77 const
double GNENet::Z_INITIALIZED = 1;
86 myNetBuilder(netBuilder),
87 myAttributeCarriers(new
GNENetHelper::AttributeCarriers(this)),
89 myJunctionIDCounter(0),
91 myNeedRecompute(true),
93 myAdditionalsSaved(true),
94 myTLSProgramsSaved(true),
95 myDemandElementsSaved(true),
96 myDataElementsSaved(true),
97 myUpdateGeometryEnabled(true),
98 myUpdateDataEnabled(true) {
102 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in GNENet constructor");
104 initJunctionsAndEdges();
106 if (myZBoundary.ymin() != Z_INITIALIZED) {
107 myZBoundary.add(0, 0);
119 WRITE_DEBUG(
"Deleting net builder in GNENet destructor");
148 const std::map<std::string, int>&
231 const std::string& suggestedName,
bool wasSplit,
bool allowDuplicateGeom,
bool recomputeConnections) {
238 if (outgoingEdge->getToNode() == dest->
getNBNode() && outgoingEdge->getGeometry().size() == 2) {
239 if (!allowDuplicateGeom) {
251 if ((oppositeEdge->
getID().size() > 1) && (oppositeEdge->
getID().front() ==
'-')) {
252 edgeID = oppositeEdge->
getID().substr(1);
254 edgeID =
"-" + oppositeEdge->
getID();
263 edgeID = edgeID +
toString(counter);
266 edgeID = suggestedName;
267 }
else if (edgeInfix.size() > 0) {
272 edgeID = src->
getID() + edgeInfix + dest->
getID();
293 edge =
new GNEEdge(
this, nbe, wasSplit);
297 double defaultSpeed = oc.
getFloat(
"default.speed");
298 const std::string defaultType = oc.
getString(
"default.type");
299 const int defaultNrLanes = oc.
getInt(
"default.lanenumber");
300 const int defaultPriority = oc.
getInt(
"default.priority");
306 defaultType, defaultSpeed,
307 defaultNrLanes, defaultPriority,
308 defaultWidth, defaultOffset, spread);
310 edge =
new GNEEdge(
this, nbe, wasSplit);
316 if (recomputeConnections) {
339 std::vector<GNECrossing*> crossingsToRemove;
341 for (
const auto& junctionNeighbour : junctionNeighbours) {
343 for (
const auto& crossing : junctionNeighbour->getGNECrossings()) {
345 if (crossing->checkEdgeBelong(junctionNeighbour->getChildEdges())) {
346 crossingsToRemove.push_back(crossing);
351 for (
const auto& crossing : crossingsToRemove) {
356 for (
const auto& edge : incidentEdges) {
371 for (
const auto& lane : edge->
getLanes()) {
375 while (lane->getChildAdditionals().size() > 0) {
379 while (lane->getChildShapes().size() > 0) {
380 deleteShape(lane->getChildShapes().front(), undoList);
383 while (lane->getChildDemandElements().size() > 0) {
387 while (lane->getChildGenericDatas().size() > 0) {
411 if (recomputeConnections) {
440 for (
const auto& lane : which->
getLanes()) {
442 std::vector<GNEAdditional*> copyOfLaneAdditionals = lane->getChildAdditionals();
443 for (
const auto& additional : copyOfLaneAdditionals) {
447 std::vector<GNEShape*> copyOfLaneShapes = lane->getChildShapes();
448 for (
const auto& shape : copyOfLaneShapes) {
452 std::vector<GNEDemandElement*> copyOfLaneDemandElements = lane->getChildDemandElements();
453 for (
const auto& demandElement : copyOfLaneDemandElements) {
457 std::vector<GNEGenericData*> copyOfLaneGenericDatas = lane->getChildGenericDatas();
458 for (
const auto& demandElement : copyOfLaneGenericDatas) {
506 deleteEdge(edge, undoList, recomputeConnections);
528 if (recomputeConnections) {
537 undoList->
add(
new GNEChange_Lane(edge, lane, laneAttrs,
false, recomputeConnections),
true);
633 throw ProcessError(
"Trying to delete a default Vehicle Type");
661 for (
const auto& dataInterval : copyOfDataIntervalChildren) {
674 for (
const auto& genericData : copyOfGenericDataChildren) {
716 if (recomputeConnections) {
721 undoList->
add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true, recomputeConnections),
true);
729 bool addRestriction =
true;
732 for (
const auto& edgeLane : edge->
getLanes()) {
735 addRestriction =
false;
744 if (addRestriction) {
765 for (
const auto& lane : edge->
getLanes()) {
766 if (lane->isRestricted(vclass)) {
771 const int numLanes = (int)edge->
getLanes().size();
772 if (index > numLanes) {
782 }
else if (vclass ==
SVC_BUS) {
801 const int numLanes = (int)edge->
getLanes().size();
802 if (index > numLanes) {
818 for (
const auto& lane : edge->
getLanes()) {
819 if (lane->isRestricted(vclass)) {
834 if (newJunction ==
nullptr) {
844 std::pair<PositionVector, PositionVector> newGeoms = oldEdgeGeometry.
splitAt(edgeSplitPosition);
845 const double oldLength = oldEdgeGeometry.
length();
846 const double relativeLength1 = oldLength != 0 ? newGeoms.first.length() / oldLength : 1;
847 const double relativeLength2 = oldLength != 0 ? newGeoms.second.length() / oldLength : 1;
855 const std::string::size_type sep_index = baseName.rfind(
'.');
857 if (sep_index != std::string::npos) {
858 std::string posString = baseName.substr(sep_index + 1);
859 if (GNEAttributeCarrier::canParse<int>(posString.c_str())) {
861 posBase = GNEAttributeCarrier::parse<int>(posString.c_str());
862 baseName = baseName.substr(0, sep_index);
869 undoList, baseName +
toString(posBase + (
int)edgeSplitPosition),
true,
false,
false);
873 std::vector<NBNode::Crossing> affectedCrossings;
875 if (crossing->checkEdgeBelong(edge)) {
881 newEdges.push_back(secondPart->
getNBEdge());
883 newEdges.push_back(nbEdge);
886 nbC.
edges = newEdges;
887 affectedCrossings.push_back(nbC);
893 newGeoms.first.pop_back();
894 newGeoms.first.erase(newGeoms.first.begin());
899 newGeoms.second.pop_back();
900 newGeoms.second.erase(newGeoms.second.begin());
910 for (
int i = 0; i < (int)edge->
getLanes().size(); ++i) {
914 for (
const auto& nbC : affectedCrossings) {
919 for (
const auto& additional : childAdditionals) {
920 additional->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
923 for (
int i = 0; i < (int)edge->
getLanes().size(); i++) {
924 for (
const auto& additional : edge->
getLanes().at(i)->getChildAdditionals()) {
925 additional->splitEdgeGeometry(laneSplitPosition, edge->
getLanes().at(i), secondPart->
getLanes().at(i), undoList);
930 for (
const auto& demandElement : childDemandElements) {
931 demandElement->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
934 for (
int i = 0; i < (int)edge->
getLanes().size(); i++) {
935 for (
const auto& demandElement : edge->
getLanes().at(i)->getChildDemandElements()) {
936 demandElement->splitEdgeGeometry(laneSplitPosition, edge->
getLanes().at(i), secondPart->
getLanes().at(i), undoList);
951 newJunction =
splitEdge(edge, pos, undoList, newJunction);
953 splitEdge(oppositeEdge, pos, undoList, newJunction);
960 if (nbEdge->guessOpposite(
true)) {
974 assert(reversed != 0);
989 assert(reversed != 0);
1003 reversed =
createEdge(src, dest, edge, undoList,
"-" + edge->
getID(),
false,
true);
1004 assert(reversed != 0);
1024 for (
const auto& incomingNBEdge : incomingNBEdges) {
1035 for (
const auto& outgoingNBEdge : outgoingNBEdges) {
1053 for (
NBEdge* edge : roundabout) {
1054 if (edge->getFromNode() == junction->
getNBNode()) {
1056 for (
const auto& roundaboutEdge : roundabout) {
1077 std::vector<GNEEdge*> edges;
1083 const double lefthandSign = lefthand ? -1 : 1;
1084 std::vector<GNEJunction*> newJunctions;
1085 GNEEdge* prevOpposite =
nullptr;
1089 if (edge == prevOpposite) {
1090 newJunction = newJunctions.back();
1095 const double splitOffset = (edge->getToJunction() == junction
1096 ?
MAX2(POSITION_EPS, geomLength - radius)
1097 :
MIN2(geomLength - POSITION_EPS, radius));
1098 Position pos = edge->getNBEdge()->getGeometry().positionAtOffset2D(splitOffset);
1099 newJunction =
splitEdge(edge, pos, undoList, newJunction);
1100 if (newJunctions.empty() || newJunction != newJunctions.back()) {
1101 newJunctions.push_back(newJunction);
1108 for (
int i = 0; i < (int)newJunctions.size(); i++) {
1109 GNEJunction* from = newJunctions[(i + 1) % newJunctions.size()];
1117 int numSegments =
MAX2(2, (
int)ceil(angleDiff * radius / resolution));
1119 for (
int j = 1; j < numSegments; j++) {
1120 const double angle = angle1 + lefthandSign * j * angleDiff / numSegments;
1121 innerGeom.push_back(center +
Position(cos(angle) * radius, sin(angle) * radius));
1135 if (i.second->getPositionInView() == pos) {
1164 for (
int i = 0; i < (int)edgeType.second->getLaneTypes().size(); i++) {
1166 edgeType.second->getLaneTypes().at(i)->speed,
1167 edgeType.second->getLaneTypes().at(i)->permissions,
1168 edgeType.second->getLaneTypes().at(i)->width,
1169 edgeType.second->getLaneTypes().at(i)->attrs);
1202 for (
const auto& lane : edge.second->getLanes()) {
1203 lane->updateGeometry();
1237 if (volatileOptions) {
1238 window->
setStatusBarText(
"Forced computing junctions with volatile options ...");
1246 if (volatileOptions) {
1253 if (volatileOptions) {
1262 if (additionalPath !=
"") {
1266 if (!generalHandler.
parse()) {
1273 if (demandPath !=
"") {
1277 if (!handler.
parse()) {
1284 window->getApp()->endWaitCursor();
1301 for (
const auto& demandElement : demandElements.second) {
1302 demandElement->computePathElement();
1314 for (
const auto& genericData : genericDataTag.second) {
1315 genericData->computePathElement();
1330 for (
auto it : tlsDefs) {
1331 it->setParticipantsInformation();
1332 it->setTLControllingInformation();
1367 if (selectedJunctions.size() < 2) {
1372 std::set<NBNode*, ComparatorIdLess> cluster;
1373 for (
auto it : selectedJunctions) {
1374 cluster.insert(it->getNBNode());
1375 const EdgeVector& incoming = it->getNBNode()->getIncomingEdges();
1376 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
1377 const EdgeVector& outgoing = it->getNBNode()->getOutgoingEdges();
1378 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1384 std::string
id =
"cluster";
1393 if ((i.second->getPositionInView() == pos) && (cluster.find(i.second->getNBNode()) == cluster.end())) {
1395 WRITE_DEBUG(
"Opening FXMessageBox 'Join non-selected junction'");
1397 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1404 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'No'");
1405 }
else if (answer == 4) {
1406 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'ESC'");
1411 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'Yes'");
1421 pos.
setx(pos.
x() + 0.1);
1422 pos.
sety(pos.
y() + 0.1);
1438 std::vector<NBNode::Crossing> oldCrossings;
1439 for (
auto i : selectedJunctions) {
1440 while (i->getGNECrossings().size() > 0) {
1441 GNECrossing* crossing = i->getGNECrossings().front();
1448 for (
auto it : selectedJunctions) {
1449 it->setLogicValid(
false, undoList);
1452 for (
auto it : allIncoming) {
1457 for (
auto it : allOutgoing) {
1461 edgesWithin.insert(it);
1469 for (
auto nbc : oldCrossings) {
1471 for (
NBEdge* e : nbc.edges) {
1472 if (edgesWithin.count(e) != 0) {
1480 nbc.customTLIndex, nbc.customTLIndex2, nbc.customShape,
1481 false,
true),
true);
1486 for (
auto it : selectedJunctions) {
1493 if (pos != oldPos) {
1504 std::vector<GNECrossing*> myNetCrossings;
1506 myNetCrossings.reserve(myNetCrossings.size() + it.second->getGNECrossings().size());
1507 myNetCrossings.insert(myNetCrossings.end(), it.second->getGNECrossings().begin(), it.second->getGNECrossings().end());
1510 std::vector<GNECrossing*> myInvalidCrossings;
1511 for (
auto i = myNetCrossings.begin(); i != myNetCrossings.end(); i++) {
1512 if ((*i)->getNBCrossing()->valid ==
false) {
1513 myInvalidCrossings.push_back(*i);
1517 if (myInvalidCrossings.empty()) {
1519 WRITE_DEBUG(
"Opening FXMessageBox 'No crossing to remove'");
1521 FXMessageBox::warning(
getApp(), MBOX_OK,
1525 WRITE_DEBUG(
"Closed FXMessageBox 'No crossing to remove' with 'OK'");
1527 std::string plural = myInvalidCrossings.size() == 1 ? (
"") : (
"s");
1529 WRITE_DEBUG(
"Opening FXMessageBox 'clear crossings'");
1531 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1537 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'No'");
1538 }
else if (answer == 4) {
1539 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'ESC'");
1543 for (
auto i = myInvalidCrossings.begin(); i != myInvalidCrossings.end(); i++) {
1556 std::vector<GNEJunction*> toRemove;
1560 toRemove.push_back(junction);
1563 for (
auto it : toRemove) {
1573 std::vector<GNEDemandElement*> routesWithoutChildren;
1577 if (route->getChildDemandElements().empty()) {
1578 routesWithoutChildren.push_back(route);
1582 if (routesWithoutChildren.size() > 0) {
1586 for (
const auto& i : routesWithoutChildren) {
1599 std::set<std::pair<std::string, GNEDemandElement*> > mySortedRoutes;
1603 bool hasStops =
false;
1604 for (
const auto& stop : route->getChildDemandElements()) {
1605 if (stop->getTagProperty().isStop()) {
1614 std::vector<std::vector<GNEDemandElement*> > routesToMerge;
1615 auto index = mySortedRoutes.begin();
1617 for (
auto i = mySortedRoutes.begin(); i != mySortedRoutes.end(); i++) {
1618 if (routesToMerge.empty()) {
1619 routesToMerge.push_back({i->second});
1621 if (index->first == i->first) {
1622 routesToMerge.back().push_back(i->second);
1624 routesToMerge.push_back({i->second});
1630 bool thereIsRoutesToMerge =
false;
1631 for (
const auto& i : routesToMerge) {
1633 thereIsRoutesToMerge =
true;
1637 if (thereIsRoutesToMerge) {
1641 for (
const auto& i : routesToMerge) {
1644 for (
int j = 1; j < (int)i.size(); j++) {
1646 while (i.at(j)->getChildDemandElements().size() > 0) {
1647 i.at(j)->getChildDemandElements().front()->setAttribute(
SUMO_ATTR_ROUTE, i.at(0)->getID(), undoList);
1663 std::map<GNEDemandElement*, std::string> personPlanMap;
1665 for (
const auto& persontag : {
1669 if (person->getChildDemandElements().size() > 0) {
1673 while (personPlan) {
1691 if (personPlanMap.size() > 0) {
1695 for (
const auto& personPlan : personPlanMap) {
1708 std::vector<GNEDemandElement*> invalidDemandElements;
1715 invalidDemandElements.push_back(route);
1721 invalidDemandElements.push_back(flow);
1727 invalidDemandElements.push_back(trip);
1731 if (invalidDemandElements.size() > 0) {
1735 for (
const auto& invalidDemandElement : invalidDemandElements) {
1754 for (
auto j : toJoin) {
1760 for (
auto con : connections) {
1801 if (endpoints.size() < 2) {
1807 std::map<GNEEdge*, std::vector<NBEdge::Connection>> straightConnections;
1809 for (
const auto& c : e->getNBEdge()->getConnections()) {
1811 straightConnections[e].push_back(c);
1818 for (
const auto& pair : endpoints) {
1820 const std::string& origID = pair.second;
1822 std::string newID = origID !=
"" ? origID : newJunction->
getID();
1829 if (e->getNBEdge()->getGeometry().back().almostSame(pos) || e->getNBEdge()->getParameter(
"origTo") == newID) {
1836 if (e->getNBEdge()->getGeometry().front().almostSame(pos) || e->getNBEdge()->getParameter(
"origFrom") == newID) {
1841 if (newID != newJunction->
getID()) {
1845 WRITE_WARNING(
"Could not rename split node to '" + newID +
"'");
1851 for (
const auto& item : straightConnections) {
1853 std::map<NBEdge*, GNEEdge*> newEdges;
1854 for (
auto& c : item.second) {
1860 if (newEdges.count(c.toEdge) == 0) {
1862 newEdges[c.toEdge] = newEdge;
1865 newEdge = newEdges[c.toEdge];
1887 for (
auto i : connections) {
1910 while (additionalMap.second.size() > 0) {
1916 while (shapeMap.second.size() > 0) {
1922 while (TAZMap.second.size() > 0) {
1935 while (demandElementsMap.second.size() > 0) {
2009 std::vector<GNEAdditional*> invalidSingleLaneAdditionals;
2010 std::vector<GNEAdditional*> invalidMultiLaneAdditionals;
2013 for (
const auto& addditional : additionalPair.second) {
2015 if (addditional->getTagProperty().hasAttribute(
SUMO_ATTR_LANE) && !addditional->isAdditionalValid()) {
2016 invalidSingleLaneAdditionals.push_back(addditional);
2017 }
else if (addditional->getTagProperty().hasAttribute(
SUMO_ATTR_LANES) && !addditional->isAdditionalValid()) {
2018 invalidMultiLaneAdditionals.push_back(addditional);
2023 if (invalidSingleLaneAdditionals.size() > 0 || invalidMultiLaneAdditionals.size() > 0) {
2027 if (fixAdditionalElementsDialog.execute() == 0) {
2075 std::vector<GNEDemandElement*> invalidSingleLaneDemandElements;
2078 for (
const auto& demandElement : demandElementSet.second) {
2080 demandElement->computePathElement();
2083 invalidSingleLaneDemandElements.push_back(demandElement);
2088 if (invalidSingleLaneDemandElements.size() > 0) {
2092 if (fixDemandElementsDialog.execute() == 0) {
2100 WRITE_DEBUG(
"demand elements saved after dialog");
2156 double minimumBegin = 0;
2167 return minimumBegin;
2173 double maximumEnd = 0;
2180 if (interval->getAttributeDouble(
SUMO_ATTR_END) > maximumEnd) {
2193 std::vector<std::map<std::string, GNEAdditional*> > sortedAdditionals;
2195 std::map<std::string, GNEDemandElement*> sortedRoutes;
2197 if (route->getChildAdditionals().size() > 0) {
2198 sortedRoutes[route->getID()] = route;
2201 for (
const auto& route : sortedRoutes) {
2202 route.second->writeDemandElement(device);
2205 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2207 sortedAdditionals.back()[routeProbe->getID()] = routeProbe;
2210 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2212 sortedAdditionals.back()[calibrator->getID()] = calibrator;
2216 sortedAdditionals.back()[laneCalibrator->getID()] = laneCalibrator;
2219 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2221 sortedAdditionals.back()[busStop->getID()] = busStop;
2224 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2226 sortedAdditionals.back()[trainStop->getID()] = trainStop;
2229 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2231 sortedAdditionals.back()[containerStop->getID()] = containerStop;
2234 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2236 sortedAdditionals.back()[chargingStation->getID()] = chargingStation;
2239 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2241 sortedAdditionals.back()[parkingArea->getID()] = parkingArea;
2244 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2246 sortedAdditionals.back()[
E1->getID()] =
E1;
2249 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2251 sortedAdditionals.back()[E1Instant->getID()] = E1Instant;
2254 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2256 sortedAdditionals.back()[
E2->getID()] =
E2;
2259 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2261 sortedAdditionals.back()[E2Multilane->getID()] = E2Multilane;
2264 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2266 sortedAdditionals.back()[
E3->getID()] =
E3;
2269 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2271 sortedAdditionals.back()[rerouter->getID()] = rerouter;
2274 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2276 sortedAdditionals.back()[VSS->getID()] = VSS;
2279 sortedAdditionals.push_back(std::map<std::string, GNEAdditional*>());
2281 sortedAdditionals.back()[vaporizer->getID()] = vaporizer;
2284 for (
const auto& additionalTag : sortedAdditionals) {
2285 for (
const auto& additional : additionalTag) {
2286 additional.second->writeAdditional(device);
2290 std::map<std::string, GNETAZElement*> sortedTAZs;
2292 sortedTAZs[
TAZ->getID()] =
TAZ;
2294 for (
const auto& TAZElement : sortedTAZs) {
2295 TAZElement.second->writeTAZElement(device);
2298 std::map<std::string, GNEShape*> sortedShapes;
2300 sortedShapes[poly->getID()] = poly;
2302 for (
const auto& shape : sortedShapes) {
2303 shape.second->writeShape(device);
2305 sortedShapes.clear();
2308 sortedShapes[
POI->getID()] =
POI;
2311 sortedShapes[POILane->getID()] = POILane;
2316 for (
const auto& shape : sortedShapes) {
2317 shape.second->writeShape(device);
2326 device.
writeXMLHeader(
"routes",
"routes_file.xsd", std::map<SumoXMLAttr, std::string>(),
false);
2328 std::map<std::string, GNEDemandElement*> sortedDemandElements;
2331 sortedDemandElements[vTypeDistribution->getID()] = vTypeDistribution;
2333 for (
const auto& demandElement : sortedDemandElements) {
2334 demandElement.second->writeDemandElement(device);
2336 sortedDemandElements.clear();
2339 if (vType->getParentDemandElements().empty()) {
2340 sortedDemandElements[vType->getID()] = vType;
2343 for (
const auto& demandElement : sortedDemandElements) {
2344 demandElement.second->writeDemandElement(device);
2346 sortedDemandElements.clear();
2349 if (route->getChildAdditionals().empty()) {
2350 sortedDemandElements[route->getID()] = route;
2353 for (
const auto& demandElement : sortedDemandElements) {
2354 demandElement.second->writeDemandElement(device);
2357 std::map<double, std::map<std::string, GNEDemandElement*> > vehiclesSortedByDepart;
2359 for (
const auto& demandElement : demandElementTag.second) {
2360 if (demandElement->getTagProperty().isVehicle() || demandElement->getTagProperty().isPerson() || demandElement->getTagProperty().isContainer()) {
2362 vehiclesSortedByDepart[GNEAttributeCarrier::parse<double>(demandElement->getBegin())][demandElement->getID()] = demandElement;
2367 for (
const auto& vehicleTag : vehiclesSortedByDepart) {
2368 for (
const auto& vehicle : vehicleTag.second) {
2369 vehicle.second->writeDemandElement(device);
2379 device.
writeXMLHeader(
"data",
"datamode_file.xsd", std::map<SumoXMLAttr, std::string>(),
false);
2382 dataSet->writeDataSet(device);
2403 device.
openTag(
"additionals");
2427 for (
int i = 0; i < (int)edgeType.second->getLaneTypes().size(); i++) {
2429 edgeType.second->getLaneTypes().at(i)->speed,
2430 edgeType.second->getLaneTypes().at(i)->permissions,
2431 edgeType.second->getLaneTypes().at(i)->width,
2432 edgeType.second->getLaneTypes().at(i)->attrs);
2471 dataInterval->updateGenericDataIDs();
2472 dataInterval->updateAttributeColors();
2515 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
2524 for (
const auto& lane : edge.second->getLanes()) {
2525 lane->updateGeometry();
2537 edge.second->remakeGNEConnections();
2539 for (
const auto& connection : edge.second->getGNEConnections()) {
2540 connection->updateGeometry();
2549 std::set<std::string> liveExplicitTurnarounds;
2552 liveExplicitTurnarounds.insert(explicitTurnarounds);
2568 if (oc.
getBool(
"numerical-ids") || oc.
isSet(
"reserved-ids")) {
2572 if (!oc.
getBool(
"offset.disable-normalization")) {
2575 edge.second->updateGeometry();
2586 if (volatileOptions) {
2607 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in computeAndUpdate(...) due recomputing with volatile options");
2614 WRITE_GLDEBUG(
"Add junctions during recomputing after calling myNetBuilder->compute(...)");
2617 junction.second->updateCenteringBoundary(
false);
2622 WRITE_GLDEBUG(
"Add edges during recomputing after calling myNetBuilder->compute(...)");
2625 edge.second->updateCenteringBoundary(
false);
2631 connection.second->remakeGNEConnections();
2636 junction.second->setLogicValid(
true,
nullptr);
2638 junction.second->updateGeometryAfterNetbuild();
2643 edge.second->updateGeometry();
2654 std::vector<std::string> values = GNEAttributeCarrier::parse<std::vector<std::string> >(ac->
getAttribute(key));
2655 std::vector<std::string> newValues;
2656 for (
auto v : values) {
2657 newValues.push_back(v == which ? by : v);
@ GLO_NETWORK
The network - empty.
#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
@ SUMO_TAG_REROUTER
A rerouter.
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_E2DETECTOR
an e2 detector
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_LANECALIBRATOR
A calibrator placed over lane (used in netedit)
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ 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_PARKING_AREA
A parking area.
@ GNE_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ 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_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
@ GNE_TAG_POILANE
Point of interest over Lane.
@ SUMO_TAG_E1DETECTOR
an e1 detector
@ SUMO_TAG_TYPE
type (edge)
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_E3DETECTOR
an e3 detector
@ SUMO_TAG_VSS
A variable speed sign.
@ 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
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
@ 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_OPPOSITE
neighboring lane, simplified lane attr instead of child element
@ 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)
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
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 tagProperty associated with this Attribute Carrier
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.
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
A road/street connecting two junctions (netedit-version)
GNEEdge * getOppositeEdge() const
get opposite edge
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
NBEdge * getNBEdge() const
returns the internal NBEdge
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
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
void addChildElement(T *element)
add child element
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 replaceIncomingConnections(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replace one edge by another in all tls connections
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.
Position getPositionInView() const
Returns position of hierarchical element in view.
void removeConnectionsFrom(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections from the given edge
bool isValid(SumoXMLAttr key, const std::string &value)
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
void removeEdgeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
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)
void removeConnectionsTo(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections to the given edge
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
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< SumoXMLTag, std::set< GNEGenericData * > > & getGenericDatas() const
get all generic datas
GNEEdgeType * registerEdgeType(GNEEdgeType *edgeType)
registers a edge in GNENet containers
const std::map< SumoXMLTag, std::set< GNEDemandElement * > > & getDemandElements() const
get demand elements
void clearDemandElements()
clear demand elements
GNEEdge * registerEdge(GNEEdge *edge)
registers an edge with GNENet containers
void remapJunctionAndEdgeIds()
remap junction and edge IDs
void clearAdditionals()
clear additionals
GNEJunction * registerJunction(GNEJunction *junction)
registers a junction in GNENet containers
const std::set< GNEDataSet * > & getDataSets() const
get demand elements
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
const std::map< std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
void addDefaultVTypes()
add default VTypes
const std::map< SumoXMLTag, std::set< GNETAZElement * > > & getTAZElements() const
get TAZElements
const std::set< GNEDataInterval * > & getDataIntervals() const
get all data intervals of network
std::vector< GNEJunction * > getSelectedJunctions() const
return selected junctions
const std::map< SumoXMLTag, std::set< GNEShape * > > & getShapes() const
get shapes
const std::map< SumoXMLTag, std::set< GNEAdditional * > > & getAdditionals() const
get additionals
void clearTAZElements()
clear TAZElements
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
void clearEdges()
clear edges
const std::map< std::string, GNEJunction * > & getJunctions() const
get junctions
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
class for GNEChange_ReplaceEdgeInTLS
A NBNetBuilder extended by visualisation and editing capabilities.
void clearAdditionalElements(GNEUndoList *undoList)
clear additionals
void removeSolitaryJunctions(GNEUndoList *undoList)
removes junctions that have no edges
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
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
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
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
void deleteTAZElement(GNETAZElement *TAZElement, GNEUndoList *undoList)
remove TAZElement
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
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.
void requireSaveNet(bool value)
inform that net has to be saved
GNEJunction * splitEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList, GNEJunction *newJunction=0)
split edge at position by inserting a new junction
void setViewNet(GNEViewNet *viewNet)
Set the net to be notified of network changes.
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
void computeAndUpdate(OptionsCont &oc, bool volatileOptions)
recompute the network and update lane geometries
SUMORTree myGrid
the rtree which contains all GUIGlObjects (so named for historical reasons)
void clearDataElements(GNEUndoList *undoList)
clear data elements
void savePlain(OptionsCont &oc)
save plain xml representation of the network (and nothing else)
void deleteDataInterval(GNEDataInterval *dataInterval, GNEUndoList *undoList)
remove data interval
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
void clearDemandElements(GNEUndoList *undoList)
clear demand elements
void adjustPersonPlans(GNEUndoList *undoList)
adjust person plans
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.
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
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::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this 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...
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.
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
void requireSaveTLSPrograms()
inform that TLS Programs has to be saved
unsigned int myEdgeIDCounter
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
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge *edge, GNEUndoList *undoList)
remove restricted lane
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
const std::map< std::string, int > & getEdgesAndNumberOfLanes() const
et edges and number of lanes
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
bool checkJunctionPosition(const Position &pos)
return true if there are already a Junction in the given position, false in other case
bool addGreenVergeLane(GNEEdge *edge, int index, GNEUndoList *undoList)
add restricted lane to edge
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
bool isNetRecomputed() const
check if net require 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.
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
GNEPathManager * myPathManager
Path manager.
GNEPathManager * getPathManager()
get path manager
void createRoundabout(GNEJunction *junction, GNEUndoList *undoList)
transform the given junction into a roundabout
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)
unsigned int myJunctionIDCounter
std::map< std::string, int > myEdgesAndNumberOfLanes
map with the Edges and their number of lanes
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
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
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
void saveDemandElementsConfirmed(const std::string &filename)
save demand elements after confirming invalid objects
void enableUpdateGeometry()
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction's connections
Boundary myZBoundary
the z boundary (stored in the x-coordinate), values of 0 are ignored
double getDataSetIntervalMinimumBegin() const
get minimum interval
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
void updatePathCalculator()
update path calculator (called when SuperModes Demand or Data is selected)
bool isPathCalculatorUpdated() const
check if pathCalculator is updated
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void invalidateJunctionPath(const GNEJunction *junction)
invalidate junction path
void invalidateLanePath(const GNELane *lane)
invalidate lane path
void clearDemandPaths()
clear demand paths
An Element which don't belongs to GNENet but has influency in the simulation.
const GNEAttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn't exist)
bool isPlacedInRTree() const
return true if Tag correspond to an element that has has to be placed in RTREE
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEViewNetHelper::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.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
A window containing a gl-object's parameter.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
void destroyPopup()
destoys the popup
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.
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
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
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.
bool hasLoadedLength() const
Returns whether a length was set explicitly.
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, LaneSpreadFunction spreadType, 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.
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.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
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 length() const
Returns the length.
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 addAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Adds an additional object (detector/shape/trigger) for visualisation.
void removeAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Removes an additional object (detector/shape/trigger) from being visualised.
static std::string trim(const std::string s, const std::string &t=" \t\n")
remove leading and trailing whitespace
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
A structure which describes a connection between edges or lanes.
An (internal) definition of a single lane of an edge.