/** * TrackerMap * Copyright (C) 2021-2022 Iván Ávalos , Henoch Ojeda * * 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 . */ 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)) } }