|
| 1 | +/* |
| 2 | + * Copyright 2023 Esri |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + * |
| 16 | + */ |
| 17 | + |
| 18 | +package com.arcgismaps.toolkit.geocompose |
| 19 | + |
| 20 | +/** |
| 21 | + * Used to perform operations on a composable [SceneView]. |
| 22 | + * |
| 23 | + * There should be a one-to-one relationship between a SceneViewProxy and a composable [SceneView]. This |
| 24 | + * relationship is established by passing an instance of SceneViewProxy to the composable [SceneView] function. |
| 25 | + * Operations can only be performed once the associated composable SceneView has entered the composition. |
| 26 | + * Operations performed when the associated composable SceneView is not in the composition will fail gracefully, |
| 27 | + * i.e. won't throw exceptions but won't return a successful result. |
| 28 | + * |
| 29 | + * @since 200.4.0 |
| 30 | + */ |
| 31 | +public class SceneViewProxy : GeoViewProxy("SceneView") { |
| 32 | + /** |
| 33 | + * The view-based [com.arcgismaps.mapping.view.SceneView] that this SceneViewProxy will operate on. This should |
| 34 | + * be initialized by the composable [SceneView] when it enters the composition and set to null when |
| 35 | + * it is disposed by calling [setSceneView]. |
| 36 | + * |
| 37 | + * @since 200.4.0 |
| 38 | + */ |
| 39 | + private var sceneView: com.arcgismaps.mapping.view.SceneView? = null |
| 40 | + set(value) { |
| 41 | + setGeoView(value) |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * Sets the [sceneView] parameter on this operator. This should be called by the composable [SceneView] |
| 46 | + * when it enters the composition and set to null when it is disposed. |
| 47 | + * |
| 48 | + * @since 200.4.0 |
| 49 | + */ |
| 50 | + internal fun setSceneView(sceneView: com.arcgismaps.mapping.view.SceneView?) { |
| 51 | + this.sceneView = sceneView |
| 52 | + } |
| 53 | +} |
0 commit comments