Skip to content

Commit

Permalink
Removed checkDottedCaches(). Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 9e35c78 commit cdb9b12
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 41 deletions.
37 changes: 4 additions & 33 deletions src/netedit/elements/GNEContour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ GUIDottedGeometry::DottedGeometryColor GNEContour::myDottedGeometryColor;

GNEContour::GNEContour(GNEAttributeCarrier* AC) :
myAC(AC),
myDottedGeometries(new std::vector<GUIDottedGeometry>()) {
myDottedGeometries(new std::vector<GUIDottedGeometry>(4)) {
}


Expand All @@ -56,18 +56,14 @@ Boundary
GNEContour::getContourBoundary() const {
Boundary b;
for (const auto &dottedGeometry : *myDottedGeometries) {
b.add(dottedGeometry.getUnresampledShape().getBoxBoundary());
if (dottedGeometry.getUnresampledShape().size() > 0) {
b.add(dottedGeometry.getUnresampledShape().getBoxBoundary());
}
}
return b;
}


void
GNEContour::reset() const {
myDottedGeometries->clear();
}


void
GNEContour::drawDottedContourClosed(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const PositionVector& shape, const double scale, const bool addOffset, const double lineWidth) const {
Expand Down Expand Up @@ -208,8 +204,6 @@ GNEContour::drawDottedContourEdges(const GUIVisualizationSettings& s, const GUIV
void
GNEContour::drawInnenContourClosed(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const PositionVector& shape, const double scale, const double lineWidth) const {
// check dotted caches
checkDottedCaches(1);
// declare scaled shape
PositionVector scaledShape = shape;
// scale shape
Expand All @@ -229,22 +223,9 @@ GNEContour::drawInnenContourClosed(const GUIVisualizationSettings& s, const GUIV
}


void
GNEContour::checkDottedCaches(size_t dottedGeometries) const {
// check dotted geometries
if (myDottedGeometries->size() != dottedGeometries) {
myDottedGeometries->clear();
for (size_t i = 0; i < dottedGeometries; i++) {
myDottedGeometries->push_back(GUIDottedGeometry());
}
}
}

PositionVector
GNEContour::buildDottedContourClosed(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const PositionVector& shape, const double scale) const {
// check dotted caches
checkDottedCaches(1);
// declare scaled shape
PositionVector scaledShape = shape;
// scale shape
Expand All @@ -262,8 +243,6 @@ PositionVector
GNEContour::buildDottedContourExtruded(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
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, d, shape, false);
myDottedGeometries->at(2) = GUIDottedGeometry(s, d, shape.reverse(), false);
Expand Down Expand Up @@ -299,8 +278,6 @@ PositionVector
GNEContour::buildDottedContourRectangle(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const Position& pos, const double width, const double height, const double offsetX,
const double offsetY, const double rot, const double scale) const {
// check dotted caches
checkDottedCaches(1);
// create shape
PositionVector rectangleShape;
// make rectangle
Expand All @@ -326,8 +303,6 @@ GNEContour::buildDottedContourRectangle(const GUIVisualizationSettings& s, const
PositionVector
GNEContour::buildDottedContourCircle(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const Position& pos, double radius, const double scale) const {
// check dotted caches
checkDottedCaches(1);
// get resolution
int resolution = 1;
if (d <= GUIVisualizationSettings::Detail::CircleResolution32) {
Expand All @@ -351,8 +326,6 @@ GNEContour::buildDottedContourCircle(const GUIVisualizationSettings& s, const GU
PositionVector
GNEContour::buildDottedContourEdge(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const GNEEdge* edge, const bool drawFirstExtrem, const bool drawLastExtrem) const {
// check dotted caches
checkDottedCaches(4);
// set left hand flag
const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
// obtain lanes
Expand Down Expand Up @@ -393,8 +366,6 @@ GNEContour::buildDottedContourEdge(const GUIVisualizationSettings& s, const GUIV
PositionVector
GNEContour::buildDottedContourEdges(const GUIVisualizationSettings& /*s*/, const GUIVisualizationSettings::Detail /*d*/,
const GNEEdge* /* fromEdge */, const GNEEdge* /* toEdge */) const {
// check dotted caches
checkDottedCaches(4);

/* FINISH */
return PositionVector();
Expand Down
6 changes: 0 additions & 6 deletions src/netedit/elements/GNEContour.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ class GNEContour {
/// @brief get contour boundary
Boundary getContourBoundary() const;

/// @brief reset dotted contour
void reset() const;

/// @brief dotted contours
/// @{

Expand Down Expand Up @@ -114,9 +111,6 @@ class GNEContour {
/// @brief dotted geometry color
static GUIDottedGeometry::DottedGeometryColor myDottedGeometryColor;

/// @brief check dotted caches
void checkDottedCaches(size_t dottedGeometries) const;

/// @brief build dotted contour shape
PositionVector buildDottedContourClosed(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const PositionVector& shape, const double scale) const;
Expand Down
2 changes: 0 additions & 2 deletions src/netedit/elements/additional/GNEPoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ GNEPoly::updateGeometry() {
// just update polygon geometry
myPolygonGeometry.updateGeometry(myShape);
myTesselation.clear();
myContour.reset();
}


Expand Down Expand Up @@ -750,7 +749,6 @@ GNEPoly::setAttribute(SumoXMLAttr key, const std::string& value) {
break;
case SUMO_ATTR_FILL:
myFill = parse<bool>(value);
myContour.reset();
break;
case SUMO_ATTR_LINEWIDTH:
myLineWidth = parse<double>(value);
Expand Down

0 comments on commit cdb9b12

Please sign in to comment.