 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
81 const
double GNENet::Z_INITIALIZED = 1;
91 myNetBuilder(netBuilder),
92 myEdgeIDSupplier("gneE", netBuilder->getEdgeCont().getAllNames()),
93 myJunctionIDSupplier("gneJ", netBuilder->getNodeCont().getAllNames()),
94 myNeedRecompute(true),
96 myAdditionalsSaved(true),
97 myTLSProgramsSaved(true),
98 myDemandElementsSaved(true),
99 myUpdateGeometryEnabled(true),
100 myAllowUndoShapes(true) {
104 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in GNENet constructor");
106 initJunctionsAndEdges();
108 if (myZBoundary.ymin() != Z_INITIALIZED) {
109 myZBoundary.add(0, 0);
113 for (
auto i : listOfTags) {
114 myAttributeCarriers.additionals.insert(std::make_pair(i, std::map<std::string, GNEAdditional*>()));
117 for (
auto i : listOfTags) {
118 myAttributeCarriers.additionals.insert(std::make_pair(i, std::map<std::string, GNEAdditional*>()));
123 for (
auto i : listOfTags) {
124 myAttributeCarriers.demandElements.insert(std::make_pair(i, std::map<std::string, GNEDemandElement*>()));
127 for (
auto i : listOfTags) {
128 myAttributeCarriers.demandElements.insert(std::make_pair(i, std::map<std::string, GNEDemandElement*>()));
144 it.second->
decRef(
"GNENet::~GNENet");
146 WRITE_DEBUG(
"Deleting unreferenced " + it.second->getTagStr() +
" '" + it.second->getID() +
"' in GNENet destructor");
151 it.second->decRef(
"GNENet::~GNENet");
153 WRITE_DEBUG(
"Deleting unreferenced " + it.second->getTagStr() +
" '" + it.second->getID() +
"' in GNENet destructor");
158 for (
auto j : it.second) {
162 WRITE_DEBUG(
"Deleting unreferenced " + j.second->getTagStr() +
" '" + j.second->getID() +
"' in GNENet destructor");
168 for (
auto j : it.second) {
172 WRITE_DEBUG(
"Deleting unreferenced " + j.second->getTagStr() +
" '" + j.second->getID() +
"' in GNENet destructor");
179 WRITE_DEBUG(
"Deleting net builder in GNENet destructor");
218 const std::string& imgFile,
bool relativePath,
const PositionVector& shape,
bool geo,
bool fill,
double lineWidth,
bool ) {
222 GNEPoly* poly =
new GNEPoly(
this,
id, type, shape, geo, fill, lineWidth, color, layer, angle, imgFile, relativePath,
false,
false);
230 poly->
incRef(
"addPolygon");
241 const std::string& lane,
double posOverLane,
double posLat,
double layer,
double angle,
242 const std::string& imgFile,
bool relativePath,
double width,
double height,
bool ) {
248 GNEPOI* poi =
new GNEPOI(
this,
id, type, color, pos, geo, layer, angle, imgFile, relativePath, width, height,
false);
261 throw ProcessError(
"Error adding GNEPOI into shapeContainer");
266 GNEPOI* poi =
new GNEPOI(
this,
id, type, color, layer, angle, imgFile, relativePath, retrievedLane, posOverLane, posLat, width, height,
false);
279 throw ProcessError(
"Error adding GNEPOI over lane into shapeContainer");
328 const std::string& suggestedName,
330 bool allowDuplicateGeom,
331 bool recomputeConnections) {
334 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
335 if ((*it)->getToNode() == dest->
getNBNode() && (*it)->getGeometry().size() == 2) {
336 if (!allowDuplicateGeom) {
343 if (suggestedName !=
"" && !
retrieveEdge(suggestedName,
false)) {
354 edge =
new GNEEdge(
this, nbe, wasSplit);
358 double defaultSpeed = oc.
getFloat(
"default.speed");
359 std::string defaultType = oc.
getString(
"default.type");
360 int defaultNrLanes = oc.
getInt(
"default.lanenumber");
361 int defaultPriority = oc.
getInt(
"default.priority");
365 defaultType, defaultSpeed,
366 defaultNrLanes, defaultPriority,
369 edge =
new GNEEdge(
this, nbe, wasSplit);
373 if (recomputeConnections) {
397 std::vector<GNECrossing*> crossingsToRemove;
399 for (
auto i : junctionNeighbours) {
401 for (
auto j : i->getGNECrossings()) {
404 crossingsToRemove.push_back(j);
410 for (
auto i : crossingsToRemove) {
416 for (
auto it : incident) {
438 while (i->getChildShapes().size() > 0) {
439 deleteShape(i->getChildShapes().front(), undoList);
448 while (i->getChildDemandElements().size() > 0) {
458 while (i->getChildAdditionals().size() > 0) {
468 if (recomputeConnections) {
502 std::vector<GNEAdditional*> copyOfLaneAdditionals = i->getChildAdditionals();
503 for (
auto j : copyOfLaneAdditionals) {
513 std::vector<GNEDemandElement*> copyOfLaneDemandElements = i->getChildDemandElements();
514 for (
auto j : copyOfLaneDemandElements) {
520 std::vector<GNEShape*> copyOfLaneShapes = i->getChildShapes();
521 for (
auto j : copyOfLaneShapes) {
536 for (
auto con : connections) {
553 deleteEdge(edge, undoList, recomputeConnections);
569 if (recomputeConnections) {
578 undoList->add(
new GNEChange_Lane(edge, lane, laneAttrs,
false, recomputeConnections),
true);
603 undoList->
p_begin(
"delete crossing");
648 throw ProcessError(
"Trying to delete a default Vehicle Type");
678 if (recomputeConnections) {
683 undoList->add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true, recomputeConnections),
true);
691 bool addRestriction =
true;
694 for (
const auto lane : edge->
getLanes()) {
697 addRestriction =
false;
706 if (addRestriction) {
722 for (
const auto& lane : edge->
getLanes()) {
723 if (lane->isRestricted(vclass)) {
728 const int numLanes = (int)edge->
getLanes().size();
729 if (index > numLanes) {
758 for (
const auto& lane : edge->
getLanes()) {
759 if (lane->isRestricted(vclass)) {
774 if (newJunction ==
nullptr) {
784 std::pair<PositionVector, PositionVector> newGeoms = oldEdgeGeometry.
splitAt(edgeSplitPosition);
792 const std::string::size_type sep_index = baseName.rfind(
'.');
794 if (sep_index != std::string::npos) {
795 std::string posString = baseName.substr(sep_index + 1);
796 if (GNEAttributeCarrier::canParse<int>(posString.c_str())) {
798 posBase = GNEAttributeCarrier::parse<int>(posString.c_str());
799 baseName = baseName.substr(0, sep_index);
806 undoList, baseName +
toString(posBase + (
int)edgeSplitPosition),
true,
false,
false);
810 std::vector<NBNode::Crossing> affectedCrossings;
812 if (crossing->checkEdgeBelong(edge)) {
818 newEdges.push_back(secondPart->
getNBEdge());
820 newEdges.push_back(nbEdge);
823 nbC.
edges = newEdges;
824 affectedCrossings.push_back(nbC);
830 newGeoms.first.pop_back();
831 newGeoms.first.erase(newGeoms.first.begin());
836 newGeoms.second.pop_back();
837 newGeoms.second.erase(newGeoms.second.begin());
840 for (
int i = 0; i < (int)edge->
getLanes().size(); ++i) {
844 for (
const auto& nbC : affectedCrossings) {
849 additional->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
852 for (
int i = 0; i < (int)edge->
getLanes().size(); i++) {
853 for (
const auto& additional : edge->
getLanes().at(i)->getChildAdditionals()) {
854 additional->splitEdgeGeometry(laneSplitPosition, edge->
getLanes().at(i), secondPart->
getLanes().at(i), undoList);
859 demandElement->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
862 for (
int i = 0; i < (int)edge->
getLanes().size(); i++) {
863 for (
const auto& demandElement : edge->
getLanes().at(i)->getChildDemandElements()) {
864 demandElement->splitEdgeGeometry(laneSplitPosition, edge->
getLanes().at(i), secondPart->
getLanes().at(i), undoList);
879 newJunction =
splitEdge(edge, pos, undoList, newJunction);
881 splitEdge(oppositeEdge, pos, undoList, newJunction);
891 assert(reversed != 0);
906 assert(reversed != 0);
920 reversed =
createEdge(src, dest, edge, undoList,
"-" + edge->
getID(),
false,
true);
921 assert(reversed != 0);
941 for (
NBEdge* edge : incoming) {
953 for (
NBEdge* edge : outgoing) {
973 if (i.second->getPositionInView() == pos) {
987 WRITE_DEBUG(
"Current saving Status: net unsaved, additionals " + additionalsSaved +
", demand elements " + demandElementsSaved);
1032 defaultVehicleType->
incRef(
"GNENet::DEFAULT_VEHTYPE");
1037 defaultBikeType->
incRef(
"GNENet::DEFAULT_BIKETYPE_ID");
1042 defaultPersonType->
incRef(
"GNENet::DEFAULT_PEDTYPE_ID");
1053 }
else if (failHard) {
1074 }
else if (failHard) {
1085 assert((from !=
nullptr) && (to !=
nullptr));
1088 if ((i.second->getGNEJunctionSource() == from) && (i.second->getGNEJunctionDestiny() == to)) {
1105 }
else if (failHard) {
1118 }
else if (failHard) {
1132 for (
auto j : i.second->getGNEConnections()) {
1133 if (j->getID() ==
id) {
1147 std::vector<GNEConnection*>
1149 std::vector<GNEConnection*> result;
1153 for (
auto j : i.second->getGNEConnections()) {
1154 if (!onlySelected || j->isAttributeCarrierSelected()) {
1155 result.push_back(j);
1168 for (
auto j : i.second->getGNECrossings()) {
1169 if (j->getID() ==
id) {
1183 std::vector<GNECrossing*>
1185 std::vector<GNECrossing*> result;
1189 for (
auto j : i.second->getGNECrossings()) {
1190 if (!onlySelected || j->isAttributeCarrierSelected()) {
1191 result.push_back(j);
1199 std::vector<GNEEdge*>
1201 std::vector<GNEEdge*> result;
1204 if (!onlySelected || i.second->isAttributeCarrierSelected()) {
1205 result.push_back(i.second);
1212 std::vector<GNELane*>
1214 std::vector<GNELane*> result;
1217 for (
auto j : i.second->getLanes()) {
1218 if (!onlySelected || j->isAttributeCarrierSelected()) {
1219 result.push_back(j);
1231 if (edge !=
nullptr) {
1235 if (it->getID() ==
id) {
1240 if (lane ==
nullptr) {
1252 }
else if (failHard) {
1260 std::vector<GNEJunction*>
1262 std::vector<GNEJunction*> result;
1265 if (!onlySelected || i.second->isAttributeCarrierSelected()) {
1266 result.push_back(i.second);
1273 std::vector<GNEShape*>
1275 std::vector<GNEShape*> result;
1282 result.push_back(shape);
1292 result.push_back(poi);
1301 std::vector<GNEShape*>
1303 std::vector<GNEShape*> result;
1308 result.push_back(poly);
1311 for (
const auto& it :
getPOIs()) {
1314 result.push_back(poi);
1338 if (
object !=
nullptr) {
1343 if (ac ==
nullptr) {
1344 throw ProcessError(
"GUIGlObject does not match the declared type");
1348 }
else if (failHard) {
1349 throw ProcessError(
"Attempted to retrieve non-existant GUIGlObject");
1356 std::vector<GNEAttributeCarrier*>
1358 std::vector<GNEAttributeCarrier*> result;
1362 result.push_back(i.second);
1363 for (
auto j : i.second->getGNECrossings()) {
1364 result.push_back(j);
1368 result.push_back(i.second);
1369 for (
auto j : i.second->getLanes()) {
1370 result.push_back(j);
1372 for (
auto j : i.second->getGNEConnections()) {
1373 result.push_back(j);
1377 for (
auto j : i.second) {
1378 result.push_back(j.second);
1382 result.push_back(
dynamic_cast<GNEPoly*
>(i.second));
1385 result.push_back(
dynamic_cast<GNEPOI*
>(i.second));
1388 for (
auto j : i.second) {
1389 result.push_back(j.second);
1395 result.push_back(i.second);
1400 result.push_back(i.second);
1407 result.push_back(i.second);
1412 result.push_back(i.second);
1417 for (
auto j : i.second->getLanes()) {
1418 result.push_back(j);
1424 for (
auto j : i.second->getGNEConnections()) {
1425 result.push_back(j);
1431 for (
auto j : i.second->getGNECrossings()) {
1432 result.push_back(j);
1438 result.push_back(
dynamic_cast<GNEPoly*
>(i.second));
1444 result.push_back(
dynamic_cast<GNEPOI*
>(i.second));
1460 if (volatileOptions) {
1461 window->
setStatusBarText(
"Forced computing junctions with volatile options ...");
1469 if (volatileOptions) {
1476 if (volatileOptions) {
1487 if (additionalPath !=
"") {
1490 for (
auto i : listOfTags) {
1494 for (
auto i : listOfTags) {
1510 if (demandPath !=
"") {
1513 for (
auto i : listOfTags) {
1517 for (
auto i : listOfTags) {
1532 window->getApp()->endWaitCursor();
1542 for (
const auto& j : i.second) {
1543 j.second->computePath();
1558 for (
auto it : tlsDefs) {
1559 it->setParticipantsInformation();
1560 it->setTLControllingInformation();
1577 if (n.second->getGNECrossings().size() > 0) {
1600 if (selectedJunctions.size() < 2) {
1605 std::set<NBNode*, ComparatorIdLess> cluster;
1606 for (
auto it : selectedJunctions) {
1607 cluster.insert(it->getNBNode());
1608 const EdgeVector& incoming = it->getNBNode()->getIncomingEdges();
1609 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
1610 const EdgeVector& outgoing = it->getNBNode()->getOutgoingEdges();
1611 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1617 std::string
id =
"cluster";
1626 if ((i.second->getPositionInView() == pos) && (cluster.find(i.second->getNBNode()) == cluster.end())) {
1628 WRITE_DEBUG(
"Opening FXMessageBox 'Join non-selected junction'");
1630 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1637 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'No'");
1638 }
else if (answer == 4) {
1639 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'ESC'");
1644 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'Yes'");
1654 pos.
setx(pos.
x() + 0.1);
1655 pos.
sety(pos.
y() + 0.1);
1671 std::vector<NBNode::Crossing> oldCrossings;
1672 for (
auto i : selectedJunctions) {
1673 while (i->getGNECrossings().size() > 0) {
1674 GNECrossing* crossing = i->getGNECrossings().front();
1681 for (
auto it : selectedJunctions) {
1682 it->setLogicValid(
false, undoList);
1685 for (
auto it : allIncoming) {
1690 for (
auto it : allOutgoing) {
1695 edgesWithin.insert(it);
1703 for (
auto nbc : oldCrossings) {
1705 for (
NBEdge* e : nbc.edges) {
1706 if (edgesWithin.count(e) != 0) {
1714 nbc.customTLIndex, nbc.customTLIndex2, nbc.customShape,
1715 false,
true),
true);
1720 for (
auto it : selectedJunctions) {
1727 if (pos != oldPos) {
1738 std::vector<GNECrossing*> myNetCrossings;
1740 myNetCrossings.reserve(myNetCrossings.size() + it.second->getGNECrossings().size());
1741 myNetCrossings.insert(myNetCrossings.end(), it.second->getGNECrossings().begin(), it.second->getGNECrossings().end());
1744 std::vector<GNECrossing*> myInvalidCrossings;
1745 for (
auto i = myNetCrossings.begin(); i != myNetCrossings.end(); i++) {
1746 if ((*i)->getNBCrossing()->valid ==
false) {
1747 myInvalidCrossings.push_back(*i);
1751 if (myInvalidCrossings.empty()) {
1753 WRITE_DEBUG(
"Opening FXMessageBox 'No crossing to remove'");
1755 FXMessageBox::warning(
getApp(), MBOX_OK,
1759 WRITE_DEBUG(
"Closed FXMessageBox 'No crossing to remove' with 'OK'");
1761 std::string plural = myInvalidCrossings.size() == 1 ? (
"") : (
"s");
1763 WRITE_DEBUG(
"Opening FXMessageBox 'clear crossings'");
1765 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1771 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'No'");
1772 }
else if (answer == 4) {
1773 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'ESC'");
1777 for (
auto i = myInvalidCrossings.begin(); i != myInvalidCrossings.end(); i++) {
1790 std::vector<GNEJunction*> toRemove;
1794 toRemove.push_back(junction);
1797 for (
auto it : toRemove) {
1807 std::vector<GNEDemandElement*> routesWithoutChildren;
1811 if (i.second->getChildDemandElements().empty()) {
1812 routesWithoutChildren.push_back(i.second);
1816 if (routesWithoutChildren.size() > 0) {
1818 undoList->
p_begin(
"clean unused routes");
1820 for (
const auto& i : routesWithoutChildren) {
1835 std::set<std::pair<std::string, GNEDemandElement*> > mySortedRoutes;
1839 bool hasStops =
false;
1840 for (
const auto& j : i.second->getChildDemandElements()) {
1841 if (j->getTagProperty().isStop()) {
1850 std::vector<std::vector<GNEDemandElement*> > routesToMerge;
1851 auto index = mySortedRoutes.begin();
1853 for (
auto i = mySortedRoutes.begin(); i != mySortedRoutes.end(); i++) {
1854 if (routesToMerge.empty()) {
1855 routesToMerge.push_back({i->second});
1857 if (index->first == i->first) {
1858 routesToMerge.back().push_back(i->second);
1860 routesToMerge.push_back({i->second});
1866 bool thereIsRoutesToMerge =
false;
1867 for (
const auto& i : routesToMerge) {
1869 thereIsRoutesToMerge =
true;
1873 if (thereIsRoutesToMerge) {
1875 undoList->
p_begin(
"merge routes");
1877 for (
const auto& i : routesToMerge) {
1880 for (
int j = 1; j < (int)i.size(); j++) {
1882 while (i.at(j)->getChildDemandElements().size() > 0) {
1883 i.at(j)->getChildDemandElements().front()->setAttribute(
SUMO_ATTR_ROUTE, i.at(0)->getID(), undoList);
1901 std::vector<GNEDemandElement*> invalidDemandElements;
1907 if (!i.second->isDemandElementValid()) {
1908 invalidDemandElements.push_back(i.second);
1913 if (!i.second->isDemandElementValid()) {
1914 invalidDemandElements.push_back(i.second);
1919 if (!i.second->isDemandElementValid()) {
1920 invalidDemandElements.push_back(i.second);
1924 if (invalidDemandElements.size() > 0) {
1926 undoList->
p_begin(
"remove invalid demand elements");
1928 for (
const auto& i : invalidDemandElements) {
1943 undoList->
p_begin(
"Replace junction by geometry");
1949 for (
auto j : toJoin) {
1955 for (
auto con : connections) {
1989 if (endpoints.size() < 2) {
1993 undoList->
p_begin(
"Split junction");
1995 std::map<GNEEdge*, std::vector<NBEdge::Connection>> straightConnections;
1997 for (
const auto& c : e->getNBEdge()->getConnections()) {
1999 straightConnections[e].push_back(c);
2006 for (
const auto& pair : endpoints) {
2008 const std::string& origID = pair.second;
2010 std::string newID = origID !=
"" ? origID : newJunction->
getID();
2017 if (e->getNBEdge()->getGeometry().back().almostSame(pos) || e->getNBEdge()->getParameter(
"origTo") == newID) {
2024 if (e->getNBEdge()->getGeometry().front().almostSame(pos) || e->getNBEdge()->getParameter(
"origFrom") == newID) {
2029 if (newID != newJunction->
getID()) {
2033 WRITE_WARNING(
"Could not rename split node to '" + newID +
"'");
2039 for (
const auto& item : straightConnections) {
2041 std::map<NBEdge*, GNEEdge*> newEdges;
2042 for (
auto& c : item.second) {
2048 if (newEdges.count(c.toEdge) == 0) {
2050 newEdges[c.toEdge] = newEdge;
2053 newEdge = newEdges[c.toEdge];
2072 undoList->
p_begin(
"clear junction connections");
2075 for (
auto i : connections) {
2084 undoList->
p_begin(
"reset junction connections");
2101 i->updateConnectionIDs();
2122 std::vector<GNEAttributeCarrier*>
2125 std::vector<GNEAttributeCarrier*> result;
2134 if (ignoreCurrentSupermode ||
2138 result.push_back(AC);
2160 std::string oldID = junction->
getID();
2186 }
else if (hardFail) {
2187 throw ProcessError(
"Attempted to retrieve non-existant additional");
2194 std::vector<GNEAdditional*>
2196 std::vector<GNEAdditional*> result;
2199 for (
auto j : i.second) {
2200 if (!onlySelected || j.second->isAttributeCarrierSelected()) {
2201 result.push_back(j.second);
2214 counter += (int)i.second.size();
2239 std::string netSaved = (
myNetSaved ?
"saved" :
"unsaved");
2241 WRITE_DEBUG(
"Current saving Status: net " + netSaved +
", additionals unsaved, demand elements " + demandElementsSaved);
2257 std::vector<GNEAdditional*> invalidSingleLaneAdditionals;
2258 std::vector<GNEAdditional*> invalidMultiLaneAdditionals;
2261 for (
auto j : i.second) {
2263 if (j.second->getTagProperty().hasAttribute(
SUMO_ATTR_LANE) && !j.second->isAdditionalValid()) {
2264 invalidSingleLaneAdditionals.push_back(j.second);
2265 }
else if (j.second->getTagProperty().hasAttribute(
SUMO_ATTR_LANES) && !j.second->isAdditionalValid()) {
2266 invalidMultiLaneAdditionals.push_back(j.second);
2271 if (invalidSingleLaneAdditionals.size() > 0 || invalidMultiLaneAdditionals.size() > 0) {
2275 if (fixAdditionalElementsDialog.execute() == 0) {
2319 }
else if (hardFail) {
2320 throw ProcessError(
"Attempted to retrieve non-existant demand element");
2327 std::vector<GNEDemandElement*>
2329 std::vector<GNEDemandElement*> result;
2332 for (
auto j : i.second) {
2333 if (!onlySelected || j.second->isAttributeCarrierSelected()) {
2334 result.push_back(j.second);
2347 counter += (int)i.second.size();
2380 throw ProcessError(demandElement->
getTagStr() +
" with old begin='" + oldBegin +
"' doesn't exist");
2395 std::string netSaved = (
myNetSaved ?
"saved" :
"unsaved");
2397 WRITE_DEBUG(
"Current saving Status: net " + netSaved +
", additionals " + additionalsSaved +
", demand elements unsaved");
2415 std::vector<GNEDemandElement*> invalidSingleLaneDemandElements;
2418 for (
auto j : i.second) {
2420 if (!j.second->isDemandElementValid()) {
2421 invalidSingleLaneDemandElements.push_back(j.second);
2426 if (invalidSingleLaneDemandElements.size() > 0) {
2430 if (fixDemandElementsDialog.execute() == 0) {
2438 WRITE_DEBUG(
"demand elements saved after dialog");
2493 for (
auto j : i.second) {
2494 j.second->writeAdditional(device);
2501 for (
auto j : i.second) {
2503 if (j.second->getParentAdditionals().empty()) {
2504 j.second->writeAdditional(device);
2512 for (
auto j : i.second) {
2514 if (j.second->getParentAdditionals().empty()) {
2515 j.second->writeAdditional(device);
2524 for (
auto j : i.second) {
2526 if (j.second->getParentAdditionals().empty()) {
2527 j.second->writeAdditional(device);
2534 dynamic_cast<GNEShape*
>(i.second)->writeShape(device);
2536 for (
const auto& i :
myPOIs) {
2537 dynamic_cast<GNEShape*
>(i.second)->writeShape(device);
2549 i.second->writeDemandElement(device);
2553 i.second->writeDemandElement(device);
2557 i.second->writeDemandElement(device);
2561 i.second->writeDemandElement(device);
2569 if (shape.size() > 0) {
2571 GNEPoly* shapePoly =
new GNEPoly(
this,
"edit_shape",
"edit_shape", shape,
false, fill, 0.3, col,
GLO_POLYGON, 0,
"",
false,
false,
false);
2591 throw ProcessError(
"Polygon for edit shapes has to be inicializated");
2601 std::string newID =
"poly_" +
toString(counter);
2605 newID =
"poly_" +
toString(counter);
2610 std::string newID =
"POI_" +
toString(counter);
2614 newID =
"POI_" +
toString(counter);
2659 device.
openTag(
"additionals");
2751 if (updateViewAfterDeleting) {
2767 if (demandElement) {
2836 if (updateViewAfterDeleting) {
2856 for (
auto name_it : nodeContainer.
getAllNames()) {
2867 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
2878 for (
const auto& j : i.second->getLanes()) {
2879 j->updateGeometry();
2909 junction->
incRef(
"GNENet::registerJunction");
2933 edge->
incRef(
"GNENet::registerEdge");
2965 junction->
decRef(
"GNENet::deleteSingleJunction");
2968 if (updateViewAfterDeleting) {
2987 edge->
decRef(
"GNENet::deleteSingleEdge");
2993 if (updateViewAfterDeleting) {
3025 if (updateViewAfterDeleting) {
3054 if (updateViewAfterDeleting) {
3084 i.second->remakeGNEConnections();
3086 for (
const auto& j : i.second->getGNEConnections()) {
3087 j->updateGeometry();
3096 std::set<std::string> liveExplicitTurnarounds;
3099 liveExplicitTurnarounds.insert(it);
3115 if (oc.
getBool(
"numerical-ids") || oc.
isSet(
"reserved-ids")) {
3116 std::map<std::string, GNEEdge*> newEdgeMap;
3117 std::map<std::string, GNEJunction*> newJunctionMap;
3120 it.second->setMicrosimID(it.second->getNBEdge()->getID());
3121 newEdgeMap[it.second->getNBEdge()->getID()] = it.second;
3124 newJunctionMap[it.second->getNBNode()->getID()] = it.second;
3125 it.second->setMicrosimID(it.second->getNBNode()->getID());
3131 if (!oc.
getBool(
"offset.disable-normalization")) {
3134 it.second->updateGeometry();
3145 if (volatileOptions) {
3156 for (
auto it : copyOfEdges) {
3161 for (
auto it : copyOfJunctions) {
3166 for (
const auto& j : it.second) {
3168 if (j.second->getTagProperty().isDrawable()) {
3176 for (
auto i : listOfTags) {
3180 for (
auto i : listOfTags) {
3189 for (
const auto& it :
myPOIs) {
3195 for (
const auto& j : it.second) {
3197 if (j.second->getTagProperty().isDrawable()) {
3205 for (
auto i : listOfTags) {
3209 for (
auto i : listOfTags) {
3215 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in computeAndUpdate(...) due recomputing with volatile options");
3220 WRITE_GLDEBUG(
"Add junctions during recomputing after calling myNetBuilder->compute(...)");
3225 WRITE_GLDEBUG(
"Add egdges during recomputing after calling myNetBuilder->compute(...)");
3231 it.second->remakeGNEConnections();
3236 it.second->setLogicValid(
true,
nullptr);
3238 it.second->updateGeometryAfterNetbuild();
3243 it.second->updateGeometry();
3254 std::vector<std::string> values = GNEAttributeCarrier::parse<std::vector<std::string> >(ac->
getAttribute(key));
3255 std::vector<std::string> newValues;
3256 for (
auto v : values) {
3257 newValues.push_back(v == which ? by : v);
void insertAdditional(GNEAdditional *additional)
Insert a additional element int GNENet container.
void requireSaveNet(bool value)
inform that net has to be saved
bool isPerson() const
return true if tag correspond to a person element
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
bool myUpdateGeometryEnabled
Flag to enable or disable update geometry of elements after inserting or removing element in net.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
void p_clear()
clears the undo list (implies abort)
static const double UNSPECIFIED_OFFSET
unspecified lane offset
const AttributeCarriers & getAttributeCarriers() const
retrieve all attribute carriers of Net
@ SVC_PEDESTRIAN
pedestrian
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
IDSupplier myJunctionIDSupplier
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.
void clearInspectedAC()
Clear all current inspected ACs.
An Element which don't belongs to GNENet but has influency in the simulation.
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
static void createRouteCalculatorInstance(GNENet *net)
create instance of RouteCalculator
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
void initJunctionsAndEdges()
Init Junctions and edges.
An Element which don't belongs to GNENet but has influency in the simulation.
A window containing a gl-object's parameter.
static const double Z_INITIALIZED
marker for whether the z-boundary is initialized
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
static void replaceInListAttribute(GNEAttributeCarrier *ac, SumoXMLAttr key, const std::string &which, const std::string &by, GNEUndoList *undoList)
std::string generateAdditionalID(SumoXMLTag type) const
generate additional id
bool myDemandElementsSaved
Flag to check if demand elements has to be saved.
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
void removeShape(GNEShape *shape, bool updateViewAfterDeleting)
remove created shape (but NOT delete)
friend class GNEChange_Additional
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
std::map< std::string, GNEJunction * > junctions
map with the name and pointer to junctions of net
const std::string getID() const
function to support debugging
void cleanInvalidDemandElements(GNEUndoList *undoList)
clean invalid demand elements
#define WRITE_WARNING(msg)
int getNumberOfTLSPrograms() const
get number of TLS Programs
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
bool netHasGNECrossings() const
check if net has GNECrossings
@ SUMO_TAG_POLY
begin/end of the description of a polygon
Storage for edges, including some functionality operating on multiple edges.
void rename(NBNode *node, const std::string &newID)
Renames the node. Throws exception if newID already exists.
bool isPlacedInRTree() const
return true if Tag correspond to an element that has has to be placed in RTREE
const std::string DEFAULT_PEDTYPE_ID
void deleteShape(GNEShape *shape, GNEUndoList *undoList)
remove shape
Instance responsible for building networks.
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
@ SUMO_ATTR_TLTYPE
node: the type of traffic light
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...
A container for traffic light definitions and built programs.
#define WRITE_GLDEBUG(msg)
Static storage of an output device and its base (abstract) implementation.
bool isStoppingPlace() const
return true if tag correspond to a detector (Only used to group all stoppingPlaces in the output XML)
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
void resetJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
reset junction's connections
void selectAttributeCarrier(bool changeFlag=true)
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
double z() const
Returns the z-position.
void removeEdgeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
GNEEdge * getParentEdge() const
Returns underlying parent edge.
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
void reserveEdgeID(const std::string &id)
reserve edge ID (To avoid duplicates)
void disableUpdateGeometry()
disable update geometry of elements after inserting or removing an element in net
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
virtual void selectAttributeCarrier(bool changeFlag=true)=0
A NBNetBuilder extended by visualisation and editing capabilities.
std::vector< GNEJunction * > getJunctionNeighbours() const
return GNEJunction neighbours
Dialog for edit rerouters.
friend class GNEChange_Connection
void insertEdge(GNEEdge *edge)
inserts a single edge into the net and into the underlying netbuild-container
void setx(double x)
set position x
void removeEditedAC(GNEAttributeCarrier *AC)
remove edited ACs
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
std::map< std::string, GNEDemandElement * > vehicleDepartures
special map used for saving Demand Elements of type "Vehicle" (Vehicles, routeFlows,...
void saveJoined(OptionsCont &oc)
save log of joined junctions (and nothing else)
void invalidatePathChildElementss()
invalidate path element childs
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
IDSupplier myEdgeIDSupplier
void setMicrosimID(const std::string &newID)
override to also set lane ids
void updateAdditionalID(const std::string &oldID, GNEAdditional *additional)
update additional ID in container
std::vector< std::string > getAllNames() const
get all node names
void deleteSingleEdge(GNEEdge *edge, bool updateViewAfterDeleting)
deletes a single edge
void reverseEdge(GNEEdge *edge, GNEUndoList *undoList)
reverse edge
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
std::vector< GNEConnection * > getGNEConnections() const
Returns all GNEConnections vinculated with this junction.
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers(bool ignoreCurrentSupermode)
get all selected attribute carriers (or only relative to current supermode
@ SUMO_TAG_LANE
begin/end of the description of a single lane
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
bool myNeedRecompute
whether the net needs recomputation
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
void splitEdgesBidi(GNEEdge *edge, GNEEdge *oppositeEdge, const Position &pos, GNEUndoList *undoList)
split all edges at position by inserting one new junction
Storage for geometrical objects.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
@ SUMO_TAG_PTYPE
description of a person type (used in NETEDIT)
void requireSaveTLSPrograms()
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
FXApp * getApp()
get pointer to the main App
@ SVC_BICYCLE
vehicle is a bicycle
double getHeight() const
Returns the height of the boundary (y-axis)
static OptionsCont & getOptions()
Retrieves the options.
bool myAllowUndoShapes
flag used to indicate if shaped created can be undo
bool cleanInvalidCrossings(GNEUndoList *undoList)
clear invalid crossings
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
The main window of the Netedit.
void markAsModified(GNEUndoList *undoList)
prevent re-guessing connections at this junction
void replaceIncomingEdge(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replaces edge
void update()
notify myViewNet
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
void changeShapeID(GNEShape *s, const std::string &OldID)
change Shape ID
bool restrictLane(SUMOVehicleClass vclass, GNELane *lane, GNEUndoList *undoList)
transform lane to restricted lane
@ GNE_ATTR_SHAPE_END
last coordinate of edge shape
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void insertJunction(GNEJunction *junction)
inserts a single junction into the net and into the underlying netbuild-container
int buildCrossings()
build pedestrian crossings
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node's edges clockwise regarding driving direction.
@ SUMO_TAG_NOTHING
invalid tag
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
@ SUMO_TAG_VTYPE
description of a vehicle type
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
void disableSaveDemandElementsMenu()
disable save demand elements
void update() const
Mark the entire GNEViewNet to be repainted later.
void addExplicitTurnaround(std::string id)
add edge id to the list of explicit turnarounds
std::vector< GNEConnection * > retrieveConnections(bool onlySelected=false) const
return all connections
std::map< SumoXMLTag, std::map< std::string, GNEAdditional * > > additionals
map with the name and pointer to additional elements of net
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
void close()
Closes the device and removes it from the dictionary.
bool hasDefaultGeometryEndpointAtNode(const NBNode *node) const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
GNEViewNet * myViewNet
The viewNet to be notofied of about changes.
friend class GNEChange_Shape
SUMORTree & getVisualisationSpeedUp()
Returns the RTree used for visualisation speed-up.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void reserveJunctionID(const std::string &id)
reserve junction ID (To avoid duplicates)
friend class GNEChange_Lane
SumoXMLTag
Numbers representing SUMO-XML - element names.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Container for nodes during the netbuilding process.
NBEdgeCont & getEdgeCont()
static void writeJoinedJunctions(const OptionsCont &oc, NBNodeCont &nc)
Writes the joined-juncionts to file.
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
bool isList() const
return true if atribute is a list
void updateGeometry()
update pre-computed geometry information (including crossings)
The representation of a single edge during network building.
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
void avoid(const std::string &id)
make sure that the given id is never supplied
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
int getIndex() const
returns the index of the lane
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
void setViewNet(GNEViewNet *viewNet)
Set the viewNet to be notified of network changes.
A road/street connecting two junctions (netedit-version)
GNEJunction * splitEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList, GNEJunction *newJunction=0)
split edge at position by inserting a new junction
const Boundary & getZBoundary() const
Returns the Z boundary (stored in the x() coordinate) values of 0 do not affect the boundary.
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
GNEPoly * retrievePolygon(const std::string &id, bool failHard=true) const
get Polygon by id
std::string getAttribute(SumoXMLAttr key) const
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
std::map< std::string, GNEEdge * > edges
map with the name and pointer to edges of net
A RT-tree for efficient storing of SUMO's GL-objects.
const Position & getPosition() const
@ GNE_ATTR_SHAPE_START
first coordinate of edge shape
void analyzeCluster(NodeSet cluster, std::string &id, Position &pos, bool &hasTLS, TrafficLightType &type, SumoXMLNodeType &nodeType)
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
NBNetBuilder * myNetBuilder
The internal netbuilder.
bool checkIsRemovable() const
check if node is removable
bool joinSelectedJunctions(GNEUndoList *undoList)
join selected junctions
NBNode * getNBNode() const
Return net build node.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
get edges to join
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
GNEEdge * registerEdge(GNEEdge *edge)
registers an edge with GNENet containers
bool isVehicle() const
return true if tag correspond to a vehicle element
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
@ SUMO_TAG_ROUTEFLOW
a flow definition nusing a route instead of a from-to edges route (used in NETEDIT)
NBNetBuilder * getNetBuilder() const
get net builder
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
void reset()
Resets the boundary.
@ LINKDIR_STRAIGHT
The link is a straight direction.
NBNode * getToNode() const
Returns the destination node of the edge.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
virtual void updateGeometry()=0
update pre-computed geometry information
void joinRoutes(GNEUndoList *undoList)
join routes
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.
int size() const
Returns the number of stored items within the container.
void push_back_noDoublePos(const Position &p)
insert in back a non double position
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
void enableSaveDemandElementsMenu()
enable save demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
void deleteSingleJunction(GNEJunction *junction, bool updateViewAfterDeleting)
deletes a single junction
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
std::map< std::string, int > myEdgesAndNumberOfLanes
map with the Edges and their number of lanes
struct used for saving all attribute carriers of net, in different formats
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void computeAndUpdate(OptionsCont &oc, bool volatileOptions)
recompute the network and update lane geometries
std::string getAttribute(SumoXMLAttr key) const
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
static std::vector< SumoXMLTag > allowedTagsByCategory(int tagPropertyCategory, bool onlyDrawables)
get tags of all editable element types using TagProperty Type (TAGTYPE_NETELEMENT,...
void requireSaveAdditionals(bool value)
inform that additionals has to be saved
@ SUMO_TAG_POILANE
begin/end of the description of a Point of interest over Lane (used by Netedit)
bool isAdditionalsSaved() const
check if additionals are saved
bool remove(const std::string &id, const bool del=true)
Removes an item.
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
NBEdge * getNBEdge() const
returns the internal NBEdge
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void requireSaveDemandElements(bool value)
inform that demand elements has to be saved
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
std::string getLaneID(int lane) const
get lane ID
const std::vector< GNEShape * > & getChildShapes() const
get child shapes
std::vector< std::pair< Position, std::string > > getEndPoints() const
return list of unique endpoint coordinates of all edges at this node
void selectAttributeCarrier(bool changeFlag=true)
bool isDemandElement() const
return true if tag correspond to a demand element
std::set< NBEdge * > EdgeSet
container for unique edges
const std::string DEFAULT_VTYPE_ID
void splitJunction(GNEJunction *junction, bool reconnect, GNEUndoList *undoList)
replace the selected junction by a list of junctions for each unique edge endpoint
void removeAdditionalGLObject(GUIGlObject *o)
Removes an additional object (detector/shape/trigger) from being visualised.
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
std::vector< GNEDemandElement * > retrieveDemandElements(bool onlySelected=false) const
return all demand elements
GNEPoly * addPolygonForEditShapes(GNENetElement *netElement, const PositionVector &shape, bool fill, RGBColor col)
Builds a special polygon used for edit Junctions's shapes.
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
std::vector< GNEShape * > retrieveShapes(SumoXMLTag shapeTag, bool onlySelected=false)
return shape by type shapes
bool priority
whether the pedestrians have priority
void enableUpdateGeometry()
@ SUMO_ATTR_EDGES
the edges of a route
A class that stores a 2D geometrical boundary.
int getNumberOfDemandElements(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of demand elements of the net.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
int getNumLanes() const
Returns the number of lanes.
double getWidth() const
Returns the width of the boudary (x-axis)
void enableSaveTLSProgramsMenu()
enable save TLS Programs
void renameJunction(GNEJunction *junction, const std::string &newID)
updates the map and reserves new id
@ SUMO_TAG_EDGE
begin/end of the description of an edge
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)
bool myAdditionalsSaved
Flag to check if additionals has to be saved.
@ GNE_SUPERMODE_NETWORK
Network mode (Edges, junctions, etc..)
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Supermode currentSupermode
the current supermode
bool addRestrictedLane(SUMOVehicleClass vclass, GNEEdge *edge, int index, GNEUndoList *undoList)
add restricted lane to edge
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
GNEInspectorFrame * getInspectorFrame() const
get frame for GNE_NMODE_INSPECT
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool failHard=true)
get a single attribute carrier based on a GLID
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
GNEUndoList * getUndoList() const
get the undoList object
void initGNEConnections()
initialize GNEConnections
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void append(const PositionVector &v, double sameThreshold=2.0)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
void save(OptionsCont &oc)
save the network
void duplicateLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
duplicates lane
void enableSaveAdditionalsMenu()
enable save additionals
std::vector< GNECrossing * > retrieveCrossings(bool onlySelected=false) const
return all crossings
A storage for options typed value containers)
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node)
Lane & getLaneStruct(int lane)
void updateDemandElementBegin(const std::string &oldBegin, GNEDemandElement *demandElement)
update demand element begin in container
@ GNE_ATTR_DEFAULT_VTYPE
Flag to check if VType is a default VType.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
void addOutgoingGNEEdge(GNEEdge *edge)
add outgoing GNEEdge
void saveDemandElementsConfirmed(const std::string &filename)
save demand elements after confirming invalid objects
friend class GNEChange_DemandElement
void resetNodeBorder(const NBNode *node)
void decRef(const std::string &debugMsg="")
Decrease reference.
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
GNEJunction * registerJunction(GNEJunction *junction)
registers a junction with GNENet containers
void updateDemandElementID(const std::string &oldID, GNEDemandElement *demandElement)
update demand element ID in container
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
std::map< SumoXMLTag, std::map< std::string, GNEDemandElement * > > demandElements
map with the name and pointer to demand elements of net
bool myNetSaved
Flag to check if net has to be saved.
@ SUMO_TAG_VEHICLE
description of a vehicle
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
bool isDemandElementsSaved() const
check if demand elements are saved
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 removeConnectionsFrom(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections from the given edge
std::vector< GNEAdditional * > retrieveAdditionals(bool onlySelected=false) const
return all additionals
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.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=FEATURE_GUESSED)
friend class GNEChange_Edge
GNEFrameAttributesModuls::AttributesEditor * getAttributesEditor() const
get AttributesEditor
GNEViewNet * getViewNet() const
get view net
int customTLIndex
the custom traffic light index of this crossing (if controlled)
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
AttributeCarriers myAttributeCarriers
AttributeCarriers of net.
const POIs & getPOIs() const
Returns all pois.
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
void mergeJunctions(GNEJunction *moved, GNEJunction *target, GNEUndoList *undoList)
merge the given junctions edges between the given junctions will be deleted
virtual bool isAttributeCarrierSelected() const =0
check if attribute carrier is selected
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
bool additionalExist(GNEAdditional *additional) const
return true if additional exist (use pointer instead ID)
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(SumoXMLTag type=SUMO_TAG_NOTHING)
get the attribute carriers based on Type
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
std::set< std::string > myExplicitTurnarounds
list of edge ids for which turn-arounds must be added explicitly
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
const Boundary & getBoundary() const
returns the bounder of the network
GNEJunction * getGNEJunctionSource() const
returns the source-junction
void unblockObject(GUIGlID id)
Marks an object as unblocked.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
GNECrossing * retrieveCrossing(const std::string &id, bool failHard=true) const
get Crossing by id
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool isPersonPlan() const
return true if tag correspond to a person plan
NBConnection getNBConnection() const
get NBConnection
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Dialog for edit rerouters.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
void disableSaveAdditionalsMenu()
disable save additionals
void saveAdditionals(const std::string &filename)
save additional elements of the network
GNEJunction * getParentJunction() const
get parent Junction
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
double width
This crossing's width.
double y() const
Returns the y-position.
void savePlain(OptionsCont &oc)
save plain xml representation of the network (and nothing else)
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
void requireRecompute()
inform the net about the need for recomputation
void saveTLSPrograms(const std::string &filename)
save TLS Programs elements of the network
PositionVector customShape
optional customShape for this crossing
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
void rename(NBEdge *edge, const std::string &newID)
Renames the edge. Throws exception if newID already exists.
friend class GNEChange_Junction
GNEEdge * addReversedEdge(GNEEdge *edge, GNEUndoList *undoList)
add reversed edge
PositionVector reverse() const
reverse position vector
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
void removeSolitaryJunctions(GNEUndoList *undoList)
removes junctions that have no edges
@ GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
void saveAdditionalsConfirmed(const std::string &filename)
save additionals after confirming invalid objects
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge *edge, GNEUndoList *undoList)
remove restricted lane
SUMORTree myGrid
the rtree which contains all GUIGlObjects (so named for historical reasons)
An (internal) definition of a single lane of an edge.
bool changeID(const std::string &oldId, const std::string &newId)
change ID of a stored object
static std::string getEdgeIDFromLane(const std::string laneID)
return edge id when given the lane ID
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
virtual std::string getAttribute(SumoXMLAttr key) const =0
void setStatusBarText(const std::string &statusBarText)
set text of the statusBar
virtual void unselectAttributeCarrier(bool changeFlag=true)=0
unselect attribute carrier using GUIGlobalSelection
T get(const std::string &id) const
Retrieves an item.
virtual void updateGeometry()=0
update pre-computed geometry information
void extract(NBDistrictCont &dc, NBEdge *edge, bool remember=false)
Removes the given edge from the container like erase but does not delete it.
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction's connections
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
void incRef(const std::string &debugMsg="")
Increarse reference.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
void registerJoinedCluster(const NodeSet &cluster)
gets all joined clusters (see doc for myClusters2Join)
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
@ SUMO_TAG_CONNECTION
connectio between two lanes
std::string getNext()
Returns the next id.
bool isDrawable() const
return true if tag correspond to a drawable element
bool isDetector() const
return true if tag correspond to a shape (Only used to group all detectors in the XML)
void setShapeEditedElement(GNENetElement *element)
retrieve the netElement of which the shape is being edited
GUISelectedStorage gSelected
A global holder of selected objects.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static const double UNSPECIFIED_WIDTH
unspecified lane width
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
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.
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
EdgeVector edges
The edges being crossed.
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
void computeJunction(GNEJunction *junction)
trigger recomputation of junction shape and logic param[in] window The window to inform about delay
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
@ SUMO_TAG_ROUTE
begin/end of the description of a route
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
static void deleteRouteCalculatorInstance()
delete instance of RouteCalculator
bool extract(NBNode *node, bool remember=false)
Removes the given node but does not delete it.
void clear()
Removes all items from the container (deletes them, too)
int getNumberOfShapes() const
get number of shapes
const AttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn't exist)
static const TagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
void renameEdge(GNEEdge *edge, const std::string &newID)
updates the map and reserves new id
GNEConnection * retrieveConnection(const std::string &id, bool failHard=true) const
get Connection by id
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
bool computeSingleLogic(OptionsCont &oc, NBTrafficLightDefinition *def)
Computes a specific traffic light logic (using by NETEDIT)
@ SVC_BUS
vehicle is a bus
bool isUpdateGeometryEnabled() const
check if update geometry after inserting or removing has to be updated
class for GNEChange_ReplaceEdgeInTLS
bool isValid(SumoXMLAttr key, const std::string &value)
@ GNE_ATTR_SELECTED
element is selected
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Boundary myZBoundary
the z boundary (stored in the x-coordinate), values of 0 are ignored
the function-object for an editing operation (abstract base)
bool demandElementExist(GNEDemandElement *demandElement) const
return true if demand element exist (use pointer instead ID)
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
void removePolygonForEditShapes(GNEPoly *polygon)
remove Polygon for edit shapes
const std::string & getTagStr() const
get tag assigned to this object in string format
std::string generateDemandElementID(const std::string &prefix, SumoXMLTag type) const
generate demand element id
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.
Represents a single node (junction) during network building.
const Polygons & getPolygons() const
Returns all polygons.
virtual std::string getBegin() const
get begin time of demand element
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Stores the information about how to visualize structures.
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc.....
void removeConnectionsTo(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections to the given edge
void deleteDemandElement(GNEDemandElement *demandElement, GNEUndoList *undoList)
remove demand element
NBNodeCont & getNodeCont()
Returns a reference to the node container.
void sety(double y)
set position y
A definition of a pedestrian crossing.
A structure which describes a connection between edges or lanes.
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 insertDemandElement(GNEDemandElement *demandElement)
Insert a demand element element int GNENet container.
void computeDemandElements(GNEApplicationWindow *window)
compute demand elements param[in] window The window to inform about delay
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SVC_IGNORING
vehicles ignoring classes
const std::string DEFAULT_BIKETYPE_ID
virtual void updateGeometry()=0
update pre-computed geometry information
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
bool checkJunctionPosition(const Position &pos)
return true if there are already a Junction in the given position, false in other case
void replaceIncomingConnections(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replace one edge by another in all tls connections
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
the function-object for an editing operation (abstract base)
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
bool myTLSProgramsSaved
Flag to check if shapes has to be saved.
const std::string & getID() const
Returns the id.
Polygons myPolygons
stored Polygons
bool isNetSaved() const
return if net has to be saved
void cleanUnusedRoutes(GNEUndoList *undoList)
clean unused routes
const std::vector< Connection > & getConnections() const
Returns the connections.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
NBNode * getFromNode() const
Returns the origin node of the edge.
#define WRITE_MESSAGE(msg)
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
void saveDemandElements(const std::string &filename)
save demand element elements of the network
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ GLO_NETWORK
The network - empty.
GNEViewParent * getViewParent() const
get the net object
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
void insertShape(GNEShape *shape, bool updateViewAfterDeleting)
insert shape
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
bool add(const std::string &id, T item)
Adds an item.
bool wasSplit()
whether this edge was created from a split
const std::string & getID() const