Skip to content

Commit

Permalink
Updated drawDottedContourExtruded(). Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent b9bcb39 commit 5a2e2b9
Show file tree
Hide file tree
Showing 25 changed files with 66 additions and 62 deletions.
6 changes: 4 additions & 2 deletions src/guisim/GUILane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,12 +619,14 @@ GUILane::drawGL(const GUIVisualizationSettings& s) const {
glTranslated(0, 0, .1);
GLHelper::drawBoxLines(shape, getShapeRotations(s2), getShapeLengths(s2), halfInnerFeetWidth);
setColor(s);
GLHelper::drawCrossTies(shape, getShapeRotations(s2), getShapeLengths(s2), 0.26 * exaggeration, 0.6 * exaggeration, halfCrossTieWidth, s.forceDrawForRectangleSelection);
GLHelper::drawCrossTies(shape, getShapeRotations(s2), getShapeLengths(s2), 0.26 * exaggeration, 0.6 * exaggeration,
halfCrossTieWidth, 0, s.forceDrawForRectangleSelection);
}
} else if (isCrossing) {
if (s.drawCrossingsAndWalkingareas && (s.scale > 3.0 || s.junctionSize.minSize == 0)) {
glTranslated(0, 0, .2);
GLHelper::drawCrossTies(baseShape, getShapeRotations(s2), getShapeLengths(s2), 0.5, 1.0, getWidth() * 0.5, s.drawForRectangleSelection);
GLHelper::drawCrossTies(baseShape, getShapeRotations(s2), getShapeLengths(s2), 0.5, 1.0, getWidth() * 0.5,
0, s.drawForRectangleSelection);
glTranslated(0, 0, -.2);
}
} else if (isWalkingArea) {
Expand Down
12 changes: 6 additions & 6 deletions src/netedit/elements/GNEContour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ GNEContour::drawDottedContourClosed(const GUIVisualizationSettings& s, const GUI
void
GNEContour::drawDottedContourExtruded(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const PositionVector& shape, const double extrusionWidth, const double scale, const bool drawFirstExtrem,
const bool drawLastExtrem, const double lineWidth) const {
const bool drawLastExtrem, const double offset, const double lineWidth) const {
// check if mouse is within two lines (only in rectangle selection mode)
if (s.drawForObjectUnderCursor) {
// first build dotted contour
const auto extrudedShape = buildDottedContourExtruded(s, shape, extrusionWidth, scale, drawFirstExtrem, drawLastExtrem);
const auto extrudedShape = buildDottedContourExtruded(s, shape, extrusionWidth, scale, drawFirstExtrem, drawLastExtrem, offset);
gPostDrawing.positionWithinShape(myAC->getGUIGlObject(), myAC->getNet()->getViewNet()->getPositionInformation(), extrudedShape);
} else {
drawDottedContours(s, d, scale, true, lineWidth);
Expand Down Expand Up @@ -203,16 +203,16 @@ GNEContour::buildDottedContourClosed(const GUIVisualizationSettings& s, const Po


PositionVector
GNEContour::buildDottedContourExtruded(const GUIVisualizationSettings& s, const PositionVector& shape, const double extrusionWidth, const double scale,
const bool drawFirstExtrem, const bool drawLastExtrem) const {
GNEContour::buildDottedContourExtruded(const GUIVisualizationSettings& s, const PositionVector& shape, const double extrusionWidth,
const double scale, const bool drawFirstExtrem, const bool drawLastExtrem, const double offset) const {
// check dotted caches
checkDottedCaches(4);
// create top and bot geometries
myDottedGeometries->at(0) = GUIDottedGeometry(s, shape, false, true);
myDottedGeometries->at(2) = GUIDottedGeometry(s, shape.reverse(), false, true);
// move geometries top and bot
myDottedGeometries->at(0).moveShapeToSide(extrusionWidth * scale * -1);
myDottedGeometries->at(2).moveShapeToSide(extrusionWidth * scale * -1);
myDottedGeometries->at(0).moveShapeToSide((extrusionWidth * scale * -1) - offset);
myDottedGeometries->at(2).moveShapeToSide((extrusionWidth * scale * -1) - offset);
// create left and right geometries
if (drawFirstExtrem) {
myDottedGeometries->at(3) = GUIDottedGeometry(s, {
Expand Down
5 changes: 3 additions & 2 deletions src/netedit/elements/GNEContour.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class GNEContour {
/// @brief draw dotted contour extruded (used in elements formed by a central shape)
void drawDottedContourExtruded(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const PositionVector& shape, const double extrusionWidth, const double scale,
const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth) const;
const bool drawFirstExtrem, const bool drawLastExtrem, const double offset,
const double lineWidth) const;

/// @brief draw dotted contour (for rectangled elements)
void drawDottedContourRectangle(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
Expand Down Expand Up @@ -108,7 +109,7 @@ class GNEContour {

/// @brief build and draw dotted contour extruded
PositionVector buildDottedContourExtruded(const GUIVisualizationSettings& s, const PositionVector& shape, const double extrusionWidth,
const double scale, const bool drawFirstExtrem, const bool drawLastExtrem) const;
const double scale, const bool drawFirstExtrem, const bool drawLastExtrem, const double offset) const;

/// @brief build dotted contour rectangle
PositionVector buildDottedContourRectangle(const GUIVisualizationSettings& s, const Position& pos, const double width, const double height,
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEBusStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ GNEBusStop::drawGL(const GUIVisualizationSettings& s) const {
// draw stoppingPlace children
drawStoppingPlaceChildren(s);
// draw dotted geometry (don't exaggerate contour)
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), stopWidth, 1, true, true,
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), stopWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEChargingStation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ GNEChargingStation::drawGL(const GUIVisualizationSettings& s) const {
// draw stoppingPlace children
drawStoppingPlaceChildren(s);
// draw dotted geometry (don't exaggerate contour)
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), s.stoppingPlaceSettings.chargingStationWidth, 1, true, true,
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), s.stoppingPlaceSettings.chargingStationWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEContainerStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ GNEContainerStop::drawGL(const GUIVisualizationSettings& s) const {
}
}
// draw dotted geometry (don't exaggerate contour)
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), s.stoppingPlaceSettings.containerStopWidth, 1, true, true,
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), s.stoppingPlaceSettings.containerStopWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/netedit/elements/additional/GNELaneAreaDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ GNELaneAreaDetector::drawGL(const GUIVisualizationSettings& s) const {
drawAdditionalName(s);
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), s.detectorSettings.E2Width, E2Exaggeration, true, true,
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), s.detectorSettings.E2Width, E2Exaggeration, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down Expand Up @@ -426,7 +426,7 @@ GNELaneAreaDetector::drawLanePartialGL(const GUIVisualizationSettings& s, const
}
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, E2Geometry.getShape(), E2DetectorWidth, 1, segment->isFirstSegment(), segment->isLastSegment(),
myContour.drawDottedContourExtruded(s, d, E2Geometry.getShape(), E2DetectorWidth, 1, segment->isFirstSegment(), segment->isLastSegment(), 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down Expand Up @@ -467,7 +467,7 @@ GNELaneAreaDetector::drawJunctionPartialGL(const GUIVisualizationSettings& s, co
}
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, connectionGeometry.getShape(), E2DetectorWidth, 1, false, false,
myContour.drawDottedContourExtruded(s, d, connectionGeometry.getShape(), E2DetectorWidth, 1, false, false, 0,
s.dottedContourSettings.segmentWidth);
} else {
// Set invalid person plan color
Expand All @@ -485,7 +485,7 @@ GNELaneAreaDetector::drawJunctionPartialGL(const GUIVisualizationSettings& s, co
}
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, invalidGeometry.getShape(), E2DetectorWidth, 1, false, false,
myContour.drawDottedContourExtruded(s, d, invalidGeometry.getShape(), E2DetectorWidth, 1, false, false, 0,
s.dottedContourSettings.segmentWidth);
}
// Pop last matrix
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEOverheadWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ GNEOverheadWire::drawLanePartialGL(const GUIVisualizationSettings& s, const GNEP
// declare trim geometry to draw
const auto shape = (segment->isFirstSegment() || segment->isLastSegment()) ? overheadWireGeometry.getShape() : segment->getLane()->getLaneShape();
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, shape, overheadWireWidth, 1, true, true,
myContour.drawDottedContourExtruded(s, d, shape, overheadWireWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down Expand Up @@ -354,7 +354,7 @@ GNEOverheadWire::drawJunctionPartialGL(const GUIVisualizationSettings& s, const
// get shape
const auto& shape = segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane()).getShape();
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, shape, overheadWireWidth, 1, true, true,
myContour.drawDottedContourExtruded(s, d, shape, overheadWireWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEParkingArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ GNEParkingArea::drawGL(const GUIVisualizationSettings& s) const {
// draw stoppingPlace children
drawStoppingPlaceChildren(s);
// draw dotted geometry (don't exaggerate contour)
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), myWidth * 0.5, 1, true, true,
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), myWidth * 0.5, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEParkingSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ GNEParkingSpace::drawGL(const GUIVisualizationSettings& s) const {
drawAdditionalName(s);
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myShapeLength, width, parkingAreaExaggeration, true, true,
myContour.drawDottedContourExtruded(s, d, myShapeLength, width, parkingAreaExaggeration, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEPoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ GNEPoly::drawGL(const GUIVisualizationSettings& s) const {
} else {
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myPolygonGeometry.getShape(), s.neteditSizeSettings.polylineWidth,
polyExaggeration, true, true, s.dottedContourSettings.segmentWidth);
polyExaggeration, true, true, 0, s.dottedContourSettings.segmentWidth);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNERouteProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ GNERouteProbe::drawGL(const GUIVisualizationSettings& s) const {
drawAdditionalName(s);
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), 0.5, routeProbeExaggeration, true, true,
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), 0.5, routeProbeExaggeration, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEVaporizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ GNEVaporizer::drawGL(const GUIVisualizationSettings& s) const {
drawAdditionalName(s);
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), 0.5, vaporizerExaggeration, true, true,
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), 0.5, vaporizerExaggeration, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/data/GNETAZRelData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ GNETAZRelData::drawGL(const GUIVisualizationSettings& s) const {
}
if (myNet->getViewNet()->getDataViewOptions().TAZRelDrawing()) {
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myTAZRelGeometryCenter.getShape(), 0.5, 1, true, true,
myContour.drawDottedContourExtruded(s, d, myTAZRelGeometryCenter.getShape(), 0.5, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
} else {
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myTAZRelGeometry.getShape(), 0.5, 1, true, true,
myContour.drawDottedContourExtruded(s, d, myTAZRelGeometry.getShape(), 0.5, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/netedit/elements/demand/GNEDemandElementPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ GNEDemandElementPlan::drawPlanGL(const bool drawPlan, const GUIVisualizationSett
GLHelper::popMatrix();
}
// draw dotted geometry
myPlanElement->getContour().drawDottedContourExtruded(s, d, planGeometry.getShape(), pathWidth, 1, true, true,
myPlanElement->getContour().drawDottedContourExtruded(s, d, planGeometry.getShape(), pathWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
// check if draw plan parent
Expand Down Expand Up @@ -1206,10 +1206,10 @@ GNEDemandElementPlan::drawPlanLanePartial(const bool drawPlan, const GUIVisualiz
const auto shape = (segment->isFirstSegment() || segment->isLastSegment()) ? planGeometry.getShape() : segment->getLane()->getLaneShape();
// draw dotted geometry
if (duplicateWidth) {
myPlanElement->getContour().drawDottedContourExtruded(s, d, shape, pathWidth, 1, true, true,
myPlanElement->getContour().drawDottedContourExtruded(s, d, shape, pathWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
} else {
myPlanElement->getContour().drawDottedContourExtruded(s, d, shape, pathWidth, 1, true, true,
myPlanElement->getContour().drawDottedContourExtruded(s, d, shape, pathWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidthSmall);
}
}
Expand Down Expand Up @@ -1276,19 +1276,19 @@ GNEDemandElementPlan::drawPlanJunctionPartial(const bool drawPlan, const GUIVisu
const auto& shape = segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane()).getShape();
// draw dotted geometry
if (duplicateWidth) {
myPlanElement->getContour().drawDottedContourExtruded(s, d, shape, pathWidth, 1, true, true,
myPlanElement->getContour().drawDottedContourExtruded(s, d, shape, pathWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
} else {
myPlanElement->getContour().drawDottedContourExtruded(s, d, shape, pathWidth, 1, true, true,
myPlanElement->getContour().drawDottedContourExtruded(s, d, shape, pathWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidthSmall);
}
}
} else if (segment->getPreviousLane()) {
myPlanElement->getContour().drawDottedContourExtruded(s, d, {segment->getPreviousLane()->getLaneShape().back(), myPlanElement->getParentJunctions().back()->getPositionInView()},
pathWidth, 1, true, true, s.dottedContourSettings.segmentWidth);
pathWidth, 1, true, true, 0, s.dottedContourSettings.segmentWidth);
} else if (segment->getNextLane()) {
myPlanElement->getContour().drawDottedContourExtruded(s, d, {myPlanElement->getParentJunctions().front()->getPositionInView(), segment->getNextLane()->getLaneShape().front()},
pathWidth, 1, true, true, s.dottedContourSettings.segmentWidth);
pathWidth, 1, true, true, 0, s.dottedContourSettings.segmentWidth);
}
}
// check if draw plan parent
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/demand/GNERoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ GNERoute::drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathMana
}
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, routeGeometry.getShape(), routeWidth, 1, segment->isFirstSegment(), segment->isLastSegment(),
myContour.drawDottedContourExtruded(s, d, routeGeometry.getShape(), routeWidth, 1, segment->isFirstSegment(), segment->isLastSegment(), 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down Expand Up @@ -551,7 +551,7 @@ GNERoute::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPath
}
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, geometry.getShape(), routeWidth, 1, false, false,
myContour.drawDottedContourExtruded(s, d, geometry.getShape(), routeWidth, 1, false, false, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/demand/GNEStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ GNEStop::drawGL(const GUIVisualizationSettings& s) const {
drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myDemandElementGeometry.getShape(), width, exaggeration, true, true,
myContour.drawDottedContourExtruded(s, d, myDemandElementGeometry.getShape(), width, exaggeration, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/demand/GNEStopPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ GNEStopPlan::drawStopOverEdge(const GUIVisualizationSettings& s, const GUIVisual
GNEViewNetHelper::LockIcon::drawLockIcon(s, d, this, getType(), getPositionInView(), exaggeration);
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true,
myContour.drawDottedContourExtruded(s, d, myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true, 0,
s.dottedContourSettings.segmentWidth);
}

Expand Down Expand Up @@ -508,7 +508,7 @@ GNEStopPlan::drawStopOverStoppingPlace(const GUIVisualizationSettings& s, const
GNEViewNetHelper::LockIcon::drawLockIcon(s, d, this, getType(), getPositionInView(), exaggeration);
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, d, myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true,
myContour.drawDottedContourExtruded(s, d, myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true, 0,
s.dottedContourSettings.segmentWidth);
}

Expand Down

0 comments on commit 5a2e2b9

Please sign in to comment.