Skip to content
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

GeoJsonFeature.setPolygonStyle() doesn't redraw polygon if the feature was previously added via GeoJsonLayer.addFeature() #1050

Open
appach22 opened this issue Jan 8, 2022 · 0 comments
Labels
priority: p4 An issue that should be addressed eventually. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@appach22
Copy link

appach22 commented Jan 8, 2022

Summary

First I add GeoJsonLayer without features to map. Then I continiously add features using GeoJsonLayer.addFeature() and all the features are appearing on the map. Next I try to call GeoJsonFeature.setPolygonStyle() on the added features, but corresponding polygons don't change their appearance.

Expected behavior

Calling GeoJsonFeature.setPolygonStyle() should redraw the feature with the given style.

Observed behavior

The feature's appearance remains the same as before.

Environment details

Library version 2.3.0

Code example

// Add layer with empty features array
val geoJsons = JSONArray()
val geoJson = JSONObject()
geoJson.put("type", "FeatureCollection")
geoJson.put("features", geoJsons)
val layer = GeoJsonLayer(googleMap, geoJson)
val style = layer.defaultPolygonStyle
style.strokeColor = Color.RED
layer.addLayerToMap()

// This will draw the feature with red stroke
layer.addFeature(geoJsonFeature)

// Changing stroke color
val style = geoJsonFeature.polygonStyle
style.strokeColor = Color.BLUE
// This line should affect the polygon appearance but it doesn't
geoJsonFeature.polygonStyle = style

I suppose that the reason is Layer.addFeature() calls improper version of underlyed renderer's addFeature() (Renderer.addFeature() instead of GeoJsonRenderer.addFeature())

@appach22 appach22 added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 8, 2022
@appach22 appach22 changed the title GeoJsonFeature.setPolygonStyle() doesn't redraw polygon if the feature was prewiously added via GeoJsonLayer.addFeature() GeoJsonFeature.setPolygonStyle() doesn't redraw polygon if the feature was previously added via GeoJsonLayer.addFeature() Jan 13, 2022
@kikoso kikoso added priority: p4 An issue that should be addressed eventually. and removed triage me I really want to be triaged. labels Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p4 An issue that should be addressed eventually. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants