diff options
Diffstat (limited to 'androidApp/src/main')
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt index f87d89a..39312a8 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt @@ -136,6 +136,7 @@ class MapFragment : GlobeMapFragment() { screenMarker.loc = Point2d.FromDegrees(marker.longitude, marker.latitude) screenMarker.image = if (isReport) { + // For reports, position, start and end markers must be shown differently when (i) { 0 -> getIcon(MarkerType.REPORT_START) markers.size - 1 -> getIcon(MarkerType.REPORT_END) @@ -195,12 +196,16 @@ class MapFragment : GlobeMapFragment() { clear(true) - val vectorInfoGeofence = VectorInfo() - vectorInfoGeofence.setColor(Color.BLUE) - vectorInfoGeofence.setLineWidth(10.0f) + val vectorInfo = VectorInfo() + vectorInfo.setColor(Color.BLUE) + vectorInfo.setLineWidth(10.0f) + + val labelInfo = LabelInfo() + labelInfo.textColor = Color.BLUE val shapes = mutableListOf<Shape>() val vectors = mutableListOf<VectorObject>() + val labels = mutableListOf<ScreenLabel>() geofences.forEach { geofence -> geofence.area?.let { area -> @@ -216,6 +221,13 @@ class MapFragment : GlobeMapFragment() { }.toTypedArray()) vectors.add(vector) + + val label = ScreenLabel() + label.text = geofence.name + label.loc = Point2d.FromDegrees(geometry.centroid.y, geometry.centroid.x) + label.layoutImportance = Float.MAX_VALUE + + labels.add(label) } } } @@ -233,7 +245,13 @@ class MapFragment : GlobeMapFragment() { geofenceObjects.add(mapControl.addVectors( vectors, - vectorInfoGeofence, + vectorInfo, + ThreadMode.ThreadAny + )) + + geofenceObjects.add(mapControl.addScreenLabels( + labels, + labelInfo, ThreadMode.ThreadAny )) } |