Closed snodnipper closed 6 years ago
Thank's for the pull request, I'll check this out some more soon.
I'm seeing the needs behind this pull request now. It may not be possible to get the MVT metadata like the layer name + other metadata back out of a JTS tile layers. I'm not sure I understand the 'Sink' private interface change yet. Using a private interface in a public API method likely an issue. I may provide some edits if that's alright.
Is the use of a Sink an attempt to mix in some reactive (Rx) programming style? Maybe this could be taken out and put into a separate pull request. I have some concerns about it, especially where every geometry involves a layer name lookup (linear search layer name string comparison?).
One super picky comment - I generally format code with IntelliJ - auto-indent so function parameters line up. Some new functions in MVTReader have misaligned parameters.
thanks for the comments.
1) Sink interface - I only created this to reduce code duplication and maintain existing code contracts. There are two slightly different code paths that could be simplified (but would be a breaking change).
and
imho, that complexity could be designed out by writing loadMvt
to only use Layers...the code block is:
for(VectorTile.Tile.Layer nextLayer : mvt.getLayersList()) {
String layerName = nextLayer.getName();
We wouldn't therefore need to continually perform lookups for the layer.
I agree that the public / private aspect of void loadMvt
was confusing - I have now marked it as private.
2) Code formatting - no problem, I hope to look at that tomorrow. I normally use checkstyle rules and have been working with IntelliJ in a completely unknown state.
I have added you to our repo should you want to commit further on this branch. No problem either way but I can stop amending commits if we are both working on the branch.
I am currently working on a "feature/layer-enhancement" branch to deal with the inefficiencies discussed - I will message when uploaded for further discussion.
Update: https://github.com/OrdnanceSurvey/mapbox-vector-tile-java/tree/feature/layer-enhancement
Update2: added encoder / decoder util, which could be enhanced to be dev friendly.
See suggested edits at https://github.com/OrdnanceSurvey/mapbox-vector-tile-java/pull/1
PR has latest code (squashed). I am remote today (limited battery / network) so if you'd like to keep more history then I'll have to deal with that tomorrow.
Merged, thank you for your contributions. Will look into maven central release jar very soon with new 2.0.0 version.
Available in 2.0.0 in maven central. @snodnipper
Improve layer support within the vector tile library.
I am not precious about any of this code and I am happy to refactor as appropriate - for example, it might be helpful to rename LayerGroup as Mvt.
Thanks!