Skip to content

Commit

Permalink
move using-declarations into class body to avoid polluting global (#1186
Browse files Browse the repository at this point in the history
)

namespace
  • Loading branch information
kikitte authored Nov 7, 2024
1 parent f3edf73 commit d710207
Show file tree
Hide file tree
Showing 143 changed files with 510 additions and 543 deletions.
3 changes: 1 addition & 2 deletions include/geos/algorithm/CGAlgorithmsDD.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ class CoordinateSequence;
}
}

using namespace geos::math;

namespace geos {
namespace algorithm { // geos::algorithm

/// Implements basic computational geometry algorithms using extended precision float-point arithmetic.
class GEOS_DLL CGAlgorithmsDD {
using DD = geos::math::DD;

public:

Expand Down
16 changes: 7 additions & 9 deletions include/geos/algorithm/MinimumAreaRectangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ namespace geos {
}
}

using geos::geom::CoordinateSequence;
using geos::geom::CoordinateXY;
using geos::geom::Geometry;
using geos::geom::GeometryFactory;
using geos::geom::LineSegment;
using geos::geom::LineString;
using geos::geom::Polygon;


namespace geos {
namespace algorithm { // geos::algorithm

Expand All @@ -65,6 +56,13 @@ namespace algorithm { // geos::algorithm
*
*/
class GEOS_DLL MinimumAreaRectangle {
using CoordinateSequence = geos::geom::CoordinateSequence;
using CoordinateXY = geos::geom::CoordinateXY;
using Geometry = geos::geom::Geometry;
using GeometryFactory = geos::geom::GeometryFactory;
using LineSegment = geos::geom::LineSegment;
using LineString = geos::geom::LineString;
using Polygon = geos::geom::Polygon;

private:

Expand Down
4 changes: 1 addition & 3 deletions include/geos/algorithm/PolygonNodeTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ class CoordinateXY;
}
}

using geos::geom::CoordinateXY;


namespace geos {
namespace algorithm { // geos::algorithm

Expand All @@ -39,6 +36,7 @@ namespace algorithm { // geos::algorithm
*
*/
class GEOS_DLL PolygonNodeTopology {
using CoordinateXY = geos::geom::CoordinateXY;

public:

Expand Down
9 changes: 4 additions & 5 deletions include/geos/algorithm/Rectangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ class Polygon;
}
}

using geos::geom::CoordinateXY;
using geos::geom::GeometryFactory;
using geos::geom::LineSegment;
using geos::geom::Polygon;

namespace geos {
namespace algorithm {

class GEOS_DLL Rectangle {
using CoordinateXY = geos::geom::CoordinateXY;
using GeometryFactory = geos::geom::GeometryFactory;
using LineSegment = geos::geom::LineSegment;
using Polygon = geos::geom::Polygon;

public:

Expand Down
7 changes: 3 additions & 4 deletions include/geos/algorithm/construct/IndexedDistanceToPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
#include <geos/algorithm/construct/IndexedPointInPolygonsLocator.h>
#include <geos/operation/distance/IndexedFacetDistance.h>

using geos::geom::Geometry;
using geos::geom::Point;
using geos::operation::distance::IndexedFacetDistance;

namespace geos {
namespace algorithm { // geos::algorithm
namespace construct { // geos::algorithm::construct
Expand All @@ -43,6 +39,9 @@ namespace construct { // geos::algorithm::construct
* \author Martin Davis
*/
class GEOS_DLL IndexedDistanceToPoint {
using Geometry = geos::geom::Geometry;
using Point = geos::geom::Point;
using IndexedFacetDistance = geos::operation::distance::IndexedFacetDistance;

public:
/**
Expand Down
12 changes: 6 additions & 6 deletions include/geos/algorithm/construct/IndexedPointInPolygonsLocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
#include <geos/index/strtree/TemplateSTRtree.h>
#include <geos/algorithm/locate/IndexedPointInAreaLocator.h>

using geos::geom::Geometry;
using geos::geom::CoordinateXY;
using geos::geom::Location;
using geos::index::strtree::TemplateSTRtree;
using geos::algorithm::locate::IndexedPointInAreaLocator;

namespace geos {
namespace algorithm { // geos::algorithm
namespace construct { // geos::algorithm::construct
Expand All @@ -43,6 +37,12 @@ namespace construct { // geos::algorithm::construct
* \author Martin Davis
*/
class GEOS_DLL IndexedPointInPolygonsLocator {
using Geometry = geos::geom::Geometry;
using CoordinateXY = geos::geom::CoordinateXY;
using Location = geos::geom::Location;
template<typename ItemType>
using TemplateSTRtree = geos::index::strtree::TemplateSTRtree<ItemType>;
using IndexedPointInAreaLocator = geos::algorithm::locate::IndexedPointInAreaLocator;

public:
/**
Expand Down
3 changes: 1 addition & 2 deletions include/geos/algorithm/construct/LargestEmptyCircle.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class Point;
}
}

using geos::operation::distance::IndexedFacetDistance;

namespace geos {
namespace algorithm { // geos::algorithm
namespace construct { // geos::algorithm::construct
Expand Down Expand Up @@ -75,6 +73,7 @@ namespace construct { // geos::algorithm::construct
* \author Martin Davis
*/
class GEOS_DLL LargestEmptyCircle {
using IndexedFacetDistance = geos::operation::distance::IndexedFacetDistance;

public:

Expand Down
5 changes: 2 additions & 3 deletions include/geos/algorithm/construct/MaximumInscribedCircle.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class Point;
}
}

using geos::algorithm::locate::IndexedPointInAreaLocator;
using geos::operation::distance::IndexedFacetDistance;

namespace geos {
namespace algorithm { // geos::algorithm
namespace construct { // geos::algorithm::construct
Expand All @@ -54,6 +51,8 @@ namespace construct { // geos::algorithm::construct
* Also computes two points which are separated by the distance.
*/
class GEOS_DLL MaximumInscribedCircle {
using IndexedPointInAreaLocator = geos::algorithm::locate::IndexedPointInAreaLocator;
using IndexedFacetDistance = geos::operation::distance::IndexedFacetDistance;

public:

Expand Down
19 changes: 9 additions & 10 deletions include/geos/algorithm/hull/ConcaveHull.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ class QuadEdgeSubdivision;
}
}

using geos::geom::Coordinate;
using geos::geom::Geometry;
using geos::geom::GeometryFactory;
using geos::geom::Triangle;
using geos::triangulate::quadedge::QuadEdge;
using geos::triangulate::quadedge::QuadEdgeSubdivision;
using geos::triangulate::quadedge::TriangleVisitor;
using geos::triangulate::tri::Tri;
using geos::triangulate::tri::TriList;

namespace geos {
namespace algorithm { // geos::algorithm
namespace hull { // geos::algorithm::hull
Expand Down Expand Up @@ -93,6 +83,15 @@ typedef std::priority_queue<HullTri*, std::vector<HullTri*>, HullTri::HullTriCom
* @author mdavis
*/
class GEOS_DLL ConcaveHull {
using Coordinate = geos::geom::Coordinate;
using Geometry = geos::geom::Geometry;
using GeometryFactory = geos::geom::GeometryFactory;
using Triangle = geos::geom::Triangle;
using QuadEdge = geos::triangulate::quadedge::QuadEdge;
using QuadEdgeSubdivision = geos::triangulate::quadedge::QuadEdgeSubdivision;
using Tri = geos::triangulate::tri::Tri;
template<typename TriType>
using TriList = geos::triangulate::tri::TriList<TriType>;

public:

Expand Down
27 changes: 12 additions & 15 deletions include/geos/algorithm/hull/ConcaveHullOfPolygons.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#pragma once

#include <geos/triangulate/tri/TriList.h>
#include <geos/triangulate/tri/Tri.h>

#include <set>
#include <deque>
Expand All @@ -38,21 +39,6 @@ class Tri;
}
}

#include <geos/triangulate/tri/Tri.h>


using geos::geom::Coordinate;
using geos::geom::CoordinateSequence;
using geos::geom::Envelope;
using geos::geom::Geometry;
using geos::geom::GeometryCollection;
using geos::geom::GeometryFactory;
using geos::geom::LinearRing;
using geos::geom::Polygon;
using geos::triangulate::tri::Tri;
using geos::triangulate::tri::TriList;


namespace geos {
namespace algorithm { // geos::algorithm
namespace hull { // geos::algorithm::hull
Expand Down Expand Up @@ -95,6 +81,17 @@ namespace hull { // geos::algorithm::hull
*
*/
class GEOS_DLL ConcaveHullOfPolygons {
using Coordinate = geos::geom::Coordinate;
using CoordinateSequence = geos::geom::CoordinateSequence;
using Envelope = geos::geom::Envelope;
using Geometry = geos::geom::Geometry;
using GeometryCollection = geos::geom::GeometryCollection;
using GeometryFactory = geos::geom::GeometryFactory;
using LinearRing = geos::geom::LinearRing;
using Polygon = geos::geom::Polygon;
using Tri = geos::triangulate::tri::Tri;
template<typename TriType>
using TriList = geos::triangulate::tri::TriList<TriType>;

private:

Expand Down
16 changes: 8 additions & 8 deletions include/geos/algorithm/hull/HullTri.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ namespace quadedge {
}
}

using geos::geom::Coordinate;
using geos::geom::Triangle;
using geos::triangulate::tri::Tri;
using geos::triangulate::tri::TriList;

namespace geos {
namespace algorithm { // geos::algorithm
namespace hull { // geos::algorithm::hull



class HullTri : public Tri
{
private:
class HullTri : public geos::triangulate::tri::Tri {
using Coordinate = geos::geom::Coordinate;
using Triangle = geos::geom::Triangle;
using Tri = geos::triangulate::tri::Tri;
template<typename TriType>
using TriList = geos::triangulate::tri::TriList<TriType>;

private:

double m_size;
bool m_isMarked = false;
Expand Down
19 changes: 8 additions & 11 deletions include/geos/algorithm/hull/HullTriangulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#pragma once

#include <geos/algorithm/hull/HullTri.h>
#include <geos/triangulate/tri/Tri.h>
#include <geos/triangulate/tri/TriList.h>
#include <geos/triangulate/quadedge/TriangleVisitor.h>

Expand All @@ -34,23 +33,21 @@ class QuadEdgeSubdivision;
}
}

using geos::geom::Geometry;
using geos::geom::GeometryFactory;
using geos::geom::Coordinate;
using geos::triangulate::tri::Tri;
using geos::triangulate::tri::TriList;
using geos::triangulate::quadedge::QuadEdge;
using geos::triangulate::quadedge::QuadEdgeSubdivision;
using geos::triangulate::quadedge::TriangleVisitor;


namespace geos {
namespace algorithm { // geos::algorithm
namespace hull { // geos::algorithm::hull


class HullTriangulation
{
using Geometry = geos::geom::Geometry;
using GeometryFactory = geos::geom::GeometryFactory;
using Coordinate = geos::geom::Coordinate;
template<typename TriType>
using TriList = geos::triangulate::tri::TriList<TriType>;
using QuadEdge = geos::triangulate::quadedge::QuadEdge;
using QuadEdgeSubdivision = geos::triangulate::quadedge::QuadEdgeSubdivision;
using TriangleVisitor = geos::triangulate::quadedge::TriangleVisitor;

private:

Expand Down
12 changes: 3 additions & 9 deletions include/geos/algorithm/hull/OuterShellsExtracter.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,11 @@

namespace geos {
namespace geom {
class Coordinate;
class CoordinateSequence;
class Envelope;
class Geometry;
class GeometryCollection;
class GeometryFactory;
class LinearRing;
class Polygon;
}
}

using geos::geom::Geometry;
using geos::geom::LinearRing;

namespace geos {
namespace algorithm { // geos::algorithm
namespace hull { // geos::algorithm::hull
Expand All @@ -44,6 +35,9 @@ namespace hull { // geos::algorithm::hull
* \author Martin Davis
*/
class OuterShellsExtracter {
using Geometry = geos::geom::Geometry;
using LinearRing = geos::geom::LinearRing;

private:

OuterShellsExtracter(const Geometry& g);
Expand Down
11 changes: 4 additions & 7 deletions include/geos/coverage/Corner.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,16 @@ class LineString;
}
}


using geos::geom::Coordinate;
using geos::geom::Envelope;
using geos::geom::LineString;
using geos::simplify::LinkedLine;


namespace geos {
namespace coverage { // geos::coverage


class Corner
{
using Coordinate = geos::geom::Coordinate;
using Envelope = geos::geom::Envelope;
using LineString = geos::geom::LineString;
using LinkedLine = geos::simplify::LinkedLine;

public:

Expand Down
14 changes: 6 additions & 8 deletions include/geos/coverage/CoverageBoundarySegmentFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ class Geometry;
}
}

using geos::geom::Coordinate;
using geos::geom::CoordinateSequence;
using geos::geom::CoordinateSequenceFilter;
using geos::geom::Geometry;
using geos::geom::LineSegment;

namespace geos {
namespace coverage { // geos::coverage

class CoverageBoundarySegmentFinder : public CoordinateSequenceFilter
class CoverageBoundarySegmentFinder : public geos::geom::CoordinateSequenceFilter
{

using Coordinate = geos::geom::Coordinate;
using CoordinateSequence = geos::geom::CoordinateSequence;
using CoordinateSequenceFilter = geos::geom::CoordinateSequenceFilter;
using Geometry = geos::geom::Geometry;
using LineSegment = geos::geom::LineSegment;

public:

Expand Down
Loading

0 comments on commit d710207

Please sign in to comment.