Skip to content

Commit

Permalink
Added constant getGUIGlObject function. Refs #14109
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 5a04f65 commit 0fbb8af
Show file tree
Hide file tree
Showing 21 changed files with 93 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/netedit/elements/GNEAttributeCarrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class GNEAttributeCarrier : public GNEReferenceCounter {
/// @brief get GUIGlObject associated with this AttributeCarrier
virtual GUIGlObject* getGUIGlObject() = 0;

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
virtual const GUIGlObject* getGUIGlObject() const = 0;

/// @brief update pre-computed geometry information
virtual void updateGeometry() = 0;

Expand Down
10 changes: 8 additions & 2 deletions src/netedit/elements/GNEContour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,22 @@ GNEContour::drawDottedContours(const GUIVisualizationSettings& s, const GUIVisua
if (AC->checkDrawSelectContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::SELECT, lineWidth, addOffset);
}
// move contour
if (AC->checkDrawMoveContour()) {
drawDottedContour(s, GUIDottedGeometry::DottedContourType::MOVE, lineWidth, addOffset);
}
}
}


void
GNEContour::drawDottedContourGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const GUIGlObject* glObject, const PositionVector &shape, const double radius,
const GNEAttributeCarrier *AC, const PositionVector &shape, const double radius,
const double scale, const double lineWidth) const {
// first check if draw dotted contour
if (!s.disableDottedContours && (d <= GUIVisualizationSettings::Detail::DottedContours)) {
if (!s.disableDottedContours && (d <= GUIVisualizationSettings::Detail::DottedContours) && AC->checkDrawMoveContour() ) {
// get gl object
const auto glObject = AC->getGUIGlObject();
// get geometry points
const auto &geometryPoints = gViewObjectsHandler.getGeometryPoints(glObject);
// get temporal position over shape
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/GNEContour.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class GNEContour {

/// @brief draw dotted contour for geometry points
void drawDottedContourGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const GUIGlObject* glObject, const PositionVector &shape, const double radius,
const GNEAttributeCarrier *AC, const PositionVector &shape, const double radius,
const double scale, const double lineWidth) const;

/// @brief draw innen contour (currently used only in walkingAreas)
Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/additional/GNEAdditional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ GNEAdditional::getGUIGlObject() {
}


const GUIGlObject*
GNEAdditional::getGUIGlObject() const {
return this;
}


const std::string
GNEAdditional::getOptionalName() const {
try {
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/additional/GNEAdditional.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ class GNEAdditional : public GNEPathManager::PathElement, public GNEHierarchical
/// @brief get GUIGlObject associated with this AttributeCarrier
GUIGlObject* getGUIGlObject();

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
const GUIGlObject* getGUIGlObject() const;

/// @brief Returns the name of the object (default "")
virtual const std::string getOptionalName() const;

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/data/GNEDataInterval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ GNEDataInterval::getGUIGlObject() {
}


const GUIGlObject*
GNEDataInterval::getGUIGlObject() const {
return nullptr;
}


void
GNEDataInterval::updateGeometry() {
// nothing to update
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/data/GNEDataInterval.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class GNEDataInterval : public GNEHierarchicalElement, public Parameterised {
/// @brief get GUIGlObject associated with this AttributeCarrier
GUIGlObject* getGUIGlObject();

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
const GUIGlObject* getGUIGlObject() const;

/// @brief update pre-computed geometry information
void updateGeometry();

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/data/GNEDataSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ GNEDataSet::getGUIGlObject() {
}


const GUIGlObject*
GNEDataSet::getGUIGlObject() const {
return nullptr;
}


void
GNEDataSet::updateAttributeColors() {
// first update attribute colors in data interval childrens
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/data/GNEDataSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ class GNEDataSet : public GNEAttributeCarrier, public Parameterised {
/// @brief get GUIGlObject associated with this AttributeCarrier
GUIGlObject* getGUIGlObject();

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
const GUIGlObject* getGUIGlObject() const;

/// @brief update attribute colors deprecated
void updateAttributeColors();

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/data/GNEGenericData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ GNEGenericData::getGUIGlObject() {
}


const GUIGlObject*
GNEGenericData::getGUIGlObject() const {
return this;
}


GNEDataInterval*
GNEGenericData::getDataIntervalParent() const {
return myDataIntervalParent;
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/data/GNEGenericData.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ class GNEGenericData : public GNEPathManager::PathElement, public Parameterised,
/// @brief get GUIGlObject associated with this AttributeCarrier
GUIGlObject* getGUIGlObject();

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
const GUIGlObject* getGUIGlObject() const;

/// @brief get data interval parent
GNEDataInterval* getDataIntervalParent() const;

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/data/GNEMeanData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ GNEMeanData::getGUIGlObject() {
}


const GUIGlObject*
GNEMeanData::getGUIGlObject() const {
return nullptr;
}


void
GNEMeanData::updateGeometry() {
// nothing to update
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/data/GNEMeanData.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class GNEMeanData : public GNEHierarchicalElement {
/// @brief get GUIGlObject associated with this AttributeCarrier
GUIGlObject* getGUIGlObject();

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
const GUIGlObject* getGUIGlObject() const;

/// @brief update pre-computed geometry information
void updateGeometry();

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/demand/GNEDemandElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ GNEDemandElement::getGUIGlObject() {
}


const GUIGlObject*
GNEDemandElement::getGUIGlObject() const {
return this;
}


const GUIGeometry&
GNEDemandElement::getDemandElementGeometry() {
return myDemandElementGeometry;
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/demand/GNEDemandElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ class GNEDemandElement : public GNEPathManager::PathElement, public GNEHierarchi
/// @brief get GUIGlObject associated with this AttributeCarrier
GUIGlObject* getGUIGlObject();

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
const GUIGlObject* getGUIGlObject() const;

/// @brief get demand element geometry (stacked)
const GUIGeometry& getDemandElementGeometry();

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/network/GNEEdgeTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ GNEEdgeTemplate::getGUIGlObject() {
}


const GUIGlObject*
GNEEdgeTemplate::getGUIGlObject() const {
return nullptr;
}


void
GNEEdgeTemplate::updateGeometry() {
throw InvalidArgument("cannot be called in templates");
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/network/GNEEdgeTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class GNEEdgeTemplate : public GNEAttributeCarrier {
/// @brief get GUIGlObject associated with this AttributeCarrier
GUIGlObject* getGUIGlObject();

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
const GUIGlObject* getGUIGlObject() const;

/// @brief update pre-computed geometry information
void updateGeometry();

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/network/GNELaneTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ GNELaneTemplate::getGUIGlObject() {
}


const GUIGlObject*
GNELaneTemplate::getGUIGlObject() const {
return nullptr;
}


void
GNELaneTemplate::updateGeometry() {
throw InvalidArgument("cannot be called in templates");
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/network/GNELaneTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class GNELaneTemplate : public GNEAttributeCarrier {
/// @brief get GUIGlObject associated with this AttributeCarrier
GUIGlObject* getGUIGlObject();

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
const GUIGlObject* getGUIGlObject() const;

/// @brief update pre-computed geometry information
void updateGeometry();

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/network/GNENetworkElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ GNENetworkElement::getGUIGlObject() {
}


const GUIGlObject*
GNENetworkElement::getGUIGlObject() const {
return this;
}


void
GNENetworkElement::setShapeEdited(const bool value) {
myShapeEdited = value;
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/network/GNENetworkElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class GNENetworkElement : public GUIGlObject, public GNEHierarchicalElement, pub
/// @brief get GUIGlObject associated with this AttributeCarrier
GUIGlObject* getGUIGlObject();

/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
const GUIGlObject* getGUIGlObject() const;

/// @brief set shape edited
void setShapeEdited(const bool value);

Expand Down

0 comments on commit 0fbb8af

Please sign in to comment.