[M2] M2 全览地图

This commit is contained in:
wangmingjun
2023-02-15 20:01:46 +08:00
parent e25e506725
commit 142028bd75
7 changed files with 31 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
package com.mogo.och.bus.passenger.callback
import com.mogo.och.bus.passenger.bean.PM2Station
/**
* @author: wangmingjun
* @date: 2023/2/2
@@ -11,4 +13,5 @@ interface DrivingInfoCallback {
fun updateRemainMT(meters : Long, timeInSecond : Long) // 米,秒
fun changeOperationStatus(loginStatus : Boolean)
fun showNoTaskView(isTrue : Boolean)
fun updateLineStations(stations: MutableList<PM2Station>)
}

View File

@@ -243,11 +243,12 @@ class PM2DrivingModel private constructor() {
private fun updatePassengerRouteInfo(result: PM2RoutesResult) {
mDrivingInfoCallback?.updateLine(result.name, result.runningDur)
mDrivingInfoCallback?.showNoTaskView(false)
if (result.sites != null) {
mDrivingInfoCallback?.showNoTaskView(false)
val stations: List<PM2Station> = result.sites
mStations.clear()
mStations.addAll(stations)
mDrivingInfoCallback?.updateLineStations(mStations)
for (i in stations.indices) {
val station: PM2Station = stations[i]
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED

View File

@@ -3,6 +3,7 @@ package com.mogo.och.bus.passenger.presenter
import androidx.lifecycle.LifecycleOwner
import com.mogo.commons.mvp.Presenter
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bus.passenger.bean.PM2Station
import com.mogo.och.bus.passenger.callback.AutoPilotStatusCallback
import com.mogo.och.bus.passenger.callback.DrivingInfoCallback
import com.mogo.och.bus.passenger.model.PM2DrivingModel
@@ -65,6 +66,12 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
}
}
override fun updateLineStations(stations: MutableList<PM2Station>) {
UiThreadHandler.post {
mView?.updateLineStations(stations)
}
}
override fun updateAutoStatus(isOpen: Boolean) {
UiThreadHandler.post {
mView?.updateAutoStatus(isOpen)
@@ -72,6 +79,6 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
}
override fun updateAutoStatus(status: Int) {
TODO("Not yet implemented")
}
}

View File

@@ -1,11 +1,14 @@
package com.mogo.och.bus.passenger.ui
import android.graphics.BitmapFactory
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import com.amap.api.maps.model.LatLng
import com.mogo.commons.mvp.MvpFragment
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.bean.PM2Station
import com.mogo.och.bus.passenger.presenter.PM2DrivingPresenter
import com.mogo.och.common.module.utils.DateTimeUtil.*
import kotlinx.android.synthetic.m2.p_m2_driving_info_fragment.*
@@ -98,6 +101,8 @@ class PM2DrivingInfoFragment :
line_name_tv.visibility = View.GONE
line_during_tv.visibility = View.GONE
no_line_tv.visibility = View.VISIBLE
overMapView.clearSiteMarkers()
overMapView.clearCustomPolyline()
}
}
@@ -115,6 +120,17 @@ class PM2DrivingInfoFragment :
}
}
fun updateLineStations(stations: MutableList<PM2Station>){
var stationsList = mutableListOf<LatLng>()
for (i in stations.indices){
val station = stations[i]
var latLng = LatLng(station.gcjLat,station.gcjLon)
stationsList.add(latLng)
}
overMapView?.drawSiteMarkers(stationsList,
BitmapFactory.decodeResource(resources,R.drawable.m2_map_staton_icon),0.5f,0.9f)
}
companion object {
private val TAG = PM2DrivingInfoFragment::class.java.simpleName
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -11,7 +11,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mapStyleExtraPath="@string/m2_over_map_style_extra_path"
app:mapStylePath="@string/m2_over_map_style_path" />
app:mapStylePath="@string/m2_over_map_style_path"
app:endPointDrawable="@drawable/m2_map_end_icon"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/img_drive_bg"