Eclipse SUMO - Simulation of Urban MObility
|
A storage for of displayed objects via their numerical id. More...
#include <GUIGlObjectStorage.h>
Public Member Functions | |
void | changeName (GUIGlObject *object, const std::string &fullName) |
void | clear () |
Clears this container. | |
const std::vector< GUIGlObject * > & | getAllGLObjects () const |
Returns the set of all known objects. | |
GUIGlObject * | getNetObject () const |
Returns the network object. | |
GUIGlObject * | getObjectBlocking (const std::string &fullName) const |
Returns the object from the container locking it. | |
GUIGlObject * | getObjectBlocking (GUIGlID id) const |
Returns the object from the container locking it. | |
GUIGlObjectStorage () | |
Constructor. | |
GUIGlID | registerObject (GUIGlObject *object) |
Registers an object. | |
bool | remove (GUIGlID id) |
Removes the named object from this container. | |
void | setNetObject (GUIGlObject *object) |
Sets the given object as the "network" object. | |
void | unblockObject (GUIGlID id) |
Marks an object as unblocked. | |
~GUIGlObjectStorage () | |
Destructor. | |
Static Public Attributes | |
static GUIGlObjectStorage | gIDStorage |
A single static instance of this class. | |
Private Member Functions | |
GUIGlObjectStorage (const GUIGlObjectStorage &s)=delete | |
invalidated copy constructor | |
GUIGlObjectStorage & | operator= (const GUIGlObjectStorage &s)=delete |
invalidate assignment operator | |
Private Attributes | |
std::map< std::string, GUIGlObject * > | myFullNameMap |
The known objects by their full name. | |
FXMutex | myLock |
A lock to avoid parallel access on the storages. | |
GUIGlObject * | myNetObject |
The network object. | |
GUIGlID | myNextID |
The next id to give; initially one, increased by one with each object registration. | |
std::vector< GUIGlObject * > | myObjects |
The known objects. | |
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 49 of file GUIGlObjectStorage.h.
GUIGlObjectStorage::GUIGlObjectStorage | ( | ) |
GUIGlObjectStorage::~GUIGlObjectStorage | ( | ) |
Destructor.
Definition at line 46 of file GUIGlObjectStorage.cpp.
|
privatedelete |
invalidated copy constructor
void GUIGlObjectStorage::changeName | ( | GUIGlObject * | object, |
const std::string & | fullName | ||
) |
Definition at line 66 of file GUIGlObjectStorage.cpp.
References myFullNameMap, and myLock.
Referenced by GUIGlObject::GUIGlObject(), and GUIGlObject::setMicrosimID().
void GUIGlObjectStorage::clear | ( | ) |
Clears this container.
The objects are not deleted.
Definition at line 113 of file GUIGlObjectStorage.cpp.
References myFullNameMap, myLock, myNextID, and myObjects.
Referenced by GUIRunThread::deleteSim().
const std::vector< GUIGlObject * > & GUIGlObjectStorage::getAllGLObjects | ( | ) | const |
Returns the set of all known objects.
Definition at line 132 of file GUIGlObjectStorage.cpp.
References myObjects.
Referenced by GNESelectorFrame::SelectionOperation::loadFromFile().
|
inline |
Returns the network object.
Definition at line 124 of file GUIGlObjectStorage.h.
References myNetObject.
Referenced by GUISUMOAbstractView::openObjectDialogAtCursor().
GUIGlObject * GUIGlObjectStorage::getObjectBlocking | ( | const std::string & | fullName | ) | const |
Returns the object from the container locking it.
The lock prevents the object from being deleted while it is accessed.
[in] | id | The id of the object to return |
Definition at line 86 of file GUIGlObjectStorage.cpp.
References myFullNameMap, myLock, and GUIGlObject::setBlocked().
GUIGlObject * GUIGlObjectStorage::getObjectBlocking | ( | GUIGlID | id | ) | const |
Returns the object from the container locking it.
The lock prevents the object from being deleted while it is accessed.
[in] | id | The id of the object to return |
Definition at line 74 of file GUIGlObjectStorage.cpp.
References myLock, myObjects, and GUIGlObject::setBlocked().
Referenced by GUISUMOAbstractView::centerTo(), GUISelectedStorage::deselect(), GUIMessageWindow::getActiveStringObject(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GUIViewTraffic::getLaneUnderCursor(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GUISelectedStorage::loadIDs(), GUIDialog_ChooserAbstract::onCmdLocateByName(), GUISUMOViewParent::onCmdSpeedFactor(), GUIDialog_ChooserAbstract::onCmdTrack(), GNEViewNet::onCmdTransformPOI(), GUIViewTraffic::onGamingClick(), GUIViewTraffic::onGamingRightClick(), GUISUMOAbstractView::onLeftBtnPress(), GUISUMOViewParent::onUpdSpeedFactor(), GUIDialog_GLChosenEditor::rebuildList(), GUIDialog_ChooserAbstract::refreshList(), GNENetHelper::AttributeCarriers::retrieveAttributeCarrier(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUISUMOAbstractView::showToolTipFor(), GUIViewTraffic::startTrack(), and GUISelectedStorage::toggleSelection().
|
privatedelete |
invalidate assignment operator
GUIGlID GUIGlObjectStorage::registerObject | ( | GUIGlObject * | object | ) |
Registers an object.
This is done within the constructor of the GUIGlObject. The next free id is calculated as well.
[in] | object | The object to register |
Definition at line 50 of file GUIGlObjectStorage.cpp.
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 99 of file GUIGlObjectStorage.cpp.
References myFullNameMap, myLock, myNextID, and myObjects.
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 117 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 123 of file GUIGlObjectStorage.cpp.
References myLock, and myObjects.
Referenced by GUIMessageWindow::appendMsg(), GUISUMOAbstractView::centerTo(), GUISelectedStorage::deselect(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GUIViewTraffic::onCmdAddRerouter(), GUIViewTraffic::onCmdCloseEdge(), GUIViewTraffic::onCmdCloseLane(), GUIDialog_ChooserAbstract::onCmdLocateByName(), GUIDialog_ChooserAbstract::onCmdTrack(), GUIViewTraffic::onGamingClick(), GUIViewTraffic::onGamingRightClick(), GUIDialog_GLChosenEditor::rebuildList(), GUIDialog_ChooserAbstract::refreshList(), GNENetHelper::AttributeCarriers::retrieveAttributeCarrier(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUIMessageWindow::setCursorPos(), and GUISelectedStorage::toggleSelection().
|
static |
A single static instance of this class.
Definition at line 129 of file GUIGlObjectStorage.h.
Referenced by GUIMessageWindow::appendMsg(), GUISUMOAbstractView::centerTo(), GUIRunThread::deleteSim(), GUISelectedStorage::deselect(), GUIMessageWindow::getActiveStringObject(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GUIViewTraffic::getLaneUnderCursor(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GNENet::GNENet(), GUIGlObject::GUIGlObject(), GUINet::GUINet(), GNESelectorFrame::SelectionOperation::loadFromFile(), GUISelectedStorage::loadIDs(), GUIViewTraffic::onCmdAddRerouter(), GUIViewTraffic::onCmdCloseEdge(), GUIViewTraffic::onCmdCloseLane(), GUISUMOViewParent::onCmdLocate(), GUIDialog_ChooserAbstract::onCmdLocateByName(), GUISUMOViewParent::onCmdSpeedFactor(), GUIDialog_ChooserAbstract::onCmdTrack(), GNEViewNet::onCmdTransformPOI(), GUIViewTraffic::onGamingClick(), GUIViewTraffic::onGamingRightClick(), GUISUMOAbstractView::onLeftBtnPress(), GUISUMOViewParent::onUpdSpeedFactor(), GUISUMOAbstractView::openObjectDialogAtCursor(), GUIDialog_GLChosenEditor::rebuildList(), GUIDialog_ChooserAbstract::refreshList(), GNENetHelper::AttributeCarriers::retrieveAttributeCarrier(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUIMessageWindow::setCursorPos(), GUIGlObject::setMicrosimID(), GUISUMOAbstractView::showToolTipFor(), GUIViewTraffic::startTrack(), GUISelectedStorage::toggleSelection(), and GUIGlObject::~GUIGlObject().
|
private |
The known objects by their full name.
Definition at line 139 of file GUIGlObjectStorage.h.
Referenced by changeName(), clear(), getObjectBlocking(), and remove().
|
mutableprivate |
A lock to avoid parallel access on the storages.
Definition at line 145 of file GUIGlObjectStorage.h.
Referenced by changeName(), clear(), getObjectBlocking(), getObjectBlocking(), registerObject(), remove(), and unblockObject().
|
private |
The network object.
Definition at line 148 of file GUIGlObjectStorage.h.
Referenced by getNetObject(), and setNetObject().
|
private |
The next id to give; initially one, increased by one with each object registration.
Definition at line 142 of file GUIGlObjectStorage.h.
Referenced by clear(), registerObject(), and remove().
|
private |
The known objects.
Definition at line 136 of file GUIGlObjectStorage.h.
Referenced by clear(), getAllGLObjects(), getObjectBlocking(), GUIGlObjectStorage(), registerObject(), remove(), and unblockObject().