Untitled
unknown
plain_text
10 days ago
3.8 kB
3
Indexable
private val isMeasuring = mutableStateOf(false) Box(modifier = Modifier.fillMaxSize()) { val mapViewProxy = MapViewProxy() MapView( modifier = Modifier.fillMaxSize(), mapViewProxy = mapViewProxy, arcGISMap = map, graphicsOverlays = listOf(graphicsOverlay), locationDisplay = locationDisplay, onSingleTapConfirmed = { screenCoordinate -> if (isMeasuring.value) { val mapPoint: Point? = mapViewProxy.screenToLocationOrNull(screenCoordinate.screenCoordinate) if (mapPoint != null) { pointsDrawn = true val mapPointNotNull: Point = mapPoint val mapPointProjected: Point? = GeometryEngine.projectOrNull( mapPointNotNull, SpatialReference.wgs84() ) val latitude = mapPointProjected?.y val longitude = mapPointProjected?.x calloutLocation.value = mapPointProjected .................................... { calloutLocation.value?.let { location -> Callout(location = location, offset = Offset(0f, -50f)) { Text( text = if (selectedGeometryType == "Area") { "${areaText.value} ${originalAreaUnit}" } else { "${distanceText.value} ${originalDistanceUnit}" } ) } LaunchedEffect(Unit) { withContext(Dispatchers.IO) { val geometryTableList: List<GeometryTable> = geometryDao.getAllGeometries() for (geometry in geometryTableList) { val geom = Converters().toGeometry(geometry.geometry) val objectId = geometry.objectId val attributeData = attributeTableViewModel.getAttributeForObjectIdVM(objectId) val attributeMap = mutableMapOf<String, Any>() attributeData?.let { attributeMap["OBJECTID"] = it.sobjectId attributeMap["Pipe_ID"] = it.pipeId attributeMap["Status"] = it.status attributeMap["Start_Node_ID"] = it.startNodeID attributeMap["Stop_Node_ID"] = it.stopNodeID attributeMap["Material"] = it.material attributeMap["Design_Dia"] = it.designDia attributeMap["Design_Length"] = it.designLength attributeMap["ZONE"] = it.zone } val polyline = geom as Polyline val lineSymbol = SimpleLineSymbol(SimpleLineSymbolStyle.Solid, com.arcgismaps.Color.red, 10f) val graphic = Graphic(polyline, attributeMap, lineSymbol) graphicsOverlay.graphics.add(graphic) } } } } } Toast.makeText( context, "Map tapped at: Latitude: $latitude, Longitude: $longitude", Toast.LENGTH_SHORT ).show() val relatedGraphics = mutableListOf<Graphic>()
Editor is loading...
Leave a Comment