From d16fc6a98a03ceb6d3b320990771010909dadeb0 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Thu, 4 Aug 2022 10:20:12 +0800 Subject: [PATCH] =?UTF-8?q?[290=20bus/taxi]bus=E5=8F=B8=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BD=A8=E8=BF=B9=E8=AE=A1=E7=AE=97,?= =?UTF-8?q?=E5=8F=AA=E6=9C=89=E4=B8=A4=E4=B8=AA=E7=AB=99=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E4=BD=BF=E7=94=A8=E5=85=A8=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=EF=BC=8C=E6=9C=89=E5=A4=9A=E4=B8=AA=E7=AB=99=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E8=BF=9B=E8=A1=8C=E5=88=86=E6=AE=B5=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../passenger/model/BusPassengerModel.java | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java index 4cf55d2582..7ddfb2df9f 100644 --- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java @@ -385,20 +385,26 @@ public class BusPassengerModel { //找出前往站对应的轨迹点,拿出两站点的集合 CallerLogger.INSTANCE.d(M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size()); if (mRoutePoints.size() > 0) { - if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex - 1 >=0){ + if (mStations.size() > 2){ //两个站点以上要计算两个站点间的估计路线 + if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex - 1 >=0){ + mTwoStationsRouts.clear(); + BusPassengerStation stationNext = mStations.get(mNextStationIndex); + BusPassengerStation stationCur = mStations.get(mNextStationIndex - 1); + //当前站在轨迹中对应的点 + int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints + ,stationCur.getGcjLon(),stationCur.getGcjLat()); + //要前往的站在轨迹中对应的点 + int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints + ,stationNext.getGcjLon(),stationNext.getGcjLat()); + mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex)); + } + }else { //只有两个站点的时候整个路线就是两个站点之间的轨迹 mTwoStationsRouts.clear(); - BusPassengerStation stationNext = mStations.get(mNextStationIndex); - BusPassengerStation stationCur = mStations.get(mNextStationIndex - 1); - //当前站在轨迹中对应的点 - int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints - ,stationCur.getGcjLon(),stationCur.getGcjLat()); - //要前往的站在轨迹中对应的点 - int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints - ,stationNext.getGcjLon(),stationNext.getGcjLat()); - mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex)); + mTwoStationsRouts.addAll(mRoutePoints); + } + if (mTwoStationsRouts.size() > 0){ float sumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(mTwoStationsRouts); SharedPrefsMgr.getInstance(mContext).putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,(int) sumLength); - if (mAutopilotPlanningCallback != null){ mAutopilotPlanningCallback.updateTotalDistance(); }