|
| 1 | +/* Copyright 2025 Esri |
| 2 | + * |
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | + * you may not use this file except in compliance with the License. |
| 5 | + * You may obtain a copy of the License at |
| 6 | + * |
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + * |
| 9 | + * Unless required by applicable law or agreed to in writing, software |
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | + * See the License for the specific language governing permissions and |
| 13 | + * limitations under the License. |
| 14 | + * |
| 15 | + */ |
| 16 | + |
| 17 | +package com.esri.arcgismaps.sample.displaylocalscene.screens |
| 18 | + |
| 19 | +import androidx.compose.foundation.layout.Column |
| 20 | +import androidx.compose.foundation.layout.fillMaxSize |
| 21 | +import androidx.compose.foundation.layout.padding |
| 22 | +import androidx.compose.material3.Scaffold |
| 23 | +import androidx.compose.runtime.Composable |
| 24 | +import androidx.compose.runtime.remember |
| 25 | +import androidx.compose.ui.Modifier |
| 26 | +import com.arcgismaps.geometry.Envelope |
| 27 | +import com.arcgismaps.geometry.Point |
| 28 | +import com.arcgismaps.geometry.SpatialReference |
| 29 | +import com.arcgismaps.mapping.ArcGISScene |
| 30 | +import com.arcgismaps.mapping.ArcGISTiledElevationSource |
| 31 | +import com.arcgismaps.mapping.BasemapStyle |
| 32 | +import com.arcgismaps.mapping.Viewpoint |
| 33 | +import com.arcgismaps.mapping.layers.ArcGISSceneLayer |
| 34 | +import com.arcgismaps.mapping.view.Camera |
| 35 | +import com.arcgismaps.mapping.view.SceneViewingMode |
| 36 | +import com.arcgismaps.toolkit.geoviewcompose.LocalSceneView |
| 37 | +import com.esri.arcgismaps.sample.sampleslib.components.SampleTopAppBar |
| 38 | + |
| 39 | +/** |
| 40 | + * Main screen layout for the sample app |
| 41 | + */ |
| 42 | +@Composable |
| 43 | +fun DisplayLocalSceneScreen(sampleName: String) { |
| 44 | + Scaffold( |
| 45 | + topBar = { SampleTopAppBar(title = sampleName) }, |
| 46 | + content = { |
| 47 | + Column( |
| 48 | + modifier = Modifier |
| 49 | + .fillMaxSize() |
| 50 | + .padding(it), |
| 51 | + ) { |
| 52 | + val sceneLayer = remember { |
| 53 | + ArcGISSceneLayer("https://www.arcgis.com/home/item.html?id=61da8dc1a7bc4eea901c20ffb3f8b7af") |
| 54 | + } |
| 55 | + |
| 56 | + val elevationSource = remember { |
| 57 | + ArcGISTiledElevationSource("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer") |
| 58 | + } |
| 59 | + |
| 60 | + val arcGISScene = remember { |
| 61 | + ArcGISScene( |
| 62 | + BasemapStyle.ArcGISTopographic, |
| 63 | + SceneViewingMode.Local |
| 64 | + ).apply { |
| 65 | + operationalLayers.add(sceneLayer) |
| 66 | + baseSurface.elevationSources.add(elevationSource) |
| 67 | + |
| 68 | + initialViewpoint = Viewpoint( |
| 69 | + center = Point( |
| 70 | + x = 19455026.8116, |
| 71 | + y = -5054995.7415, |
| 72 | + spatialReference = SpatialReference.webMercator() |
| 73 | + ), |
| 74 | + scale = 8314.6991, |
| 75 | + camera = Camera( |
| 76 | + locationPoint = Point( |
| 77 | + x = 19455578.6821, |
| 78 | + y = -5056336.2227, |
| 79 | + z = 1699.3366, |
| 80 | + spatialReference = SpatialReference.webMercator()), |
| 81 | + heading = 338.7410, |
| 82 | + pitch = 40.3763, |
| 83 | + roll = 0.0, |
| 84 | + ) |
| 85 | + ) |
| 86 | + clippingArea = Envelope( |
| 87 | + xMin = 19454578.8235, |
| 88 | + yMin = -5055381.4798, |
| 89 | + xMax = 19455518.8814, |
| 90 | + yMax = -5054888.4150, |
| 91 | + spatialReference = SpatialReference.webMercator() |
| 92 | + ) |
| 93 | + isClippingEnabled = true |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + LocalSceneView( |
| 98 | + modifier = Modifier.fillMaxSize(), |
| 99 | + scene = arcGISScene |
| 100 | + ) |
| 101 | + } |
| 102 | + } |
| 103 | + ) |
| 104 | +} |
0 commit comments