82 const
double GNENet::Z_INITIALIZED = 1;
91 myNetBuilder(netBuilder),
92 myAttributeCarriers(new
GNENetHelper::AttributeCarriers(this)),
98 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in GNENet constructor");
100 initJunctionsAndEdges();
102 if (myZBoundary.ymin() != Z_INITIALIZED) {
103 myZBoundary.add(0, 0);
117 WRITE_DEBUG(
"Deleting net builder in GNENet destructor");
152 const std::map<std::string, int>&
233 const std::string& suggestedName,
bool wasSplit,
bool allowDuplicateGeom,
bool recomputeConnections) {
240 if (outgoingEdge->getToNode() == dest->
getNBNode() && outgoingEdge->getGeometry().size() == 2) {
241 if (!allowDuplicateGeom) {
251 if (oppositeEdges.size() > 0) {
253 if ((oppositeEdges.front()->getID().size() > 1) && (oppositeEdges.front()->getID().front() ==
'-')) {
254 edgeID = oppositeEdges.front()->getID().substr(1);
256 edgeID =
"-" + oppositeEdges.front()->getID();
265 edgeID = edgeID +
toString(counter);
268 edgeID = suggestedName;
269 }
else if (edgeInfix.size() > 0) {
274 edgeID = src->
getID() + edgeInfix + dest->
getID();
295 edge =
new GNEEdge(
this, nbe, wasSplit);
299 double defaultSpeed = neteditOptions.getFloat(
"default.speed");
300 const std::string defaultType = neteditOptions.getString(
"default.type");
301 const int defaultNrLanes = neteditOptions.getInt(
"default.lanenumber");
302 const int defaultPriority = neteditOptions.getInt(
"default.priority");
309 defaultNrLanes, defaultPriority,
310 defaultWidth, defaultOffset, spread);
312 edge =
new GNEEdge(
this, nbe, wasSplit);
315 undoList->
begin(edge,
TL(
"create edge"));
318 if (recomputeConnections) {
386 std::vector<GNECrossing*> crossingsToRemove;
388 for (
const auto& junctionNeighbour : junctionNeighbours) {
390 for (
const auto& crossing : junctionNeighbour->getGNECrossings()) {
392 if (crossing->checkEdgeBelong(junctionNeighbour->getChildEdges())) {
393 crossingsToRemove.push_back(crossing);
398 for (
const auto& crossing : crossingsToRemove) {
403 for (
const auto& edge : incidentEdges) {
418 for (
const auto& lane : edge->
getLanes()) {
422 while (lane->getChildAdditionals().size() > 0) {
426 while (lane->getChildDemandElements().size() > 0) {
430 while (lane->getChildGenericDatas().size() > 0) {
446 if (planParent->getChildDemandElements().size() == 1) {
463 if (recomputeConnections) {
489 undoList->
begin(which,
TL(
"replace edge"));
492 for (
const auto& lane : which->
getLanes()) {
494 std::vector<GNEAdditional*> copyOfLaneAdditionals = lane->getChildAdditionals();
495 for (
const auto& additional : copyOfLaneAdditionals) {
509 std::vector<GNEDemandElement*> copyOfLaneDemandElements = lane->getChildDemandElements();
510 for (
const auto& demandElement : copyOfLaneDemandElements) {
514 std::vector<GNEGenericData*> copyOfLaneGenericDatas = lane->getChildGenericDatas();
515 for (
const auto& demandElement : copyOfLaneGenericDatas) {
585 deleteEdge(edge, undoList, recomputeConnections);
603 if (recomputeConnections) {
612 undoList->
add(
new GNEChange_Lane(edge, lane, laneAttrs,
false, recomputeConnections),
true);
678 throw ProcessError(
TL(
"Trying to delete a default Vehicle Type"));
710 for (
const auto& dataInterval : copyOfDataIntervalChildren) {
723 for (
const auto& genericData : copyOfGenericDataChildren) {
771 undoList->
begin(lane,
TL(
"duplicate lane"));
774 if (recomputeConnections) {
779 undoList->
add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true, recomputeConnections),
true);
787 bool addRestriction =
true;
790 for (
const auto& edgeLane : edge->
getLanes()) {
793 addRestriction =
false;
802 if (addRestriction) {
814 std::vector<GNEConnection*> cons;
824 for (
auto c : cons) {
841 for (
const auto& lane : edge->
getLanes()) {
842 if (lane->isRestricted(vclass)) {
847 const int numLanes = (int)edge->
getLanes().size();
848 if (index > numLanes) {
858 }
else if (vclass ==
SVC_BUS) {
877 const int numLanes = (int)edge->
getLanes().size();
878 if (index > numLanes) {
894 for (
const auto& lane : edge->
getLanes()) {
895 if (lane->isRestricted(vclass)) {
905 std::pair<GNEJunction*, GNEEdge*>
908 undoList->
begin(edge,
TL(
"split edge"));
910 if (newJunction ==
nullptr) {
920 std::pair<PositionVector, PositionVector> newGeoms = oldEdgeGeometry.
splitAt(edgeSplitPosition);
921 const double oldLength = oldEdgeGeometry.
length();
922 const double relativeLength1 = oldLength != 0 ? newGeoms.first.length() / oldLength : 1;
923 const double relativeLength2 = oldLength != 0 ? newGeoms.second.length() / oldLength : 1;
931 const std::string::size_type sep_index = baseName.rfind(
'.');
933 if (sep_index != std::string::npos) {
934 std::string posString = baseName.substr(sep_index + 1);
935 if (GNEAttributeCarrier::canParse<int>(posString.c_str())) {
937 posBase = GNEAttributeCarrier::parse<int>(posString.c_str());
938 baseName = baseName.substr(0, sep_index);
945 undoList, baseName +
toString(posBase + (
int)edgeSplitPosition),
true,
false,
false);
949 std::vector<NBNode::Crossing> affectedCrossings;
951 if (crossing->checkEdgeBelong(edge)) {
957 newEdges.push_back(secondPart->
getNBEdge());
959 newEdges.push_back(nbEdge);
962 nbC.
edges = newEdges;
963 affectedCrossings.push_back(nbC);
969 newGeoms.first.pop_back();
970 newGeoms.first.erase(newGeoms.first.begin());
975 newGeoms.second.pop_back();
976 newGeoms.second.erase(newGeoms.second.begin());
986 for (
int i = 0; i < (int)edge->
getLanes().size(); ++i) {
990 for (
const auto& nbC : affectedCrossings) {
995 for (
const auto& additional : childAdditionals) {
996 additional->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
999 for (
int i = 0; i < (int)edge->
getLanes().size(); i++) {
1000 for (
const auto& additional : edge->
getLanes().at(i)->getChildAdditionals()) {
1001 additional->splitEdgeGeometry(laneSplitPosition, edge->
getLanes().at(i), secondPart->
getLanes().at(i), undoList);
1006 for (
const auto& demandElement : childDemandElements) {
1007 demandElement->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
1010 for (
int i = 0; i < (int)edge->
getLanes().size(); i++) {
1011 for (
const auto& demandElement : edge->
getLanes().at(i)->getChildDemandElements()) {
1012 demandElement->splitEdgeGeometry(laneSplitPosition, edge->
getLanes().at(i), secondPart->
getLanes().at(i), undoList);
1018 return std::make_pair(newJunction, secondPart);
1025 undoList->
begin(edge,
TL(
"split edges"));
1027 auto newStuff =
splitEdge(edge, pos, undoList, newJunction);
1028 newJunction = newStuff.first;
1030 splitEdge(oppositeEdge, pos, undoList, newJunction);
1037 if (nbEdge->guessOpposite(
true)) {
1048 undoList->
begin(edge,
TL(
"reverse edge"));
1051 assert(reversed != 0);
1062 if (reversed !=
nullptr) {
1065 undoList->
begin(edge,
TL(
"add reversed edge"));
1066 if (!disconnected) {
1069 assert(reversed != 0);
1083 reversed =
createEdge(src, dest, edge, undoList,
"-" + edge->
getID(),
false,
true);
1084 assert(reversed != 0);
1099 undoList->
begin(moved,
TL(
"merge junctions"));
1104 for (
const auto& incomingNBEdge : incomingNBEdges) {
1115 for (
const auto& outgoingNBEdge : outgoingNBEdges) {
1133 for (
NBEdge* edge : roundabout) {
1134 if (edge->getFromNode() == junction->
getNBNode()) {
1135 undoList->
begin(junction,
TL(
"select roundabout"));
1136 for (
const auto& roundaboutEdge : roundabout) {
1151 undoList->
begin(junction,
TL(
"create roundabout"));
1165 std::vector<GNEEdge*> edges;
1172 std::reverse(edges.begin(), edges.end());
1174 const double lefthandSign = lefthand ? -1 : 1;
1175 std::vector<GNEJunction*> newJunctions;
1176 GNEEdge* templateEdge =
nullptr;
1177 GNEEdge* prevOpposite =
nullptr;
1179 std::vector<std::pair<NBNode::Crossing, std::vector<std::string>>> oldCrossings;
1181 std::vector<std::string> edgeIDs;
1182 for (
auto e : crossing->getCrossingEdges()) {
1183 edgeIDs.push_back(e->getID());
1185 oldCrossings.push_back(std::make_pair(*crossing->getNBCrossing(), edgeIDs));
1187 std::map<std::string, std::string> edgeRename;
1191 if (edge == prevOpposite) {
1192 newJunction = newJunctions.back();
1195 if (edge->getToJunction() == junction) {
1196 if (templateEdge ==
nullptr) {
1197 templateEdge = edge;
1200 NBEdge* e = edge->getNBEdge();
1204 templateEdge = edge;
1209 prevOpposite = edge->
getOppositeEdges().size() > 0 ? edge->getOppositeEdges().front() :
nullptr;
1210 const double geomLength = edge->getNBEdge()->getGeometry().length2D();
1211 const double splitOffset = (edge->getToJunction() == junction
1212 ?
MAX2(POSITION_EPS, geomLength - radius)
1213 :
MIN2(geomLength - POSITION_EPS, radius));
1214 Position pos = edge->getNBEdge()->getGeometry().positionAtOffset2D(splitOffset);
1215 auto newStuff =
splitEdge(edge, pos, undoList, newJunction);
1216 newJunction = newStuff.first;
1217 if (edge->getFromJunction() == junction) {
1219 edgeRename[newStuff.second->getID()] = edge->
getID();
1221 if (newJunctions.empty() || newJunction != newJunctions.back()) {
1222 newJunctions.push_back(newJunction);
1229 for (
auto item : edgeRename) {
1234 for (
auto nbCItem : oldCrossings) {
1236 nbCItem.first.edges.clear();
1238 for (
const std::string& ce : nbCItem.second) {
1239 bool foundCE =
false;
1240 for (
NBEdge* je : nj->getNBNode()->getEdges()) {
1241 if (je->getID() == ce) {
1243 nbCItem.first.edges.push_back(je);
1251 if (nbCItem.first.edges.size() == nbCItem.second.size()) {
1259 for (
int i = 0; i < (int)newJunctions.size(); i++) {
1260 GNEJunction* from = newJunctions[(i + 1) % newJunctions.size()];
1268 int numSegments =
MAX2(2, (
int)ceil(angleDiff * radius / resolution));
1270 for (
int j = 1; j < numSegments; j++) {
1271 const double angle = angle1 + lefthandSign * j * angleDiff / numSegments;
1272 innerGeom.push_back(center +
Position(cos(angle) * radius, sin(angle) * radius));
1290 if (junction.second->getPositionInView() == pos) {
1304 neteditOptions.set(
"output-file", neteditOptions.getString(
"net-file"));
1305 sumoOptions.resetWritable();
1306 sumoOptions.set(
"net-file", neteditOptions.getString(
"net-file"));
1314 for (
int i = 0; i < (int)edgeType.second->getLaneTypes().size(); i++) {
1316 edgeType.second->getLaneTypes().at(i)->speed,
1317 edgeType.second->getLaneTypes().at(i)->permissions,
1318 edgeType.second->getLaneTypes().at(i)->width,
1319 edgeType.second->getLaneTypes().at(i)->attrs);
1325 sumoOptions.resetWritable();
1326 neteditOptions.resetDefault(
"output-file");
1357 edge.second->updateGeometry();
1362 edge.second->updateCenteringBoundary(
true);
1391 if (volatileOptions) {
1392 window->
setStatusBarText(
TL(
"Forced computing junctions with volatile options ..."));
1400 if (volatileOptions) {
1407 window->getApp()->beginWaitCursor();
1409 if (volatileOptions) {
1422 if (!generalHandler.
parse()) {
1433 if (!generalHandler.
parse()) {
1444 if (!dataHandler.
parse()) {
1455 if (!generalHandler.
parse()) {
1464 window->getApp()->endWaitCursor();
1482 for (
const auto& demandElement : demandElements.second) {
1483 demandElement.second->computePathElement();
1495 for (
const auto& genericData : genericDataTag.second) {
1496 genericData.second->computePathElement();
1511 for (
auto it : tlsDefs) {
1512 it->setParticipantsInformation();
1513 it->setTLControllingInformation();
1548 if (selectedJunctions.size() < 2) {
1553 std::set<NBNode*, ComparatorIdLess> cluster;
1554 for (
const auto& selectedJunction : selectedJunctions) {
1555 cluster.insert(selectedJunction->getNBNode());
1556 const EdgeVector& incoming = selectedJunction->getNBNode()->getIncomingEdges();
1557 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
1558 const EdgeVector& outgoing = selectedJunction->getNBNode()->getOutgoingEdges();
1559 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1565 std::string
id =
"cluster";
1573 if ((junction.second->getPositionInView() == pos) && (cluster.find(junction.second->getNBNode()) == cluster.end())) {
1575 WRITE_DEBUG(
"Opening FXMessageBox 'Join non-selected junction'");
1577 const std::string header =
TL(
"Position of joined junction");
1578 const std::string bodyA =
TL(
"There is another unselected junction in the same position of joined junction.");
1579 const std::string bodyB =
TL(
"It will be joined with the other selected junctions. Continue?");
1580 const auto answer = FXMessageBox::question(
getApp(), MBOX_YES_NO, header.c_str(),
"%s", (bodyA + std::string(
"\n") + bodyB).c_str());
1584 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'No'");
1585 }
else if (answer == 4) {
1586 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'ESC'");
1591 WRITE_DEBUG(
"Closed FXMessageBox 'Join non-selected junction' with 'Yes'");
1600 pos.
setx(pos.
x() + 0.1);
1601 pos.
sety(pos.
y() + 0.1);
1613 std::vector<NBNode::Crossing> oldCrossings;
1614 for (
const auto& selectedJunction : selectedJunctions) {
1615 const auto crossings = selectedJunction->getGNECrossings();
1616 for (
auto crossing : crossings) {
1621 for (
const auto& selectedJunction : selectedJunctions) {
1622 selectedJunction->setLogicValid(
false, undoList);
1625 for (
const auto& incomingEdge : allIncoming) {
1626 if (std::find(allOutgoing.begin(), allOutgoing.end(), incomingEdge) == allOutgoing.end()) {
1631 for (
const auto& outgoingEdge : allOutgoing) {
1635 edgesWithin.insert(outgoingEdge);
1642 for (
const auto& nbc : oldCrossings) {
1644 for (
NBEdge* e : nbc.edges) {
1645 if (edgesWithin.count(e) != 0) {
1653 nbc.customTLIndex, nbc.customTLIndex2, nbc.customShape,
1654 false,
true),
true);
1658 for (
const auto& selectedJunction : selectedJunctions) {
1664 if (pos != oldPos) {
1675 std::vector<GNECrossing*> myNetCrossings;
1677 myNetCrossings.reserve(myNetCrossings.size() + junction.second->getGNECrossings().size());
1678 myNetCrossings.insert(myNetCrossings.end(), junction.second->getGNECrossings().begin(), junction.second->getGNECrossings().end());
1681 std::vector<GNECrossing*> myInvalidCrossings;
1682 for (
auto i = myNetCrossings.begin(); i != myNetCrossings.end(); i++) {
1683 if (!(*i)->getNBCrossing()->valid) {
1684 myInvalidCrossings.push_back(*i);
1688 if (myInvalidCrossings.empty()) {
1690 WRITE_DEBUG(
"Opening FXMessageBox 'No crossing to remove'");
1692 const std::string header =
TL(
"Clear crossings");
1693 const std::string body =
TL(
"There are no invalid crossings to remove.");
1694 FXMessageBox::warning(
getApp(), MBOX_OK, (header).c_str(),
"%s", (body).c_str());
1696 WRITE_DEBUG(
"Closed FXMessageBox 'No crossing to remove' with 'OK'");
1698 std::string plural = myInvalidCrossings.size() == 1 ? (
"") : (
"s");
1700 WRITE_DEBUG(
"Opening FXMessageBox 'clear crossings'");
1702 const std::string header =
TL(
"Clear crossings");
1703 const std::string body =
TL(
"Crossings will be cleared. Continue?");
1704 const auto answer = FXMessageBox::question(
getApp(), MBOX_YES_NO, header.c_str(),
"%s", body.c_str());
1709 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'No'");
1710 }
else if (answer == 4) {
1711 WRITE_DEBUG(
"Closed FXMessageBox 'clear crossings' with 'ESC'");
1715 for (
auto i = myInvalidCrossings.begin(); i != myInvalidCrossings.end(); i++) {
1728 std::vector<GNEJunction*> toRemove;
1730 if (junction.second->getNBNode()->getEdges().size() == 0) {
1731 toRemove.push_back(junction.second);
1734 for (
auto junction : toRemove) {
1744 std::vector<GNEDemandElement*> routesWithoutChildren;
1748 if (route.second->getChildDemandElements().empty()) {
1749 routesWithoutChildren.push_back(route.second);
1753 if (routesWithoutChildren.size() > 0) {
1757 for (
const auto& i : routesWithoutChildren) {
1770 std::set<std::pair<std::string, GNEDemandElement*> > mySortedRoutes;
1774 bool hasStops =
false;
1775 for (
const auto& stop : route.second->getChildDemandElements()) {
1776 if (stop->getTagProperty().isVehicleStop()) {
1785 std::vector<std::vector<GNEDemandElement*> > routesToMerge;
1786 auto index = mySortedRoutes.begin();
1788 for (
auto i = mySortedRoutes.begin(); i != mySortedRoutes.end(); i++) {
1789 if (routesToMerge.empty()) {
1790 routesToMerge.push_back({i->second});
1792 if (index->first == i->first) {
1793 routesToMerge.back().push_back(i->second);
1795 routesToMerge.push_back({i->second});
1801 bool thereIsRoutesToMerge =
false;
1802 for (
const auto& i : routesToMerge) {
1804 thereIsRoutesToMerge =
true;
1808 if (thereIsRoutesToMerge) {
1812 for (
const auto& routes : routesToMerge) {
1813 if (routes.size() > 1) {
1815 for (
int i = 1; i < (int)routes.size(); i++) {
1817 while (routes.at(i)->getChildDemandElements().size() > 0) {
1818 routes.at(i)->getChildDemandElements().front()->setAttribute(
SUMO_ATTR_ROUTE, routes.at(0)->getID(), undoList);
1834 std::map<GNEDemandElement*, std::string> personPlanMap;
1836 for (
const auto& persontag : {
1840 if (person.second->getChildDemandElements().size() > 0) {
1844 while (personPlan) {
1862 if (personPlanMap.size() > 0) {
1866 for (
const auto& personPlan : personPlanMap) {
1879 std::vector<GNEDemandElement*> invalidDemandElements;
1886 invalidDemandElements.push_back(route.second);
1892 invalidDemandElements.push_back(flow.second);
1898 invalidDemandElements.push_back(trip.second);
1902 if (invalidDemandElements.size() > 0) {
1906 for (
const auto& invalidDemandElement : invalidDemandElements) {
1919 undoList->
begin(junction,
TL(
"replace junction by geometry"));
1925 for (
auto j : toJoin) {
1931 for (
auto con : connections) {
1972 if (endpoints.size() < 2) {
1976 undoList->
begin(junction,
TL(
"split junction"));
1978 std::map<GNEEdge*, std::vector<NBEdge::Connection>> straightConnections;
1980 for (
const auto& c : e->getNBEdge()->getConnections()) {
1982 straightConnections[e].push_back(c);
1989 for (
const auto& pair : endpoints) {
1991 const std::string& origID = pair.second;
1993 std::string newID = origID !=
"" ? origID : newJunction->
getID();
2000 if (e->getNBEdge()->getGeometry().back().almostSame(pos) || e->getNBEdge()->getParameter(
"origTo") == newID) {
2007 if (e->getNBEdge()->getGeometry().front().almostSame(pos) || e->getNBEdge()->getParameter(
"origFrom") == newID) {
2012 if (newID != newJunction->
getID()) {
2022 for (
const auto& item : straightConnections) {
2024 std::map<NBEdge*, GNEEdge*> newEdges;
2025 for (
auto& c : item.second) {
2031 if (newEdges.count(c.toEdge) == 0) {
2033 newEdges[c.toEdge] = newEdge;
2036 newEdge = newEdges[c.toEdge];
2058 for (
auto i : connections) {
2067 undoList->
begin(junction,
TL(
"reset junction connections"));
2081 while (additionalMap.second.size() > 0) {
2094 while (demandElementsMap.second.size() > 0) {
2118 while (meanDataMap.second.size() > 0) {
2168 std::vector<GNEAdditional*> invalidSingleLaneAdditionals;
2169 std::vector<GNEAdditional*> invalidMultiLaneAdditionals;
2172 for (
const auto& addditional : additionalPair.second) {
2174 if (addditional.second->getTagProperty().hasAttribute(
SUMO_ATTR_LANE) && !addditional.second->isAdditionalValid()) {
2175 invalidSingleLaneAdditionals.push_back(addditional.second);
2176 }
else if (addditional.second->getTagProperty().hasAttribute(
SUMO_ATTR_LANES) && !addditional.second->isAdditionalValid()) {
2177 invalidMultiLaneAdditionals.push_back(addditional.second);
2182 if (invalidSingleLaneAdditionals.size() > 0 || invalidMultiLaneAdditionals.size() > 0) {
2186 if (fixAdditionalElementsDialog.execute() == 0) {
2225 std::vector<GNEDemandElement*> invalidSingleLaneDemandElements;
2228 for (
const auto& demandElement : demandElementSet.second) {
2230 demandElement.second->computePathElement();
2233 invalidSingleLaneDemandElements.push_back(demandElement.second);
2238 if (invalidSingleLaneDemandElements.size() > 0) {
2242 if (fixDemandElementsDialog.execute() == 0) {
2248 WRITE_DEBUG(
"demand elements saved after dialog");
2275 double minimumBegin = 0;
2282 if (interval.second->getAttributeDouble(
SUMO_ATTR_BEGIN) < minimumBegin) {
2286 return minimumBegin;
2292 double maximumEnd = 0;
2299 if (interval.second->getAttributeDouble(
SUMO_ATTR_END) > maximumEnd) {
2300 maximumEnd = interval.second->getAttributeDouble(
SUMO_ATTR_END);
2389 std::map<double, std::map<std::pair<SumoXMLTag, std::string>,
GNEDemandElement*> > vehiclesSortedByDepart;
2391 for (
const auto& demandElement : demandElementTag.second) {
2392 if (demandElement.second->getTagProperty().isVehicle() || demandElement.second->getTagProperty().isPerson() || demandElement.second->getTagProperty().isContainer()) {
2393 vehiclesSortedByDepart[demandElement.second->getAttributeDouble(
SUMO_ATTR_DEPART)][std::make_pair(demandElement.second->getTagProperty().getTag(), demandElement.second->getID())] = demandElement.second;
2398 if (vehiclesSortedByDepart.size() > 0) {
2399 device << (
" <!-- Vehicles, persons and containers (sorted by depart) -->\n");
2400 for (
const auto& vehicleTag : vehiclesSortedByDepart) {
2401 for (
const auto& vehicle : vehicleTag.second) {
2402 vehicle.second->writeDemandElement(device);
2419 dataSet.second->writeDataSet(device);
2448 std::map<std::string, GNEAdditional*> sortedAdditionals;
2449 for (
const auto& tag : tags) {
2451 if (sortedAdditionals.count(additional.second->getID()) == 0) {
2452 sortedAdditionals[additional.second->getID()] = additional.second;
2458 for (
const auto& additional : sortedAdditionals) {
2459 additional.second->writeAdditional(device);
2466 std::map<std::string, GNEDemandElement*> sortedDemandElements;
2468 sortedDemandElements[demandElement.second->getID()] = demandElement.second;
2470 for (
const auto& demandElement : sortedDemandElements) {
2471 demandElement.second->writeDemandElement(device);
2478 std::map<std::string, GNEDemandElement*> sortedElements;
2483 if ((additionalFile && (numChildren != 0)) || (!additionalFile && (numChildren == 0))) {
2484 sortedElements[routeDistribution.second->getID()] = routeDistribution.second;
2487 for (
const auto& element : sortedElements) {
2488 element.second->writeDemandElement(device);
2490 sortedElements.clear();
2496 std::map<std::string, GNEDemandElement*> sortedRoutes;
2498 if ((additionalFile && (route.second->getChildAdditionals().size() > 0)) ||
2499 (!additionalFile && (route.second->getChildAdditionals().size() == 0))) {
2500 sortedRoutes[route.second->getID()] = route.second;
2503 for (
const auto& route : sortedRoutes) {
2504 route.second->writeDemandElement(device);
2511 std::map<std::string, GNEDemandElement*> sortedElements;
2516 if ((additionalFile && (numChildren != 0)) || (!additionalFile && (numChildren == 0))) {
2517 sortedElements[vTypeDistribution.second->getID()] = vTypeDistribution.second;
2520 for (
const auto& element : sortedElements) {
2521 element.second->writeDemandElement(device);
2523 sortedElements.clear();
2529 std::map<std::string, GNEDemandElement*> sortedElements;
2533 const auto numChildren = vType.second->getChildAdditionals().size();
2534 if ((additionalFile && (numChildren != 0)) || (!additionalFile && (numChildren == 0))) {
2535 sortedElements[vType.second->getID()] = vType.second;
2538 for (
const auto& element : sortedElements) {
2539 element.second->writeDemandElement(device);
2546 std::map<std::string, GNEMeanData*> sortedMeanDatas;
2548 if (sortedMeanDatas.count(meanData.second->getID()) == 0) {
2549 sortedMeanDatas[meanData.second->getID()] = meanData.second;
2554 for (
const auto& additional : sortedMeanDatas) {
2555 additional.second->writeMeanData(device);
2564 const bool defaultVType = GNEAttributeCarrier::parse<bool>(vType.second->getAttribute(
GNE_ATTR_DEFAULT_VTYPE));
2567 if ((vType.second->getParentDemandElements().size() == 0) && (!defaultVType || (defaultVType && defaultVTypeModified))) {
2568 if (additionalFile && (vType.second->getChildAdditionals().size() != 0)) {
2569 device << (
" <!-- VTypes (used in calibratorFlows) -->\n");
2571 }
else if (!additionalFile && (vType.second->getChildAdditionals().size() == 0)) {
2572 device << (
" <!-- VTypes -->\n");
2584 if (additionalFile && (route.second->getChildAdditionals().size() != 0)) {
2585 device << (
" <!-- Routes (used in RouteProbReroutes and calibratorFlows) -->\n");
2587 }
else if (!additionalFile && (route.second->getChildAdditionals().size() == 0)) {
2588 device << (
" <!-- Routes -->\n");
2599 device << (
" <!-- RouteProbes -->\n");
2610 device << (
" <!-- Calibrators -->\n");
2622 device << (
" <!-- StoppingPlaces -->\n");
2634 device << (
" <!-- Detectors -->\n");
2651 device << (
" <!-- Other additionals -->\n");
2664 (additionals.second.size() > 0)) {
2665 device << (
" <!-- Shapes -->\n");
2677 device << (
" <!-- JuPedSim elements -->\n");
2688 device << (
" <!-- TAZs -->\n");
2698 device << (
" <!-- Wires -->\n");
2708 device << (
" <!-- MeanDataEdges -->\n");
2718 device << (
" <!-- MeanDataLanes -->\n");
2729 device.
openTag(
"additionals");
2753 for (
int i = 0; i < (int)edgeType.second->getLaneTypes().size(); i++) {
2755 edgeType.second->getLaneTypes().at(i)->speed,
2756 edgeType.second->getLaneTypes().at(i)->permissions,
2757 edgeType.second->getLaneTypes().at(i)->width,
2758 edgeType.second->getLaneTypes().at(i)->attrs);
2797 dataInterval.second->updateGenericDataIDs();
2798 dataInterval.second->updateAttributeColors();
2841 throw ProcessError(
TL(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.") + std::string(
"\n"));
2850 for (
const auto& lane : edge.second->getLanes()) {
2851 lane->updateGeometry();
2863 edge.second->remakeGNEConnections();
2865 for (
const auto& connection : edge.second->getGNEConnections()) {
2866 connection->updateGeometry();
2875 std::set<std::string> liveExplicitTurnarounds;
2878 liveExplicitTurnarounds.insert(explicitTurnarounds);
2894 if (neteditOptions.
getBool(
"numerical-ids") || neteditOptions.
isSet(
"reserved-ids")) {
2898 if (!neteditOptions.
getBool(
"offset.disable-normalization")) {
2901 edge.second->updateGeometry();
2912 if (volatileOptions) {
2931 WRITE_GLDEBUG(
"initJunctionsAndEdges function called in computeAndUpdate(...) due recomputing with volatile options");
2938 WRITE_GLDEBUG(
"Add junctions during recomputing after calling myNetBuilder->compute(...)");
2941 junction.second->updateCenteringBoundary(
false);
2946 WRITE_GLDEBUG(
"Add edges during recomputing after calling myNetBuilder->compute(...)");
2949 edge.second->updateCenteringBoundary(
false);
2955 edge.second->remakeGNEConnections(
true);
2960 junction.second->setLogicValid(
true,
nullptr);
2962 junction.second->updateGeometryAfterNetbuild();
2964 junction.second->rebuildGNEWalkingAreas();
2969 edge.second->updateGeometry();
2980 std::vector<std::string> values = GNEAttributeCarrier::parse<std::vector<std::string> >(ac->
getAttribute(key));
2981 std::vector<std::string> newValues;
2982 bool lastBy =
false;
2983 for (
auto v : values) {
2984 if (v == which && !lastBy) {
2986 newValues.push_back(by);
2988 newValues.push_back(v);
@ MID_COPY_VIEW_GEOBOUNDARY
Copy view geo-coordinate boundary - popup entry.
@ GLO_NETWORK
The network - empty.
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGE(msg)
#define WRITE_GLDEBUG(msg)
std::set< NBEdge * > EdgeSet
container for unique edges
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_TRACTION_SUBSTATION
A traction substation.
@ SUMO_TAG_REROUTER
A rerouter.
@ GNE_TAG_MULTI_LANE_AREA_DETECTOR
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_ACCESS
An access point for a train stop.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_MEANDATA_LANE
a lane based mean data detector
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
@ SUMO_TAG_OVERHEAD_WIRE_CLAMP
An overhead wire clamp (connection of wires in opposite directions)
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_CONNECTION
connectioon between two lanes
@ SUMO_TAG_PARKING_AREA
A parking area.
@ GNE_TAG_CALIBRATOR_LANE
A calibrator placed over lane.
@ SUMO_TAG_PARKING_SPACE
A parking space for a single vehicle within a parking area.
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_MEANDATA_EDGE
an edge based mean data detector
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_OVERHEAD_WIRE_SECTION
An overhead wire section.
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
@ GNE_TAG_POILANE
Point of interest over Lane.
@ GNE_TAG_JPS_OBSTACLE
polygon used for draw juPedSim obstacles
@ SUMO_TAG_TYPE
type (edge)
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
@ GNE_TAG_JPS_WALKABLEAREA
polygon used for draw juPedSim walkable areas
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_ENTRY_EXIT_DETECTOR
alternative tag for e3 detector
@ SUMO_TAG_VSS
A variable speed sign.
@ GNE_TAG_STOPPERSON_EDGE
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
@ STRAIGHT
The link is a straight direction.
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_OPPOSITE
to busStop (used by personPlans)
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_ADDITIONALCHILDREN
check number of additional children (used in vTypeDistribution)
@ GNE_ATTR_DEFAULT_VTYPE
Flag to check if VType is a default VType.
@ GNE_ATTR_MODIFICATION_STATUS
whether a feature has been loaded,guessed,modified or approved
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_TLTYPE
node: the type of traffic light
@ GNE_ATTR_SHAPE_END
last coordinate of edge shape
@ SUMO_ATTR_END
weights: time range end
@ GNE_ATTR_DEFAULT_VTYPE_MODIFIED
Flag to check if a default VType was modified.
@ GNE_ATTR_SHAPE_START
first coordinate of edge shape
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
void reset()
Resets the boundary.
double getHeight() const
Returns the height of the boundary (y-axis)
double getWidth() const
Returns the width of the boudary (x-axis)
static void drawBoundary(const GUIVisualizationSettings &s, const Boundary &b)
Draw a boundary (used for debugging)
An Element which don't belong to GNENet but has influence in the simulation.
The main window of Netedit.
OptionsCont & getSumoOptions()
get SUMO options container
void setStatusBarText(const std::string &statusBarText)
set text of the statusBar
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void setInGrid(bool value)
const std::string & getTagStr() const
get tag assigned to this object in string format
static const std::string FEATURE_GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
virtual GUIGlObject * getGUIGlObject()=0
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool inGrid() const
check if this AC was inserted in grid
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool isList() const
return true if attribute is a list
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
static void registerJoin(const std::set< NBNode *, ComparatorIdLess > &cluster, NBNodeCont &nc, GNEUndoList *undoList)
change attribute
the function-object for an editing operation (abstract base)
NBConnection getNBConnection() const
get NBConnection
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
GNEJunction * getParentJunction() const
get parent Junction
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
An Element which don't belong to GNENet but has influence in the simulation.
GNEDataSet * getDataSetParent() const
Returns a pointer to GNEDataSet parent.
const std::vector< GNEGenericData * > & getGenericDataChildren() const
get generic data children
const std::map< const double, GNEDataInterval * > & getDataIntervalChildren() const
get data interval children
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
A road/street connecting two junctions (netedit-version)
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
NBEdge * getNBEdge() const
returns the internal NBEdge
GNEEdge * getReverseEdge() const
get reverse edge (if exist)
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
std::vector< GNEEdge * > getOppositeEdges() const
get opposite edges
bool wasSplit()
whether this edge was created from a split
void copyTemplate(const GNEEdgeTemplate *edgeTemplate, GNEUndoList *undoList)
copy edge attributes from edgetemplate
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
std::string getAttribute(SumoXMLAttr key) const
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Dialog for edit rerouters.
Dialog for edit rerouters.
An Element which don't belong to GNENet but has influence in the simulation.
GNEDataInterval * getDataIntervalParent() const
get data interval parent
void addChildElement(T *element)
add child element
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
void clearInspectedAC()
Clear all current inspected ACs.
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
std::string getAttribute(SumoXMLAttr key) const
void replaceIncomingConnections(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replace one edge by another in all tls connections
void markAsModified(GNEUndoList *undoList)
prevent re-guessing connections at this junction
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
std::vector< GNEConnection * > getGNEConnections() const
Returns all GNEConnections vinculated with this junction.
Position getPositionInView() const
Returns position of hierarchical element in view.
void removeConnectionsFrom(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections from the given edge
bool isValid(SumoXMLAttr key, const std::string &value)
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
void removeEdgeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
NBNode * getNBNode() const
Return net build node.
std::vector< GNEJunction * > getJunctionNeighbours() const
return GNEJunction neighbours
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=FEATURE_GUESSED)
void removeConnectionsTo(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections to the given edge
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
int getIndex() const
returns the index of the lane
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
GNEEdge * getParentEdge() const
get parent edge
An Element which don't belong to GNENet but has influence in the simulation.
struct used for saving all attribute carriers of net, in different formats
std::vector< GNEEdge * > retrieveEdges(GNEJunction *from, GNEJunction *to) const
get all edges by from and to GNEJunction
GNEEdgeType * registerEdgeType(GNEEdgeType *edgeType)
registers a edge in containers
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
void clearDemandElements()
clear demand elements
GNEEdge * registerEdge(GNEEdge *edge)
registers an edge with containers
GNECrossing * retrieveCrossing(const GUIGlObject *glObject, bool hardFail=true) const
get Crossing by AC
void remapJunctionAndEdgeIds()
remap junction and edge IDs
const std::map< const GNEAttributeCarrier *, GNEDataInterval * > & getDataIntervals() const
get all data intervals of network
void clearAdditionals()
clear additionals
GNEJunction * registerJunction(GNEJunction *junction)
registers a junction in containers
const std::map< SumoXMLTag, std::map< const GUIGlObject *, GNEAdditional * > > & getAdditionals() const
get additionals
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
const std::map< const std::string, GNEDataSet * > & getDataSets() const
get demand elements
const std::map< std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
void addDefaultVTypes()
add default VTypes
std::vector< GNEJunction * > getSelectedJunctions() const
return selected junctions
const std::map< SumoXMLTag, std::map< const GUIGlObject *, GNEGenericData * > > & getGenericDatas() const
get all generic datas
const std::map< SumoXMLTag, std::map< const std::string, GNEMeanData * > > & getMeanDatas() const
get meanDatas
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
void clearEdges()
clear edges
const std::map< std::string, GNEJunction * > & getJunctions() const
get junctions
const std::map< std::string, GNEEdgeType * > & getEdgeTypes() const
map with the ID and pointer to edgeTypes of net
const std::map< SumoXMLTag, std::map< const GUIGlObject *, GNEDemandElement * > > & getDemandElements() const
get demand elements
void clearJunctions()
clear junctions
GNEConnection * retrieveConnection(const std::string &id, bool hardFail=true) const
get Connection by id
class for GNEChange_ReplaceEdgeInTLS
void dataElementsSaved()
mark demand elements as saved
void demandElementsSaved()
mark demand elements as saved
void additionalsSaved()
mark additionals as saved
void TLSSaved()
mark TLS as saved
void meanDatasSaved()
mark mean data elements as saved
void networkSaved()
mark network as saved
A NBNetBuilder extended by visualisation and editing capabilities.
void clearAdditionalElements(GNEUndoList *undoList)
clear additionals
void removeSolitaryJunctions(GNEUndoList *undoList)
removes junctions that have no edges
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
void writeMeanDatas(OutputDevice &device, SumoXMLTag tag) const
write meanData element by type and sorted by ID
bool joinSelectedJunctions(GNEUndoList *undoList)
join selected junctions
void writeVTypeDistributions(OutputDevice &device, const bool additionalFile) const
write vTypeDistributions sorted by ID
double getDataSetIntervalMaximumEnd() const
get maximum interval
bool writeJuPedSimComment(OutputDevice &device) const
write JuPedSim comment
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
bool writeRouteProbeComment(OutputDevice &device) const
write routeProbe comment
static const double Z_INITIALIZED
marker for whether the z-boundary is initialized
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
SUMORTree & getGrid()
Returns the RTree used for visualisation speed-up.
GNEViewNet * myViewNet
The net to be notified of about changes.
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
void disableUpdateGeometry()
disable update geometry of elements after inserting or removing an element in net
void saveDemandElementsConfirmed()
save demand elements after confirming invalid objects
void saveTLSPrograms(const std::string &filename)
save TLS Programs elements of the network
void computeAndUpdate(OptionsCont &neteditOptions, bool volatileOptions)
recompute the network and update lane geometries
NBNetBuilder * getNetBuilder() const
get net builder
void saveAdditionalsConfirmed()
save additionals after confirming invalid objects
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
bool writeMeanDataLaneComment(OutputDevice &device) const
write Wire comment
void reverseEdge(GNEEdge *edge, GNEUndoList *undoList)
reverse edge
bool writeTAZComment(OutputDevice &device) const
write TAZ comment
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
void saveJoined(const std::string &filename)
save log of joined junctions (and nothing else)
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
bool restrictLane(SUMOVehicleClass vclass, GNELane *lane, GNEUndoList *undoList)
transform lane to restricted lane
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
void setViewNet(GNEViewNet *viewNet)
Set the net to be notified of network changes.
bool writeCalibratorComment(OutputDevice &device) const
write calibrator comment
bool myNeedRecompute
whether the net needs recomputation
void deleteDemandElement(GNEDemandElement *demandElement, GNEUndoList *undoList)
remove demand element
void duplicateLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
duplicates lane
const Boundary & getZBoundary() const
Returns the Z boundary (stored in the x() coordinate) values of 0 do not affect the boundary.
const Boundary & getBoundary() const
returns the bounder of the network
void saveEdgeTypes(const std::string &filename)
save edgeTypes elements of the network
void deleteNetworkElement(GNENetworkElement *networkElement, GNEUndoList *undoList)
delete network element
void saveAdditionals()
save additional elements
SUMORTree myGrid
the rtree which contains all GUIGlObjects (so named for historical reasons)
void writeVTypes(OutputDevice &device, const bool additionalFile) const
write vTypes sorted by ID
void clearDataElements(GNEUndoList *undoList)
clear data elements
void deleteDataInterval(GNEDataInterval *dataInterval, GNEUndoList *undoList)
remove data interval
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
void clearDemandElements(GNEUndoList *undoList)
clear demand elements
bool writeMeanDataEdgeComment(OutputDevice &device) const
write meanDataEdge comment
void adjustPersonPlans(GNEUndoList *undoList)
adjust person plans
void computeNetwork(GNEApplicationWindow *window, bool force=false, bool volatileOptions=false)
trigger full netbuild computation param[in] window The window to inform about delay param[in] force W...
void writeRoutes(OutputDevice &device, const bool additionalFile) const
write route sorted by ID
void cleanInvalidDemandElements(GNEUndoList *undoList)
clean invalid demand elements
bool myUpdateDataEnabled
Flag to enable or disable update data elements after inserting or removing element in net.
void cleanUnusedRoutes(GNEUndoList *undoList)
clean unused routes
NBNetBuilder * myNetBuilder
The internal netbuilder.
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
void computeJunction(GNEJunction *junction)
trigger recomputation of junction shape and logic param[in] window The window to inform about delay
void resetJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
reset junction's connections
void deleteMeanData(GNEMeanData *meanData, GNEUndoList *undoList)
remove generic data
void replaceIncomingEdge(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replaces edge
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void deleteGenericData(GNEGenericData *genericData, GNEUndoList *undoList)
remove generic data
std::pair< GNEJunction *, GNEEdge * > splitEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList, GNEJunction *newJunction=0)
split edge at position by inserting a new junction
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEEdge * addReversedEdge(GNEEdge *edge, const bool disconnected, GNEUndoList *undoList)
add reversed edge
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
bool myUpdateGeometryEnabled
Flag to enable or disable update geometry of elements after inserting or removing element in net.
void initJunctionsAndEdges()
Init Junctions and edges.
bool writeWireComment(OutputDevice &device) const
write Wire comment
void splitEdgesBidi(GNEEdge *edge, GNEEdge *oppositeEdge, const Position &pos, GNEUndoList *undoList)
split all edges at position by inserting one new junction
GNENetHelper::SavingStatus * mySavingStatus
AttributeCarriers of net.
void saveDemandElements()
save demand element elements of the network
void clearMeanDataElements(GNEUndoList *undoList)
clear meanDatas
unsigned int myEdgeIDCounter
void expandBoundary(const Boundary &newBoundary)
expand boundary
void disableUpdateData()
disable update data elements after inserting or removing an element in net
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge *edge, GNEUndoList *undoList)
remove restricted lane
void saveDataElements()
save data set elements of the network
void mergeJunctions(GNEJunction *moved, GNEJunction *target, GNEUndoList *undoList)
merge the given junctions edges between the given junctions will be deleted
GNEEdge * createEdge(GNEJunction *src, GNEJunction *dest, GNEEdge *edgeTemplate, GNEUndoList *undoList, const std::string &suggestedName="", bool wasSplit=false, bool allowDuplicateGeom=false, bool recomputeConnections=true)
creates a new edge (unless an edge with the same geometry already exists)
std::set< std::string > myExplicitTurnarounds
list of edge ids for which turn-arounds must be added explicitly
void saveJuPedSimElements(const std::string &file)
save JuPedSim elements
const std::map< std::string, int > & getEdgesAndNumberOfLanes() const
et edges and number of lanes
bool writeStoppingPlaceComment(OutputDevice &device) const
write stoppingPlace comment
void addZValueInBoundary(const double z)
add Z in net boundary
static const std::map< SumoXMLAttr, std::string > EMPTY_HEADER
variable used for write headers in additional, demand and data elements
void writeRouteDistributions(OutputDevice &device, const bool additionalFile) const
write route distributions sorted by ID
bool isUpdateGeometryEnabled() const
check if update geometry after inserting or removing has to be updated
bool addRestrictedLane(SUMOVehicleClass vclass, GNEEdge *edge, int index, GNEUndoList *undoList)
add restricted lane to edge
void saveNetwork()
save the network
bool checkJunctionPosition(const Position &pos)
return true if there are already a Junction in the given position, false in other case
bool addGreenVergeLane(GNEEdge *edge, int index, GNEUndoList *undoList)
add restricted lane to edge
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
bool isNetRecomputed() const
check if net require recomputing
void writeAdditionalByType(OutputDevice &device, const std::vector< SumoXMLTag > tags) const
write additional element by type and sorted by ID
bool isUpdateDataEnabled() const
check if update data after inserting or removing has to be updated
bool writeShapesComment(OutputDevice &device) const
write shape comment
void deleteDataSet(GNEDataSet *dataSet, GNEUndoList *undoList)
remove data set
static void replaceInListAttribute(GNEAttributeCarrier *ac, SumoXMLAttr key, const std::string &which, const std::string &by, GNEUndoList *undoList)
replace in list attribute
bool cleanInvalidCrossings(GNEUndoList *undoList)
clear invalid crossings
void splitJunction(GNEJunction *junction, bool reconnect, GNEUndoList *undoList)
replace the selected junction by a list of junctions for each unique edge endpoint
void selectRoundabout(GNEJunction *junction, GNEUndoList *undoList)
select all roundabout edges and junctions for the current roundabout
void joinRoutes(GNEUndoList *undoList)
join routes
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool writeRouteComment(OutputDevice &device, const bool additionalFile) const
write route comment
bool writeVTypeComment(OutputDevice &device, const bool additionalFile) const
write vType comment
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
GNEPathManager * myPathManager
Path manager.
bool writeDetectorComment(OutputDevice &device) const
write detector comment
GNEPathManager * getPathManager()
get path manager
void createRoundabout(GNEJunction *junction, GNEUndoList *undoList)
transform the given junction into a roundabout
void writeDemandByType(OutputDevice &device, SumoXMLTag tag) const
write demand element by type and sorted by ID
void requireRecompute()
inform the net about the need for recomputation
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
unsigned int myJunctionIDCounter
bool writeOtherAdditionalsComment(OutputDevice &device) const
write other additional comment
std::map< std::string, int > myEdgesAndNumberOfLanes
map with the Edges and their number of lanes
void saveMeanDatasConfirmed()
save meanDatas
void addExplicitTurnaround(std::string id)
add edge id to the list of explicit turnarounds
void initGNEConnections()
initialize GNEConnections
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
void savePlain(const std::string &prefix)
save plain xml representation of the network (and nothing else)
GNENetHelper::AttributeCarriers * myAttributeCarriers
AttributeCarriers of net.
void computeDataElements(GNEApplicationWindow *window)
compute data elements param[in] window The window to inform about delay
FXApp * getApp()
get pointer to the main App
int getNumberOfTLSPrograms() const
get number of TLS Programs
GNEViewNet * getViewNet() const
get view net
void saveDataElementsConfirmed()
save data elements after confirming invalid objects
void enableUpdateGeometry()
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction's connections
void saveMeanDatas()
save meanData elements of the network
Boundary myZBoundary
the z boundary (stored in the x-coordinate), values of 0 are ignored
double getDataSetIntervalMinimumBegin() const
get minimum interval
void computeDemandElements(GNEApplicationWindow *window)
compute demand elements param[in] window The window to inform about delay
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void updatePathCalculator()
update path calculator (called when SuperModes Demand or Data is selected)
bool isPathCalculatorUpdated() const
check if pathCalculator is updated
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void invalidateJunctionPath(const GNEJunction *junction)
invalidate junction path
void invalidateLanePath(const GNELane *lane)
invalidate lane path
void clearDemandPaths()
clear demand paths
bool isShapeElement() const
return true if tag correspond to a shape
const GNEAttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn't exist)
bool isPlacedInRTree() const
return true if Tag correspond to an element that has to be placed in RTREE
bool isStoppingPlace() const
additional elements
bool isCalibrator() const
return true if tag correspond to a calibrator (Only used to group all detectors in the XML)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isDetector() const
return true if tag correspond to a shape (Only used to group all detectors in the XML)
bool isJuPedSimElement() const
return true if tag correspond to a JuPedSim element
bool isAdditionalPureElement() const
return true if tag correspond to a pure additional element
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
A window containing a gl-object's parameter.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
void destroyPopup()
destroys the popup
Stores the information about how to visualize structures.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
static double angleDiff(const double angle1, const double angle2)
Returns the difference of the second angle to the first angle in radiants.
Storage for edges, including some functionality operating on multiple edges.
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
The representation of a single edge during network building.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
static const double UNSPECIFIED_FRICTION
unspecified lane friction
EdgeBuildingStep getStep() const
The building step of this edge.
bool hasLoadedLength() const
Returns whether a length was set explicitly.
NBNode * getToNode() const
Returns the destination node of the edge.
@ LANES2LANES_RECHECK
Lanes to lanes - relationships are computed; should be rechecked.
int getNumLanes() const
Returns the number of lanes.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
void resetNodeBorder(const NBNode *node)
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
std::string getLaneID(int lane) const
get lane ID
bool hasDefaultGeometryEndpointAtNode(const NBNode *node) const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
int getPriority() const
Returns the priority of the edge.
static const double UNSPECIFIED_WIDTH
unspecified lane width
const std::vector< Connection > & getConnections() const
Returns the connections.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Lane & getLaneStruct(int lane)
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Instance responsible for building networks.
NBTypeCont & getTypeCont()
Returns a reference to the type container.
NBEdgeCont & getEdgeCont()
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
A definition of a pedestrian crossing.
PositionVector customShape
optional customShape for this crossing
int customTLIndex
the custom traffic light index of this crossing (if controlled)
bool priority
whether the pedestrians have priority
EdgeVector edges
The edges being crossed.
double width
This crossing's width.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
std::vector< std::string > getAllNames() const
get all node names
void analyzeCluster(NodeSet cluster, std::string &id, Position &pos, bool &hasTLS, TrafficLightType &type, SumoXMLNodeType &nodeType)
Represents a single node (junction) during network building.
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
static const double UNSPECIFIED_RADIUS
unspecified lane width
std::vector< std::pair< Position, std::string > > getEndPoints() const
return list of unique endpoint coordinates of all edges at this node
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
get edges to join
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node)
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
void updateSurroundingGeometry()
update geometry of node and surrounding edges
const Position & getPosition() const
double getRadius() const
Returns the turning radius of this node.
bool checkIsRemovable() const
check if node is removable
bool isTLControlled() const
Returns whether this node is controlled by any tls.
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node's edges clockwise regarding driving direction.
A container for traffic light definitions and built programs.
bool computeSingleLogic(OptionsCont &oc, NBTrafficLightDefinition *def)
Computes a specific traffic light logic (using by netedit)
void writeEdgeTypes(OutputDevice &into, const std::set< std::string > &typeIDs=std::set< std::string >()) const
writes all EdgeTypes (and their lanes) as XML
void insertEdgeType(const std::string &id, int numLanes, double maxSpeed, int prio, SVCPermissions permissions, LaneSpreadFunction spreadType, double width, bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth, double widthResolution, double maxWidth, double minWidth)
Adds a edgeType into the list.
void clearTypes()
clear types
void insertLaneType(const std::string &edgeTypeID, int index, double maxSpeed, SVCPermissions permissions, double width, const std::set< SumoXMLAttr > &attrs)
Adds a laneType into the list.
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network stored in the given net builder.
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
static void writeJoinedJunctions(const std::string &filename, NBNodeCont &nc)
Writes the joined-juncionts to file.
static void writeNetwork(const OptionsCont &oc, const std::string &prefix, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void resetWritable()
Resets all options to be writeable.
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
void close()
Closes the device and removes it from the dictionary.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
A point in 2D or 3D with translation and scaling methods.
void setx(double x)
set position x
double x() const
Returns the x-position.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position (in radians bet...
void sety(double y)
set position y
double y() const
Returns the y-position.
void append(const PositionVector &v, double sameThreshold=2.0)
double length() const
Returns the length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
std::pair< PositionVector, PositionVector > splitAt(double where, bool use2D=false) const
Returns the two lists made when this list vector is splitted at the given point.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
void push_back_noDoublePos(const Position &p)
insert in back a non double position
PositionVector reverse() const
reverse position vector
A RT-tree for efficient storing of SUMO's GL-objects.
void addAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Adds an additional object (detector/shape/trigger) for visualisation.
void removeAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Removes an additional object (detector/shape/trigger) from being visualised.
static std::string trim(const std::string s, const std::string &t=" \t\n")
remove leading and trailing whitespace
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
A structure which describes a connection between edges or lanes.
An (internal) definition of a single lane of an edge.