69 #ifdef CHECK_MEMORY_LEAKS 71 #endif // CHECK_MEMORY_LEAKS 79 const std::string& streetName,
const std::string& edgeType,
int priority)
80 :
MSEdge(id, numericalID, function, streetName, edgeType, priority),
94 assert(laneNo < myLanes->size());
95 return *((*myLanes)[laneNo]);
101 std::vector<GUIGlID> ret;
107 ret.push_back(edge->
getGlID());
118 const MSEdge* edge = i->second;
132 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
133 ret.
add((*i)->getShape().getBoxBoundary());
139 const std::vector<MSLane*>& lanes = (*it)->getLanes();
140 for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
141 ret.
add((*it_lane)->getShape().front());
145 const std::vector<MSLane*>& lanes = (*it)->getLanes();
146 for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
147 ret.
add((*it_lane)->getShape().back());
159 netsWrappers.reserve(size);
160 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
162 netsWrappers.push_back(static_cast<GUIEdge*>((*i).second));
180 new FXMenuCommand(ret, (
"pos: " +
toString(pos)).c_str(), 0, 0, 0);
234 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
254 if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName) {
257 if (lane1 != 0 && lane2 != 0) {
263 if (angle > 90 && angle < 270) {
268 }
else if (drawInternalEdgeName) {
270 }
else if (drawCwaEdgeName) {
273 if (drawStreetName) {
281 for (std::set<MSTransportable*>::const_iterator i =
myPersons.begin(); i !=
myPersons.end(); ++i) {
292 assert(container != 0);
303 if (vehicleControl != 0) {
307 size_t laneIndex = 0;
309 for (std::vector<MSLane*>::const_iterator msl =
myLanes->begin(); msl !=
myLanes->end(); ++msl, ++laneIndex) {
314 segment != 0; segment = segment->getNextSegment()) {
315 const SUMOReal length = segment->getLength();
316 if (laneIndex < segment->numQueues()) {
318 queue = segment->getQueue(laneIndex);
319 const size_t queueSize = queue.size();
320 SUMOReal vehiclePosition = segmentOffset + length;
323 for (
size_t i = 0; i < queueSize; ++i) {
326 while (vehiclePosition < segmentOffset) {
330 vehiclePosition += length;
337 vehiclePosition -= vehLength;
340 segmentOffset += length;
354 vehNo += segment->getCarNumber();
356 return (
unsigned int)vehNo;
362 std::string result =
" ";
363 std::vector<const MEVehicle*> vehs;
365 std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
366 vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
368 for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
369 result += (*it)->getID() +
" ";
379 flow += (
SUMOReal) segment->getCarNumber() * segment->getMeanSpeed();
381 return 3600 * flow / (*myLanes)[0]->getLength();
389 occ += segment->getBruttoOccupancy();
397 return (*
myLanes)[0]->getSpeedLimit();
415 switch (activeScheme) {
437 switch (activeScheme) {
466 const std::vector<MSLane*>& lanes =
getLanes();
467 const bool isClosed = lane->
isClosed();
468 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
481 edges.push_back(
this);
492 const std::vector<MSLane*>& lanes =
getLanes();
493 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
495 for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
496 if ((*v)->getLane() == (*i)) {
500 (*i)->releaseVehicles();
SUMOReal getScaleValue(size_t activeScheme) const
gets the scaling value according to the current scheme index
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
std::set< MSTransportable * > myContainers
Containers on the edge.
SUMOReal getFlow() const
returns flow based on headway
std::vector< MEVehicle * > Queue
GUIVisualizationTextSettings streetName
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
SUMOReal rotationAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void add(const Position &pos)
Adds the given position to this one.
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
const Position geometryPositionAtOffset(SUMOReal offset) const
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
RandomDistributor< MSEdge * > edgeProbs
The distributions of new destinations to use.
The vehicle arrived at a junction.
bool add(SUMOReal prob, T val, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
void secureVehicles()
lock access to vehicle removal/additions for thread synchronization
Stores the information about how to visualize structures.
const EdgeBasicFunction myFunction
the purpose of the edge
GUIColorer edgeColorer
The mesoscopic edge colorer.
SUMOReal getFlow() const
return flow based on meanSpead
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::vector< MSVehicle * > VehCont
Container for vehicles.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
const std::string & getStreetName() const
Returns the street name of the edge.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
GUIMEVehicleControl * getGUIMEVehicleControl()
Returns the vehicle control.
The edge is a macroscopic connector (source/sink)
The class responsible for building and deletion of vehicles (gui-version)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
void setPositionAndAngle(const Position &pos, SUMOReal angle)
set position and angle for drawing
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
SUMOReal getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
unsigned int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
GUIVisualizationTextSettings cwaEdgeName
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
EdgeBasicFunction
Defines possible edge types.
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.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
GUIGlID getGlID() const
Returns the numerical id of the object.
A class that stores a 2D geometrical boundary.
SUMOReal scale
information about a lane's width (temporary, used for a single view)
Representation of a lane in the micro simulation (gui-version)
SUMOReal getRelativeSpeed() const
return meanSpead divided by allowedSpeed
GUIVisualizationTextSettings edgeName
A road/street connecting two junctions (gui-version)
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void rebuildAllowedLanes()
SUMOReal getLength() const
return the length of the edge
The edge is a district edge.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
void closeTraffic(const GUILane *lane)
close this edge for traffic
GUIVisualizationTextSettings internalEdgeName
A point in 2D or 3D with translation and scaling methods.
SUMOTime begin
The begin time these definitions are valid.
SUMOReal getLength() const
Returns the length of the segment in meters.
size_t getCarNumber() const
Returns the total number of cars on the segment.
MSEdgeVector mySuccessors
The succeeding edges.
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
const T getColor(const SUMOReal value) const
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
SUMOReal getAllowedSpeed() const
static MSEdge mySpecialDest_keepDestination
special destination values
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Tries to reroute the vehicle.
float minSize
The minimum size to draw this object.
const std::vector< MSLane * > * myLanes
Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane...
MSLane & getLane(size_t laneNo)
returns the enumerated lane (!!! why not private with a friend?)
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
SUMOReal getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
void addRerouter()
add a rerouter
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
void drawMesoVehicles(const GUIVisualizationSettings &s) const
void unlock()
release mutex lock
SUMOReal getMesoMeanSpeed() const
get the mean speed for mesoscopic simulation
GUIEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
The edge is a pedestrian walking area (a special type of internal edge)
static std::vector< GUIGlID > getIDs(bool includeInternal)
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
SUMOReal length() const
Returns the length.
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
unsigned int getVehicleNo() const
SUMOReal getBruttoOccupancy() const
SUMOTime end
The end time these definitions are valid.
SUMOReal getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
A MSVehicle extended by some values for usage within the gui.
GUIVisualizationSizeSettings containerSize
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
The edge is a normal street.
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
A single mesoscopic segment (cell)
The edge is a pedestrian crossing (a special type of internal edge)
static size_t dictSize()
Returns the number of edges.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
MESegment * getSegmentForEdge(const MSEdge &e, SUMOReal pos=0)
Get the segment for a given edge at a given position.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::string myStreetName
the real-world name of this edge (need not be unique)
void mul(SUMOReal val)
Multiplies both positions with the given value.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
GUIVisualizationSizeSettings personSize
std::string getVehicleIDs() const
static DictType myDict
Static dictionary to associate string-ids with objects.
GUIVisualizationSizeSettings vehicleSize
Boundary getBoundary() const
Returns the street's geometry.
std::vector< MSEdge * > MSEdgeVector
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
The edge is an internal edge.
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
MSEdgeVector myPredecessors
The preceeding edges.
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
Representation of a lane in the micro simulation.
A window containing a gl-object's parameter.
SUMOReal getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
static void fill(std::vector< GUIEdge * > &netsWrappers)
SUMOReal getExaggeration(const GUIVisualizationSettings &s) const
return the drawing size including exaggeration and constantSize values
SUMOReal getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const PositionVector & getShape() const
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.