Skip to content

Commit f8c9fef

Browse files
author
Soren Roth
committed
Merge branch 'v.next' into feature-branches/forms
2 parents e71a65b + 1400121 commit f8c9fef

File tree

327 files changed

+12915
-268
lines changed

Some content is hidden

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

327 files changed

+12915
-268
lines changed

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).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

0 commit comments

Comments
 (0)