Skip to content

Commit

Permalink
Fixed #15929
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2024
1 parent 9857596 commit 74e2499
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/netedit/elements/demand/GNEContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ GNEContainer::drawGL(const GUIVisualizationSettings& s) const {
}
// draw stack label
if (myStackedLabelNumber > 0) {
drawStackLabel(myStackedLabelNumber, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s), false);
drawStackLabel(myStackedLabelNumber, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s));
} else if (getChildDemandElements().front()->getTagProperty().getTag() == GNE_TAG_STOPCONTAINER_CONTAINERSTOP) {
// declare counter for stacked containers over stops
int stackedCounter = 0;
Expand All @@ -409,12 +409,12 @@ GNEContainer::drawGL(const GUIVisualizationSettings& s) const {
}
// if we have more than two stacked elements, draw label
if (stackedCounter > 1) {
drawStackLabel(stackedCounter, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s), false);
drawStackLabel(stackedCounter, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s));
}
}
// draw flow label
if (myTagProperty.isFlow()) {
drawFlowLabel(Position(containerPosition.x() - 1, containerPosition.y() - 4.25), -90, 1.8, 2, getExaggeration(s), false);
drawFlowLabel(Position(containerPosition.x() - 1, containerPosition.y() - 4.25), -90, 1.8, 2, getExaggeration(s));
}
// draw name
drawName(containerPosition, s.scale, s.containerName, s.angle);
Expand Down
10 changes: 3 additions & 7 deletions src/netedit/elements/demand/GNEDemandElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,19 +524,15 @@ GNEDemandElement::drawJunctionLine(const GNEDemandElement* element) const {

void
GNEDemandElement::drawStackLabel(const int number, const std::string& element, const Position& position, const double rotation,
const double width, const double length, const double exaggeration, const bool contour) const {
const double width, const double length, const double exaggeration) const {
// declare contour width
const double contourWidth = (0.05 * exaggeration);
// Push matrix
GLHelper::pushMatrix();
// Traslate to top
glTranslated(position.x(), position.y(), GLO_ROUTE + getType() + 0.1 + GLO_PERSONFLOW);
glTranslated(position.x(), position.y(), GLO_VEHICLELABELS);
glRotated(rotation, 0, 0, -1);
if (contour) {
glTranslated((width * exaggeration * 0.5) + (0.35 * exaggeration) + 0.4, 0, 0);
} else {
glTranslated((width * exaggeration * 0.5) + (0.35 * exaggeration), 0, 0);
}
glTranslated((width * exaggeration * 0.5) + (0.35 * exaggeration) + 0.05, 0, 0);
// draw external box
GLHelper::setColor(RGBColor::GREY);
GLHelper::drawBoxLine(Position(), 0, (length * exaggeration), 0.3 * exaggeration);
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/demand/GNEDemandElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class GNEDemandElement : public GNEPathElement, public GNEHierarchicalElement, p

/// @brief draw stack label
void drawStackLabel(const int number, const std::string& element, const Position& position, const double rotation,
const double width, const double length, const double exaggeration, const bool contour) const;
const double width, const double length, const double exaggeration) const;

/// @name replace parent elements
/// @{
Expand Down
12 changes: 4 additions & 8 deletions src/netedit/elements/demand/GNEDemandElementFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,17 @@ GNEDemandElementFlow::~GNEDemandElementFlow() {}


void
GNEDemandElementFlow::drawFlowLabel(const Position& position, const double rotation, const double width, const double length,
const double exaggeration, const bool contour) const {
GNEDemandElementFlow::drawFlowLabel(const Position& position, const double rotation, const double width,
const double length, const double exaggeration) const {
// declare contour width
const double contourWidth = (0.05 * exaggeration);
// Push matrix
GLHelper::pushMatrix();
// Traslate to bot
glTranslated(position.x(), position.y(), GLO_PERSONFLOW + 0.1);
glTranslated(position.x(), position.y(), GLO_VEHICLELABELS);
// glTranslated(position.x(), position.y(), GLO_ROUTE + getType() + 0.1 + GLO_PERSONFLOW + 0.1);
glRotated(rotation, 0, 0, -1);
if (contour) {
glTranslated(-1 * ((width * 0.5 * exaggeration) + (0.35 * exaggeration)) - 0.4, 0, 0);
} else {
glTranslated(-1 * ((width * 0.5 * exaggeration) + (0.35 * exaggeration)), 0, 0);
}
glTranslated(-1 * ((width * 0.5 * exaggeration) + (0.35 * exaggeration)) - 0.05, 0, 0);
// draw external box
GLHelper::setColor(RGBColor::GREY);
GLHelper::drawBoxLine(Position(), Position(), 0, (length * exaggeration), 0.3 * exaggeration);
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/demand/GNEDemandElementFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class GNEDemandElementFlow : public SUMOVehicleParameter {
~GNEDemandElementFlow();

/// @brief draw flow label
void drawFlowLabel(const Position& position, const double rotation, const double width, const double length,
const double exaggeration, const bool contour) const;
void drawFlowLabel(const Position& position, const double rotation, const double width,
const double length, const double exaggeration) const;

/// @brief write flow attributes
void writeFlowAttributes(const GNEDemandElement* flowElement, OutputDevice& device) const;
Expand Down
6 changes: 3 additions & 3 deletions src/netedit/elements/demand/GNEPerson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ GNEPerson::drawGL(const GUIVisualizationSettings& s) const {
GLHelper::popMatrix();
// draw stack label
if (myStackedLabelNumber > 0) {
drawStackLabel(myStackedLabelNumber, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s), false);
drawStackLabel(myStackedLabelNumber, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
} else if ((getChildDemandElements().front()->getTagProperty().getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
(getChildDemandElements().front()->getTagProperty().getTag() == GNE_TAG_STOPPERSON_TRAINSTOP)) {
// declare counter for stacked persons over stops
Expand All @@ -402,12 +402,12 @@ GNEPerson::drawGL(const GUIVisualizationSettings& s) const {
}
// if we have more than two stacked elements, draw label
if (stackedCounter > 1) {
drawStackLabel(stackedCounter, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s), false);
drawStackLabel(stackedCounter, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
}
}
// draw flow label
if (myTagProperty.isFlow()) {
drawFlowLabel(Position(personPosition.x() - 1, personPosition.y() - 0.25), -90, 1.8, 2, getExaggeration(s), false);
drawFlowLabel(Position(personPosition.x() - 1, personPosition.y() - 0.25), -90, 1.8, 2, getExaggeration(s));
}
// draw lock icon
GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), personPosition, exaggeration, s.dottedContourSettings.segmentWidth);
Expand Down
8 changes: 4 additions & 4 deletions src/netedit/elements/demand/GNEVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,16 +933,16 @@ GNEVehicle::drawGL(const GUIVisualizationSettings& s) const {
}
// draw lock icon
GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), vehiclePosition, exaggeration);
// draw dotted contour
const bool dottedContorDrawn = myVehicleContour.drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
// draw stack label
if ((myStackedLabelNumber > 0) && !drawSpreadVehicles) {
drawStackLabel(myStackedLabelNumber, "Vehicle", vehiclePosition, vehicleRotation, width, length, exaggeration, dottedContorDrawn);
drawStackLabel(myStackedLabelNumber, "Vehicle", vehiclePosition, vehicleRotation, width, length, exaggeration);
}
// draw flow label
if (myTagProperty.isFlow()) {
drawFlowLabel(vehiclePosition, vehicleRotation, width, length, exaggeration, dottedContorDrawn);
drawFlowLabel(vehiclePosition, vehicleRotation, width, length, exaggeration);
}
// draw dotted contour
myVehicleContour.drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
}
// draw squared shape
myVehicleContour.calculateContourRectangleShape(s, d, this, vehiclePosition, length * 0.5, width * 0.5, getType(),
Expand Down
1 change: 1 addition & 0 deletions src/utils/gui/globjects/GUIGlObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ StringBijection<GUIGlObjectType>::Entry GUIGlObject::GUIGlObjectTypeNamesInitial
{"frontElement", GLO_FRONTELEMENT},
{"geometryPoint", GLO_GEOMETRYPOINT},
{"dottedContour", GLO_DOTTEDCONTOUR},
{"vehicleLabels", GLO_VEHICLELABELS},
{"temporalShape", GLO_TEMPORALSHAPE},
{"rectangleSelection", GLO_RECTANGLESELECTION},
{"testElement", GLO_TESTELEMENT},
Expand Down
3 changes: 3 additions & 0 deletions src/utils/gui/globjects/GUIGlObjectTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ enum GUIGlObjectType {
/// @brief dotted contour (used in netedit)
GLO_DOTTEDCONTOUR = 1040,

/// @brief stack and flow labels (used in netedit)
GLO_VEHICLELABELS = 1045,

/// @brief temporal shape (used in netedit)
GLO_TEMPORALSHAPE = 1050,

Expand Down

0 comments on commit 74e2499

Please sign in to comment.