Skip to content

Commit

Permalink
Update MapViewModel.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
ruiqima committed Mar 7, 2024
1 parent e5e2e5c commit fd159ff
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,7 @@ class MapViewModel(
) : AndroidViewModel(application) {

// create a map using the topographic basemap style
val map: ArcGISMap = ArcGISMap(BasemapStyle.ArcGISTopographic).apply {
// set initial Viewpoint to North America
initialViewpoint = Viewpoint(
center = Point(
x = -10977012.785807,
y = 4514257.550369,
spatialReference = SpatialReference(wkid = 3857)
),
scale = 68015210.0
)
}
val map: ArcGISMap = ArcGISMap(BasemapStyle.ArcGISTopographic)

// create a mapViewProxy that will be used to identify features in the MapView
// should also be passed to the composable MapView this mapViewProxy is associated with
Expand Down Expand Up @@ -84,14 +74,25 @@ class MapViewModel(
}

// add the world cities layer with and the damaged properties feature layer
map.operationalLayers.addAll(listOf(mapImageLayer, featureLayer))
map.apply {
// set initial Viewpoint to North America
initialViewpoint = Viewpoint(
center = Point(
x = -10977012.785807,
y = 4514257.550369,
spatialReference = SpatialReference(wkid = 3857)
),
scale = 68015210.0
)
operationalLayers.addAll(listOf(mapImageLayer, featureLayer))
}

}

/**
* Identify the feature layer results and display the resulting information
*/
fun handleIdentifyResult(result: Result<List<IdentifyLayerResult>>) {
private fun handleIdentifyResult(result: Result<List<IdentifyLayerResult>>) {
sampleCoroutineScope.launch {
result.onSuccess { identifyResultList ->
val message = StringBuilder()
Expand Down

0 comments on commit fd159ff

Please sign in to comment.