Repository navigation
Fix GeometryCollection::getAll extension method - #3295
Merged
pomadchin merged 2 commits intoNov 19, 2020
Merged
Conversation
pomadchin
self-requested a review
September 26, 2020 00:11
Member
|
@jpolchlo could you update the changelog? |
Member
|
Hm, I also have a feeling that changes intorduced in this PR #3288 are not neccesary now. I think it makes sense to revert them to keep the code consistent? |
Contributor
Author
|
Happy to update the changelog, but I was/am waiting for discussion as to whether this is the right solution. If you and others are happy with what's presented here, then I'll note the changes and we can move to merge. |
…ass requested, not subclasses Signed-off-by: jpolchlo <[email protected]>
pomadchin
approved these changes
Nov 18, 2020
pomadchin
force-pushed
the
fix/geometrycollection-getall
branch
from
November 18, 2020 23:27
6b59e70 to
0412a57
Compare
2 tasks done
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
As noted in #3289, we have some problems dealing with
GeometryCollections. This bug was traced to the implementation ofgetAllwhich used reflection to extract the contained geometries that matched a desired type. This was intended to be used to extract specific types or subclasses (gc.getAll[Geometry]would be useful). The problem was withgc.getAll(GeometryCollection), sinceMultiPoint,MultiLineString, andMultiPolygonare subclasses ofGeometryCollection. Therefore,gc.getAll[GeometryCollection]would return allMulti*andGeometryCollectionentities. This caused problems for methods likereproject, which would duplicateMulti*elements.This PR, in it's first form, is for discussion purposes. The simple solution presented here is that
getAllloses it's subclass semantic. This is the most straightforward, requiring no additional changes, but it does break the semantics, and therefore, technically must wait for GT 4. A more laborious change could be implemented, keeping the subclass semantics of the oldgetAllimplementation, but reimplementingreprojectand other functions that don't correctly differentiate types. This latter solution is more work, but may be preferred to maintain certain functionality.In all cases, GT 3 broke with the model of GT 2 and down where the contents of geometry collections were explicitly compartmentalized, so we might have some latitude for bending semver rules, as this PR's content can be seen as a bugfix of a broken API rather than a change of interface.
Signed-off-by: jpolchlo [email protected]
Checklist
Notes
Closes #3289