forked from libgeos/geos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add classes for curved geometry types
- Loading branch information
Showing
30 changed files
with
2,684 additions
and
1,014 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/********************************************************************** | ||
* | ||
* GEOS - Geometry Engine Open Source | ||
* http://geos.osgeo.org | ||
* | ||
* Copyright (C) 2024 ISciences, LLC | ||
* | ||
* This is free software; you can redistribute and/or modify it under | ||
* the terms of the GNU Lesser General Public Licence as published | ||
* by the Free Software Foundation. | ||
* See the COPYING file for more information. | ||
* | ||
**********************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <geos/geom/SimpleCurve.h> | ||
|
||
namespace geos { | ||
namespace geom { | ||
|
||
class GEOS_DLL CircularString : public SimpleCurve { | ||
|
||
public: | ||
using SimpleCurve::SimpleCurve; | ||
|
||
friend class GeometryFactory; | ||
|
||
~CircularString() override; | ||
|
||
std::unique_ptr<CircularString> clone() const; | ||
|
||
std::string getGeometryType() const override; | ||
|
||
GeometryTypeId getGeometryTypeId() const override; | ||
|
||
CircularString* cloneImpl() const override | ||
{ | ||
return new CircularString(*this); | ||
} | ||
|
||
CircularString* reverseImpl() const override; | ||
|
||
int | ||
getSortIndex() const override | ||
{ | ||
return SORTINDEX_LINESTRING; | ||
}; | ||
|
||
}; | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/********************************************************************** | ||
* | ||
* GEOS - Geometry Engine Open Source | ||
* http://geos.osgeo.org | ||
* | ||
* Copyright (C) 2024 ISciences, LLC | ||
* | ||
* This is free software; you can redistribute and/or modify it under | ||
* the terms of the GNU Lesser General Public Licence as published | ||
* by the Free Software Foundation. | ||
* See the COPYING file for more information. | ||
* | ||
**********************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <geos/geom/SimpleCurve.h> | ||
#include <vector> | ||
|
||
namespace geos { | ||
namespace geom { | ||
|
||
class GEOS_DLL CompoundCurve : public Curve { | ||
friend class GeometryFactory; | ||
|
||
|
||
public: | ||
|
||
CompoundCurve(const CompoundCurve&); | ||
|
||
CompoundCurve& operator=(const CompoundCurve&); | ||
|
||
std::unique_ptr<CoordinateSequence> getCoordinates() const override; | ||
|
||
const CoordinateXY* getCoordinate() const override; | ||
|
||
uint8_t getCoordinateDimension() const override; | ||
|
||
bool hasZ() const override; | ||
|
||
bool hasM() const override; | ||
|
||
bool isEmpty() const override; | ||
|
||
bool isClosed() const override; | ||
|
||
std::size_t getNumGeometries() const override; | ||
|
||
const Geometry* getGeometryN(std::size_t) const override; | ||
|
||
std::size_t getNumPoints() const override; | ||
|
||
std::unique_ptr<Geometry> getBoundary() const override; | ||
|
||
std::string getGeometryType() const override; | ||
|
||
GeometryTypeId getGeometryTypeId() const override; | ||
|
||
bool equalsExact(const Geometry* other, double tolerance = 0) | ||
const override; | ||
|
||
bool equalsIdentical(const Geometry* other) const override; | ||
|
||
const Envelope* getEnvelopeInternal() const override | ||
{ | ||
return &envelope; | ||
} | ||
|
||
std::unique_ptr<CompoundCurve> clone() const; | ||
|
||
CompoundCurve* cloneImpl() const override; | ||
|
||
std::unique_ptr<CompoundCurve> reverse() const; | ||
|
||
CompoundCurve* reverseImpl() const override; | ||
|
||
void apply_rw(const CoordinateFilter* filter) override; | ||
|
||
void apply_ro(CoordinateFilter* filter) const override; | ||
|
||
void apply_rw(GeometryFilter* filter) override; | ||
|
||
void apply_ro(GeometryFilter* filter) const override; | ||
|
||
void apply_rw(GeometryComponentFilter* filter) override; | ||
|
||
void apply_ro(GeometryComponentFilter* filter) const override; | ||
|
||
void apply_rw(CoordinateSequenceFilter& filter) override; | ||
|
||
void apply_ro(CoordinateSequenceFilter& filter) const override; | ||
|
||
void normalize() override; | ||
|
||
int compareToSameClass(const Geometry* geom) const override; | ||
|
||
|
||
protected: | ||
CompoundCurve(std::vector<std::unique_ptr<SimpleCurve>>&&, | ||
const GeometryFactory&); | ||
|
||
int getSortIndex() const override | ||
{ | ||
return SORTINDEX_COMPOUNDCURVE; | ||
} | ||
|
||
void geometryChangedAction() override | ||
{ | ||
envelope = computeEnvelopeInternal(); | ||
} | ||
|
||
Envelope computeEnvelopeInternal(); | ||
|
||
private: | ||
std::vector<std::unique_ptr<SimpleCurve>> curves; | ||
Envelope envelope; | ||
}; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/********************************************************************** | ||
* | ||
* GEOS - Geometry Engine Open Source | ||
* http://geos.osgeo.org | ||
* | ||
* Copyright (C) 2024 ISciences, LLC | ||
* | ||
* This is free software; you can redistribute and/or modify it under | ||
* the terms of the GNU Lesser General Public Licence as published | ||
* by the Free Software Foundation. | ||
* See the COPYING file for more information. | ||
* | ||
**********************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <geos/geom/Geometry.h> | ||
|
||
namespace geos { | ||
namespace geom { | ||
|
||
class GEOS_DLL Curve : public Geometry { | ||
|
||
public: | ||
/// Returns line dimension (1) | ||
Dimension::DimensionType getDimension() const override | ||
{ | ||
return Dimension::L; // line | ||
} | ||
|
||
int | ||
getBoundaryDimension() const override | ||
{ | ||
return isClosed() ? Dimension::False : 0; | ||
} | ||
|
||
virtual bool isClosed() const = 0; | ||
|
||
protected: | ||
|
||
Curve(const GeometryFactory& factory) : Geometry(&factory) {} | ||
|
||
}; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/********************************************************************** | ||
* | ||
* GEOS - Geometry Engine Open Source | ||
* http://geos.osgeo.org | ||
* | ||
* Copyright (C) 2024 ISciences, LLC | ||
* | ||
* This is free software; you can redistribute and/or modify it under | ||
* the terms of the GNU Lesser General Public Licence as published | ||
* by the Free Software Foundation. | ||
* See the COPYING file for more information. | ||
* | ||
**********************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <geos/geom/SurfaceImpl.h> | ||
|
||
namespace geos { | ||
namespace geom { | ||
|
||
class GEOS_DLL CurvePolygon : public SurfaceImpl<Curve> { | ||
friend class GeometryFactory; | ||
|
||
public: | ||
~CurvePolygon() override = default; | ||
|
||
std::unique_ptr<CoordinateSequence> getCoordinates() const override; | ||
|
||
int | ||
getSortIndex() const override | ||
{ | ||
return SORTINDEX_CURVEPOLYGON; | ||
} | ||
|
||
std::string getGeometryType() const override; | ||
|
||
GeometryTypeId getGeometryTypeId() const override; | ||
|
||
std::unique_ptr<Geometry> getBoundary() const override; | ||
|
||
void normalize() override; | ||
|
||
protected: | ||
using SurfaceImpl::SurfaceImpl; | ||
|
||
Geometry* cloneImpl() const override; | ||
|
||
Geometry* reverseImpl() const override; | ||
}; | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.