- Nur ArcGIS Karte implementiert
- in toml arcgis libraries hinzugefügt - mindSdk von 27 auf 28 gesetzt
This commit is contained in:
123
.idea/codeStyles/Project.xml
generated
Normal file
123
.idea/codeStyles/Project.xml
generated
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</JetCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="XML">
|
||||||
|
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
|
</indentOptions>
|
||||||
|
<arrangement>
|
||||||
|
<rules>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:android</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:id</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>style</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
</rules>
|
||||||
|
</arrangement>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
||||||
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
8
.idea/deploymentTargetSelector.xml
generated
8
.idea/deploymentTargetSelector.xml
generated
@@ -4,6 +4,14 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
<DropdownSelection timestamp="2025-12-19T16:43:39.005516700Z">
|
||||||
|
<Target type="DEFAULT_BOOT">
|
||||||
|
<handle>
|
||||||
|
<DeviceId pluginId="PhysicalDevice" identifier="serial=N0AA003656K80600629" />
|
||||||
|
</handle>
|
||||||
|
</Target>
|
||||||
|
</DropdownSelection>
|
||||||
|
<DialogSelection />
|
||||||
</SelectionState>
|
</SelectionState>
|
||||||
</selectionStates>
|
</selectionStates>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.example.snapandsolve"
|
applicationId = "com.example.snapandsolve"
|
||||||
minSdk = 27
|
minSdk = 28
|
||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "1.0"
|
versionName = "1.0"
|
||||||
@@ -68,4 +68,11 @@ dependencies {
|
|||||||
debugImplementation(libs.androidx.compose.ui.test.manifest)
|
debugImplementation(libs.androidx.compose.ui.test.manifest)
|
||||||
implementation("androidx.compose.material:material-icons-core")
|
implementation("androidx.compose.material:material-icons-core")
|
||||||
implementation("androidx.compose.material:material-icons-extended")
|
implementation("androidx.compose.material:material-icons-extended")
|
||||||
|
|
||||||
|
// ArcGIS Maps for Kotlin - SDK dependency
|
||||||
|
implementation(libs.arcgis.maps.kotlin)
|
||||||
|
// Toolkit dependencies
|
||||||
|
implementation(platform(libs.arcgis.maps.kotlin.toolkit.bom))
|
||||||
|
implementation(libs.arcgis.maps.kotlin.toolkit.geoview.compose)
|
||||||
|
implementation(libs.arcgis.maps.kotlin.toolkit.authentication)
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,9 @@
|
|||||||
<!-- Kamera Zugriffsberechtigung -->
|
<!-- Kamera Zugriffsberechtigung -->
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||||
|
<!-- ArcGIS Pro benötigt-->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import com.arcgismaps.ApiKey
|
||||||
|
import com.arcgismaps.ArcGISEnvironment
|
||||||
import com.example.snapandsolve.camera.AlbumViewModel
|
import com.example.snapandsolve.camera.AlbumViewModel
|
||||||
import com.example.snapandsolve.ui.theme.SnapAndSolveTheme
|
import com.example.snapandsolve.ui.theme.SnapAndSolveTheme
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@@ -21,6 +23,11 @@ class MainActivity : ComponentActivity() {
|
|||||||
|
|
||||||
viewModel = AlbumViewModel(coroutineContext = Dispatchers.Default)
|
viewModel = AlbumViewModel(coroutineContext = Dispatchers.Default)
|
||||||
|
|
||||||
|
/*
|
||||||
|
Wird gebraucht um die Karte in ArcGIS anzuzeigen. Die Prüfung ob man Zugang hat oder nicht
|
||||||
|
wurde gelöscht.
|
||||||
|
*/
|
||||||
|
ArcGISEnvironment.apiKey = ApiKey.create(BuildConfig.ARCGIS_TOKEN)
|
||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.arcgismaps.mapping.ArcGISMap
|
||||||
|
import com.arcgismaps.mapping.BasemapStyle
|
||||||
|
import com.arcgismaps.mapping.Viewpoint
|
||||||
|
import com.arcgismaps.toolkit.geoviewcompose.MapView
|
||||||
import com.example.snapandsolve.camera.AlbumViewModel
|
import com.example.snapandsolve.camera.AlbumViewModel
|
||||||
import com.example.snapandsolve.camera.AlbumViewState
|
import com.example.snapandsolve.camera.AlbumViewState
|
||||||
import com.example.snapandsolve.camera.Intent
|
import com.example.snapandsolve.camera.Intent
|
||||||
@@ -130,10 +134,21 @@ fun ContentScreen(
|
|||||||
onDismissReport: () -> Unit
|
onDismissReport: () -> Unit
|
||||||
) {
|
) {
|
||||||
val mapViewModel = remember { MapViewModel(application) }
|
val mapViewModel = remember { MapViewModel(application) }
|
||||||
// ViewModel für die Kamera-Funktionalität
|
|
||||||
val albumViewModel = remember { AlbumViewModel(Dispatchers.Default) }
|
val albumViewModel = remember { AlbumViewModel(Dispatchers.Default) }
|
||||||
|
|
||||||
|
// ArcGIS Map erstellen
|
||||||
|
val map = remember {
|
||||||
|
createMap() //Funktion zur Erstellung der Map
|
||||||
|
}
|
||||||
|
|
||||||
Box(modifier = modifier.fillMaxSize()) {
|
Box(modifier = modifier.fillMaxSize()) {
|
||||||
|
// HINTERGRUND: Die Map
|
||||||
|
MapView(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
arcGISMap = map
|
||||||
|
)
|
||||||
|
|
||||||
|
// VORDERGRUND: Das Overlay (wenn showReport = true)
|
||||||
if (showReport) {
|
if (showReport) {
|
||||||
ReportOverlay(
|
ReportOverlay(
|
||||||
onCancel = onDismissReport,
|
onCancel = onDismissReport,
|
||||||
@@ -333,4 +348,21 @@ fun ReportOverlay(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createMap(): ArcGISMap {
|
||||||
|
|
||||||
|
return ArcGISMap(BasemapStyle.ArcGISTopographic).apply {
|
||||||
|
|
||||||
|
initialViewpoint = Viewpoint(
|
||||||
|
53.14,
|
||||||
|
8.20,
|
||||||
|
20000.0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,64 @@
|
|||||||
package com.example.snapandsolve
|
package com.example.snapandsolve
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.lifecycle.AndroidViewModel
|
import androidx.lifecycle.AndroidViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.arcgismaps.data.ArcGISFeature
|
||||||
|
import com.arcgismaps.data.CodedValueDomain
|
||||||
|
import com.arcgismaps.data.ServiceFeatureTable
|
||||||
|
import com.arcgismaps.mapping.ArcGISMap
|
||||||
|
import com.arcgismaps.mapping.BasemapStyle
|
||||||
|
import com.arcgismaps.mapping.Viewpoint
|
||||||
|
import com.arcgismaps.mapping.layers.FeatureLayer
|
||||||
|
import com.arcgismaps.toolkit.geoviewcompose.MapViewProxy
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class MapViewModel(application: Application ): AndroidViewModel(application) {
|
class MapViewModel(application: Application ): AndroidViewModel(application) {
|
||||||
|
val map: ArcGISMap = ArcGISMap(BasemapStyle.OpenOsmStyle).apply {
|
||||||
|
initialViewpoint = Viewpoint(53.14, 8.20, 20000.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
ALLES UNTER DIESEM KOMMENTAR WIRD NICHT GENUTZT. Aber EVENTUELL nötig zum einbinden von
|
||||||
|
Layer und Features.
|
||||||
|
*/
|
||||||
|
// Hold a reference to the selected feature.
|
||||||
|
var selectedFeature: ArcGISFeature? by mutableStateOf(null)
|
||||||
|
val mapViewProxy = MapViewProxy()
|
||||||
|
|
||||||
|
//var currentFeatureOperation by mutableStateOf(FeatureOperationType.CREATE)
|
||||||
|
|
||||||
|
lateinit var featureLayer: FeatureLayer
|
||||||
|
|
||||||
|
// Create a snackbar message to display the result of feature operations.
|
||||||
|
var snackBarMessage: String by mutableStateOf("")
|
||||||
|
|
||||||
|
lateinit var serviceFeatureTable: ServiceFeatureTable
|
||||||
|
|
||||||
|
var currentDamageType by mutableStateOf("")
|
||||||
|
|
||||||
|
// The list of damage types to update the feature attribute.
|
||||||
|
var damageTypeList: List<String> = mutableListOf()
|
||||||
|
|
||||||
|
init {
|
||||||
|
viewModelScope.launch {
|
||||||
|
serviceFeatureTable = ServiceFeatureTable("https://services9.arcgis.com/UVxdrlZq3S3gqt7w/ArcGIS/rest/services/StrassenSchaeden/FeatureServer/0")
|
||||||
|
serviceFeatureTable.load().onSuccess {
|
||||||
|
// Get the field from the feature table that will be updated.
|
||||||
|
val typeDamageField = serviceFeatureTable.fields.first { it.name == "Typ" }
|
||||||
|
// Get the coded value domain for the field.
|
||||||
|
val attributeDomain = typeDamageField.domain as CodedValueDomain
|
||||||
|
// Add the damage types to the list.
|
||||||
|
attributeDomain.codedValues.forEach {
|
||||||
|
damageTypeList += it.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
featureLayer = FeatureLayer.createWithFeatureTable(serviceFeatureTable)
|
||||||
|
map.operationalLayers.add(featureLayer)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ lifecycleRuntimeKtx = "2.10.0"
|
|||||||
activityCompose = "1.12.1"
|
activityCompose = "1.12.1"
|
||||||
composeBom = "2024.09.00"
|
composeBom = "2024.09.00"
|
||||||
material3 = "1.4.0"
|
material3 = "1.4.0"
|
||||||
|
arcgisMapsKotlin = "200.8.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
@@ -26,6 +27,10 @@ androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-
|
|||||||
androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||||
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
|
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||||
androidx-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
|
androidx-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
|
||||||
|
arcgis-maps-kotlin = { group = "com.esri", name = "arcgis-maps-kotlin", version.ref = "arcgisMapsKotlin" }
|
||||||
|
arcgis-maps-kotlin-toolkit-bom = { group = "com.esri", name = "arcgis-maps-kotlin-toolkit-bom", version.ref = "arcgisMapsKotlin" }
|
||||||
|
arcgis-maps-kotlin-toolkit-geoview-compose = { group = "com.esri", name = "arcgis-maps-kotlin-toolkit-geoview-compose" }
|
||||||
|
arcgis-maps-kotlin-toolkit-authentication = { group = "com.esri", name = "arcgis-maps-kotlin-toolkit-authentication" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|||||||
Reference in New Issue
Block a user