Eclipse SUMO - Simulation of Urban MObility
GNEChange_TLS Class Reference

#include <GNEChange_TLS.h>

Inheritance diagram for GNEChange_TLS:
[legend]
Collaboration diagram for GNEChange_TLS:
[legend]

Public Member Functions

 GNEChange_TLS (GNEJunction *junction, NBTrafficLightDefinition *tlDef, bool forward, bool forceInsert=false, const std::string tlID="")
 Constructor for creating/deleting a TLS. More...
 
 GNEChange_TLS (GNEJunction *junction, NBTrafficLightDefinition *tlDef, bool forward, TrafficLightType type, bool forceInsert=false, const std::string tlID="")
 Constructor for creating/deleting a TLS. More...
 
 GNEChange_TLS (GNEJunction *junction, NBTrafficLightDefinition *tlDef, const std::string &newID)
 Constructor for renaming a TLS. More...
 
 ~GNEChange_TLS ()
 Destructor. More...
 
inherited from GNEChange

get undo Name

std::string undoName () const
 return undoName More...
 
std::string redoName () const
 get Redo name More...
 
void undo ()
 undo action More...
 
void redo ()
 redo action More...
 

Private Attributes

const bool myForceInsert
 check if forceInsert is enabled More...
 
GNEJunctionmyJunction
 we need the junction because it is the target of our change commands More...
 
const std::string myNewID
 
const std::string myOldID
 variables used for renaming TLS More...
 
NBTrafficLightDefinitionmyTlDef
 the traffic light to be created/deleted. We assume no responsibility for the pointer More...
 

friend class

GNEChangenext
 
virtual int size () const
 Return the size of the command group. More...
 
Supermode getSupermode () const
 get supermode More...
 
bool canMerge () const
 Return TRUE if this command can be merged with previous undo commands. This is useful to combine e.g. multiple consecutive single-character text changes into a single block change. The default implementation returns FALSE. More...
 
bool mergeWith (GNEChange *command)
 Called by the undo system to try and merge the new incoming command with this command; should return TRUE if merging was possible. The default implementation returns FALSE. More...
 
const Supermode mySupermode
 supermode related with this change More...
 
bool myForward
 we group antagonistic commands (create junction/delete junction) and keep them apart by this flag More...
 
const bool mySelectedElement
 flag for check if element is selected More...
 
const GNEHierarchicalContainer myOriginalHierarchicalContainer
 Hierarchical container with parent and children. More...
 
std::map< GNEHierarchicalElement *, GNEHierarchicalContainermyHierarchicalContainers
 map with hierarchical container of all parent and children elements More...
 
void restoreHierarchicalContainers ()
 restore container (only use in undo() function) More...
 
template<typename T >
void addElementInParentsAndChildren (T *element)
 add given element into parents and children (only use in redo() function) More...
 
template<typename T >
void removeElementFromParentsAndChildren (T *element)
 remove given element from parents and children (only use in redo() function) More...
 

Detailed Description

A network change in which a traffic light is created or deleted

Definition at line 34 of file GNEChange_TLS.h.

Constructor & Destructor Documentation

◆ GNEChange_TLS() [1/3]

GNEChange_TLS::GNEChange_TLS ( GNEJunction junction,
NBTrafficLightDefinition tlDef,
bool  forward,
bool  forceInsert = false,
const std::string  tlID = "" 
)

Constructor for creating/deleting a TLS.

constructor for creating an edge

Parameters
[in]junctionThe junction to which the traffic light belong
[in]tlDefThe traffic light definition (may be 0 on creation)
[in]forwardWhether to create/delete (true/false)
[in]tlIDThe id for the newly created tlDef (set to junction id if * "" is given)

Definition at line 41 of file GNEChange_TLS.cpp.

◆ GNEChange_TLS() [2/3]

GNEChange_TLS::GNEChange_TLS ( GNEJunction junction,
NBTrafficLightDefinition tlDef,
bool  forward,
TrafficLightType  type,
bool  forceInsert = false,
const std::string  tlID = "" 
)

Constructor for creating/deleting a TLS.

Parameters
[in]junctionThe junction to which the traffic light belong
[in]tlDefThe traffic light definition (may be 0 on creation)
[in]forwardWhether to create/delete (true/false)
[in]tlIDThe id for the newly created tlDef (set to junction id if * "" is given)
[in]typeTrafficLightType

Definition at line 63 of file GNEChange_TLS.cpp.

References NBNode::getControllingTLS(), GUIGlObject::getMicrosimID(), GNEJunction::getNBNode(), GNEReferenceCounter::incRef(), NBNode::isTLControlled(), myJunction, myTlDef, and NETWORK.

◆ GNEChange_TLS() [3/3]

GNEChange_TLS::GNEChange_TLS ( GNEJunction junction,
NBTrafficLightDefinition tlDef,
const std::string &  newID 
)

Constructor for renaming a TLS.

Parameters
[in]junctionThe junction to which the traffic light belong
[in]tlDefThe traffic light definition (may be 0 on creation)
[in]newIDnew TL ID

Definition at line 84 of file GNEChange_TLS.cpp.

References GNEReferenceCounter::incRef(), myJunction, and NETWORK.

◆ ~GNEChange_TLS()

Member Function Documentation

◆ addElementInParentsAndChildren()

template<typename T >
void GNEChange::addElementInParentsAndChildren ( T *  element)
inlineprotectedinherited

add given element into parents and children (only use in redo() function)

Definition at line 124 of file GNEChange.h.

References GNEHierarchicalContainer::getChildren(), GNEHierarchicalContainer::getParents(), and GNEChange::myOriginalHierarchicalContainer.

Referenced by GNEChange_Additional::redo(), GNEChange_DemandElement::redo(), GNEChange_Edge::redo(), GNEChange_GenericData::redo(), and GNEChange_Lane::redo().

Here is the caller graph for this function:

◆ canMerge()

bool GNEChange::canMerge ( ) const
inherited

Return TRUE if this command can be merged with previous undo commands. This is useful to combine e.g. multiple consecutive single-character text changes into a single block change. The default implementation returns FALSE.

Definition at line 74 of file GNEChange.cpp.

Referenced by GNEUndoList::add().

Here is the caller graph for this function:

◆ getSupermode()

Supermode GNEChange::getSupermode ( ) const
inherited

get supermode

Definition at line 68 of file GNEChange.cpp.

References GNEChange::mySupermode.

Referenced by GNEUndoList::getRedoSupermode(), and GNEUndoList::getUndoSupermode().

Here is the caller graph for this function:

◆ mergeWith()

bool GNEChange::mergeWith ( GNEChange command)
inherited

Called by the undo system to try and merge the new incoming command with this command; should return TRUE if merging was possible. The default implementation returns FALSE.

Definition at line 80 of file GNEChange.cpp.

Referenced by GNEUndoList::add().

Here is the caller graph for this function:

◆ redo()

◆ redoName()

std::string GNEChange_TLS::redoName ( ) const
virtual

get Redo name

Implements GNEChange.

Definition at line 180 of file GNEChange_TLS.cpp.

References GNEAttributeCarrier::getID(), GNEChange::myForward, myJunction, and TL.

◆ removeElementFromParentsAndChildren()

template<typename T >
void GNEChange::removeElementFromParentsAndChildren ( T *  element)
inlineprotectedinherited

remove given element from parents and children (only use in redo() function)

Definition at line 167 of file GNEChange.h.

References GNEHierarchicalContainer::getChildren(), GNEHierarchicalContainer::getParents(), and GNEChange::myOriginalHierarchicalContainer.

Referenced by GNEChange_Additional::redo(), GNEChange_DemandElement::redo(), GNEChange_Edge::redo(), GNEChange_GenericData::redo(), and GNEChange_Lane::redo().

Here is the caller graph for this function:

◆ restoreHierarchicalContainers()

void GNEChange::restoreHierarchicalContainers ( )
protectedinherited

restore container (only use in undo() function)

Definition at line 94 of file GNEChange.cpp.

References GNEChange::myHierarchicalContainers.

Referenced by GNEChange_Additional::undo(), GNEChange_DemandElement::undo(), GNEChange_Edge::undo(), GNEChange_GenericData::undo(), and GNEChange_Lane::undo().

Here is the caller graph for this function:

◆ size()

int GNEChange::size ( ) const
virtualinherited

Return the size of the command group.

Reimplemented in GNEChangeGroup.

Definition at line 61 of file GNEChange.cpp.

Referenced by GNEChangeGroup::size().

Here is the caller graph for this function:

◆ undo()

◆ undoName()

std::string GNEChange_TLS::undoName ( ) const
virtual

return undoName

Implements GNEChange.

Definition at line 170 of file GNEChange_TLS.cpp.

References GNEAttributeCarrier::getID(), GNEChange::myForward, myJunction, and TL.

Field Documentation

◆ myForceInsert

const bool GNEChange_TLS::myForceInsert
private

check if forceInsert is enabled

Definition at line 94 of file GNEChange_TLS.h.

Referenced by redo(), and undo().

◆ myForward

bool GNEChange::myForward
protectedinherited

we group antagonistic commands (create junction/delete junction) and keep them apart by this flag

Definition at line 212 of file GNEChange.h.

Referenced by GNEChange_Additional::redo(), GNEChange_Children::redo(), GNEChange_Connection::redo(), GNEChange_Crossing::redo(), GNEChange_DataInterval::redo(), GNEChange_DataSet::redo(), GNEChange_DemandElement::redo(), GNEChange_Edge::redo(), GNEChange_EdgeType::redo(), GNEChange_GenericData::redo(), GNEChange_Junction::redo(), GNEChange_Lane::redo(), GNEChange_MeanData::redo(), redo(), GNEChange_Additional::redoName(), GNEChange_Children::redoName(), GNEChange_Connection::redoName(), GNEChange_Crossing::redoName(), GNEChange_DataInterval::redoName(), GNEChange_DataSet::redoName(), GNEChange_DemandElement::redoName(), GNEChange_Edge::redoName(), GNEChange_EdgeType::redoName(), GNEChange_GenericData::redoName(), GNEChange_Junction::redoName(), GNEChange_Lane::redoName(), GNEChange_MeanData::redoName(), redoName(), GNEChange_Additional::undo(), GNEChange_Children::undo(), GNEChange_Connection::undo(), GNEChange_Crossing::undo(), GNEChange_DataInterval::undo(), GNEChange_DataSet::undo(), GNEChange_DemandElement::undo(), GNEChange_Edge::undo(), GNEChange_EdgeType::undo(), GNEChange_GenericData::undo(), GNEChange_Junction::undo(), GNEChange_Lane::undo(), GNEChange_MeanData::undo(), undo(), GNEChange_Additional::undoName(), GNEChange_Children::undoName(), GNEChange_Connection::undoName(), GNEChange_Crossing::undoName(), GNEChange_DataInterval::undoName(), GNEChange_DataSet::undoName(), GNEChange_DemandElement::undoName(), GNEChange_Edge::undoName(), GNEChange_EdgeType::undoName(), GNEChange_GenericData::undoName(), GNEChange_Junction::undoName(), GNEChange_Lane::undoName(), GNEChange_MeanData::undoName(), and undoName().

◆ myHierarchicalContainers

std::map<GNEHierarchicalElement*, GNEHierarchicalContainer> GNEChange::myHierarchicalContainers
protectedinherited

map with hierarchical container of all parent and children elements

Definition at line 221 of file GNEChange.h.

Referenced by GNEChange::GNEChange(), and GNEChange::restoreHierarchicalContainers().

◆ myJunction

GNEJunction* GNEChange_TLS::myJunction
private

we need the junction because it is the target of our change commands

Note
we assume shared responsibilty for the junction via reference counting

Definition at line 86 of file GNEChange_TLS.h.

Referenced by GNEChange_TLS(), redo(), redoName(), undo(), undoName(), and ~GNEChange_TLS().

◆ myNewID

const std::string GNEChange_TLS::myNewID
private

Definition at line 98 of file GNEChange_TLS.h.

Referenced by redo(), and undo().

◆ myOldID

const std::string GNEChange_TLS::myOldID
private

variables used for renaming TLS

Definition at line 97 of file GNEChange_TLS.h.

Referenced by redo(), and undo().

◆ myOriginalHierarchicalContainer

const GNEHierarchicalContainer GNEChange::myOriginalHierarchicalContainer
protectedinherited

◆ mySelectedElement

◆ mySupermode

const Supermode GNEChange::mySupermode
protectedinherited

supermode related with this change

Definition at line 209 of file GNEChange.h.

Referenced by GNEChange::getSupermode().

◆ myTlDef

NBTrafficLightDefinition* GNEChange_TLS::myTlDef
private

the traffic light to be created/deleted. We assume no responsibility for the pointer

Note
since it is hard to track by which NBnodes a tlDef is used (may be more than one).

Definition at line 91 of file GNEChange_TLS.h.

Referenced by GNEChange_TLS(), redo(), and undo().

◆ next


The documentation for this class was generated from the following files: