47 myForceInsert(forceInsert) {
48 myJunction->incRef(
"GNEChange_TLS");
49 if (myTlDef ==
nullptr) {
52 throw ProcessError(
"If myTlDef is null, forward cannot be false");
56 if (myJunction->getNBNode()->isTLControlled()) {
58 type = (*myJunction->getNBNode()->getControllingTLS().begin())->getType();
60 myTlDef =
new NBOwnTLDef(tlID ==
"" ? myJunction->getMicrosimID() : tlID, 0, type);
66 bool forceInsert,
const std::string tlID) :
70 myForceInsert(forceInsert) {
75 throw ProcessError(
"If myTlDef is null, forward cannot be false");
91 myOldID(tlDef->getID()),
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, etc..)
bool isUndoRedoAllowed() const
const std::string getID() const
get ID (all Attribute Carriers have one)
const std::string & getTagStr() const
get tag assigned to this object in string format
GNENet * getNet() const
get pointer to net
GNEJunction * myJunction
we need the junction because it is the target of our change commands
GNEChange_TLS(GNEJunction *junction, NBTrafficLightDefinition *tlDef, bool forward, bool forceInsert=false, const std::string tlID="")
Constructor for creating/deleting a TLS.
const std::string myNewID
std::string undoName() const
return undoName
~GNEChange_TLS()
Destructor.
const std::string myOldID
variables used for renaming TLS
std::string redoName() const
get Redo name
NBTrafficLightDefinition * myTlDef
the traffic light to be created/deleted. We assume no responsibility for the pointer
const bool myForceInsert
check if forceInsert is enabled
the function-object for an editing operation (abstract base)
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag
void addTrafficLight(NBTrafficLightDefinition *tlDef, bool forceInsert)
adds a traffic light
NBNode * getNBNode() const
Return net build node.
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
removes a traffic light
void requireSaveNetwork()
inform that network has to be saved
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
GNEViewNet * getViewNet() const
get view net
void decRef(const std::string &debugMsg="")
Decrease reference.
void incRef(const std::string &debugMsg="")
Increase reference.
bool unreferenced()
check if object ins't referenced
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
bool isTLControlled() const
Returns whether this node is controlled by any tls.
A traffic light logics which must be computed (only nodes/edges are given)
The base class for traffic light logic definitions.
void rename(NBTrafficLightDefinition *tlDef, const std::string &newID)
rename traffic light
static OptionsCont & getOptions()
Retrieves the options.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
T get(const std::string &str) const