82 myLastSimDuration(0), myLastIdleDuration(0),
83 myLastVehicleMovementCount(0), myOverallVehicleCount(0), myOverallSimDuration(0) {
142 for (std::vector<MSTrafficLightLogic*>::const_iterator i = logics.begin(); i != logics.end(); ++i) {
155 if (links.size() == 0) {
162 MSTrafficLightLogic::LinkVectorVector::const_iterator j;
163 for (j = links.begin(); j != links.end(); ++j) {
164 MSTrafficLightLogic::LinkVector::const_iterator j2;
165 for (j2 = (*j).begin(); j2 != (*j).end(); ++j2) {
225 FXMutexLock locker(
myLock);
232 std::vector<GUIGlID> ret;
234 if (!(*i)->isInternal() || includeInternal) {
235 ret.push_back((*i)->getGlID());
244 std::vector<GUIGlID> ret;
245 std::vector<std::string> ids;
247 std::string sid = (*i).second->getMicrosimID();
248 if (find(ids.begin(), ids.end(), sid) == ids.end()) {
249 ret.push_back((*i).second->getGlID());
261 for (std::vector<SumoXMLTag>::const_iterator i = types.begin(); i != types.end(); ++i) {
264 if (wrapper !=
nullptr) {
275 for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
277 if (!(*i)->isTazConnector() || (*i)->getLanes().size() > 0) {
284 std::map<MSJunction*, std::string> junction2TLL;
286 for (
const auto& links : tls->getLinks()) {
287 for (
const MSLink* l : links) {
288 junction2TLL[l->getJunction()] = l->getTLLogic()->getID();
299 const std::vector<MSLane*>& lanes = edge->
getLanes();
300 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
301 b.
add((*j)->getShape().getBoxBoundary());
305 const float cmin[2] = { (float)b.
xmin(), (float)b.
ymin() };
306 const float cmax[2] = { (float)b.
xmax(), (float)b.
ymax() };
310 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
317 const float cmin[2] = { (float)b.
xmin(), (float)b.
ymin() };
318 const float cmax[2] = { (float)b.
xmax(), (float)b.
ymax() };
428 ret->
mkItem(
"loaded vehicles [#]",
true,
430 ret->
mkItem(
"insertion-backlogged vehicles [#]",
true,
432 ret->
mkItem(
"departed vehicles [#]",
true,
434 ret->
mkItem(
"running vehicles [#]",
true,
436 ret->
mkItem(
"arrived vehicles [#]",
true,
438 ret->
mkItem(
"discarded vehicles [#]",
true,
440 ret->
mkItem(
"collisions [#]",
true,
442 ret->
mkItem(
"teleports [#]",
true,
444 ret->
mkItem(
"halting [#]",
true,
446 ret->
mkItem(
"avg. speed [m/s]",
true,
448 ret->
mkItem(
"avg. relative speed",
true,
451 ret->
mkItem(
"loaded persons [#]",
true,
453 ret->
mkItem(
"running persons [#]",
true,
455 ret->
mkItem(
"jammed persons [#]",
true,
518 if (net !=
nullptr) {
521 throw ProcessError(
"A gui-network was not yet constructed.");
569 edgeAttrs.insert(tmp.begin(), tmp.end());
576 std::vector<std::string>
579 return std::vector<std::string>(edgeAttrs.begin(), edgeAttrs.end());
584 double value,
double begTime,
double endTime)
const {
586 if (edge !=
nullptr) {
587 myWeightStorage->addEffort(edge, begTime, endTime, value);
589 WRITE_ERROR(
"Trying to set the effort for the unknown edge '" +
id +
"'.");
599 std::vector<std::string> attrs = discoveryHandler.
getEdgeAttrs();
601 +
"' Found " +
toString(attrs.size())
602 +
" attributes: " +
toString(attrs));
605 std::vector<EdgeFloatTimeLineRetriever_GUI> retrieverDefsInternal;
606 retrieverDefsInternal.reserve(attrs.size());
607 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
608 for (
const std::string& attr : attrs) {
619 std::vector<std::string>
621 std::vector<std::string> result;
623 result.push_back(item.first);
630 const auto it =
myLogics2Wrapper.find(const_cast<MSTrafficLightLogic*>(tll));
638 if (!(*i)->isInternal()) {
639 const std::vector<MSLane*>& lanes = (*i)->getLanes();
640 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
641 static_cast<GUILane*
>(*j)->updateColor(s);
646 (*i)->updateColor(s);
virtual std::vector< std::string > getAttributeNames() const =0
Retrieves all attribute names.
int myLastSimDuration
The step durations (simulation, /*visualisation, */idle)
Boundary myBoundary
The networks boundary.
Position getJunctionPosition(const std::string &name) const
returns the position of a junction
double getAvgWaitingTime() const
double ymin() const
Returns minimum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
The class responsible for building and deletion of vehicles (gui-version)
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
std::map< std::string, MSEdgeWeightsStorage * > myLoadedEdgeData
loaded edge data for visualization
int getArrivedVehicleNo() const
Returns the number of arrived vehicles.
std::vector< GUIJunctionWrapper * > myJunctionWrapper
Wrapped MS-junctions.
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
begin/end of the description of a single lane
double getAvgDuration() const
Storage for geometrical objects extended by mutexes.
int getLoadedVehicleNo() const
Returns the number of build vehicles.
friend class GUITrafficLightLogicWrapper
void unlock()
release exclusive access to the simulation state
int getLinkTLID(MSLink *link) const
int getLoadedNumber() const
Returns the number of build transportables.
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
int size() const
Returns the number of stored items within the container.
Stores the information about how to visualize structures.
An XML-handler for network weights.
LayeredRTree myGrid
The visualization speed-up.
T get(const std::string &id) const
Retrieves an item.
void initTLMap()
Initialises the tl-logic map and wrappers.
bool logSimulationDuration() const
Returns whether duration shall be logged.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
bool loadEdgeData(const std::string &file)
load edgeData from file
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
double getAvgWalkDuration() const
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
double getMeanUPS() const
Returns the update per seconds rate.
GUIMEVehicleControl * getGUIMEVehicleControl()
Returns the vehicle control.
The class responsible for building and deletion of vehicles (gui-version)
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
double getWidth() const
Returns the width of the boudary (x-axis)
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
void initGUIStructures()
Initialises gui wrappers.
static const double SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk ...
SUMOTime myEdgeDataEndTime
end of loaded edgeData
double myVersion
the network version
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
void lock()
grant exclusive access to the simulation state
Links2LogicMap myLinks2Logic
The link-to-logic-id map.
const std::string & getID() const
Returns the id.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
A storage for edge travel times and efforts.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
long myOverallVehicleCount
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.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
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)
Logics2WrapperMap myLogics2Wrapper
The traffic light-to-wrapper map.
bool isSelected(const MSTrafficLightLogic *tll) const override
return wheter the given logic (or rather it's wrapper) is selected in the GUI
A road/street connecting two junctions (gui-version)
A road/street connecting two junctions.
long long int myVehiclesMoved
The overall number of vehicle movements.
double getEdgeData(const MSEdge *edge, const std::string &attr)
retrieve loaded edged weight for the given attribute and the current simulation time ...
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::vector< GUIDetectorWrapper * > myDetectorWrapper
A detector dictionary.
double getAvgDepartDelay() const
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Encapsulated SAX-Attributes.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
std::vector< GUIGlID > getTLSIDs() const
Returns the gl-ids of all traffic light logics within the net.
A point in 2D or 3D with translation and scaling methods.
MSTrafficLightLogic * getActive(const std::string &id) const
Returns the active program of a named tls.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
MSDetectorControl * myDetectorControl
Controls detectors;.
double getFPS() const
retrieve FPS
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
void createTLWrapper(MSTrafficLightLogic *tll) override
creates a wrapper for the given logic
static void clearDictionary()
Clears the dictionary (the objects will not be deleted)
double xmin() const
Returns minimum x-coordinate.
const Position & getPosition() const
std::vector< GUIGlID > getJunctionIDs(bool includeInternal) const
Boundary & grow(double by)
extends the boundary by the given amount
double getVehicleMeanSpeedRelative() const
double getAvgTripSpeed() const
int getSimDuration() const
Returns the duration of the last step's simulation part (in ms)
double getAvgWalkTimeLoss() const
begin/end of the description of an edge
double getAvgTimeLoss() const
int getWholeDuration() const
Returns the duration of the last step (sim+visualisation+idle) (in ms)
Complete definition about what shall be retrieved and where to store it.
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
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 Insert(const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId)
Insert entry (delegate to appropriate layer)
MSTransportableControl * myContainerControl
Controls container building and deletion;.
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
A MSNet extended by some values for usage within the gui.
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
virtual int getHaltingVehicleNo() const
Returns the number of halting vehicles.
double getAvgRouteLength() const
double getHeight() const
Returns the height of the boundary (y-axis)
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
const std::vector< SumoXMLTag > getAvailableTypes() const
Returns the list of available detector types.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSTransportableControl * myPersonControl
Controls person building and deletion;.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
const Boundary & getBoundary() const
returns the bounder of the network
class for discovering edge attributes
bool vehicleExists(const std::string &name) const
returns the information whether the vehicle still exists
long myOverallSimDuration
GUIVehicleControl * getGUIVehicleControl()
Returns the vehicle control.
MSTransportableControl & getPersonControl() override
Returns the person control.
double getMeanRTFactor(int duration) const
Returns the simulation speed as a factor to real time.
an aggreagated-output interval
The parent class for traffic light logics.
static void updateAll()
Updates all instances (passes values)
void simulationStep()
Performs a single simulation step (locking the simulation)
double getRTFactor() const
Returns the simulation speed as a factor to real time.
Boundary getBoundary() const
Returns the boundary of the junction.
The class responsible for building and deletion of vehicles.
std::vector< MSEdge * > MSEdgeVector
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
void simulationStep()
Performs a single simulation step.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
double getUPS() const
Returns the update per seconds rate.
int getDiscardedVehicleNo() const
Returns the number of discarded vehicles.
double ymax() const
Returns maximum y-coordinate.
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
#define WRITE_MESSAGE(msg)
GUINet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents)
Constructor.
static double getTotalLength(bool includeInternal, bool eachLane)
void guiSimulationStep()
Some further steps needed for gui processing.
double getAvgWalkRouteLength() const
GUISelectedStorage gSelected
A global holder of selected objects.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Callback method for an opening tag to implement by derived classes.
int getCollisionCount() const
return the number of collisions
int getLinkTLIndex(MSLink *link) const
A window containing a gl-object's parameter.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
int getTeleportCount() const
return the number of teleports (including collisions)
Stores time-dependant events and executes them at the proper time.
long myLastVehicleMovementCount
int getIdleDuration() const
Returns the duration of the last step's idle part (in ms)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
MSTransportableControl & getContainerControl() override
Returns the container control.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Class passing values from a GUIGlObject to another object.
std::vector< std::string > getEdgeAttrs()
double getVehicleMeanSpeed() const
int getJammedNumber() const
Returns the number of times a transportables was jammed.
GUI-version of the transportable control for building gui persons and containers. ...