-
Notifications
You must be signed in to change notification settings - Fork 373
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
Geos 3.10 documentation contradicts implementation #564
Comments
I would say that the documentation has never been accurate, rather than recent changes breaking something, but please feel free to set me straight. As you point out, the You can't do much in GEOS without accessing Coordinates. A The flaw I see in |
Time to remove the inheritance and have |
I think so. I'm toying with a single class that can store (via a union) any of (a) |
As we've both noted, the current
The fact that persisting the coordinate is required was not immediately apparent to me. Clearly it's required now, but the way that Regardless, it sounds like you're leaning toward removing the in inheritable nature of Thank you for answering the question so quickly! |
+1. Time to open an RFC or start a Discussion? |
Is there an action to be taken here? The documentation could be removed, but it's not wrong in theory, just a little blind to the limitations of a sub-classing approach in practice. |
I would say the quoted section is wrong and should just be removed:
Yes, you might want this, but no, GEOS provides no means for you to do so. |
I understand that the C++ API should be treated as unstable, and I accept the risks of using an unstable API. This is not a complaint that the API changed. This is a bug in the documentation, which does not match the implementation.
As Geos stands today, it explicitly breaks one of the use cases outlined in the documentation as one that it caters to. I would like to understand if this is intentional or not so that I can decide whether to cut and run, fork the project, or try to fix it.
The documentation of
geos::geom::CoordinateSequence
states:Given this description, and the description of
CoordinateSequence::getAt
, which statesI believe it is reasonable to conclude that a custom
CoordinateSequence
implementation which does not store the underlyingdata as
Coordinate
objects should be allowed to construct temporaryCoordinates
any time it needs to interface with the restof libGeos. Already, this is problematic because the
getAt
method is defined to return a reference, meaning at the very least thecustom
CoordinateSequence
would have to hold a persistentCoordinate
as a member variable that it could populate and returnthe reference to.
This issue becomes more obvious working with the filter functions
CoordinateSequence::apply_ro
andCoordinateSequence::apply_rw
. TheCoordinateFilter
interface takes pointers toCoordinate
objects, and in some cases these filters make assumptions about the underlying structure of the data or persistence of the pointers. The two specific issues I have come across while attempting to update libGeos are the implementations ofgeos::operation::valid::RepeatedPointFilter
andgeos::algorithm::locate::IndexedPointInAreaLocator::SegmentView
. In the former case, there is an assumption made that the pointers passed in continue to be valid at least until the next pointer is passed in; in the latter case, there's an assumption that the two pointers passed in are adjacent to each other such that the first can be incremented to reach the second.I see that a lot of the recent changes internally have been performance-oriented, and I laud that effort; however, they've come at the expense of an immensely useful piece of the API that has the potential to provide a bigger benefit than reducing the number of
virtual
calls in a hot loop. Allowing users to define their ownCoordinateSequence
type which integrates with the rest of geos and does not require usingCoordinate
as an underlying storage type allows users to utilize the power of this library without having to be constantly copying the data from their custom data storage format into and out of theCoordinate
type.I would like to know if this is an intentional break and using
CoordinateSequence
as I've described isn't actually supported. If so, the documentation should be changed to indicate that this use case is no longer supported. If not, then I believe the API ofCoordinateSequence
should be modified such that it doesn't return references or pass pointers to filters, and that filters should make no assumptions about the layout or persistence of data and should prefer to copy coordinates instead.The text was updated successfully, but these errors were encountered: