Skip to content

Commit

Permalink
Updated drawGeometryPoints function. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 9e79839 commit 49716d1
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 168 deletions.
68 changes: 35 additions & 33 deletions src/netedit/elements/additional/GNEPoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,15 @@ GNEPoly::drawGL(const GUIVisualizationSettings& s) const {
myNet->getViewNet()->drawTranslateFrontAttributeCarrier(this, getShapeLayer());
// draw polygon
drawPolygon(s, d, color, polyExaggeration);
// draw contour
drawPolygonContour(s, d, color, polyExaggeration);
// draw contour if don't move whole polygon
if (!myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkModeOptions()->getMoveWholePolygons()) {
// get darker color
const RGBColor darkerColor = color.changedBrightness(-32);
// draw contour
drawPolygonContour(s, d, darkerColor, polyExaggeration);
// draw geometry points
drawGeometryPoints(s, d, darkerColor, polyExaggeration);
}
// pop layer matrix
GLHelper::popMatrix();
// draw name and type
Expand Down Expand Up @@ -848,37 +855,32 @@ GNEPoly::drawPolygon(const GUIVisualizationSettings& s, const GUIVisualizationSe

void
GNEPoly::drawPolygonContour(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const RGBColor &color, const double exaggeration) const {
// draw contour if don't move whole polygon
if (!myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkModeOptions()->getMoveWholePolygons()) {
// get draw color
const RGBColor darkerColor = color.changedBrightness(-32);
// get inverted color
const RGBColor invertedColor = color.invertedColor();
// push contour matrix
GLHelper::pushMatrix();
// translate to front
glTranslated(0, 0, 0.1);
// set color
GLHelper::setColor(darkerColor);
// draw polygon contour
GUIGeometry::drawGeometry(d, myPolygonGeometry, s.neteditSizeSettings.polygonContourWidth * exaggeration);
// pop contour matrix
GLHelper::popMatrix();
// draw shape points only in Network supemode
if (drawMovingGeometryPoints(false)) {
// check move mode flag
const bool moveMode = (myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, this, myNet->getViewNet()->getPositionInformation(), myPolygonGeometry.getShape(), darkerColor, invertedColor,
s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5), exaggeration,
myNet->getViewNet()->getNetworkViewOptions().editingElevation(), true);
// draw moving hint points
if (!myNet->getViewNet()->getLockManager().isObjectLocked(getType(), isAttributeCarrierSelected()) && moveMode) {
GUIGeometry::drawMovingHint(s, this, myNet->getViewNet()->getPositionInformation(), myPolygonGeometry.getShape(), invertedColor,
s.neteditSizeSettings.polygonGeometryPointRadius, exaggeration);
}
}
const RGBColor &color, const double exaggeration) const {
// push contour matrix
GLHelper::pushMatrix();
// translate to front
glTranslated(0, 0, 0.1);
// set color
GLHelper::setColor(color);
// draw polygon contour
GUIGeometry::drawGeometry(d, myPolygonGeometry, s.neteditSizeSettings.polygonContourWidth * exaggeration);
// pop contour matrix
GLHelper::popMatrix();
}


void
GNEPoly::drawGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const RGBColor &color, const double exaggeration) const {
// draw shape points only in supermode network
if (myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
// check if we're in move mode
const bool moveMode = (myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE);
// get geometry point sizes
const double geometryPointSize = s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, d, this, myPolygonGeometry.getShape(), color, geometryPointSize, exaggeration,
myNet->getViewNet()->getNetworkViewOptions().editingElevation(), moveMode);
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/netedit/elements/additional/GNEPoly.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ class GNEPoly : public TesselatedPolygon, public GNEAdditional {

/// @brief draw contour
void drawPolygonContour(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const RGBColor &color, const double exaggeration) const;
const RGBColor &color, const double exaggeration) const;

/// @brief draw geometry points
void drawGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const RGBColor &color, const double exaggeration) const;

/// @brief draw polygon name and type
void drawPolygonNameAndType(const GUIVisualizationSettings& s) const;
Expand Down
9 changes: 2 additions & 7 deletions src/netedit/elements/additional/GNETAZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,9 @@ GNETAZ::drawGL(const GUIVisualizationSettings& s) const {
// check move mode flag
const bool moveMode = (myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, this, myNet->getViewNet()->getPositionInformation(), myAdditionalGeometry.getShape(), darkerColor, invertedColor,
GUIGeometry::drawGeometryPoints(s, d, this, myAdditionalGeometry.getShape(), darkerColor,
s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5), TAZExaggeration,
myNet->getViewNet()->getNetworkViewOptions().editingElevation(), drawExtremeSymbols);
// draw moving hint points
if (!myNet->getViewNet()->getLockManager().isObjectLocked(GLO_TAZ, isAttributeCarrierSelected()) && moveMode) {
GUIGeometry::drawMovingHint(s, this, myNet->getViewNet()->getPositionInformation(), myAdditionalGeometry.getShape(), invertedColor,
s.neteditSizeSettings.polygonGeometryPointRadius, TAZExaggeration);
}
myNet->getViewNet()->getNetworkViewOptions().editingElevation(), true);
}
}
// draw center
Expand Down
14 changes: 4 additions & 10 deletions src/netedit/elements/network/GNEConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,18 +457,12 @@ GNEConnection::drawGL(const GUIVisualizationSettings& s) const {
GLHelper::drawLine(myInternalJunctionMarker);
}
// draw shape points only in Network supemode
if (myShapeEdited && s.drawMovingGeometryPoint(1, s.neteditSizeSettings.connectionGeometryPointRadius) && myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
// color
const RGBColor darkerColor = connectionColor.changedBrightness(-32);
if (myShapeEdited && s.drawMovingGeometryPoint(1, s.neteditSizeSettings.connectionGeometryPointRadius)) {
// draw geometry points
GUIGeometry::drawGeometryPoints(s, this, myNet->getViewNet()->getPositionInformation(), myConnectionGeometry.getShape(), darkerColor, RGBColor::BLACK,
GUIGeometry::drawGeometryPoints(s, d, this, myConnectionGeometry.getShape(), connectionColor.changedBrightness(-32),
s.neteditSizeSettings.connectionGeometryPointRadius, 1,
myNet->getViewNet()->getNetworkViewOptions().editingElevation(), drawExtremeSymbols);
// draw moving hint
if (myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE) {
GUIGeometry::drawMovingHint(s, this, myNet->getViewNet()->getPositionInformation(), myConnectionGeometry.getShape(), darkerColor,
s.neteditSizeSettings.connectionGeometryPointRadius, 1);
}
myNet->getViewNet()->getNetworkViewOptions().editingElevation(),
myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE);
}
// Pop layer matrix
GLHelper::popMatrix();
Expand Down
10 changes: 3 additions & 7 deletions src/netedit/elements/network/GNECrossing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,10 @@ GNECrossing::drawGL(const GUIVisualizationSettings& s) const {
// color
const RGBColor darkerColor = crossingColor.changedBrightness(-32);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, this, myNet->getViewNet()->getPositionInformation(), myCrossingGeometry.getShape(), darkerColor, RGBColor::BLACK,
GUIGeometry::drawGeometryPoints(s, d, this, myCrossingGeometry.getShape(), darkerColor,
s.neteditSizeSettings.crossingGeometryPointRadius, selectionScale,
myNet->getViewNet()->getNetworkViewOptions().editingElevation(), drawExtremeSymbols);
// draw moving hint
if (myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE) {
GUIGeometry::drawMovingHint(s, this, myNet->getViewNet()->getPositionInformation(), myCrossingGeometry.getShape(), darkerColor,
s.neteditSizeSettings.crossingGeometryPointRadius, selectionScale);
}
myNet->getViewNet()->getNetworkViewOptions().editingElevation(),
myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE);
}
// pop layer matrix
GLHelper::popMatrix();
Expand Down
10 changes: 3 additions & 7 deletions src/netedit/elements/network/GNEJunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1656,14 +1656,10 @@ GNEJunction::drawJunctionAsShape(const GUIVisualizationSettings& s, const GUIVis
// draw shape
GUIGeometry::drawGeometry(d, junctionGeometry, s.neteditSizeSettings.junctionGeometryPointRadius * 0.5);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, this, mousePos, junctionOpenShape, darkerColor, RGBColor::BLACK,
GUIGeometry::drawGeometryPoints(s, d, this, junctionOpenShape, darkerColor,
s.neteditSizeSettings.junctionGeometryPointRadius, exaggeration,
myNet->getViewNet()->getNetworkViewOptions().editingElevation(), drawExtremeSymbols);
// draw moving hint
if (myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE) {
GUIGeometry::drawMovingHint(s, this, mousePos, junctionOpenShape, darkerColor,
s.neteditSizeSettings.junctionGeometryPointRadius, exaggeration);
}
myNet->getViewNet()->getNetworkViewOptions().editingElevation(),
myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/netedit/elements/network/GNELane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1366,11 +1366,11 @@ GNELane::drawShapeEdited(const GUIVisualizationSettings& s) const {
myDrawingConstants->getOffset());
// move front
glTranslated(0, 0, 1);
// color
const RGBColor darkerColor = s.colorSettings.editShapeColor.changedBrightness(-32);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, this, myNet->getViewNet()->getPositionInformation(), myLaneGeometry.getShape(), darkerColor, RGBColor::BLACK,
s.neteditSizeSettings.laneGeometryPointRadius, 1, myNet->getViewNet()->getNetworkViewOptions().editingElevation(), true);
GUIGeometry::drawGeometryPoints(s, myDrawingConstants->getDetail(), this, myLaneGeometry.getShape(),
s.colorSettings.editShapeColor.changedBrightness(-32),
s.neteditSizeSettings.laneGeometryPointRadius, 1,
myNet->getViewNet()->getNetworkViewOptions().editingElevation(), true);
// Pop shape edited matrix
GLHelper::popMatrix();
}
Expand Down
12 changes: 3 additions & 9 deletions src/netedit/elements/network/GNEWalkingArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,11 @@ GNEWalkingArea::drawTesselatedWalkingArea(const GUIVisualizationSettings& s, con
}
// draw shape points only in Network supemode
if (myShapeEdited && s.drawMovingGeometryPoint(1, s.neteditSizeSettings.crossingGeometryPointRadius)) {
// color
const RGBColor darkerColor = color.changedBrightness(-32);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, this, myNet->getViewNet()->getPositionInformation(), myTesselation.getShape(), darkerColor, RGBColor::BLACK,
GUIGeometry::drawGeometryPoints(s, d, this, myTesselation.getShape(), color.changedBrightness(-32),
s.neteditSizeSettings.crossingGeometryPointRadius, 1,
myNet->getViewNet()->getNetworkViewOptions().editingElevation(), true);
// draw moving hint
if (myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE) {
GUIGeometry::drawMovingHint(s, this, myNet->getViewNet()->getPositionInformation(), myTesselation.getShape(), darkerColor,
s.neteditSizeSettings.crossingGeometryPointRadius, 1);
}
myNet->getViewNet()->getNetworkViewOptions().editingElevation(),
myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE);
}
// pop layer Matrix
GLHelper::popMatrix();
Expand Down
2 changes: 2 additions & 0 deletions src/netedit/frames/GNEConsecutiveSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,11 @@ GNEConsecutiveSelector::drawTemporalConsecutiveLanePath(const GUIVisualizationSe
// positions
const Position firstPosition = myLanePath.front().first->getLaneShape().positionAtOffset2D(myLanePath.front().second);
const Position secondPosition = myLanePath.back().first->getLaneShape().positionAtOffset2D(myLanePath.back().second);
/*
// draw geometry points
GUIGeometry::drawGeometryPoints(s, nullptr, myFrameParent->getViewNet()->getPositionInformation(), {firstPosition, secondPosition},
pointColor, RGBColor::WHITE, s.neteditSizeSettings.polylineWidth, 1, false, true);
*/
// Pop last matrix
GLHelper::popMatrix();
}
Expand Down

0 comments on commit 49716d1

Please sign in to comment.