 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
58 myGNEJunctionSource(myNet->retrieveJunction(nbe->getFromNode()->getID())),
59 myGNEJunctionDestiny(myNet->retrieveJunction(nbe->getToNode()->getID())),
61 myAmResponsible(false),
63 myConnectionStatus(loaded ? FEATURE_LOADED : FEATURE_GUESSED),
64 myUpdateGeometry(true) {
68 for (
int i = 0; i < numLanes; i++) {
70 myLanes.back()->incRef(
"GNEEdge::GNEEdge");
81 for (
const auto& lane :
myLanes) {
82 lane->decRef(
"GNEEdge::~GNEEdge");
83 if (lane->unreferenced()) {
85 WRITE_DEBUG(
"Deleting unreferenced " + lane->getTagStr() +
" '" + lane->getID() +
"' in GNEEdge destructor");
91 connection->decRef(
"GNEEdge::~GNEEdge");
92 if (connection->unreferenced()) {
94 WRITE_DEBUG(
"Deleting unreferenced " + connection->getTagStr() +
" '" + connection->getID() +
"' in GNEEdge destructor");
116 for (
const auto& lane :
myLanes) {
117 lane->updateGeometry();
123 connection->updateGeometry();
128 childAdditionals->updateGeometry();
132 additionalParent->updateGeometry();
136 demandElementParent->updatePartialGeometry(
this);
140 childDemandElements->updatePartialGeometry(
this);
144 pathElementChild->updatePartialGeometry(
this);
181 shapeStartEdited.
add(offset);
197 shapeEndEdited.
add(offset);
245 i->startGeometryMoving();
249 i->startGeometryMoving();
253 i->startGeometryMoving();
257 i->startGeometryMoving();
261 i->startGeometryMoving();
276 i->endGeometryMoving();
280 i->endGeometryMoving();
284 i->endGeometryMoving();
288 i->endGeometryMoving();
292 i->endGeometryMoving();
313 for (
int i = 0; i < (int)entireGeometry.size(); i++) {
314 if (entireGeometry[i].distanceTo2D(newPos) <
SNAP_RADIUS) {
315 if (i == 0 || i == (
int)(entireGeometry.size() - 1)) {
323 if (createIfNoExist) {
353 if (index < (
int)edgeGeometry.size()) {
355 edgeGeometry[index] = oldPos;
356 edgeGeometry[index].
add(offset);
376 for (
auto& i : modifiedShape) {
394 innerShapeToCommit.
removeClosest(innerShapeToCommit[(
int)innerShapeToCommit.size() - 1]);
420 modifiedShape.erase(modifiedShape.begin() + index);
454 for (
const auto& i :
myLanes) {
455 b.
add(i->getCenteringBoundary());
544 glPushName(trip->getGlID());
558 glPushName(flow->getGlID());
596 if (elementChild->getTagProperty().isVehicle()) {
598 glPushName(elementChild->getGlID());
605 }
else if (elementChild->getTagProperty().isPersonPlan()) {
640 if (geom[index].distanceTo2D(clickPos) <
SNAP_RADIUS) {
653 undoList->
p_begin(
"remove endpoint");
657 undoList->
p_begin(
"remove endpoint");
669 undoList->
p_begin(
"set endpoint");
726 edge->updateGeometry();
729 edge->updateGeometry();
735 edge->updateGeometry();
738 edge->updateGeometry();
748 std::vector<GNEConnection*> retrievedConnections;
750 for (
auto it : connections) {
754 retrievedConnections.push_back(retrievedGNEConnection);
761 retrievedGNEConnection->
incRef(
"GNEEdge::remakeGNEConnections");
771 if (it->unreferenced()) {
773 WRITE_DEBUG(
"Deleting unreferenced " + it->getTagStr() +
" '" + it->getID() +
"' in rebuildGNEConnections()");
787 if (i->isAttributeCarrierSelected()) {
788 i->unselectAttributeCarrier();
791 i->decRef(
"GNEEdge::clearGNEConnections");
793 if (i->unreferenced()) {
795 WRITE_DEBUG(
"Deleting unreferenced " + i->getTagStr() +
" '" + i->getID() +
"' in clearGNEConnections()");
805 std::vector<GNEAdditional*> routeProbes;
808 routeProbes.push_back(i);
812 auto it = std::find(routeProbes.begin(), routeProbes.end(), routeProbe);
813 if (it == routeProbes.end()) {
816 return (
int)(it - routeProbes.begin());
821 std::vector<GNECrossing*>
823 std::vector<GNECrossing*> crossings;
825 if (i->checkEdgeBelong(
this)) {
826 crossings.push_back(i);
830 if (i->checkEdgeBelong(
this)) {
831 crossings.push_back(i);
841 undoList->
p_begin(
"copy template");
852 for (
int i = 0; i < (int)
myLanes.size(); i++) {
865 std::set<GUIGlID> result;
867 result.insert(i->getGlID());
873 const std::vector<GNELane*>&
879 const std::vector<GNEConnection*>&
921 return "lane specific";
927 return "lane specific";
933 return "lane specific";
982 const std::string origValue =
myLanes.at(0)->getAttribute(key);
985 it->setAttribute(key, value, undoList);
1108 return canParse<double>(value) && (parse<double>(value) > 0);
1110 return canParse<int>(value) && (parse<double>(value) > 0);
1112 return canParse<int>(value);
1122 return canParse<PositionVector>(value);
1128 return canParse<double>(value) && ((parse<double>(value) >= -1) || (parse<double>(value) ==
NBEdge::UNSPECIFIED_WIDTH));
1130 return canParse<double>(value) && parse<double>(value) >= 0 && parse<double>(value) <
myNBEdge->
getLoadedLength();
1132 return canParse<double>(value);
1134 if (value.empty()) {
1136 }
else if (canParse<Position>(value)) {
1137 Position shapeStart = parse<Position>(value);
1144 if (value.empty()) {
1146 }
else if (canParse<Position>(value)) {
1147 Position shapeEnd = parse<Position>(value);
1156 return canParse<bool>(value);
1228 glTranslated(0, 0, route->
getType());
1234 if ((segment.junction == junction) && (segment.AC == route)) {
1249 if ((segment.edge ==
this) && (segment.AC == route)) {
1292 glTranslated(0, 0, tripOrFromTo->
getType());
1310 if ((segment.edge ==
this) && (segment.AC == tripOrFromTo)) {
1329 bool drawPersonPlan =
false;
1331 drawPersonPlan =
true;
1333 drawPersonPlan =
true;
1335 drawPersonPlan =
true;
1338 drawPersonPlan =
true;
1341 if (drawPersonPlan) {
1343 double personPlanWidth = 0;
1355 if (duplicateWidth) {
1356 personPlanWidth *= 2;
1371 glPushName(personPlan->
getGlID());
1375 glTranslated(0, 0, personPlan->
getType());
1381 if ((segment.junction == junction) && (segment.AC == personPlan)) {
1396 if ((segment.edge ==
this) && (segment.AC == personPlan)) {
1424 const double circleWidthSquared = circleWidth * circleWidth;
1456 firstEdge = firstPersonPlan->
getParentLanes().front()->getParentEdge();
1459 firstEdge = firstPersonPlan->
getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
1469 if ((firstEdge ==
this) && (firstPersonPlan == personPlan)) {
1498 for (
const auto& pathElementChild : copyOfMyPathElementChilds) {
1499 pathElementChild->invalidatePath();
1532 throw InvalidArgument(
"GNEEdge::setAttribute (private) called for attr SUMO_ATTR_NUMLANES. This should never happen");
1576 WRITE_DEBUG(
"invalidating (removing) connections of edge '" +
getID() +
"' due it were guessed");
1580 WRITE_DEBUG(
"declaring connections of edge '" +
getID() +
"' as loaded (It will not be removed)");
1590 newShapeStart = parse<Position>(value);
1606 newShapeEnd = parse<Position>(value);
1619 if (parse<bool>(value)) {
1645 const int oldNumLanes = (int)
myLanes.size();
1646 for (
int i = oldNumLanes; i < numLanes; i++) {
1650 for (
int i = (oldNumLanes - 1); i > (numLanes - 1); i--) {
1674 myNBEdge->
addLane(index,
true, recomputeConnections, !recomputeConnections);
1681 lane =
new GNELane(
this, index);
1684 lane->
incRef(
"GNEEdge::addLane");
1696 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1707 i->remakeGNEConnections();
1711 i->remakeGNEConnections();
1731 if (lane ==
nullptr) {
1741 lane->
decRef(
"GNEEdge::removeLane");
1750 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1761 i->remakeGNEConnections();
1765 i->remakeGNEConnections();
1789 if (selectAfterCreation) {
1797 dynamic_cast<GNEDetectorE2*
>(i)->checkE2MultilaneIntegrity();
1803 dynamic_cast<GNEDetectorE2*
>(i)->checkE2MultilaneIntegrity();
1822 if (con !=
nullptr) {
1823 con->
decRef(
"GNEEdge::removeConnection");
1828 dynamic_cast<GNEDetectorE2*
>(i)->checkE2MultilaneIntegrity();
1834 dynamic_cast<GNEDetectorE2*
>(i)->checkE2MultilaneIntegrity();
1855 if ((i->getFromLaneIndex() == fromLane) && (i->getEdgeTo()->getNBEdge() == to) && (i->getToLaneIndex() == toLane)) {
1859 if (createIfNoExist) {
1863 WRITE_DEBUG(
"Created " + createdConnection->
getTagStr() +
" '" + createdConnection->
getID() +
"' in retrieveGNEConnection()");
1867 dynamic_cast<GNEDetectorE2*
>(i)->checkE2MultilaneIntegrity();
1873 dynamic_cast<GNEDetectorE2*
>(i)->checkE2MultilaneIntegrity();
1876 return createdConnection;
1888 i->setMicrosimID(
getNBEdge()->getLaneID(i->getIndex()));
1896 if (i->isRestricted(vclass)) {
1908 if (i->checkEdgeBelong(
this)) {
1920 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
1933 #ifdef DEBUG_SMOOTH_GEOM
1935 <<
" forElevation=" << forElevation
1938 <<
" smoothShape old=" << old <<
"\n";
1940 if (old.size() == 3 || old.size() == 4) {
1942 }
else if (old.size() > 4 && !forElevation) {
1944 init.push_back(old[0]);
1945 init.push_back(old[1]);
1946 init.push_back(old[-2]);
1947 init.push_back(old[-1]);
1953 if (incoming.size() == 1) {
1954 begShape = incoming[0]->getGeometry();
1956 assert(incoming.size() == 2);
1959 if (outgoing.size() == 1) {
1960 endShape = outgoing[0]->getGeometry();
1962 assert(outgoing.size() == 2);
1968 init.push_back(old[0]);
1971 init.push_back(old[-1]);
1975 init[1].setz(2 * init[0].z() - begZ);
1976 init[2].setz(2 * init[-1].z() - endZ);
1979 const double straightThresh =
DEG2RAD(oc.
getFloat(
"opendrive-output.straight-threshold"));
1982 #ifdef DEBUG_SMOOTH_GEOM
1984 std::cout <<
" begShape=" << begShape <<
" endShape=" << endShape <<
" forElevation=" << forElevation <<
" dist=" << dist <<
" ok=" << ok <<
" init=" << init <<
"\n";
1988 if (init.size() == 0) {
1991 const int numPoints =
MAX2(oc.
getInt(
"junctions.internal-link-detail"),
1993 return init.
bezier(numPoints);
2001 if (modifiedShape.size() < 2) {
2004 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
2014 if (elevationBase.size() == 0 || elevationBase[-1].z() != pos.z()) {
2015 elevationBase.push_back(pos);
2019 if (elevation.size() <= 2) {
2023 if (modifiedShape.size() < 5) {
2029 for (
int i = 1; i < (int)modifiedShape.size(); ++i) {
2030 seen += modifiedShape[i - 1].distanceTo2D(modifiedShape[i]);
2034 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
2044 geom.erase(geom.begin());
2068 double circleWidthSquared = circleWidth * circleWidth;
2077 if (color.
alpha() > 0) {
2167 if (spreadSuperposed) {
2171 Position shift(dist * cos(shiftA), dist * sin(shiftA));
2176 if (angle > 90 && angle < 270) {
2182 if (drawStreetName) {
2188 if (activeScheme == 12) {
2191 }
else if (activeScheme == 13) {
2196 const double doubleValue = lane2->
getColorValue(s, activeScheme);
2216 glPushName(rerouter->
getGlID());
2218 for (
const auto& j :
myLanes) {
2223 glTranslated(lanePos.
x(), lanePos.
y(), rerouter->
getType());
2224 glRotated(-1 * laneRot, 0, 0, 1);
2225 glScaled(exaggeration, exaggeration, 1);
2227 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
2228 glBegin(GL_TRIANGLES);
2229 glColor3d(1, .8f, 0);
2231 glVertex2d(0 - 1.4, 0);
2232 glVertex2d(0 - 1.4, 6);
2233 glVertex2d(0 + 1.4, 6);
2234 glVertex2d(0 + 1.4, 0);
2235 glVertex2d(0 - 1.4, 0);
2236 glVertex2d(0 + 1.4, 6);
unsigned char alpha() const
Returns the alpha-amount of the color.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Position getSplitPos(const Position &clickPos)
static const double BUBBLE_RADIUS
constant values for drawing buubles
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
Position getPositionInView() const
Returns position of hierarchical element in view.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
bool myAmResponsible
whether we are responsible for deleting myNBNode
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
RGBColor selectedEdgeColor
edge selection color
void smoothElevation(GNEUndoList *undoList)
smooth elevation with regard to adjoining edges
NBEdge * toEdge
The edge the connections yields in.
An Element which don't belongs to GNENet but has influency in the simulation.
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
void addLane(GNELane *lane, const NBEdge::Lane &laneAttrs, bool recomputeConnections)
increase number of lanes by one use the given attributes and restore the GNELane
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
double speed
The speed allowed on this lane.
An Element which don't belongs to GNENet but has influency in the simulation.
bool unreferenced()
check if object ins't referenced
std::string myConnectionStatus
modification status of the connections
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
void copyTemplate(GNEEdge *tpl, GNEUndoList *undolist)
copy edge attributes from tpl
std::string edgeParam
key for coloring by edge parameter
GNEJunction * myGNEJunctionSource
pointer to GNEJunction source
void updateGeometry()
update pre-computed geometry information
const std::string getID() const
function to support debugging
#define WRITE_WARNING(msg)
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
GUIVisualizationSizeSettings junctionSize
void straightenElevation(GNEUndoList *undoList)
interpolate z values linear between junctions
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
static void drawSegmentGeometry(const GNEViewNet *viewNet, const SegmentGeometry::Segment &segment, const double width)
draw geometry segment
void declareConnectionsAsLoaded(EdgeBuildingStep step=EdgeBuildingStep::LANES2LANES_USER)
declares connections as fully loaded. This is needed to avoid recomputing connections if an edge has ...
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
void mirrorX()
mirror coordinates along the x-axis
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
static const double SNAP_RADIUS
const GNEDemandElement * getLockedPerson() const
get locked person
static const RGBColor BLACK
bool uncontrolled
check if Connection is uncontrolled
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
double z() const
Returns the z-position.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
static const Position INVALID
used to indicate that a position is valid
bool drawBoundaries
enable or disable draw boundaries
void resetWritable()
Resets all options to be writeable.
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
@ GLO_PERSONTRIP
a person trip
void drawPartialPersonPlan(const GUIVisualizationSettings &s, const GNEDemandElement *personPlan, const GNEJunction *junction) const
draw partial person plan
static PositionVector bezierControlPoints(const PositionVector &begShape, const PositionVector &endShape, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, bool &ok, NBNode *recordError=0, double straightThresh=DEG2RAD(5), int shapeFlag=0)
get bezier control points
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const GNEGeometry::SegmentGeometry & getDemandElementSegmentGeometry() const
get demand element segment geometry
void moveShapeStart(const Position &oldPos, const Position &offset)
move position of shape start without commiting change
A NBNetBuilder extended by visualisation and editing capabilities.
static const double route
width for routes
void drawChildConnections(const GUIVisualizationSettings &s, const GUIGlObjectType GLTypeParent) const
void setStreetName(const std::string &name)
sets the street name of this edge
GNEJunction * myGNEJunctionDestiny
pointer to GNEJunction destiny
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
double contPos
custom position for internal junction on this connection
void invalidatePathChildElementss()
invalidate path element childs
void drawPartialTripFromTo(const GUIVisualizationSettings &s, const GNEDemandElement *tripOrFromTo, const GNEJunction *junction) const
draw partial trip and Flow
GUIVisualizationWidthSettings widthSettings
width settings
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
void setMicrosimID(const std::string &newID)
override to also set lane ids
void endGeometryMoving()
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
GNEEdge()
constructor for dummy edge
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
@ SUMO_TAG_LANE
begin/end of the description of a single lane
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
void setShapeEndPos(const Position &pos)
change Shape EndPos
void drawEdgeName(const GUIVisualizationSettings &s) const
draw edge name
void clearGNEConnections()
clear current connections
static const double ride
width for rides
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
const Position & getLastPosition() const
get first position (or Invalid position if segments are empty)
static OptionsCont & getOptions()
Retrieves the options.
int getPriority() const
Returns the priority of the edge.
bool showDemandElements() const
check if show demand elements checkbox is enabled
void setDistance(double distance)
set lane specific speed (negative lane implies set for all lanes)
RGBColor selectedRouteColor
route selection color (used for routes and vehicle stops)
@ GNE_ATTR_SHAPE_END
last coordinate of edge shape
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
void removeLane(GNELane *lane, bool recomputeConnections)
@briefdecrease the number of lanes by one. argument is only used to increase robustness (assertions)
double length() const
Returns the length.
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void drawPartialRoute(const GUIVisualizationSettings &s, const GNEDemandElement *route, const GNEJunction *junction) const
draw partial route
void setLoadedLength(double val)
set loaded length
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
void smooth(GNEUndoList *undoList)
make geometry smooth
void editEndpoint(Position pos, GNEUndoList *undoList)
makes pos the new geometry endpoint at the appropriate end, or remove current existent endpoint
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
@ L2L_USER
The connection was given by the user.
int myPriority
The priority of the edge.
@ SUMO_ATTR_SPREADTYPE
The information about how to spread the lanes from the given position.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
GNELane * getLaneFrom() const
@briefthe get lane of the incoming lane
SumoXMLTag
Numbers representing SUMO-XML - element names.
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
void moveShapeEnd(const Position &oldPos, const Position &offset)
move position of shape end without commiting change
int fromLane
The lane the connections starts at.
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
static const double geometryPointsText
details for Geometry Points Texts
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.
void updateGeometry()
update pre-computed geometry information (including crossings)
The representation of a single edge during network building.
void removeEdgeFromCrossings(GNEJunction *junction, GNEUndoList *undoList)
remove crossing of junction
Representation of a RouteProbe in netedit.
int getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid)
return index of a vertex of shape, or of a new vertex if position is over an shape's edge
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
GUIColorer junctionColorer
The junction colorer.
int getIndex() const
returns the index of the lane
void commitShapeStartChange(const Position &oldPos, GNEUndoList *undoList)
commit position changing in shape start
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute attr
double speed
custom speed for connection
PositionVector smoothShape(const PositionVector &shape, bool forElevation)
return smoothed shape
NBEdge * myNBEdge
the underlying NBEdge
A road/street connecting two junctions (netedit-version)
bool myWasSplit
whether this edge was created from a split
friend class GNEChange_Attribute
declare friend class
std::string getAttribute(SumoXMLAttr key) const
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void add(double xoff, double yoff, double zoff)
int toLane
The lane the connections yields in.
double getChildRotation(const GNELane *lane)
get child rotation calculated in ChildConnections
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
const Position & getPosition() const
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
@ GNE_ATTR_SHAPE_START
first coordinate of edge shape
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
NBNode * getNBNode() const
Return net build node.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void invalidateConnections(bool reallowSetting=false)
invalidate current connections of edge
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)
static const std::string FEATURE_GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
GUIVisualizationTextSettings addName
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
void reset()
Resets the boundary.
int removeClosest(const Position &p)
removes the point closest to p and return the removal index
NBNode * getToNode() const
Returns the destination node of the edge.
@ GNE_ATTR_MODIFICATION_STATUS
whether a feature has been loaded,guessed,modified or approved
const double SUMO_const_halfLaneWidth
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
bool setConnection(int lane, NBEdge *destEdge, int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED, SVCPermissions permissions=SVC_UNSPECIFIED)
Adds a connection to a certain lane of a certain edge.
GNELane * getLaneByAllowedVClass(const SUMOVehicleClass vClass) const
return the first lane that allow a vehicle of type vClass (or the first lane, if none was found)
const PositionVector & getGeometry() const
Returns the geometry of the edge.
void push_back_noDoublePos(const Position &p)
insert in back a non double position
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
GUIVisualizationDetailSettings detailSettings
detail settings
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
bool clickedOverShapeStart(const Position &pos)
void commitShapeEndChange(const Position &oldPos, GNEUndoList *undoList)
commit position changing in shape end
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
double getLaneWidth() const
Returns the default width of lanes of this edge.
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
const PositionVector & getLaneShape() const
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
virtual std::string getAttribute(SumoXMLAttr key) const =0
@ SUMO_TAG_PERSONSTOP_LANE
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
NBEdge * getNBEdge() const
returns the internal NBEdge
static const double INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
bool myUpdateGeometry
@brif flag to enable/disable update geomtetry of lanes (used mainly by setNumLanes)
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
virtual const RGBColor & getColor() const =0
get color
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.
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
A class that stores a 2D geometrical boundary.
Position getPositionInView() const
Returns position of hierarchical element in view.
int getNumLanes() const
Returns the number of lanes.
std::vector< GNEDemandElement * > myPathElementChilds
vector with references to path element childs
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
static void drawShapeDottedContourRectangle(const GUIVisualizationSettings &s, const int type, const Position ¢er, const double width, const double height, const double rotation=0, const double offsetX=0, const double offsetY=0)
draw a dotted contour around the given Position with certain width and height
static const double personTrip
width for person trips
static const RGBColor personTrip
color for personStops
double scale
information about a lane's width (temporary, used for a single view)
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Supermode currentSupermode
the current supermode
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
void drawRerouterSymbol(const GUIVisualizationSettings &s, GNEAdditional *rerouter) const
draw Rerouter symbols
static void drawShapeDottedContourBetweenLanes(const GUIVisualizationSettings &s, const int type, const PositionVector &frontLaneShape, const double offsetFrontLaneShape, const PositionVector &backLaneShape, const double offsetBackLaneShape)
draw a dotted contour around the given lane shapes
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
static const double trip
width for trips
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
set preferred Vehicle Class
A storage for options typed value containers)
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
bool isWalk() const
return true if tag correspond to a walk element
static const PositionVector EMPTY
empty Vector
bool clickedOverShapeEnd(const Position &pos)
return true if user clicked over ShapeEnd
@ SUMO_TAG_REROUTER
A rerouter.
bool editingElevation() const
check if we're editing elevation
Lane & getLaneStruct(int lane)
double width
This lane's width.
@ SUMO_TAG_PERSONTRIP_BUSSTOP
GNEEdge * getOppositeEdge() const
get opposite edge
void addOutgoingGNEEdge(GNEEdge *edge)
add outgoing GNEEdge
int indexOfClosest(const Position &p) const
index of the closest position to p
void decRef(const std::string &debugMsg="")
Decrease reference.
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
double length2D() const
Returns the length.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
GNEConnection * retrieveGNEConnection(int fromLane, NBEdge *to, int toLane, bool createIfNoExist=true)
get GNEConnection if exist, and if not create it if create is enabled
void setGeometry(PositionVector geom, bool inner)
update edge geometry and inform the lanes
void mul(double val)
Multiplies both positions with the given value.
static void drawShapeDottedContourAroundShape(const GUIVisualizationSettings &s, const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false, const bool keepPossibleTurns=false)
Removes the specified connection(s)
int insertAtClosest(const Position &p, bool interpolateZ)
inserts p between the two closest positions
int getRouteProbeRelativePosition(GNERouteProbe *routeProbe) const
obtain relative positions of RouteProbes
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=FEATURE_GUESSED)
void startGeometryMoving()
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
static const double UNSPECIFIED_LOADED_LENGTH
no length override given
GNEViewNet * getViewNet() const
get view net
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
ConnectionVector myGNEConnections
vector with the connections of this edge
GUIVisualizationTextSettings streetName
const std::string & getStreetName() const
Returns the street name of this edge.
@ SUMO_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (used by Netedit)
GUIVisualizationColorSettings colorSettings
color settings
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
void addConnection(NBEdge::Connection nbCon, bool selectAfterCreation=false)
adds a connection
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
bool isPersonTrip() const
return true if tag correspond to a person trip
const Position & getChildPosition(const GNELane *lane)
get child position calculated in ChildConnections
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
void drawGeometryPoints(const GUIVisualizationSettings &s) const
draw geometry points
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
void setParametersStr(const std::string ¶msString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
GNEJunction * getGNEJunctionSource() const
returns the source-junction
double getEndOffset() const
Returns the offset to the destination node.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool isPersonPlan() const
return true if tag correspond to a person plan
std::set< GUIGlID > getLaneGlIDs() const
returns GLIDs of all lanes
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
const std::set< GNEDemandElement * > & getChildDemandElementsSortedByType(SumoXMLTag tag) const
return child demand elements sorted by type
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
std::vector< GNECrossing * > getGNECrossings()
get GNECrossings vinculated with this Edge
double y() const
Returns the y-position.
bool isAttributeEnabled(SumoXMLAttr key) const
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
void deleteLane(int index, bool recompute, bool shiftIndices)
delete lane
bool isPersonStop() const
return true if tag correspond to a person stop element
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
PositionVector resample(double maxLength) const
resample shape with the given number of points (equal spacing)
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void updateJunctionPosition(GNEJunction *junction, const Position &origPos)
update edge geometry after junction move
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
double getSpeed() const
Returns the speed allowed on this edge.
@ GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
bool geometryLike() const
whether this is structurally similar to a geometry node
An (internal) definition of a single lane of an edge.
PositionVector interpolateZ(double zStart, double zEnd) const
returned vector that varies z smoothly over its length
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
bool keepClear
whether the junction must be kept clear when using this connection
const SVCPermissions SVCAll
all VClasses are allowed
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
virtual std::string getAttribute(SumoXMLAttr key) const =0
void removePathElement(GNEDemandElement *pathElementChild)
remove path element (Only used by GNEHierarchicalParentElements::changeRouteEdges)
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void incRef(const std::string &debugMsg="")
Increarse reference.
bool drawAdditionals(const double exaggeration) const
check if additionals must be drawn
@ SUMO_TAG_PERSONTRIP_FROMTO
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
std::string myType
The type of the edge.
void addPathElement(GNEDemandElement *pathElementChild)
add path element (Only used by GNEHierarchicalParentElements::changeRouteEdges)
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static const double UNSPECIFIED_WIDTH
unspecified lane width
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
static const RGBColor ride
color for rides
void addLane(int index, bool recomputeShape, bool recomputeConnections, bool shiftIndices)
add lane
PositionVector customShape
custom shape for connection
void removeConnection(NBEdge::Connection nbCon)
removes a connection
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
double getFinalLength() const
get length that will be assigned to the lanes in the final network
GNENet * myNet
the net to inform about updates
void updateLinkState()
recompute cached myLinkState
@ SUMO_TAG_ROUTE
begin/end of the description of a route
const std::string & getTypeID() const
get ID of type
RGBColor selectedPersonPlanColor
person plan selection color (Rides, Walks, personStops...)
void renameEdge(GNEEdge *edge, const std::string &newID)
updates the map and reserves new id
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
void updateGeometry()
update pre-computed geometry information
GUIVisualizationSizeSettings addSize
bool hasString(const std::string &str) const
void add(const Position &pos)
Adds the given position to this one.
GUIColorer laneColorer
The lane colorer.
bool isInitialised() const
check if Boundary is Initialised
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
@ GNE_ATTR_SELECTED
element is selected
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
PositionVector bezier(int numPoints)
return a bezier interpolation
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
Boundary & grow(double by)
extends the boundary by the given amount
bool isValid(SumoXMLAttr key, const std::string &value)
static const RGBColor walk
color for walks
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
double endOffset
This lane's offset to the intersection begin.
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
bool isRide() const
return true if tag correspond to a ride element
const std::string & getTagStr() const
get tag assigned to this object in string format
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(....
LaneVector myLanes
vectgor with the lanes of this edge
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Stores the information about how to visualize structures.
void resetEndpoint(const Position &pos, GNEUndoList *undoList)
restores the endpoint to the junction position at the appropriate end
GNELane * getLaneByDisallowedVClass(const SUMOVehicleClass vClass) const
return the first lane that disallow a vehicle of type vClass (or the first lane, if none was found)
static const RGBColor vehicleTrips
color for vehicle trips
friend class GNEChange_Lane
Friend class.
A structure which describes a connection between edges or lanes.
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_TAG_EMBEDDEDROUTE
begin/end of the description of a embedded route (used in NETEDIT)
const std::string getOptionalName() const
Returns the street name.
bool showAllPersonPlans() const
check all person plans has to be show
@ GNE_ATTR_BIDIR
whether an edge is part of a bidirectional railway
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
double visibility
custom foe visiblity for connection
RGBColor selectedVehicleColor
vehicle selection color
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
NetworkEditMode networkEditMode
the current Network edit mode
const std::string & getID() const
Returns the id.
const T getColor(const double value) const
const std::vector< Connection > & getConnections() const
Returns the connections.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
GUIVisualizationTextSettings edgeName
NBNode * getFromNode() const
Returns the origin node of the edge.
const std::vector< T > & getSchemes() const
@ GNE_NMODE_MOVE
mode for moving network elements
GUIVisualizationTextSettings edgeValue
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge's geometry
@ SUMO_TAG_TRIP
a single trip definition (used by router)
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
void remakeGNEConnections()
remake connections
void push_front_noDoublePos(const Position &p)
insert in front a non double position
void setShapeStartPos(const Position &pos)
change Shape StartPos
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
double getDistance() const
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
static const RGBColor WHITE
double exaggeration
The size exaggeration (upscale)
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
@ GNE_ATTR_PARENT
parent of an additional element
bool hasLaneSpecificWidth() const
whether lanes differ in width
Boundary myMovingGeometryBoundary
boundary used during moving of elements
static const double walk
width for walks
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
NBEdge * getTurnDestination(bool possibleDestination=false) const
bool wasSplit()
whether this edge was created from a split
const std::string & getID() const
void setNumLanes(int numLanes, GNEUndoList *undoList)
changes the number of lanes. When reducing the number of lanes, higher-numbered lanes are removed fir...