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

Update Feature clustering sample #179

Closed
Closed
Show file tree
Hide file tree
Changes from all 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 @@ -22,8 +22,11 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.AndroidViewModel
import com.arcgismaps.geometry.Point
import com.arcgismaps.geometry.SpatialReference
import com.arcgismaps.mapping.ArcGISMap
import com.arcgismaps.mapping.BasemapStyle
import com.arcgismaps.mapping.Viewpoint
import com.arcgismaps.tasks.geoprocessing.GeoprocessingJob
import com.arcgismaps.tasks.geoprocessing.GeoprocessingParameters
import com.arcgismaps.tasks.geoprocessing.GeoprocessingResult
Expand Down Expand Up @@ -57,6 +60,14 @@ class MapViewModel(
// job used to run the geoprocessing task on a service
private var geoprocessingJob: GeoprocessingJob? = null

init {
map.apply {
initialViewpoint = Viewpoint(
center = Point(-13671170.0, 5693633.0, SpatialReference(wkid = 3857)),
scale = 1e5
)
}
}
/**
* Creates a [geoprocessingJob] with the default [GeoprocessingParameters]
* and a custom query date range between [fromDate] & [toDate]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import com.arcgismaps.geometry.Point
import com.arcgismaps.geometry.SpatialReference
import com.arcgismaps.mapping.Viewpoint
import com.arcgismaps.toolkit.geocompose.MapView
import com.arcgismaps.toolkit.geocompose.MapViewpointOperation
import com.esri.arcgismaps.sample.analyzehotspots.components.MapViewModel
import com.esri.arcgismaps.sample.sampleslib.components.JobLoadingDialog
import com.esri.arcgismaps.sample.sampleslib.components.MessageDialog
Expand Down Expand Up @@ -60,13 +56,7 @@ fun MainScreen(sampleName: String) {
modifier = Modifier
.fillMaxSize()
.weight(1f),
arcGISMap = mapViewModel.map,
viewpointOperation = MapViewpointOperation.Set(
viewpoint = Viewpoint(
center = Point(-13671170.0, 5693633.0, SpatialReference(wkid = 3857)),
scale = 1e5
)
)
arcGISMap = mapViewModel.map
)
// bottom layout with a button to display analyze hotspot options
BottomAppContent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import com.arcgismaps.LoadStatus
import com.arcgismaps.mapping.ArcGISMap
import com.arcgismaps.mapping.BasemapStyle
import com.arcgismaps.mapping.PortalItem
import com.arcgismaps.mapping.Viewpoint
import com.arcgismaps.mapping.layers.FeatureLayer
import com.arcgismaps.mapping.popup.FieldsPopupElement
import com.arcgismaps.mapping.popup.TextPopupElement
Expand Down Expand Up @@ -88,8 +89,10 @@ class MapViewModel(
Portal(application.getString(R.string.portal_url)),
"8916d50c44c746c1aafae001552bad23"
)
// set the map to be displayed in the layout's MapView
map = ArcGISMap(portalItem)
// set the map to be displayed in the layout's MapView and set the initialViewpoint
map = ArcGISMap(portalItem).apply {
initialViewpoint = Viewpoint(39.8, -98.6, 10e7)
}

sampleCoroutineScope.launch {
map.load().onSuccess {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import com.arcgismaps.mapping.Viewpoint
import com.arcgismaps.toolkit.geocompose.MapView
import com.arcgismaps.toolkit.geocompose.MapViewpointOperation
import com.esri.arcgismaps.sample.displaypointsusingclusteringfeaturereduction.components.ClusterInfoContent
import com.esri.arcgismaps.sample.displaypointsusingclusteringfeaturereduction.components.MapViewModel
import com.esri.arcgismaps.sample.sampleslib.components.BottomSheet
Expand Down Expand Up @@ -72,9 +70,6 @@ fun MainScreen(sampleName: String) {
.fillMaxSize()
.weight(1f),
arcGISMap = mapViewModel.map,
viewpointOperation = MapViewpointOperation.Set(
viewpoint = Viewpoint(39.8, -98.6, 10e7)
),
mapViewProxy = mapViewModel.mapViewProxy,
onSingleTapConfirmed = mapViewModel::identify,
onPan = { mapViewModel.dismissBottomSheet() }
Expand Down
Loading