aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-11 15:24:22 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-11 15:24:22 -0600
commit877d064c1a7cc8dc985750de3fe5cd8d8b935fb1 (patch)
treef2ea1de91bcbdac5c518623ad27c2b859103353e /androidApp/src/main/java
parent58ddb792fa4b4e3ac6b077111e20805fa091c70d (diff)
downloadetbsa-trackermap-mobile-877d064c1a7cc8dc985750de3fe5cd8d8b935fb1.tar.gz
etbsa-trackermap-mobile-877d064c1a7cc8dc985750de3fe5cd8d8b935fb1.tar.bz2
etbsa-trackermap-mobile-877d064c1a7cc8dc985750de3fe5cd8d8b935fb1.zip
Shows geofence names on map
Diffstat (limited to 'androidApp/src/main/java')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt26
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
))
}