82 const
double GNENet::Z_INITIALIZED = 1;
91 myNetBuilder(netBuilder),
92 myAttributeCarriers(new
GNENetHelper::AttributeCarriers(this)),
93 myPathCalculator(new
GNENetHelper::PathCalculator(this)),
94 myEdgeIDSupplier("gneE", netBuilder->getEdgeCont().getAllNames()),
95 myJunctionIDSupplier("gneJ", netBuilder->getNodeCont().getAllNames()),
96 myNeedRecompute(true),
98 myAdditionalsSaved(true),
99 myTLSProgramsSaved(true),
100 myDemandElementsSaved(true),
101 myDataElementsSaved(true),
102 myUpdateGeometryEnabled(true),
103 myUpdateDataEnabled(true) {
107 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in GNENet constructor");
109 initJunctionsAndEdges();
111 if (myZBoundary.ymin() != Z_INITIALIZED) {
112 myZBoundary.add(0, 0);
124 WRITE_DEBUG(
"Deleting net builder in GNENet destructor");
220 const std::string& suggestedName,
bool wasSplit,
bool allowDuplicateGeom,
bool recomputeConnections) {
223 if (outgoingEdge->getToNode() == dest->
getNBNode() && outgoingEdge->getGeometry().size() == 2) {
224 if (!allowDuplicateGeom) {
230 if (suggestedName !=
"" && !
retrieveEdge(suggestedName,
false)) {
241 edge =
new GNEEdge(
this, nbe, wasSplit);
245 double defaultSpeed = oc.
getFloat(
"default.speed");
246 const std::string defaultType = oc.
getString(
"default.type");
247 const int defaultNrLanes = oc.
getInt(
"default.lanenumber");
248 const int defaultPriority = oc.
getInt(
"default.priority");
253 defaultType, defaultSpeed,
254 defaultNrLanes, defaultPriority,
258 edge =
new GNEEdge(
this, nbe, wasSplit);
264 if (recomputeConnections) {
287 std::vector<GNECrossing*> crossingsToRemove;
289 for (
const auto& junctionNeighbour : junctionNeighbours) {
291 for (
const auto& crossing : junctionNeighbour->getGNECrossings()) {
293 if (crossing->checkEdgeBelong(junctionNeighbour->getChildEdges())) {
294 crossingsToRemove.push_back(crossing);
299 for (
const auto& crossing : crossingsToRemove) {
304 for (
const auto& edge : incidentEdges) {
319 for (
const auto& lane : edge->
getLanes()) {
321 lane->invalidatePathElements();
323 while (lane->getChildAdditionals().size() > 0) {
327 while (lane->getChildShapes().size() > 0) {
328 deleteShape(lane->getChildShapes().front(), undoList);
331 while (lane->getChildDemandElements().size() > 0) {
335 while (lane->getChildGenericDatas().size() > 0) {
359 if (recomputeConnections) {
388 for (
const auto& lane : which->
getLanes()) {
390 std::vector<GNEAdditional*> copyOfLaneAdditionals = lane->getChildAdditionals();
391 for (
const auto& additional : copyOfLaneAdditionals) {
395 std::vector<GNEShape*> copyOfLaneShapes = lane->getChildShapes();
396 for (
const auto& shape : copyOfLaneShapes) {
400 std::vector<GNEDemandElement*> copyOfLaneDemandElements = lane->getChildDemandElements();
401 for (
const auto& demandElement : copyOfLaneDemandElements) {
405 std::vector<GNEGenericData*> copyOfLaneGenericDatas = lane->getChildGenericDatas();
406 for (
const auto& demandElement : copyOfLaneGenericDatas) {
454 deleteEdge(edge, undoList, recomputeConnections);
476 if (recomputeConnections) {
485 undoList->add(
new GNEChange_Lane(edge, lane, laneAttrs,
false, recomputeConnections),
true);
510 undoList->
p_begin(
"delete crossing");
581 throw ProcessError(
"Trying to delete a default Vehicle Type");
609 for (
const auto& dataInterval : copyOfDataIntervalChildren) {
622 for (
const auto& genericData : copyOfGenericDataChildren) {
664 if (recomputeConnections) {
669 undoList->add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true, recomputeConnections),
true);
677 bool addRestriction =
true;
680 for (
const auto& edgeLane : edge->
getLanes()) {
683 addRestriction =
false;
692 if (addRestriction) {
708 for (
const auto& lane : edge->
getLanes()) {
709 if (lane->isRestricted(vclass)) {
714 const int numLanes = (int)edge->
getLanes().size();
715 if (index > numLanes) {
744 for (
const auto& lane : edge->
getLanes()) {
745 if (lane->isRestricted(vclass)) {
760 if (newJunction ==
nullptr) {
770 std::pair<PositionVector, PositionVector> newGeoms = oldEdgeGeometry.
splitAt(edgeSplitPosition);
778 const std::string::size_type sep_index = baseName.rfind(
'.');
780 if (sep_index != std::string::npos) {
781 std::string posString = baseName.substr(sep_index + 1);
782 if (GNEAttributeCarrier::canParse<int>(posString.c_str())) {
784 posBase = GNEAttributeCarrier::parse<int>(posString.c_str());
785 baseName = baseName.substr(0, sep_index);
792 undoList, baseName +
toString(posBase + (
int)edgeSplitPosition),
true,
false,
false);
794 edge->
getParentJunctions().back()->replaceIncomingConnections(edge, secondPart, undoList);
796 std::vector<NBNode::Crossing> affectedCrossings;
798 if (crossing->checkEdgeBelong(edge)) {
804 newEdges.push_back(secondPart->
getNBEdge());
806 newEdges.push_back(nbEdge);
809 nbC.
edges = newEdges;
810 affectedCrossings.push_back(nbC);
816 newGeoms.first.pop_back();
817 newGeoms.first.erase(newGeoms.first.begin());
822 newGeoms.second.pop_back();
823 newGeoms.second.erase(newGeoms.second.begin());
826 for (
int i = 0; i < (int)edge->
getLanes().size(); ++i) {
830 for (
const auto& nbC : affectedCrossings) {
835 additional->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
838 for (
int i = 0; i < (int)edge->
getLanes().size(); i++) {
839 for (
const auto& additional : edge->
getLanes().at(i)->getChildAdditionals()) {
840 additional->splitEdgeGeometry(laneSplitPosition, edge->
getLanes().at(i), secondPart->
getLanes().at(i), undoList);
845 demandElement->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
848 for (
int i = 0; i < (int)edge->
getLanes().size(); i++) {
849 for (
const auto& demandElement : edge->
getLanes().at(i)->getChildDemandElements()) {
850 demandElement->splitEdgeGeometry(laneSplitPosition, edge->
getLanes().at(i), secondPart->
getLanes().at(i), undoList);
865 newJunction =
splitEdge(edge, pos, undoList, newJunction);
867 splitEdge(oppositeEdge, pos, undoList, newJunction);
877 assert(reversed != 0);
892 assert(reversed != 0);
906 reversed =
createEdge(src, dest, edge, undoList,
"-" + edge->
getID(),
false,
true);
907 assert(reversed != 0);
927 for (
const auto& incomingNBEdge : incomingNBEdges) {
938 for (
const auto& outgoingNBEdge : outgoingNBEdges) {
956 for (
NBEdge* edge : roundabout) {
957 if (edge->getFromNode() == junction->
getNBNode()) {
958 undoList->
p_begin(
"select roundabout");
959 for (
NBEdge* roundaboutEdge : roundabout) {
974 undoList->
p_begin(
"create roundabout");
980 std::vector<GNEEdge*> edges;
986 const double lefthandSign = lefthand ? -1 : 1;
987 std::vector<GNEJunction*> newJunctions;
988 GNEEdge* prevOpposite =
nullptr;
992 if (edge == prevOpposite) {
993 newJunction = newJunctions.back();
998 const double splitOffset = (edge->getParentJunctions().back() == junction
999 ?
MAX2(POSITION_EPS, geomLength - radius)
1000 :
MIN2(geomLength - POSITION_EPS, radius));
1001 Position pos = edge->getNBEdge()->getGeometry().positionAtOffset2D(splitOffset);
1002 newJunction =
splitEdge(edge, pos, undoList, newJunction);
1003 if (newJunctions.empty() || newJunction != newJunctions.back()) {
1004 newJunctions.push_back(newJunction);
1011 for (
int i = 0; i < (int)newJunctions.size(); i++) {
1012 GNEJunction* from = newJunctions[(i + 1) % newJunctions.size()];
1020 int numSegments =
MAX2(2, (
int)ceil(angleDiff * radius / resolution));
1022 for (
int j = 1; j < numSegments; j++) {
1023 const double angle = angle1 + lefthandSign * j * angleDiff / numSegments;
1024 innerGeom.push_back(center +
Position(cos(angle) * radius, sin(angle) * radius));
1038 if (i.second->getPositionInView() == pos) {
1067 for (
int i = 0; i < (int)edgeType.second->getLaneTypes().size(); i++) {
1069 edgeType.second->getLaneTypes().at(i)->speed,
1070 edgeType.second->getLaneTypes().at(i)->permissions,
1071 edgeType.second->getLaneTypes().at(i)->width,
1072 edgeType.second->getLaneTypes().at(i)->attrs);
1105 for (
const auto& lane : edge.second->getLanes()) {
1106 lane->updateGeometry();
1116 }
else if (failHard) {
1131 }
else if (failHard) {
1146 }
else if (failHard) {
1157 if ((from !=
nullptr) && (to !=
nullptr)) {
1160 if ((edge.second->getParentJunctions().front() == from) && (edge.second->getParentJunctions().back() == to)) {
1181 for (
auto j : i.second->getGNEConnections()) {
1182 if (j->getID() ==
id) {
1196 std::vector<GNEConnection*>
1198 std::vector<GNEConnection*> result;
1202 for (
auto j : i.second->getGNEConnections()) {
1203 if (!onlySelected || j->isAttributeCarrierSelected()) {
1204 result.push_back(j);
1217 for (
auto j : i.second->getGNECrossings()) {
1218 if (j->getID() ==
id) {
1232 std::vector<GNECrossing*>
1234 std::vector<GNECrossing*> result;
1238 for (
auto j : i.second->getGNECrossings()) {
1239 if (!onlySelected || j->isAttributeCarrierSelected()) {
1240 result.push_back(j);
1248 std::vector<GNEEdge*>
1250 std::vector<GNEEdge*> result;
1253 if (!onlySelected || edge.second->isAttributeCarrierSelected()) {
1254 result.push_back(edge.second);
1261 std::vector<GNEEdge*>
1263 std::vector<GNEEdge*> result;
1267 if (!onlySelected || edge.second->isAttributeCarrierSelected()) {
1269 const Position firstJunctionPosition = edge.second->getParentJunctions().front()->getPositionInView();
1270 const Position secondJunctionPosition = edge.second->getParentJunctions().back()->getPositionInView();
1272 double edgeAngle =
RAD2DEG(firstJunctionPosition.
angleTo2D(secondJunctionPosition));
1274 while (edgeAngle < 0) {
1278 edgeAngle = fmod(edgeAngle, 360);
1280 if ((edgeAngle >= 0) && (edgeAngle < 180)) {
1282 result.push_back(edge.second);
1291 std::vector<GNEEdge*>
1293 std::vector<GNEEdge*> result;
1297 if (!onlySelected || edge.second->isAttributeCarrierSelected()) {
1299 const Position firstJunctionPosition = edge.second->getParentJunctions().front()->getPositionInView();
1300 const Position secondJunctionPosition = edge.second->getParentJunctions().back()->getPositionInView();
1302 double edgeAngle =
RAD2DEG(firstJunctionPosition.
angleTo2D(secondJunctionPosition));
1304 while (edgeAngle < 0) {
1308 edgeAngle = fmod(edgeAngle, 360);
1310 if ((edgeAngle >= 180) && (edgeAngle < 360)) {
1312 result.push_back(edge.second);
1321 std::vector<GNELane*>
1323 std::vector<GNELane*> result;
1326 for (
auto j : i.second->getLanes()) {
1327 if (!onlySelected || j->isAttributeCarrierSelected()) {
1328 result.push_back(j);
1340 if (edge !=
nullptr) {
1344 if (it->getID() ==
id) {
1349 if (lane ==
nullptr) {
1361 }
else if (failHard) {
1369 std::vector<GNEJunction*>
1371 std::vector<GNEJunction*> result;
1374 if (!onlySelected || i.second->isAttributeCarrierSelected()) {
1375 result.push_back(i.second);
1382 std::vector<GNEShape*>
1384 std::vector<GNEShape*> result;
1387 if (!onlySelected || shape.second->isAttributeCarrierSelected()) {
1388 result.push_back(shape.second);
1395 std::vector<GNEShape*>
1397 std::vector<GNEShape*> result;
1400 for (
const auto& shape : shapeTag.second) {
1401 if (!onlySelected || shape.second->isAttributeCarrierSelected()) {
1402 result.push_back(shape.second);
1439 if (
object !=
nullptr) {
1444 if (ac ==
nullptr) {
1445 throw ProcessError(
"GUIGlObject does not match the declared type");
1449 }
else if (failHard) {
1450 throw ProcessError(
"Attempted to retrieve non-existant GUIGlObject");
1457 std::vector<GNEAttributeCarrier*>
1459 std::vector<GNEAttributeCarrier*> result;
1463 result.push_back(junction.second);
1464 for (
const auto& crossing : junction.second->getGNECrossings()) {
1465 result.push_back(crossing);
1469 result.push_back(edge.second);
1470 for (
const auto& lane : edge.second->getLanes()) {
1471 result.push_back(lane);
1473 for (
const auto& connection : edge.second->getGNEConnections()) {
1474 result.push_back(connection);
1478 for (
const auto& additional : additionalSet.second) {
1479 result.push_back(additional.second);
1483 for (
const auto& shape : shapeSet.second) {
1484 result.push_back(shape.second);
1488 for (
const auto& TAZElement : TAZSet.second) {
1489 result.push_back(TAZElement.second);
1493 for (
const auto& demandElement : demandElementSet.second) {
1494 result.push_back(demandElement.second);
1498 result.push_back(dataSet.second);
1499 for (
const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
1500 result.push_back(dataInterval.second);
1501 for (
const auto& genericData : dataInterval.second->getGenericDataChildren()) {
1502 result.push_back(genericData);
1509 for (
const auto& additional : additionalTag.second) {
1510 if (additional.second->getTagProperty().getTag() == type) {
1511 result.push_back(additional.second);
1514 for (
const auto& additionalChild : additional.second->getChildAdditionals()) {
1515 if (additionalChild->getTagProperty().getTag() == type) {
1516 result.push_back(additionalChild);
1525 result.push_back(shape.second);
1530 result.push_back(TAZElement.second);
1535 result.push_back(demandElemet.second);
1539 for (
const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
1540 for (
const auto& genericData : dataInterval.second->getGenericDataChildren()) {
1541 if (genericData->getTagProperty().getTag() == type) {
1542 result.push_back(genericData);
1552 result.push_back(junction.second);
1557 result.push_back(edge.second);
1562 for (
const auto& lane : edge.second->getLanes()) {
1563 result.push_back(lane);
1569 for (
const auto& connection : edge.second->getGNEConnections()) {
1570 result.push_back(connection);
1576 for (
const auto& crossing : junction.second->getGNECrossings()) {
1577 result.push_back(crossing);
1583 result.push_back(dataSet.second);
1588 for (
const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
1589 result.push_back(dataInterval.second);
1606 if (volatileOptions) {
1607 window->
setStatusBarText(
"Forced computing junctions with volatile options ...");
1615 if (volatileOptions) {
1622 if (volatileOptions) {
1631 if (additionalPath !=
"") {
1642 if (demandPath !=
"") {
1653 window->getApp()->endWaitCursor();
1667 for (
const auto& j : i.second) {
1668 j.second->computePath();
1698 for (
auto it : tlsDefs) {
1699 it->setParticipantsInformation();
1700 it->setTLControllingInformation();
1723 if (n.second->getGNECrossings().size() > 0) {
1746 if (selectedJunctions.size() < 2) {
1751 std::set<NBNode*, ComparatorIdLess> cluster;
1752 for (
auto it : selectedJunctions) {
1753 cluster.insert(it->getNBNode());
1754 const EdgeVector& incoming = it->getNBNode()->getIncomingEdges();
1755 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
1756 const EdgeVector& outgoing = it->getNBNode()->getOutgoingEdges();
1757 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1763 std::string
id =
"cluster";
1772 if ((i.second->getPositionInView() == pos) && (cluster.find(i.second->getNBNode()) == cluster.end())) {
1774 WRITE_DEBUG(
"Opening FXMessageBox 'Join non-selected junction'");
1776 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1783 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'No'");
1784 }
else if (answer == 4) {
1785 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'ESC'");
1790 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'Yes'");
1800 pos.
setx(pos.
x() + 0.1);
1801 pos.
sety(pos.
y() + 0.1);
1817 std::vector<NBNode::Crossing> oldCrossings;
1818 for (
auto i : selectedJunctions) {
1819 while (i->getGNECrossings().size() > 0) {
1820 GNECrossing* crossing = i->getGNECrossings().front();
1827 for (
auto it : selectedJunctions) {
1828 it->setLogicValid(
false, undoList);
1831 for (
auto it : allIncoming) {
1836 for (
auto it : allOutgoing) {
1840 edgesWithin.insert(it);
1848 for (
auto nbc : oldCrossings) {
1850 for (
NBEdge* e : nbc.edges) {
1851 if (edgesWithin.count(e) != 0) {
1859 nbc.customTLIndex, nbc.customTLIndex2, nbc.customShape,
1860 false,
true),
true);
1865 for (
auto it : selectedJunctions) {
1872 if (pos != oldPos) {
1883 std::vector<GNECrossing*> myNetCrossings;
1885 myNetCrossings.reserve(myNetCrossings.size() + it.second->getGNECrossings().size());
1886 myNetCrossings.insert(myNetCrossings.end(), it.second->getGNECrossings().begin(), it.second->getGNECrossings().end());
1889 std::vector<GNECrossing*> myInvalidCrossings;
1890 for (
auto i = myNetCrossings.begin(); i != myNetCrossings.end(); i++) {
1891 if ((*i)->getNBCrossing()->valid ==
false) {
1892 myInvalidCrossings.push_back(*i);
1896 if (myInvalidCrossings.empty()) {
1898 WRITE_DEBUG(
"Opening FXMessageBox 'No crossing to remove'");
1900 FXMessageBox::warning(
getApp(), MBOX_OK,
1904 WRITE_DEBUG(
"Closed FXMessageBox 'No crossing to remove' with 'OK'");
1906 std::string plural = myInvalidCrossings.size() == 1 ? (
"") : (
"s");
1908 WRITE_DEBUG(
"Opening FXMessageBox 'clear crossings'");
1910 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1916 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'No'");
1917 }
else if (answer == 4) {
1918 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'ESC'");
1922 for (
auto i = myInvalidCrossings.begin(); i != myInvalidCrossings.end(); i++) {
1935 std::vector<GNEJunction*> toRemove;
1939 toRemove.push_back(junction);
1942 for (
auto it : toRemove) {
1952 std::vector<GNEDemandElement*> routesWithoutChildren;
1956 if (i.second->getChildDemandElements().empty()) {
1957 routesWithoutChildren.push_back(i.second);
1961 if (routesWithoutChildren.size() > 0) {
1963 undoList->
p_begin(
"clean unused routes");
1965 for (
const auto& i : routesWithoutChildren) {
1978 std::set<std::pair<std::string, GNEDemandElement*> > mySortedRoutes;
1982 bool hasStops =
false;
1983 for (
const auto& j : i.second->getChildDemandElements()) {
1984 if (j->getTagProperty().isStop()) {
1993 std::vector<std::vector<GNEDemandElement*> > routesToMerge;
1994 auto index = mySortedRoutes.begin();
1996 for (
auto i = mySortedRoutes.begin(); i != mySortedRoutes.end(); i++) {
1997 if (routesToMerge.empty()) {
1998 routesToMerge.push_back({i->second});
2000 if (index->first == i->first) {
2001 routesToMerge.back().push_back(i->second);
2003 routesToMerge.push_back({i->second});
2009 bool thereIsRoutesToMerge =
false;
2010 for (
const auto& i : routesToMerge) {
2012 thereIsRoutesToMerge =
true;
2016 if (thereIsRoutesToMerge) {
2018 undoList->
p_begin(
"merge routes");
2020 for (
const auto& i : routesToMerge) {
2023 for (
int j = 1; j < (int)i.size(); j++) {
2025 while (i.at(j)->getChildDemandElements().size() > 0) {
2026 i.at(j)->getChildDemandElements().front()->setAttribute(
SUMO_ATTR_ROUTE, i.at(0)->getID(), undoList);
2042 std::vector<GNEDemandElement*> invalidDemandElements;
2048 if (!i.second->isDemandElementValid()) {
2049 invalidDemandElements.push_back(i.second);
2054 if (!i.second->isDemandElementValid()) {
2055 invalidDemandElements.push_back(i.second);
2060 if (!i.second->isDemandElementValid()) {
2061 invalidDemandElements.push_back(i.second);
2065 if (invalidDemandElements.size() > 0) {
2067 undoList->
p_begin(
"remove invalid demand elements");
2069 for (
const auto& i : invalidDemandElements) {
2082 undoList->
p_begin(
"Replace junction by geometry");
2088 for (
auto j : toJoin) {
2094 for (
auto con : connections) {
2131 if (endpoints.size() < 2) {
2135 undoList->
p_begin(
"Split junction");
2137 std::map<GNEEdge*, std::vector<NBEdge::Connection>> straightConnections;
2139 for (
const auto& c : e->getNBEdge()->getConnections()) {
2141 straightConnections[e].push_back(c);
2148 for (
const auto& pair : endpoints) {
2150 const std::string& origID = pair.second;
2152 std::string newID = origID !=
"" ? origID : newJunction->
getID();
2159 if (e->getNBEdge()->getGeometry().back().almostSame(pos) || e->getNBEdge()->getParameter(
"origTo") == newID) {
2166 if (e->getNBEdge()->getGeometry().front().almostSame(pos) || e->getNBEdge()->getParameter(
"origFrom") == newID) {
2171 if (newID != newJunction->
getID()) {
2175 WRITE_WARNING(
"Could not rename split node to '" + newID +
"'");
2181 for (
const auto& item : straightConnections) {
2183 std::map<NBEdge*, GNEEdge*> newEdges;
2184 for (
auto& c : item.second) {
2190 if (newEdges.count(c.toEdge) == 0) {
2192 newEdges[c.toEdge] = newEdge;
2195 newEdge = newEdges[c.toEdge];
2214 undoList->
p_begin(
"clear junction connections");
2217 for (
auto i : connections) {
2226 undoList->
p_begin(
"reset junction connections");
2250 std::vector<GNEAttributeCarrier*>
2253 std::vector<GNEAttributeCarrier*> result;
2261 bool insert =
false;
2262 if (ignoreCurrentSupermode) {
2273 result.push_back(AC);
2311 return (
"edgeType_" +
toString(counter));
2319 }
else if (hardFail) {
2320 throw ProcessError(
"Attempted to retrieve non-existant additional");
2327 std::vector<GNEAdditional*>
2329 std::vector<GNEAdditional*> result;
2332 for (
const auto& additional : additionalTag.second) {
2333 if (!onlySelected || additional.second->isAttributeCarrierSelected()) {
2334 result.push_back(additional.second);
2337 for (
const auto& additionalChild : additional.second->getChildAdditionals()) {
2338 if (!onlySelected || additionalChild->isAttributeCarrierSelected()) {
2339 result.push_back(additionalChild);
2353 counter += (int)i.second.size();
2376 std::vector<GNEAdditional*> invalidSingleLaneAdditionals;
2377 std::vector<GNEAdditional*> invalidMultiLaneAdditionals;
2380 for (
const auto& addditional : additionalPair.second) {
2382 if (addditional.second->getTagProperty().hasAttribute(
SUMO_ATTR_LANE) && !addditional.second->isAdditionalValid()) {
2383 invalidSingleLaneAdditionals.push_back(addditional.second);
2384 }
else if (addditional.second->getTagProperty().hasAttribute(
SUMO_ATTR_LANES) && !addditional.second->isAdditionalValid()) {
2385 invalidMultiLaneAdditionals.push_back(addditional.second);
2390 if (invalidSingleLaneAdditionals.size() > 0 || invalidMultiLaneAdditionals.size() > 0) {
2394 if (fixAdditionalElementsDialog.execute() == 0) {
2438 }
else if (hardFail) {
2439 throw ProcessError(
"Attempted to retrieve non-existant demand element");
2446 std::vector<GNEDemandElement*>
2448 std::vector<GNEDemandElement*> result;
2451 for (
auto j : i.second) {
2452 if (!onlySelected || j.second->isAttributeCarrierSelected()) {
2453 result.push_back(j.second);
2466 counter += (int)i.second.size();
2491 std::vector<GNEDemandElement*> invalidSingleLaneDemandElements;
2494 for (
const auto& demandElement : demandElementSet.second) {
2496 demandElement.second->computePath();
2498 if (!demandElement.second->isDemandElementValid()) {
2499 invalidSingleLaneDemandElements.push_back(demandElement.second);
2504 if (invalidSingleLaneDemandElements.size() > 0) {
2508 if (fixDemandElementsDialog.execute() == 0) {
2516 WRITE_DEBUG(
"demand elements saved after dialog");
2556 if (isVehicle || isFlow) {
2560 while ((vehicles.count(tagStr +
"_" +
toString(counter)) != 0) ||
2561 (trips.count(tagStr +
"_" +
toString(counter)) != 0) ||
2562 (vehiclesEmbebbed.count(tagStr +
"_" +
toString(counter)) != 0) ||
2563 (routeFlows.count(tagStr +
"_" +
toString(counter)) != 0) ||
2564 (flows.count(tagStr +
"_" +
toString(counter)) != 0) ||
2565 (flowsEmbebbed.count(tagStr +
"_" +
toString(counter)) != 0) ||
2566 (vehicles.count(tagStr +
"_" +
toString(counter)) != 0)) {
2570 return (tagStr +
"_" +
toString(counter));
2571 }
else if (isPerson) {
2593 }
else if (hardFail) {
2594 throw ProcessError(
"Attempted to retrieve non-existant data set");
2601 std::vector<GNEDataSet*>
2603 std::vector<GNEDataSet*> result;
2607 result.push_back(dataSet.second);
2613 std::vector<GNEGenericData*>
2615 std::vector<GNEGenericData*> result;
2616 size_t numGenericDatas = 0;
2619 for (
const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
2620 numGenericDatas += dataInterval.second->getGenericDataChildren().size();
2623 result.reserve(numGenericDatas);
2626 for (
const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
2627 for (
const auto& genericData : dataInterval.second->getGenericDataChildren()) {
2628 if (!onlySelected || genericData->isAttributeCarrierSelected()) {
2629 result.push_back(genericData);
2683 return (prefix + dataSetTagStr +
"_" +
toString(counter));
2687 std::set<std::string>
2690 std::set<std::string> attributesSolution;
2692 std::vector<GNEGenericData*> genericDatas;
2695 for (
const auto& interval : dataSet.second->getDataIntervalChildren()) {
2699 for (
const auto& genericData : interval.second->getGenericDataChildren()) {
2700 if (genericDataTag.empty() || (genericData->getTagProperty().getTagStr() == genericDataTag)) {
2701 genericDatas.push_back(genericData);
2708 for (
const auto& genericData : genericDatas) {
2709 for (
const auto& attribute : genericData->getParametersMap()) {
2710 attributesSolution.insert(attribute.first);
2713 return attributesSolution;
2717 std::set<std::string>
2719 const std::string& beginStr,
const std::string& endStr)
const {
2721 std::set<std::string> attributesSolution;
2723 std::vector<GNEDataSet*> dataSets;
2724 std::vector<GNEDataInterval*> dataIntervals;
2726 if (dataSetID.empty()) {
2730 dataSets.push_back(dataSet.second);
2735 return attributesSolution;
2738 int numberOfIntervals = 0;
2739 for (
const auto& dataSet : dataSets) {
2740 numberOfIntervals += (int)dataSet->getDataIntervalChildren().size();
2743 dataIntervals.reserve(numberOfIntervals);
2745 for (
const auto& dataSet : dataSets) {
2746 for (
const auto& dataInterval : dataSet->getDataIntervalChildren()) {
2748 if (beginStr.empty() && endStr.empty()) {
2749 dataIntervals.push_back(dataInterval.second);
2750 }
else if (endStr.empty()) {
2752 const double begin = GNEAttributeCarrier::parse<double>(beginStr);
2753 if (dataInterval.second->getAttributeDouble(
SUMO_ATTR_BEGIN) >= begin) {
2754 dataIntervals.push_back(dataInterval.second);
2756 }
else if (beginStr.empty()) {
2758 const double end = GNEAttributeCarrier::parse<double>(endStr);
2759 if (dataInterval.second->getAttributeDouble(
SUMO_ATTR_END) <= end) {
2760 dataIntervals.push_back(dataInterval.second);
2764 const double begin = GNEAttributeCarrier::parse<double>(beginStr);
2765 const double end = GNEAttributeCarrier::parse<double>(endStr);
2766 if ((dataInterval.second->getAttributeDouble(
SUMO_ATTR_BEGIN) >= begin) &&
2767 (dataInterval.second->getAttributeDouble(
SUMO_ATTR_END) <= end)) {
2768 dataIntervals.push_back(dataInterval.second);
2774 for (
const auto& dataInterval : dataIntervals) {
2775 for (
const auto& genericData : dataInterval->getGenericDataChildren()) {
2777 if (genericDataTag.empty() || (genericData->getTagProperty().getTagStr() == genericDataTag)) {
2778 for (
const auto& attribute : genericData->getParametersMap()) {
2779 attributesSolution.insert(attribute.first);
2784 return attributesSolution;
2790 double minimumBegin = 0;
2798 for (
const auto& interval : dataSet.second->getDataIntervalChildren()) {
2799 if (interval.second->getAttributeDouble(
SUMO_ATTR_BEGIN) < minimumBegin) {
2804 return minimumBegin;
2810 double maximumEnd = 0;
2818 for (
const auto& interval : dataSet.second->getDataIntervalChildren()) {
2819 if (interval.second->getAttributeDouble(
SUMO_ATTR_END) > maximumEnd) {
2820 maximumEnd = interval.second->getAttributeDouble(
SUMO_ATTR_END);
2835 for (
const auto& additional : additionalPair.second) {
2836 additional.second->writeAdditional(device);
2843 for (
const auto& additional : additionalPair.second) {
2845 if (additional.second->getParentAdditionals().empty()) {
2846 additional.second->writeAdditional(device);
2854 for (
const auto& additional : additionalPair.second) {
2856 if (additional.second->getParentAdditionals().empty()) {
2857 additional.second->writeAdditional(device);
2866 for (
const auto& additional : additionalPair.second) {
2868 if (additional.second->getParentAdditionals().empty()) {
2869 additional.second->writeAdditional(device);
2876 TAZ.second->writeTAZElement(device);
2880 poly.second->writeShape(device);
2884 for (
const auto&
POI : shape.second) {
2886 POI.second->writeShape(device);
2900 i.second->writeDemandElement(device);
2904 i.second->writeDemandElement(device);
2908 i.second->writeDemandElement(device);
2911 std::map<double, std::vector<GNEDemandElement*> > vehiclesSortedByDepart;
2913 for (
const auto& demandElement : demandElementTag.second) {
2914 if (demandElement.second->getTagProperty().isPerson() || demandElement.second->getTagProperty().isVehicle()) {
2916 vehiclesSortedByDepart[GNEAttributeCarrier::parse<double>(demandElement.second->getBegin())].push_back(demandElement.second);
2921 for (
const auto& vehicleTag : vehiclesSortedByDepart) {
2922 for (
const auto& vehicle : vehicleTag.second) {
2923 vehicle->writeDemandElement(device);
2936 dataSet.second->writeDataSet(device);
2947 }
else if (hardFail) {
2948 throw ProcessError(
"Attempted to retrieve non-existant shape");
2955 std::vector<GNEShape*>
2957 std::vector<GNEShape*> result;
2960 for (
auto j : i.second) {
2961 if (!onlySelected || j.second->isAttributeCarrierSelected()) {
2962 result.push_back(j.second);
2993 counter += (int)i.second.size();
3004 }
else if (hardFail) {
3005 throw ProcessError(
"Attempted to retrieve non-existant TAZElement");
3012 std::vector<GNETAZElement*>
3014 std::vector<GNETAZElement*> result;
3017 for (
auto j : i.second) {
3018 if (!onlySelected || j.second->isAttributeCarrierSelected()) {
3019 result.push_back(j.second);
3042 counter += (int)i.second.size();
3063 device.
openTag(
"additionals");
3087 for (
int i = 0; i < (int)edgeType.second->getLaneTypes().size(); i++) {
3089 edgeType.second->getLaneTypes().at(i)->speed,
3090 edgeType.second->getLaneTypes().at(i)->permissions,
3091 edgeType.second->getLaneTypes().at(i)->width,
3092 edgeType.second->getLaneTypes().at(i)->attrs);
3131 for (
const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
3132 dataInterval.second->updateGenericDataIDs();
3133 dataInterval.second->updateAttributeColors();
3177 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
3186 for (
const auto& lane : edge.second->getLanes()) {
3187 lane->updateGeometry();
3211 edge.second->remakeGNEConnections();
3213 for (
const auto& connection : edge.second->getGNEConnections()) {
3214 connection->updateGeometry();
3223 std::set<std::string> liveExplicitTurnarounds;
3226 liveExplicitTurnarounds.insert(explicitTurnarounds);
3242 if (oc.
getBool(
"numerical-ids") || oc.
isSet(
"reserved-ids")) {
3246 if (!oc.
getBool(
"offset.disable-normalization")) {
3249 edge.second->updateGeometry();
3260 if (volatileOptions) {
3279 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in computeAndUpdate(...) due recomputing with volatile options");
3284 WRITE_GLDEBUG(
"Add junctions during recomputing after calling myNetBuilder->compute(...)");
3287 junction.second->updateCenteringBoundary(
false);
3292 WRITE_GLDEBUG(
"Add edges during recomputing after calling myNetBuilder->compute(...)");
3295 edge.second->updateCenteringBoundary(
false);
3301 connection.second->remakeGNEConnections();
3306 junction.second->setLogicValid(
true,
nullptr);
3308 junction.second->updateGeometryAfterNetbuild();
3313 edge.second->updateGeometry();
3324 std::vector<std::string> values = GNEAttributeCarrier::parse<std::vector<std::string> >(ac->
getAttribute(key));
3325 std::vector<std::string> newValues;
3326 for (
auto v : values) {
3327 newValues.push_back(v == which ? by : v);
@ GLO_NETWORK
The network - empty.
GUISelectedStorage gSelected
A global holder of selected objects.
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(msg)
#define WRITE_GLDEBUG(msg)
std::set< NBEdge * > EdgeSet
container for unique edges
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_VTYPE
description of a vehicle type
@ SUMO_TAG_NOTHING
invalid tag
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route (used in NETEDIT)
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_CONNECTION
connectio between two lanes
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ GNE_TAG_VEHICLE_WITHROUTE
@ SUMO_TAG_TYPE
type (edge)
@ SUMO_TAG_PTYPE
description of a person type (used in NETEDIT)
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ STRAIGHT
The link is a straight direction.
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_DEFAULT_VTYPE
Flag to check if VType is a default VType.
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_TLTYPE
node: the type of traffic light
@ GNE_ATTR_SHAPE_END
last coordinate of edge shape
@ SUMO_ATTR_END
weights: time range end
@ GNE_ATTR_SHAPE_START
first coordinate of edge shape
#define UNUSED_PARAMETER(x)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
void reset()
Resets the boundary.
double getHeight() const
Returns the height of the boundary (y-axis)
double getWidth() const
Returns the width of the boudary (x-axis)
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc.....
An Element which don't belongs to GNENet but has influency in the simulation.
The main window of the Netedit.
void enableSaveAdditionalsMenu()
enable save additionals
void setStatusBarText(const std::string &statusBarText)
set text of the statusBar
void disableSaveDemandElementsMenu()
disable save demand elements
void enableSaveDataElementsMenu()
enable save data elements
void disableSaveAdditionalsMenu()
disable save additionals
void enableSaveTLSProgramsMenu()
enable save TLS Programs
void disableSaveDataElementsMenu()
disable save data elements
void enableSaveDemandElementsMenu()
enable save demand elements
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
static const GNETagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
const std::string & getTagStr() const
get tag assigned to this object in string format
virtual GUIGlObject * getGUIGlObject()=0
get GUIGlObject associated with this AttributeCarrier
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool isList() const
return true if atribute is a list
the function-object for an editing operation (abstract base)
the function-object for an editing operation (abstract base)
NBConnection getNBConnection() const
get NBConnection
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
GNEJunction * getParentJunction() const
get parent Junction
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
An Element which don't belongs to GNENet but has influency in the simulation.
GNEDataSet * getDataSetParent() const
Returns a pointer to GNEDataSet parent.
const std::vector< GNEGenericData * > & getGenericDataChildren() const
get generic data children
const std::map< const double, GNEDataInterval * > & getDataIntervalChildren() const
get data interval children
An Element which don't belongs to GNENet but has influency in the simulation.
virtual std::string getAttribute(SumoXMLAttr key) const =0
A road/street connecting two junctions (netedit-version)
GNEEdge * getOppositeEdge() const
get opposite edge
NBEdge * getNBEdge() const
returns the internal NBEdge
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
bool wasSplit()
whether this edge was created from a split
std::string getAttribute(SumoXMLAttr key) const
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Dialog for edit rerouters.
Dialog for edit rerouters.
An Element which don't belongs to GNENet but has influency in the simulation.
GNEDataInterval * getDataIntervalParent() const
get data interval parent
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
const std::vector< GNETAZElement * > & getChildTAZElements() const
get child TAZElements
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEShape * > & getChildShapes() const
get child shapes
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
void clearInspectedAC()
Clear all current inspected ACs.
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
std::string getAttribute(SumoXMLAttr key) const
void markAsModified(GNEUndoList *undoList)
prevent re-guessing connections at this junction
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
std::vector< GNEConnection * > getGNEConnections() const
Returns all GNEConnections vinculated with this junction.
void invalidatePathElements()
invalidate path element childs
Position getPositionInView() const
Returns position of hierarchical element in view.
bool isValid(SumoXMLAttr key, const std::string &value)
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
NBNode * getNBNode() const
Return net build node.
std::vector< GNEJunction * > getJunctionNeighbours() const
return GNEJunction neighbours
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=FEATURE_GUESSED)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
void invalidatePathElements()
invalidate path element childs
int getIndex() const
returns the index of the lane
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
GNEEdge * getParentEdge() const
get arent edge
struct used for saving all attribute carriers of net, in different formats
const std::map< std::string, GNEDataSet * > & getDataSets() const
GNEEdgeType * registerEdgeType(GNEEdgeType *edgeType)
void clearDemandElements()
clear demand elements
GNEEdge * registerEdge(GNEEdge *edge)
void remapJunctionAndEdgeIds()
remap junction and edge IDs
void clearAdditionals()
clear additionals
GNEJunction * registerJunction(GNEJunction *junction)
const std::map< std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
const std::map< SumoXMLTag, std::map< std::string, GNETAZElement * > > & getTAZElements() const
void addDefaultVTypes()
add default VTypes
void clearTAZElements()
clear TAZElements
const std::map< SumoXMLTag, std::map< std::string, GNEAdditional * > > & getAdditionals() const
void clearEdges()
clear edges
const std::map< SumoXMLTag, std::map< std::string, GNEDemandElement * > > & getDemandElements() const
const std::map< std::string, GNEJunction * > & getJunctions() const
map with the ID and pointer to junctions of net
const std::map< std::string, GNEEdgeType * > & getEdgeTypes() const
map with the ID and pointer to edgeTypes of net
void clearJunctions()
clear junctions
void clearShapes()
clear shapes
const std::map< SumoXMLTag, std::map< std::string, GNEShape * > > & getShapes() const
class for GNEChange_ReplaceEdgeInTLS
class used to calculate paths in nets
void updatePathCalculator()
update path calculator (called when SuperModes Demand or Data is selected)
A NBNetBuilder extended by visualisation and editing capabilities.
void removeSolitaryJunctions(GNEUndoList *undoList)
removes junctions that have no edges
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
GNECrossing * retrieveCrossing(const std::string &id, bool failHard=true) const
get Crossing by id
std::vector< GNEDataSet * > retrieveDataSets() const
return all data sets
bool joinSelectedJunctions(GNEUndoList *undoList)
join selected junctions
double getDataSetIntervalMaximumEnd() const
get maximum interval
void save(OptionsCont &oc)
save the network
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void saveDemandElements(const std::string &filename)
save demand element elements of the network
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
static const double Z_INITIALIZED
marker for whether the z-boundary is initialized
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
int getNumberOfTAZElements(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of TAZElements of the net.
SUMORTree & getGrid()
Returns the RTree used for visualisation speed-up.
GNEViewNet * myViewNet
The net to be notofied of about changes.
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
bool myDataElementsSaved
Flag to check if data elements has to be saved.
void disableUpdateGeometry()
disable update geometry of elements after inserting or removing an element in net
void saveTLSPrograms(const std::string &filename)
save TLS Programs elements of the network
NBNetBuilder * getNetBuilder() const
get net builder
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
void reverseEdge(GNEEdge *edge, GNEUndoList *undoList)
reverse edge
GNEEdge * addReversedEdge(GNEEdge *edge, GNEUndoList *undoList)
add reversed edge
std::string generateTAZElementID(SumoXMLTag TAZElementTag) const
generate TAZElement ID
int getNumberOfDemandElements(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of demand elements of the net.
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
void deleteTAZElement(GNETAZElement *TAZElement, GNEUndoList *undoList)
remove TAZElement
std::string generateAdditionalID(SumoXMLTag type) const
generate additional id
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
std::vector< GNEGenericData * > retrieveGenericDatas(bool onlySelected=false) const
return all generic datas
bool restrictLane(SUMOVehicleClass vclass, GNELane *lane, GNEUndoList *undoList)
transform lane to restricted lane
bool isNetSaved() const
return if net has to be saved
bool myNetSaved
Flag to check if net has to be saved.
bool myTLSProgramsSaved
Flag to check if shapes has to be saved.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
void requireSaveNet(bool value)
inform that net has to be saved
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
GNEJunction * splitEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList, GNEJunction *newJunction=0)
split edge at position by inserting a new junction
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool failHard=true) const
get a single attribute carrier based on a GLID
void setViewNet(GNEViewNet *viewNet)
Set the net to be notified of network changes.
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
std::vector< GNEAdditional * > retrieveAdditionals(bool onlySelected=false) const
return all additionals
bool myNeedRecompute
whether the net needs recomputation
void saveAdditionalsConfirmed(const std::string &filename)
save additionals after confirming invalid objects
void deleteDemandElement(GNEDemandElement *demandElement, GNEUndoList *undoList)
remove demand element
void duplicateLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
duplicates lane
const Boundary & getZBoundary() const
Returns the Z boundary (stored in the x() coordinate) values of 0 do not affect the boundary.
const Boundary & getBoundary() const
returns the bounder of the network
void saveEdgeTypes(const std::string &filename)
save edgeTypes elements of the network
IDSupplier myEdgeIDSupplier
void reserveEdgeID(const std::string &id)
reserve edge ID (To avoid duplicates)
void computeAndUpdate(OptionsCont &oc, bool volatileOptions)
recompute the network and update lane geometries
GNENetHelper::PathCalculator * myPathCalculator
PathCalculator instance.
SUMORTree myGrid
the rtree which contains all GUIGlObjects (so named for historical reasons)
std::vector< GNEEdge * > retrieve000180AngleEdges(bool onlySelected=false) const
return edges with junction angle between 0 (inclusive) and 180 (exclusive) degrees
void savePlain(OptionsCont &oc)
save plain xml representation of the network (and nothing else)
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers(bool ignoreCurrentSupermode)
get all selected attribute carriers (or only relative to current supermode
void deleteDataInterval(GNEDataInterval *dataInterval, GNEUndoList *undoList)
remove data interval
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
std::vector< GNEDemandElement * > retrieveDemandElements(bool onlySelected=false) const
return all demand elements
void requireSaveAdditionals(bool value)
inform that additionals has to be saved
void cleanInvalidDemandElements(GNEUndoList *undoList)
clean invalid demand elements
bool myUpdateDataEnabled
Flag to enable or disable update data elements after inserting or removing element in net.
void cleanUnusedRoutes(GNEUndoList *undoList)
clean unused routes
NBNetBuilder * myNetBuilder
The internal netbuilder.
GNETAZElement * retrieveTAZElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named TAZElement.
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
void computeJunction(GNEJunction *junction)
trigger recomputation of junction shape and logic param[in] window The window to inform about delay
void resetJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
reset junction's connections
GNEEdgeType * retrieveEdgeType(const std::string &id, bool failHard=true) const
get edge type by id
void replaceIncomingEdge(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replaces edge
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void deleteGenericData(GNEGenericData *genericData, GNEUndoList *undoList)
remove generic data
GNENetHelper::PathCalculator * getPathCalculator()
obtain instance of PathCalculator
std::string generateDataSetID(const std::string &prefix) const
generate data set id
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
void computeNetwork(GNEApplicationWindow *window, bool force=false, bool volatileOptions=false, std::string additionalPath="", std::string demandPath="", std::string dataPath="")
trigger full netbuild computation param[in] window The window to inform about delay param[in] force W...
std::vector< GNEConnection * > retrieveConnections(bool onlySelected=false) const
return all connections
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
bool myUpdateGeometryEnabled
Flag to enable or disable update geometry of elements after inserting or removing element in net.
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
bool isAdditionalsSaved() const
check if additionals are saved
void initJunctionsAndEdges()
Init Junctions and edges.
void splitEdgesBidi(GNEEdge *edge, GNEEdge *oppositeEdge, const Position &pos, GNEUndoList *undoList)
split all edges at position by inserting one new junction
IDSupplier myJunctionIDSupplier
void requireSaveTLSPrograms()
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
void expandBoundary(const Boundary &newBoundary)
expand boundary
void deleteShape(GNEShape *shape, GNEUndoList *undoList)
remove shape
void disableUpdateData()
disable update data elements after inserting or removing an element in net
std::vector< GNEEdge * > retrieve180360AngleEdges(bool onlySelected=false) const
return edges with junction angle between 180 (inclusive) and 360 (exclusive) degrees
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge *edge, GNEUndoList *undoList)
remove restricted lane
std::string generateDemandElementID(SumoXMLTag tag) const
generate demand element id
void mergeJunctions(GNEJunction *moved, GNEJunction *target, GNEUndoList *undoList)
merge the given junctions edges between the given junctions will be deleted
GNEEdge * createEdge(GNEJunction *src, GNEJunction *dest, GNEEdge *edgeTemplate, GNEUndoList *undoList, const std::string &suggestedName="", bool wasSplit=false, bool allowDuplicateGeom=false, bool recomputeConnections=true)
creates a new edge (unless an edge with the same geometry already exists)
std::set< std::string > myExplicitTurnarounds
list of edge ids for which turn-arounds must be added explicitly
std::set< std::string > retrieveGenericDataParameters(const std::string &genericDataTag, const double begin, const double end) const
return a set of parameters for the given data Interval
bool myAdditionalsSaved
Flag to check if additionals has to be saved.
void addZValueInBoundary(const double z)
add Z in net boundary
bool isUpdateGeometryEnabled() const
check if update geometry after inserting or removing has to be updated
bool addRestrictedLane(SUMOVehicleClass vclass, GNEEdge *edge, int index, GNEUndoList *undoList)
add restricted lane to edge
int getNumberOfDataSets() const
Returns the number of data sets of the net.
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
bool checkJunctionPosition(const Position &pos)
return true if there are already a Junction in the given position, false in other case
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void reserveJunctionID(const std::string &id)
reserve junction ID (To avoid duplicates)
bool isNetRecomputed() const
check if net requiere recomputing
bool isUpdateDataEnabled() const
check if update data after inserting or removing has to be updated
void deleteDataSet(GNEDataSet *dataSet, GNEUndoList *undoList)
remove data set
static void replaceInListAttribute(GNEAttributeCarrier *ac, SumoXMLAttr key, const std::string &which, const std::string &by, GNEUndoList *undoList)
bool cleanInvalidCrossings(GNEUndoList *undoList)
clear invalid crossings
void splitJunction(GNEJunction *junction, bool reconnect, GNEUndoList *undoList)
replace the selected junction by a list of junctions for each unique edge endpoint
void selectRoundabout(GNEJunction *junction, GNEUndoList *undoList)
select all roundabout edges and junctions for the current roundabout
void joinRoutes(GNEUndoList *undoList)
join routes
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
std::vector< GNEShape * > retrieveShapes(SumoXMLTag shapeTag, bool onlySelected=false)
return shape by type shapes
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
void requireSaveDemandElements(bool value)
inform that demand elements has to be saved
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
int getNumberOfShapes(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of shapes of the net.
void createRoundabout(GNEJunction *junction, GNEUndoList *undoList)
transform the given junction into a roundabout
bool netHasGNECrossings() const
check if net has GNECrossings
std::string generateEdgeTypeID() const
generate edgeType id
void requireSaveDataElements(bool value)
inform that data sets has to be saved
void requireRecompute()
inform the net about the need for recomputation
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
void saveJoined(OptionsCont &oc)
save log of joined junctions (and nothing else)
GNEShape * retrieveShape(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named shape.
std::map< std::string, int > myEdgesAndNumberOfLanes
map with the Edges and their number of lanes
void addExplicitTurnaround(std::string id)
add edge id to the list of explicit turnarounds
void saveDataElements(const std::string &filename)
save data set elements of the network
void initGNEConnections()
initialize GNEConnections
void saveAdditionals(const std::string &filename)
save additional elements of the network
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
std::vector< GNETAZElement * > retrieveTAZElements(bool onlySelected=false) const
return all TAZElements
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNENetHelper::AttributeCarriers * myAttributeCarriers
AttributeCarriers of net.
void computeDataElements(GNEApplicationWindow *window)
compute data elements param[in] window The window to inform about delay
FXApp * getApp()
get pointer to the main App
bool isDataElementsSaved() const
check if data sets are saved
void saveDataElementsConfirmed(const std::string &filename)
save data elements after confirming invalid objects
bool myDemandElementsSaved
Flag to check if demand elements has to be saved.
int getNumberOfTLSPrograms() const
get number of TLS Programs
GNEViewNet * getViewNet() const
get view net
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true) const
get junction by id
void saveDemandElementsConfirmed(const std::string &filename)
save demand elements after confirming invalid objects
std::vector< GNECrossing * > retrieveCrossings(bool onlySelected=false) const
return all crossings
void enableUpdateGeometry()
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction's connections
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(SumoXMLTag type=SUMO_TAG_NOTHING)
get the attribute carriers based on Type
Boundary myZBoundary
the z boundary (stored in the x-coordinate), values of 0 are ignored
double getDataSetIntervalMinimumBegin() const
get minimum interval
GNEConnection * retrieveConnection(const std::string &id, bool failHard=true) const
get Connection by id
void computeDemandElements(GNEApplicationWindow *window)
compute demand elements param[in] window The window to inform about delay
bool isDemandElementsSaved() const
check if demand elements are saved
const std::string & getID() const
get ID
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
An Element which don't belongs to GNENet but has influency in the simulation.
bool isShape() const
return true if tag correspond to a shape
bool isTAZElement() const
return true if tag correspond to a TAZ element
const GNEAttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn't exist)
bool isNetworkElement() const
return true if tag correspond to a network element
bool isDataElement() const
return true if tag correspond to a data element
bool isPlacedInRTree() const
return true if Tag correspond to an element that has has to be placed in RTREE
bool isStoppingPlace() const
return true if tag correspond to a detector (Only used to group all stoppingPlaces in the output XML)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isDetector() const
return true if tag correspond to a shape (Only used to group all detectors in the XML)
bool isDemandElement() const
return true if tag correspond to a demand element
bool isAdditionalElement() const
return true if tag correspond to an additional element
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void p_clear()
clears the undo list (implies abort)
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
void unblockObject(GUIGlID id)
Marks an object as unblocked.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
A window containing a gl-object's parameter.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
Stores the information about how to visualize structures.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
static double angleDiff(const double angle1, const double angle2)
Returns the difference of the second angle to the first angle in radiants.
std::string getNext()
Returns the next id.
void avoid(const std::string &id)
make sure that the given id is never supplied
Storage for edges, including some functionality operating on multiple edges.
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
The representation of a single edge during network building.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
NBNode * getToNode() const
Returns the destination node of the edge.
int getNumLanes() const
Returns the number of lanes.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
void resetNodeBorder(const NBNode *node)
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
std::string getLaneID(int lane) const
get lane ID
bool hasDefaultGeometryEndpointAtNode(const NBNode *node) const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
static const double UNSPECIFIED_WIDTH
unspecified lane width
const std::vector< Connection > & getConnections() const
Returns the connections.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Lane & getLaneStruct(int lane)
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Instance responsible for building networks.
NBTypeCont & getTypeCont()
Returns a reference to the type container.
NBEdgeCont & getEdgeCont()
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
A definition of a pedestrian crossing.
PositionVector customShape
optional customShape for this crossing
int customTLIndex
the custom traffic light index of this crossing (if controlled)
bool priority
whether the pedestrians have priority
EdgeVector edges
The edges being crossed.
double width
This crossing's width.
void registerJoinedCluster(const NodeSet &cluster)
gets all joined clusters (see doc for myClusters2Join)
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
std::vector< std::string > getAllNames() const
get all node names
void analyzeCluster(NodeSet cluster, std::string &id, Position &pos, bool &hasTLS, TrafficLightType &type, SumoXMLNodeType &nodeType)
Represents a single node (junction) during network building.
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
static const double UNSPECIFIED_RADIUS
unspecified lane width
std::vector< std::pair< Position, std::string > > getEndPoints() const
return list of unique endpoint coordinates of all edges at this node
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
get edges to join
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node)
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
void updateSurroundingGeometry()
update geometry of node and surrounding edges
const Position & getPosition() const
double getRadius() const
Returns the turning radius of this node.
bool checkIsRemovable() const
check if node is removable
bool isTLControlled() const
Returns whether this node is controlled by any tls.
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node's edges clockwise regarding driving direction.
A container for traffic light definitions and built programs.
bool computeSingleLogic(OptionsCont &oc, NBTrafficLightDefinition *def)
Computes a specific traffic light logic (using by NETEDIT)
void writeEdgeTypes(OutputDevice &into) const
writes all EdgeTypes (and their lanes) as XML
void insertEdgeType(const std::string &id, int numLanes, double maxSpeed, int prio, SVCPermissions permissions, double width, bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth, double widthResolution, double maxWidth, double minWidth)
Adds a edgeType into the list.
void clearTypes()
clear types
void insertLaneType(const std::string &edgeTypeID, int index, double maxSpeed, SVCPermissions permissions, double width, const std::set< SumoXMLAttr > &attrs)
Adds a laneType into the list.
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network stored in the given net builder.
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
static void writeJoinedJunctions(const OptionsCont &oc, NBNodeCont &nc)
Writes the joined-juncionts to file.
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
void close()
Closes the device and removes it from the dictionary.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
C++ TraCI client API implementation.
A point in 2D or 3D with translation and scaling methods.
void setx(double x)
set position x
double x() const
Returns the x-position.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position
void sety(double y)
set position y
double y() const
Returns the y-position.
double length2D() const
Returns the length.
void append(const PositionVector &v, double sameThreshold=2.0)
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
std::pair< PositionVector, PositionVector > splitAt(double where, bool use2D=false) const
Returns the two lists made when this list vector is splitted at the given point.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
void push_back_noDoublePos(const Position &p)
insert in back a non double position
PositionVector reverse() const
reverse position vector
A RT-tree for efficient storing of SUMO's GL-objects.
void removeAdditionalGLObject(GUIGlObject *o)
Removes an additional object (detector/shape/trigger) from being visualised.
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
static std::string getEdgeIDFromLane(const std::string laneID)
return edge id when given the lane ID
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false)
Runs the given handler on the given file; returns if everything's ok.
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
A structure which describes a connection between edges or lanes.
An (internal) definition of a single lane of an edge.