-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add classes for curved geometry types #1046
Conversation
Looks like you have a winner, @dbaston |
a little helper for myself: classDiagram
class GeometryCollection
class LineString
class SimpleCurve
class Curve
class Polygon
class Surface
class CircularString
class CompoundCurve
class CurvePolygon
class MultiCurve
class MultiSurface
SimpleCurve <|-- LineString
Curve <|-- SimpleCurve
Surface <|-- Polygon
SimpleCurve <|-- CircularString
Curve <|-- CompoundCurve
Surface <|-- CurvePolygon
GeometryCollection <|-- MultiCurve
GeometryCollection <|-- MultiSurface
|
From QGIS side, I don't expect any troubles from the difference, most code works on geometry level (and not individual geos class level), we this is pretty transparent. @nyalldawson @lbartoletti @elpaso (as last contributors there) do you see any potential problem? |
No, looks ok to me. Glad to have curve support in GEOS! kudos @dbaston |
c85565c
to
9d77ade
Compare
Perhaps mark this as Draft? |
f30a751
to
e7eb5a2
Compare
I think this is ready for review. While large, I think it represents the minimum set of changes that can safely go into master:
|
This PR adds curved geometry types to the GEOS
Geometry
hierarchy and adds support to theWKTReader
for reading them. It is not ready to be merged; I'm just posting it at this stage in case anyone has feedback on the class hierarchy before I continue with implementation.It makes the following additions to the class hierarchy:
SimpleCurve
toLineString
.Curve
toSimpleCurve
.Surface
toPolygon
.CircularString
withSimpleCurve
as a parentCompoundCurve
withCurve
as a parentCurvePolygon
withSurface
as a parentMultiCurve
withGeometryCollection
as a parentMultiSurface
withGeometryCollection
as a parentIt turns out this is pretty close to what OGR does, except that OGR does
Surface
-->CurvePolygon
-->Polygon
instead of having bothCurvePolygon
andPolygon
as children ofSurface
. While it is true that aPolygon
is a specialization of aCurvePolygon
, settingCurvePolygon
as the parent has a downside of making the result ofdynamic_cast<CurvePolygon*>
less informative, and I didn't see an upside that would outweigh this annoyance. Similarly, I did not makeMultiPolygon
a subclass ofMultiSurface
, orMultiLineString
a subclass ofMultiCurve
. But I'm receptive to the argument that it's simpler to just do things the same as OGR.The QGIS class hierarchy looks to be the same as OGR's, except for the omission of
SimpleCurve
.