Skip to content

Commit

Permalink
Avoid repeatedly recreating GeometryEditorStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
darryl-lynch committed Jan 17, 2025
1 parent dc71387 commit 2977748
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class CreateAndEditGeometriesViewModel(application: Application) : AndroidViewMo
// create a MapViewProxy that will be used to identify features in the MapView and set the viewpoint
val mapViewProxy = MapViewProxy()

// create a geometryEditorStyle
private val geometryEditorStyle = GeometryEditorStyle()
// create a graphic to hold graphics identified on tap
private var identifiedGraphic = Graphic()
// create a graphics overlay
Expand Down Expand Up @@ -118,9 +120,9 @@ class CreateAndEditGeometriesViewModel(application: Application) : AndroidViewMo

// give the graphic an appropriate fill based on the geometry type
when (geometry) {
is Point, is Multipoint -> graphic.symbol = GeometryEditorStyle().vertexSymbol
is Polyline -> graphic.symbol = GeometryEditorStyle().lineSymbol
is Polygon -> graphic.symbol = GeometryEditorStyle().fillSymbol
is Point, is Multipoint -> graphic.symbol = geometryEditorStyle.vertexSymbol
is Polyline -> graphic.symbol = geometryEditorStyle.lineSymbol
is Polygon -> graphic.symbol = geometryEditorStyle.fillSymbol
else -> {}
}
// add the graphic to the graphics overlay
Expand Down

0 comments on commit 2977748

Please sign in to comment.