74 const std::string& streetName,
const std::string& edgeType,
int priority)
75 :
MSEdge(id, numericalID, function, streetName, edgeType, priority),
89 assert(laneNo < (
int)
myLanes->size());
90 return *((*myLanes)[laneNo]);
96 std::vector<GUIGlID> ret;
102 ret.push_back(edge->
getGlID());
113 const MSEdge* edge = i->second;
127 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
128 ret.
add((*i)->getShape().getBoxBoundary());
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().front());
140 const std::vector<MSLane*>& lanes = (*it)->getLanes();
141 for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
142 ret.
add((*it_lane)->getShape().back());
162 new FXMenuCommand(ret, (
"pos: " +
toString(pos)).c_str(), 0, 0, 0);
219 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
239 if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName) {
242 if (lane1 != 0 && lane2 != 0) {
248 if (angle > 90 && angle < 270) {
253 }
else if (drawInternalEdgeName) {
255 }
else if (drawCwaEdgeName) {
258 if (drawStreetName) {
266 for (std::set<MSTransportable*>::const_iterator i =
myPersons.begin(); i !=
myPersons.end(); ++i) {
277 assert(container != 0);
288 if (vehicleControl != 0) {
294 for (std::vector<MSLane*>::const_iterator msl =
myLanes->begin(); msl !=
myLanes->end(); ++msl, ++laneIndex) {
297 double segmentOffset = 0;
299 segment != 0; segment = segment->getNextSegment()) {
300 const double length = segment->
getLength();
301 if (laneIndex < segment->numQueues()) {
303 queue = segment->getQueue(laneIndex);
304 const int queueSize = (int)queue.size();
305 double vehiclePosition = segmentOffset + length;
308 for (
int i = 0; i < queueSize; ++i) {
311 while (vehiclePosition < segmentOffset) {
315 vehiclePosition += length;
321 vehiclePosition -= vehLength;
324 segmentOffset += length;
338 vehNo += segment->getCarNumber();
346 std::string result =
" ";
347 std::vector<const MEVehicle*> vehs;
349 std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
350 vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
352 for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
353 result += (*it)->getID() +
" ";
363 flow += (double) segment->getCarNumber() * segment->getMeanSpeed();
365 return 3600 * flow / (*myLanes)[0]->getLength();
373 occ += segment->getBruttoOccupancy();
375 return occ / (*myLanes)[0]->getLength() / (double)(
myLanes->size());
381 return (*
myLanes)[0]->getSpeedLimit();
403 switch (activeScheme) {
420 switch (activeScheme) {
423 segment != 0; segment = segment->getNextSegment()) {
430 segment != 0; segment = segment->getNextSegment()) {
436 segment != 0; segment = segment->getNextSegment()) {
442 segment != 0; segment = segment->getNextSegment()) {
448 segment != 0; segment = segment->getNextSegment()) {
454 segment != 0; segment = segment->getNextSegment()) {
466 switch (activeScheme) {
492 switch (activeScheme) {
523 const std::vector<MSLane*>& lanes =
getLanes();
524 const bool isClosed = lane->
isClosed();
525 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
538 edges.push_back(
this);
549 const std::vector<MSLane*>& lanes =
getLanes();
550 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
552 for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
553 if ((*v)->getLane() == (*i)) {
557 (*i)->releaseVehicles();
const SumoXMLEdgeFunc myFunction
the purpose of the edge
double getLength() const
return the length of the edge
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
std::set< MSTransportable * > myContainers
Containers on the edge.
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
double scale
information about a lane's width (temporary, used for a single view)
std::vector< MEVehicle * > Queue
GUIVisualizationTextSettings streetName
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const double angle) const
Draws the object on the specified position with the specified angle.
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
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 std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
bool isTazConnector() const
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb.
double getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
double getAllowedSpeed() const
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
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.
void secureVehicles()
lock access to vehicle removal/additions for thread synchronization
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
Stores the information about how to visualize structures.
GUIColorer edgeColorer
The mesoscopic edge colorer.
double getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
double getBruttoOccupancy() const
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double interpolateLanePosToGeometryPos(double lanePos) const
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
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.
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, int align=0, double width=-1)
The class responsible for building and deletion of vehicles (gui-version)
double getLength() const
Returns the lane's length.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
GUIVisualizationTextSettings cwaEdgeName
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
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.
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Representation of a lane in the micro simulation (gui-version)
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
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.
static double naviDegree(const double angle)
void rebuildAllowedLanes()
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
double minSize
The minimum size to draw this object.
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.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
SUMOTime begin
The begin time these definitions are valid.
MSEdgeVector mySuccessors
The succeeding edges.
double getFlow() const
returns flow based on headway
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
double getLength() const
Returns the length of the segment in meters.
const T getColor(const double value) const
double length() const
Returns the length.
double getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
static MSEdge mySpecialDest_keepDestination
special destination values
double getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
Boundary & grow(double by)
extends the boundary by the given amount
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
std::vector< MSVehicle * > VehCont
Container for vehicles.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Tries to reroute the vehicle.
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some edge function
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
double getLastHeadwaySeconds() const
get the last headway time in seconds
void unlock()
release mutex lock
static std::vector< GUIGlID > getIDs(bool includeInternal)
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
int numQueues() const
return the number of queues
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
SUMOTime end
The end time these definitions are valid.
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
A MSVehicle extended by some values for usage within the gui.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
GUIVisualizationSizeSettings containerSize
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
A single mesoscopic segment (cell)
double getFlow() const
return flow based on meanSpead
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
double getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
std::string myStreetName
the real-world name of this edge (need not be unique)
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
int getCarNumber() const
Returns the total number of cars on the segment.
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
std::string getVehicleIDs() const
static DictType myDict
Static dictionary to associate string-ids with objects.
GUIEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
GUIVisualizationSizeSettings vehicleSize
Boundary getBoundary() const
Returns the street's geometry.
void mul(double val)
Multiplies both positions with the given value.
std::vector< MSEdge * > MSEdgeVector
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
double getMeanSpeed() const
get the mean speed
static double getTotalLength(bool includeInternal, bool eachLane)
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
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.
Representation of a lane in the micro simulation.
A window containing a gl-object's parameter.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
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.