52#define ENDPOINT_TOLERANCE 2
72myAmResponsible(
false),
74myConnectionStatus(loaded ? FEATURE_LOADED : FEATURE_GUESSED),
75myUpdateGeometry(true) {
77 int numLanes = myNBEdge->getNumLanes();
78 myLanes.reserve(numLanes);
79 for (
int i = 0; i < numLanes; i++) {
80 myLanes.push_back(
new GNELane(
this, i));
81 myLanes.back()->
incRef(
"GNEEdge::GNEEdge");
84 for (
const auto& lane : myLanes) {
85 lane->updateGeometry();
88 updateCenteringBoundary(
false);
94 for (
const auto& lane :
myLanes) {
95 lane->decRef(
"GNEEdge::~GNEEdge");
96 if (lane->unreferenced()) {
102 WRITE_DEBUG(
"Deleting unreferenced " + lane->getTagStr() +
" '" + lane->getID() +
"' in GNEEdge destructor");
108 connection->decRef(
"GNEEdge::~GNEEdge");
109 if (connection->unreferenced()) {
115 WRITE_DEBUG(
"Deleting unreferenced " + connection->getTagStr() +
" '" + connection->getID() +
"' in GNEEdge destructor");
137 return "Parent junctions are in the same position: " +
148 for (
const auto& lane :
myLanes) {
149 lane->updateGeometry();
153 connection->updateGeometry();
157 childAdditional->updateGeometry();
161 childDemandElement->updateGeometry();
165 childGenericData->updateGeometry();
170 childAdditional->computePathElement();
173 childDemandElement->computePathElement();
176 childGenericData->computePathElement();
191 return myLanes.front()->getPositionInView();
245 if (shape[index].distanceSquaredTo2D(clickedPosition) >
getSnapRadius(
true)) {
249 if (!customStartPosition && (index == 0)) {
253 if (!customEndPosition && (index == lastIndex)) {
264 }
else if (index == lastIndex) {
271 shape.erase(shape.begin() + index);
325 for (
const auto& geometryPoint : innenShape) {
326 if (geometryPoint.distanceSquaredTo2D(pos) < snapRadius) {
368 for (
const auto& lane :
myLanes) {
369 lane->updateCenteringBoundary(
false);
372 for (
const auto& additional : lane->getChildAdditionals()) {
432 for (
const auto& lane :
myLanes) {
489 if (geom[index].distanceSquaredTo2D(clickPos) <
getSnapRadius(
true)) {
526 if (geom[index].distanceSquaredTo2D(pos) <
getSnapRadius(
true)) {
527 newPos = geom[index];
535 if (geom[index].distanceSquaredTo2D(pos) <
getSnapRadius(
true)) {
536 newPos = geom[index];
591 edge->updateGeometry();
594 edge->updateGeometry();
600 edge->updateGeometry();
603 edge->updateGeometry();
611 laneShape.
move2side(
myLanes.front()->getParentEdge()->getNBEdge()->getLaneWidth(
myLanes.front()->getIndex()) / 2);
612 return laneShape.front();
619 laneShape.
move2side(-1 *
myLanes.back()->getParentEdge()->getNBEdge()->getLaneWidth(
myLanes.back()->getIndex()) / 2);
620 return laneShape.front();
627 laneShape.
move2side(
myLanes.front()->getParentEdge()->getNBEdge()->getLaneWidth(
myLanes.front()->getIndex()) / 2);
628 return laneShape.back();
635 laneShape.
move2side(-1 *
myLanes.back()->getParentEdge()->getNBEdge()->getLaneWidth(
myLanes.back()->getIndex()) / 2);
636 return laneShape.back();
644 std::vector<GNEConnection*> retrievedConnections;
646 for (
const auto& connection : connections) {
649 if (junctionsReady) {
652 retrievedConnections.push_back(retrievedGNEConnection);
659 retrievedGNEConnection->
incRef(
"GNEEdge::remakeGNEConnections");
667 connection->decRef();
675 if (connection->unreferenced()) {
678 WRITE_DEBUG(
"Deleting unreferenced " + connection->getTagStr() +
" '" + connection->getID() +
"' in rebuildGNEConnections()");
692 if (connection->isAttributeCarrierSelected()) {
693 connection->unselectAttributeCarrier();
696 connection->decRef(
"GNEEdge::clearGNEConnections");
704 if (connection->unreferenced()) {
706 WRITE_DEBUG(
"Deleting unreferenced " + connection->getTagStr() +
" '" + connection->getID() +
"' in clearGNEConnections()");
716 std::vector<GNEAdditional*> routeProbes;
719 routeProbes.push_back(i);
723 auto it = std::find(routeProbes.begin(), routeProbes.end(), routeProbe);
724 if (it == routeProbes.end()) {
727 return (
int)(it - routeProbes.begin());
732std::vector<GNECrossing*>
734 std::vector<GNECrossing*> crossings;
736 if (i->checkEdgeBelong(
this)) {
737 crossings.push_back(i);
741 if (i->checkEdgeBelong(
this)) {
742 crossings.push_back(i);
772 for (
int i = 0; i < (int)
myLanes.size(); i++) {
805 for (
int i = 0; i < (int)
myLanes.size(); i++) {
831 std::set<GUIGlID> result;
833 result.insert(i->getGlID());
839const std::vector<GNELane*>&
845const std::vector<GNEConnection*>&
887 return "lane specific";
893 return "lane specific";
899 return "lane specific";
907 return "lane specific";
971 const std::string origValue =
myLanes.at(0)->getAttribute(key);
974 it->setAttribute(key, value, undoList);
1040 change->forceChange();
1085 if (updateTemplate) {
1117 return canParse<double>(value) && (parse<double>(value) > 0);
1119 return canParse<double>(value) && (parse<double>(value) > 0);
1121 return canParse<int>(value) && (parse<double>(value) > 0);
1123 return canParse<int>(value);
1125 if (value.empty()) {
1137 return canParse<PositionVector>(value);
1143 if (value.empty() || (value ==
"default")) {
1146 return canParse<double>(value) && ((parse<double>(value) >= -1) || (parse<double>(value) ==
NBEdge::UNSPECIFIED_WIDTH));
1149 return canParse<double>(value) && parse<double>(value) >= 0 && parse<double>(value) <
myNBEdge->
getLoadedLength();
1151 if (value.empty()) {
1154 return canParse<double>(value);
1157 if (value.empty()) {
1159 }
else if (canParse<Position>(value)) {
1160 Position shapeStart = parse<Position>(value);
1167 if (value.empty()) {
1169 }
else if (canParse<Position>(value)) {
1170 Position shapeEnd = parse<Position>(value);
1179 return canParse<int>(value) && (parse<double>(value) >= 0);
1183 return canParse<bool>(value);
1265 const std::map<const GNELane*, std::vector<GNEDemandElement*> > laneVehiclesMap =
getVehiclesOverEdgeMap();
1267 for (
const auto& laneVehicle : laneVehiclesMap) {
1269 double totalLength = 0;
1270 for (
const auto& vehicle : laneVehicle.second) {
1274 double multiplier = 1;
1275 const double laneShapeLength = laneVehicle.first->getLaneShape().length();
1276 if (laneShapeLength == 0) {
1278 }
else if (totalLength > laneShapeLength) {
1279 multiplier = (laneShapeLength / totalLength);
1284 for (
const auto& vehicle : laneVehicle.second) {
1285 vehicle->updateDemandElementSpreadGeometry(laneVehicle.first, length * multiplier);
1296 const std::map<const GNELane*, std::vector<GNEDemandElement*> > laneVehiclesMap =
getVehiclesOverEdgeMap();
1298 for (
const auto& vehicleMap : laneVehiclesMap) {
1300 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosVehicles;
1302 std::vector<GNEEdge::StackDemandElements> stackedVehicles;
1304 for (
const auto& vehicle : vehicleMap.second) {
1310 if (posOverLane < 0) {
1311 posOverLane += vehicleMap.first->getLaneShape().length();
1314 departPosVehicles.push_back(std::make_pair(
StackPosition(departPos, length), vehicle));
1316 vehicle->updateDemandElementGeometry(vehicleMap.first, posOverLane);
1318 vehicle->updateDemandElementStackLabel(0);
1322 std::sort(departPosVehicles.begin(), departPosVehicles.end());
1324 for (
const auto& departPosVehicle : departPosVehicles) {
1329 if (stackedVehicles.empty()) {
1333 stackedVehicles[stackedVehicles.size() - 1].addDemandElements(vehicle);
1340 for (
const auto& vehicle : stackedVehicles) {
1342 if (vehicle.getDemandElements().size() > 1) {
1354 const std::map<const GNELane*, std::vector<GNEDemandElement*> > lanePersonsMap =
getPersonsOverEdgeMap();
1356 for (
const auto& personMap : lanePersonsMap) {
1358 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosPersons;
1360 std::vector<GNEEdge::StackDemandElements> stackedPersons;
1362 for (
const auto& person : personMap.second) {
1366 departPosPersons.push_back(std::make_pair(
StackPosition(departPos, 1.8), person));
1368 person->updateDemandElementGeometry(personMap.first, departPos);
1370 person->updateDemandElementStackLabel(0);
1374 std::sort(departPosPersons.begin(), departPosPersons.end());
1376 for (
const auto& departPosPerson : departPosPersons) {
1381 if (stackedPersons.empty()) {
1385 stackedPersons[stackedPersons.size() - 1].addDemandElements(person);
1392 for (
const auto& person : stackedPersons) {
1394 if (person.getDemandElements().size() > 1) {
1408 for (
const auto& containerMap : laneContainersMap) {
1410 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosContainers;
1412 std::vector<GNEEdge::StackDemandElements> stackedContainers;
1414 for (
const auto& container : containerMap.second) {
1418 departPosContainers.push_back(std::make_pair(
StackPosition(departPos, 1.8), container));
1420 container->updateDemandElementGeometry(containerMap.first, departPos);
1422 container->updateDemandElementStackLabel(0);
1426 std::sort(departPosContainers.begin(), departPosContainers.end());
1428 for (
const auto& departPosContainer : departPosContainers) {
1433 if (stackedContainers.empty()) {
1437 stackedContainers[stackedContainers.size() - 1].addDemandElements(container);
1444 for (
const auto& container : stackedContainers) {
1446 if (container.getDemandElements().size() > 1) {
1457 const bool drawFrontExtreme,
const bool drawBackExtreme,
const double exaggeration) {
1458 if (edge->
getLanes().size() == 1) {
1461 laneDrawingConstants.
halfWidth * exaggeration, 1, drawFrontExtreme, drawBackExtreme);
1482 GUIDottedGeometry extremes(s, dottedGeometryTop, drawFrontExtreme, dottedGeometryBot, drawBackExtreme);
1490 dottedGeometryColor.
reset();
1508 while (edgeAngle < 0) {
1512 edgeAngle = fmod(edgeAngle, 360);
1514 return edgeAngle >= 0 && edgeAngle < 180;
1523 for (
const auto& incomingEdge : incomingEdges) {
1524 for (
const auto& connection : incomingEdge->getGNEConnections()) {
1525 if (connection->getEdgeTo() ==
this) {
1542 for (
const auto& outgoingEdge :
getParentJunctions().back()->getGNEOutgoingEdges()) {
1544 return outgoingEdge;
1555 pair(departPos, departPos + length) {
1572 pair(stackedPosition, {
1580 second.push_back(demandElement);
1590const std::vector<GNEDemandElement*>&
1603 if (stop->getTagProperty().isStop() || stop->getTagProperty().isStopPerson()) {
1608 for (
const auto& lane :
myLanes) {
1609 for (
const auto& stop : lane->getChildDemandElements()) {
1610 if (stop->getTagProperty().isStop() || stop->getTagProperty().isStopPerson()) {
1639 throw InvalidArgument(
"GNEEdge::setAttribute (private) called for attr SUMO_ATTR_NUMLANES. This should never happen");
1644 if (value.empty()) {
1672 if (value.empty() || (value ==
"default")) {
1686 if (value.empty()) {
1695 WRITE_DEBUG(
"invalidating (removing) connections of edge '" +
getID() +
"' due it were guessed");
1699 WRITE_DEBUG(
"declaring connections of edge '" +
getID() +
"' as loaded (It will not be removed)");
1709 newShapeStart = parse<Position>(value);
1723 newShapeEnd = parse<Position>(value);
1735 if (parse<bool>(value)) {
1745 if (value.empty()) {
1777 innenShape.pop_back();
1798 innenShapeToUpdate.pop_back();
1806 if (innenShapeToUpdate.size() > 0) {
1830 const int oldNumLanes = (int)
myLanes.size();
1833 if (oppositeID !=
"") {
1837 for (
int i = oldNumLanes; i < numLanes; i++) {
1841 for (
int i = (oldNumLanes - 1); i > (numLanes - 1); i--) {
1845 if (oppositeID !=
"") {
1884 myNBEdge->
addLane(index,
true, recomputeConnections, !recomputeConnections);
1890 lane =
new GNELane(
this, index);
1893 lane->
incRef(
"GNEEdge::addLane");
1908 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1919 fromEdge->remakeGNEConnections();
1923 toEdge->remakeGNEConnections();
1937 if (lane ==
nullptr) {
1950 lane->
decRef(
"GNEEdge::removeLane");
1961 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1972 fromEdge->remakeGNEConnections();
1976 toEdge->remakeGNEConnections();
1998 if (selectAfterCreation) {
2019 if (connection !=
nullptr) {
2020 connection->
decRef(
"GNEEdge::removeConnection");
2034 WRITE_DEBUG(
"Deleting unreferenced " + connection->
getTagStr() +
" '" + connection->
getID() +
"' in removeConnection()");
2045 if ((connection->getFromLaneIndex() == fromLane) && (connection->getEdgeTo()->getNBEdge() == to) && (connection->getToLaneIndex() == toLane)) {
2049 if (createIfNoExist) {
2068 for (
const auto& lane :
myLanes) {
2076 for (
const auto& lane :
myLanes) {
2077 if (lane->isRestricted(vclass)) {
2089 if (crossing->checkEdgeBelong(
this)) {
2101 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
2114#ifdef DEBUG_SMOOTH_GEOM
2116 <<
" forElevation=" << forElevation
2119 <<
" smoothShape old=" << old <<
"\n";
2121 if (old.size() == 3 || old.size() == 4) {
2123 }
else if (old.size() > 4 && !forElevation) {
2125 init.push_back(old[0]);
2126 init.push_back(old[1]);
2127 init.push_back(old[-2]);
2128 init.push_back(old[-1]);
2134 if (incoming.size() == 1) {
2135 begShape = incoming[0]->getGeometry();
2137 assert(incoming.size() == 2);
2140 if (outgoing.size() == 1) {
2141 endShape = outgoing[0]->getGeometry();
2143 assert(outgoing.size() == 2);
2149 init.push_back(old[0]);
2152 init.push_back(old[-1]);
2156 init[1].setz(2 * init[0].z() - begZ);
2157 init[2].setz(2 * init[-1].z() - endZ);
2160 const double straightThresh =
DEG2RAD(neteditOptions.getFloat(
"opendrive-output.straight-threshold"));
2163#ifdef DEBUG_SMOOTH_GEOM
2165 std::cout <<
" begShape=" << begShape <<
" endShape=" << endShape <<
" forElevation=" << forElevation <<
" dist=" << dist <<
" ok=" << ok <<
" init=" << init <<
"\n";
2169 if (init.size() == 0) {
2172 const int numPoints =
MAX2(neteditOptions.getInt(
"junctions.internal-link-detail"),
2173 int(old.
length2D() / neteditOptions.getFloat(
"opendrive.curve-resolution")));
2174 return init.
bezier(numPoints);
2182 if (modifiedShape.size() < 2) {
2185 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
2195 if (elevationBase.size() == 0 || elevationBase[-1].z() != pos.z()) {
2196 elevationBase.push_back(pos);
2200 if (elevation.size() <= 2) {
2204 if (modifiedShape.size() < 5) {
2210 for (
int i = 1; i < (int)modifiedShape.size(); ++i) {
2211 seen += modifiedShape[i - 1].distanceTo2D(modifiedShape[i]);
2215 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
2237 geom.push_back(pos);
2243const std::map<const GNELane*, std::vector<GNEDemandElement*> >
2246 std::vector<GNEDemandElement*> vehiclesOverEdge;
2248 std::map<const GNELane*, std::vector<GNEDemandElement*> > vehiclesOverEdgeMap;
2250 std::set<std::pair<double, GNEDemandElement*> > vehicles;
2254 (edgeChild->getParentEdges().front() ==
this)) {
2255 vehicles.insert(std::make_pair(edgeChild->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild));
2256 vehicles.insert(std::make_pair(edgeChild->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild));
2257 }
else if ((edgeChild->getTagProperty().getTag() ==
SUMO_TAG_ROUTE) && (edgeChild->getParentEdges().front() ==
this)) {
2258 for (
const auto& routeChild : edgeChild->getChildDemandElements()) {
2260 vehicles.insert(std::make_pair(routeChild->getAttributeDouble(
SUMO_ATTR_DEPART), routeChild));
2263 }
else if ((edgeChild->getTagProperty().getTag() ==
GNE_TAG_ROUTE_EMBEDDED) && (edgeChild->getParentEdges().front() ==
this)) {
2264 vehicles.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild->getParentDemandElements().front()));
2268 vehiclesOverEdge.reserve(vehicles.size());
2270 for (
const auto& vehicle : vehicles) {
2272 vehiclesOverEdge.push_back(vehicle.second);
2275 for (
const auto& vehicle : vehiclesOverEdge) {
2276 const GNELane* vehicleLane = vehicle->getFirstPathLane();
2278 vehiclesOverEdgeMap[vehicleLane].push_back(vehicle);
2281 return vehiclesOverEdgeMap;
2285const std::map<const GNELane*, std::vector<GNEDemandElement*> >
2288 std::vector<GNEDemandElement*> personsOverEdge;
2290 std::map<const GNELane*, std::vector<GNEDemandElement*> > personsOverEdgeMap;
2292 std::set<std::pair<double, GNEDemandElement*> > persons;
2295 if (edgeChild->getTagProperty().isPersonPlan()) {
2296 persons.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPARTPOS), edgeChild->getParentDemandElements().front()));
2300 personsOverEdge.reserve(persons.size());
2302 for (
const auto& person : persons) {
2304 personsOverEdge.push_back(person.second);
2307 for (
const auto& person : personsOverEdge) {
2308 const GNELane* personLane = person->getFirstPathLane();
2310 personsOverEdgeMap[personLane].push_back(person);
2313 return personsOverEdgeMap;
2318const std::map<const GNELane*, std::vector<GNEDemandElement*> >
2321 std::vector<GNEDemandElement*> containersOverEdge;
2323 std::map<const GNELane*, std::vector<GNEDemandElement*> > containersOverEdgeMap;
2325 std::set<std::pair<double, GNEDemandElement*> > containers;
2328 if (edgeChild->getTagProperty().isContainerPlan()) {
2329 containers.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPARTPOS), edgeChild->getParentDemandElements().front()));
2333 containersOverEdge.reserve(containers.size());
2335 for (
const auto& container : containers) {
2337 containersOverEdge.push_back(container.second);
2340 for (
const auto& container : containersOverEdge) {
2341 const GNELane* containerLane = container->getFirstPathLane();
2342 if (containerLane) {
2343 containersOverEdgeMap[containerLane].push_back(container);
2346 return containersOverEdgeMap;
2353 const bool validScale = (s.
scale > 8.0);
2363 const double circleWidthSquared = circleWidth * circleWidth;
2371 if (geometryPointColor.
alpha() != 0) {
2377 if (bigGeometryPoints) {
2388 if (bigGeometryPoints) {
2396 glTranslated(geometryPointPos.x(), geometryPointPos.y(), 0.1);
2402 glTranslated(0, 0, 0.2);
2411 if (bigGeometryPoints) {
2445 glTranslated(geometryPointPos.x(), geometryPointPos.y(), 0.1);
2455 glTranslated(0, 0, 0.2);
2501 glTranslated(geometryPointPos.x(), geometryPointPos.y(), 0.1);
2511 glTranslated(0, 0, 0.2);
2550 drawPosition.
mul(.5);
2551 if (spreadSuperposed) {
2555 const Position shift(dist * cos(shiftA), dist * sin(shiftA));
2556 drawPosition.
add(shift);
2562 if (drawAngle > 90 && drawAngle < 270) {
2570 if (drawStreetName) {
2579 if (activeScheme == 12) {
2582 }
else if (activeScheme == 13) {
2587 const double doubleValue = lastLane->
getColorValue(s, activeScheme);
2612 for (
const auto& lane :
getLanes()) {
2625 additional->drawGL(s);
2631 stopEdge->drawGL(s);
2637 for (
const auto& vehicleMap : vehiclesMap) {
2638 for (
const auto& vehicle : vehicleMap.second) {
2651 std::vector<GNEAdditional*> TAZSourceSinks;
2656 TAZSourceSinks.push_back(additional);
2659 if (TAZSourceSinks.size() > 0) {
2663 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2664 if (TAZSourceSink == frontAC) {
2668 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2669 if (TAZSourceSink != frontAC) {
2674 bool selected =
false;
2675 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2676 if (TAZSourceSink->isAttributeCarrierSelected()) {
2681 for (
const auto& lane :
myLanes) {
2695 glTranslated(0, 0, 0.1);
2704 lane->getLaneGeometry(), laneDrawingConstants.
halfWidth);
2709 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2710 if (TAZSourceSink == frontAC) {
2714 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2715 if (TAZSourceSink != frontAC) {
2720 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2723 }
else if (TAZSourceSink == frontAC) {
2769 RGBColor color = geometryPointColor;
2821 const double squaredSnapRadius = (snapRadius * snapRadius);
2825 const int nearestIndex = originalShape.
indexOfClosest(mousePosition);
2829 std::vector<int> indexes;
2831 if (nearestIndex == -1) {
2836 for (
int i = 1; i <= nearestIndex; i++) {
2837 indexes.push_back(i);
2840 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2844 }
else if (nearestPosition.
distanceSquaredTo2D(shapeToMove[nearestIndex]) <= squaredSnapRadius) {
2845 for (
int i = 1; i <= nearestIndex; i++) {
2846 indexes.push_back(i);
2849 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2852 const int newIndex = shapeToMove.
insertAtClosest(nearestPosition,
true);
2853 for (
int i = 1; i <= newIndex; i++) {
2854 indexes.push_back(i);
2857 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2865 const double squaredSnapRadius = (snapRadius * snapRadius);
2869 const int nearestIndex = originalShape.
indexOfClosest(mousePosition);
2873 std::vector<int> indexes;
2875 if (nearestIndex == -1) {
2880 for (
int i = nearestIndex; i < ((int)originalShape.size() - 1); i++) {
2881 indexes.push_back(i);
2884 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2888 }
else if (nearestPosition.
distanceSquaredTo2D(shapeToMove[nearestIndex]) <= squaredSnapRadius) {
2889 for (
int i = nearestIndex; i < ((int)originalShape.size() - 1); i++) {
2890 indexes.push_back(i);
2893 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2896 const int newIndex = shapeToMove.
insertAtClosest(nearestPosition,
true);
2897 for (
int i = newIndex; i < ((int)originalShape.size() - 1); i++) {
2898 indexes.push_back(i);
2901 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2908 std::vector<int> geometryPointsToMove;
2910 geometryPointsToMove.push_back(i);
2924 if (shapeToMove.
length2D() < moveMultipleElementValues.getEdgeOffset()) {
2931 offset = moveMultipleElementValues.getEdgeOffset();
2933 offset = shapeToMove.
length2D() - moveMultipleElementValues.getEdgeOffset();
2942 }
else if (offsetPosition.
distanceSquaredTo2D(shapeToMove[nearestIndex]) <= (snapRadius * snapRadius)) {
2947 const int newIndex = shapeToMove.
insertAtClosest(offsetPosition,
true);
2958 return snapRadius * snapRadius;
#define ENDPOINT_TOLERANCE
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
@ GLO_DOTTEDCONTOUR_INSPECTED
dotted contour inspected element (used in netedit)
@ GLO_FRONTELEMENT
front element (used in netedit)
@ GLO_GEOMETRYPOINT
geometry point (used in netedit)
GUIPostDrawing gPostDrawing
GUIIcon
An enumeration of icons used by the gui applications.
#define WRITE_WARNINGF(...)
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.
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ GNE_TAG_STOPCONTAINER_EDGE
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
@ GNE_TAG_STOPPERSON_EDGE
@ 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_STOPOFFSET
stop offset (virtual, used by edge and lanes)
@ GNE_ATTR_OPPOSITE
neighboring lane, simplified lane attr instead of child element
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_STOPOEXCEPTION
stop exceptions (virtual, used by edge and lanes)
@ 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 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 pushName(unsigned int name)
push Name
static void popMatrix()
pop matrix
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
static void popName()
pop Name
static void pushMatrix()
push matrix
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)
GNENetworkSelector * getEdgesSelector() const
get edges selector
const std::string getID() const
get ID (all Attribute Carriers have one)
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 tagProperty associated with this Attribute Carrier
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
bool deleteOnlyGeometryPoints() const
check if only delete geometry points checkbox is enabled
struct for saving subordinated elements (Junction->Edge->Lane->(Additional | DemandElement)
ProtectElements * getProtectElements() const
get protect elements modul
DeleteOptions * getDeleteOptions() const
get delete options modul
An Element which don't belong to GNENet but has influence 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
bool isConvexAngle() const
check if edge makes a convex angle [0 - 180) degrees
void setNumLanes(int numLanes, GNEUndoList *undoList)
changes the number of lanes. When reducing the number of lanes, higher-numbered lanes are removed fir...
std::string getNetworkElementProblem() const
return a string with the current network element problem
const std::map< const GNELane *, std::vector< GNEDemandElement * > > getPersonsOverEdgeMap() const
get persons a that start over this edge
void drawEdgeGeometryPoints(const GUIVisualizationSettings &s) const
draw edge geometry points (note: This function is called by GNELane::drawGL(...)
const std::map< const GNELane *, std::vector< GNEDemandElement * > > getContainersOverEdgeMap() const
get containers a that start over this edge
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
bool hasPredecessors() const
check if this edge has predecessors (note: only for vehicles, this function ignore walking areas!...
void drawEndGeometryPoint(const GUIVisualizationSettings &s, const double circleWidth, const double exaggeration) const
draw end extreme geometry point
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
friend class GNEChange_Lane
Friend class.
void smooth(GNEUndoList *undoList)
make geometry smooth
void updateGeometry()
update pre-computed geometry information
GNEMoveOperation * getMoveOperation()
get move operation
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 structures
static void drawDottedContourEdge(const GUIVisualizationSettings &s, const GUIDottedGeometry::DottedContourType type, const GNEEdge *edge, const bool drawFrontExtreme, const bool drawBackExtreme, const double exaggeration=1)
draw dotted contour for the given dottedGeometries
void copyEdgeType(const GNEEdgeType *edgeType, GNEUndoList *undoList)
copy edge attributes from edgeType
NBEdge * getNBEdge() const
returns the internal NBEdge
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
GNEEdge * getReverseEdge() const
get reverse edge (if exist)
const Position getFrontUpShapePosition() const
get front up shape position
void setGeometryPointColor(const Position &geometryPointPos, const double circleWidth, const RGBColor &geometryPointColor) const
set geometry point color
void setGeometry(PositionVector geom, bool inner)
update edge geometry and inform the lanes
void smoothElevation(GNEUndoList *undoList)
smooth elevation with regard to adjoining edges
void drawLaneStopOffset(const GUIVisualizationSettings &s) const
draw edgeStopOffset
bool clickedOverGeometryPoint(const Position &pos) const
return true if user clicked over a Geometry Point
bool clickedOverShapeEnd(const Position &pos) const
return true if user clicked over ShapeEnd
void updateVehicleStackLabels()
bool isValid(SumoXMLAttr key, const std::string &value)
void remakeGNEConnections(bool junctionsReady=false)
remake connections
GNEMoveOperation * processMoveBothJunctionSelected()
process moving edge when both junctions are selected
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)
bool hasCustomEndPoints() const
void updatePersonStackLabels()
void removeConnection(NBEdge::Connection nbCon)
removes a connection
void drawChildrens(const GUIVisualizationSettings &s) const
draw children
bool hasSuccessors() const
check if this edge has successors (note: only for vehicles, this function ignore walking areas!...
bool isAttributeComputed(SumoXMLAttr key) const
bool drawBigGeometryPoints() const
check if draw big geometry points
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)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
static const double SNAP_RADIUS_SQUARED
void updateSecondParentJunction(const std::string &value)
update last parent junction
std::vector< GNEEdge * > getOppositeEdges() const
get opposite edges
PositionVector smoothShape(const PositionVector &shape, bool forElevation)
return smoothed shape
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
bool wasSplit()
whether this edge was created from a split
NBEdge * myNBEdge
the underlying NBEdge
void copyTemplate(const GNEEdgeTemplate *edgeTemplate, GNEUndoList *undoList)
copy edge attributes from edgetemplate
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
int getRouteProbeRelativePosition(GNERouteProbe *routeProbe) const
obtain relative positions of RouteProbes
std::string myConnectionStatus
modification status of the connections
void drawStartGeometryPoint(const GUIVisualizationSettings &scircleWidth, const double circleWidth, const double exaggeration) const
draw start extreme geometry point
void deleteGLObject()
delete element
const std::string getOptionalName() const
Returns the street name.
void clearGNEConnections()
clear current connections
bool myUpdateGeometry
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
void updateContainerStackLabels()
void drawEdgeShape(const GUIVisualizationSettings &s) const
draw edge shape (only one line)
bool clickedOverShapeStart(const Position &pos) const
return true if user clicked over ShapeStart
bool isNetworkElementValid() const
check if current network element is valid to be written into XML
void setShapeStartPos(const Position &pos)
change Shape StartPos
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
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
GNEMoveOperation * processMoveFromJunctionSelected(const PositionVector originalShape, const Position mousePosition, const double snapRadius)
process moving edge when only from junction is selected
GNEMoveOperation * processNoneJunctionSelected(const double snapRadius)
process moving edge when none junction are selected
const Parameterised::Map & getACParametersMap() const
get parameters map
void drawTAZElements(const GUIVisualizationSettings &s) const
draw TAZElements
double getSnapRadius(const bool squared) const
get snap radius
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()
GNEMoveOperation * processMoveToJunctionSelected(const PositionVector originalShape, const Position mousePosition, const double snapRadius)
process moving edge when only to junction is selected
void updateGLObject()
update GLObject (geometry, ID, etc.)
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
std::string getAttribute(SumoXMLAttr key) const
const std::vector< GNELaneTemplate * > & getLaneTemplates() const
get vector with the lane templates of this edge
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
void setEdgeTemplate(const GNEEdge *edge)
set edge template
GNEEdgeTemplate * getEdgeTemplate() const
get edge template (to copy attributes from)
void updateEdgeTemplate()
update edge template
TemplateEditor * getTemplateEditor() const
get template editor
GNEElementTree * getHierarchicalElementTree() const
get GNEElementTree modul
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
void updateGeometry()
update pre-computed geometry information (including crossings)
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
Position getPositionInView() const
Returns position of hierarchical element in view.
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
NBNode * getNBNode() const
Return net build node.
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=FEATURE_GUESSED)
void addOutgoingGNEEdge(GNEEdge *edge)
add outgoing GNEEdge
const double halfWidth
Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
get elements shape
int getIndex() const
returns the index of the lane
const GUIGeometry & getLaneGeometry() const
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
GNEMoveOperation * calculateMoveShapeOperation(const PositionVector originalShape, const Position mousePosition, const double snapRadius, const bool onlyContour)
calculate move shape operation
bool getMergeGeometryPoints() const
check if merge geometry points
CommonModeOptions * getCommonModeOptions() const
get common mode options
std::vector< int > geometryPointsToMove
shape points to move (of shapeToMove)
PositionVector shapeToUpdate
shape to update (edited in moveElement)
std::vector< GNEEdge * > retrieveEdges(GNEJunction *from, GNEJunction *to) const
get all edges by from and to GNEJunction
const std::set< GNELane * > & getLanes() const
get lanes
const std::set< GNEConnection * > & getConnections() const
get connections
void insertLane(GNELane *lane)
insert lane
void deleteConnection(GNEConnection *connection)
delete connection
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
void insertConnection(GNEConnection *connection)
insert connection
void updateEdgeID(GNEEdge *edge, const std::string &newID)
update edge ID in container
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
void deleteLane(GNELane *lane)
delete lane
int getNumberOfSelectedEdges() const
get number of selected edges
void requireSaveDemandElements()
inform that demand elements has to be saved
A NBNetBuilder extended by visualisation and editing capabilities.
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
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
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
GNEPathManager * getPathManager()
get path manager
GNEViewNet * getViewNet() const
get view net
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Boundary myBoundary
object boundary
bool isNetworkElementSelected(const GNENetworkElement *networkElement) const
check if the given networkElement is being selected
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void decRef(const std::string &debugMsg="")
Decrease reference.
void incRef(const std::string &debugMsg="")
Increase 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 end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList 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
const GNEViewNetHelper::MoveMultipleElementValues & getMoveMultipleElementValues() const
get move multiple element values
GNEMoveFrame * getMoveFrame() const
get frame for move elements
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
GNEAdditionalFrame * getAdditionalFrame() const
get frame for NETWORK_ADDITIONAL
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
class for pack all variables related with GUIDottedGeometry color
void changeColor()
change color
void reset()
rest Dotted Geometry Color
void drawDottedGeometry(const GUIVisualizationSettings &s, GUIDottedGeometry::DottedContourType type, DottedGeometryColor &dottedGeometryColor, const double customWidth=1) const
draw inspected dottedShape
void moveShapeToSide(const double value)
move shape to side
void invertOffset()
invert offset of all segments
static void drawDottedContourShape(const GUIVisualizationSettings &s, const DottedContourType type, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given shape (used by additionals)
static void drawGeometry(const GUIVisualizationSettings &s, const Position &mousePos, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
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.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
bool mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
const GUIGlObject * markedFirstGeometryPoint
marked first geometry point (used for moving/delete geometry points)
const GUIGlObject * markedSecondGeometryPoint
marked first geometry point (used for moving/delete geometry points)
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.
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual 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)
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
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
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
const std::vector< Connection > & getConnections() const
Returns the connections.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given
StopOffset myEdgeStopOffset
A vClass specific stop offset - assumed of length 0 (unspecified) or 1. For the latter case the int i...
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)
bool hasLaneSpecificFriction() const
whether lanes differ in friction
double getLaneWidth() const
Returns the default width of lanes of this edge.
NBNode * getToNode() const
Returns the destination node of the edge.
Lane & getLaneStruct(int lane)
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.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
bool hasLoadedLength() const
Returns whether a length was set explicitly.
void setDistance(double distance)
set kilometrage at start of edge (negative value implies couting down along the edge)
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
double getSpeed() const
Returns the speed allowed on this edge.
const std::string & getID() const
double getDistance() const
get distance
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
bool isBidiEdge(bool checkPotential=false) const
whether this edge is part of a bidirectional edge pair
void setBidi(bool isBidi)
mark this edge as a bidi edge
int getNumLanes() const
Returns the number of lanes.
void setFriction(int lane, double friction)
set lane specific friction (negative lane implies set for all lanes)
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
std::string getLaneID(int lane) const
get lane ID
@ USER
The connection was given by the user.
double getFriction() const
Returns the friction on this edge.
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 friction=UNSPECIFIED_FRICTION, double length=myDefaultConnectionLength, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED, SVCPermissions permissions=SVC_UNSPECIFIED, bool indirectLeft=false, const std::string &edgeType="", SVCPermissions changeLeft=SVC_UNSPECIFIED, SVCPermissions changeRight=SVC_UNSPECIFIED, bool postProcess=false)
Adds a connection to a certain lane of a certain edge.
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
const std::string & getTypeID() const
get ID of type
const std::string & getStreetName() const
Returns the street name of this edge.
const NBEdge * getBidiEdge() const
NBNode * getFromNode() const
Returns the origin node of the edge.
NBEdge * getTurnDestination(bool possibleDestination=false) const
int getPriority() const
Returns the priority of the edge.
static const double UNSPECIFIED_WIDTH
unspecified lane width
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)
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.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at 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.
bool set(const std::string &name, const std::string &value, const bool append=false)
Sets the given value for the named option.
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, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
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"
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
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".
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
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 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
int indexOfClosest(const Position &p, bool twoD=false) const
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
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
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false, int beginOffset=0, int endOffset=0, bool resample=false)
Removes positions if too near.
void pop_front()
pop first Position
PositionVector reverse() const
reverse position vector
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor BLUE
unsigned char alpha() const
Returns the alpha-amount of the color.
static const RGBColor ORANGE
static const RGBColor CYAN
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
void setOffset(const double offset)
set offset
bool isDefined() const
check if stopOffset was defined
void reset()
reset stopOffset
SVCPermissions getPermissions() const
get permissions
void setExceptions(const std::string permissions)
set exceptions (used in netedit)
std::string getExceptions() const
get exceptions (used in netedit)
double getOffset() const
get offset
const std::string & getString(const T key) const
bool hasString(const std::string &str) const
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 isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool isMovingSelectedEdge() const
flag for moving edge
bool editingElevation() const
check if we're editing elevation
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool showTAZElements() const
check if show TAZ Elements
RGBColor selectedEdgeColor
edge selection color
static const double geometryPointsText
details for Geometry Points Texts
static const double junctionBubbleRadius
junction bubble radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
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.
double friction
The friction on this lane.
SVCPermissions permissions
List of vehicle types that are allowed on this lane.