67 #include <mesogui/GUIMEVehicleControl.h> 70 #ifdef CHECK_MEMORY_LEAKS 72 #endif // CHECK_MEMORY_LEAKS 92 myLastSimDuration(0), myLastIdleDuration(0),
93 myLastVehicleMovementCount(0), myOverallVehicleCount(0), myOverallSimDuration(0) {
151 for (std::vector<MSTrafficLightLogic*>::const_iterator i = logics.begin(); i != logics.end(); ++i) {
164 if (links.size() == 0) {
171 MSTrafficLightLogic::LinkVectorVector::const_iterator j;
172 for (j = links.begin(); j != links.end(); ++j) {
173 MSTrafficLightLogic::LinkVector::const_iterator j2;
174 for (j2 = (*j).begin(); j2 != (*j).end(); ++j2) {
242 std::vector<GUIGlID> ret;
244 if (!(*i)->isInner() || includeInternal) {
245 ret.push_back((*i)->getGlID());
254 std::vector<GUIGlID> ret;
255 std::vector<std::string> ids;
257 std::string sid = (*i).second->getMicrosimID();
258 if (find(ids.begin(), ids.end(), sid) == ids.end()) {
259 ret.push_back((*i).second->getGlID());
271 for (std::vector<SumoXMLTag>::const_iterator i = types.begin(); i != types.end(); ++i) {
273 for (std::map<std::string, MSDetectorFileOutput*>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
289 for (std::map<std::string, MSJunction*>::const_iterator i = junctions.begin(); i != junctions.end(); ++i) {
293 float* cmin =
new float[2];
294 float* cmax =
new float[2];
298 const std::vector<MSLane*>& lanes = edge->
getLanes();
299 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
300 b.
add((*j)->getShape().getBoxBoundary());
311 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
433 ret->
mkItem(
"loaded vehicles [#]",
true,
435 ret->
mkItem(
"insertion-backlogged vehicles [#]",
true,
437 ret->
mkItem(
"departed vehicles [#]",
true,
439 ret->
mkItem(
"running vehicles [#]",
true,
441 ret->
mkItem(
"arrived vehicles [#]",
true,
443 ret->
mkItem(
"collisions [#]",
true,
445 ret->
mkItem(
"teleports [#]",
true,
448 ret->
mkItem(
"loaded persons [#]",
true,
450 ret->
mkItem(
"running persons [#]",
true,
452 ret->
mkItem(
"jammed persons [#]",
true,
511 throw ProcessError(
"A gui-network was not yet constructed.");
534 GUINet::getGUIMEVehicleControl() {
545 const std::vector<MSLane*>& lanes = (*i)->getLanes();
546 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
547 static_cast<GUILane*
>(*j)->updateColor(s);
552 (*i)->updateColor(s);
SUMOReal getAvgDuration() const
Boundary getBoundary() const
Returns the boundary of the junction.
Boundary myBoundary
The networks boundary.
unsigned int getLoadedPersonNumber() const
Returns the number of build Persons.
SUMOReal getHeight() const
Returns the height of the boundary.
The class responsible for building and deletion of vehicles (gui-version)
SUMOReal getWidth() const
Returns the width of the boudary.
unsigned int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
std::vector< GUIJunctionWrapper * > myJunctionWrapper
Wrapped MS-junctions.
unsigned int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
Storage for geometrical objects extended by mutexes.
SUMOReal getMeanRTFactor(int duration) const
Returns the simulation speed as a factor to real time.
friend class GUITrafficLightLogicWrapper
void unlock()
release exclusive access to the simulation state
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
SUMOReal ymin() const
Returns minimum y-coordinate.
Stores the information about how to visualize structures.
SUMOReal getAvgWaitingTime() const
LayeredRTree myGrid
The visualization speed-up.
void initTLMap()
Initialises the tl-logic map and wrappers.
SUMOReal xmin() const
Returns minimum x-coordinate.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
MSTrafficLightLogic * getActive(const std::string &id) const
Returns the active program of a named tls.
unsigned int getJammedPersonNumber() const
Returns the number of times a person was jammed.
unsigned int getRunningPersonNumber() const
Returns the number of build and inserted, but not yet deleted Persons.
MSPersonControl * myPersonControl
Controls person building and deletion;.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
void initGUIStructures()
Initialises gui wrappers.
SUMOReal getAvgDepartDelay() const
void lock()
grant exclusive access to the simulation state
unsigned int getWholeDuration() const
Returns the duration of the last step (sim+visualisation+idle) (in ms)
Links2LogicMap myLinks2Logic
The link-to-logic-id map.
Position getJunctionPosition(const std::string &name) const
returns the position of a junction
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
std::vector< GUIDetectorWrapper * > myDetectorDict
A detector dictionary.
long myOverallVehicleCount
static SUMOReal getTotalLength(bool includeInternal, bool eachLane)
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GUIGlID getGlID() const
Returns the numerical id of the object.
SUMOReal xmax() const
Returns maximum x-coordinate.
const Boundary & getBoundary() const
returns the bounder of the network
A class that stores a 2D geometrical boundary.
void setIdleDuration(int val)
Sets the duration of the last step's idle part.
The simulated network and simulation perfomer.
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
static OptionsCont & getOptions()
Retrieves the options.
Representation of a lane in the micro simulation (gui-version)
T get(const std::string &id) const
Retrieves an item.
SUMOReal getAvgRouteLength() const
unsigned int getCollisionCount() const
return the number of collisions
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Logics2WrapperMap myLogics2Wrapper
The traffic light-to-wrapper map.
A road/street connecting two junctions (gui-version)
const std::string & getID() const
Returns the id.
long long int myVehiclesMoved
The overall number of vehicle movements.
SUMOReal getUPS() const
Returns the update per seconds rate.
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
unsigned int getLoadedVehicleNo() const
Returns the number of build vehicles.
GUIGlID createTLWrapper(MSTrafficLightLogic *tll)
creates a wrapper for the given logic and returns the GlID
std::vector< GUIGlID > getJunctionIDs(bool includeInternal) const
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
unsigned int getTeleportCount() const
return the number of teleports (including collisions)
unsigned int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
A point in 2D or 3D with translation and scaling methods.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
MSDetectorControl * myDetectorControl
Controls detectors;.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
int getLinkTLIndex(MSLink *link) const
static void clearDictionary()
Clears the dictionary (the objects will not be deleted)
unsigned int size() const
Returns the number of items within the container.
std::vector< MSTrafficLightLogic * > myTLLogicWrappers
Wrapped TL-Logics.
unsigned int myLastIdleDuration
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
SUMOReal myVersion
the network version
MSContainerControl * myContainerControl
Controls container building and deletion;.
unsigned int getSimDuration() const
Returns the duration of the last step's simulation part (in ms)
const IDMap & getMyMap() const
void unlock()
release mutex lock
void setSimDuration(int val)
Sets the duration of the last step's simulation part.
static std::vector< GUIGlID > getIDs(bool includeInternal)
std::vector< GUIEdge * > myEdgeWrapper
Wrapped MS-edges.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
const std::vector< SumoXMLTag > getAvailableTypes() const
Returns the list of available detector types.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
static const SUMOReal SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk ...
void Insert(const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId)
Insert entry (delegate to appropriate layer)
GUI-version of the container control for building gui containers.
unsigned int getIdleDuration() const
Returns the duration of the last step's idle part (in ms)
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
A MSNet extended by some values for usage within the gui.
SUMOReal getMeanUPS() const
Returns the update per seconds rate.
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
long myOverallSimDuration
GUIVehicleControl * getGUIVehicleControl()
Returns the vehicle control.
std::vector< GUIGlID > getTLSIDs() const
Returns the gl-ids of all traffic light logics within the net.
bool vehicleExists(const std::string &name) const
returns the information whether the vehicle still exists
unsigned int getEndedVehicleNo() const
Returns the number of removed vehicles.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
unsigned int myLastSimDuration
The step durations (simulation, /*visualisation, */idle)
unsigned int getLinkTLID(MSLink *link) const
static void updateAll()
Updates all instances.
The parent class for traffic light logics.
SUMOReal getRTFactor() const
Returns the simulation speed as a factor to real time.
static void updateAll()
Updates all instances (passes values)
GUI-version of the person control for building gui persons.
SUMOReal ymax() const
Returns maximum y-coordinate.
void simulationStep()
Performs a single simulation step (locking the simulation)
bool logSimulationDuration() const
Returns whether duration shall be logged.
The class responsible for building and deletion of vehicles.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
void simulationStep()
Performs a single simulation step.
The edge is an internal edge.
GUINet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents)
Constructor.
void guiSimulationStep()
Some further steps needed for gui processing.
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
void closeBuilding()
Closes the building of the table.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
MSContainerControl & getContainerControl()
Returns the container control.
A window containing a gl-object's parameter.
Stores time-dependant events and executes them at the proper time.
static void fill(std::vector< GUIEdge * > &netsWrappers)
long myLastVehicleMovementCount
SUMOReal getAvgTimeLoss() const
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const Position & getPosition() const
MSPersonControl & getPersonControl()
Returns the person control.
Class passing values from a GUIGlObject to another object.