symbole angepasst
unused fun gelöscht
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
@@ -35,7 +36,7 @@ import java.io.ByteArrayOutputStream
|
||||
|
||||
|
||||
|
||||
class MapViewModel(application: Application) : AndroidViewModel(application) {
|
||||
class MapViewModel(application: Application, context: Context) : AndroidViewModel(application) {
|
||||
|
||||
companion object {
|
||||
// Zentrale Definition der Schadenstypen
|
||||
@@ -99,7 +100,7 @@ class MapViewModel(application: Application) : AndroidViewModel(application) {
|
||||
println("DEBUG: Fehler beim Laden der Tabelle: ${it.message}")
|
||||
}
|
||||
featureLayer = FeatureLayer.createWithFeatureTable(serviceFeatureTable)
|
||||
featureLayer.renderer = createTypStatusRenderer()
|
||||
featureLayer.renderer = createTypStatusRenderer(context)
|
||||
map.operationalLayers.add(featureLayer)
|
||||
|
||||
// ===== DEBUG: Felder nach dem Hinzufügen zur Map =====
|
||||
@@ -219,27 +220,9 @@ class MapViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
||||
when (selectedOperation) {
|
||||
FeatureOperationType.DEFAULT -> selectFeatureAt(singleTapConfirmedEvent.screenCoordinate)
|
||||
FeatureOperationType.DELETE -> deleteFeatureAt(singleTapConfirmedEvent.screenCoordinate)
|
||||
FeatureOperationType.UPDATE_ATTRIBUTE -> selectFeatureForAttributeEditAt(singleTapConfirmedEvent.screenCoordinate)
|
||||
FeatureOperationType.UPDATE_GEOMETRY -> updateFeatureGeometryAt(singleTapConfirmedEvent.screenCoordinate)
|
||||
FeatureOperationType.PICK_REPORT_LOCATION -> pickReportLocation(singleTapConfirmedEvent.screenCoordinate)
|
||||
// RATE_FEATURE wird nicht mehr gebraucht - wird im DEFAULT mit behandelt!
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteFeatureAt(screenCoordinate: ScreenCoordinate) {
|
||||
featureLayer?.let { featureLayer ->
|
||||
// Clear any existing selection.
|
||||
featureLayer.clearSelection()
|
||||
selectedFeature = null
|
||||
viewModelScope.launch {
|
||||
// Determine if a user tapped on a feature.
|
||||
mapViewProxy.identify(featureLayer, screenCoordinate, 10.dp).onSuccess { identifyResult ->
|
||||
selectedFeature = (identifyResult.geoElements.firstOrNull() as? ArcGISFeature)?.also {
|
||||
featureLayer.selectFeature(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,7 +414,6 @@ class MapViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
||||
enum class FeatureOperationType(val operationName: String, val instruction: String) {
|
||||
DEFAULT("Default", ""),
|
||||
DELETE("Delete feature", "Select an existing feature to delete it."),
|
||||
UPDATE_ATTRIBUTE("Update attribute", "Select an existing feature to edit its attribute."),
|
||||
UPDATE_GEOMETRY("Update geometry", "Select an existing feature and tap the map to move it to a new position."),
|
||||
PICK_REPORT_LOCATION("Pick report location", "Tippe auf die Karte, um die Position zu setzen."),
|
||||
|
||||
Reference in New Issue
Block a user