82 const
double GNENet::Z_INITIALIZED = 1;
92 myNetBuilder(netBuilder),
93 myEdgeIDSupplier("gneE", netBuilder->getEdgeCont().getAllNames()),
94 myJunctionIDSupplier("gneJ", netBuilder->getNodeCont().getAllNames()),
95 myNeedRecompute(true),
97 myAdditionalsSaved(true),
98 myTLSProgramsSaved(true),
99 myDemandElementsSaved(true),
100 myUpdateGeometryEnabled(true),
101 myAllowUndoShapes(true) {
105 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in GNENet constructor");
107 initJunctionsAndEdges();
109 if (myZBoundary.ymin() != Z_INITIALIZED) {
110 myZBoundary.add(0, 0);
114 for (
auto i : listOfTags) {
115 myAttributeCarriers.additionals.insert(std::make_pair(i, std::map<std::string, GNEAdditional*>()));
118 for (
auto i : listOfTags) {
119 myAttributeCarriers.additionals.insert(std::make_pair(i, std::map<std::string, GNEAdditional*>()));
124 for (
auto i : listOfTags) {
125 myAttributeCarriers.demandElements.insert(std::make_pair(i, std::map<std::string, GNEDemandElement*>()));
128 for (
auto i : listOfTags) {
129 myAttributeCarriers.demandElements.insert(std::make_pair(i, std::map<std::string, GNEDemandElement*>()));
145 it.second->
decRef(
"GNENet::~GNENet");
147 WRITE_DEBUG(
"Deleting unreferenced " + it.second->getTagStr() +
" '" + it.second->getID() +
"' in GNENet destructor");
152 it.second->decRef(
"GNENet::~GNENet");
154 WRITE_DEBUG(
"Deleting unreferenced " + it.second->getTagStr() +
" '" + it.second->getID() +
"' in GNENet destructor");
159 for (
auto j : it.second) {
163 WRITE_DEBUG(
"Deleting unreferenced " + j.second->getTagStr() +
" '" + j.second->getID() +
"' in GNENet destructor");
169 for (
auto j : it.second) {
173 WRITE_DEBUG(
"Deleting unreferenced " + j.second->getTagStr() +
" '" + j.second->getID() +
"' in GNENet destructor");
180 WRITE_DEBUG(
"Deleting net builder in GNENet destructor");
219 const std::string& imgFile,
bool relativePath,
const PositionVector& shape,
bool geo,
bool fill,
double lineWidth,
bool ) {
223 GNEPoly* poly =
new GNEPoly(
this,
id, type, shape, geo, fill, lineWidth, color, layer, angle, imgFile, relativePath,
false,
false);
231 poly->
incRef(
"addPolygon");
242 const std::string& lane,
double posOverLane,
double posLat,
double layer,
double angle,
243 const std::string& imgFile,
bool relativePath,
double width,
double height,
bool ) {
249 GNEPOI* poi =
new GNEPOI(
this,
id, type, color, pos, geo, layer, angle, imgFile, relativePath, width, height,
false);
262 throw ProcessError(
"Error adding GNEPOI into shapeContainer");
267 GNEPOI* poi =
new GNEPOI(
this,
id, type, color, layer, angle, imgFile, relativePath, retrievedLane, posOverLane, posLat, width, height,
false);
280 throw ProcessError(
"Error adding GNEPOI over lane into shapeContainer");
327 const std::string& suggestedName,
329 bool allowDuplicateGeom,
330 bool recomputeConnections) {
333 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
334 if ((*it)->getToNode() == dest->
getNBNode() && (*it)->getGeometry().size() == 2) {
335 if (!allowDuplicateGeom) {
342 if (suggestedName !=
"" && !
retrieveEdge(suggestedName,
false)) {
353 edge =
new GNEEdge(*nbe,
this, wasSplit);
357 double defaultSpeed = oc.
getFloat(
"default.speed");
358 std::string defaultType =
"";
359 int defaultNrLanes = oc.
getInt(
"default.lanenumber");
360 int defaultPriority = oc.
getInt(
"default.priority");
364 defaultType, defaultSpeed,
365 defaultNrLanes, defaultPriority,
368 edge =
new GNEEdge(*nbe,
this, wasSplit);
372 if (recomputeConnections) {
396 std::vector<GNECrossing*> crossingsToRemove;
398 for (
auto i : junctionNeighbours) {
400 for (
auto j : i->getGNECrossings()) {
403 crossingsToRemove.push_back(j);
409 for (
auto i : crossingsToRemove) {
415 for (
auto it : incident) {
437 while (i->getShapeChildren().size() > 0) {
438 deleteShape(i->getShapeChildren().front(), undoList);
447 while (i->getAdditionalChildren().size() > 0) {
457 while (i->getDemandElementChildren().size() > 0) {
465 if (recomputeConnections) {
499 std::vector<GNEAdditional*> copyOfLaneAdditionals = i->getAdditionalChildren();
500 for (
auto j : copyOfLaneAdditionals) {
510 std::vector<GNEDemandElement*> copyOfLaneDemandElements = i->getDemandElementChildren();
511 for (
auto j : copyOfLaneDemandElements) {
517 std::vector<GNEShape*> copyOfLaneShapes = i->getShapeChildren();
518 for (
auto j : copyOfLaneShapes) {
533 for (
auto con : connections) {
550 deleteEdge(edge, undoList, recomputeConnections);
566 if (recomputeConnections) {
575 undoList->add(
new GNEChange_Lane(edge, lane, laneAttrs,
false, recomputeConnections),
true);
600 undoList->
p_begin(
"delete crossing");
641 throw ProcessError(
"Trying to delete a default Vehicle Type");
660 if (recomputeConnections) {
665 undoList->add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true, recomputeConnections),
true);
673 bool addRestriction =
true;
679 addRestriction =
false;
688 if (addRestriction) {
705 if (i->isRestricted(vclass)) {
710 const int numLanes = (int)edge.
getLanes().size();
711 if (index > numLanes) {
741 if (i->isRestricted(vclass)) {
754 if (newJunction ==
nullptr) {
760 std::pair<PositionVector, PositionVector> newGeoms = oldGeom.
splitAt(linePos);
766 const std::string::size_type sep_index = baseName.rfind(
'.');
767 if (sep_index != std::string::npos) {
768 std::string posString = baseName.substr(sep_index + 1);
770 posBase = GNEAttributeCarrier::parse<int>(posString.c_str());
771 baseName = baseName.substr(0, sep_index);
779 undoList, baseName +
toString(posBase + (
int)linePos),
true,
false,
false);
783 std::vector<NBNode::Crossing> affectedCrossings;
785 if (crossing->checkEdgeBelong(edge)) {
791 newEdges.push_back(secondPart->
getNBEdge());
793 newEdges.push_back(nbEdge);
796 nbC.
edges = newEdges;
797 affectedCrossings.push_back(nbC);
803 newGeoms.first.pop_back();
804 newGeoms.first.erase(newGeoms.first.begin());
809 newGeoms.second.pop_back();
810 newGeoms.second.erase(newGeoms.second.begin());
813 for (
int i = 0; i < (int)edge->
getLanes().size(); ++i) {
817 for (
const auto& nbC : affectedCrossings) {
830 newJunction =
splitEdge(edge, pos, undoList, newJunction);
832 splitEdge(oppositeEdge, pos, undoList, newJunction);
842 assert(reversed != 0);
857 assert(reversed != 0);
871 reversed =
createEdge(src, dest, edge, undoList,
"-" + edge->
getID(),
false,
true);
872 assert(reversed != 0);
892 for (
NBEdge* edge : incoming) {
904 for (
NBEdge* edge : outgoing) {
924 if (i.second->getPositionInView() == pos) {
938 WRITE_DEBUG(
"Current saving Status: net unsaved, additionals " + additionalsSaved +
", demand elements " + demandElementsSaved);
983 defaultVehicleType->
incRef(
"GNENet::DEFAULT_VEHTYPE");
988 defaultBikeType->
incRef(
"GNENet::DEFAULT_BIKETYPE_ID");
993 defaultPersonType->
incRef(
"GNENet::DEFAULT_PEDTYPE_ID");
1004 }
else if (failHard) {
1025 }
else if (failHard) {
1036 assert((from !=
nullptr) && (to !=
nullptr));
1039 if ((i.second->getGNEJunctionSource() == from) && (i.second->getGNEJunctionDestiny() == to)) {
1056 }
else if (failHard) {
1069 }
else if (failHard) {
1083 for (
auto j : i.second->getGNEConnections()) {
1084 if (j->getID() == id) {
1098 std::vector<GNEConnection*>
1100 std::vector<GNEConnection*> result;
1104 for (
auto j : i.second->getGNEConnections()) {
1105 if (!onlySelected || j->isAttributeCarrierSelected()) {
1106 result.push_back(j);
1119 for (
auto j : i.second->getGNECrossings()) {
1120 if (j->getID() == id) {
1134 std::vector<GNECrossing*>
1136 std::vector<GNECrossing*> result;
1140 for (
auto j : i.second->getGNECrossings()) {
1141 if (!onlySelected || j->isAttributeCarrierSelected()) {
1142 result.push_back(j);
1150 std::vector<GNEEdge*>
1152 std::vector<GNEEdge*> result;
1155 if (!onlySelected || i.second->isAttributeCarrierSelected()) {
1156 result.push_back(i.second);
1163 std::vector<GNELane*>
1165 std::vector<GNELane*> result;
1168 for (
auto j : i.second->getLanes()) {
1169 if (!onlySelected || j->isAttributeCarrierSelected()) {
1170 result.push_back(j);
1182 if (edge !=
nullptr) {
1186 if (it->getID() == id) {
1191 if (lane ==
nullptr) {
1203 }
else if (failHard) {
1211 std::vector<GNEJunction*>
1213 std::vector<GNEJunction*> result;
1216 if (!onlySelected || i.second->isAttributeCarrierSelected()) {
1217 result.push_back(i.second);
1224 std::vector<GNEShape*>
1226 std::vector<GNEShape*> result;
1233 result.push_back(shape);
1243 result.push_back(poi);
1252 std::vector<GNEShape*>
1254 std::vector<GNEShape*> result;
1259 result.push_back(poly);
1262 for (
const auto& it :
getPOIs()) {
1265 result.push_back(poi);
1289 if (
object !=
nullptr) {
1294 if (ac ==
nullptr) {
1295 throw ProcessError(
"GUIGlObject does not match the declared type");
1299 }
else if (failHard) {
1300 throw ProcessError(
"Attempted to retrieve non-existant GUIGlObject");
1307 std::vector<GNEAttributeCarrier*>
1309 std::vector<GNEAttributeCarrier*> result;
1313 result.push_back(i.second);
1314 for (
auto j : i.second->getGNECrossings()) {
1315 result.push_back(j);
1319 result.push_back(i.second);
1320 for (
auto j : i.second->getLanes()) {
1321 result.push_back(j);
1323 for (
auto j : i.second->getGNEConnections()) {
1324 result.push_back(j);
1328 for (
auto j : i.second) {
1329 result.push_back(j.second);
1333 result.push_back(dynamic_cast<GNEPoly*>(i.second));
1336 result.push_back(dynamic_cast<GNEPOI*>(i.second));
1339 for (
auto j : i.second) {
1340 result.push_back(j.second);
1346 result.push_back(i.second);
1351 result.push_back(i.second);
1358 result.push_back(i.second);
1363 result.push_back(i.second);
1368 for (
auto j : i.second->getLanes()) {
1369 result.push_back(j);
1375 for (
auto j : i.second->getGNEConnections()) {
1376 result.push_back(j);
1382 for (
auto j : i.second->getGNECrossings()) {
1383 result.push_back(j);
1389 result.push_back(dynamic_cast<GNEPoly*>(i.second));
1395 result.push_back(dynamic_cast<GNEPOI*>(i.second));
1411 if (volatileOptions) {
1412 window->
setStatusBarText(
"Forced computing junctions with volatile options ...");
1420 if (volatileOptions) {
1427 if (volatileOptions) {
1438 if (additionalPath !=
"") {
1441 for (
auto i : listOfTags) {
1445 for (
auto i : listOfTags) {
1461 if (demandPath !=
"") {
1464 for (
auto i : listOfTags) {
1468 for (
auto i : listOfTags) {
1483 window->getApp()->endWaitCursor();
1493 for (
const auto& j : i.second) {
1494 j.second->compute();
1509 for (
auto it : tlsDefs) {
1510 it->setParticipantsInformation();
1511 it->setTLControllingInformation();
1528 if (n.second->getGNECrossings().size() > 0) {
1551 if (selectedJunctions.size() < 2) {
1556 std::set<NBNode*, ComparatorIdLess> cluster;
1557 for (
auto it : selectedJunctions) {
1558 cluster.insert(it->getNBNode());
1559 const EdgeVector& incoming = it->getNBNode()->getIncomingEdges();
1560 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
1561 const EdgeVector& outgoing = it->getNBNode()->getOutgoingEdges();
1562 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1568 std::string
id =
"cluster";
1577 if ((i.second->getPositionInView() == pos) && (cluster.find(i.second->getNBNode()) == cluster.end())) {
1579 WRITE_DEBUG(
"Opening FXMessageBox 'Join non-selected junction'");
1581 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1588 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'No'");
1589 }
else if (answer == 4) {
1590 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'ESC'");
1595 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'Yes'");
1605 pos.
setx(pos.
x() + 0.1);
1606 pos.
sety(pos.
y() + 0.1);
1622 std::vector<NBNode::Crossing> oldCrossings;
1623 for (
auto i : selectedJunctions) {
1624 while (i->getGNECrossings().size() > 0) {
1625 GNECrossing* crossing = i->getGNECrossings().front();
1632 for (
auto it : selectedJunctions) {
1633 it->setLogicValid(
false, undoList);
1636 for (
auto it : allIncoming) {
1641 for (
auto it : allOutgoing) {
1646 edgesWithin.insert(it);
1654 for (
auto nbc : oldCrossings) {
1656 for (
NBEdge* e : nbc.edges) {
1657 if (edgesWithin.count(e) != 0) {
1665 nbc.customTLIndex, nbc.customTLIndex2, nbc.customShape,
1666 false,
true),
true);
1671 for (
auto it : selectedJunctions) {
1678 if (pos != oldPos) {
1689 std::vector<GNECrossing*> myNetCrossings;
1691 myNetCrossings.reserve(myNetCrossings.size() + it.second->getGNECrossings().size());
1692 myNetCrossings.insert(myNetCrossings.end(), it.second->getGNECrossings().begin(), it.second->getGNECrossings().end());
1695 std::vector<GNECrossing*> myInvalidCrossings;
1696 for (
auto i = myNetCrossings.begin(); i != myNetCrossings.end(); i++) {
1697 if ((*i)->getNBCrossing()->valid ==
false) {
1698 myInvalidCrossings.push_back(*i);
1702 if (myInvalidCrossings.empty()) {
1704 WRITE_DEBUG(
"Opening FXMessageBox 'No crossing to remove'");
1706 FXMessageBox::warning(
getApp(), MBOX_OK,
1710 WRITE_DEBUG(
"Closed FXMessageBox 'No crossing to remove' with 'OK'");
1712 std::string plural = myInvalidCrossings.size() == 1 ? (
"") : (
"s");
1714 WRITE_DEBUG(
"Opening FXMessageBox 'clear crossings'");
1716 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1722 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'No'");
1723 }
else if (answer == 4) {
1724 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'ESC'");
1728 for (
auto i = myInvalidCrossings.begin(); i != myInvalidCrossings.end(); i++) {
1741 std::vector<GNEJunction*> toRemove;
1745 toRemove.push_back(junction);
1748 for (
auto it : toRemove) {
1758 std::vector<GNEDemandElement*> routesWithoutChildren;
1762 if (i.second->getDemandElementChildren().empty()) {
1763 routesWithoutChildren.push_back(i.second);
1767 if (routesWithoutChildren.size() > 0) {
1769 undoList->
p_begin(
"clean unused routes");
1771 for (
const auto& i : routesWithoutChildren) {
1786 std::set<std::pair<std::string, GNEDemandElement*> > mySortedRoutes;
1790 bool hasStops =
false;
1791 for (
const auto& j : i.second->getDemandElementChildren()) {
1792 if (j->getTagProperty().isStop()) {
1801 std::vector<std::vector<GNEDemandElement*> > routesToMerge;
1802 auto index = mySortedRoutes.begin();
1804 for (
auto i = mySortedRoutes.begin(); i != mySortedRoutes.end(); i++) {
1805 if (routesToMerge.empty()) {
1806 routesToMerge.push_back({i->second});
1808 if (index->first == i->first) {
1809 routesToMerge.back().push_back(i->second);
1811 routesToMerge.push_back({i->second});
1817 bool thereIsRoutesToMerge =
false;
1818 for (
const auto& i : routesToMerge) {
1820 thereIsRoutesToMerge =
true;
1824 if (thereIsRoutesToMerge) {
1826 undoList->
p_begin(
"merge routes");
1828 for (
const auto& i : routesToMerge) {
1831 for (
int j = 1; j < (int)i.size(); j++) {
1833 while (i.at(j)->getDemandElementChildren().size() > 0) {
1834 i.at(j)->getDemandElementChildren().front()->setAttribute(
SUMO_ATTR_ROUTE, i.at(0)->getID(), undoList);
1852 std::vector<GNEDemandElement*> invalidDemandElements;
1858 if (!i.second->isDemandElementValid()) {
1859 invalidDemandElements.push_back(i.second);
1864 if (!i.second->isDemandElementValid()) {
1865 invalidDemandElements.push_back(i.second);
1870 if (!i.second->isDemandElementValid()) {
1871 invalidDemandElements.push_back(i.second);
1875 if (invalidDemandElements.size() > 0) {
1877 undoList->
p_begin(
"remove invalid demand elements");
1879 for (
const auto& i : invalidDemandElements) {
1894 undoList->
p_begin(
"Replace junction by geometry");
1900 for (
auto j : toJoin) {
1906 for (
auto con : connections) {
1939 if (endpoints.size() < 2) {
1943 undoList->
p_begin(
"Split junction");
1945 std::map<GNEEdge*, std::vector<NBEdge::Connection>> straightConnections;
1947 for (
const auto& c : e->getNBEdge()->getConnections()) {
1949 straightConnections[e].push_back(c);
1956 for (
const auto& pair : endpoints) {
1958 const std::string& origID = pair.second;
1960 std::string newID = origID !=
"" ? origID : newJunction->
getID();
1967 if (e->getNBEdge()->getGeometry().back().almostSame(pos) || e->getNBEdge()->getParameter(
"origTo") == newID) {
1974 if (e->getNBEdge()->getGeometry().front().almostSame(pos) || e->getNBEdge()->getParameter(
"origFrom") == newID) {
1979 if (newID != newJunction->
getID()) {
1983 WRITE_WARNING(
"Could not rename split node to '" + newID +
"'");
1989 for (
const auto& item : straightConnections) {
1991 std::map<NBEdge*, GNEEdge*> newEdges;
1992 for (
auto& c : item.second) {
1998 if (newEdges.count(c.toEdge) == 0) {
2000 newEdges[c.toEdge] = newEdge;
2003 newEdge = newEdges[c.toEdge];
2022 undoList->
p_begin(
"clear junction connections");
2025 for (
auto i : connections) {
2034 undoList->
p_begin(
"reset junction connections");
2051 i->updateConnectionIDs();
2072 std::vector<GNEAttributeCarrier*>
2075 std::vector<GNEAttributeCarrier*> result;
2084 if (ignoreCurrentSupermode ||
2088 result.push_back(AC);
2110 std::string oldID = junction->
getID();
2136 }
else if (hardFail) {
2137 throw ProcessError(
"Attempted to retrieve non-existant additional");
2144 std::vector<GNEAdditional*>
2146 std::vector<GNEAdditional*> result;
2149 for (
auto j : i.second) {
2150 if (!onlySelected || j.second->isAttributeCarrierSelected()) {
2151 result.push_back(j.second);
2164 counter += (int)i.second.size();
2189 std::string netSaved = (
myNetSaved ?
"saved" :
"unsaved");
2191 WRITE_DEBUG(
"Current saving Status: net " + netSaved +
", additionals unsaved, demand elements " + demandElementsSaved);
2207 std::vector<GNEAdditional*> invalidSingleLaneAdditionals;
2208 std::vector<GNEAdditional*> invalidMultiLaneAdditionals;
2211 for (
auto j : i.second) {
2213 if (j.second->getTagProperty().hasAttribute(
SUMO_ATTR_LANE) && !j.second->isAdditionalValid()) {
2214 invalidSingleLaneAdditionals.push_back(j.second);
2215 }
else if (j.second->getTagProperty().hasAttribute(
SUMO_ATTR_LANES) && !j.second->isAdditionalValid()) {
2216 invalidMultiLaneAdditionals.push_back(j.second);
2221 if (invalidSingleLaneAdditionals.size() > 0 || invalidMultiLaneAdditionals.size() > 0) {
2225 if (fixAdditionalElementsDialog.execute() == 0) {
2269 }
else if (hardFail) {
2270 throw ProcessError(
"Attempted to retrieve non-existant demand element");
2277 std::vector<GNEDemandElement*>
2279 std::vector<GNEDemandElement*> result;
2282 for (
auto j : i.second) {
2283 if (!onlySelected || j.second->isAttributeCarrierSelected()) {
2284 result.push_back(j.second);
2297 counter += (int)i.second.size();
2330 throw ProcessError(demandElement->
getTagStr() +
" with old begin='" + oldBegin +
"' doesn't exist");
2345 std::string netSaved = (
myNetSaved ?
"saved" :
"unsaved");
2347 WRITE_DEBUG(
"Current saving Status: net " + netSaved +
", additionals " + additionalsSaved +
", demand elements unsaved");
2365 std::vector<GNEDemandElement*> invalidSingleLaneDemandElements;
2368 for (
auto j : i.second) {
2370 if (!j.second->isDemandElementValid()) {
2371 invalidSingleLaneDemandElements.push_back(j.second);
2376 if (invalidSingleLaneDemandElements.size() > 0) {
2380 if (fixDemandElementsDialog.execute() == 0) {
2388 WRITE_DEBUG(
"demand elements saved after dialog");
2443 for (
auto j : i.second) {
2444 j.second->writeAdditional(device);
2451 for (
auto j : i.second) {
2453 if (j.second->getAdditionalParents().empty()) {
2454 j.second->writeAdditional(device);
2462 for (
auto j : i.second) {
2464 if (j.second->getAdditionalParents().empty()) {
2465 j.second->writeAdditional(device);
2474 for (
auto j : i.second) {
2476 if (j.second->getAdditionalParents().empty()) {
2477 j.second->writeAdditional(device);
2484 dynamic_cast<GNEShape*
>(i.second)->writeShape(device);
2486 for (
const auto& i :
myPOIs) {
2487 dynamic_cast<GNEShape*
>(i.second)->writeShape(device);
2499 i.second->writeDemandElement(device);
2503 i.second->writeDemandElement(device);
2507 i.second->writeDemandElement(device);
2511 i.second->writeDemandElement(device);
2519 if (shape.size() > 0) {
2521 GNEPoly* shapePoly =
new GNEPoly(
this,
"edit_shape",
"edit_shape", shape,
false, fill, 0.3, col,
GLO_POLYGON, 0,
"",
false,
false,
false);
2541 throw ProcessError(
"Polygon for edit shapes has to be inicializated");
2551 std::string newID =
"poly_" +
toString(counter);
2555 newID =
"poly_" +
toString(counter);
2560 std::string newID =
"POI_" +
toString(counter);
2564 newID =
"POI_" +
toString(counter);
2609 device.
openTag(
"additionals");
2701 if (updateViewAfterDeleting) {
2717 if (demandElement) {
2786 if (updateViewAfterDeleting) {
2806 for (
auto name_it : nodeContainer.
getAllNames()) {
2817 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
2852 junction->
incRef(
"GNENet::registerJunction");
2876 edge->
incRef(
"GNENet::registerEdge");
2908 junction->
decRef(
"GNENet::deleteSingleJunction");
2911 if (updateViewAfterDeleting) {
2930 edge->
decRef(
"GNENet::deleteSingleEdge");
2936 if (updateViewAfterDeleting) {
2968 if (updateViewAfterDeleting) {
2997 if (updateViewAfterDeleting) {
3027 i.second->remakeGNEConnections();
3029 for (
const auto& j : i.second->getGNEConnections()) {
3030 j->updateGeometry();
3039 std::set<std::string> liveExplicitTurnarounds;
3042 liveExplicitTurnarounds.insert(it);
3058 if (oc.
getBool(
"numerical-ids") || oc.
isSet(
"reserved-ids")) {
3059 std::map<std::string, GNEEdge*> newEdgeMap;
3060 std::map<std::string, GNEJunction*> newJunctionMap;
3063 it.second->setMicrosimID(it.second->getNBEdge()->getID());
3064 newEdgeMap[it.second->getNBEdge()->getID()] = it.second;
3067 newJunctionMap[it.second->getNBNode()->getID()] = it.second;
3068 it.second->setMicrosimID(it.second->getNBNode()->getID());
3074 if (!oc.
getBool(
"offset.disable-normalization")) {
3077 it.second->updateGeometry();
3088 if (volatileOptions) {
3099 for (
auto it : copyOfEdges) {
3104 for (
auto it : copyOfJunctions) {
3109 for (
const auto& j : it.second) {
3111 if (j.second->getTagProperty().isDrawable()) {
3119 for (
auto i : listOfTags) {
3123 for (
auto i : listOfTags) {
3132 for (
const auto& it :
myPOIs) {
3138 for (
const auto& j : it.second) {
3140 if (j.second->getTagProperty().isDrawable()) {
3148 for (
auto i : listOfTags) {
3152 for (
auto i : listOfTags) {
3158 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in computeAndUpdate(...) due recomputing with volatile options");
3163 WRITE_GLDEBUG(
"Add junctions during recomputing after calling myNetBuilder->compute(...)");
3168 WRITE_GLDEBUG(
"Add egdges during recomputing after calling myNetBuilder->compute(...)");
3174 it.second->remakeGNEConnections();
3179 it.second->setLogicValid(
true,
nullptr);
3181 it.second->updateGeometryAfterNetbuild();
3186 it.second->updateGeometry();
3197 std::vector<std::string> values = GNEAttributeCarrier::parse<std::vector<std::string> >(ac->
getAttribute(key));
3198 std::vector<std::string> newValues;
3199 for (
auto v : values) {
3200 newValues.push_back(v == which ? by : v);
void setViewNet(GNEViewNet *viewNet)
Set the viewNet to be notified of network changes.
const AttributeCarriers & getAttributeCarriers() const
retrieve all attribute carriers of Net
GNEJunction * splitEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList, GNEJunction *newJunction=0)
split edge at position by inserting a new junction
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
void enableSaveTLSProgramsMenu()
enable save TLS Programs
bool addRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, int index, GNEUndoList *undoList)
add restricted lane to edge
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
std::vector< GNEConnection * > getGNEConnections() const
Returns all GNEConnections vinculated with this junction.
void initJunctionsAndEdges()
Init Junctions and edges.
void insertAdditional(GNEAdditional *additional)
Insert a additional element int GNENet container.
static const TagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
void close()
Closes the device and removes it from the dictionary.
GNEViewNet * myViewNet
The viewNet to be notofied of about changes.
SumoXMLTag
Numbers representing SUMO-XML - element names.
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
GNEInspectorFrame * getInspectorFrame() const
get frame for GNE_NMODE_INSPECT
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
the function-object for an editing operation (abstract base)
A structure which describes a connection between edges or lanes.
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
void enableSaveAdditionalsMenu()
enable save additionals
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
IDSupplier myEdgeIDSupplier
description of a vehicle type
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
bool isVehicle() const
return true if tag correspond to a vehicle element
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
virtual void selectAttributeCarrier(bool changeFlag=true)=0
void setStatusBarText(const std::string &statusBarText)
set text of the statusBar
int buildCrossings()
build pedestrian crossings
bool isDrawable() const
return true if tag correspond to a drawable element
void append(const PositionVector &v, double sameThreshold=2.0)
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
SUMORTree myGrid
the rtree which contains all GUIGlObjects (so named for historical reasons)
double z() const
Returns the z-position.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
begin/end of the description of a junction
begin/end of the description of a single lane
std::map< std::string, GNEEdge * > edges
map with the name and pointer to edges of net
FXApp * getApp()
get pointer to the main App
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
void enableSaveDemandElementsMenu()
enable save demand elements
void update() const
Mark the entire GNEViewNet to be repainted later.
void splitJunction(GNEJunction *junction, bool reconnect, GNEUndoList *undoList)
replace the selected junction by a list of junctions for each unique edge endpoint ...
The main window of the Netedit.
bool changeID(const std::string &oldId, const std::string &newId)
change ID of a stored object
a flow definitio nusing a from-to edges instead of a route (used by router)
void removeEdgeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
NBNetBuilder * getNetBuilder() const
get net builder
const AttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn't exist)
void setMicrosimID(const std::string &newID)
override to also set lane ids
const Polygons & getPolygons() const
Returns all polygons.
bool isDemandElement() const
return true if tag correspond to a demand element
A container for traffic light definitions and built programs.
int size() const
Returns the number of stored items within the container.
bool isValid(SumoXMLAttr key, const std::string &value)
void deleteDemandElement(GNEDemandElement *demandElement, GNEUndoList *undoList)
remove demand element
a flow definition nusing a route instead of a from-to edges route (used in NETEDIT) ...
void deleteSingleEdge(GNEEdge *edge, bool updateViewAfterDeleting)
deletes a single edge
std::map< SumoXMLTag, std::map< std::string, GNEAdditional * > > additionals
map with the name and pointer to additional elements of net
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool failHard=true)
get a single attribute carrier based on a GLID
connectio between two lanes
Stores the information about how to visualize structures.
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers(bool ignoreCurrentSupermode)
get all selected attribute carriers (or only relative to current supermode
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.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
GNEViewParent * getViewParent() const
get the net object
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
double y() const
Returns the y-position.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
GNEConnection * retrieveConnection(const std::string &id, bool failHard=true) const
get Connection by id
T get(const std::string &id) const
Retrieves an item.
friend class GNEChange_Lane
The representation of a single edge during network building.
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
virtual void updateGeometry()=0
update pre-computed geometry information
Polygons myPolygons
stored Polygons
friend class GNEChange_Additional
static void writeJoinedJunctions(const OptionsCont &oc, NBNodeCont &nc)
Writes the joined-juncionts to file.
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
std::vector< std::pair< Position, std::string > > getEndPoints() const
return list of unique endpoint coordinates of all edges at this node
void removeAdditionalGLObject(GUIGlObject *o)
Removes an additional object (detector/shape/trigger) from being visualised.
double x() const
Returns the x-position.
void avoid(const std::string &id)
make sure that the given id is never supplied
void saveDemandElementsConfirmed(const std::string &filename)
save demand elements after confirming invalid objects
void reverseEdge(GNEEdge *edge, GNEUndoList *undoList)
reverse edge
void update()
notify myViewNet
void insertJunction(GNEJunction *junction)
inserts a single junction into the net and into the underlying netbuild-container ...
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
void deleteShape(GNEShape *shape, GNEUndoList *undoList)
remove shape
#define WRITE_GLDEBUG(msg)
GNEPoly * retrievePolygon(const std::string &id, bool failHard=true) const
get Polygon by id
static std::vector< SumoXMLTag > allowedTagsByCategory(int tagPropertyCategory, bool onlyDrawables)
get tags of all editable element types using TagProperty Type (TAGTYPE_NETELEMENT, TAGTYPE_ADDITIONAL, etc.)
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
double getWidth() const
Returns the width of the boudary (x-axis)
void resetJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
reset junction's connections
A NBNetBuilder extended by visualisation and editing capabilities.
GNEEdge * createEdge(GNEJunction *src, GNEJunction *dest, GNEEdge *tpl, 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)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
std::vector< GNEConnection * > retrieveConnections(bool onlySelected=false) const
return all connections
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 addExplicitTurnaround(std::string id)
add edge id to the list of explicit turnarounds
void rename(NBEdge *edge, const std::string &newID)
Renames the edge. Throws exception if newID already exists.
PositionVector reverse() const
reverse position vector
Dialog for edit rerouters.
bool myAllowUndoShapes
flag used to indicate if shaped created can be undo
const std::string DEFAULT_BIKETYPE_ID
bool cleanInvalidCrossings(GNEUndoList *undoList)
clear invalid crossings
bool isDetector() const
return true if tag correspond to a shape (Only used to group all detectors in the XML) ...
friend class GNEChange_Shape
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
Storage for geometrical objects.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a Point of interest
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void insertEdge(GNEEdge *edge)
inserts a single edge into the net and into the underlying netbuild-container
const std::string & getID() const
Returns the id.
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
std::map< std::string, GNEDemandElement * > vehicleDepartures
special map used for saving Demand Elements of type "Vehicle" (Vehicles, routeFlows, etc.) sorted by depart time
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
Lane & getLaneStruct(int lane)
const Boundary & getBoundary() const
returns the bounder of the network
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node's edges clockwise regarding driving direction.
const std::string DEFAULT_VTYPE_ID
A RT-tree for efficient storing of SUMO's GL-objects.
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
virtual std::string getAttribute(SumoXMLAttr key) const =0
first coordinate of edge shape
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const std::vector< GNEAdditional * > & getAdditionalChildren() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
void cleanInvalidDemandElements(GNEUndoList *undoList)
clean invalid demand elements
GNEJunction * registerJunction(GNEJunction *junction)
registers a junction with GNENet containers
static const double UNSPECIFIED_WIDTH
unspecified lane width
A class that stores a 2D geometrical boundary.
bool myNeedRecompute
whether the net needs recomputation
void selectAttributeCarrier(bool changeFlag=true)
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc..)
begin/end of the description of a route
NBNetBuilder * myNetBuilder
The internal netbuilder.
#define WRITE_WARNING(msg)
bool netHasGNECrossings() const
check if net has GNECrossings
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
bool isDemandElementsSaved() const
check if demand elements are saved
void saveTLSPrograms(const std::string &filename)
save TLS Programs elements of the network
static OptionsCont & getOptions()
Retrieves the options.
void p_clear()
clears the undo list (implies abort)
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
bool priority
whether the pedestrians have priority
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
const std::vector< GNEShape * > & getShapeChildren() const
get shapes of VSS
bool add(const std::string &id, T item)
Adds an item.
void disableSaveAdditionalsMenu()
disable save additionals
bool restrictLane(SUMOVehicleClass vclass, GNELane *lane, GNEUndoList *undoList)
transform lane to restricted lane
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
void joinRoutes(GNEUndoList *undoList)
join routes
The link is a straight direction.
bool isList() const
return true if atribute is a list
bool myAdditionalsSaved
Flag to check if additionals has to be saved.
void renameJunction(GNEJunction *junction, const std::string &newID)
updates the map and reserves new id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
IDSupplier myJunctionIDSupplier
std::map< std::string, int > myEdgesAndNumberOfLanes
map with the Edges and their number of lanes
NBEdge * getNBEdge() const
returns the internal NBEdge
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
An (internal) definition of a single lane of an edge.
the function-object for an editing operation (abstract base)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
void registerJoinedCluster(const NodeSet &cluster)
gets all joined clusters (see doc for myClusters2Join)
std::string getAttribute(SumoXMLAttr key) const
static const double Z_INITIALIZED
marker for whether the z-boundary is initialized
std::string getAttribute(SumoXMLAttr key) const
bool isTLControlled() const
Returns whether this node is controlled by any tls.
GNEUndoList * getUndoList() const
get the undoList object
int getIndex() const
returns the index of the lane
friend class GNEChange_Connection
void removeShape(GNEShape *shape, bool updateViewAfterDeleting)
remove created shape (but NOT delete)
static void createRouteCalculatorInstance(GNENet *net)
create instance of RouteCalculator
void updateAdditionalID(const std::string &oldID, GNEAdditional *additional)
update additional ID in container
std::set< NBEdge * > EdgeSet
container for unique edges
void removeConnectionsFrom(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections from the given edge
std::string getNext()
Returns the next id.
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
remove restricted lane
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
std::vector< GNEDemandElement * > retrieveDemandElements(bool onlySelected=false) const
return all demand elements
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
GNEPoly * addPolygonForEditShapes(GNENetElement *netElement, const PositionVector &shape, bool fill, RGBColor col)
Builds a special polygon used for edit Junctions's shapes.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
GNEEdge & getParentEdge()
Returns underlying parent edge.
void saveAdditionalsConfirmed(const std::string &filename)
save additionals after confirming invalid objects
void enableUpdateGeometry()
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
bool hasDefaultGeometryEndpointAtNode(const NBNode *node) const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
std::string getLaneID(int lane) const
get lane ID
Dialog for edit rerouters.
void extract(NBDistrictCont &dc, NBEdge *edge, bool remember=false)
Removes the given edge from the container like erase but does not delete it.
int getNumLanes() const
Returns the number of lanes.
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.
A point in 2D or 3D with translation and scaling methods.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
bool isUpdateGeometryEnabled() const
check if update geometry after inserting or removing has to be updated
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
void setx(double x)
set position x
NBEdgeCont & getEdgeCont()
Supermode currentSupermode
the current supermode
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
bool joinSelectedJunctions(GNEUndoList *undoList)
join selected junctions
Boundary myZBoundary
the z boundary (stored in the x-coordinate), values of 0 are ignored
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
GNEFrameAttributesModuls::AttributesEditor * getAttributesEditor() const
get AttributesEditor
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
void replaceIncomingEdge(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replaces edge
void selectAttributeCarrier(bool changeFlag=true)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
bool isPerson() const
return true if tag correspond to a person element
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
int getNumberOfDemandElements(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of demand elements of the net.
virtual bool isAttributeCarrierSelected() const =0
check if attribute carrier is selected
bool additionalExist(GNEAdditional *additional) const
return true if additional exist (use pointer instead ID)
void requiereSaveDemandElements(bool value)
inform that demand elements has to be saved
bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, const std::string &lane, double posOverLane, double posLat, double layer, double angle, const std::string &imgFile, bool relativePath, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
void computeJunction(GNEJunction *junction)
trigger recomputation of junction shape and logic param[in] window The window to inform about delay ...
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
void requiereSaveAdditionals(bool value)
inform that additionals has to be saved
const std::string & getID() const
virtual void updateGeometry()=0
update pre-computed geometry information
virtual void unselectAttributeCarrier(bool changeFlag=true)=0
unselect attribute carrier using GUIGlobalSelection
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
Storage for edges, including some functionality operating on multiple edges.
void initGNEConnections()
initialize GNEConnections
bool isAdditionalsSaved() const
check if additionals are saved
void updateDemandElementID(const std::string &oldID, GNEDemandElement *demandElement)
update demand element ID in container
std::map< SumoXMLTag, std::map< std::string, GNEDemandElement * > > demandElements
map with the name and pointer to demand elements of net
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
void save(OptionsCont &oc)
save the network
node: the type of traffic light
edge: the shape in xml-definition
void cleanUnusedRoutes(GNEUndoList *undoList)
clean unused routes
void removeConnectionsTo(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections to the given edge
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
bool isPlacedInRTree() const
return true if Tag correspond to an element that has has to be placed in RTREE
void addOutgoingGNEEdge(GNEEdge *edge)
add outgoing GNEEdge
const std::string getID() const
function to support debugging
friend class GNEChange_Edge
void clearInspectedAC()
Clear all current inspected ACs.
void changeShapeID(GNEShape *s, const std::string &OldID)
change Shape ID
friend class GNEChange_DemandElement
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
std::vector< GNEShape * > retrieveShapes(SumoXMLTag shapeTag, bool onlySelected=false)
return shape by type shapes
bool isStoppingPlace() const
return true if tag correspond to a detector (Only used to group all stoppingPlaces in the output XML)...
GNEJunction * getGNEJunctionSource() const
returns the source-junction
void incRef(const std::string &debugMsg="")
Increarse reference.
std::string generateDemandElementID(const std::string &prefix, SumoXMLTag type) const
generate demand element id
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
void insertShape(GNEShape *shape, bool updateViewAfterDeleting)
insert shape
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
vehicle is a passenger car (a "normal" car)
SUMORTree & getVisualisationSpeedUp()
Returns the RTree used for visualisation speed-up.
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(SumoXMLTag type=SUMO_TAG_NOTHING)
get the attribute carriers based on Type
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
std::set< std::string > myExplicitTurnarounds
list of edge ids for which turn-arounds must be added explicitly
void decRef(const std::string &debugMsg="")
Decrease reference.
void rename(NBNode *node, const std::string &newID)
Renames the node. Throws exception if newID already exists.
begin/end of the description of an edge
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool checkJunctionPosition(const Position &pos)
return true if there are already a Junction in the given position, false in other case ...
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network stored in the given net builder.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
A road/street connecting two junctions (netedit-version)
void reserveJunctionID(const std::string &id)
reserve junction ID (To avoid duplicates)
void duplicateLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
duplicates lane
void reset()
Resets the boundary.
void updateDemandElementBegin(const std::string &oldBegin, GNEDemandElement *demandElement)
update demand element begin in container
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
GNECrossing * retrieveCrossing(const std::string &id, bool failHard=true) const
get Crossing by id
std::vector< std::string > getAllNames() const
get all node names
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
bool myDemandElementsSaved
Flag to check if demand elements has to be saved.
double width
This crossing's width.
const Boundary & getZBoundary() const
Returns the Z boundary (stored in the x() coordinate) values of 0 do not affect the boundary...
std::string generateAdditionalID(SumoXMLTag type) const
generate additional id
int customTLIndex
the custom traffic light index of this crossing (if controlled)
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
Flag to check if VType is a default VType.
void setShapeEditedElement(GNENetElement *element)
retrieve the netElement of which the shape is being edited
void updateGeometry()
update pre-computed geometry information
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
void removeEditedAC(GNEAttributeCarrier *AC)
remove edited ACs
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
const std::vector< Connection > & getConnections() const
Returns the connections.
NBConnection getNBConnection() const
get NBConnection
GNEEdge * registerEdge(GNEEdge *edge)
registers an edge with GNENet containers
PositionVector customShape
optional customShape for this crossing
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
double getHeight() const
Returns the height of the boundary (y-axis)
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
bool computeSingleLogic(OptionsCont &oc, NBTrafficLightDefinition *def)
Computes a specific traffic light logic (using by NETEDIT)
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
An Element which don't belongs to GNENet but has influency in the simulation.
std::vector< GNEAdditional * > retrieveAdditionals(bool onlySelected=false) const
return all additionals
Instance responsible for building networks.
const std::string DEFAULT_PEDTYPE_ID
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
friend class GNEChange_Junction
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 computeNetwork(GNEApplicationWindow *window, bool force=false, bool volatileOptions=false, std::string additionalPath="", std::string demandPath="")
trigger full netbuild computation param[in] window The window to inform about delay param[in] force W...
void removeSolitaryJunctions(GNEUndoList *undoList)
removes junctions that have no edges
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
const std::string & getTagStr() const
get tag assigned to this object in string format
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
bool myUpdateGeometryEnabled
Flag to enable or disable update geometry of elements after inserting or removing element in net...
void requiereSaveNet(bool value)
inform that net has to be saved
Demanding mode (Routes, Vehicles etc..)
struct used for saving all attribute carriers of net, in different formats
AttributeCarriers myAttributeCarriers
AttributeCarriers of net.
void sety(double y)
set position y
A storage for options typed value containers)
void disableSaveDemandElementsMenu()
disable save demand elements
void deleteSingleJunction(GNEJunction *junction, bool updateViewAfterDeleting)
deletes a single junction
void computeDemandElements(GNEApplicationWindow *window)
compute demand elements param[in] window The window to inform about delay
class for GNEChange_ReplaceEdgeInTLS
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction's connections
void computeAndUpdate(OptionsCont &oc, bool volatileOptions)
recompute the network and update lane geometries
int getNumberOfShapes() const
get number of shapes
crossing between edges for pedestrians
void renameEdge(GNEEdge *edge, const std::string &newID)
updates the map and reserves new id
static void replaceInListAttribute(GNEAttributeCarrier *ac, SumoXMLAttr key, const std::string &which, const std::string &by, GNEUndoList *undoList)
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void replaceIncomingConnections(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replace one edge by another in all tls connections
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool myTLSProgramsSaved
Flag to check if shapes has to be saved.
std::map< std::string, GNEJunction * > junctions
map with the name and pointer to junctions of net
std::vector< GNECrossing * > retrieveCrossings(bool onlySelected=false) const
return all crossings
const Position & getPosition() const
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
EdgeVector edges
The edges being crossed.
Represents a single node (junction) during network building.
void saveJoined(OptionsCont &oc)
save log of joined junctions (and nothing else)
A definition of a pedestrian crossing.
GNEEdge * addReversedEdge(GNEEdge *edge, GNEUndoList *undoList)
add reversed edge
void saveDemandElements(const std::string &filename)
save demand element elements of the network
Static storage of an output device and its base (abstract) implementation.
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
last coordinate of edge shape
virtual std::string getBegin() const
get begin time of demand element
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
description of a person type (used in NETEDIT)
void push_back_noDoublePos(const Position &p)
insert in back a non double position
virtual void updateGeometry()=0
update pre-computed geometry information
a single trip definition (used by router)
void unblockObject(GUIGlID id)
Marks an object as unblocked.
void reserveEdgeID(const std::string &id)
reserve edge ID (To avoid duplicates)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
static void deleteRouteCalculatorInstance()
delete instance of RouteCalculator
void disableUpdateGeometry()
disable update geometry of elements after inserting or removing an element in net ...
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
NBNode * getFromNode() const
Returns the origin node of the edge.
void analyzeCluster(NodeSet cluster, std::string &id, Position &pos, bool &hasTLS, TrafficLightType &type, SumoXMLNodeType &nodeType)
Container for nodes during the netbuilding process.
bool demandElementExist(GNEDemandElement *demandElement) const
return true if demand element exist (use pointer instead ID)
void removePolygonForEditShapes(GNEPoly *polygon)
remove Polygon for edit shapes
std::vector< GNEJunction * > getJunctionNeighbours() const
return GNEJunction neighbours
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
void mergeJunctions(GNEJunction *moved, GNEJunction *target, GNEUndoList *undoList)
merge the given junctions edges between the given junctions will be deleted
void requiereSaveTLSPrograms()
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool remove(const std::string &id, const bool del=true)
Removes an item.
begin/end of the description of a Point of interest over Lane (used by Netedit)
bool extract(NBNode *node, bool remember=false)
Removes the given node but does not delete it.
#define WRITE_MESSAGE(msg)
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
static std::string getEdgeIDFromLane(const std::string laneID)
return edge id when given the lane ID
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Network mode (Edges, junctions, etc..)
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
bool checkIsRemovable() const
check if node is removable
NBNode * getNBNode() const
Return net build node.
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
get edges to join
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
GUISelectedStorage gSelected
A global holder of selected objects.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=FEATURE_GUESSED)
A window containing a gl-object's parameter.
void insertDemandElement(GNEDemandElement *demandElement)
Insert a demand element element int GNENet container.
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
bool wasSplit()
whether this edge was created from a split
int getNumberOfTLSPrograms() const
get number of TLS Programs
virtual std::string getAttribute(SumoXMLAttr key) const =0
NBNode * getToNode() const
Returns the destination node of the edge.
void saveAdditionals(const std::string &filename)
save additional elements of the network
bool myNetSaved
Flag to check if net has to be saved.
void savePlain(OptionsCont &oc)
save plain xml representation of the network (and nothing else)
vehicles ignoring classes
void splitEdgesBidi(GNEEdge *edge, GNEEdge *oppositeEdge, const Position &pos, GNEUndoList *undoList)
split all edges at position by inserting one new junction
void requireRecompute()
inform the net about the need for recomputation
bool isNetSaved() const
return if net has to be saved
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, bool relativePath, const PositionVector &shape, bool geo, bool fill, double lineWidth, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
An Element which don't belongs to GNENet but has influency in the simulation.
begin/end of the description of a polygon
void markAsModified(GNEUndoList *undoList)
prevent re-guessing connections at this junction
GNEViewNet * getViewNet() const
get view net
GNEJunction * getParentJunction() const
get parent Junction
const POIs & getPOIs() const
Returns all pois.