aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap
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
commit5dd2bf01865705f5ee74374472895ffed30f2b26 (patch)
treeb68d77c77c52037622dedb79ed8075103bdfa5b0 /androidApp/src/main/java/mx/trackermap
parentbca4d82fcbd7fd1c89c6879eee0a9718699df049 (diff)
downloadetbsa-trackermap-mobile-5dd2bf01865705f5ee74374472895ffed30f2b26.tar.gz
etbsa-trackermap-mobile-5dd2bf01865705f5ee74374472895ffed30f2b26.tar.bz2
etbsa-trackermap-mobile-5dd2bf01865705f5ee74374472895ffed30f2b26.zip
Shows geofence names on map
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap')
-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
))
}