Skip to content

Compose MapView: Geometry editor #170

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

Merged
merged 18 commits into from
Oct 30, 2023
Merged
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import com.arcgismaps.mapping.ArcGISMap
import com.arcgismaps.mapping.view.LocationDisplay
import com.arcgismaps.mapping.view.MapView
import com.arcgismaps.mapping.view.MapViewInteractionOptions
import com.arcgismaps.mapping.view.geometryeditor.GeometryEditor
import kotlinx.coroutines.launch

/**
Expand All @@ -49,6 +50,7 @@ public val MapViewInteractionOptionDefaults: MapViewInteractionOptions = MapView
* @param modifier Modifier to be applied to the composable MapView
* @param arcGISMap the [ArcGISMap] to be rendered by this composable
* @param locationDisplay the [LocationDisplay] used by the composable [com.arcgismaps.toolkit.geocompose.MapView]
* @param geometryEditor create and edit geometries by interacting with the composable [com.arcgismaps.toolkit.geocompose.MapView].
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something like,
the [GeometryEditor] used by the composable [com.arcgismaps.toolkit.geocompose.MapView] to create and edit geometries by user interaction

* @param mapViewInteractionOptions the [MapViewInteractionOptions] used by this composable [com.arcgismaps.toolkit.geocompose.MapView]
* @param onViewpointChanged lambda invoked when the viewpoint of the composable MapView has changed
* @param overlay the composable overlays to display on top of the composable MapView. Example, a compass, floorfilter etc.
Expand All @@ -59,6 +61,7 @@ public fun MapView(
modifier: Modifier = Modifier,
arcGISMap: ArcGISMap? = null,
locationDisplay: LocationDisplay = rememberLocationDisplay(),
geometryEditor: GeometryEditor? = null,
mapViewInteractionOptions: MapViewInteractionOptions = MapViewInteractionOptionDefaults,
onViewpointChanged: (() -> Unit)? = null,
overlay: @Composable () -> Unit = {}
Expand All @@ -67,18 +70,15 @@ public fun MapView(
val context = LocalContext.current
val mapView = remember { MapView(context) }

Box(modifier = Modifier.semantics {
contentDescription = "MapViewContainer"
}) {
AndroidView(modifier = modifier
.semantics {
contentDescription = "MapView"
},
Box(modifier = Modifier.semantics { contentDescription = "MapContainer" }) {
AndroidView(
modifier = modifier.semantics { contentDescription = "MapView" },
factory = { mapView },
update = {
it.map = arcGISMap
it.interactionOptions = mapViewInteractionOptions
it.locationDisplay = locationDisplay
it.geometryEditor = geometryEditor
})

overlay()
Expand Down