Skip to content

Commit

Permalink
Merge branch 'main' of github.com:eclipse-sumo/sumo into Netedit_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Aug 30, 2024
2 parents 1acf410 + 958c20b commit 5dcdffa
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 33 deletions.
12 changes: 2 additions & 10 deletions src/netbuild/NBEdgeCont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand Down
33 changes: 14 additions & 19 deletions src/netedit/elements/demand/GNEContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/netwrite/NWWriter_SUMO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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).

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2024-08-30 12:51:13 by Eclipse SUMO netconvert Version v1_20_0+1808-24980b48140
This data file and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v20.html
This file may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License 2.0 are satisfied: GNU General Public License, version 2
or later which is available at
https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
<netconvertConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/netconvertConfiguration.xsd">
<input>
<node-files value="input_plain.nod.xml"/>
<edge-files value="input_plain.edg.xml"/>
</input>
<output>
<write-license value="true"/>
</output>
<report>
<xml-validation value="never"/>
</report>
</netconvertConfiguration>
-->

<net version="1.20" junctionCornerDetail="5" limitTurnSpeed="5.50" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/net_file.xsd">

<location netOffset="0.00,100.00" convBoundary="0.00,0.00,400.00,100.00" origBoundary="-10000000000.00,-10000000000.00,10000000000.00,10000000000.00" projParameter="!"/>

<edge id=":gneJ0_0" function="internal">
<lane id=":gneJ0_0_0" index="0" allow="rail" speed="0.10" length="0.10" shape="0.00,100.00 0.00,100.00"/>
</edge>
<edge id=":gneJ1_0" function="internal" bidi=":gneJ1_3">
<lane id=":gneJ1_0_0" index="0" allow="rail" speed="13.89" length="208.28" shape="208.28,100.00 198.12,100.00 0.00,100.00"/>
</edge>
<edge id=":gneJ1_1" function="internal" bidi=":gneJ1_2">
<lane id=":gneJ1_1_0" index="0" allow="rail" speed="13.89" length="208.31" shape="207.40,96.30 204.77,97.82 202.96,98.99 201.05,99.74 198.12,100.00 0.00,100.00"/>
</edge>
<edge id=":gneJ1_2" function="internal" bidi=":gneJ1_1">
<lane id=":gneJ1_2_0" index="0" allow="rail" speed="13.89" length="208.31" shape="0.00,100.00 198.12,100.00 201.05,99.74 202.96,98.99 204.77,97.82 207.40,96.30"/>
</edge>
<edge id=":gneJ1_3" function="internal" bidi=":gneJ1_0">
<lane id=":gneJ1_3_0" index="0" allow="rail" speed="13.89" length="208.28" shape="0.00,100.00 198.12,100.00 208.28,100.00"/>
</edge>
<edge id=":gneJ2_0" function="internal">
<lane id=":gneJ2_0_0" index="0" allow="rail" speed="0.10" length="0.10" shape="400.00,100.00 400.00,100.00"/>
</edge>
<edge id=":gneJ3_0" function="internal">
<lane id=":gneJ3_0_0" index="0" allow="rail" speed="0.10" length="0.10" shape="400.00,-0.00 400.00,-0.00"/>
</edge>

<edge id="-gneE0" from="gneJ1" to="gneJ0" priority="-1" spreadType="center" bidi="gneE0">
<lane id="-gneE0_0" index="0" allow="rail" speed="13.89" length="0.10" shape="0.10,100.00 0.00,100.00"/>
</edge>
<edge id="-gneE1" from="gneJ2" to="gneJ1" priority="-1" spreadType="center" bidi="gneE1">
<lane id="-gneE1_0" index="0" allow="rail" speed="13.89" length="191.72" shape="400.00,100.00 208.28,100.00"/>
</edge>
<edge id="-gneE2" from="gneJ3" to="gneJ1" priority="-1" spreadType="center" bidi="gneE2">
<lane id="-gneE2_0" index="0" allow="rail" speed="13.89" length="215.33" shape="400.00,-0.00 207.40,96.30"/>
</edge>
<edge id="gneE0" from="gneJ0" to="gneJ1" priority="-1" spreadType="center" bidi="-gneE0">
<lane id="gneE0_0" index="0" allow="rail" speed="13.89" length="0.10" endOffset="250.00" shape="0.00,100.00 0.10,100.00"/>
</edge>
<edge id="gneE1" from="gneJ1" to="gneJ2" priority="-1" spreadType="center" bidi="-gneE1">
<lane id="gneE1_0" index="0" allow="rail" speed="13.89" length="191.72" shape="208.28,100.00 400.00,100.00"/>
</edge>
<edge id="gneE2" from="gneJ1" to="gneJ3" priority="-1" spreadType="center" bidi="-gneE2">
<lane id="gneE2_0" index="0" allow="rail" speed="13.89" length="215.33" shape="207.40,96.30 400.00,-0.00"/>
</edge>

<junction id="gneJ0" type="priority" x="0.00" y="100.00" incLanes="-gneE0_0" intLanes=":gneJ0_0_0" shape="0.00,101.60 0.00,98.40 0.00,101.60 0.00,98.40">
<request index="0" response="0" foes="0" cont="0"/>
</junction>
<junction id="gneJ1" type="rail_signal" x="200.00" y="100.00" incLanes="-gneE1_0 -gneE2_0 gneE0_0" intLanes=":gneJ1_0_0 :gneJ1_1_0 :gneJ1_2_0 :gneJ1_3_0" shape="208.28,101.60 208.28,98.40 208.12,97.73 206.69,94.87 204.94,95.85 203.66,96.70 202.59,97.41 201.48,97.94 200.08,98.28 198.12,98.40 198.12,101.60">
<request index="0" response="0000" foes="0010" cont="0"/>
<request index="1" response="1001" foes="1001" cont="0"/>
<request index="2" response="0000" foes="0000" cont="0"/>
<request index="3" response="0000" foes="0010" cont="0"/>
</junction>
<junction id="gneJ2" type="priority" x="400.00" y="100.00" incLanes="gneE1_0" intLanes=":gneJ2_0_0" shape="400.00,98.40 400.00,101.60 400.00,98.40 400.00,101.60">
<request index="0" response="0" foes="0" cont="0"/>
</junction>
<junction id="gneJ3" type="priority" x="400.00" y="0.00" incLanes="gneE2_0" intLanes=":gneJ3_0_0" shape="399.28,-1.43 400.72,1.43 399.28,-1.43 400.72,1.43">
<request index="0" response="0" foes="0" cont="0"/>
</junction>

<connection from="-gneE0" to="gneE0" fromLane="0" toLane="0" speed="0.10" via=":gneJ0_0_0" dir="t" state="M"/>
<connection from="-gneE1" to="-gneE0" fromLane="0" toLane="0" via=":gneJ1_0_0" tl="gneJ1" linkIndex="0" dir="s" state="O"/>
<connection from="-gneE2" to="-gneE0" fromLane="0" toLane="0" via=":gneJ1_1_0" tl="gneJ1" linkIndex="1" dir="s" state="o"/>
<connection from="gneE0" to="gneE2" fromLane="0" toLane="0" via=":gneJ1_2_0" tl="gneJ1" linkIndex="2" dir="R" state="O"/>
<connection from="gneE0" to="gneE1" fromLane="0" toLane="0" via=":gneJ1_3_0" tl="gneJ1" linkIndex="3" dir="s" state="O"/>
<connection from="gneE1" to="-gneE1" fromLane="0" toLane="0" speed="0.10" via=":gneJ2_0_0" dir="t" state="M"/>
<connection from="gneE2" to="-gneE2" fromLane="0" toLane="0" speed="0.10" via=":gneJ3_0_0" dir="t" state="M"/>

<connection from=":gneJ0_0" to="gneE0" fromLane="0" toLane="0" dir="t" state="M"/>
<connection from=":gneJ1_0" to="-gneE0" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":gneJ1_1" to="-gneE0" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":gneJ1_2" to="gneE2" fromLane="0" toLane="0" dir="R" state="M"/>
<connection from=":gneJ1_3" to="gneE1" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":gneJ2_0" to="-gneE1" fromLane="0" toLane="0" dir="t" state="M"/>
<connection from=":gneJ3_0" to="-gneE2" fromLane="0" toLane="0" dir="t" state="M"/>

</net>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Success.

0 comments on commit 5dcdffa

Please sign in to comment.