Skip to content

Commit

Permalink
Moved const stoppingPlace variables from GNEStoppingPlace to GUIVisua…
Browse files Browse the repository at this point in the history
…lizationStoppingPlaceSettings. Refs #12
  • Loading branch information
palvarezlopez committed Sep 19, 2024
1 parent 55d38c0 commit 264a0ea
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEBusStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ GNEBusStop::drawGL(const GUIVisualizationSettings& s) const {
// draw lines
drawLines(d, myLines, baseColor);
// draw sign
drawSign(d, busStopExaggeration, baseColor, signColor, (myTagProperty.getTag() == SUMO_TAG_BUS_STOP) ? "H" : "T");
drawSign(s, d, busStopExaggeration, baseColor, signColor, (myTagProperty.getTag() == SUMO_TAG_BUS_STOP) ? "H" : "T");
// draw geometry points
if (movingGeometryPoints && (myStartPosition != INVALID_DOUBLE)) {
drawLeftGeometryPoint(s, d, myAdditionalGeometry.getShape().front(), myAdditionalGeometry.getShapeRotations().front(), baseColor);
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 @@ -163,7 +163,7 @@ GNEChargingStation::drawGL(const GUIVisualizationSettings& s) const {
// draw charging power and efficiency
drawLines(d, {toString(myChargingPower)}, baseColor);
// draw sign
drawSign(d, chargingStationExaggeration, baseColor, signColor, "C");
drawSign(s, d, chargingStationExaggeration, baseColor, signColor, "C");
// draw geometry points
if (movingGeometryPoints && (myStartPosition != INVALID_DOUBLE)) {
drawLeftGeometryPoint(s, d, myAdditionalGeometry.getShape().front(), myAdditionalGeometry.getShapeRotations().front(), baseColor);
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 @@ -157,7 +157,7 @@ GNEContainerStop::drawGL(const GUIVisualizationSettings& s) const {
// draw lines
drawLines(d, myLines, baseColor);
// draw sign
drawSign(d, containerStopExaggeration, baseColor, signColor, "C");
drawSign(s, d, containerStopExaggeration, baseColor, signColor, "C");
// draw geometry points
if (movingGeometryPoints && (myStartPosition != INVALID_DOUBLE)) {
drawLeftGeometryPoint(s, d, myAdditionalGeometry.getShape().front(), myAdditionalGeometry.getShapeRotations().front(), baseColor);
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 @@ -189,7 +189,7 @@ GNEParkingArea::drawGL(const GUIVisualizationSettings& s) const {
// Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration
GUIGeometry::drawGeometry(d, myAdditionalGeometry, myWidth * 0.5 * MIN2(1.0, parkingAreaExaggeration));
// draw sign
drawSign(d, parkingAreaExaggeration, baseColor, signColor, "P");
drawSign(s, d, parkingAreaExaggeration, baseColor, signColor, "P");
// Traslate to front
glTranslated(0, 0, 0.1);
// draw lotSpaceDefinitions
Expand Down
21 changes: 6 additions & 15 deletions src/netedit/elements/additional/GNEStoppingPlace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@
#include "GNEStoppingPlace.h"
#include "GNEAdditionalHandler.h"

// ===========================================================================
// static members
// ===========================================================================

const double GNEStoppingPlace::mySymbolExternalRadius = 1.1;
const double GNEStoppingPlace::mySymbolExternalRadiusSquared = 1.21;
const double GNEStoppingPlace::mySymbolInternalRadius = 0.9;
const double GNEStoppingPlace::mySymbolInternalText = 1.6;

// ===========================================================================
// member method definitions
// ===========================================================================
Expand Down Expand Up @@ -323,8 +314,8 @@ GNEStoppingPlace::drawLines(const GUIVisualizationSettings::Detail d, const std:


void
GNEStoppingPlace::drawSign(const GUIVisualizationSettings::Detail d, const double exaggeration, const RGBColor& baseColor,
const RGBColor& signColor, const std::string& word) const {
GNEStoppingPlace::drawSign(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d, const double exaggeration,
const RGBColor& baseColor, const RGBColor& signColor, const std::string& word) const {
// only draw in level 2
if (d <= GUIVisualizationSettings::Detail::AdditionalDetails) {
// calculate middle point
Expand All @@ -342,17 +333,17 @@ GNEStoppingPlace::drawSign(const GUIVisualizationSettings::Detail d, const doubl
// set color
GLHelper::setColor(baseColor);
// Draw circle
GLHelper::drawFilledCircleDetailled(d, mySymbolExternalRadius);
GLHelper::drawFilledCircleDetailled(d, s.stoppingPlaceSettings.symbolExternalRadius);
// continue depending of rectangle selection
if (d <= GUIVisualizationSettings::Detail::Text) {
// Traslate to front
glTranslated(0, 0, .1);
// set color
GLHelper::setColor(signColor);
// draw another circle in the same position, but a little bit more small
GLHelper::drawFilledCircleDetailled(d, mySymbolInternalRadius);
GLHelper::drawFilledCircleDetailled(d, s.stoppingPlaceSettings.symbolInternalRadius);
// draw H depending of detailSettings
GLHelper::drawText(word, Position(), .1, mySymbolInternalText, baseColor);
GLHelper::drawText(word, Position(), .1, s.stoppingPlaceSettings.symbolInternalTextSize, baseColor);
}
// pop draw matrix
GLHelper::popMatrix();
Expand All @@ -376,7 +367,7 @@ GNEStoppingPlace::calculateStoppingPlaceContour(const GUIVisualizationSettings&
} else {
// don't exaggerate contour
myAdditionalContour.calculateContourExtrudedShape(s, d, this, myAdditionalGeometry.getShape(), width, 1, true, true, 0);
mySymbolContour.calculateContourCircleShape(s, d, this, mySymbolPosition, mySymbolExternalRadius, exaggeration);
mySymbolContour.calculateContourCircleShape(s, d, this, mySymbolPosition, s.stoppingPlaceSettings.symbolExternalRadius, exaggeration);
}
}

Expand Down
14 changes: 1 addition & 13 deletions src/netedit/elements/additional/GNEStoppingPlace.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,6 @@ class GNEStoppingPlace : public GNEAdditional, public Parameterised {
/// @brief circle contour
GNEContour mySymbolContour;

/// @brief circle width resolution for all stopping places
static const double mySymbolExternalRadius;

/// @brief squared circle width resolution for all stopping places
static const double mySymbolExternalRadiusSquared;

/// @brief inner circle width resolution for all stopping places
static const double mySymbolInternalRadius;

/// @brief text inner circle width resolution for all stopping places
static const double mySymbolInternalText;

/// @brief set geometry common to all stopping places
void setStoppingPlaceGeometry(double movingToSide);

Expand All @@ -183,7 +171,7 @@ class GNEStoppingPlace : public GNEAdditional, public Parameterised {
const RGBColor& color) const;

/// @brief draw sign
void drawSign(const GUIVisualizationSettings::Detail d, const double exaggeration,
void drawSign(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d, const double exaggeration,
const RGBColor& baseColor, const RGBColor& signColor, const std::string& word) const;

/// @brief check object in view
Expand Down
7 changes: 5 additions & 2 deletions src/utils/gui/settings/GUIVisualizationSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ const double GUIVisualizationStoppingPlaceSettings::busStopWidth(1);
const double GUIVisualizationStoppingPlaceSettings::trainStopWidth(0.5);
const double GUIVisualizationStoppingPlaceSettings::containerStopWidth(3);
const double GUIVisualizationStoppingPlaceSettings::chargingStationWidth(1);
const double GUIVisualizationStoppingPlaceSettings::symbolExternalRadius(1.1);
const double GUIVisualizationStoppingPlaceSettings::symbolInternalRadius(0.9);
const double GUIVisualizationStoppingPlaceSettings::symbolInternalTextSize(1.6);

// -------------------------------------------------------------------------
// Dotted contour values
Expand Down Expand Up @@ -668,7 +671,7 @@ GUIVisualizationSettings::GUIVisualizationSettings(const std::string& _name, boo


bool
GUIVisualizationSettings::checkDrawJunction(const Boundary &b, const bool selected) const {
GUIVisualizationSettings::checkDrawJunction(const Boundary& b, const bool selected) const {
if (drawForViewObjectsHandler) {
return false;
} else if (junctionSize.constantSize) {
Expand Down Expand Up @@ -696,7 +699,7 @@ GUIVisualizationSettings::checkDrawAdditional(const Detail d, const bool selecte


bool
GUIVisualizationSettings::checkDrawPoly(const Boundary &b, const bool selected) const {
GUIVisualizationSettings::checkDrawPoly(const Boundary& b, const bool selected) const {
if (drawForViewObjectsHandler) {
return false;
} else if (polySize.constantSize) {
Expand Down
13 changes: 11 additions & 2 deletions src/utils/gui/settings/GUIVisualizationSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,15 @@ struct GUIVisualizationStoppingPlaceSettings {

/// @brief chargingStation width
static const double chargingStationWidth;

/// @brief symbol external radius
static const double symbolExternalRadius;

/// @brief symbol internal radius
static const double symbolInternalRadius;

/// @brief symbol internal text size
static const double symbolInternalTextSize;
};


Expand Down Expand Up @@ -615,13 +624,13 @@ class GUIVisualizationSettings {
GUIVisualizationSettings(const std::string& _name, bool _netedit = false);

/// @brief check if draw junction
bool checkDrawJunction(const Boundary &b, const bool selected) const;
bool checkDrawJunction(const Boundary& b, const bool selected) const;

/// @brief check if draw additionals
bool checkDrawAdditional(Detail d, const bool selected) const;

/// @brief check if draw polygon
bool checkDrawPoly(const Boundary &b, const bool selected) const;
bool checkDrawPoly(const Boundary& b, const bool selected) const;

/// @brief check if draw POI
bool checkDrawPOI(const double w, const double h, const Detail d, const bool selected) const;
Expand Down

0 comments on commit 264a0ea

Please sign in to comment.