88 myLastSimDuration(0), myLastIdleDuration(0),
89 myLastVehicleMovementCount(0), myOverallVehicleCount(0), myOverallSimDuration(0) {
163 if (links.size() == 0) {
172 MSTrafficLightLogic::LinkVectorVector::const_iterator j;
173 for (j = links.begin(); j != links.end(); ++j) {
174 MSTrafficLightLogic::LinkVector::const_iterator j2;
175 for (j2 = (*j).begin(); j2 != (*j).end(); ++j2) {
243 FXMutexLock locker(
myLock);
250 std::vector<GUIGlID> ret;
252 if (!(*i)->isInternal() || includeInternal) {
253 ret.push_back((*i)->getGlID());
262 std::vector<GUIGlID> ret;
263 std::vector<std::string> ids;
265 std::string sid = (*i).second->getMicrosimID();
266 if (find(ids.begin(), ids.end(), sid) == ids.end()) {
267 ret.push_back((*i).second->getGlID());
279 for (std::vector<SumoXMLTag>::const_iterator i = types.begin(); i != types.end(); ++i) {
282 if (wrapper !=
nullptr) {
301 for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
303 if (!(*i)->isTazConnector() || (*i)->getLanes().size() > 0) {
310 std::map<MSJunction*, std::string> junction2TLL;
312 for (
const auto& links : tls->getLinks()) {
313 for (
const MSLink* l : links) {
314 junction2TLL[l->getJunction()] = l->getTLLogic()->getID();
325 const std::vector<MSLane*>& lanes = edge->
getLanes();
326 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
327 b.
add((*j)->getShape().getBoxBoundary());
331 const float cmin[2] = { (float)b.
xmin(), (float)b.
ymin() };
332 const float cmax[2] = { (float)b.
xmax(), (float)b.
ymax() };
336 throw ProcessError(
TL(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n"));
343 const float cmin[2] = { (float)b.
xmin(), (float)b.
ymin() };
344 const float cmax[2] = { (float)b.
xmax(), (float)b.
ymax() };
354 for (
MSLane* lane : edge->getLanes()) {
359 const float cmin[2] = { (float)b.
xmin(), (float)b.
ymin() };
360 const float cmax[2] = { (float)b.
xmax(), (float)b.
ymax() };
367 const float cmin[2] = { (float)b.
xmin(), (float)b.
ymin() };
368 const float cmax[2] = { (float)b.
xmax(), (float)b.
ymax() };
490 ret->
mkItem(
TL(
"loaded vehicles [#]"),
true,
492 ret->
mkItem(
TL(
"insertion-backlogged vehicles [#]"),
true,
494 ret->
mkItem(
TL(
"departed vehicles [#]"),
true,
496 ret->
mkItem(
TL(
"running vehicles [#]"),
true,
498 ret->
mkItem(
TL(
"arrived vehicles [#]"),
true,
500 ret->
mkItem(
TL(
"discarded vehicles [#]"),
true,
502 ret->
mkItem(
TL(
"collisions [#]"),
true,
504 ret->
mkItem(
TL(
"teleports [#]"),
true,
506 ret->
mkItem(
TL(
"halting [#]"),
true,
508 ret->
mkItem(
TL(
"stopped [#]"),
true,
510 ret->
mkItem(
TL(
"avg. speed [m/s]"),
true,
512 ret->
mkItem(
TL(
"avg. relative speed"),
true,
515 ret->
mkItem(
TL(
"loaded persons [#]"),
true,
517 ret->
mkItem(
TL(
"running persons [#]"),
true,
519 ret->
mkItem(
TL(
"jammed persons [#]"),
true,
583 if (net !=
nullptr) {
586 throw ProcessError(
"A gui-network was not yet constructed.");
646 edgeAttrs.insert(tmp.begin(), tmp.end());
649 if (a !=
"from" && a !=
"to") {
662std::vector<std::string>
665 return std::vector<std::string>(edgeAttrs.begin(), edgeAttrs.end());
671 double value,
double begTime,
double endTime)
const {
673 if (edge !=
nullptr) {
674 myWeightStorage->addEffort(edge, begTime, endTime, value);
676 WRITE_WARNINGF(
TL(
"Trying to set data value for the unknown edge '%'."),
id);
683 double val,
double beg,
double end)
const {
686 bool haveRel =
false;
687 if (fromEdge !=
nullptr && toEdge !=
nullptr) {
689 if (item.first == toEdge) {
690 const MSEdge* edge = item.second;
691 while (edge !=
nullptr && edge->
isInternal()) {
692 myWeightStorage->addEffort(edge, beg, end, val);
700 WRITE_WARNINGF(
TL(
"Trying to set data value for the unknown relation from edge '%' to edge '%'."), from, to);
710 std::vector<std::string> attrs = discoveryHandler.
getEdgeAttrs();
715 +
".\n Found " +
toString(attrs.size())
716 +
" attributes: " +
toString(attrs));
722 std::vector<EdgeFloatTimeLineRetriever_GUI> retrieverDefsInternal;
723 retrieverDefsInternal.reserve(attrs.size());
724 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
725 for (
const std::string& attr : attrs) {
742std::vector<std::string>
744 std::vector<std::string> result;
746 result.push_back(item.first);
752std::vector<std::string>
754 std::vector<std::string> result;
757 result.push_back(item.first);
759 std::sort(result.begin(), result.end());
763std::vector<std::string>
767 return item->second.front()->getAttributeNames();
769 return std::vector<std::string>();
813 if (!(*i)->isInternal()) {
814 const std::vector<MSLane*>& lanes = (*i)->getLanes();
815 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
816 static_cast<GUILane*
>(*j)->updateColor(s);
821 (*i)->updateColor(s);
@ MID_COPY_VIEW_GEOBOUNDARY
Copy view geo-coordinate boundary - popup entry.
@ GLO_NETWORK
The network - empty.
GUISelectedStorage gSelected
A global holder of selected objects.
std::vector< MSEdge * > MSEdgeVector
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(msg)
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_END
weights: time range end
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
Boundary & grow(double by)
extends the boundary by the given amount
double getHeight() const
Returns the height of the boundary (y-axis)
double getWidth() const
Returns the width of the boudary (x-axis)
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
static bool registerHotkey(const std::string &key, MSTrafficLightLogic &tll)
register hotkey actions
Base (microsim) event class.
Class passing values from a GUIGlObject to another object.
static void updateAll()
Updates all instances (passes values)
The main window of the SUMO-gui.
void handleEvent_SimulationStep(GUIEvent *e)
called when event "simulation step" ocurred
void addHotkey(int key, Command *press, Command *release)
register custom hotkey action
Changes the speed allowed on a set of lanes (gui version)
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
A road/street connecting two junctions (gui-version)
static double getTotalLength(bool includeInternal, bool eachLane)
static std::vector< GUIGlID > getIDs(bool includeInternal)
static void clearDictionary()
Clears the dictionary (the objects will not be deleted)
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app, bool addSeparator=true) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
static bool gSecondaryShape
whether secondary shapes are currently being drawn
const MSJunction & getJunction() const
Returns the represented junction.
Boundary getBoundary() const
Returns the boundary of the junction.
Representation of a lane in the micro simulation (gui-version)
const PositionVector & getShape(bool secondary) const override
The class responsible for building and deletion of vehicles (gui-version)
static GUIMainWindow * getInstance()
get instance
class for discovering edge attributes
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Callback method for an opening tag to implement by derived classes.
SUMOTime firstIntervalBegin
std::set< std::string > edgeAttrs
std::vector< std::string > getEdgeAttrs()
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
void addEdgeRelWeight(const std::string &from, const std::string &to, double val, double beg, double end) const
A MSNet extended by some values for usage within the gui.
double getAvgTripSpeed() const
double getAvgRouteLength() const
double getAvgDuration() const
int getWholeDuration() const
Returns the duration of the last step (sim+visualisation+idle) (in ms)
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
void setIdleDuration(int val)
Sets the duration of the last step's idle part.
GUIVehicleControl * getGUIVehicleControl()
Returns the vehicle control.
void unlock()
release exclusive access to the simulation state
double getUPS() const
Returns the update per seconds rate.
bool loadEdgeData(const std::string &file)
load edgeData from file
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
long myLastVehicleMovementCount
std::vector< GUIGlID > getJunctionIDs(bool includeInternal) const
MSTransportableControl & getPersonControl() override
Returns the person control.
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
void flushOutputsAtEnd()
flush outputs once the simulation has reached its end
bool isSelected(const MSTrafficLightLogic *tll) const override
return wheter the given logic (or rather it's wrapper) is selected in the GUI
long myOverallVehicleCount
void simulationStep()
Performs a single simulation step (locking the simulation)
int getSimDuration() const
Returns the duration of the last step's simulation part (in ms)
SUMORTree myGrid2
The visualization speed-up for secondary shapes.
void initGUIStructures()
Initialises gui wrappers.
long myOverallSimDuration
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
const Boundary & getBoundary() const
returns the bounder of the network
double getRTFactor() const
Returns the simulation speed as a factor to real time.
void registerRenderedObject(GUIGlObject *o)
add object into rtree
std::vector< GUIEdge * > myEdgeWrapper
Wrapped MS-edges.
GUITrafficLightLogicWrapper * getTLLWrapper(MSTrafficLightLogic *tll)
double getAvgWalkDuration() const
int getLinkTLID(const MSLink *const link) const
void setSimDuration(int val)
Sets the duration of the last step's simulation part.
SUMORTree & getVisualisationSpeedUp()
Returns the RTree used for visualisation speed-up.
std::vector< GUICalibrator * > myCalibratorWrapper
A calibrator dictionary.
std::vector< std::string > getMeanDataIDs() const
return list of loaded edgeData ids (being computed in the current simulation)
double getMeanUPS() const
Returns the update per seconds rate.
double getMeanData(const MSLane *lane, const std::string &id, const std::string &attr)
retrieve live lane/edge weight for the given meanData id and attribute
void initTLMap()
Initialises the tl-logic map and wrappers.
int getLinkTLIndex(const MSLink *const link) const
Boundary myBoundary
The networks boundary.
double getAvgWalkTimeLoss() const
std::vector< GUIGlID > getTLSIDs() const
Returns the gl-ids of all traffic light logics within the net.
std::map< std::string, MSEdgeWeightsStorage * > myLoadedEdgeData
loaded edge data for visualization
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Logics2WrapperMap myLogics2Wrapper
The traffic light-to-wrapper map.
int getIdleDuration() const
Returns the duration of the last step's idle part (in ms)
double getMeanRTFactor(int duration) const
Returns the simulation speed as a factor to real time.
void createTLWrapper(MSTrafficLightLogic *tll) override
creates a wrapper for the given logic
bool vehicleExists(const std::string &name) const
returns the information whether the vehicle still exists
std::vector< GUIDetectorWrapper * > myDetectorWrapper
A detector dictionary.
void addHotkey(int key, Command *press, Command *release=nullptr)
register custom hotkey action
double getAvgWalkRouteLength() const
void lock()
grant exclusive access to the simulation state
std::vector< GUIJunctionWrapper * > myJunctionWrapper
Wrapped MS-junctions.
void updateGUI() const override
update view after simulation.loadState
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
double getAvgTimeLoss() const
double getAvgDepartDelay() const
double getEdgeData(const MSEdge *edge, const std::string &attr)
retrieve loaded edged weight for the given attribute and the current simulation time
double getAvgWaitingTime() const
friend class GUITrafficLightLogicWrapper
std::vector< std::string > getMeanDataAttrs(const std::string &meanDataID) const
return list of available attributes for the given meanData id
int myLastSimDuration
The step durations (simulation, /*visualisation, */idle)
Position getJunctionPosition(const std::string &name) const
returns the position of a junction
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
void guiSimulationStep()
Some further steps needed for gui processing.
MSTransportableControl & getContainerControl() override
Returns the container control.
GUINet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents)
Constructor.
GUIMEVehicleControl * getGUIMEVehicleControl()
Returns the vehicle control.
Links2LogicMap myLinks2Logic
The link-to-logic-id map.
LayeredRTree myGrid
The visualization speed-up.
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
double getFPS() const
retrieve FPS
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
Storage for geometrical objects extended by mutexes.
GUI-version of the transportable control for building gui persons and containers.
The class responsible for building and deletion of vehicles (gui-version)
Stores the information about how to visualize structures.
static const double MISSING_DATA
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void Insert(const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId)
Insert entry (delegate to appropriate layer)
static const std::map< std::string, MSCalibrator * > & getInstances()
return all calibrator instances
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
const std::map< std::string, std::vector< MSMeanData * > > & getMeanData() const
void close(SUMOTime step)
Closes the detector outputs.
const std::vector< SumoXMLTag > getAvailableTypes() const
Returns the list of available detector types.
A road/street connecting two junctions.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const MSConstEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING, bool ignoreTransientPermissions=false) const
Returns the following edges with internal vias, restricted by vClass.
bool isInternal() const
return whether this edge is an internal edge
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....
A storage for edge travel times and efforts.
Stores time-dependant events and executes them at the proper time.
static bool gHaveEmissions
Whether emission output of some type is needed (files or GUI)
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
const Position & getPosition(bool secondaryShape=false) const
Representation of a lane in the micro simulation.
The simulated network and simulation perfomer.
MSTransportableControl * myPersonControl
Controls person building and deletion;.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
MMVersion myVersion
the network version
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
MSTransportableControl * myContainerControl
Controls container building and deletion;.
void simulationStep(const bool onlyMove=false)
Performs a single simulation step.
SUMOTime myEdgeDataEndTime
end of loaded edgeData
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
bool logSimulationDuration() const
Returns whether duration shall be logged.
long long int myVehiclesMoved
The overall number of vehicle movements.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSDetectorControl * myDetectorControl
Controls detectors;.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
static const double SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
MSTrafficLightLogic * getActive(const std::string &id) const
Returns the active program of a named tls.
The parent class for traffic light logics.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
int getLinkIndex(const MSLink *const link) const
Returns the index of the given link.
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
int getLoadedNumber() const
Returns the number of build transportables.
int getJammedNumber() const
Returns the number of times a transportables was jammed.
The class responsible for building and deletion of vehicles.
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
int getLoadedVehicleNo() const
Returns the number of build vehicles.
int getCollisionCount() const
return the number of collisions
int getStoppedVehiclesCount() const
return the number of vehicles that are currently stopped
double getVehicleMeanSpeed() const
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
int getArrivedVehicleNo() const
Returns the number of arrived vehicles.
virtual int getHaltingVehicleNo() const
Returns the number of halting vehicles.
int getTeleportCount() const
return the number of teleports (including collisions)
double getVehicleMeanSpeedRelative() const
int getDiscardedVehicleNo() const
Returns the number of discarded vehicles.
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
void setAggregationThreshold(const int thresh)
int getAggregationThreshold() const
const std::string & getID() const
Returns the id.
T get(const std::string &id) const
Retrieves an item.
int size() const
Returns the number of stored items within the container.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static OptionsCont & getOptions()
Retrieves the options.
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
double y() const
Returns the y-position.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Complete definition about what shall be retrieved and where to store it.
An XML-handler for network weights.
void addAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Adds an additional object (detector/shape/trigger) for visualisation.
virtual void Insert(const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId)
Insert entry.
Encapsulated SAX-Attributes.
virtual std::vector< std::string > getAttributeNames() const =0
Retrieves all attribute names.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
static SequentialStringBijection Attrs
The names of SUMO-XML attributes for use in netbuild.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.