86const
double GNENet::Z_INITIALIZED = 1;
95#pragma warning(disable: 4355)
99 myNetBuilder(netBuilder),
100 myTagPropertiesDatabase(tagPropertiesDatabase),
101 myAttributeCarriers(new
GNENetHelper::AttributeCarriers(this)),
103 mySavingFilesHandler(new
GNENetHelper::SavingFilesHandler(this)),
199const std::map<std::string, int>&
280 const std::string& suggestedName,
bool wasSplit,
bool allowDuplicateGeom,
bool recomputeConnections) {
283 if (outgoingEdge->getToNode() == dest->
getNBNode() && outgoingEdge->getGeometry().size() == 2) {
284 if (!allowDuplicateGeom) {
298 if (oppositeEdges.size() > 0) {
300 if ((oppositeEdges.front()->getID().size() > 1) && (oppositeEdges.front()->getID().front() ==
'-')) {
301 edgeID = oppositeEdges.front()->getID().substr(1);
303 edgeID =
"-" + oppositeEdges.front()->getID();
312 edgeID = edgeID +
toString(counter);
315 edgeID = suggestedName;
316 }
else if (edgeInfix.size() > 0) {
321 edgeID = src->
getID() + edgeInfix + dest->
getID();
338 edge =
new GNEEdge(
this, nbe, wasSplit);
342 double defaultSpeed = neteditOptions.getFloat(
"default.speed");
343 const std::string defaultType = neteditOptions.getString(
"default.type");
344 const int defaultNrLanes = neteditOptions.getInt(
"default.lanenumber");
345 const int defaultPriority = neteditOptions.getInt(
"default.priority");
352 defaultNrLanes, defaultPriority,
353 defaultWidth, defaultOffset, spread);
355 edge =
new GNEEdge(
this, nbe, wasSplit);
358 undoList->
begin(edge,
TL(
"create edge"));
361 if (recomputeConnections) {
431 std::vector<GNECrossing*> crossingsToRemove;
433 for (
const auto& junctionNeighbour : junctionNeighbours) {
435 for (
const auto& crossing : junctionNeighbour->getGNECrossings()) {
438 crossingsToRemove.push_back(crossing);
443 for (
const auto& crossing : crossingsToRemove) {
448 for (
const auto& edge : incidentEdges) {
469 while (lane->getChildAdditionals().size() > 0) {
473 while (lane->getChildDemandElements().size() > 0) {
477 while (lane->getChildGenericDatas().size() > 0) {
497 if (planParent->getChildDemandElements().size() == 1) {
514 if (recomputeConnections) {
530 if (oppLaneID !=
"") {
532 if (lane !=
nullptr) {
547 undoList->
begin(which,
TL(
"replace edge"));
552 std::vector<GNEAdditional*> copyOfLaneAdditionals = lane->getChildAdditionals();
553 for (
const auto& additional : copyOfLaneAdditionals) {
567 std::vector<GNEDemandElement*> copyOfLaneDemandElements = lane->getChildDemandElements();
568 for (
const auto& demandElement : copyOfLaneDemandElements) {
572 std::vector<GNEGenericData*> copyOfLaneGenericDatas = lane->getChildGenericDatas();
573 for (
const auto& demandElement : copyOfLaneGenericDatas) {
643 deleteEdge(edge, undoList, recomputeConnections);
663 if (recomputeConnections) {
672 undoList->
add(
new GNEChange_Lane(edge, lane, laneAttrs,
false, recomputeConnections),
true);
751 throw ProcessError(
TL(
"Trying to delete a default Vehicle Type"));
779 for (
const auto& dataInterval : copyOfDataIntervalChildren) {
792 for (
const auto& genericData : copyOfGenericDataChildren) {
840 undoList->
begin(lane,
TL(
"duplicate lane"));
843 if (recomputeConnections) {
848 undoList->
add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true, recomputeConnections),
true);
856 bool addRestriction =
true;
862 addRestriction =
false;
871 if (addRestriction) {
883 std::vector<GNEConnection*> cons;
893 for (
auto c : cons) {
911 if (lane->isRestricted(vclass)) {
917 if (index > numLanes) {
927 }
else if (vclass ==
SVC_BUS) {
947 if (index > numLanes) {
964 if (lane->isRestricted(vclass)) {
974std::pair<GNEJunction*, GNEEdge*>
977 undoList->
begin(edge,
TL(
"split edge"));
979 if (newJunction ==
nullptr) {
989 std::pair<PositionVector, PositionVector> newGeoms = oldEdgeGeometry.
splitAt(edgeSplitPosition);
990 const double oldLength = oldEdgeGeometry.
length();
991 const double relativeLength1 = oldLength != 0 ? newGeoms.first.length() / oldLength : 1;
992 const double relativeLength2 = oldLength != 0 ? newGeoms.second.length() / oldLength : 1;
1000 const std::string::size_type sep_index = baseName.rfind(
'.');
1002 if (sep_index != std::string::npos) {
1003 std::string posString = baseName.substr(sep_index + 1);
1004 if (GNEAttributeCarrier::canParse<int>(posString.c_str())) {
1006 posBase = GNEAttributeCarrier::parse<int>(posString.c_str());
1007 baseName = baseName.substr(0, sep_index);
1014 undoList, baseName +
toString(posBase + (
int)edgeSplitPosition),
true,
false,
false);
1018 std::vector<NBNode::Crossing> affectedCrossings;
1020 if (crossing->checkEdgeBelong(edge)) {
1026 newEdges.push_back(secondPart->
getNBEdge());
1028 newEdges.push_back(nbEdge);
1031 nbC.
edges = newEdges;
1032 affectedCrossings.push_back(nbC);
1038 newGeoms.first.pop_back();
1039 newGeoms.first.erase(newGeoms.first.begin());
1044 newGeoms.second.pop_back();
1045 newGeoms.second.erase(newGeoms.second.begin());
1055 for (
int i = 0; i < (int)edge->
getChildLanes().size(); ++i) {
1059 for (
const auto& nbC : affectedCrossings) {
1064 for (
const auto& additional : childAdditionals) {
1065 additional->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
1068 for (
int i = 0; i < (int)edge->
getChildLanes().size(); i++) {
1069 for (
const auto& additional : edge->
getChildLanes().at(i)->getChildAdditionals()) {
1075 for (
const auto& demandElement : childDemandElements) {
1076 demandElement->splitEdgeGeometry(edgeSplitPosition, edge, secondPart, undoList);
1079 for (
int i = 0; i < (int)edge->
getChildLanes().size(); i++) {
1080 for (
const auto& demandElement : edge->
getChildLanes().at(i)->getChildDemandElements()) {
1081 demandElement->splitEdgeGeometry(laneSplitPosition, edge->
getChildLanes().at(i), secondPart->
getChildLanes().at(i), undoList);
1087 return std::make_pair(newJunction, secondPart);
1094 undoList->
begin(edge,
TL(
"split edges"));
1096 auto newStuff =
splitEdge(edge, pos, undoList, newJunction);
1097 newJunction = newStuff.first;
1099 splitEdge(oppositeEdge, pos, undoList, newJunction);
1106 if (nbEdge->guessOpposite(
true)) {
1117 undoList->
begin(edge,
TL(
"reverse edge"));
1134 if (reversed !=
nullptr) {
1137 undoList->
begin(edge,
TL(
"add reversed edge"));
1138 if (!disconnected) {
1141 assert(reversed != 0);
1155 reversed =
createEdge(src, dest, edge, undoList,
"-" + edge->
getID(),
false,
true);
1156 assert(reversed != 0);
1171 undoList->
begin(moved,
TL(
"merge junctions"));
1174 for (
const auto& incomingNBEdge : incomingNBEdges) {
1185 for (
const auto& outgoingNBEdge : outgoingNBEdges) {
1203 for (
NBEdge* edge : roundabout) {
1204 if (edge->getFromNode() == junction->
getNBNode()) {
1205 undoList->
begin(junction,
TL(
"select roundabout"));
1206 for (
const auto& roundaboutEdge : roundabout) {
1221 undoList->
begin(junction,
TL(
"create roundabout"));
1235 std::vector<GNEEdge*> edges;
1242 std::reverse(edges.begin(), edges.end());
1244 const double lefthandSign = lefthand ? -1 : 1;
1245 std::vector<GNEJunction*> newJunctions;
1246 GNEEdge* templateEdge =
nullptr;
1247 GNEEdge* prevOpposite =
nullptr;
1249 std::vector<std::pair<NBNode::Crossing, std::vector<std::string>>> oldCrossings;
1251 std::vector<std::string> edgeIDs;
1252 for (
auto e : crossing->getCrossingEdges()) {
1253 edgeIDs.push_back(e->getID());
1255 oldCrossings.push_back(std::make_pair(*crossing->getNBCrossing(), edgeIDs));
1257 std::map<std::string, std::string> edgeRename;
1261 if (edge == prevOpposite) {
1262 newJunction = newJunctions.back();
1265 if (edge->getToJunction() == junction) {
1266 if (templateEdge ==
nullptr) {
1267 templateEdge = edge;
1270 NBEdge* e = edge->getNBEdge();
1274 templateEdge = edge;
1279 prevOpposite = edge->
getOppositeEdges().size() > 0 ? edge->getOppositeEdges().front() :
nullptr;
1280 const double geomLength = edge->getNBEdge()->getGeometry().length2D();
1281 const double splitOffset = (edge->getToJunction() == junction
1282 ?
MAX2(POSITION_EPS, geomLength - radius)
1283 :
MIN2(geomLength - POSITION_EPS, radius));
1284 Position pos = edge->getNBEdge()->getGeometry().positionAtOffset2D(splitOffset);
1285 auto newStuff =
splitEdge(edge, pos, undoList, newJunction);
1286 newJunction = newStuff.first;
1287 if (edge->getFromJunction() == junction) {
1289 edgeRename[newStuff.second->getID()] = edge->
getID();
1291 if (newJunctions.empty() || newJunction != newJunctions.back()) {
1292 newJunctions.push_back(newJunction);
1299 for (
auto item : edgeRename) {
1304 for (
auto nbCItem : oldCrossings) {
1306 nbCItem.first.edges.clear();
1308 for (
const std::string& ce : nbCItem.second) {
1309 bool foundCE =
false;
1310 for (
NBEdge* je : nj->getNBNode()->getEdges()) {
1311 if (je->getID() == ce) {
1313 nbCItem.first.edges.push_back(je);
1321 if (nbCItem.first.edges.size() == nbCItem.second.size()) {
1329 for (
int i = 0; i < (int)newJunctions.size(); i++) {
1330 GNEJunction* from = newJunctions[(i + 1) % newJunctions.size()];
1338 int numSegments =
MAX2(2, (
int)ceil(angleDiff * radius / resolution));
1340 for (
int j = 1; j < numSegments; j++) {
1341 const double angle = angle1 + lefthandSign * j * angleDiff / numSegments;
1342 innerGeom.push_back(center +
Position(cos(angle) * radius, sin(angle) * radius));
1360 if (junction.second->getPositionInView() == pos) {
1373 getApp()->beginWaitCursor();
1376 neteditOptions.set(
"output-file", neteditOptions.getString(
"net-file"));
1377 sumoOptions.resetWritable();
1378 sumoOptions.set(
"net-file", neteditOptions.getString(
"net-file"));
1386 for (
int i = 0; i < (int)edgeType.second->getLaneTypes().size(); i++) {
1388 edgeType.second->getLaneTypes().at(i)->speed,
1389 edgeType.second->getLaneTypes().at(i)->permissions,
1390 edgeType.second->getLaneTypes().at(i)->width,
1391 edgeType.second->getLaneTypes().at(i)->attrs);
1397 sumoOptions.resetWritable();
1398 neteditOptions.resetDefault(
"output-file");
1402 getApp()->endWaitCursor();
1431 edge.second->updateGeometry();
1436 edge.second->updateCenteringBoundary(
true);
1465 if (volatileOptions) {
1466 window->
setStatusBarText(
TL(
"Forced computing junctions with volatile options ..."));
1474 if (volatileOptions) {
1481 getApp()->beginWaitCursor();
1483 if (volatileOptions) {
1495 for (
const auto& file : additionalFiles) {
1499 if (!generalHandler.
parse()) {
1500 WRITE_ERROR(
TL(
"Loading of additional file failed: ") + file);
1502 WRITE_MESSAGE(
TL(
"Loading of additional file successfully: ") + file);
1511 if (!generalHandler.
parse()) {
1522 if (!dataHandler.
parse()) {
1533 if (!generalHandler.
parse()) {
1542 getApp()->endWaitCursor();
1560 for (
const auto& demandElement : demandElements.second) {
1561 demandElement.second->computePathElement();
1573 for (
const auto& genericData : genericDataTag.second) {
1574 genericData.second->computePathElement();
1589 for (
auto it : tlsDefs) {
1590 it->setParticipantsInformation();
1591 it->setTLControllingInformation();
1626 if (selectedJunctions.size() < 2) {
1631 std::set<NBNode*, ComparatorIdLess> cluster;
1632 for (
const auto& selectedJunction : selectedJunctions) {
1633 cluster.insert(selectedJunction->getNBNode());
1634 const EdgeVector& incoming = selectedJunction->getNBNode()->getIncomingEdges();
1635 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
1636 const EdgeVector& outgoing = selectedJunction->getNBNode()->getOutgoingEdges();
1637 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1643 std::string
id =
"cluster";
1651 if ((junction.second->getPositionInView() == pos) && (cluster.find(junction.second->getNBNode()) == cluster.end())) {
1653 const std::string header =
TL(
"Position of joined junction");
1654 const std::string bodyA =
TL(
"There is another unselected junction in the same position of joined junction.");
1655 const std::string bodyB =
TL(
"It will be joined with the other selected junctions. Continue?");
1656 const auto answer = FXMessageBox::question(
getApp(), MBOX_YES_NO, header.c_str(),
"%s", (bodyA + std::string(
"\n") + bodyB).c_str());
1668 pos.
setx(pos.
x() + 0.1);
1669 pos.
sety(pos.
y() + 0.1);
1681 std::vector<NBNode::Crossing> oldCrossings;
1682 for (
const auto& selectedJunction : selectedJunctions) {
1683 const auto crossings = selectedJunction->getGNECrossings();
1684 for (
auto crossing : crossings) {
1689 for (
const auto& selectedJunction : selectedJunctions) {
1690 selectedJunction->setLogicValid(
false, undoList);
1693 for (
const auto& incomingEdge : allIncoming) {
1694 if (std::find(allOutgoing.begin(), allOutgoing.end(), incomingEdge) == allOutgoing.end()) {
1699 for (
const auto& outgoingEdge : allOutgoing) {
1703 edgesWithin.insert(outgoingEdge);
1710 for (
const auto& nbc : oldCrossings) {
1712 for (
NBEdge* e : nbc.edges) {
1713 if (edgesWithin.count(e) != 0) {
1721 nbc.customTLIndex, nbc.customTLIndex2, nbc.customShape,
1722 false,
true),
true);
1726 for (
const auto& selectedJunction : selectedJunctions) {
1732 if (pos != oldPos) {
1743 std::vector<GNECrossing*> myNetCrossings;
1745 myNetCrossings.reserve(myNetCrossings.size() + junction.second->getGNECrossings().size());
1746 myNetCrossings.insert(myNetCrossings.end(), junction.second->getGNECrossings().begin(), junction.second->getGNECrossings().end());
1749 std::vector<GNECrossing*> myInvalidCrossings;
1750 for (
auto i = myNetCrossings.begin(); i != myNetCrossings.end(); i++) {
1751 if (!(*i)->getNBCrossing()->valid) {
1752 myInvalidCrossings.push_back(*i);
1756 if (myInvalidCrossings.empty()) {
1758 const std::string header =
TL(
"Clear crossings");
1759 const std::string body =
TL(
"There are no invalid crossings to remove.");
1760 FXMessageBox::warning(
getApp(), MBOX_OK, (header).c_str(),
"%s", (body).c_str());
1762 std::string plural = myInvalidCrossings.size() == 1 ? (
"") : (
"s");
1764 const std::string header =
TL(
"Clear crossings");
1765 const std::string body =
TL(
"Crossings will be cleared. Continue?");
1766 const auto answer = FXMessageBox::question(
getApp(), MBOX_YES_NO, header.c_str(),
"%s", body.c_str());
1772 for (
auto i = myInvalidCrossings.begin(); i != myInvalidCrossings.end(); i++) {
1785 std::vector<GNEJunction*> toRemove;
1787 if (junction.second->getNBNode()->getEdges().size() == 0) {
1788 toRemove.push_back(junction.second);
1791 for (
auto junction : toRemove) {
1801 std::vector<GNEDemandElement*> routesWithoutChildren;
1805 if (route.second->getChildDemandElements().empty()) {
1806 routesWithoutChildren.push_back(route.second);
1810 if (routesWithoutChildren.size() > 0) {
1814 for (
const auto& i : routesWithoutChildren) {
1827 std::set<std::pair<std::string, GNEDemandElement*> > mySortedRoutes;
1831 bool hasStops =
false;
1832 for (
const auto& stop : route.second->getChildDemandElements()) {
1833 if (stop->getTagProperty()->isVehicleStop()) {
1842 std::vector<std::vector<GNEDemandElement*> > routesToMerge;
1843 auto index = mySortedRoutes.begin();
1845 for (
auto i = mySortedRoutes.begin(); i != mySortedRoutes.end(); i++) {
1846 if (routesToMerge.empty()) {
1847 routesToMerge.push_back({i->second});
1849 if (index->first == i->first) {
1850 routesToMerge.back().push_back(i->second);
1852 routesToMerge.push_back({i->second});
1858 bool thereIsRoutesToMerge =
false;
1859 for (
const auto& i : routesToMerge) {
1861 thereIsRoutesToMerge =
true;
1865 if (thereIsRoutesToMerge) {
1869 for (
const auto& routes : routesToMerge) {
1870 if (routes.size() > 1) {
1872 for (
int i = 1; i < (int)routes.size(); i++) {
1874 while (routes.at(i)->getChildDemandElements().size() > 0) {
1875 routes.at(i)->getChildDemandElements().front()->setAttribute(
SUMO_ATTR_ROUTE, routes.at(0)->getID(), undoList);
1891 std::map<GNEDemandElement*, std::string> personPlanMap;
1893 for (
const auto& persontag : {
1897 if (person.second->getChildDemandElements().size() > 0) {
1901 while (personPlan) {
1919 if (personPlanMap.size() > 0) {
1923 for (
const auto& personPlan : personPlanMap) {
1936 std::vector<GNEDemandElement*> invalidDemandElements;
1943 invalidDemandElements.push_back(route.second);
1949 invalidDemandElements.push_back(flow.second);
1955 invalidDemandElements.push_back(trip.second);
1959 if (invalidDemandElements.size() > 0) {
1963 for (
const auto& invalidDemandElement : invalidDemandElements) {
1976 undoList->
begin(junction,
TL(
"replace junction by geometry"));
1982 for (
auto edgePair : edgesToJoin) {
1988 for (
auto con : connections) {
2020 if (endpoints.size() < 2) {
2024 undoList->
begin(junction,
TL(
"split junction"));
2026 std::map<std::pair<std::string, GNEEdge*>, std::vector<NBEdge::Connection>> straightConnections;
2028 for (
const auto& c : e->getNBEdge()->getConnections()) {
2030 straightConnections[std::make_pair(e->getID(), e)].push_back(c);
2035 for (
const auto& pair : endpoints) {
2037 const std::string& origID = pair.second;
2039 std::string newID = origID !=
"" ? origID : newJunction->
getID();
2046 if (e->getNBEdge()->getGeometry().back().almostSame(pos) || e->getNBEdge()->getParameter(
"origTo") == newID) {
2053 if (e->getNBEdge()->getGeometry().front().almostSame(pos) || e->getNBEdge()->getParameter(
"origFrom") == newID) {
2058 if (newID != newJunction->
getID()) {
2068 for (
const auto& item : straightConnections) {
2069 GNEEdge* in = item.first.second;
2070 std::map<std::pair<std::string, NBEdge*>,
GNEEdge*> newEdges;
2071 for (
auto& c : item.second) {
2077 if (newEdges.count(std::make_pair(c.toEdge->getID(), c.toEdge)) == 0) {
2080 newEdges[std::make_pair(c.toEdge->getID(), c.toEdge)] = newEdge;
2084 newEdge = newEdges[std::make_pair(c.toEdge->getID(), c.toEdge)];
2107 for (
auto i : connections) {
2116 undoList->
begin(junction,
TL(
"reset junction connections"));
2130 while (additionalMap.second.size() > 0) {
2144 while (demandElementsMap.second.size() > 0) {
2151 for (
const auto& type : types) {
2176 while (meanDataMap.second.size() > 0) {
2226 std::vector<GNEAdditional*> invalidSingleLaneAdditionals;
2227 std::vector<GNEAdditional*> invalidMultiLaneAdditionals;
2230 for (
const auto& addditional : additionalPair.second) {
2232 if (addditional.second->getTagProperty()->hasAttribute(
SUMO_ATTR_LANE) && !addditional.second->isAdditionalValid()) {
2233 invalidSingleLaneAdditionals.push_back(addditional.second);
2234 }
else if (addditional.second->getTagProperty()->hasAttribute(
SUMO_ATTR_LANES) && !addditional.second->isAdditionalValid()) {
2235 invalidMultiLaneAdditionals.push_back(addditional.second);
2240 if (invalidSingleLaneAdditionals.size() > 0 || invalidMultiLaneAdditionals.size() > 0) {
2246 if (fixAdditionalElementsDialog.execute() == 0) {
2281 std::vector<GNEDemandElement*> invalidSingleLaneDemandElements;
2284 for (
const auto& demandElement : demandElementSet.second) {
2286 demandElement.second->computePathElement();
2289 invalidSingleLaneDemandElements.push_back(demandElement.second);
2294 if (invalidSingleLaneDemandElements.size() > 0) {
2300 if (fixDemandElementsDialog.execute() == 0) {
2327 double minimumBegin = 0;
2334 if (interval.second->getAttributeDouble(
SUMO_ATTR_BEGIN) < minimumBegin) {
2338 return minimumBegin;
2344 double maximumEnd = 0;
2351 if (interval.second->getAttributeDouble(
SUMO_ATTR_END) > maximumEnd) {
2352 maximumEnd = interval.second->getAttributeDouble(
SUMO_ATTR_END);
2371 getApp()->beginWaitCursor();
2377 for (
const auto& additionalsByFilename : additionalByFilenames) {
2384 writeVTypes(device, additionalsByFilename.second,
true);
2387 writeRoutes(device, additionalsByFilename.second,
true);
2393 writeAdditionalByType(device, additionalsByFilename.second, {SUMO_TAG_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE});
2405 writeAdditionalByType(device, additionalsByFilename.second, {SUMO_TAG_LANE_AREA_DETECTOR, GNE_TAG_MULTI_LANE_AREA_DETECTOR});
2415 writeAdditionalByType(device, additionalsByFilename.second, {SUMO_TAG_POI, GNE_TAG_POILANE, GNE_TAG_POIGEO});
2434 getApp()->endWaitCursor();
2441 getApp()->beginWaitCursor();
2447 for (
const auto& demandByFilename : demandByFilenames) {
2454 writeVTypes(device, demandByFilename.second,
false);
2458 writeRoutes(device, demandByFilename.second,
false);
2461 std::map<double, std::map<std::pair<SumoXMLTag, std::string>,
GNEDemandElement*> > vehiclesSortedByDepart;
2463 for (
const auto& demandElement : demandElementTag.second) {
2464 if (demandElement.second->getTagProperty()->isVehicle() || demandElement.second->getTagProperty()->isPerson() || demandElement.second->getTagProperty()->isContainer()) {
2465 vehiclesSortedByDepart[demandElement.second->getAttributeDouble(
SUMO_ATTR_DEPART)][std::make_pair(demandElement.second->getTagProperty()->getTag(), demandElement.second->getID())] = demandElement.second;
2470 if (vehiclesSortedByDepart.size() > 0) {
2471 device << (
" <!-- Vehicles, persons and containers (sorted by depart) -->\n");
2472 for (
const auto& vehicleTag : vehiclesSortedByDepart) {
2473 for (
const auto& vehicle : vehicleTag.second) {
2474 if (demandByFilename.second.count(vehicle.second) > 0) {
2475 vehicle.second->writeDemandElement(device);
2486 getApp()->endWaitCursor();
2493 getApp()->beginWaitCursor();
2499 for (
const auto& dataByFilename : dataByFilenames) {
2504 if (dataByFilename.second.count(dataSet.second) > 0) {
2505 dataSet.second->writeDataSet(device);
2514 getApp()->endWaitCursor();
2521 getApp()->beginWaitCursor();
2527 for (
const auto& meanDataByFilename : meanDataByFilenames) {
2544 getApp()->endWaitCursor();
2550 const std::vector<SumoXMLTag> tags)
const {
2551 std::map<std::string, std::vector<GNEAdditional*> > sortedAdditionals;
2552 for (
const auto& tag : tags) {
2554 if ((tag ==
SUMO_TAG_VAPORIZER) || (sortedAdditionals.count(additional.second->getID()) == 0)) {
2555 sortedAdditionals[additional.second->getID()].push_back(additional.second);
2561 for (
const auto& additionalVector : sortedAdditionals) {
2562 for (
const auto& additional : additionalVector.second) {
2563 if (ACs.count(additional) > 0) {
2564 additional->writeAdditional(device);
2573 std::map<std::string, GNEDemandElement*> sortedDemandElements;
2575 if (ACs.count(demandElement.second) > 0) {
2576 sortedDemandElements[demandElement.second->getID()] = demandElement.second;
2579 for (
const auto& demandElement : sortedDemandElements) {
2580 demandElement.second->writeDemandElement(device);
2587 std::map<std::string, GNEDemandElement*> sortedElements;
2590 if (ACs.count(routeDistribution.second) > 0) {
2591 sortedElements[routeDistribution.second->getID()] = routeDistribution.second;
2594 for (
const auto& element : sortedElements) {
2595 element.second->writeDemandElement(device);
2597 sortedElements.clear();
2603 std::map<std::string, GNEDemandElement*> sortedRoutes;
2605 if (ACs.count(route.second) > 0) {
2608 for (
const auto vTypeChild : route.second->getChildDemandElements()) {
2615 if ((additionalFile && (route.second->getChildAdditionals().size() > 0)) ||
2616 (!additionalFile && (route.second->getChildAdditionals().size() == 0))) {
2617 sortedRoutes[route.second->getID()] = route.second;
2622 for (
const auto& route : sortedRoutes) {
2623 route.second->writeDemandElement(device);
2630 std::map<std::string, GNEDemandElement*> sortedElements;
2633 if (ACs.count(vTypeDistribution.second) > 0) {
2634 sortedElements[vTypeDistribution.second->getID()] = vTypeDistribution.second;
2637 for (
const auto& element : sortedElements) {
2638 element.second->writeDemandElement(device);
2640 sortedElements.clear();
2646 std::map<std::string, GNEDemandElement*> sortedVTypes;
2648 if (ACs.count(vType.second) > 0) {
2651 for (
const auto vTypeChild : vType.second->getChildDemandElements()) {
2658 if ((additionalFile && (vType.second->getChildAdditionals().size() > 0)) ||
2659 (!additionalFile && (vType.second->getChildAdditionals().size() == 0))) {
2660 sortedVTypes[vType.second->getID()] = vType.second;
2665 for (
const auto& vType : sortedVTypes) {
2666 vType.second->writeDemandElement(device);
2673 std::map<std::string, GNEMeanData*> sortedMeanDatas;
2675 if (ACs.count(meanData.second) > 0) {
2676 if (sortedMeanDatas.count(meanData.second->getID()) == 0) {
2677 sortedMeanDatas[meanData.second->getID()] = meanData.second;
2683 for (
const auto& additional : sortedMeanDatas) {
2684 additional.second->writeMeanData(device);
2693 const bool defaultVType = GNEAttributeCarrier::parse<bool>(vType.second->getAttribute(
GNE_ATTR_DEFAULT_VTYPE));
2696 if ((vType.second->getParentDemandElements().size() == 0) && (!defaultVType || (defaultVType && defaultVTypeModified))) {
2697 if (ACs.count(vType.second) > 0) {
2698 if (additionalFile && (vType.second->getChildAdditionals().size() != 0)) {
2699 device << (
" <!-- VTypes (used in calibratorFlows) -->\n");
2701 }
else if (!additionalFile && (vType.second->getChildAdditionals().size() == 0)) {
2702 device << (
" <!-- VTypes -->\n");
2715 if (ACs.count(route.second) > 0) {
2716 if (additionalFile && (route.second->getChildAdditionals().size() != 0)) {
2717 device << (
" <!-- Routes (used in RouteProbReroutes and calibratorFlows) -->\n");
2719 }
else if (!additionalFile && (route.second->getChildAdditionals().size() == 0)) {
2720 device << (
" <!-- Routes -->\n");
2731 for (
const auto& AC : ACs) {
2733 device << (
" <!-- RouteProbes -->\n");
2743 for (
const auto& AC : ACs) {
2744 if (AC->getTagProperty()->isCalibrator()) {
2745 device << (
" <!-- Calibrators -->\n");
2755 for (
const auto& AC : ACs) {
2756 if (AC->getTagProperty()->isStoppingPlace()) {
2757 device << (
" <!-- StoppingPlaces -->\n");
2767 for (
const auto& AC : ACs) {
2768 if (AC->getTagProperty()->isDetector()) {
2769 device << (
" <!-- Detectors -->\n");
2779 for (
const auto& AC : ACs) {
2780 if (AC->getTagProperty()->isAdditionalPureElement() &&
2781 !AC->getTagProperty()->isStoppingPlace() &&
2782 !AC->getTagProperty()->isDetector() &&
2783 !AC->getTagProperty()->isCalibrator() &&
2787 device << (
" <!-- Other additionals -->\n");
2797 for (
const auto& AC : ACs) {
2798 if (AC->getTagProperty()->isShapeElement() && !AC->getTagProperty()->isJuPedSimElement()) {
2799 device << (
" <!-- Shapes -->\n");
2809 for (
const auto& AC : ACs) {
2810 if (AC->getTagProperty()->isJuPedSimElement()) {
2811 device << (
" <!-- JuPedSim elements -->\n");
2821 for (
const auto& AC : ACs) {
2823 device << (
" <!-- TAZs -->\n");
2833 for (
const auto& AC : ACs) {
2834 if (AC->getTagProperty()->isWireElement()) {
2835 device << (
" <!-- Wires -->\n");
2846 device << (
" <!-- MeanDataEdges -->\n");
2856 device << (
" <!-- MeanDataLanes -->\n");
2867 device.
openTag(
"additionals");
2889 for (
int i = 0; i < (int)edgeType.second->getLaneTypes().size(); i++) {
2891 edgeType.second->getLaneTypes().at(i)->speed,
2892 edgeType.second->getLaneTypes().at(i)->permissions,
2893 edgeType.second->getLaneTypes().at(i)->width,
2894 edgeType.second->getLaneTypes().at(i)->attrs);
2933 dataInterval.second->updateGenericDataIDs();
2934 dataInterval.second->updateAttributeColors();
2989 throw ProcessError(
TL(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.") + std::string(
"\n"));
2998 for (
const auto& lane : edge.second->getChildLanes()) {
2999 lane->updateGeometry();
3011 edge.second->remakeGNEConnections();
3013 for (
const auto& connection : edge.second->getGNEConnections()) {
3014 connection->updateGeometry();
3023 std::set<std::string> liveExplicitTurnarounds;
3026 liveExplicitTurnarounds.insert(explicitTurnarounds);
3040 if (neteditOptions.
getBool(
"numerical-ids") || neteditOptions.
isSet(
"reserved-ids")) {
3044 if (!neteditOptions.
getBool(
"offset.disable-normalization")) {
3047 edge.second->updateGeometry();
3058 if (volatileOptions) {
3084 junction.second->updateCenteringBoundary(
false);
3091 edge.second->updateCenteringBoundary(
false);
3097 edge.second->remakeGNEConnections(
true);
3102 junction.second->setLogicValid(
true,
nullptr);
3104 junction.second->updateGeometryAfterNetbuild();
3106 junction.second->rebuildGNEWalkingAreas();
3111 edge.second->updateGeometry();
3122 std::vector<std::string> values = GNEAttributeCarrier::parse<std::vector<std::string> >(ac->
getAttribute(key));
3123 std::vector<std::string> newValues;
3124 bool lastBy =
false;
3125 for (
auto v : values) {
3126 if (v == which && !lastBy) {
3128 newValues.push_back(by);
3130 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)
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.
@ GNE_TAG_VTYPEREF
reference to a vType (used in VType distributions)
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_ACCESS
An access point for a train stop.
@ SUMO_TAG_MEANDATA_LANE
a lane based mean data detector
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_CONNECTION
connectioon between two lanes
@ 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
description of a route
@ SUMO_TAG_MEANDATA_EDGE
an edge based mean data detector
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ GNE_TAG_JPS_OBSTACLE
polygon used for draw juPedSim obstacles
@ SUMO_TAG_TYPE
type (edge)
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ GNE_TAG_ROUTEREF
virtual element used to reference routes with distributions
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
@ GNE_TAG_JPS_WALKABLEAREA
polygon used for draw juPedSim walkable areas
@ 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_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.
double ymin() const
Returns minimum y-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)
The main window of Netedit.
OptionsCont & getSumoOptions()
get SUMO options container
void setStatusBarText(const std::string &statusBarText)
set text of the statusBar
bool isUndoRedoAllowed() const
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)
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
static const std::string False
true value in string format(used for comparing boolean values in getAttribute(...))
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual GUIGlObject * getGUIGlObject()=0
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...
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
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)
NBEdge * getNBEdge() const
returns the internal NBEdge
GNEEdge * getReverseEdge() const
get reverse edge (if exist)
std::vector< GNEEdge * > getOppositeEdges() const
get opposite edges
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
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
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Dialog for edit rerouters.
Dialog for edit rerouters.
GNEDataInterval * getDataIntervalParent() const
get data interval parent
const GNEHierarchicalContainerChildren< GNEEdge * > & getChildEdges() const
get child edges
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerChildren< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
const GNEHierarchicalContainerChildren< GNEAdditional * > & getChildAdditionals() const
return child additionals
const GNEHierarchicalContainerChildrenSet< GNETAZSourceSink * > & getChildTAZSourceSinks() const
return child TAZSourceSinks (Set)
void addChildElement(ChildType *element)
add child without updating parent (ONLY used if we're creating elements without undo-redo)
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
void clearInspection()
clear inspection
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
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
void buildTemplates()
build templates
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
const std::unordered_map< SumoXMLTag, std::unordered_map< const GUIGlObject *, GNEDemandElement * >, std::hash< int > > & getDemandElements() const
get demand elements
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
const std::unordered_map< SumoXMLTag, std::unordered_map< const GUIGlObject *, GNEGenericData * >, std::hash< int > > & getGenericDatas() const
get all generic datas
GNECrossing * retrieveCrossing(const GUIGlObject *glObject, bool hardFail=true) const
get Crossing by AC
void remapJunctionAndEdgeIds()
remap junction and edge IDs
std::string generateEdgeID() const
generate edge ID
void clearAdditionals()
clear additionals
GNEJunction * registerJunction(GNEJunction *junction)
registers a junction in containers
const std::unordered_map< SumoXMLTag, std::map< const std::string, GNEMeanData * >, std::hash< int > > & getMeanDatas() const
get meanDatas
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
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
const std::unordered_map< const GNEAttributeCarrier *, GNEDataInterval * > & getDataIntervals() const
get all data intervals of network
void clearEdges()
clear edges
const std::map< std::string, GNEJunction * > & getJunctions() const
get junctions
const std::map< std::string, GNEEdgeType * > & getEdgeTypes() const
map with the ID and pointer to edgeTypes of net
void clearJunctions()
clear junctions
const std::unordered_map< SumoXMLTag, std::unordered_map< const GUIGlObject *, GNEAdditional * >, std::hash< int > > & getAdditionals() const
get additionals
GNEConnection * retrieveConnection(const std::string &id, bool hardFail=true) const
get Connection by id
class for GNEChange_ReplaceEdgeInTLS
modul for handling saving files
ACsbyFilename getMeanDatasByFilename()
get meanDatas sorted by filenames (and also clear unused filenames)
ACsbyFilename getDatasByFilename()
get datas sorted by filenames (and also clear unused filenames)
void updateNeteditConfig()
update netedit config
ACsbyFilename getAdditionalsByFilename()
get additionals sorted by filenames (and also clear unused filenames)
ACsbyFilename getDemandsByFilename()
get demands sorted by filenames (and also clear unused filenames)
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
GNEPathManager * myDataPathManager
Data path manager.
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
const GNETagPropertiesDatabase * myTagPropertiesDatabase
pointer to tagProperties database
bool joinSelectedJunctions(GNEUndoList *undoList)
join selected junctions
double getDataSetIntervalMaximumEnd() const
get maximum interval
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
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
bool saveMeanDatas()
save meanData elements of the network
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
GNEPathManager * getDataPathManager()
get data path manager
bool writeMeanDataLaneComment(OutputDevice &device) const
write Wire comment
void reverseEdge(GNEEdge *edge, GNEUndoList *undoList)
reverse edge
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 mergeJunctions(GNEJunction *moved, const GNEJunction *target, GNEUndoList *undoList)
merge the given junctions edges between the given junctions will be deleted
void setViewNet(GNEViewNet *viewNet)
Set the net to be notified of network changes.
bool writeCalibratorComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) 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 writeAdditionalByType(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs, const std::vector< SumoXMLTag > tags) const
write additional element by type and sorted by ID
void saveEdgeTypes(const std::string &filename)
save edgeTypes elements of the network
void deleteNetworkElement(GNENetworkElement *networkElement, GNEUndoList *undoList)
delete network element
SUMORTree myGrid
the rtree which contains all GUIGlObjects (so named for historical reasons)
void clearDataElements(GNEUndoList *undoList)
clear data elements
bool writeDetectorComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write detector comment
void deleteDataInterval(GNEDataInterval *dataInterval, GNEUndoList *undoList)
remove data interval
bool saveDataElements()
save data set elements of the network
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
void clearDemandElements(GNEUndoList *undoList)
clear demand elements
GNEPathManager * getDemandPathManager()
get demand path manager
bool writeMeanDataEdgeComment(OutputDevice &device) const
write meanDataEdge comment
void adjustPersonPlans(GNEUndoList *undoList)
adjust person plans
GNENetHelper::ACTemplate * getACTemplates() const
get all attribute carriers templates used in this net
bool writeShapesComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write shape comment
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 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
bool writeOtherAdditionalsComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write other additional comment
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 writeMeanDatas(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs, SumoXMLTag tag) const
write meanData element by type and sorted by ID
void initJunctionsAndEdges()
Init Junctions and edges.
void splitEdgesBidi(GNEEdge *edge, GNEEdge *oppositeEdge, const Position &pos, GNEUndoList *undoList)
split all edges at position by inserting one new junction
GNENetHelper::SavingStatus * mySavingStatus
saving status module
void clearMeanDataElements(GNEUndoList *undoList)
clear meanDatas
void writeVTypeDistributions(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write vTypeDistributions sorted by ID
unsigned int myEdgeIDCounter
void expandBoundary(const Boundary &newBoundary)
expand boundary
void disableUpdateData()
disable update data elements after inserting or removing an element in net
void writeDemandByType(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs, SumoXMLTag tag) const
write demand element by type and sorted by ID
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge *edge, GNEUndoList *undoList)
remove restricted lane
void deleteTAZSourceSink(GNETAZSourceSink *TAZSourceSink, GNEUndoList *undoList)
remove TAZSourceSink
void writeVTypes(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs, const bool additionalFile) const
write vTypes sorted by ID
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
GNENetHelper::SavingFilesHandler * getSavingFilesHandler() const
get saving files handler
bool saveAdditionals()
save additional elements
const std::map< std::string, int > & getEdgesAndNumberOfLanes() const
et edges and number of lanes
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
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
const GNETagPropertiesDatabase * getTagPropertiesDatabase() const
get tag properties database
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
bool isNetRecomputed() const
check if net require recomputing
GNEPathManager * myNetworkPathManager
Network path manager.
bool isUpdateDataEnabled() const
check if update data after inserting or removing has to be updated
void deleteDataSet(GNEDataSet *dataSet, GNEUndoList *undoList)
remove data set
static void replaceInListAttribute(GNEAttributeCarrier *ac, SumoXMLAttr key, const std::string &which, const std::string &by, GNEUndoList *undoList)
replace in list attribute
bool saveJuPedSimElements(const std::unordered_set< const GNEAttributeCarrier * > &ACs, const std::string &file)
save JuPedSim elements
bool cleanInvalidCrossings(GNEUndoList *undoList)
clear invalid crossings
bool writeStoppingPlaceComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write stoppingPlace comment
GNEPathManager * getNetworkPathManager()
get network path manager
void splitJunction(GNEJunction *junction, bool reconnect, GNEUndoList *undoList)
replace the selected junction by a list of junctions for each unique edge endpoint
void selectRoundabout(GNEJunction *junction, GNEUndoList *undoList)
select all roundabout edges and junctions for the current roundabout
void joinRoutes(GNEUndoList *undoList)
join routes
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void writeRouteDistributions(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write route distributions sorted by ID
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
bool writeRouteComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs, const bool additionalFile) const
write route comment
GNENetHelper::SavingFilesHandler * mySavingFilesHandler
saving files handler module
void createRoundabout(GNEJunction *junction, GNEUndoList *undoList)
transform the given junction into a roundabout
void requireRecompute()
inform the net about the need for recomputation
bool writeJuPedSimComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write JuPedSim comment
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
bool writeRouteProbeComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write routeProbe comment
bool writeTAZComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write TAZ comment
unsigned int myJunctionIDCounter
std::map< std::string, int > myEdgesAndNumberOfLanes
map with the Edges and their number of lanes
GNEPathManager * myDemandPathManager
Demand path manager.
bool writeWireComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs) const
write Wire comment
void writeRoutes(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs, const bool additionalFile) const
write route sorted by ID
bool writeVTypeComment(OutputDevice &device, const std::unordered_set< const GNEAttributeCarrier * > &ACs, const bool additionalFile) const
write vType comment
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
GNENet()=delete
Invalidated default constructor.
void savePlain(const std::string &prefix)
save plain xml representation of the network (and nothing else)
unsigned int & getJunctionIDCounter()
bool saveDemandElements()
save demand element elements of the network
GNENetHelper::AttributeCarriers * myAttributeCarriers
attributeCarriers module
void computeDataElements(GNEApplicationWindow *window)
compute data elements param[in] window The window to inform about delay
FXApp * getApp()
get pointer to the main App
GNENetHelper::ACTemplate * myACTemplates
attributeCarriers templates
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
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
unsigned int & getEdgeIDCounter()
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void updatePathCalculator()
update DijkstraRouter (needed a good calculation of dijkstra path after modifying network)
bool isPathCalculatorUpdated() const
check if pathCalculator is updated
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void invalidateJunctionPath(const GNEJunction *junction)
invalidate junction path
void clearSegments()
clear segments
void invalidateLanePath(const GNELane *lane)
invalidate lane path
bool isPlacedInRTree() const
return true if Tag correspond to an element that has to be placed in RTREE
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const std::vector< const GNEAttributeProperties * > & getAttributeProperties() const
get all attribute properties
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
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
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app, bool addSeparator=true) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
A window containing a gl-object's parameter.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
void destroyPopup()
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...
const Boundary & getConvBoundary() const
Returns the converted boundary.
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.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
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
const std::vector< Connection > & getConnections() const
Returns the connections.
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)
NBNode * getToNode() const
Returns the destination node of the edge.
static const double UNSPECIFIED_FRICTION
unspecified lane friction
Lane & getLaneStruct(int lane)
const PositionVector & getGeometry() const
Returns the geometry of the edge.
EdgeBuildingStep getStep() const
The building step of this edge.
bool hasLoadedLength() const
Returns whether a length was set explicitly.
@ LANES2LANES_RECHECK
Lanes to lanes - relationships are computed; should be rechecked.
int getNumLanes() const
Returns the number of lanes.
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
int getPriority() const
Returns the priority of the edge.
static const double UNSPECIFIED_WIDTH
unspecified lane width
static const double UNSPECIFIED_OFFSET
unspecified lane offset
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.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBEdgeCont & getEdgeCont()
NBTypeCont & getTypeCont()
Returns a reference to the type container.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
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.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
static const double UNSPECIFIED_RADIUS
unspecified lane width
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
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 Position & getPosition() const
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node)
void updateSurroundingGeometry()
update geometry of node and surrounding edges
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
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.
std::vector< std::string > getVector()
return vector of strings
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.