 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
67 const std::string& streetName,
const std::string& edgeType,
int priority,
69 :
MSEdge(id, numericalID, function, streetName, edgeType, priority, distance),
83 assert(laneNo < (
int)
myLanes->size());
84 return *((*myLanes)[laneNo]);
90 std::vector<GUIGlID> ret;
95 if (includeInternal || edge->
isNormal()) {
107 const MSEdge* edge = i->second;
121 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
122 ret.
add((*i)->getShape().getBoxBoundary());
128 const std::vector<MSLane*>& lanes = (*it)->getLanes();
129 for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
130 ret.
add((*it_lane)->getShape().front());
134 const std::vector<MSLane*>& lanes = (*it)->getLanes();
135 for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
136 ret.
add((*it_lane)->getShape().back());
156 new FXMenuCommand(ret, (
"segment: " +
toString(segment->
getIndex())).c_str(),
nullptr,
nullptr, 0);
221 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
238 if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName || drawEdgeValue) {
241 if (lane1 !=
nullptr && lane2 !=
nullptr) {
246 if (spreadSuperposed) {
250 Position shift(dist * cos(shiftA), dist * sin(shiftA));
256 }
else if (drawInternalEdgeName) {
258 }
else if (drawCwaEdgeName) {
261 if (drawStreetName) {
267 if (activeScheme == 31) {
270 }
else if (activeScheme == 32) {
288 FXMutexLock locker(
myLock);
289 for (std::set<MSTransportable*>::const_iterator i =
myPersons.begin(); i !=
myPersons.end(); ++i) {
296 FXMutexLock locker(
myLock);
299 assert(container != 0);
309 if (vehicleControl !=
nullptr) {
312 FXMutexLock locker(
myLock);
315 for (std::vector<MSLane*>::const_iterator msl =
myLanes->begin(); msl !=
myLanes->end(); ++msl, ++laneIndex) {
318 double segmentOffset = 0;
320 segment !=
nullptr; segment = segment->getNextSegment()) {
321 const double length = segment->
getLength();
322 if (laneIndex < segment->numQueues()) {
324 queue = segment->getQueue(laneIndex);
325 const int queueSize = (int)queue.size();
326 double vehiclePosition = segmentOffset + length;
329 for (
int i = 0; i < queueSize; ++i) {
332 while (vehiclePosition < segmentOffset) {
336 vehiclePosition += length;
342 vehiclePosition -= vehLength;
345 segmentOffset += length;
359 vehNo += segment->getCarNumber();
367 std::string result =
" ";
368 std::vector<const MEVehicle*> vehs;
370 std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
371 vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
373 for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
374 result += (*it)->getID() +
" ";
384 flow += (double) segment->getCarNumber() * segment->getMeanSpeed();
386 return 3600 * flow / (*myLanes)[0]->getLength();
394 occ += segment->getBruttoOccupancy();
396 return occ / (*myLanes)[0]->getLength() / (double)(
myLanes->size());
402 return (*
myLanes)[0]->getSpeedLimit();
425 int activeMicroScheme = -1;
426 switch (activeScheme) {
428 activeMicroScheme = 0;
431 activeMicroScheme = 18;
434 activeMicroScheme = 30;
448 switch (activeScheme) {
451 segment !=
nullptr; segment = segment->getNextSegment()) {
458 segment !=
nullptr; segment = segment->getNextSegment()) {
464 segment !=
nullptr; segment = segment->getNextSegment()) {
470 segment !=
nullptr; segment = segment->getNextSegment()) {
476 segment !=
nullptr; segment = segment->getNextSegment()) {
482 segment !=
nullptr; segment = segment->getNextSegment()) {
494 switch (activeScheme) {
520 switch (activeScheme) {
551 const std::vector<MSLane*>& lanes =
getLanes();
552 const bool isClosed = lane->
isClosed();
553 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
561 pred->rebuildAllowedTargets();
569 edges.push_back(
this);
580 const std::vector<MSLane*>& lanes =
getLanes();
581 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
583 for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
584 if ((*v)->getLane() == (*i)) {
588 (*i)->releaseVehicles();
unsigned char alpha() const
Returns the alpha-amount of the color.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
GUIColorer edgeColorer
The mesoscopic edge colorer.
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
bool hideConnectors
flag to show or hidde connectors
static DictType myDict
Static dictionary to associate string-ids with objects.
A window containing a gl-object's parameter.
std::string edgeParam
key for coloring by edge parameter
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const std::string & getStreetName() const
Returns the street name of the edge.
Representation of a lane in the micro simulation.
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
A single mesoscopic segment (cell)
int getLaneEdgeMode() const
Returns the number of the active lane (edge) coloring schme.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
MSEdgeVector myPredecessors
The preceeding edges.
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
void drawMesoVehicles(const GUIVisualizationSettings &s) const
double getFlow() const
return flow based on meanSpead
MSInsertionControl & getInsertionControl()
Returns the insertion control.
double getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
std::vector< MSVehicle * > VehCont
Container for vehicles.
bool setFunctionalColor(const GUIColorer &c, RGBColor &col, int activeScheme=-1) const
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
A MSVehicle extended by some values for usage within the gui.
double length() const
Returns the length.
GUIVisualizationSizeSettings containerSize
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
double getEntryBlockTimeSeconds() const
get the last headway time in seconds
GUIVisualizationSizeSettings vehicleSize
double getAllowedSpeed() const
RandomDistributor< MSEdge * > edgeProbs
The distributions of new destinations to use.
double getLength() const
return the length of the edge
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
The class responsible for building and deletion of vehicles (gui-version)
bool isNormal() const
return whether this edge is an internal edge
void closeTraffic(const GUILane *lane)
close this edge for traffic
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
double scaledSize(double scale, double constFactor=0.1) const
get scale size
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
GUIMEVehicleControl * getGUIMEVehicleControl()
Returns the vehicle control.
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
std::shared_ptr< const std::vector< MSLane * > > myLanes
Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane,...
bool isInternal() const
return whether this edge is an internal edge
void addRerouter()
add a rerouter
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const double angle) const
Draws the object on the specified position with the specified angle.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
GUIVisualizationTextSettings internalEdgeName
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Tries to reroute the vehicle.
static MSEdge mySpecialDest_keepDestination
special destination values
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
const PositionVector & getShape() const
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
double getMeanSpeed() const
get the mean speed
double getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
double getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
GUIEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority, double distance)
Constructor.
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool isTazConnector() const
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
GUIGlID getGlID() const
Returns the numerical id of the object.
double getFlow() const
returns flow based on headway
A class that stores a 2D geometrical boundary.
double interpolateLanePosToGeometryPos(double lanePos) const
double getLength() const
Returns the lane's length.
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
double scale
information about a lane's width (temporary, used for a single view)
double getLastHeadwaySeconds() const
get the last headway time in seconds
A point in 2D or 3D with translation and scaling methods.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
A road/street connecting two junctions.
GUIVisualizationSizeSettings personSize
std::string getVehicleIDs() const
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
const std::string getOptionalName() const
Returns the street name.
void mul(double val)
Multiplies both positions with the given value.
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
double minSize
The minimum size to draw this object.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIVisualizationTextSettings streetName
FXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
SUMOTime begin
The begin time these definitions are valid.
bool setFunctionalColor(const GUIColorer &c) const
sets the color according to the current scheme index and some edge function
GUIVisualizationTextSettings cwaEdgeName
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Representation of a lane in the micro simulation (gui-version)
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static MELoop * gMesoNet
mesoscopic simulation infrastructure
MSEdgeVector mySuccessors
The succeeding edges.
A road/street connecting two junctions (gui-version)
double getLength() const
Returns the length of the segment in meters.
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::vector< MSEdge * > MSEdgeVector
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
static double getTotalLength(bool includeInternal, bool eachLane)
int numQueues() const
return the number of queues
GUISelectedStorage gSelected
A global holder of selected objects.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
double getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
std::set< MSTransportable * > myContainers
Containers on the edge.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
std::vector< MEVehicle * > Queue
double getBruttoOccupancy() const
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
static std::vector< GUIGlID > getIDs(bool includeInternal)
void add(const Position &pos)
Adds the given position to this one.
GUIColorer laneColorer
The lane colorer.
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
Boundary & grow(double by)
extends the boundary by the given amount
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
bool drawJunctionShape
whether the shape of the junction should be drawn
Stores the information about how to visualize structures.
void secureVehicles()
lock access to vehicle removal/additions for thread synchronization
SUMOTime end
The end time these definitions are valid.
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.
const std::string & getID() const
Returns the id.
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
bool isSelected() const
whether this lane is selected in the GUI
const T getColor(const double value) const
GUIVisualizationTextSettings edgeName
GUIVisualizationTextSettings edgeValue
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
std::string myStreetName
the real-world name of this edge (need not be unique)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
int getCarNumber() const
Returns the total number of cars on the segment.
void rebuildAllowedLanes()
Boundary getBoundary() const
Returns the street's geometry.
const SumoXMLEdgeFunc myFunction
the purpose of the edge
const MSEdgeVector & getPredecessors() const
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.