![]() |
Eclipse SUMO - Simulation of Urban MObility
|
A storage for of displayed objects via their numerical id. More...
#include <GUIGlObjectStorage.h>
Public Member Functions | |
void | clear () |
Clears this container. More... | |
std::set< GUIGlID > | getAllIDs () const |
Returns the set of all known ids. More... | |
GUIGlObject * | getNetObject () const |
Returns the network object. More... | |
GUIGlObject * | getObjectBlocking (const std::string &fullName) |
Returns the object from the container locking it. More... | |
GUIGlObject * | getObjectBlocking (GUIGlID id) |
Returns the object from the container locking it. More... | |
GUIGlObjectStorage () | |
Constructor. More... | |
GUIGlID | registerObject (GUIGlObject *object, const std::string &fullName) |
Registers an object. More... | |
bool | remove (GUIGlID id) |
Removes the named object from this container. More... | |
void | setNetObject (GUIGlObject *object) |
Sets the given object as the "network" object. More... | |
void | unblockObject (GUIGlID id) |
Marks an object as unblocked. More... | |
~GUIGlObjectStorage () | |
Destructor. More... | |
Static Public Attributes | |
static GUIGlObjectStorage | gIDStorage |
A single static instance of this class. More... | |
Private Types | |
typedef std::map< GUIGlID, GUIGlObject * > | ObjectMap |
Definition of a container from numerical ids to objects. More... | |
Private Member Functions | |
GUIGlObjectStorage (const GUIGlObjectStorage &s) | |
invalidated copy constructor More... | |
GUIGlObjectStorage & | operator= (const GUIGlObjectStorage &s) |
invalidate assignment operator More... | |
Private Attributes | |
ObjectMap | my2Delete |
Objects to delete. More... | |
GUIGlID | myAktID |
The next id to give; initially zero, increased by one with each object registration. More... | |
ObjectMap | myBlocked |
The currently accessed objects. More... | |
std::map< std::string, GUIGlObject * > | myFullNameMap |
FXMutex | myLock |
A lock to avoid parallel access on the storages. More... | |
ObjectMap | myMap |
The known objects which are not accessed currently. More... | |
GUIGlObject * | myNetObject |
The network object. More... | |
A storage for of displayed objects via their numerical id.
This is a container for GUIGlObject - objects, which may be displayed and due to this may generate tooltips or be grapped in other ways.
As in case of vehicles (other, later implemented objects may have this property, too) they may be deleted by the simulation while being accessed
Definition at line 51 of file GUIGlObjectStorage.h.
|
private |
Definition of a container from numerical ids to objects.
Definition at line 149 of file GUIGlObjectStorage.h.
GUIGlObjectStorage::GUIGlObjectStorage | ( | ) |
Constructor.
Definition at line 42 of file GUIGlObjectStorage.cpp.
GUIGlObjectStorage::~GUIGlObjectStorage | ( | ) |
Destructor.
Definition at line 48 of file GUIGlObjectStorage.cpp.
|
private |
invalidated copy constructor
void GUIGlObjectStorage::clear | ( | ) |
Clears this container.
The objects are not deleted.
Definition at line 111 of file GUIGlObjectStorage.cpp.
References myAktID, myLock, and myMap.
Referenced by GUIRunThread::deleteSim().
std::set< GUIGlID > GUIGlObjectStorage::getAllIDs | ( | ) | const |
Returns the set of all known ids.
Definition at line 132 of file GUIGlObjectStorage.cpp.
|
inline |
Returns the network object.
Definition at line 133 of file GUIGlObjectStorage.h.
References myNetObject.
Referenced by GNEViewNet::openObjectDialog(), and GUISUMOAbstractView::openObjectDialog().
GUIGlObject * GUIGlObjectStorage::getObjectBlocking | ( | const std::string & | fullName | ) |
Returns the object from the container locking it.
The lock prevents the object from being deleted while it is accessed. The object is moved from "myMap" to "myBlocked".
[in] | id | The id of the object to return |
Definition at line 81 of file GUIGlObjectStorage.cpp.
References getObjectBlocking(), myFullNameMap, and myLock.
GUIGlObject * GUIGlObjectStorage::getObjectBlocking | ( | GUIGlID | id | ) |
Returns the object from the container locking it.
The lock prevents the object from being deleted while it is accessed. The object is moved from "myMap" to "myBlocked".
[in] | id | The id of the object to return |
Definition at line 62 of file GUIGlObjectStorage.cpp.
References myBlocked, myLock, and myMap.
Referenced by GUISUMOAbstractView::centerTo(), GUISelectedStorage::deselect(), GUIMessageWindow::getActiveStringObject(), GNEViewNet::getAdditionalAtPopupPosition(), GNEViewNet::getConnectionAtPopupPosition(), GNEViewNet::getCrossingAtPopupPosition(), GNEViewNet::getEdgeAtPopupPosition(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GNEViewNet::getJunctionAtPopupPosition(), GNEViewNet::getLaneAtPopupPosition(), GUIViewTraffic::getLaneUnderCursor(), GUISUMOAbstractView::getObjectAtPosition(), getObjectBlocking(), GUISUMOAbstractView::getObjectsAtPosition(), GNEViewNet::getPOIAtPopupPosition(), GNEViewNet::getPolygonAtPopupPosition(), GUISelectedStorage::loadIDs(), GNEViewNet::mergeJunctions(), GNESelectorFrame::SelectionOperation::onCmdLoad(), GUIDialog_GLObjChooser::onCmdLocateByName(), GUISUMOViewParent::onCmdSpeedFactor(), GUIDialog_GLObjChooser::onCmdTrack(), GUISUMOAbstractView::onLeftBtnPress(), GUISUMOViewParent::onUpdSpeedFactor(), GNEViewNet::openObjectDialog(), GUISUMOAbstractView::openObjectDialog(), GUIDialog_GLChosenEditor::rebuildList(), GUIDialog_GLObjChooser::refreshList(), GNENet::retrieveAttributeCarrier(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUISUMOAbstractView::showToolTipFor(), and GUISelectedStorage::toggleSelection().
|
private |
invalidate assignment operator
GUIGlID GUIGlObjectStorage::registerObject | ( | GUIGlObject * | object, |
const std::string & | fullName | ||
) |
Registers an object.
This done within the constructor of the GUIGlObject; The object's "setGLID" method is called giving the next free id.
[in] | object | The object to register |
[in] | fullName | The full name of the object to register |
Definition at line 52 of file GUIGlObjectStorage.cpp.
References myAktID, myFullNameMap, myLock, and myMap.
Referenced by GUIGlObject::GUIGlObject().
bool GUIGlObjectStorage::remove | ( | GUIGlID | id | ) |
Removes the named object from this container.
This function returns true if the object may be deleted; otherwise it's kept in an internal storage (for visualisation etc.) and will be removed by this class
[in] | id | The id of the object to remove |
Definition at line 92 of file GUIGlObjectStorage.cpp.
References my2Delete, myBlocked, myFullNameMap, myLock, and myMap.
Referenced by GUIGlObject::~GUIGlObject().
|
inline |
Sets the given object as the "network" object.
[in] | object | The object to set as network object |
Definition at line 125 of file GUIGlObjectStorage.h.
References myNetObject.
Referenced by GNENet::GNENet(), and GUINet::GUINet().
void GUIGlObjectStorage::unblockObject | ( | GUIGlID | id | ) |
Marks an object as unblocked.
The object is moved from "myBlocked" to "myMap".
[in] | id | The id of the object to unblock |
Definition at line 119 of file GUIGlObjectStorage.cpp.
References myBlocked, myLock, and myMap.
Referenced by GUIMessageWindow::appendMsg(), GUISUMOAbstractView::centerTo(), GUISelectedStorage::deselect(), GNEViewNet::getAdditionalAtPopupPosition(), GNEViewNet::getConnectionAtPopupPosition(), GNEViewNet::getCrossingAtPopupPosition(), GNEViewNet::getEdgeAtPopupPosition(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GNEViewNet::getJunctionAtPopupPosition(), GNEViewNet::getLaneAtPopupPosition(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GNEViewNet::getPOIAtPopupPosition(), GNEViewNet::getPolygonAtPopupPosition(), GNEViewNet::mergeJunctions(), GUIViewTraffic::onCmdAddRerouter(), GNEViewNet::onCmdAddSelected(), GUIViewTraffic::onCmdCloseEdge(), GUIViewTraffic::onCmdCloseLane(), GUIDialog_GLObjChooser::onCmdLocateByName(), GNEViewNet::onCmdRemoveSelected(), GUIDialog_GLObjChooser::onCmdTrack(), GUIViewTraffic::onGamingClick(), GUIViewTraffic::onGamingRightClick(), GNEViewNet::openObjectDialog(), GUISUMOAbstractView::openObjectDialog(), TraCIServerAPI_GUI::processGet(), GUIDialog_GLChosenEditor::rebuildList(), GUIDialog_GLObjChooser::refreshList(), GNENet::retrieveAttributeCarrier(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUIMessageWindow::setCursorPos(), GUISUMOAbstractView::showToolTipFor(), and GUISelectedStorage::toggleSelection().
|
static |
A single static instance of this class.
Definition at line 140 of file GUIGlObjectStorage.h.
Referenced by GUIMessageWindow::appendMsg(), GUISUMOAbstractView::centerTo(), GUIRunThread::deleteSim(), GUISelectedStorage::deselect(), GUIMessageWindow::getActiveStringObject(), GNEViewNet::getAdditionalAtPopupPosition(), GNEViewNet::getConnectionAtPopupPosition(), GNEViewNet::getCrossingAtPopupPosition(), GNEViewNet::getEdgeAtPopupPosition(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GNEViewNet::getJunctionAtPopupPosition(), GNEViewNet::getLaneAtPopupPosition(), GUIViewTraffic::getLaneUnderCursor(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GNEViewNet::getPOIAtPopupPosition(), GNEViewNet::getPolygonAtPopupPosition(), GNENet::GNENet(), GUIGlObject::GUIGlObject(), GUINet::GUINet(), GUISelectedStorage::loadIDs(), GNEViewNet::mergeJunctions(), GUIViewTraffic::onCmdAddRerouter(), GNEViewNet::onCmdAddSelected(), GUIViewTraffic::onCmdCloseEdge(), GUIViewTraffic::onCmdCloseLane(), GNESelectorFrame::SelectionOperation::onCmdLoad(), GUISUMOViewParent::onCmdLocate(), GUIDialog_GLObjChooser::onCmdLocateByName(), GNEViewNet::onCmdRemoveSelected(), GUISUMOViewParent::onCmdSpeedFactor(), GUIDialog_GLObjChooser::onCmdTrack(), GNEViewNet::onCmdTransformPOI(), GUIViewTraffic::onGamingClick(), GUIViewTraffic::onGamingRightClick(), GUISUMOAbstractView::onLeftBtnPress(), GUISUMOViewParent::onUpdSpeedFactor(), GNEViewNet::openObjectDialog(), GUISUMOAbstractView::openObjectDialog(), TraCIServerAPI_GUI::processGet(), GUIDialog_GLChosenEditor::rebuildList(), GUIDialog_GLObjChooser::refreshList(), GNENet::retrieveAttributeCarrier(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUIMessageWindow::setCursorPos(), GUISUMOAbstractView::showToolTipFor(), GUISelectedStorage::toggleSelection(), and GUIGlObject::~GUIGlObject().
|
private |
|
private |
The next id to give; initially zero, increased by one with each object registration.
Definition at line 165 of file GUIGlObjectStorage.h.
Referenced by clear(), and registerObject().
|
private |
The currently accessed objects.
Definition at line 159 of file GUIGlObjectStorage.h.
Referenced by getObjectBlocking(), remove(), and unblockObject().
|
private |
Definition at line 156 of file GUIGlObjectStorage.h.
Referenced by getObjectBlocking(), registerObject(), and remove().
|
mutableprivate |
A lock to avoid parallel access on the storages.
Definition at line 168 of file GUIGlObjectStorage.h.
Referenced by clear(), getAllIDs(), getObjectBlocking(), registerObject(), remove(), and unblockObject().
|
private |
The known objects which are not accessed currently.
Definition at line 152 of file GUIGlObjectStorage.h.
Referenced by clear(), getAllIDs(), getObjectBlocking(), registerObject(), remove(), and unblockObject().
|
private |
The network object.
Definition at line 171 of file GUIGlObjectStorage.h.
Referenced by getNetObject(), and setNetObject().