Skip to content

Commit

Permalink
Updated drawDottedGeometry function. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 268065a commit cff4f77
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 24 deletions.
34 changes: 17 additions & 17 deletions src/netedit/elements/GNEContour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ GNEContour::calculateContourClosedShape(const GUIVisualizationSettings& s, const
const auto closedShape = buildContourClosedShape(s, d, shape, scale);
gViewObjectsHandler.checkShapeElement(d, myAC->getGUIGlObject(), closedShape);
} else {
drawDottedContours(s, d, addOffset, lineWidth);
drawDottedContours(s, d, lineWidth, addOffset);
}
}

Expand All @@ -85,7 +85,7 @@ GNEContour::calculateContourExtrudedShape(const GUIVisualizationSettings& s, con
const auto extrudedShape = buildContourExtrudedShape(s, d, shape, extrusionWidth, scale, drawFirstExtrem, drawLastExtrem, offset);
gViewObjectsHandler.checkShapeElement(d, myAC->getGUIGlObject(), extrudedShape);
} else {
drawDottedContours(s, d, true, lineWidth);
drawDottedContours(s, d, lineWidth, true);
}
}

Expand All @@ -100,7 +100,7 @@ GNEContour::calculateContourRectangleShape(const GUIVisualizationSettings& s, co
const auto rectangleShape = buildContourRectangle(s, d, pos, width, height, offsetX, offsetY, rot, scale);
gViewObjectsHandler.checkShapeElement(d, myAC->getGUIGlObject(), rectangleShape);
} else {
drawDottedContours(s, d, true, lineWidth);
drawDottedContours(s, d, lineWidth, true);
}
}

Expand All @@ -114,7 +114,7 @@ GNEContour::calculateContourCircleShape(const GUIVisualizationSettings& s, const
buildContourCircle(s, d, pos, radius, scale);
gViewObjectsHandler.checkCircleElement(d, myAC->getGUIGlObject(), pos, (radius * scale));
} else {
drawDottedContours(s, d, true, lineWidth);
drawDottedContours(s, d, lineWidth, true);
}
}

Expand Down Expand Up @@ -183,7 +183,7 @@ GNEContour::calculateContourEdge(const GUIVisualizationSettings& s, const GUIVis
const auto contourShape = buildContourEdge(s, d, edge, drawFirstExtrem, drawLastExtrem);
gViewObjectsHandler.checkShapeElement(d, myAC->getGUIGlObject(), contourShape);
} else {
drawDottedContours(s, d, true, lineWidth);
drawDottedContours(s, d, lineWidth, true);
}
}

Expand All @@ -194,7 +194,7 @@ GNEContour::calculateContourEdges(const GUIVisualizationSettings& s, const GUIVi
// first build dotted contour (only in rectangle selection mode)
buildContourEdges(s, d, fromEdge, toEdge);
// draw dotted contours
drawDottedContours(s, d, true, lineWidth);
drawDottedContours(s, d, lineWidth, true);
}


Expand Down Expand Up @@ -394,45 +394,45 @@ GNEContour::updateContourBondary() const {

void
GNEContour::drawDottedContours(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const bool addOffset, const double lineWidth) const {
const double lineWidth, const bool addOffset) const {
// first check if draw dotted contour
if (!s.disableDottedContours && (d <= GUIVisualizationSettings::Detail::DottedContours)) {
// basic contours
if (myAC->checkDrawFromContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::FROM, addOffset, lineWidth);
drawDottedContour(s, GUIDottedGeometry::DottedContourType::FROM, lineWidth, addOffset);
}
if (myAC->checkDrawToContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::TO, addOffset, lineWidth);
drawDottedContour(s, GUIDottedGeometry::DottedContourType::TO, lineWidth, addOffset);
}
if (myAC->checkDrawRelatedContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::RELATED, addOffset, lineWidth);
drawDottedContour(s, GUIDottedGeometry::DottedContourType::RELATED, lineWidth, addOffset);
}
if (myAC->checkDrawOverContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::OVER, addOffset, lineWidth);
drawDottedContour(s, GUIDottedGeometry::DottedContourType::OVER, lineWidth, addOffset);
}
// inspect contour
if (myAC->checkDrawInspectContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::INSPECT, addOffset, lineWidth);
drawDottedContour(s, GUIDottedGeometry::DottedContourType::INSPECT, lineWidth, addOffset);
}
// front contour
if (myAC->checkDrawFrontContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::FRONT, addOffset, lineWidth);
drawDottedContour(s, GUIDottedGeometry::DottedContourType::FRONT, lineWidth, addOffset);
}
// delete contour
if (myAC->checkDrawDeleteContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::REMOVE, addOffset, lineWidth);
drawDottedContour(s, GUIDottedGeometry::DottedContourType::REMOVE, lineWidth, addOffset);
}
// select contour
if (myAC->checkDrawSelectContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::SELECT, addOffset, lineWidth);
drawDottedContour(s, GUIDottedGeometry::DottedContourType::SELECT, lineWidth, addOffset);
}
}
}


void
GNEContour::drawDottedContour(const GUIVisualizationSettings& s, GUIDottedGeometry::DottedContourType type,
const bool addOffset, const double lineWidth) const {
const double lineWidth, const bool addOffset) const {
// reset dotted geometry color
myDottedGeometryColor.reset();
// Push draw matrix
Expand All @@ -441,7 +441,7 @@ GNEContour::drawDottedContour(const GUIVisualizationSettings& s, GUIDottedGeomet
glTranslated(0, 0, GLO_DOTTEDCONTOUR);
// draw dotted geometries
for (const auto &dottedGeometry : *myDottedGeometries) {
dottedGeometry.drawDottedGeometry(s, type, myDottedGeometryColor, addOffset, lineWidth);
dottedGeometry.drawDottedGeometry(s, type, myDottedGeometryColor, lineWidth, addOffset);
}
// pop matrix
GLHelper::popMatrix();
Expand Down
7 changes: 4 additions & 3 deletions src/netedit/elements/GNEContour.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,13 @@ class GNEContour {
/// @name drawing functions
/// @{

/// @brief draw dotted contours
/// @brief draw dotted contours (basics, select, delete, inspect...)
void drawDottedContours(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const bool addOffset, const double lineWidth) const;
const double lineWidth, const bool addOffset) const;

/// @brief draw dotted contour
void drawDottedContour(const GUIVisualizationSettings& s, GUIDottedGeometry::DottedContourType type, const bool addOffset, const double lineWidth) const;
void drawDottedContour(const GUIVisualizationSettings& s, GUIDottedGeometry::DottedContourType type,
const double lineWidth, const bool addOffset) const;

/// @}

Expand Down
2 changes: 0 additions & 2 deletions src/netedit/elements/network/GNECrossing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ GNECrossing::drawGL(const GUIVisualizationSettings& s) const {
// draw shape points only in Network supemode
if (myShapeEdited && myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
s.drawMovingGeometryPoint(crossingExaggeration, s.neteditSizeSettings.crossingGeometryPointRadius)) {
// get edit modes
const auto& editModes = myNet->getViewNet()->getEditModes();
// color
const RGBColor darkerColor = crossingColor.changedBrightness(-32);
// draw geometry points
Expand Down
2 changes: 1 addition & 1 deletion src/utils/gui/div/GUIDottedGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ GUIDottedGeometry::updateDottedGeometry(const GUIVisualizationSettings& s, const

void
GUIDottedGeometry::drawDottedGeometry(const GUIVisualizationSettings& s, GUIDottedGeometry::DottedContourType type,
DottedGeometryColor& dottedGeometryColor, const bool addOffset, const double lineWidth) const {
DottedGeometryColor& dottedGeometryColor, const double lineWidth, const bool addOffset) const {
// iterate over all segments
for (auto& segment : myDottedGeometrySegments) {
// iterate over shape
Expand Down
2 changes: 1 addition & 1 deletion src/utils/gui/div/GUIDottedGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class GUIDottedGeometry {

/// @brief draw dotted geometry
void drawDottedGeometry(const GUIVisualizationSettings& s, GUIDottedGeometry::DottedContourType type,
DottedGeometryColor& dottedGeometryColor, const bool addOffset, const double lineWidth) const;
DottedGeometryColor& dottedGeometryColor, const double lineWidth, const bool addOffset) const;

/// @brief draw innen geometry
void drawInnenGeometry(const double lineWidth) const;
Expand Down

0 comments on commit cff4f77

Please sign in to comment.