Correct Marker Flag

This commit is contained in:
clement
2024-07-17 12:52:22 +02:00
parent fd3ecdc255
commit c718551215

View File

@@ -22,40 +22,29 @@ class RetrieveRoad(private var map: MapView,
private var context: Context
) :
AsyncTask<String, Void, Void>() {
val icons = intArrayOf(
com.example.busroute.R.drawable.ic_continue,
com.example.busroute.R.drawable.ic_slight_right,
com.example.busroute.R.drawable.ic_turn_right,
com.example.busroute.R.drawable.ic_sharp_right,
0,
com.example.busroute.R.drawable.ic_sharp_left,
com.example.busroute.R.drawable.ic_turn_left,
com.example.busroute.R.drawable.ic_slight_left,
com.example.busroute.R.drawable.ic_u_turn,
com.example.busroute.R.drawable.ic_u_turn,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
com.example.busroute.R.drawable.ic_roundabout,
com.example.busroute.R.drawable.ic_roundabout,
com.example.busroute.R.drawable.ic_roundabout,
com.example.busroute.R.drawable.ic_roundabout,
com.example.busroute.R.drawable.ic_roundabout,
com.example.busroute.R.drawable.ic_roundabout
)
val icons = HashMap<Int, Int>()
private fun setIcons(){
icons.put(1,com.example.busroute.R.drawable.ic_continue)
icons.put(6,com.example.busroute.R.drawable.ic_slight_right)
icons.put(7,com.example.busroute.R.drawable.ic_turn_right)
icons.put(8,com.example.busroute.R.drawable.ic_sharp_right)
icons.put(12,com.example.busroute.R.drawable.ic_u_turn)
icons.put(5,com.example.busroute.R.drawable.ic_sharp_left)
icons.put(4,com.example.busroute.R.drawable.ic_turn_left)
icons.put(3,com.example.busroute.R.drawable.ic_slight_left)
icons.put(24,com.example.busroute.R.drawable.ic_arrived)
icons.put(27,com.example.busroute.R.drawable.ic_roundabout)
icons.put(28,com.example.busroute.R.drawable.ic_roundabout)
icons.put(29,com.example.busroute.R.drawable.ic_roundabout)
icons.put(30,com.example.busroute.R.drawable.ic_roundabout)
icons.put(31,com.example.busroute.R.drawable.ic_roundabout)
icons.put(32,com.example.busroute.R.drawable.ic_roundabout)
icons.put(33,com.example.busroute.R.drawable.ic_roundabout)
icons.put(34,com.example.busroute.R.drawable.ic_roundabout)
}
override fun doInBackground(vararg p0: String): Void? {
this.setIcons()
val roadManager: RoadManager = OSRMRoadManager(context, "me")
val waypoints = ArrayList<GeoPoint>()
waypoints.add(GeoPoint(latitude, longitude))
@@ -77,13 +66,12 @@ class RetrieveRoad(private var map: MapView,
nodeMarker.title = "Step $i"
nodeMarker.snippet = node.mInstructions
nodeMarker.subDescription = Road.getLengthDurationText(context, node.mLength, node.mDuration)
val id = icons[node.mManeuverType]
if (id != 0){
val id: Int? = icons.get(node.mManeuverType)
if (id != null){
val icon: Drawable? = context.getDrawable(id)
nodeMarker.image = icon
map.overlays.add(nodeMarker)
}
map.overlays.add(nodeMarker)
}
return null
}