From 9f2d5d8fbf42c4ff8c93c0769a0d543b4fee1b01 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Fri, 9 Sep 2022 15:15:50 +0800 Subject: [PATCH] =?UTF-8?q?[1.5.0]=201=E3=80=81=E8=A7=A3=E5=86=B3bus?= =?UTF-8?q?=E4=B9=98=E5=AE=A2=E5=B1=8F=E5=B0=8F=E5=9C=B0=E5=9B=BE=E9=97=AA?= =?UTF-8?q?=E7=83=81=202=E3=80=81=E8=88=8D=E5=BC=83=E5=8F=96=E4=B8=A4?= =?UTF-8?q?=E7=AB=99=E9=97=B4=E8=BD=A8=E8=BF=B9=E6=8A=A5=E9=94=99=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../passenger/model/BusPassengerModel.java | 4 +++- .../ui/BusPassengerMapDirectionView.java | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 10 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 9dc79238ae..a6f3aa85bf 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 @@ -432,7 +432,9 @@ public class BusPassengerModel { //要前往的站在轨迹中对应的点 int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints ,stationNext.getGcjLon(),stationNext.getGcjLat()); - mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex)); + if (currentRouteIndex < nextRouteIndex){ //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示 + mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex)); + } } }else { //只有两个站点的时候整个路线就是两个站点之间的轨迹 mTwoStationsRouts.clear(); diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java index a663e20563..f4ba291f5c 100644 --- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java @@ -57,8 +57,8 @@ public class BusPassengerMapDirectionView private int mCurrentIndex = -1; private int zoomLevel = 13; - private List mCoordinatesLatLng = new ArrayList<>(); - private List mLinePointsLatLng = new ArrayList<>(); + private List mCoordinatesLatLng = new ArrayList<>(); //站点坐标数据 + private List mLinePointsLatLng = new ArrayList<>(); //轨迹坐标数据 private Polyline mPolyline; private CameraUpdate mCameraUpdate; private Context mContext; @@ -197,7 +197,7 @@ public class BusPassengerMapDirectionView mCarMarker.setToTop(); } - if (mLinePointsLatLng.size() > 1){ + if (mLinePointsLatLng.size() > 0){ //圈定地图显示范围 //存放经纬度 LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder(); @@ -208,12 +208,13 @@ public class BusPassengerMapDirectionView //第二个参数为四周留空宽度 mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100)); - }else { - //设置希望展示的地图缩放级别 - CameraPosition cameraPosition = new CameraPosition.Builder() - .target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build(); - mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } +// else { +// //设置希望展示的地图缩放级别 +// CameraPosition cameraPosition = new CameraPosition.Builder() +// .target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build(); +// mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); +// } } @@ -368,7 +369,7 @@ public class BusPassengerMapDirectionView mLinePointsLatLng.clear(); mLinePointsLatLng.addAll(routeLineLatLngs); - if (mCoordinatesLatLng.size() > 0 && mCurrentIndex != currentIndex) { + if (mLinePointsLatLng.size() > 0 && mCurrentIndex != currentIndex) { if (mAMap != null && mLineMarkers.size() > 0) { mCurrentIndex = currentIndex; for (int i = 0; i < mLineMarkers.size(); i++) {