63#define ENDPOINT_TOLERANCE 2
90 for (
int i = 0; i <
myNBEdge->getNumLanes(); i++) {
91 auto lane =
new GNELane(
this, i);
92 lane->incRef(
"GNEEdge::GNEEdge");
97 lane->updateGeometry();
107 lane->decRef(
"GNEEdge::~GNEEdge");
108 if (lane->unreferenced()) {
110 if (
myNet->getAttributeCarriers()->getLanes().count(lane) > 0) {
111 myNet->getAttributeCarriers()->deleteLane(lane);
118 connection->decRef(
"GNEEdge::~GNEEdge");
119 if (connection->unreferenced()) {
121 if (
myNet->getAttributeCarriers()->getConnections().count(connection) > 0) {
122 myNet->getAttributeCarriers()->deleteConnection(connection);
163 return TLF(
"Parent junctions are in the same position: %, %",
175 lane->updateGeometry();
179 connection->updateGeometry();
183 childAdditional->updateGeometry();
187 childDemandElement->updateGeometry();
191 childGenericData->updateGeometry();
194 if (
myNet->getViewNet() &&
myNet->getViewNet()->getNetworkViewOptions().showDemandElements()) {
196 childAdditional->computePathElement();
199 childDemandElement->computePathElement();
202 childGenericData->computePathElement();
224 const auto& modes =
myNet->getViewNet()->getEditModes();
225 const auto& viewParent =
myNet->getViewNet()->getViewParent();
226 const auto& inspectedElements =
myNet->getViewNet()->getInspectedElements();
228 if (inspectedElements.isInspectingSingleElement()) {
230 if (inspectedElements.getFirstAC()->getTagProperty()->vehicleEdges() &&
235 }
else if (modes.isCurrentSupermodeDemand()) {
239 planCreator = viewParent->getPersonFrame()->getPlanCreator();
241 planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
243 planCreator = viewParent->getContainerFrame()->getPlanCreator();
245 planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
256 const auto& selectedEdges = viewParent->getVehicleFrame()->getPathCreator()->getSelectedEdges();
258 if ((selectedEdges.size() > 0) && (selectedEdges.front() ==
this)) {
262 }
else if (modes.isCurrentSupermodeData()) {
264 const auto& edgeRelDataFrame = viewParent->getEdgeRelDataFrame();
265 if (edgeRelDataFrame->shown()) {
267 if (edgeRelDataFrame->getPathCreator()->getSelectedEdges().empty()) {
270 return edgeRelDataFrame->getPathCreator()->getSelectedEdges().front() ==
this;
282 const auto& modes =
myNet->getViewNet()->getEditModes();
283 const auto& viewParent =
myNet->getViewNet()->getViewParent();
284 const auto& inspectedElements =
myNet->getViewNet()->getInspectedElements();
286 if (inspectedElements.isInspectingSingleElement()) {
288 if (inspectedElements.getFirstAC()->getTagProperty()->vehicleEdges() &&
289 inspectedElements.getFirstAC()->hasAttribute(
SUMO_ATTR_TO) &&
293 }
else if (modes.isCurrentSupermodeDemand()) {
297 planCreator = viewParent->getPersonFrame()->getPlanCreator();
299 planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
301 planCreator = viewParent->getContainerFrame()->getPlanCreator();
303 planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
314 const auto& selectedEdges = viewParent->getVehicleFrame()->getPathCreator()->getSelectedEdges();
316 if ((selectedEdges.size() > 1) && (selectedEdges.back() ==
this)) {
320 }
else if (modes.isCurrentSupermodeData()) {
322 const auto& edgeRelDataFrame = viewParent->getEdgeRelDataFrame();
323 if (edgeRelDataFrame->shown()) {
325 if (edgeRelDataFrame->getPathCreator()->getSelectedEdges().empty()) {
328 return edgeRelDataFrame->getPathCreator()->getSelectedEdges().back() ==
this;
339 const auto& inspectedElements =
myNet->getViewNet()->getInspectedElements();
341 if (inspectedElements.isInspectingSingleElement() &&
342 inspectedElements.getFirstAC()->getTagProperty()->getTag() ==
SUMO_TAG_TAZ) {
345 if (sourceSink->getParentAdditionals().front() == inspectedElements.getFirstAC()) {
350 if (
myNet->getViewNet()->getPopup()) {
351 return myNet->getViewNet()->getPopup()->getGLObject() ==
this;
360 const auto& modes =
myNet->getViewNet()->getEditModes();
361 const auto& viewParent =
myNet->getViewNet()->getViewParent();
362 const auto& viewObjectsSelector =
myNet->getViewNet()->getViewObjectsSelector();
365 if (viewParent->getAdditionalFrame()->getViewObjetsSelector()->isNetworkElementSelected(
this)) {
367 }
else if (viewParent->getAdditionalFrame()->getViewObjetsSelector()->getTag() ==
myTagProperty->getTag()) {
368 return viewObjectsSelector.getEdgeFront() ==
this;
374 if (viewObjectsSelector.getEdgeFront() !=
this) {
378 if (modes.isCurrentSupermodeDemand()) {
382 planSelector = viewParent->getPersonFrame()->getPlanSelector();
384 planSelector = viewParent->getPersonPlanFrame()->getPlanSelector();
386 planSelector = viewParent->getContainerFrame()->getPlanSelector();
388 planSelector = viewParent->getContainerPlanFrame()->getPlanSelector();
391 if (planSelector && planSelector->
markEdges()) {
392 return (viewObjectsSelector.getAttributeCarrierFront()->getTagProperty()->getTag() ==
SUMO_TAG_LANE);
395 const auto& vehicleTemplate = viewParent->getVehicleFrame()->getVehicleTagSelector()->getCurrentTemplateAC();
397 if (vehicleTemplate && vehicleTemplate->getTagProperty()->vehicleEdges()) {
398 return (viewObjectsSelector.getAttributeCarrierFront()->getTagProperty()->getTag() ==
SUMO_TAG_LANE);
401 }
else if (modes.isCurrentSupermodeData()) {
403 const auto& edgeDataFrame = viewParent->getEdgeDataFrame();
404 const auto& edgeRelDataFrame = viewParent->getEdgeRelDataFrame();
405 if (edgeDataFrame->shown()) {
407 }
else if (edgeRelDataFrame->shown()) {
409 if (edgeRelDataFrame->getPathCreator()->getSelectedEdges().empty()) {
411 }
else if (edgeRelDataFrame->getPathCreator()->getSelectedEdges().size() == 2) {
413 }
else if (edgeRelDataFrame->getPathCreator()->getSelectedEdges().front() ==
this) {
415 }
else if (edgeRelDataFrame->getPathCreator()->getSelectedEdges().back() ==
this) {
432 if (
myNet->getViewNet()->checkSelectEdges()) {
434 const auto& editModes =
myNet->getViewNet()->getEditModes();
440 (
myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == lane)) {
446 (
myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() ==
this)) {
463 const auto& editModes =
myNet->getViewNet()->getEditModes();
466 const auto junction =
myNet->getViewNet()->getViewObjectsSelector().getJunctionFront();
467 if (junction ==
myNet->getViewNet()->getViewObjectsSelector().getAttributeCarrierFront()) {
478 if (
myNet->getViewNet()->checkSelectEdges()) {
480 const auto& editModes =
myNet->getViewNet()->getEditModes();
486 (
myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == lane)) {
492 (
myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() ==
this)) {
509 const auto& editModes =
myNet->getViewNet()->getEditModes();
511 if (!
myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
514 const GNENetworkElement* editedNetworkElement =
myNet->getViewNet()->getEditNetworkElementShapes().getEditedNetworkElement();
515 if (editedNetworkElement) {
516 if (editedNetworkElement ==
this) {
521 if (editedNetworkElement == lane) {
530 (
myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == lane)) {
536 (
myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() ==
this)) {
565 return (
myNBEdge->getGeometry().front().distanceSquaredTo2D(pos) < (geometryPointRadius * geometryPointRadius));
577 return (
myNBEdge->getGeometry().back().distanceSquaredTo2D(pos) < (geometryPointRadius * geometryPointRadius));
591 for (
const auto& geometryPoint : innenShape) {
592 if (geometryPoint.distanceSquaredTo2D(pos) < (geometryPointRadius * geometryPointRadius)) {
635 myNet->removeGLObjectFromGrid(
this);
641 const auto laneBoundary = lane->getCenteringBoundary();
642 if (laneBoundary.isInitialised()) {
645 for (
const auto& additional : lane->getChildAdditionals()) {
646 const auto additionalBoundary = additional->getCenteringBoundary();
647 if (additionalBoundary.isInitialised()) {
655 const auto additionalBoundary = additional->getCenteringBoundary();
656 if (additionalBoundary.isInitialised()) {
667 myNet->addGLObjectIntoGrid(
this);
699 const auto d =
getChildLanes().front()->getDrawingConstants()->getDetail();
741 myNet->deleteEdge(
this,
myNet->getViewNet()->getUndoList(),
false);
764 if (geom[index].distanceSquaredTo2D(clickPos) < (geometryPointRadius * geometryPointRadius)) {
766 return myNet->getViewNet()->snapToActiveGrid(geom[index]);
779 (
myNBEdge->getGeometry().front().distanceSquaredTo2D(pos) < (geometryPointRadius * geometryPointRadius))) {
780 undoList->
begin(
this,
"remove endpoint");
784 (
myNBEdge->getGeometry().back().distanceSquaredTo2D(pos) < (geometryPointRadius * geometryPointRadius))) {
785 undoList->
begin(
this,
"remove endpoint");
790 double offset =
myNBEdge->getGeometry().nearest_offset_to_point2D(
myNet->getViewNet()->snapToActiveGrid(pos),
true);
796 newPos =
myNet->getViewNet()->snapToActiveGrid(newPos);
797 undoList->
begin(
this,
"set endpoint");
803 if (geom[index].distanceSquaredTo2D(pos) < (geometryPointRadius * geometryPointRadius)) {
804 newPos = geom[index];
812 if (geom[index].distanceSquaredTo2D(pos) < (geometryPointRadius * geometryPointRadius)) {
813 newPos = geom[index];
868 edge->updateGeometry();
871 edge->updateGeometry();
876 for (
const auto& edge :
getToJunction()->getGNEIncomingEdges()) {
877 edge->updateGeometry();
879 for (
const auto& edge :
getToJunction()->getGNEOutgoingEdges()) {
880 edge->updateGeometry();
889 return laneShape.front();
897 return laneShape.front();
905 return laneShape.back();
913 return laneShape.back();
919 const std::vector<NBEdge::Connection>& connections =
myNBEdge->getConnections();
921 std::vector<GNEConnection*> retrievedConnections;
923 for (
const auto& connection : connections) {
926 if (junctionsReady) {
929 retrievedConnections.push_back(retrievedGNEConnection);
936 retrievedGNEConnection->
incRef(
"GNEEdge::remakeGNEConnections");
944 connection->decRef();
946 myNet->removeGLObjectFromGrid(connection);
948 if (
myNet->getAttributeCarriers()->getConnections().count(connection) > 0) {
949 myNet->getAttributeCarriers()->deleteConnection(connection);
952 if (connection->unreferenced()) {
966 if (connection->isAttributeCarrierSelected()) {
967 connection->unselectAttributeCarrier();
970 connection->decRef(
"GNEEdge::clearGNEConnections");
972 myNet->removeGLObjectFromGrid(connection);
974 if (
myNet->getAttributeCarriers()->getConnections().count(connection) > 0) {
975 myNet->getAttributeCarriers()->deleteConnection(connection);
978 if (connection->unreferenced()) {
988 std::vector<GNEAdditional*> routeProbes;
991 routeProbes.push_back(additional);
995 auto it = std::find(routeProbes.begin(), routeProbes.end(), routeProbe);
996 if (it == routeProbes.end()) {
999 return (
int)(it - routeProbes.begin());
1004std::vector<GNECrossing*>
1006 std::vector<GNECrossing*> crossings;
1008 if (i->checkEdgeBelong(
this)) {
1009 crossings.push_back(i);
1013 if (i->checkEdgeBelong(
this)) {
1014 crossings.push_back(i);
1024 for (
const auto& attProperty :
myTagProperty->getAttributeProperties()) {
1025 if (attProperty->isCopyable() &&
isValid(attProperty->getAttr(), edgeTemplate->
getAttribute(attProperty->getAttr()))) {
1033 for (
const auto& attProperty : edgeTemplate->
getLaneTemplates().at(i)->getTagProperty()->getAttributeProperties()) {
1035 getChildLanes()[i]->setAttribute(attProperty->getAttr(), edgeTemplate->
getLaneTemplates().at(i)->getAttribute(attProperty->getAttr()), undoList);
1046 const auto tagPropertiesDatabase =
myNet->getTagPropertiesDatabase();
1048 const auto edgeProperties = tagPropertiesDatabase->getTagProperty(
SUMO_TAG_EDGE,
true);
1049 const auto laneProperties = tagPropertiesDatabase->getTagProperty(
SUMO_TAG_LANE,
true);
1050 const auto edgeTypeProperties = tagPropertiesDatabase->getTagProperty(
SUMO_TAG_TYPE,
true);
1051 const auto laneTypeProperties = tagPropertiesDatabase->getTagProperty(
SUMO_TAG_LANETYPE,
true);
1055 for (
const auto& attrProperty : edgeTypeProperties->getAttributeProperties()) {
1056 if (attrProperty->isCopyable() && edgeProperties->hasAttribute(attrProperty->getAttr())) {
1063 for (
const auto& attrProperty : laneTypeProperties->getAttributeProperties()) {
1064 if (attrProperty->isCopyable() && laneProperties->hasAttribute(attrProperty->getAttr()) &&
1065 (edgeType->
getLaneTypes().at(i)->getAttribute(attrProperty->getAttr()) != laneTypeProperties->getAttributeProperties(attrProperty->getAttr())->getDefaultStringValue())) {
1066 getChildLanes()[i]->setAttribute(attrProperty->getAttr(), edgeType->
getLaneTypes().at(i)->getAttribute(attrProperty->getAttr()), undoList);
1078 std::set<GUIGlID> result;
1080 result.insert(glID->getGlID());
1086const std::vector<GNEConnection*>&
1129 if (
myNBEdge->hasLaneSpecificSpeed()) {
1130 return "lane specific";
1135 if (
myNBEdge->hasLaneSpecificFriction()) {
1136 return "lane specific";
1141 if (
myNBEdge->hasLaneSpecificWidth()) {
1142 return "lane specific";
1149 if (
myNBEdge->hasLaneSpecificEndOffset()) {
1150 return "lane specific";
1179 if (
myNBEdge->myEdgeStopOffset.isDefined()) {
1208 return myNBEdge->getInnerGeometry();
1239 const std::string origValue =
getChildLanes().at(0)->getAttribute(key);
1242 it->setAttribute(key,
value, undoList);
1259 myNet->getAttributeCarriers()->retrieveJunction(
value)->setLogicValid(
false, undoList);
1280 myNet->getAttributeCarriers()->retrieveJunction(
value)->setLogicValid(
false, undoList);
1329 if (
myNBEdge->getTurnDestination(
true) !=
nullptr) {
1330 GNEEdge* bidi =
myNet->getAttributeCarriers()->retrieveEdge(
myNBEdge->getTurnDestination(
true)->getID());
1333 &&
myNBEdge->getGeometry().size() == 2
1335 &&
myNBEdge->getBidiEdge() ==
nullptr) {
1356 if (updateTemplate) {
1372 return (
myNet->getAttributeCarriers()->retrieveJunction(
value,
false) !=
nullptr);
1382 return (
myNet->getAttributeCarriers()->retrieveJunction(
value,
false) !=
nullptr);
1396 if (
value.empty()) {
1422 if (
value.empty()) {
1428 if (
value.empty()) {
1432 return (shapeStart !=
myNBEdge->getGeometry()[-1]);
1438 if (
value.empty()) {
1442 return (shapeEnd !=
myNBEdge->getGeometry()[0]);
1450 if (
value.empty()) {
1469 return myNBEdge->myEdgeStopOffset.getOffset() > 0;
1482 return !
myNBEdge->hasLoadedLength();
1484 if (
myNBEdge->hasLaneSpecificWidth()) {
1504 for (
int i = 0; i < (int)
myNBEdge->getLanes().size(); i++) {
1506 if (
myNBEdge->getLanes().at(i).permissions & vClass) {
1519 for (
int i = 0; i < (int)
myNBEdge->getLanes().size(); i++) {
1521 if (~(
myNBEdge->getLanes().at(i).permissions) & vClass) {
1534 const std::map<const GNELane*, std::vector<GNEDemandElement*> > laneVehiclesMap =
getVehiclesOverEdgeMap();
1536 for (
const auto& laneVehicle : laneVehiclesMap) {
1538 double totalLength = 0;
1539 for (
const auto& vehicle : laneVehicle.second) {
1543 double multiplier = 1;
1544 const double laneShapeLength = laneVehicle.first->getLaneShape().length();
1545 if (laneShapeLength == 0) {
1547 }
else if (totalLength > laneShapeLength) {
1548 multiplier = (laneShapeLength / totalLength);
1553 for (
const auto& vehicle : laneVehicle.second) {
1554 vehicle->updateDemandElementSpreadGeometry(laneVehicle.first, length * multiplier);
1565 const std::map<const GNELane*, std::vector<GNEDemandElement*> > laneVehiclesMap =
getVehiclesOverEdgeMap();
1567 for (
const auto& vehicleMap : laneVehiclesMap) {
1569 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosVehicles;
1571 std::vector<GNEEdge::StackDemandElements> stackedVehicles;
1573 for (
const auto& vehicle : vehicleMap.second) {
1579 if (posOverLane < 0) {
1580 posOverLane += vehicleMap.first->getLaneShape().length();
1583 departPosVehicles.push_back(std::make_pair(
StackPosition(departPos, length), vehicle));
1585 vehicle->updateDemandElementGeometry(vehicleMap.first, posOverLane);
1587 vehicle->updateDemandElementStackLabel(0);
1591 std::sort(departPosVehicles.begin(), departPosVehicles.end());
1593 for (
const auto& departPosVehicle : departPosVehicles) {
1598 if (stackedVehicles.empty()) {
1602 stackedVehicles[stackedVehicles.size() - 1].addDemandElements(vehicle);
1609 for (
const auto& vehicle : stackedVehicles) {
1611 if (vehicle.getDemandElements().size() > 1) {
1613 vehicle.getDemandElements().front()->updateDemandElementStackLabel((
int)vehicle.getDemandElements().size());
1623 const std::map<const GNELane*, std::vector<GNEDemandElement*> > lanePersonsMap =
getPersonsOverEdgeMap();
1625 for (
const auto& personMap : lanePersonsMap) {
1627 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosPersons;
1629 std::vector<GNEEdge::StackDemandElements> stackedPersons;
1631 for (
const auto& person : personMap.second) {
1635 departPosPersons.push_back(std::make_pair(
StackPosition(departPos, 1.8), person));
1637 person->updateDemandElementGeometry(personMap.first, departPos);
1639 person->updateDemandElementStackLabel(0);
1643 std::sort(departPosPersons.begin(), departPosPersons.end());
1645 for (
const auto& departPosPerson : departPosPersons) {
1650 if (stackedPersons.empty()) {
1654 stackedPersons[stackedPersons.size() - 1].addDemandElements(person);
1661 for (
const auto& person : stackedPersons) {
1663 if (person.getDemandElements().size() > 1) {
1665 person.getDemandElements().front()->updateDemandElementStackLabel((
int)person.getDemandElements().size());
1677 for (
const auto& containerMap : laneContainersMap) {
1679 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosContainers;
1681 std::vector<GNEEdge::StackDemandElements> stackedContainers;
1683 for (
const auto& container : containerMap.second) {
1687 departPosContainers.push_back(std::make_pair(
StackPosition(departPos, 1.8), container));
1689 container->updateDemandElementGeometry(containerMap.first, departPos);
1691 container->updateDemandElementStackLabel(0);
1695 std::sort(departPosContainers.begin(), departPosContainers.end());
1697 for (
const auto& departPosContainer : departPosContainers) {
1702 if (stackedContainers.empty()) {
1706 stackedContainers[stackedContainers.size() - 1].addDemandElements(container);
1713 for (
const auto& container : stackedContainers) {
1715 if (container.getDemandElements().size() > 1) {
1717 container.getDemandElements().front()->updateDemandElementStackLabel((
int)container.getDemandElements().size());
1729 while (edgeAngle < 0) {
1733 edgeAngle = fmod(edgeAngle, 360);
1735 return edgeAngle >= 0 && edgeAngle < 180;
1744 for (
const auto& incomingEdge : incomingEdges) {
1745 for (
const auto& connection : incomingEdge->getGNEConnections()) {
1746 if (connection->getEdgeTo() ==
this) {
1763 for (
const auto& outgoingEdge :
getParentJunctions().back()->getGNEOutgoingEdges()) {
1765 return outgoingEdge;
1776 pair(departPos, departPos + length) {
1793 pair(stackedPosition, {
1801 second.push_back(demandElement);
1811const std::vector<GNEDemandElement*>&
1821 myNet->getAttributeCarriers()->updateEdgeID(
this,
value);
1824 if (stop->getTagProperty()->isVehicleStop()) {
1825 myNet->getSavingStatus()->requireSaveDemandElements();
1830 for (
const auto& stop : lane->getChildDemandElements()) {
1831 if (stop->getTagProperty()->isVehicleStop()) {
1832 myNet->getSavingStatus()->requireSaveDemandElements();
1860 throw InvalidArgument(
"GNEEdge::setAttribute (private) called for attr SUMO_ATTR_NUMLANES. This should never happen");
1865 if (
value.empty()) {
1907 if (
value.empty()) {
1916 myNBEdge->invalidateConnections(
true);
1919 myNBEdge->declareConnectionsAsLoaded();
1954 if (
value.empty()) {
1955 myNBEdge->myEdgeStopOffset.setOffset(0);
1972 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getTemplateEditor()->updateEdgeTemplate();
1975 myNet->getDemandPathManager()->getPathCalculator()->invalidatePathCalculator();
1989 myNet->removeGLObjectFromGrid(
this);
1994 if (oppositeID !=
"") {
1998 for (
int i = oldNumLanes; i < numLanes; i++) {
2002 for (
int i = (oldNumLanes - 1); i > (numLanes - 1); i--) {
2005 if (oppositeID !=
"") {
2017 myNet->addGLObjectIntoGrid(
this);
2023 auto newJunction =
myNet->getAttributeCarriers()->retrieveJunction(
value);
2030 auto newJunction =
myNet->getAttributeCarriers()->retrieveJunction(
value);
2040 myNBEdge->addLane(index,
true, recomputeConnections, !recomputeConnections);
2044 newParentLanes.insert(newParentLanes.begin() + index, lane);
2048 for (
const auto newParentLane : newParentLanes) {
2053 lane =
new GNELane(
this, index);
2056 lane->
incRef(
"GNEEdge::addLane");
2058 myNet->getAttributeCarriers()->insertLane(lane);
2082 fromEdge->remakeGNEConnections();
2086 toEdge->remakeGNEConnections();
2100 if (lane ==
nullptr) {
2108 myNet->getViewNet()->getInspectedElements().uninspectAC(lane);
2109 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(lane);
2112 myNBEdge->deleteLane(lane->
getIndex(), recomputeConnections, !recomputeConnections);
2113 lane->
decRef(
"GNEEdge::removeLane");
2117 myNet->getAttributeCarriers()->deleteLane(lane);
2134 fromEdge->remakeGNEConnections();
2138 toEdge->remakeGNEConnections();
2160 if (selectAfterCreation) {
2178 myNBEdge->removeFromConnections(nbCon);
2181 if (connection !=
nullptr) {
2183 myNet->getViewNet()->getInspectedElements().uninspectAC(connection);
2184 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(connection);
2185 connection->
decRef(
"GNEEdge::removeConnection");
2192 myNet->removeGLObjectFromGrid(connection);
2194 if (
myNet->getAttributeCarriers()->getConnections().count(connection) > 0) {
2195 myNet->getAttributeCarriers()->deleteConnection(connection);
2208 if ((connection->getFromLaneIndex() == fromLane) && (connection->getEdgeTo()->getNBEdge() == to) && (connection->getToLaneIndex() == toLane)) {
2212 if (createIfNoExist) {
2216 myNet->addGLObjectIntoGrid(connection);
2218 myNet->getAttributeCarriers()->insertConnection(connection);
2230 lane->setNetworkElementID(
getNBEdge()->getLaneID(lane->getIndex()));
2238 if (lane->isRestricted(vclass)) {
2250 if (crossing->checkEdgeBelong(
this)) {
2251 myNet->deleteCrossing(crossing, undoList);
2260 myNBEdge->getFromNode()->getPosition().z(),
2261 myNBEdge->getToNode()->getPosition().z());
2262 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
2275#ifdef DEBUG_SMOOTH_GEOM
2277 <<
" forElevation=" << forElevation
2278 <<
" fromGeometryLike=" <<
myNBEdge->getFromNode()->geometryLike()
2279 <<
" toGeometryLike=" <<
myNBEdge->getToNode()->geometryLike()
2280 <<
" smoothShape old=" << old <<
"\n";
2282 if (old.size() == 3 || old.size() == 4) {
2284 }
else if (old.size() > 4 && !forElevation) {
2286 init.push_back(old[0]);
2287 init.push_back(old[1]);
2288 init.push_back(old[-2]);
2289 init.push_back(old[-1]);
2290 }
else if (
myNBEdge->getFromNode()->geometryLike() &&
myNBEdge->getToNode()->geometryLike()) {
2295 if (incoming.size() == 1) {
2296 begShape = incoming[0]->getGeometry();
2298 assert(incoming.size() == 2);
2299 begShape =
myNBEdge->isTurningDirectionAt(incoming[0]) ? incoming[1]->getGeometry() : incoming[0]->getGeometry();
2301 if (outgoing.size() == 1) {
2302 endShape = outgoing[0]->getGeometry();
2304 assert(outgoing.size() == 2);
2305 endShape =
myNBEdge->isTurningDirectionAt(outgoing[0]) ? outgoing[1]->getGeometry() : outgoing[0]->getGeometry();
2310 init.push_back(old[0]);
2313 init.push_back(old[-1]);
2317 init[1].setz(2 * init[0].z() - begZ);
2318 init[2].setz(2 * init[-1].z() - endZ);
2321 const double straightThresh =
DEG2RAD(neteditOptions.getFloat(
"opendrive-output.straight-threshold"));
2324#ifdef DEBUG_SMOOTH_GEOM
2326 std::cout <<
" begShape=" << begShape <<
" endShape=" << endShape <<
" forElevation=" << forElevation <<
" dist=" << dist <<
" ok=" << ok <<
" init=" << init <<
"\n";
2330 if (init.size() == 0) {
2333 const int numPoints =
MAX2(neteditOptions.getInt(
"junctions.internal-link-detail"),
2334 int(old.
length2D() / neteditOptions.getFloat(
"opendrive.curve-resolution")));
2335 return init.
bezier(numPoints);
2343 if (modifiedShape.size() < 2) {
2346 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
2356 if (elevationBase.size() == 0 || elevationBase[-1].z() != pos.z()) {
2357 elevationBase.push_back(pos);
2361 if (elevation.size() <= 2) {
2365 if (modifiedShape.size() < 5) {
2371 for (
int i = 1; i < (int)modifiedShape.size(); ++i) {
2372 seen += modifiedShape[i - 1].distanceTo2D(modifiedShape[i]);
2376 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
2398 geom.push_back(pos);
2404const std::map<const GNELane*, std::vector<GNEDemandElement*> >
2407 std::vector<GNEDemandElement*> vehiclesOverEdge;
2409 std::map<const GNELane*, std::vector<GNEDemandElement*> > vehiclesOverEdgeMap;
2411 std::set<std::pair<double, GNEDemandElement*> > vehicles;
2414 if (((edgeChild->getTagProperty()->getTag() ==
SUMO_TAG_TRIP) || (edgeChild->getTagProperty()->getTag() ==
SUMO_TAG_FLOW)) &&
2415 (edgeChild->getParentEdges().front() ==
this)) {
2416 vehicles.insert(std::make_pair(edgeChild->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild));
2417 vehicles.insert(std::make_pair(edgeChild->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild));
2418 }
else if ((edgeChild->getTagProperty()->getTag() ==
SUMO_TAG_ROUTE) && (edgeChild->getParentEdges().front() ==
this)) {
2419 for (
const auto& routeChild : edgeChild->getChildDemandElements()) {
2420 if (routeChild->getTagProperty()->vehicleRoute()) {
2421 vehicles.insert(std::make_pair(routeChild->getAttributeDouble(
SUMO_ATTR_DEPART), routeChild));
2424 }
else if ((edgeChild->getTagProperty()->getTag() ==
GNE_TAG_ROUTE_EMBEDDED) && (edgeChild->getParentEdges().front() ==
this) && (edgeChild->getParentDemandElements().size() > 0)) {
2425 vehicles.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild->getParentDemandElements().front()));
2429 vehiclesOverEdge.reserve(vehicles.size());
2431 for (
const auto& vehicle : vehicles) {
2433 vehiclesOverEdge.push_back(vehicle.second);
2436 for (
const auto& vehicle : vehiclesOverEdge) {
2437 const GNELane* vehicleLane = vehicle->getFirstPathLane();
2439 vehiclesOverEdgeMap[vehicleLane].push_back(vehicle);
2442 return vehiclesOverEdgeMap;
2446const std::map<const GNELane*, std::vector<GNEDemandElement*> >
2449 std::vector<GNEDemandElement*> personsOverEdge;
2451 std::map<const GNELane*, std::vector<GNEDemandElement*> > personsOverEdgeMap;
2453 std::set<std::pair<double, GNEDemandElement*> > persons;
2456 if (edgeChild->getTagProperty()->isPlanPerson() && (edgeChild->getParentDemandElements().size() > 0)) {
2457 persons.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPARTPOS), edgeChild->getParentDemandElements().front()));
2461 personsOverEdge.reserve(persons.size());
2463 for (
const auto& person : persons) {
2465 personsOverEdge.push_back(person.second);
2468 for (
const auto& person : personsOverEdge) {
2469 const GNELane* personLane = person->getFirstPathLane();
2471 personsOverEdgeMap[personLane].push_back(person);
2474 return personsOverEdgeMap;
2479const std::map<const GNELane*, std::vector<GNEDemandElement*> >
2482 std::vector<GNEDemandElement*> containersOverEdge;
2484 std::map<const GNELane*, std::vector<GNEDemandElement*> > containersOverEdgeMap;
2486 std::set<std::pair<double, GNEDemandElement*> > containers;
2489 if (edgeChild->getTagProperty()->isPlanContainer() && (edgeChild->getParentDemandElements().size() > 0)) {
2490 containers.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPARTPOS), edgeChild->getParentDemandElements().front()));
2494 containersOverEdge.reserve(containers.size());
2496 for (
const auto& container : containers) {
2498 containersOverEdge.push_back(container.second);
2501 for (
const auto& container : containersOverEdge) {
2502 const GNELane* containerLane = container->getFirstPathLane();
2503 if (containerLane) {
2504 containersOverEdgeMap[containerLane].push_back(container);
2507 return containersOverEdgeMap;
2528 for (
int i = 1; i < (int)
myNBEdge->getGeometry().size() - 1; i++) {
2530 const auto geometryPointPos =
myNBEdge->getGeometry()[i];
2542 glTranslated(0, 0, 0.2);
2550 if (bigGeometryPoints) {
2563 const double geometryPointRadius,
const double layer,
const double exaggeration)
const {
2567 const auto& startGeometryPointPos =
myNBEdge->getGeometry().front();
2569 const bool startPosEdited = (startGeometryPointPos !=
getParentJunctions().front()->getPositionInView());
2570 const bool forceDraw =
myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkMoveOptions()->getForceDrawGeometryPoints();
2572 if (startPosEdited || forceDraw) {
2574 const double angle =
RAD2DEG(startGeometryPointPos.angleTo2D(
myNBEdge->getGeometry()[1])) * -1;
2586 glTranslated(startGeometryPointPos.x(), startGeometryPointPos.y(),
GLO_GEOMETRYPOINT);
2602 if ((selectedGeometryPoints.size() > 0) && (selectedGeometryPoints.front() == 0)) {
2619 geometryPointRadius, exaggeration);
2627 const double geometryPointRadius,
const double layer,
const double exaggeration)
const {
2631 const auto& geometryPointPos =
myNBEdge->getGeometry().back();
2633 const bool endPosEdited = (geometryPointPos !=
getParentJunctions().back()->getPositionInView());
2634 const bool forceDraw =
myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkMoveOptions()->getForceDrawGeometryPoints();
2636 if (endPosEdited || forceDraw) {
2638 const double angle =
RAD2DEG(geometryPointPos.angleTo2D(
myNBEdge->getGeometry()[-2])) * -1;
2666 if ((selectedGeometryPoints.size() > 0) && (selectedGeometryPoints.back() == ((
int)
myNBEdge->getGeometry().size() - 1))) {
2683 geometryPointRadius, exaggeration);
2702 drawPosition.
mul(.5);
2703 if (spreadSuperposed) {
2707 const Position shift(dist * cos(shiftA), dist * sin(shiftA));
2708 drawPosition.
add(shift);
2714 if (drawAngle > 90 && drawAngle < 270) {
2722 if (drawStreetName) {
2731 if (activeScheme == 12) {
2734 }
else if (activeScheme == 13) {
2739 const double doubleValue = lastLane->
getColorValue(s, activeScheme);
2762 lane->drawLaneStopOffset(s);
2775 if (!additional->getTagProperty()->isListedElement()) {
2776 additional->drawGL(s);
2780 if (
myNet->getViewNet()->getNetworkViewOptions().showDemandElements() &&
myNet->getViewNet()->getDataViewOptions().showDemandElements()) {
2783 stopEdge->drawGL(s);
2789 for (
const auto& vehicleMap : vehiclesMap) {
2790 for (
const auto& vehicle : vehicleMap.second) {
2809 const bool forceDrawExtrems =
myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkMoveOptions()->getForceDrawGeometryPoints();
2817 myNetworkElementContour.calculateContourEdgeGeometryPoints(s, d,
this, geometryPointRadius, moveMode, firstExtrem, lastExtrem);
2825 if (
myNet->getViewNet()->getNetworkViewOptions().showTAZElements()) {
2828 bool selected =
false;
2830 if (TAZSourceSink->isAttributeCarrierSelected()) {
2847 glTranslated(0, 0, 0.1);
2856 lane->getDrawingConstants()->getDrawingWidth());
2886 glTranslated(0, 0, layer);
2897 for (
int i = 1; i < (int)
myNBEdge->getGeometry().size(); i++) {
2913 const auto& editModes =
myNet->getViewNet()->getEditModes();
2915 if (!editModes.isCurrentSupermodeNetwork()) {
2920 (
myNet->getViewNet()->getViewParent()->getDeleteFrame()->getDeleteOptions()->deleteOnlyGeometryPoints())) {
std::vector< ChildType > GNEHierarchicalContainerChildren
#define ENDPOINT_TOLERANCE
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_ADDITIONAL
Mode for editing additionals.
@ NETWORK_SELECT
mode for selecting network elements
@ DEMAND_PERSONPLAN
Mode for editing person plan.
@ DEMAND_CONTAINER
Mode for editing container.
@ DEMAND_PERSON
Mode for editing person.
@ DEMAND_VEHICLE
Mode for editing vehicles.
@ DEMAND_CONTAINERPLAN
Mode for editing container plan.
@ GLO_FRONTELEMENT
front element (used in netedit)
@ GLO_GEOMETRYPOINT
geometry point (used in netedit)
GUIViewObjectsHandler gViewObjectsHandler
#define WRITE_WARNINGF(...)
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
const std::string invalid_return< std::string >::value
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_TAZ
a traffic assignment zone
@ GNE_TAG_STOPCONTAINER_EDGE
@ SUMO_TAG_LANETYPE
lane type
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_ROUTE
description of a route
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_TYPE
type (edge)
@ 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.
@ SUMO_ATTR_FROM_JUNCTION
@ GNE_ATTR_STOPOFFSET
stop offset (virtual, used by edge and lanes)
@ GNE_ATTR_OPPOSITE
to busStop (used by personPlans)
@ 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)
A class that stores a 2D geometrical boundary.
std::string fromEdge
from edge
std::string toEdge
to edge
std::vector< std::string > consecutiveEdges
consecutive edges
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void popMatrix()
pop matrix
static void drawBoundary(const GUIVisualizationSettings &s, const Boundary &b)
Draw a boundary (used for debugging).
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
static void drawFilledCircleDetailled(const GUIVisualizationSettings::Detail d, const double radius)
Draws a filled circle around (0,0) depending of level of detail.
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)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
double getCommonAttributeDouble(SumoXMLAttr key) const
void selectAttributeCarrier()
select attribute carrier using GUIGlobalSelection
bool myDrawInFront
boolean to check if drawn this AC over other elements
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
static const std::string FALSE_STR
true value in string format(used for comparing boolean values in getAttribute(...))
static const std::string TRUE_STR
true value in string format (used for comparing boolean values in getAttribute(......
const std::string getID() const override
get ID (all Attribute Carriers have one)
static const std::string FEATURE_LOADED
feature is still unchanged after being loaded (implies approval)
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
void unselectAttributeCarrier()
unselect attribute carrier using GUIGlobalSelection
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
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)
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
Position getCommonAttributePosition(SumoXMLAttr key) const
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
bool isCommonAttributeValid(SumoXMLAttr key, const std::string &value) const
std::string getCommonAttribute(SumoXMLAttr key) const
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void updateGeometry() override
update pre-computed geometry information
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
void updateLinkState()
recompute cached myLinkState
struct for saving subordinated elements (Junction->Edge->Lane->(Additional | DemandElement)
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
void drawEdgeGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double layer) const
draw edge geometry points (note: This function is called by GNELane::drawGL(...)
double getAttributeDouble(SumoXMLAttr key) const override
const Position getFrontDownShapePosition() const
get front down shape position
Boundary myEdgeBoundary
edge boundary
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...
bool isNetworkElementValid() const override
check if current network element is valid to be written into XML
std::string getAttributeForSelection(SumoXMLAttr key) const override
method for getting the attribute in the context of object selection
const std::map< const GNELane *, std::vector< GNEDemandElement * > > getPersonsOverEdgeMap() const
get persons a that start over this edge
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
const std::map< const GNELane *, std::vector< GNEDemandElement * > > getContainersOverEdgeMap() const
get containers a that start over this edge
bool hasPredecessors() const
check if this edge has predecessors (note: only for vehicles, this function ignore walking areas!...
friend class GNEChange_Lane
Friend class.
void updateGLObject() override
update GLObject (geometry, ID, etc.)
friend class GNEMoveElementEdge
void smooth(GNEUndoList *undoList)
make geometry smooth
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
double getGeometryPointRadius() const
get geometry point radius
void setResponsible(bool newVal)
set responsibility for deleting internal structures
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) override
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 setGeometry(PositionVector geom, bool inner)
update edge geometry and inform the lanes
void smoothElevation(GNEUndoList *undoList)
smooth elevation with regard to adjoining edges
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()
void remakeGNEConnections(bool junctionsReady=false)
remake connections
bool isAttributeComputed(SumoXMLAttr key) const override
void calculateEdgeContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double layer) const
calculate contours
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 setEdgeID(const std::string &newID)
set edge ID
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!...
void drawStartGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double geometryPointRadius, const double layer, const double exaggeration) const
draw start extreme geometry point
GNEMoveElementEdge * myMoveElementEdge
move element edge
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)
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this edge
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
const std::string getOptionalName() const override
Returns the street name.
std::vector< GNEEdge * > getOppositeEdges() const
get opposite edges
PositionVector smoothShape(const PositionVector &shape, bool forElevation)
return smoothed shape
bool checkDrawSelectContour() const override
check if draw select contour (blue)
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
bool checkDrawMoveContour() const override
check if draw move contour (red)
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
Position getAttributePosition(SumoXMLAttr key) const override
bool checkDrawToContour() const override
check if draw from contour (magenta)
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)
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
bool isValid(SumoXMLAttr key, const std::string &value) override
int getRouteProbeRelativePosition(GNERouteProbe *routeProbe) const
obtain relative positions of RouteProbes
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
std::string myConnectionStatus
modification status of the connections
void drawEndGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double geometryPointRadius, const double layer, const double exaggeration) const
draw end extreme geometry point
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
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
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
void updateFirstParentJunction(const std::string &value)
update front parent junction
void updateGeometry() override
update pre-computed geometry information
void straightenElevation(GNEUndoList *undoList)
interpolate z values linear between junctions
void updateContainerStackLabels()
bool clickedOverShapeStart(const Position &pos) const
return true if user clicked over ShapeStart
void deleteGLObject() override
delete element
void setShapeStartPos(const Position &pos)
change Shape StartPos
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
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 override
void addConnection(NBEdge::Connection nbCon, bool selectAfterCreation=false)
adds a connection
void drawLaneStopOffset(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double layer) const
draw edgeStopOffset
void drawTAZElements(const GUIVisualizationSettings &s) const
draw TAZElements
void drawEdgeShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double layer) const
draw edge shape (only one line)
std::vector< GNECrossing * > getGNECrossings()
get GNECrossings vinculated with this Edge
bool checkDrawFromContour() const override
check if draw from contour (green)
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)
Parameterised * getParameters() override
get parameters associated with this edge
void updateVehicleSpreadGeometries()
bool checkDrawOverContour() const override
check if draw over contour (orange)
std::string getAttribute(SumoXMLAttr key) const override
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 getNetworkElementProblem() const override
return a string with the current network element problem
const std::vector< GNELaneTemplate * > & getLaneTemplates() const
get vector with the lane templates of this edge
std::string getAttribute(SumoXMLAttr key) const override
std::string getAttribute(SumoXMLAttr key) const override
const std::vector< GNELaneType * > & getLaneTypes() const
get laneTypes
const GNEHierarchicalContainerChildren< GNEEdge * > & getChildEdges() const
get child edges
const GNEHierarchicalContainerChildren< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
static void insertChild(ElementType element, ChildType child)
insert child element
const GNEHierarchicalContainerChildren< GNEAdditional * > & getChildAdditionals() const
return child additionals
const GNEHierarchicalContainerChildrenSet< GNETAZSourceSink * > & getChildTAZSourceSinks() const
return child TAZSourceSinks (Set)
void addChildElement(ChildType *element)
add child without updating parent (ONLY used if we're creating elements without undo-redo)
friend class GNEDemandElement
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
static void removeChild(ElementType element, ChildType child)
remove child element
static void updateParent(ElementType element, const int index, ParentType newParent)
update single parent element
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
void setParents(const GNEHierarchicalContainerParents< ParentType > &parents)
set multiple parent element (ONLY use in constructors)
void setEdgeTemplate(const GNEEdge *edge)
set edge template
GNEEdgeTemplate * getEdgeTemplate() const
get edge template (to copy attributes from)
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
void updateGeometry() override
update pre-computed geometry information (including crossings)
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
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 PositionVector & getLaneShape() const
get elements shape
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
return value for lane coloring according to the given scheme
int getIndex() const
returns the index of the lane
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
A NBNetBuilder extended by visualisation and editing capabilities.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
bool checkDrawingBoundarySelection() const
GNEContour myNetworkElementContour
network element contour
GNEHierarchicalElement * getHierarchicalElement() override
get GNEHierarchicalElement associated with this AttributeCarrier
GNENetworkElement(GNENet *net, const std::string &id, SumoXMLTag tag)
Constructor.
void setNetworkElementID(const std::string &newID)
set network element id
const CommonXMLStructure::PlanParameters & getPlanParameteres() const
get plan parameters
bool markEdges() const
check if mark edges with dotted contours
void decRef(const std::string &debugMsg="")
Decrease reference.
void incRef(const std::string &debugMsg="")
Increase reference.
bool unreferenced()
check if object ins't referenced
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...
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
T getColor(const double value) const
const std::vector< T > & getSchemes() const
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings addSize
GUIVisualizationTextSettings edgeValue
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationTextSettings streetName
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
GUIColorer laneColorer
The lane colorer.
GUIVisualizationTextSettings edgeName
Setting bundles for optional drawing names with size and color.
bool checkDrawEdge(const Boundary &b) const
check if draw edge
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.
NBNode * getToNode() const
Returns the destination node of the edge.
Lane & getLaneStruct(int lane)
const PositionVector & getGeometry() const
Returns the geometry of the edge.
const std::string & getID() const
static const double UNSPECIFIED_LOADED_LENGTH
no length override given
@ USER
The connection was given by the user.
NBNode * getFromNode() const
Returns the origin node of the edge.
static const double UNSPECIFIED_WIDTH
unspecified lane width
const Position & getPosition() const
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.
An upper class for objects with additional parameters.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
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 position 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 amount
static const PositionVector EMPTY
empty Vector
PositionVector bezier(int numPoints)
return a bezier interpolation
void push_front(const Position &p)
insert in front a Position
Position positionAtOffset2D(double pos, double lateralOffset=0, bool extrapolateBeyond=false) const
Returns the position at the given length.
void pop_front()
pop first Position
PositionVector reverse() const
reverse position vector
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
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
RGBColor selectedEdgeColor
edge selection color
static const double segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
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.