diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/distancemamager/TrajectoryAndDistanceManager.kt b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/distancemamager/TrajectoryAndDistanceManager.kt index bccff2c869..d6bbe478ba 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/distancemamager/TrajectoryAndDistanceManager.kt +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/distancemamager/TrajectoryAndDistanceManager.kt @@ -97,13 +97,13 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener { * 结束站点 */ @Volatile - private var endStationInfo: StationAndIndex = StationAndIndex(null, null, null, null) + private var endStationInfo: StationAndIndex = StationAndIndex(null, null, null, null, null) /** * 开始站点 */ @Volatile - private var startStationInfo: StationAndIndex = StationAndIndex(null, null, null, null) + private var startStationInfo: StationAndIndex = StationAndIndex(null, null, null, null, null) /** * startStationInfo endStationInfo 站点之间的距离 @@ -145,7 +145,8 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener { } private fun updateRoutePoints(routePoints: List?) { - cleanRoutePoints() + mRoutePoints = null + mRoutePointsDistance = null val latLngModels = CoordinateCalculateRouteUtil .coordinateConverterWgsToGcjLocations(AbsMogoApplication.getApp(), routePoints!!) mRoutePoints = latLngModels @@ -168,27 +169,6 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener { } } - - private fun removeTempData() { - resetStation() - preCarLocationIndexInTrajectory = 0 - lineId = null - } - - private fun resetStation() { - this.endStationInfo.index = null - this.endStationInfo.distance = null - this.endStationInfo.isNext = null - this.startStationInfo.index = null - this.startStationInfo.distance = null - this.startStationInfo.isNext = null - } - - private fun cleanRoutePoints() { - mRoutePoints = null - mRoutePointsDistance = null - } - /** * 设置或清理站点坐标 */ @@ -202,9 +182,18 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener { "线路id:${lineId}设置站点:开始站点${startStationInfo}、结束站点:${endStationInfo}" ) if (startStationInfo == null || endStationInfo == null || lineId == -1L) { - removeTempData() + this.endStationInfo.index = null + this.endStationInfo.distance = null + this.endStationInfo.isNext = null + this.endStationInfo.lineId = null + this.startStationInfo.index = null + this.startStationInfo.distance = null + this.startStationInfo.isNext = null + this.startStationInfo.lineId = null + preCarLocationIndexInTrajectory = 0 endCalculateDistanceLoop() - cleanRoutePoints() + mRoutePoints = null + mRoutePointsDistance = null TrajectoryCache.deleteCatcheFile() this.endStationInfo.stationPoint = null this.startStationInfo.stationPoint = null @@ -215,18 +204,34 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener { isSameStation(this.endStationInfo.stationPoint, endStationInfo) ) { if (this.lineId != lineId) { - resetStation() - cleanRoutePoints() + this.endStationInfo.index = null + this.endStationInfo.distance = null + this.endStationInfo.isNext = null + this.endStationInfo.lineId = null + this.startStationInfo.index = null + this.startStationInfo.distance = null + this.startStationInfo.isNext = null + this.startStationInfo.lineId = null + mRoutePoints = null + mRoutePointsDistance = null TrajectoryCache.deleteCatcheFile() stationDistance.clear() } } else { - resetStation() + this.endStationInfo.index = null + this.endStationInfo.distance = null + this.endStationInfo.isNext = null + this.endStationInfo.lineId = null + this.startStationInfo.index = null + this.startStationInfo.distance = null + this.startStationInfo.isNext = null + this.startStationInfo.lineId = null if (this.lineId == 0L || this.lineId == null) { // 兼容老MAP 不返回轨迹id lineID } else { if (this.lineId != lineId) {// bus 切换站点不会切线路 - cleanRoutePoints() + mRoutePoints = null + mRoutePointsDistance = null TrajectoryCache.deleteCatcheFile() } }