Skip to content

Redraw GeoJSON features after style changes - #1732

Merged
dkhawk merged 2 commits into
googlemaps:mainfrom
arpitagarwal1301:fix/1050-redraw-polygon-style
Aug 5, 2026
Merged

dkhawk merged 2 commits into
googlemaps:mainfrom
arpitagarwal1301:fix/1050-redraw-polygon-style

Conversation

@arpitagarwal1301

Copy link
Copy Markdown
Contributor

Fixes #1050.

Observe legacy GeoJSON features so style and geometry changes invalidate the cached renderer model and redraw map objects with the updated values. Repeated insertion remains idempotent, removed features detach their observer, and null-geometry features remain safe across the layer lifecycle.

Multi-geometries now keep their rendered children under the parent feature, preserving complete removal and click lookup. Multi-polygons also carry their polygon style into the renderer.

Tests:

  • data module unit tests, including focused redraw and renderer ownership regressions
  • data module lint
  • data debug assembly
  • diff whitespace check

@dkhawk
dkhawk force-pushed the fix/1050-redraw-polygon-style branch from 3166419 to 75f82bd Compare August 5, 2026 00:09
private var mIsLayerOnMap = false
private val mFeatureMap = HashMap<GeoJsonFeature, com.google.maps.android.data.renderer.model.Feature>()
private val mModelToLegacyFeatures = HashMap<com.google.maps.android.data.renderer.model.Feature, GeoJsonFeature>()
private val mModelToLegacyFeatures = java.util.IdentityHashMap<com.google.maps.android.data.renderer.model.Feature, GeoJsonFeature>()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use an import instead of the FQDN?

)
}

is com.google.maps.android.data.renderer.model.MultiGeometry -> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import instead.

Address review feedback by replacing inline fully-qualified domain names with aliased imports at the top of the file.
@dkhawk

dkhawk commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@kikoso Thank you for the review. All inline fully qualified class names in GeoJsonLayer.kt have been replaced with imported aliases at the top of the file.

@kikoso kikoso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dkhawk
dkhawk merged commit 051cb83 into googlemaps:main Aug 5, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants