From a9ece90febbcf5ea5eaa27cdd2826787b77cf408 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 30 Aug 2024 12:55:19 +0200 Subject: [PATCH 1/3] fix #15317, refs #14470 --- src/netbuild/NBEdgeCont.cpp | 12 ++---------- src/netwrite/NWWriter_SUMO.cpp | 4 +++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/netbuild/NBEdgeCont.cpp b/src/netbuild/NBEdgeCont.cpp index e5c6cbb81905..79862d31f0c9 100644 --- a/src/netbuild/NBEdgeCont.cpp +++ b/src/netbuild/NBEdgeCont.cpp @@ -936,22 +936,14 @@ NBEdgeCont::recheckLanes() { const double startOffset = edge->isBidiRail() ? edge->getTurnDestination(true)->getEndOffset() : 0; int i = 0; for (const NBEdge::Lane& l : edge->getLanes()) { - std::string error; if (startOffset + l.endOffset > edge->getLength()) { - error = TLF("Invalid endOffset % at lane '%' with length % (startOffset %).", + WRITE_WARNINGF(TL("Invalid endOffset % at lane '%' with length % (startOffset %)."), toString(l.endOffset), edge->getLaneID(i), toString(l.shape.length()), toString(startOffset)); } else if (l.speed < 0.) { - error = TLF("Negative allowed speed (%) on lane '%', use --speed.minimum to prevent this.", toString(l.speed), edge->getLaneID(i)); + WRITE_WARNINGF(TL("Negative allowed speed (%) on lane '%', use --speed.minimum to prevent this."), toString(l.speed), edge->getLaneID(i)); } else if (l.speed == 0.) { WRITE_WARNINGF(TL("Lane '%' has a maximum allowed speed of 0."), edge->getLaneID(i)); } - if (!error.empty()) { - if (OptionsCont::getOptions().getBool("ignore-errors")) { - WRITE_ERROR(error); - } else { - throw ProcessError(error); - } - } i++; } } diff --git a/src/netwrite/NWWriter_SUMO.cpp b/src/netwrite/NWWriter_SUMO.cpp index c042d1b8da41..25fef39e8955 100644 --- a/src/netwrite/NWWriter_SUMO.cpp +++ b/src/netwrite/NWWriter_SUMO.cpp @@ -556,7 +556,7 @@ NWWriter_SUMO::writeLane(OutputDevice& into, const std::string& lID, } writePreferences(into, preferred); // some further information - into.writeAttr(SUMO_ATTR_SPEED, speed); + into.writeAttr(SUMO_ATTR_SPEED, MAX2(0.0, speed)); if (friction != NBEdge::UNSPECIFIED_FRICTION) { into.writeAttr(SUMO_ATTR_FRICTION, friction); } @@ -574,6 +574,8 @@ NWWriter_SUMO::writeLane(OutputDevice& into, const std::string& lID, into.writeAttr(SUMO_ATTR_CUSTOMSHAPE, true); } if (endOffset > 0 || startOffset > 0) { + startOffset = MIN2(startOffset, shape.length() - POSITION_EPS); + endOffset = MIN2(endOffset, shape.length() - startOffset - POSITION_EPS); assert(startOffset + endOffset < shape.length()); shape = shape.getSubpart(startOffset, shape.length() - endOffset); } From 8a60ec17ca45b7ff0d6bf79e99262c7c481cffc9 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 30 Aug 2024 12:55:31 +0200 Subject: [PATCH 2/3] patching expected results refs #21, #15317 --- .../bidi_endOffset_invalid/errors.netconvert | 4 +- .../exitcode.netconvert | 1 - .../bidi_endOffset_invalid/net.netconvert | 109 ++++++++++++++++++ .../bidi_endOffset_invalid/output.netconvert | 1 + 4 files changed, 112 insertions(+), 3 deletions(-) delete mode 100644 tests/netconvert/function/railway/bidi_endOffset_invalid/exitcode.netconvert create mode 100644 tests/netconvert/function/railway/bidi_endOffset_invalid/net.netconvert diff --git a/tests/netconvert/function/railway/bidi_endOffset_invalid/errors.netconvert b/tests/netconvert/function/railway/bidi_endOffset_invalid/errors.netconvert index 383a9f0f1035..20feec96afaf 100644 --- a/tests/netconvert/function/railway/bidi_endOffset_invalid/errors.netconvert +++ b/tests/netconvert/function/railway/bidi_endOffset_invalid/errors.netconvert @@ -1,2 +1,2 @@ -Error: Invalid endOffset 0.00 at lane '-gneE0_0' with length 198.12 (startOffset 250.00). -Quitting (on error). +Warning: Invalid endOffset 0.00 at lane '-gneE0_0' with length 198.12 (startOffset 250.00). +Warning: Invalid endOffset 250.00 at lane 'gneE0_0' with length 198.12 (startOffset 0.00). diff --git a/tests/netconvert/function/railway/bidi_endOffset_invalid/exitcode.netconvert b/tests/netconvert/function/railway/bidi_endOffset_invalid/exitcode.netconvert deleted file mode 100644 index d00491fd7e5b..000000000000 --- a/tests/netconvert/function/railway/bidi_endOffset_invalid/exitcode.netconvert +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/netconvert/function/railway/bidi_endOffset_invalid/net.netconvert b/tests/netconvert/function/railway/bidi_endOffset_invalid/net.netconvert new file mode 100644 index 000000000000..7cf3fd265803 --- /dev/null +++ b/tests/netconvert/function/railway/bidi_endOffset_invalid/net.netconvert @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/netconvert/function/railway/bidi_endOffset_invalid/output.netconvert b/tests/netconvert/function/railway/bidi_endOffset_invalid/output.netconvert index e69de29bb2d1..a9d787cc55cb 100644 --- a/tests/netconvert/function/railway/bidi_endOffset_invalid/output.netconvert +++ b/tests/netconvert/function/railway/bidi_endOffset_invalid/output.netconvert @@ -0,0 +1 @@ +Success. From 958c20bdb28e80a8844bfec18d72e907e3bb5455 Mon Sep 17 00:00:00 2001 From: Pablo Alvarez Lopez Date: Fri, 30 Aug 2024 13:22:59 +0200 Subject: [PATCH 3/3] Fixed error creating containers over stops. Refs #15368 --- src/netedit/elements/demand/GNEContainer.cpp | 33 +++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/netedit/elements/demand/GNEContainer.cpp b/src/netedit/elements/demand/GNEContainer.cpp index 4724b1ca6797..4e0a0bcdcf7a 100644 --- a/src/netedit/elements/demand/GNEContainer.cpp +++ b/src/netedit/elements/demand/GNEContainer.cpp @@ -362,7 +362,7 @@ GNEContainer::drawGL(const GUIVisualizationSettings& s) const { // translate and rotate glTranslated(containerPosition.x(), containerPosition.y(), 0); glRotated(90, 0, 0, 1); - // set person color + // set container color GLHelper::setColor(getDrawingColor(s)); // set scale glScaled(exaggeration, exaggeration, 1); @@ -416,11 +416,6 @@ GNEContainer::drawGL(const GUIVisualizationSettings& s) const { } // draw name drawName(containerPosition, s.scale, s.containerName, s.angle); - if (s.personValue.show(this)) { - Position containerValuePosition = containerPosition + Position(0, 0.6 * s.containerName.scaledSize(s.scale)); - const double value = getColorValue(s, s.containerColorer.getActive()); - GLHelper::drawTextSettings(s.personValue, toString(value), containerValuePosition, s.scale, s.angle, GLO_MAX - getType()); - } // draw lock icon GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), getPositionInView(), exaggeration); // draw dotted contour @@ -522,24 +517,24 @@ GNEContainer::getAttributePosition(SumoXMLAttr key) const { if (getChildDemandElements().empty()) { return Position(); } - // get person plan - const GNEDemandElement* personPlan = getChildDemandElements().front(); - // first check if first person plan is a stop - if (personPlan->getTagProperty().isPlanStopPerson()) { + // get container plan + const GNEDemandElement* containerPlan = getChildDemandElements().front(); + // first check if first container plan is a stop + if (containerPlan->getTagProperty().isPlanStopContainer()) { // stop center - return personPlan->getPositionInView(); - } else if (personPlan->getTagProperty().planFromTAZ()) { + return containerPlan->getPositionInView(); + } else if (containerPlan->getTagProperty().planFromTAZ()) { // TAZ - if (personPlan->getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty()) { - return personPlan->getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID); + if (containerPlan->getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty()) { + return containerPlan->getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID); } else { - return personPlan->getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER); + return containerPlan->getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER); } - } else if (personPlan->getTagProperty().planFromJunction()) { + } else if (containerPlan->getTagProperty().planFromJunction()) { // juncrtion - return personPlan->getParentJunctions().front()->getPositionInView(); + return containerPlan->getParentJunctions().front()->getPositionInView(); } else { - return personPlan->getAttributePosition(GNE_ATTR_PLAN_GEOMETRY_STARTPOS); + return containerPlan->getAttributePosition(GNE_ATTR_PLAN_GEOMETRY_STARTPOS); } } default: @@ -703,7 +698,7 @@ GNEContainer::drawAction_drawAsImage(const GUIVisualizationSettings& s) const { //} int textureID = GUITexturesHelper::getTextureID(file); if (textureID > 0) { - const double exaggeration = s.personSize.getExaggeration(s, this); + const double exaggeration = s.containerSize.getExaggeration(s, this); const double halfLength = length / 2.0 * exaggeration; const double halfWidth = width / 2.0 * exaggeration; GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, -halfLength, halfWidth, halfLength);