aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/MarkerTransformations.kt
blob: 4dd1ea777f4d642a66bd462f08c5f4b839d3de21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
 * TrackerMap
 * Copyright (C) 2021-2022  Iván Ávalos <avalos@disroot.org>, Henoch Ojeda <imhenoch@protonmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package mx.trackermap.TrackerMap.android.shared

import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.client.models.Marker

object MarkerTransformations {
    fun markerTypeToResourceId(markerType: Marker.Type): Int {
        return when (markerType) {
            Marker.Type.ANIMAL -> R.drawable.map_animal
            Marker.Type.BACKHOE -> R.drawable.map_backhoe
            Marker.Type.BICYCLE -> R.drawable.map_bicycle
            Marker.Type.BOAT -> R.drawable.map_boat
            Marker.Type.BUS -> R.drawable.map_bus
            Marker.Type.CAR -> R.drawable.map_car
            Marker.Type.CRANE -> R.drawable.map_crane
            Marker.Type.DEFAULT -> R.drawable.map_default
            Marker.Type.HELICOPTER -> R.drawable.map_helicopter
            Marker.Type.MOTORCYCLE -> R.drawable.map_motorcycle
            Marker.Type.OFFROAD -> R.drawable.map_offroad
            Marker.Type.PERSON -> R.drawable.map_person
            Marker.Type.PICKUP -> R.drawable.map_pickup
            Marker.Type.PLANE -> R.drawable.map_plane
            Marker.Type.SCOOTER -> R.drawable.map_scooter
            Marker.Type.SHIP -> R.drawable.map_ship
            Marker.Type.TRACTOR -> R.drawable.map_tractor
            Marker.Type.TRAIN -> R.drawable.map_train
            Marker.Type.TRAM -> R.drawable.map_tram
            Marker.Type.TROLLEYBUS -> R.drawable.map_trolleybus
            Marker.Type.TRUCK -> R.drawable.map_truck
            Marker.Type.VAN -> R.drawable.map_van

            Marker.Type.REPORT_POSITION -> R.drawable.map_report_position
            Marker.Type.REPORT_START -> R.drawable.map_report_start
            Marker.Type.REPORT_END -> R.drawable.map_report_end
        }
    }

    fun markerTypeToStringId(markerType: Marker.Type): Int {
        return when (markerType) {
            Marker.Type.ANIMAL -> R.string.unit_category_animal
            Marker.Type.BACKHOE -> R.string.unit_category_backhoe
            Marker.Type.BICYCLE -> R.string.unit_category_bicycle
            Marker.Type.BOAT -> R.string.unit_category_boat
            Marker.Type.BUS -> R.string.unit_category_bus
            Marker.Type.CAR -> R.string.unit_category_car
            Marker.Type.CRANE -> R.string.unit_category_crane
            Marker.Type.DEFAULT -> R.string.unit_category_default
            Marker.Type.HELICOPTER -> R.string.unit_category_helicopter
            Marker.Type.MOTORCYCLE -> R.string.unit_category_motorcycle
            Marker.Type.OFFROAD -> R.string.unit_category_offroad
            Marker.Type.PERSON -> R.string.unit_category_person
            Marker.Type.PICKUP -> R.string.unit_category_pickup
            Marker.Type.PLANE -> R.string.unit_category_plane
            Marker.Type.SCOOTER -> R.string.unit_category_scooter
            Marker.Type.SHIP -> R.string.unit_category_ship
            Marker.Type.TRACTOR -> R.string.unit_category_tractor
            Marker.Type.TRAIN -> R.string.unit_category_train
            Marker.Type.TRAM -> R.string.unit_category_tram
            Marker.Type.TROLLEYBUS -> R.string.unit_category_trolleybus
            Marker.Type.TRUCK -> R.string.unit_category_truck
            Marker.Type.VAN -> R.string.unit_category_van
            else -> R.string.unit_category_default
        }
    }

    fun categoryToResourceId(category: String?): Int {
        return markerTypeToResourceId(Marker.categoryToMarkerType(category))
    }

    fun categoryToStringId(category: String?): Int {
        return markerTypeToStringId(Marker.categoryToMarkerType(category))
    }
}