59 {}, {}, {}, {}, {}, {}, {}),
62 myAmResponsible(
false),
64 myConnectionStatus(loaded ? FEATURE_LOADED : FEATURE_GUESSED),
65 myUpdateGeometry(
true) {
67 int numLanes = myNBEdge->getNumLanes();
68 myLanes.reserve(numLanes);
69 for (
int i = 0; i < numLanes; i++) {
70 myLanes.push_back(
new GNELane(
this, i));
71 myLanes.back()->
incRef(
"GNEEdge::GNEEdge");
74 for (
const auto& i : myLanes) {
78 updateCenteringBoundary(
false);
84 for (
const auto& lane :
myLanes) {
85 lane->decRef(
"GNEEdge::~GNEEdge");
86 if (lane->unreferenced()) {
88 WRITE_DEBUG(
"Deleting unreferenced " + lane->getTagStr() +
" '" + lane->getID() +
"' in GNEEdge destructor");
94 connection->decRef(
"GNEEdge::~GNEEdge");
95 if (connection->unreferenced()) {
97 WRITE_DEBUG(
"Deleting unreferenced " + connection->getTagStr() +
" '" + connection->getID() +
"' in GNEEdge destructor");
112 for (
const auto& lane :
myLanes) {
113 lane->updateGeometry();
117 connection->updateGeometry();
121 childAdditionals->updateGeometry();
125 childDemandElements->computePath();
126 childDemandElements->updateGeometry();
130 childGenericData->updateGeometry();
153 std::vector<int> geometryPointsToMove;
157 geometryPointsToMove.push_back(i);
174 int newIndex = index;
182 std::vector<int> geometryPointsToMove;
186 for (
int i = 1; i <= newIndex; i++) {
187 geometryPointsToMove.push_back(i);
192 for (
int i = index; i < (int)shapeToMove.size() - 1; i++) {
193 geometryPointsToMove.push_back(i);
232 if (!customStartPosition && (index == 0)) {
236 if (!customEndPosition && (index == lastIndex)) {
247 }
else if (index == lastIndex) {
254 shape.erase(shape.begin() + index);
312 for (
const auto& lane :
myLanes) {
362 for (
const auto& lane :
myLanes) {
367 additional->drawGL(s);
373 personStopEdge->drawGL(s);
379 for (
const auto& vehicleMap : vehiclesMap) {
380 for (
const auto& vehicle : vehicleMap.second) {
408 if (geom[index].distanceTo2D(clickPos) <
SNAP_RADIUS) {
421 undoList->
p_begin(
"remove endpoint");
425 undoList->
p_begin(
"remove endpoint");
437 undoList->
p_begin(
"set endpoint");
506 edge->updateGeometry();
509 edge->updateGeometry();
515 edge->updateGeometry();
518 edge->updateGeometry();
526 laneShape.
move2side(
myLanes.front()->getParentEdge()->getNBEdge()->getLaneWidth(
myLanes.front()->getIndex()) / 2);
527 return laneShape.front();
534 laneShape.
move2side(-1 *
myLanes.back()->getParentEdge()->getNBEdge()->getLaneWidth(
myLanes.back()->getIndex()) / 2);
535 return laneShape.front();
542 laneShape.
move2side(
myLanes.front()->getParentEdge()->getNBEdge()->getLaneWidth(
myLanes.front()->getIndex()) / 2);
543 return laneShape.back();
550 laneShape.
move2side(-1 *
myLanes.back()->getParentEdge()->getNBEdge()->getLaneWidth(
myLanes.back()->getIndex()) / 2);
551 return laneShape.back();
559 std::vector<GNEConnection*> retrievedConnections;
561 for (
const auto& connection : connections) {
565 retrievedConnections.push_back(retrievedGNEConnection);
572 retrievedGNEConnection->
incRef(
"GNEEdge::remakeGNEConnections");
580 connection->decRef();
582 if (connection->unreferenced()) {
586 WRITE_DEBUG(
"Deleting unreferenced " + connection->getTagStr() +
" '" + connection->getID() +
"' in rebuildGNEConnections()");
600 if (i->isAttributeCarrierSelected()) {
601 i->unselectAttributeCarrier();
604 i->decRef(
"GNEEdge::clearGNEConnections");
606 if (i->unreferenced()) {
608 WRITE_DEBUG(
"Deleting unreferenced " + i->getTagStr() +
" '" + i->getID() +
"' in clearGNEConnections()");
618 std::vector<GNEAdditional*> routeProbes;
621 routeProbes.push_back(i);
625 auto it = std::find(routeProbes.begin(), routeProbes.end(), routeProbe);
626 if (it == routeProbes.end()) {
629 return (
int)(it - routeProbes.begin());
634 std::vector<GNECrossing*>
636 std::vector<GNECrossing*> crossings;
638 if (i->checkEdgeBelong(
this)) {
639 crossings.push_back(i);
643 if (i->checkEdgeBelong(
this)) {
644 crossings.push_back(i);
669 for (
int i = 0; i < (int)
myLanes.size(); i++) {
695 for (
int i = 0; i < (int)
myLanes.size(); i++) {
714 std::set<GUIGlID> result;
716 result.insert(i->getGlID());
722 const std::vector<GNELane*>&
728 const std::vector<GNEConnection*>&
770 return "lane specific";
776 return "lane specific";
782 return "lane specific";
833 const std::string origValue =
myLanes.at(0)->getAttribute(key);
836 it->setAttribute(key, value, undoList);
955 return canParse<double>(value) && (parse<double>(value) > 0);
957 return canParse<int>(value) && (parse<double>(value) > 0);
959 return canParse<int>(value);
969 return canParse<PositionVector>(value);
977 return canParse<double>(value) && parse<double>(value) >= 0 && parse<double>(value) <
myNBEdge->
getLoadedLength();
979 return canParse<double>(value);
983 }
else if (canParse<Position>(value)) {
984 Position shapeStart = parse<Position>(value);
993 }
else if (canParse<Position>(value)) {
994 Position shapeEnd = parse<Position>(value);
1003 return canParse<bool>(value);
1023 const std::map<std::string, std::string>&
1068 const std::map<const GNELane*, std::vector<GNEDemandElement*> > laneVehiclesMap =
getVehiclesOverEdgeMap();
1070 for (
const auto& laneVehicle : laneVehiclesMap) {
1072 double totalLength = 0;
1073 for (
const auto& vehicle : laneVehicle.second) {
1077 double multiplier = 1;
1078 const double laneShapeLenght = laneVehicle.first->getLaneShape().length();
1079 if (laneShapeLenght == 0) {
1081 }
else if (totalLength > laneShapeLenght) {
1082 multiplier = (laneShapeLenght / totalLength);
1087 for (
const auto& vehicle : laneVehicle.second) {
1088 vehicle->updateDemandElementSpreadGeometry(laneVehicle.first, lenght * multiplier);
1099 const std::map<const GNELane*, std::vector<GNEDemandElement*> > laneVehiclesMap =
getVehiclesOverEdgeMap();
1101 for (
const auto& vehicleMap : laneVehiclesMap) {
1103 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosVehicles;
1105 std::vector<GNEEdge::StackDemandElements> stackedVehicles;
1107 for (
const auto& vehicle : vehicleMap.second) {
1113 if (posOverLane < 0) {
1114 posOverLane += vehicleMap.first->getLaneShape().length();
1117 departPosVehicles.push_back(std::make_pair(
StackPosition(departPos, length), vehicle));
1119 vehicle->updateDemandElementGeometry(vehicleMap.first, posOverLane);
1121 vehicle->updateDemandElementStackLabel(0);
1125 std::sort(departPosVehicles.begin(), departPosVehicles.end());
1127 for (
const auto& departPosVehicle : departPosVehicles) {
1132 if (stackedVehicles.empty()) {
1136 stackedVehicles[stackedVehicles.size() - 1].addDemandElements(vehicle);
1143 for (
const auto& vehicle : stackedVehicles) {
1145 if (vehicle.getDemandElements().size() > 1) {
1161 bool drawBigGeometryPoints =
false;
1163 drawBigGeometryPoints =
true;
1167 drawBigGeometryPoints =
true;
1170 double circleWidthSquared = circleWidth * circleWidth;
1179 if (color.
alpha() > 0) {
1183 glTranslated(0, 0, 1);
1189 glTranslated(pos.
x(), pos.
y(), 0.1);
1197 glTranslated(pos.
x(), pos.
y(), 0.2);
1205 if (drawBigGeometryPoints) {
1221 glTranslated(0, 0, 0.1);
1244 glTranslated(0, 0, 0.1);
1264 tuple(departPos, departPos + length) {
1270 return std::get<0>(*
this);
1276 return std::get<1>(*
this);
1281 tuple(stackedPosition, {
1289 std::get<1>(*this).push_back(demandElement);
1295 return std::get<0>(*
this);
1299 const std::vector<GNEDemandElement*>&
1301 return std::get<1>(*
this);
1334 throw InvalidArgument(
"GNEEdge::setAttribute (private) called for attr SUMO_ATTR_NUMLANES. This should never happen");
1376 WRITE_DEBUG(
"invalidating (removing) connections of edge '" +
getID() +
"' due it were guessed");
1380 WRITE_DEBUG(
"declaring connections of edge '" +
getID() +
"' as loaded (It will not be removed)");
1390 newShapeStart = parse<Position>(value);
1404 newShapeEnd = parse<Position>(value);
1415 if (parse<bool>(value)) {
1438 innenShape.pop_back();
1462 innenShape.pop_back();
1488 const int oldNumLanes = (int)
myLanes.size();
1489 for (
int i = oldNumLanes; i < numLanes; i++) {
1493 for (
int i = (oldNumLanes - 1); i > (numLanes - 1); i--) {
1531 myNBEdge->
addLane(index,
true, recomputeConnections, !recomputeConnections);
1538 lane =
new GNELane(
this, index);
1541 lane->
incRef(
"GNEEdge::addLane");
1553 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1564 i->remakeGNEConnections();
1568 i->remakeGNEConnections();
1582 if (lane ==
nullptr) {
1595 lane->
decRef(
"GNEEdge::removeLane");
1604 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1615 i->remakeGNEConnections();
1619 i->remakeGNEConnections();
1641 if (selectAfterCreation) {
1662 if (con !=
nullptr) {
1663 con->
decRef(
"GNEEdge::removeConnection");
1683 if ((i->getFromLaneIndex() == fromLane) && (i->getEdgeTo()->getNBEdge() == to) && (i->getToLaneIndex() == toLane)) {
1687 if (createIfNoExist) {
1691 WRITE_DEBUG(
"Created " + createdConnection->
getTagStr() +
" '" + createdConnection->
getID() +
"' in retrieveGNEConnection()");
1694 return createdConnection;
1706 i->setMicrosimID(
getNBEdge()->getLaneID(i->getIndex()));
1714 if (i->isRestricted(vclass)) {
1726 if (i->checkEdgeBelong(
this)) {
1738 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
1751 #ifdef DEBUG_SMOOTH_GEOM
1753 <<
" forElevation=" << forElevation
1756 <<
" smoothShape old=" << old <<
"\n";
1758 if (old.size() == 3 || old.size() == 4) {
1760 }
else if (old.size() > 4 && !forElevation) {
1762 init.push_back(old[0]);
1763 init.push_back(old[1]);
1764 init.push_back(old[-2]);
1765 init.push_back(old[-1]);
1771 if (incoming.size() == 1) {
1772 begShape = incoming[0]->getGeometry();
1774 assert(incoming.size() == 2);
1777 if (outgoing.size() == 1) {
1778 endShape = outgoing[0]->getGeometry();
1780 assert(outgoing.size() == 2);
1786 init.push_back(old[0]);
1789 init.push_back(old[-1]);
1793 init[1].setz(2 * init[0].z() - begZ);
1794 init[2].setz(2 * init[-1].z() - endZ);
1797 const double straightThresh =
DEG2RAD(oc.
getFloat(
"opendrive-output.straight-threshold"));
1800 #ifdef DEBUG_SMOOTH_GEOM
1802 std::cout <<
" begShape=" << begShape <<
" endShape=" << endShape <<
" forElevation=" << forElevation <<
" dist=" << dist <<
" ok=" << ok <<
" init=" << init <<
"\n";
1806 if (init.size() == 0) {
1809 const int numPoints =
MAX2(oc.
getInt(
"junctions.internal-link-detail"),
1811 return init.
bezier(numPoints);
1819 if (modifiedShape.size() < 2) {
1822 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
1832 if (elevationBase.size() == 0 || elevationBase[-1].z() != pos.z()) {
1833 elevationBase.push_back(pos);
1837 if (elevation.size() <= 2) {
1841 if (modifiedShape.size() < 5) {
1847 for (
int i = 1; i < (int)modifiedShape.size(); ++i) {
1848 seen += modifiedShape[i - 1].distanceTo2D(modifiedShape[i]);
1852 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
1874 geom.push_back(pos);
1880 const std::map<const GNELane*, std::vector<GNEDemandElement*> >
1883 std::vector<GNEDemandElement*> vehiclesOverEdge;
1885 std::map<const GNELane*, std::vector<GNEDemandElement*> > vehiclesOverEdgeMap;
1887 std::set<std::pair<double, GNEDemandElement*> > vehicles;
1891 (edgeChild->getParentEdges().front() ==
this)) {
1892 vehicles.insert(std::make_pair(edgeChild->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild));
1893 vehicles.insert(std::make_pair(edgeChild->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild));
1894 }
else if ((edgeChild->getTagProperty().getTag() ==
SUMO_TAG_ROUTE) && (edgeChild->getParentEdges().front() ==
this)) {
1895 for (
const auto& routeChild : edgeChild->getChildDemandElements()) {
1897 vehicles.insert(std::make_pair(routeChild->getAttributeDouble(
SUMO_ATTR_DEPART), routeChild));
1900 }
else if ((edgeChild->getTagProperty().getTag() ==
GNE_TAG_ROUTE_EMBEDDED) && (edgeChild->getParentEdges().front() ==
this)) {
1901 vehicles.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild->getParentDemandElements().front()));
1905 vehiclesOverEdge.reserve(vehicles.size());
1907 for (
const auto& vehicle : vehicles) {
1909 vehiclesOverEdge.push_back(vehicle.second);
1912 for (
const auto& vehicle : vehiclesOverEdge) {
1913 const GNELane* vehicleLane = vehicle->getFirstAllowedVehicleLane();
1915 vehiclesOverEdgeMap[vehicleLane].push_back(vehicle);
1918 return vehiclesOverEdgeMap;
1937 drawPosition.
mul(.5);
1938 if (spreadSuperposed) {
1942 const Position shift(dist * cos(shiftA), dist * sin(shiftA));
1943 drawPosition.
add(shift);
1949 if (drawAngle > 90 && drawAngle < 270) {
1957 if (drawStreetName) {
1966 if (activeScheme == 12) {
1969 }
else if (activeScheme == 13) {
1974 const double doubleValue = lastLane->
getColorValue(s, activeScheme);
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
#define WRITE_WARNING(msg)
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
const SVCPermissions SVCAll
all VClasses are allowed
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route (used in NETEDIT)
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ GNE_TAG_PERSONSTOP_EDGE
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ GNE_TAG_ROUTE_EMBEDDED
embedded route (used in NETEDIT)
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_MODIFICATION_STATUS
whether a feature has been loaded,guessed,modified or approved
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_SPREADTYPE
The information about how to spread the lanes from the given position.
@ GNE_ATTR_SHAPE_END
last coordinate of edge shape
@ GNE_ATTR_BIDIR
whether an edge is part of a bidirectional railway
@ GNE_ATTR_SHAPE_START
first coordinate of edge shape
const double SUMO_const_halfLaneWidth
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Boundary & grow(double by)
extends the boundary by the given amount
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
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, const int align=0, double width=-1)
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
static const std::string FEATURE_GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
void updateGeometry()
update pre-computed geometry information
void updateLinkState()
recompute cached myLinkState
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
bool deleteOnlyGeometryPoints() const
check if only delete geometry points checkbox is enabled
DeleteOptions * getDeleteOptions() const
get delete options
An Element which don't belongs to GNENet but has influency in the simulation.
void updateDemandElementStackLabel(const int stack)
update stack label
const StackPosition & getStackPosition() const
get stack position
const std::vector< GNEDemandElement * > & getDemandElements() const
get demand elements
void addDemandElements(GNEDemandElement *demandElement)
add demand elment to current StackDemandElements
StackDemandElements(const StackPosition stackedPosition, GNEDemandElement *demandElement)
constructor
Stack position (used to stack demand elements over edges)
double beginPosition() const
get begin position
StackPosition(const double departPos, const double length)
constructor
double endPosition() const
get end position
A road/street connecting two junctions (netedit-version)
const Position getFrontDownShapePosition() const
get front down shape position
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
void drawEdgeName(const GUIVisualizationSettings &s) const
draw edge name
void setNumLanes(int numLanes, GNEUndoList *undoList)
changes the number of lanes. When reducing the number of lanes, higher-numbered lanes are removed fir...
void remakeGNEConnections()
remake connections
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
friend class GNEChange_Lane
Friend class.
GNEEdge * getOppositeEdge() const
get opposite edge
void smooth(GNEUndoList *undoList)
make geometry smooth
void updateGeometry()
update pre-computed geometry information
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
void copyEdgeType(const GNEEdgeType *edgeType, GNEUndoList *undoList)
copy edge attributes from edgeType
NBEdge * getNBEdge() const
returns the internal NBEdge
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
const std::map< const GNELane *, std::vector< GNEDemandElement * > > getVehiclesOverEdgeMap() const
get vehicles a that start over this edge
std::set< GUIGlID > getLaneGlIDs() const
returns GLIDs of all lanes
const Position getFrontUpShapePosition() const
get front up shape position
void setGeometry(PositionVector geom, bool inner)
update edge geometry and inform the lanes
void smoothElevation(GNEUndoList *undoList)
smooth elevation with regard to adjoining edges
bool clickedOverShapeEnd(const Position &pos)
return true if user clicked over ShapeEnd
void updateVehicleStackLabels()
bool isValid(SumoXMLAttr key, const std::string &value)
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
LaneVector myLanes
vector with the lanes of this edge
static const double SNAP_RADIUS
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)
void removeConnection(NBEdge::Connection nbCon)
removes a connection
bool myWasSplit
whether this edge was created from a split
void removeLane(GNELane *lane, bool recomputeConnections)
@briefdecrease the number of lanes by one. argument is only used to increase robustness (assertions)
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
void updateSecondParentJunction(const std::string &value)
update last parent junction
PositionVector smoothShape(const PositionVector &shape, bool forElevation)
return smoothed shape
bool wasSplit()
whether this edge was created from a split
NBEdge * myNBEdge
the underlying NBEdge
void removeEdgeFromCrossings(GNEJunction *junction, GNEUndoList *undoList)
remove crossing of junction
Position getPositionInView() const
Returns position of hierarchical element in view.
void addLane(GNELane *lane, const NBEdge::Lane &laneAttrs, bool recomputeConnections)
increase number of lanes by one use the given attributes and restore the GNELane
GNEConnection * retrieveGNEConnection(int fromLane, NBEdge *to, int toLane, bool createIfNoExist=true)
get GNEConnection if exist, and if not create it if create is enabled
ConnectionVector myGNEConnections
vector with the connections of this edge
void editEndpoint(Position pos, GNEUndoList *undoList)
makes pos the new geometry endpoint at the appropriate end, or remove current existent endpoint
void resetBothEndpoint(GNEUndoList *undoList)
restores both endpoint to the junction position at the appropriate end
Position getSplitPos(const Position &clickPos)
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
std::string getAttribute(SumoXMLAttr key) const
void copyTemplate(const GNEInspectorFrame::TemplateEditor::EdgeTemplate &edgeTemplate, GNEUndoList *undoList)
copy edge attributes from edgetemplate
int getRouteProbeRelativePosition(GNERouteProbe *routeProbe) const
obtain relative positions of RouteProbes
std::string myConnectionStatus
modification status of the connections
const std::string getOptionalName() const
Returns the street name.
void clearGNEConnections()
clear current connections
bool myUpdateGeometry
@brif flag to enable/disable update geometry of lanes (used mainly by setNumLanes)
const Position getBackDownShapePosition() const
get back down shape position
bool areStackPositionOverlapped(const GNEEdge::StackPosition &vehicleA, const GNEEdge::StackPosition &vehicleB) const
check if given stacked positions are overlapped
void updateFirstParentJunction(const std::string &value)
update front parent junction
void straightenElevation(GNEUndoList *undoList)
interpolate z values linear between junctions
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void setShapeStartPos(const Position &pos)
change Shape StartPos
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setMicrosimID(const std::string &newID)
override to also set lane ids
const Position getBackUpShapePosition() const
get back up shape position
void resetEndpoint(const Position &pos, GNEUndoList *undoList)
restores the endpoint to the junction position at the appropriate end
bool isAttributeEnabled(SumoXMLAttr key) const
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void addConnection(NBEdge::Connection nbCon, bool selectAfterCreation=false)
adds a connection
void drawEdgeGeometryPoints(const GUIVisualizationSettings &s, const GNELane *lane) const
draw edge geometry points (note: This function is called by GNELane::drawGL(...)
bool clickedOverShapeStart(const Position &pos)
std::vector< GNECrossing * > getGNECrossings()
get GNECrossings vinculated with this Edge
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)
void updateVehicleSpreadGeometries()
void updateJunctionPosition(GNEJunction *junction, const Position &origPos)
update edge geometry after junction move
bool myAmResponsible
whether we are responsible for deleting myNBNode
GNEEdge(GNENet *net, NBEdge *nbe, bool wasSplit=false, bool loaded=false)
Constructor.
void setShapeEndPos(const Position &pos)
change Shape EndPos
const std::vector< GNELaneType * > & getLaneTypes() const
get laneTypes
std::string getAttribute(SumoXMLAttr key) const
void removeCurrentEditedAttributeCarrier(const GNEAttributeCarrier *HE)
if given AttributeCarrier is the same of myHE, set it as nullptr
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEEdge * > & getChildEdges() const
get child edges
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
void replaceParentElements(T *elementChild, const U &newParents)
replace parent elements
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
GNEFrameModuls::HierarchicalElementTree * getHierarchicalElementTree() const
get HierarchicalElementTree modul
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
void updateGeometry()
update pre-computed geometry information (including crossings)
NBNode * getNBNode() const
Return net build node.
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=FEATURE_GUESSED)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
int getIndex() const
returns the index of the lane
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
std::vector< int > geometryPointsToMove
shape points to move (of shapeToMove)
PositionVector shapeToUpdate
shape to update (edited in moveElement)
void updateID(GNEAttributeCarrier *AC, const std::string newID)
update ID
A NBNetBuilder extended by visualisation and editing capabilities.
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
GNEViewNet * getViewNet() const
get view net
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true) const
get junction by id
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const std::string & getID() const
get ID
Boundary myBoundary
object boundary
void decRef(const std::string &debugMsg="")
Decrease reference.
void incRef(const std::string &debugMsg="")
Increarse reference.
bool unreferenced()
check if object ins't referenced
Representation of a RouteProbe in netedit.
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
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...
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
GNEViewParent * getViewParent() const
get the net object
void removeFromAttributeCarrierInspected(const GNEAttributeCarrier *AC)
remove given AC of list of inspected Attribute Carriers
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
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.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
const T getColor(const double value) const
const std::vector< T > & getSchemes() const
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.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
bool drawBoundaries
enable or disable draw boundaries
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationDetailSettings detailSettings
detail settings
GUIVisualizationSizeSettings addSize
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
GUIVisualizationTextSettings edgeValue
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
bool drawDottedContour() const
check if dotted contour can be drawn
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
GUIVisualizationTextSettings streetName
GUIColorer laneColorer
The lane colorer.
GUIVisualizationTextSettings edgeName
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
GUIColorer junctionColorer
The junction colorer.
std::string edgeParam
key for coloring by edge parameter
static const double INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
The representation of a single edge during network building.
void setStreetName(const std::string &name)
sets the street name of this edge
void mirrorX()
mirror coordinates along the x-axis
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
set preferred Vehicle Class
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
double getLaneWidth() const
Returns the default width of lanes of this edge.
const std::string & getStreetName() const
Returns the street name of this edge.
void addLane(int index, bool recomputeShape, bool recomputeConnections, bool shiftIndices)
add lane
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
std::string myType
The type of the edge.
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
void setDistance(double distance)
set lane specific speed (negative lane implies set for all lanes)
const std::string & getID() const
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
NBNode * getToNode() const
Returns the destination node of the edge.
double getSpeed() const
Returns the speed allowed on this edge.
double getDistance() const
static const double UNSPECIFIED_LOADED_LENGTH
no length override given
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
int getNumLanes() const
Returns the number of lanes.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
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)
void invalidateConnections(bool reallowSetting=false)
invalidate current connections of edge
void deleteLane(int index, bool recompute, bool shiftIndices)
delete lane
bool hasLaneSpecificWidth() const
whether lanes differ in width
bool setConnection(int lane, NBEdge *destEdge, int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, KeepClear keepClear=KEEPCLEAR_UNSPECIFIED, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, double length=myDefaultConnectionLength, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED, SVCPermissions permissions=SVC_UNSPECIFIED, bool postProcess=false)
Adds a connection to a certain lane of a certain edge.
@ USER
The connection was given by the user.
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
NBEdge * getTurnDestination(bool possibleDestination=false) const
int getPriority() const
Returns the priority of the edge.
static const double UNSPECIFIED_WIDTH
unspecified lane width
const std::vector< Connection > & getConnections() const
Returns the connections.
const std::string & getTypeID() const
get ID of type
void declareConnectionsAsLoaded(EdgeBuildingStep step=EdgeBuildingStep::LANES2LANES_USER)
declares connections as fully loaded. This is needed to avoid recomputing connections if an edge has ...
double getEndOffset() const
Returns the offset to the destination node.
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Lane & getLaneStruct(int lane)
void setLoadedLength(double val)
set loaded length
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
double getFinalLength() const
get length that will be assigned to the lanes in the final network
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge's geometry
int myPriority
The priority of the edge.
NBNode * getFromNode() const
Returns the origin node of the edge.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
const Position & getPosition() const
bool geometryLike() const
whether this is structurally similar to a geometry node
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
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void resetWritable()
Resets all options to be writeable.
static OptionsCont & getOptions()
Retrieves the options.
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string ¶msString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
static const Position INVALID
used to indicate that a position is valid
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double x() const
Returns the x-position.
void add(const Position &pos)
Adds the given position to this one.
void mul(double val)
Multiplies both positions with the given value.
double z() const
Returns the z-position.
double y() const
Returns the y-position.
double length2D() const
Returns the length.
double length() const
Returns the length.
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
PositionVector resample(double maxLength, const bool adjustEnd) const
resample shape (i.e. transform to segments, equal spacing)
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
void add(double xoff, double yoff, double zoff)
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
PositionVector interpolateZ(double zStart, double zEnd) const
returned vector that varies z smoothly over its length
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
static const PositionVector EMPTY
empty Vector
PositionVector bezier(int numPoints)
return a bezier interpolation
int insertAtClosest(const Position &p, bool interpolateZ)
inserts p between the two closest positions
void push_front(const Position &p)
insert in front a Position
int indexOfClosest(const Position &p) const
index of the closest position to p
void pop_front()
pop first Position
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor WHITE
unsigned char alpha() const
Returns the alpha-amount of the color.
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
bool hasString(const std::string &str) const
static void drawDottedContourEdge(const DottedContourType type, const GUIVisualizationSettings &s, const GNEEdge *edge, const bool drawFrontExtreme, const bool drawBackExtreme)
draw dotted contour for the given dottedGeometries (used by edges)
std::map< SumoXMLAttr, std::string > edgeParameters
edge parameters
std::vector< std::map< SumoXMLAttr, std::string > > laneParameters
lane parameters
bool showDemandElements() const
check if show demand elements checkbox is enabled
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool editingElevation() const
check if we're editing elevation
bool showDemandElements() const
check if show demand elements checkbox is enabled
RGBColor selectedEdgeColor
edge selection color
static const double geometryPointsText
details for Geometry Points Texts
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double scaledSize(double scale, double constFactor=0.1) const
get scale size
A structure which describes a connection between edges or lanes.
int fromLane
The lane the connections starts at.
int toLane
The lane the connections yields in.
double speed
custom speed for connection
NBEdge * toEdge
The edge the connections yields in.
KeepClear keepClear
whether the junction must be kept clear when using this connection
double customLength
custom length for connection
bool uncontrolled
check if Connection is uncontrolled
PositionVector customShape
custom shape for connection
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
double contPos
custom position for internal junction on this connection
double visibility
custom foe visiblity for connection
An (internal) definition of a single lane of an edge.
double width
This lane's width.
double endOffset
This lane's offset to the intersection begin.
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
double speed
The speed allowed on this lane.
SVCPermissions permissions
List of vehicle types that are allowed on this lane.