Skip to content

Commit 1400121

Browse files
hud10837puneet-pdxgunt0001shubham7109changanxian
authored
Feature branches/geo compose (#355)
* Implements setting and modifying a map/layers (#136) * changes to display a map * remove unnecessary line * add viewmodel to the micro app * Revert "add viewmodel to the micro app" This reverts commit cfc6b0b. * address code review feedback * remove unused imports * add overlay support (#143) * add overlay support * add doc * remove the fillmaxsize modifier * remove MapState * add viewpointChangedLambda (#159) * add viewpointChangedLambda * address code review feedback * Support LocationDisplay (#160) * add location display micro app * add location permissions * add support for location display * screen to start/stop a location display * fix typo * show error message if location display fails to start * add AppBar and auto pan mode options * fix type of key * improve doc * add readme * adjust screen shot size * adjust screen shot size * set MapView properties in the update callback * use by remember for mutable state * set error message when LDS fails to start when toggling switch * fix doc references to composable Map * Compose Map InteractionOptions (#163) * Rename - Compose MapView (#165) * Compose MapView: Geometry editor (#170) * Compose MapView: SelectionProperties (#173) * add support for WrapAroundMode (#176) * Compose MapView: ViewLabelProperties (#174) * add implementation for gesture events (#172) * add implementation for gesture events * update SDK dependency add Events exposed on GeoView * address code review comment * address code review comments * refactor mapView.viewpointChanged * Compose Map - graphics overlay (#166) * moved GraphicsOverlaysUpdater (#183) * added grid & backgroundGrid impl (#192) * Draw Status (#186) * Geometry editor micro-app (#178) * added invoke (#197) * Update MapView doc pattern (#191) * add support for attribution text (#187) * add support for attribution text * combine attribution bar properties/events in a state object * refactor mapview parameter list * update collect lambda * Update doc * update doc * Add spatialreference changed callback (#193) * invoke currentOnInteractingChanged with initial value of isInteracting * add callback to mapview * rm initial value calls * change ?.let calls to ?.invoke * move parameter above onInteractingChanged * move launch statement above onInteracitngChanged * MapView Rotation & Scale (#195) * Add inset support (#182) * add mapview inset app * add app to settings.gradle * WIP * update formatting * address code review comments * update setViewInset values * add readme * Update README.md * add doc * address code review feedback * rename mapinsets to insets * rename mapinsets * update doc * address code review comments * Add mapview proxy (#190) * create MapViewOperator class * add param to MapView composable * add locationToScreen and doc * more doc * refactor MapView composable to remove unnecessary code * move mapoperator mapview setting to own disposable effect * don't use synchronize for operations * Eof newline * make MapViewOperator derive from a new GeoViewOperator * eof newline * return null if nan from locationToScreen * add copyrights * fix doc * fix doc * rename operator to proxy * rm overlay param again * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/GeoViewProxy.kt Co-authored-by: Gunther Heppner <gheppner@esri.com> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/MapView.kt Co-authored-by: Gunther Heppner <gheppner@esri.com> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/MapViewProxy.kt Co-authored-by: Gunther Heppner <gheppner@esri.com> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/MapViewProxy.kt Co-authored-by: Gunther Heppner <gheppner@esri.com> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/MapViewProxy.kt Co-authored-by: Gunther Heppner <gheppner@esri.com> * Apply doc fixes from code review Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * mv param below geometry editor * fix doc line length * fix param doc * fix param doc --------- Co-authored-by: Gunther Heppner <gheppner@esri.com> Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * update the copyright to the apache License (#203) * add support for onNavigationChanged (#199) * add support for onNavigationChanged * add doc * MapView TimeExtent (#194) * Support for setting Viewpoint on MapView (#202) * support for ViewpointOperation - initial commit * MapViewpointOperation - prototyping * implement await() on MapViewpointOperation, remove onCompleted callbacks * renaming * add execute extension for remaining operations * rename Bounding to SetBoundingGeometry * add set bookmark * add remaining operations to when statement * make execute an abstract fun on MapViewpointOperation * Add set viewpoint app * fix typo * add dependency to microapp on geocompose * add simple app to set viewpoint with different options * add progress indicator to demonstrate await pattern * extract bookmark to remembered val * make abstract fun an extension fun instead * add doc * add readme to microapp * eof newline * fix readme title * rever locationdisplayapp changes * update screenshot * update readme wording * use a simple list instead of reflection * add doc to MainScreen * add dash to project app name * naming and doc changes * mv onViewpointChanged parameter * change dfeautl animate duration to 0.25 * update microapp module namw --------- Co-authored-by: Hudson Miears <hud10837@esri.com> * Refactor mapview insets app (#206) * update all since tags in geo-compose module (#227) * Geo-compose: add identify methods and microapp (#223) * add methods to geoviewproxy * rename identifyLayer and identifyGraphicsOverlay to identify as overloads * add prototype app * fix recursive bug * refactor app to separate subcomponents * make one source of truth for geoview in geoviewproxy * make one source of truth for geoview in geoviewproxy * mv business logic to view model class * update doc * add doc to microapp * add top bar * add readme and screenshot * adjust readme description * adjust string resources and error messages * modify identify method to be cancellable and consolidate logic * adjust bottom sheet to only expand to half screen height and move map viewpoint * rename EventDetails -> IdentifyDetails * nullGEoViewErrorMessage no longer uses a getter * rework caching of mapview in proxy to match previous implementation * change doc DIPS -> Dp * fix tolerance parameter types -> Dp * use nullable maximumResults to match swift * sanitize max results * rm yield * add doc enhancements * extract maximum results fun * clamp 0 values for maximumResults * rm throws doc * adjust insets on bottom sheet state change * rm insets behavior * fix doc references * fix doc 200.4.0 * update screenshot * rename className prop * make details height a const * Rename MapView-related microapps to have MapView prefix (#226) * Rename MapView-related microapps to have MapView prefix * Rename all other instances with mapview prefix * rename names in readmes * rename files * rename test directories * add onUnitsPerDipChanged callback lambda (#232) * Add exportImage fun to GeoViewProxy (#233) * Add exportImage fun to GeoViewProxy * update doc * update doc * add isWrapAroundEnabled property to GeoViewProxy (#231) * add isWrapAroundEnabled property to GeoViewProxy * update @SInCE * add doc * Geo-compose: add basic SceneView function (#230) * add SceneView function * eof newline * fix doc and copyright * don't use fully qualified sceneview * added compose BOM (#237) * add ViewPointState (#234) * add ViewPointState * address code review feedback * update doc * Hud10837/layer view state (#228) * add methods to geoviewproxy * rename identifyLayer and identifyGraphicsOverlay to identify as overloads * add prototype app * fix recursive bug * refactor app to separate subcomponents * make one source of truth for geoview in geoviewproxy * make one source of truth for geoview in geoviewproxy * mv business logic to view model class * update doc * add doc to microapp * add top bar * add readme and screenshot * adjust readme description * adjust string resources and error messages * modify identify method to be cancellable and consolidate logic * adjust bottom sheet to only expand to half screen height and move map viewpoint * rename EventDetails -> IdentifyDetails * nullGEoViewErrorMessage no longer uses a getter * rework caching of mapview in proxy to match previous implementation * change doc DIPS -> Dp * fix tolerance parameter types -> Dp * use nullable maximumResults to match swift * sanitize max results * rm yield * add doc enhancements * extract maximum results fun * clamp 0 values for maximumResults * rm throws doc * adjust insets on bottom sheet state change * add layerviewstatechanged callback * add getLayerViewState * move getLayerViewState * mv param position and fix identify mainscreen * SceneView: add sceneview gesture events (#241) * add SceneView function * eof newline * fix doc and copyright * add gesture events * fix param doc" * SceneView: create SceneViewProxy (#246) * create initial SceneViewProxy class * add disposal logic to proxy class * add sceneViewProxy to SceneView * add copyright * SceneView: graphics overlays (#245) * extract graphicsoverlayupdater * eof newline * SceneView: add scene viewpoint operation (#240) * create SceneViewpointOperation * add operation to sceneview * add all operations for sceneview * add doc * eof newline * eof newline * Don't use named params on viewpoint updater * use kotlinx cancellation exception * add copyright * use duration in viewpoint operations * doc * rename durationSeconds and fix microapp * Update feature branch with v.next (#243) * add navigationchanged to sceneview (#248) * SceneView: add ViewLabelProperties (#249) * add viewlabelproperties to sceneview' * fix doc --------- Co-authored-by: Gunther Heppner <gheppner@esri.com> * SceneView: attribution (#247) * mv AttributionStateHandler function to AttributionState.kt * add attributionState param to SceneView * add @SInCE tag --------- Co-authored-by: Gunther Heppner <gheppner@esri.com> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt (#253) Co-authored-by: Gunther Heppner <gheppner@esri.com> * shared the ViewpointChangedState with SceneView (#261) * SceneView TimeExtent (#260) * shared the ViewpointChangedState with SceneView * review update * merge with the feature branch * SceneView spatial reference changed (#258) * add spatial ref changed support * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * shared the ViewpointChangedState with SceneView --------- Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * shared the ViewpointChangedState with SceneView (#257) * add layerViewStateChanged to SceneView (#262) * The view property needs to be assigned in ViewProxy class (#264) * add cameraController oaram to sceneview (#265) * add onDrawStatusChanged to SceneView (#266) * add FieldOfView (#270) * SceneView: add sunLighting and sunTime (#275) * add sunLighting and sunTime * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> --------- Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * SceneView current viewpoint camera (#256) * add getCurrentViewpointCamera in proxy * expose the currentViewpoint property * impls current view camera * adds a space for lambda * merged with feature branch. * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> --------- Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * add atmosphereEffect (#278) * Add funs for screen coordinate conversion (#272) * Add funs for screen coordinate conversion * update doc * update doc for SceneView Suntime and SunLighting (#282) * SceneView: AnalysisOverlayCollection (#269) * create AnalysisOverlayCollection * mv factory for graphics overlay collection * add analysis to scene view * eof newlines * add doc * Fix doc that mentions graphics overlays Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * mv factory function to SceneView file * address doc comments * mv updater to SceneView file * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> --------- Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * Add space effects on the scene view (#281) * add space effects on scene view * update the comment * SceneView: ambient light color (#279) * add sceneview ambientLightColor param * fix doc * rm full stop * SceneView: add manual rendering funs to SceneViewProxy (#280) * add manual rendering funs to SceneViewProxy * Fix doc * fix doc * SceneView: ImageOverlays (#274) * add ImageOverlayCollection and property * mv factory function to SceneView file * fix doc comments * mv updater to sceneview.kt * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * use data object for Cleared event * use data object for cleared even tin AnalysisOverlayCollection * use data object for cleared event in GraphicsOverlayCollection --------- Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> * SceneView: lighting options microapp (#286) * add sceneview ambientLightColor param * add space effects on scene view * update the comment * fix doc * create lighting options microapp base * set up dropdown menu * add sun time options * add lighting mode options * add Ambient light color options * add atmosphere effect options * add space effect options * change viewpoint and fix sun time picker * clean up code * use sliders instead of textfields for rgb colors * add doc * add readme and screenshot * eof newline * add doc to components * add missing imports * Add doc DropdownMenuAlertDialog * add missing copyright headers * add doc RgbaSlider * add remaining doc * Update microapps/SceneViewLightingOptionsApp/README.md Co-authored-by: Gunther Heppner <gheppner@esri.com> --------- Co-authored-by: Changan Shi <cshi@esri.com> Co-authored-by: Gunther Heppner <gheppner@esri.com> * bumping sdk to 4122 (#300) Co-authored-by: Soren Roth <sor10874@esri.com> * add maven publishing to geo-compose (#301) Co-authored-by: Soren Roth <sor10874@esri.com> * Scene view camera controller app (#288) * init implementation for camera controller * add gitignore * adds comments and remove view model. * update the doc and png image * update the comment * add the extra space line * update the screenshot * review update * update the 2023 comment * update the comment * review update * v next merge to geo compose (#303) * change name of Licesne file in preparation for migration to Esri * revert change to license file name * remove extra license file * Update README.md images (#102) * holder commit * Update README.md update link * upload screenshot image * add images to the micro app * Update README.md * Update README.md * use updated name of the auth dependency in README * Create t9nmanifest.txt (#167) * removed module and microapp (#208) * Update gradle.properties (#211) * Update build.gradle.kts (#212) * updates client id and redirect Uri (#216) * Take out build numbers for publishing (#219) * update dependency section of readme for 200.3.0 (#220) * Improve WebView Display (#213) * Update gradle.properties (#238) * Update dependency versions (#235) * kdoc project to doc the released toolkit components. (#284) * kdoc project to doc the released toolkit components. * add dependencies on the dependencies of the released projects. * Update kdoc/build.gradle.kts Co-authored-by: Erick Lopez Solis <erick_solis@esri.com> --------- Co-authored-by: Soren Roth <sor10874@esri.com> Co-authored-by: Erick Lopez Solis <erick_solis@esri.com> * add kdoc project! --------- Co-authored-by: Soren Roth <sor10874@esri.com> Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> Co-authored-by: Rama Chintapalli <rchintapalli@esri.com> Co-authored-by: Shubham Sharma <shubhamsharma@esri.com> Co-authored-by: Erick Lopez Solis <erick_solis@esri.com> Co-authored-by: Gunther Heppner <gheppner@esri.com> Co-authored-by: hud10837 <hmiears@esri.com> * Micro app - sceneview viewpoint navigation (#291) * add micro app * update doc * add readme, screenshot. Remove use of spinner * update readme * update doc * update readme * update screenshot * update image, add new location remove unused imports * Geo-Compose: Add module README (#294) * add readme and screenshot to geo-compose module * use table for screenshot * reduce screenshot size * reduce screenshot size * reduce screenshot size * increase screenshot size * reduce screenshot size * Deprecate composable-map (#293) * changes for authentication and compass app * update floorfilter micro app * deprecate composable map * update deprecated annotation * add deprecation annotation to public components * update template-app to use geo-compose module * remove unused import reformat code * Add missing doc to geo-compose classes (#307) * added attribution bar changes (#309) * Geo-compose: Remove ViewpointChangedEvent (#310) * modify mapview with new params * modify sceneview with new params * delete viewpointchangedstate * Geo-compose: Remove ViewpointOperations (#316) * rm MapViewpointOperation * rm SceneViewpointOperation * add mapviewproxy methods * add sceneviewproxy methods * update mapview set viewpoint app * refactor sceneview setviewpointapp * refactor mapview setviewpointapp to match structure of sceneview app * update readmes * rm progress indicator from sceneview app * address pr comments * address pr comments * Compose doc improvements (#315) * Add @stable annotation #319 * Update SceneViewCameraController app to use SceneViewProxy (#325) * Update SceneViewCameraController app to use SceneViewProxy setViewPointCameraAnimated function * update floorFilterApp * Merge v.next into feature-branches/geo-compose (#327) * change name of Licesne file in preparation for migration to Esri * revert change to license file name * remove extra license file * Update README.md images (#102) * holder commit * Update README.md update link * upload screenshot image * add images to the micro app * Update README.md * Update README.md * use updated name of the auth dependency in README * Create t9nmanifest.txt (#167) * removed module and microapp (#208) * Update gradle.properties (#211) * Update build.gradle.kts (#212) * updates client id and redirect Uri (#216) * Take out build numbers for publishing (#219) * update dependency section of readme for 200.3.0 (#220) * Improve WebView Display (#213) * Update gradle.properties (#238) * Update dependency versions (#235) * kdoc project to doc the released toolkit components. (#284) * kdoc project to doc the released toolkit components. * add dependencies on the dependencies of the released projects. * Update kdoc/build.gradle.kts Co-authored-by: Erick Lopez Solis <erick_solis@esri.com> --------- Co-authored-by: Soren Roth <sor10874@esri.com> Co-authored-by: Erick Lopez Solis <erick_solis@esri.com> * Add version to API ref (#314) --------- Co-authored-by: Soren Roth <sor10874@esri.com> Co-authored-by: Soren Roth <sroth@esri.com> Co-authored-by: Rama Chintapalli <rchintapalli@esri.com> Co-authored-by: Shubham Sharma <shubhamsharma@esri.com> Co-authored-by: Erick Lopez Solis <erick_solis@esri.com> Co-authored-by: Gunther Heppner <gheppner@esri.com> Co-authored-by: hud10837 <hmiears@esri.com> * Revisit GraphicsOverlayCollection, AnalysisOverlayCollection and ImageOverlayCollection (#320) * Remove GraphicsOverlaysCollection and its usage Add parameter to MapView to take graphicsOverlays as List * update mapView and SceneView to use arrays for image overlays and analysis overlays update micro app * update geometry editor micro app * remove all graphics overlays, rather than just clear graphics * Update param type to List * remove comma * update doc * update micro app * remember emptylist() * use it instead of mapView * use it instead of sceneView * use it instead of sceneView * use it instead of sceneView --------- Co-authored-by: Gunther Heppner <gheppner@esri.com> * modify compass microapp to use mapViewProxy for viewpoints (#337) * Composable MapView/SceneView: remember default parameters (#330) * add remember to default parameters in mapview * add remember to default parameters in sceneview * add circular progress indicator to sceneview setviewpoint microapp * fix lighting options app * use defaults for sceneview * add mapviewdefaults * add doc * Update map and scene parameters to be non-nullable (#331) * SceneView: analysis overlay microapp (#306) * add readme and screenshot to geo-compose module * create microapp module * add prototype version * clean up implementation * add readme * update screenshot * revert screenshot for GeoCompose * update GraphicOverlays and AnalysisOverlay to use latest implementation * update ReadMe * fix typo * add description doc for MainScreen() --------- Co-authored-by: Puneet Prakash <Puneet_Prakash@esri.com> * Composable GeoViews: Viewpoint Persistence (#343) * prototype persistence enum * move viewpoint related code to separate function * ensure persistence type changes are monitored * persist camera for sceneview * initialize sceneview with default matrix * add doc * always set persisted viewpoint even when null * use when statement * mv visible area changed invocation * rename viewpoint persistence * permit nullable persisted camera on sceneview * Rename viewpoint persistence and make it sealed class with overwritten equals and hashcode. This is needed in case we want to add some property to the class later on. * simplify getting current viewpoint and setting to persisted viewpoint * normalize point on save * only normalize viewpoint if sr is pannable or geographic' git push * use mapviewdefaults for default viewpoint persistence value * use normalized geometry as point or polygon depending on viewpoint type * persist non normalized viewpoint if normalized viewpoint is null * rename value from restore in sceneview * add explanatory comments * refactor extension fun mapview.getviewpointbypersistence * Add comments * fix template app still using viewpoint operation * use expression syntax * add viewpoint persistence doc * mv parameter higher * rm cast to polygon for bounding geometry on restoration * factor out normalize function * use early return style for readability' * rename viewpointtopersist -> normalizedviewpoint * use expression syntax for hashcode and equals * convert tryNormalizeViewpoint to extension fun on Viewpoint --------- Co-authored-by: Puneet Prakash <puneet_prakash@esri.com> Co-authored-by: Gunther Heppner <gheppner@esri.com> Co-authored-by: Shubham Sharma <shubhamsharma@esri.com> Co-authored-by: Changan Shi <cshi@esri.com> Co-authored-by: Soren Roth <sroth@esri.com> Co-authored-by: Soren Roth <sor10874@esri.com> Co-authored-by: Rama Chintapalli <rchintapalli@esri.com> Co-authored-by: Erick Lopez Solis <erick_solis@esri.com>
1 parent 1d0cdc6 commit 1400121

File tree

328 files changed

+12916
-271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

328 files changed

+12916
-271
lines changed

gradle.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,4 @@ ignoreBuildNumber=false
5454
# these versions define the dependency of the ArcGIS Maps SDK for Kotlin dependency
5555
# and are generally not overridden at the command line unless a special build is requested.
5656
sdkVersionNumber=200.4.0
57-
sdkBuildNumber=4085
58-
59-
57+
sdkBuildNumber=4122

microapps/AuthenticationApp/app/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ android {
7676

7777
dependencies {
7878
implementation(project(":authentication"))
79-
implementation(project(":composable-map"))
8079
implementation(arcgis.mapsSdk)
8180
implementation(platform(libs.androidx.compose.bom))
8281
implementation(libs.bundles.composeCore)

microapps/CompassApp/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class).all {
7979

8080
dependencies {
8181
implementation(project(":compass"))
82-
implementation(project(":composable-map"))
82+
implementation(project(":geo-compose"))
8383
implementation(arcgis.mapsSdk)
8484
implementation(platform(libs.androidx.compose.bom))
8585
implementation(libs.bundles.composeCore)

microapps/CompassApp/app/src/main/java/com/arcgismaps/toolkit/compassapp/screens/MainScreen.kt

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
package com.arcgismaps.toolkit.compassapp.screens
2020

21+
import androidx.compose.foundation.layout.Box
2122
import androidx.compose.foundation.layout.IntrinsicSize
2223
import androidx.compose.foundation.layout.Row
2324
import androidx.compose.foundation.layout.fillMaxSize
@@ -26,40 +27,58 @@ import androidx.compose.foundation.layout.height
2627
import androidx.compose.foundation.layout.padding
2728
import androidx.compose.runtime.Composable
2829
import androidx.compose.runtime.getValue
30+
import androidx.compose.runtime.mutableDoubleStateOf
31+
import androidx.compose.runtime.mutableStateOf
32+
import androidx.compose.runtime.remember
33+
import androidx.compose.runtime.rememberCoroutineScope
34+
import androidx.compose.runtime.setValue
2935
import androidx.compose.ui.Modifier
3036
import androidx.compose.ui.unit.dp
31-
import androidx.lifecycle.viewmodel.compose.viewModel
3237
import com.arcgismaps.mapping.ArcGISMap
3338
import com.arcgismaps.mapping.BasemapStyle
3439
import com.arcgismaps.mapping.Viewpoint
3540
import com.arcgismaps.toolkit.compass.Compass
36-
import com.arcgismaps.toolkit.composablemap.ComposableMap
37-
import com.arcgismaps.toolkit.composablemap.DuplexFlow
41+
import com.arcgismaps.toolkit.geocompose.MapView
42+
import com.arcgismaps.toolkit.geocompose.MapViewProxy
43+
import kotlinx.coroutines.launch
3844

3945
@Composable
4046
fun MainScreen() {
4147
// create an ArcGISMap with a Topographic basemap style
42-
val map = ArcGISMap(BasemapStyle.ArcGISTopographic)
43-
// instantiate a MapViewModel using the factory
44-
val mapViewModel = viewModel<MapViewModel>(factory = MapViewModelFactory(map))
45-
// hoist the mapRotation state
46-
val mapRotation by mapViewModel.mapRotation.collectAsState(DuplexFlow.Type.Read)
47-
// show a composable map using the mapViewModel
48-
ComposableMap(
49-
modifier = Modifier.fillMaxSize(),
50-
mapInterface = mapViewModel
48+
val arcGISMap by remember {
49+
mutableStateOf(
50+
ArcGISMap(BasemapStyle.ArcGISTopographic).apply {
51+
// set the map's viewpoint to North America
52+
initialViewpoint = Viewpoint(39.8, -98.6, 10e7)
53+
}
54+
)
55+
}
56+
var mapRotation by remember { mutableDoubleStateOf(0.0) }
57+
val mapViewProxy = remember { MapViewProxy() }
58+
// show composable MapView with compass
59+
Box(
60+
modifier = Modifier.fillMaxSize()
5161
) {
52-
Row(modifier = Modifier
53-
.height(IntrinsicSize.Max)
54-
.fillMaxWidth()
55-
.padding(25.dp)) {
62+
MapView(
63+
arcGISMap,
64+
modifier = Modifier.fillMaxSize(),
65+
mapViewProxy = mapViewProxy,
66+
onMapRotationChanged = { rotation -> mapRotation = rotation }
67+
)
68+
Row(
69+
modifier = Modifier
70+
.height(IntrinsicSize.Max)
71+
.fillMaxWidth()
72+
.padding(25.dp)
73+
) {
74+
val coroutineScope = rememberCoroutineScope()
5675
// show the compass and pass the mapRotation state data
5776
Compass(rotation = mapRotation) {
58-
// reset the ComposableMap viewpoint rotation to point north using the mapViewModel
59-
mapViewModel.setViewpointRotation(0.0)
77+
// reset the Composable MapView viewpoint rotation to point north
78+
coroutineScope.launch {
79+
mapViewProxy.setViewpointRotation(0.0)
80+
}
6081
}
6182
}
6283
}
63-
// set the composable map's viewpoint to North America
64-
mapViewModel.setViewpoint(Viewpoint(39.8, -98.6, 10e7))
6584
}

microapps/CompassApp/app/src/main/java/com/arcgismaps/toolkit/compassapp/screens/MapViewModel.kt

Lines changed: 0 additions & 40 deletions
This file was deleted.

microapps/FloorFilterApp/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class).all {
6363

6464
dependencies {
6565
implementation(project(":indoors"))
66-
implementation(project(":composable-map"))
66+
implementation(project(":geo-compose"))
6767
implementation(arcgis.mapsSdk)
6868
implementation(platform(libs.androidx.compose.bom))
6969
implementation(libs.bundles.composeCore)

microapps/FloorFilterApp/app/src/main/java/com/arcgismaps/toolkit/floorfilterapp/screens/MainScreen.kt

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,90 @@ import androidx.compose.foundation.layout.Box
2121
import androidx.compose.foundation.layout.fillMaxSize
2222
import androidx.compose.foundation.layout.padding
2323
import androidx.compose.runtime.Composable
24+
import androidx.compose.runtime.getValue
25+
import androidx.compose.runtime.mutableStateOf
26+
import androidx.compose.runtime.remember
27+
import androidx.compose.runtime.rememberCoroutineScope
2428
import androidx.compose.ui.Alignment
2529
import androidx.compose.ui.Modifier
2630
import androidx.compose.ui.unit.dp
27-
import androidx.lifecycle.viewmodel.compose.viewModel
31+
import com.arcgismaps.geometry.Envelope
32+
import com.arcgismaps.geometry.Geometry
2833
import com.arcgismaps.mapping.ArcGISMap
2934
import com.arcgismaps.mapping.PortalItem
35+
import com.arcgismaps.mapping.Viewpoint
3036
import com.arcgismaps.portal.Portal
31-
import com.arcgismaps.toolkit.composablemap.ComposableMap
37+
import com.arcgismaps.toolkit.geocompose.MapView
38+
import com.arcgismaps.toolkit.geocompose.MapViewProxy
3239
import com.arcgismaps.toolkit.indoors.FloorFilter
40+
import com.arcgismaps.toolkit.indoors.FloorFilterSelection
41+
import com.arcgismaps.toolkit.indoors.FloorFilterState
3342

3443
@Composable
3544
fun MainScreen() {
36-
val portal = Portal("https://arcgis.com/")
37-
val portalItem = PortalItem(portal, "b4b599a43a474d33946cf0df526426f5")
38-
val floorAwareWebMap = ArcGISMap(portalItem)
45+
val floorAwareWebMap by remember {
46+
mutableStateOf(
47+
ArcGISMap(
48+
PortalItem(
49+
Portal("https://arcgis.com/"),
50+
"b4b599a43a474d33946cf0df526426f5"
51+
)
52+
)
53+
)
54+
}
55+
56+
val mapViewProxy = remember { MapViewProxy() }
57+
58+
val coroutineScope = rememberCoroutineScope()
59+
60+
// use default UI properties
61+
val floorFilterState: FloorFilterState by remember {
62+
mutableStateOf(FloorFilterState(
63+
geoModel = floorAwareWebMap,
64+
coroutineScope = coroutineScope
65+
) { floorFilterSelection ->
66+
when (floorFilterSelection.type) {
67+
is FloorFilterSelection.Type.FloorSite -> {
68+
val floorFilterSelectionType =
69+
floorFilterSelection.type as FloorFilterSelection.Type.FloorSite
70+
floorFilterSelectionType.site.geometry?.let {
71+
mapViewProxy.setViewpoint(Viewpoint(getEnvelopeWithBuffer(it)))
72+
}
73+
}
74+
75+
is FloorFilterSelection.Type.FloorFacility -> {
76+
val floorFilterSelectionType =
77+
floorFilterSelection.type as FloorFilterSelection.Type.FloorFacility
78+
floorFilterSelectionType.facility.geometry?.let {
79+
mapViewProxy.setViewpoint(Viewpoint(getEnvelopeWithBuffer(it)))
80+
}
81+
}
3982

40-
val mapViewModel = viewModel<MapViewModel>(factory = MapViewModelFactory(floorAwareWebMap))
83+
else -> {}
84+
}
85+
})
86+
}
4187

42-
ComposableMap(
88+
MapView(
89+
floorAwareWebMap,
4390
modifier = Modifier.fillMaxSize(),
44-
mapInterface = mapViewModel
91+
mapViewProxy = mapViewProxy
92+
)
93+
Box(
94+
modifier = Modifier.fillMaxSize().padding(horizontal = 20.dp, vertical = 40.dp),
95+
contentAlignment = Alignment.BottomStart
4596
) {
46-
Box(
47-
modifier = Modifier.fillMaxSize().padding(horizontal = 20.dp, vertical = 40.dp),
48-
contentAlignment = Alignment.BottomStart
49-
) {
50-
FloorFilter(floorFilterState = mapViewModel.floorFilterState)
51-
}
97+
FloorFilter(floorFilterState = floorFilterState)
5298
}
5399
}
100+
101+
/**
102+
* Returns the envelope with an added buffer factor applied to the given Geometry's extent.
103+
*
104+
* @since 200.2.0
105+
*/
106+
private fun getEnvelopeWithBuffer(geometry: Geometry): Envelope {
107+
val bufferFactor = 1.25
108+
val envelope = geometry.extent
109+
return Envelope(envelope.center, envelope.width * bufferFactor, envelope.height * bufferFactor)
110+
}

microapps/FloorFilterApp/app/src/main/java/com/arcgismaps/toolkit/floorfilterapp/screens/MapViewModel.kt

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# MapView Geometry Editor Micro-app
2+
3+
This micro-app demonstrates the use of `GeometryEditor` and `GraphicsOverlay` with a composable `MapView`.
4+
5+
![Screenshot](screenshot.png)
6+
7+
## Usage
8+
9+
The application starts with a `GeometryEditor` set up and not enabled. Use the switch in the app bar to start/stop the geometry editor session.
10+
Use the overflow action button in the app bar to choose between different options to undo, redo, or clear all `Graphics` from the `GraphicsOverlay`.
11+
12+
For more information on the composable `MapView` component and how it works, see it's [Readme](../../toolkit/geo-compose/README.md).

0 commit comments

Comments
 (0)