Hi, I'm trying to toggle between a Scene and Map using compose. I want to display the same Geodatabase feature table on the Scene or Map (2d) when displayed. However on creating the feature layer I receive the Object already owned exception and I can't seem to free the table from the existing layers.
private suspend fun loadMobileScenePackage(tables: List<GeodatabaseFeatureTable>) {
// Load the Mil Symbols TODO: move to track manager
val dictionarySymbolStyle = DictionarySymbolStyle.createFromFile(styleFile)
// Load the symbols
dictionarySymbolStyle.load().onFailure { error ->
Log.e("Mapping", error.cause.toString() + ": " + styleFile)
}
mobileScenePackage.load().onSuccess {
// update the mutable state holder with the first scene from the MobileScenePackage
val scene = mobileScenePackage.scenes.first()
// Setup the scene with the renderer and geodb features
tables.forEach { ft ->
...
ft.load().onFailure { error ->
Log.e("SVC", error.cause.toString())
}
val featureLayer = FeatureLayer.createWithFeatureTable(ft)
featureLayer.load().onFailure { error ->
Log.e("SVC", error.cause.toString())
}
scene.operationalLayers.add(featureLayer)
...
}
_firstScene.update { scene }
}.onFailure { error ->
...
}
@Composable
fun createSceneViewInstance(lifecycleOwner: LifecycleOwner, sceneViewModel: SceneViewModel = hiltViewModel()): SceneView {
val sceneView = SceneView(LocalContext.current)
DisposableEffect(lifecycleOwner) {
lifecycleOwner.lifecycle.addObserver(sceneView)
onDispose {
lifecycleOwner.lifecycle.removeObserver(sceneView)
sceneView.onDestroy(lifecycleOwner)
}
}
return sceneView
}