644 std::vector<GNEConnection*> retrievedConnections;
646 for (
const auto& connection : connections) {
649 if (junctionsReady) {
652 retrievedConnections.push_back(retrievedGNEConnection);
659 retrievedGNEConnection->
incRef(
"GNEEdge::remakeGNEConnections");
667 connection->decRef();
675 if (connection->unreferenced()) {
678 WRITE_DEBUG(
"Deleting unreferenced " + connection->getTagStr() +
" '" + connection->getID() +
"' in rebuildGNEConnections()");
716 std::vector<GNEAdditional*> routeProbes;
719 routeProbes.push_back(i);
723 auto it = std::find(routeProbes.begin(), routeProbes.end(), routeProbe);
724 if (it == routeProbes.end()) {
727 return (
int)(it - routeProbes.begin());
971 const std::string origValue =
myLanes.at(0)->getAttribute(key);
974 it->setAttribute(key, value, undoList);
1040 change->forceChange();
1085 if (updateTemplate) {
1117 return canParse<double>(value) && (parse<double>(value) > 0);
1119 return canParse<double>(value) && (parse<double>(value) > 0);
1121 return canParse<int>(value) && (parse<double>(value) > 0);
1123 return canParse<int>(value);
1125 if (value.empty()) {
1137 return canParse<PositionVector>(value);
1143 if (value.empty() || (value ==
"default")) {
1146 return canParse<double>(value) && ((parse<double>(value) >= -1) || (parse<double>(value) ==
NBEdge::UNSPECIFIED_WIDTH));
1149 return canParse<double>(value) && parse<double>(value) >= 0 && parse<double>(value) <
myNBEdge->
getLoadedLength();
1151 if (value.empty()) {
1154 return canParse<double>(value);
1157 if (value.empty()) {
1159 }
else if (canParse<Position>(value)) {
1160 Position shapeStart = parse<Position>(value);
1167 if (value.empty()) {
1169 }
else if (canParse<Position>(value)) {
1170 Position shapeEnd = parse<Position>(value);
1179 return canParse<int>(value) && (parse<double>(value) >= 0);
1183 return canParse<bool>(value);
1265 const std::map<const GNELane*, std::vector<GNEDemandElement*> > laneVehiclesMap =
getVehiclesOverEdgeMap();
1267 for (
const auto& laneVehicle : laneVehiclesMap) {
1269 double totalLength = 0;
1270 for (
const auto& vehicle : laneVehicle.second) {
1274 double multiplier = 1;
1275 const double laneShapeLength = laneVehicle.first->getLaneShape().length();
1276 if (laneShapeLength == 0) {
1278 }
else if (totalLength > laneShapeLength) {
1279 multiplier = (laneShapeLength / totalLength);
1284 for (
const auto& vehicle : laneVehicle.second) {
1285 vehicle->updateDemandElementSpreadGeometry(laneVehicle.first, length * multiplier);
1296 const std::map<const GNELane*, std::vector<GNEDemandElement*> > laneVehiclesMap =
getVehiclesOverEdgeMap();
1298 for (
const auto& vehicleMap : laneVehiclesMap) {
1300 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosVehicles;
1302 std::vector<GNEEdge::StackDemandElements> stackedVehicles;
1304 for (
const auto& vehicle : vehicleMap.second) {
1310 if (posOverLane < 0) {
1311 posOverLane += vehicleMap.first->getLaneShape().length();
1314 departPosVehicles.push_back(std::make_pair(
StackPosition(departPos, length), vehicle));
1316 vehicle->updateDemandElementGeometry(vehicleMap.first, posOverLane);
1318 vehicle->updateDemandElementStackLabel(0);
1322 std::sort(departPosVehicles.begin(), departPosVehicles.end());
1324 for (
const auto& departPosVehicle : departPosVehicles) {
1329 if (stackedVehicles.empty()) {
1333 stackedVehicles[stackedVehicles.size() - 1].addDemandElements(vehicle);
1340 for (
const auto& vehicle : stackedVehicles) {
1342 if (vehicle.getDemandElements().size() > 1) {
1354 const std::map<const GNELane*, std::vector<GNEDemandElement*> > lanePersonsMap =
getPersonsOverEdgeMap();
1356 for (
const auto& personMap : lanePersonsMap) {
1358 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosPersons;
1360 std::vector<GNEEdge::StackDemandElements> stackedPersons;
1362 for (
const auto& person : personMap.second) {
1366 departPosPersons.push_back(std::make_pair(
StackPosition(departPos, 1.8), person));
1368 person->updateDemandElementGeometry(personMap.first, departPos);
1370 person->updateDemandElementStackLabel(0);
1374 std::sort(departPosPersons.begin(), departPosPersons.end());
1376 for (
const auto& departPosPerson : departPosPersons) {
1381 if (stackedPersons.empty()) {
1385 stackedPersons[stackedPersons.size() - 1].addDemandElements(person);
1392 for (
const auto& person : stackedPersons) {
1394 if (person.getDemandElements().size() > 1) {
1408 for (
const auto& containerMap : laneContainersMap) {
1410 std::vector<std::pair<GNEEdge::StackPosition, GNEDemandElement*> > departPosContainers;
1412 std::vector<GNEEdge::StackDemandElements> stackedContainers;
1414 for (
const auto& container : containerMap.second) {
1418 departPosContainers.push_back(std::make_pair(
StackPosition(departPos, 1.8), container));
1420 container->updateDemandElementGeometry(containerMap.first, departPos);
1422 container->updateDemandElementStackLabel(0);
1426 std::sort(departPosContainers.begin(), departPosContainers.end());
1428 for (
const auto& departPosContainer : departPosContainers) {
1433 if (stackedContainers.empty()) {
1437 stackedContainers[stackedContainers.size() - 1].addDemandElements(container);
1444 for (
const auto& container : stackedContainers) {
1446 if (container.getDemandElements().size() > 1) {
1457 const bool drawFrontExtreme,
const bool drawBackExtreme,
const double exaggeration) {
1458 if (edge->
getLanes().size() == 1) {
1461 laneDrawingConstants.
halfWidth * exaggeration, 1, drawFrontExtreme, drawBackExtreme);
1482 GUIDottedGeometry extremes(s, dottedGeometryTop, drawFrontExtreme, dottedGeometryBot, drawBackExtreme);
1490 dottedGeometryColor.
reset();
1603 if (stop->getTagProperty().isStop() || stop->getTagProperty().isStopPerson()) {
1608 for (
const auto& lane :
myLanes) {
1609 for (
const auto& stop : lane->getChildDemandElements()) {
1610 if (stop->getTagProperty().isStop() || stop->getTagProperty().isStopPerson()) {
1639 throw InvalidArgument(
"GNEEdge::setAttribute (private) called for attr SUMO_ATTR_NUMLANES. This should never happen");
1644 if (value.empty()) {
1672 if (value.empty() || (value ==
"default")) {
1686 if (value.empty()) {
1695 WRITE_DEBUG(
"invalidating (removing) connections of edge '" +
getID() +
"' due it were guessed");
1699 WRITE_DEBUG(
"declaring connections of edge '" +
getID() +
"' as loaded (It will not be removed)");
1709 newShapeStart = parse<Position>(value);
1723 newShapeEnd = parse<Position>(value);
1735 if (parse<bool>(value)) {
1745 if (value.empty()) {
2114#ifdef DEBUG_SMOOTH_GEOM
2116 <<
" forElevation=" << forElevation
2119 <<
" smoothShape old=" << old <<
"\n";
2121 if (old.size() == 3 || old.size() == 4) {
2123 }
else if (old.size() > 4 && !forElevation) {
2125 init.push_back(old[0]);
2126 init.push_back(old[1]);
2127 init.push_back(old[-2]);
2128 init.push_back(old[-1]);
2134 if (incoming.size() == 1) {
2135 begShape = incoming[0]->getGeometry();
2137 assert(incoming.size() == 2);
2140 if (outgoing.size() == 1) {
2141 endShape = outgoing[0]->getGeometry();
2143 assert(outgoing.size() == 2);
2149 init.push_back(old[0]);
2152 init.push_back(old[-1]);
2156 init[1].setz(2 * init[0].z() - begZ);
2157 init[2].setz(2 * init[-1].z() - endZ);
2160 const double straightThresh =
DEG2RAD(neteditOptions.getFloat(
"opendrive-output.straight-threshold"));
2163#ifdef DEBUG_SMOOTH_GEOM
2165 std::cout <<
" begShape=" << begShape <<
" endShape=" << endShape <<
" forElevation=" << forElevation <<
" dist=" << dist <<
" ok=" << ok <<
" init=" << init <<
"\n";
2169 if (init.size() == 0) {
2172 const int numPoints =
MAX2(neteditOptions.getInt(
"junctions.internal-link-detail"),
2173 int(old.
length2D() / neteditOptions.getFloat(
"opendrive.curve-resolution")));
2174 return init.
bezier(numPoints);
2195 if (elevationBase.size() == 0 || elevationBase[-1].z() != pos.z()) {
2196 elevationBase.push_back(pos);
2200 if (elevation.size() <= 2) {
2204 if (modifiedShape.size() < 5) {
2210 for (
int i = 1; i < (int)modifiedShape.size(); ++i) {
2211 seen += modifiedShape[i - 1].distanceTo2D(modifiedShape[i]);
2215 PositionVector innerShape(modifiedShape.begin() + 1, modifiedShape.end() - 1);
2246 std::vector<GNEDemandElement*> vehiclesOverEdge;
2248 std::map<const GNELane*, std::vector<GNEDemandElement*> > vehiclesOverEdgeMap;
2250 std::set<std::pair<double, GNEDemandElement*> > vehicles;
2254 (edgeChild->getParentEdges().front() ==
this)) {
2255 vehicles.insert(std::make_pair(edgeChild->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild));
2256 vehicles.insert(std::make_pair(edgeChild->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild));
2257 }
else if ((edgeChild->getTagProperty().getTag() ==
SUMO_TAG_ROUTE) && (edgeChild->getParentEdges().front() ==
this)) {
2258 for (
const auto& routeChild : edgeChild->getChildDemandElements()) {
2260 vehicles.insert(std::make_pair(routeChild->getAttributeDouble(
SUMO_ATTR_DEPART), routeChild));
2263 }
else if ((edgeChild->getTagProperty().getTag() ==
GNE_TAG_ROUTE_EMBEDDED) && (edgeChild->getParentEdges().front() ==
this)) {
2264 vehicles.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPART), edgeChild->getParentDemandElements().front()));
2268 vehiclesOverEdge.reserve(vehicles.size());
2270 for (
const auto& vehicle : vehicles) {
2272 vehiclesOverEdge.push_back(vehicle.second);
2275 for (
const auto& vehicle : vehiclesOverEdge) {
2276 const GNELane* vehicleLane = vehicle->getFirstPathLane();
2278 vehiclesOverEdgeMap[vehicleLane].push_back(vehicle);
2281 return vehiclesOverEdgeMap;
2288 std::vector<GNEDemandElement*> personsOverEdge;
2290 std::map<const GNELane*, std::vector<GNEDemandElement*> > personsOverEdgeMap;
2292 std::set<std::pair<double, GNEDemandElement*> > persons;
2295 if (edgeChild->getTagProperty().isPersonPlan()) {
2296 persons.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPARTPOS), edgeChild->getParentDemandElements().front()));
2300 personsOverEdge.reserve(persons.size());
2302 for (
const auto& person : persons) {
2304 personsOverEdge.push_back(person.second);
2307 for (
const auto& person : personsOverEdge) {
2308 const GNELane* personLane = person->getFirstPathLane();
2310 personsOverEdgeMap[personLane].push_back(person);
2313 return personsOverEdgeMap;
2321 std::vector<GNEDemandElement*> containersOverEdge;
2323 std::map<const GNELane*, std::vector<GNEDemandElement*> > containersOverEdgeMap;
2325 std::set<std::pair<double, GNEDemandElement*> > containers;
2328 if (edgeChild->getTagProperty().isContainerPlan()) {
2329 containers.insert(std::make_pair(edgeChild->getParentDemandElements().front()->getAttributeDouble(
SUMO_ATTR_DEPARTPOS), edgeChild->getParentDemandElements().front()));
2333 containersOverEdge.reserve(containers.size());
2335 for (
const auto& container : containers) {
2337 containersOverEdge.push_back(container.second);
2340 for (
const auto& container : containersOverEdge) {
2341 const GNELane* containerLane = container->getFirstPathLane();
2342 if (containerLane) {
2343 containersOverEdgeMap[containerLane].push_back(container);
2346 return containersOverEdgeMap;
2353 const bool validScale = (s.
scale > 8.0);
2363 const double circleWidthSquared = circleWidth * circleWidth;
2371 if (geometryPointColor.
alpha() != 0) {
2377 if (bigGeometryPoints) {
2388 if (bigGeometryPoints) {
2396 glTranslated(geometryPointPos.x(), geometryPointPos.y(), 0.1);
2402 glTranslated(0, 0, 0.2);
2411 if (bigGeometryPoints) {
2445 glTranslated(geometryPointPos.x(), geometryPointPos.y(), 0.1);
2455 glTranslated(0, 0, 0.2);
2501 glTranslated(geometryPointPos.x(), geometryPointPos.y(), 0.1);
2511 glTranslated(0, 0, 0.2);
2651 std::vector<GNEAdditional*> TAZSourceSinks;
2656 TAZSourceSinks.push_back(additional);
2659 if (TAZSourceSinks.size() > 0) {
2663 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2664 if (TAZSourceSink == frontAC) {
2668 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2669 if (TAZSourceSink != frontAC) {
2674 bool selected =
false;
2675 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2676 if (TAZSourceSink->isAttributeCarrierSelected()) {
2681 for (
const auto& lane :
myLanes) {
2695 glTranslated(0, 0, 0.1);
2704 lane->getLaneGeometry(), laneDrawingConstants.
halfWidth);
2709 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2710 if (TAZSourceSink == frontAC) {
2714 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2715 if (TAZSourceSink != frontAC) {
2720 for (
const auto& TAZSourceSink : TAZSourceSinks) {
2723 }
else if (TAZSourceSink == frontAC) {
2821 const double squaredSnapRadius = (snapRadius * snapRadius);
2825 const int nearestIndex = originalShape.
indexOfClosest(mousePosition);
2829 std::vector<int> indexes;
2831 if (nearestIndex == -1) {
2836 for (
int i = 1; i <= nearestIndex; i++) {
2837 indexes.push_back(i);
2840 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2844 }
else if (nearestPosition.
distanceSquaredTo2D(shapeToMove[nearestIndex]) <= squaredSnapRadius) {
2845 for (
int i = 1; i <= nearestIndex; i++) {
2846 indexes.push_back(i);
2849 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2852 const int newIndex = shapeToMove.
insertAtClosest(nearestPosition,
true);
2853 for (
int i = 1; i <= newIndex; i++) {
2854 indexes.push_back(i);
2857 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2865 const double squaredSnapRadius = (snapRadius * snapRadius);
2869 const int nearestIndex = originalShape.
indexOfClosest(mousePosition);
2873 std::vector<int> indexes;
2875 if (nearestIndex == -1) {
2880 for (
int i = nearestIndex; i < ((int)originalShape.size() - 1); i++) {
2881 indexes.push_back(i);
2884 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2888 }
else if (nearestPosition.
distanceSquaredTo2D(shapeToMove[nearestIndex]) <= squaredSnapRadius) {
2889 for (
int i = nearestIndex; i < ((int)originalShape.size() - 1); i++) {
2890 indexes.push_back(i);
2893 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);
2896 const int newIndex = shapeToMove.
insertAtClosest(nearestPosition,
true);
2897 for (
int i = newIndex; i < ((int)originalShape.size() - 1); i++) {
2898 indexes.push_back(i);
2901 return new GNEMoveOperation(
this, originalShape, indexes, shapeToMove, indexes);