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 0b03eaafec..7683fd22a8 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 @@ -26,26 +26,37 @@ import java.util.concurrent.ConcurrentHashMap /** * 计算当前位置距离站点距离和走过的和未走过的轨迹点 */ -object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ +object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener { - private val distanceListeners: ConcurrentHashMap = ConcurrentHashMap() - private val trajectoryListeners: ConcurrentHashMap = ConcurrentHashMap() - private val trajectoryWithStationListeners: ConcurrentHashMap = ConcurrentHashMap() + private val distanceListeners: ConcurrentHashMap = + ConcurrentHashMap() + private val trajectoryListeners: ConcurrentHashMap = + ConcurrentHashMap() + private val trajectoryWithStationListeners: ConcurrentHashMap = + ConcurrentHashMap() const val TAG = "DistanceManager" const val TAGDISTANCE = "BusPassengerModelDistance" fun addDistanceListener(tag: String, listener: IDistanceListener) { - if (distanceListeners.containsKey(tag)) { return } + if (distanceListeners.containsKey(tag)) { + return + } distanceListeners[tag] = listener } + fun addTrajectoryListener(tag: String, listener: ITrajectoryListener) { - if (trajectoryListeners.containsKey(tag)) { return } + if (trajectoryListeners.containsKey(tag)) { + return + } trajectoryListeners[tag] = listener } + fun addTrajectoryWithStationListener(tag: String, listener: ITrajectoryWithStationListener) { - if (trajectoryWithStationListeners.containsKey(tag)) { return } + if (trajectoryWithStationListeners.containsKey(tag)) { + return + } trajectoryWithStationListeners[tag] = listener } @@ -60,17 +71,18 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ } - @Volatile private var mRoutePoints: MutableList? = ArrayList() + // 0-1 1-2 2-3 各个轨迹点的距离 private var mRoutePointsDistance: MutableList? = ArrayList() + // 所有轨迹点距离的和 - private var maxDistanceAllPoint:Double = 0.0 + private var maxDistanceAllPoint: Double = 0.0 private val stationDistance: ConcurrentHashMap = ConcurrentHashMap() @Volatile - private var lineId:Long? = null + private var lineId: Long? = null @Volatile private var endStationInfo: StationAndIndex = StationAndIndex(null, null, null, null) @@ -92,8 +104,11 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ d(M_OCHCOMMON + TAG, "onAutopilotRotting: 收到轨迹") globalPathResp?.wayPointsList?.let { if (it.size > 0) { - d(M_OCHCOMMON + TAG, "收到轨迹:轨迹个数${it.size}第一个点${it[0]}最后一个点:${it.last()} 轨迹id:${globalPathResp.lineId}") - if(globalPathResp.lineId!=null) {// 适配低版本不传递lineId + d( + M_OCHCOMMON + TAG, + "收到轨迹:轨迹个数${it.size}第一个点${it[0]}最后一个点:${it.last()} 轨迹id:${globalPathResp.lineId}" + ) + if (globalPathResp.lineId != null) {// 适配低版本不传递lineId if (globalPathResp.lineId == lineId && !mRoutePoints.isNullOrEmpty()) { d(M_OCHCOMMON + TAG, "重复轨迹") startCalculateDistanceLoop() @@ -120,7 +135,7 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ mRoutePointsDistance = ArrayList() maxDistanceAllPoint = 0.0 mRoutePoints?.forEachIndexed { index, current -> - if (mRoutePoints!!.last()!=current) { + if (mRoutePoints!!.last() != current) { val next = mRoutePoints!![index + 1] val distanceItem = CoordinateUtils.calculateLineDistance( current.longitude, @@ -138,8 +153,9 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ private fun removeTempData() { resetStation() preCarLocationIndexInTrajectory = 0 - lineId = null + lineId = null } + private fun resetStation() { this.endStationInfo.index = null this.endStationInfo.distance = null @@ -157,8 +173,15 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ /** * 设置或清理站点坐标 */ - fun setStationPoint(startStationInfo: MogoLocation?,endStationInfo: MogoLocation?,lineId:Long?) { - d(M_OCHCOMMON+ TAG,"线路id:${lineId}设置站点:开始站点${startStationInfo}、结束站点:${endStationInfo}") + fun setStationPoint( + startStationInfo: MogoLocation?, + endStationInfo: MogoLocation?, + lineId: Long? + ) { + d( + M_OCHCOMMON + TAG, + "线路id:${lineId}设置站点:开始站点${startStationInfo}、结束站点:${endStationInfo}" + ) if (startStationInfo == null || endStationInfo == null || lineId == -1L) { removeTempData() endCalculateDistanceLoop() @@ -168,20 +191,21 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ this.startStationInfo.stationPoint = null this.lineId = null stationDistance.clear() - }else{ - if(isSameStation(this.startStationInfo.stationPoint,startStationInfo)&& - isSameStation(this.endStationInfo.stationPoint,endStationInfo)){ - if(this.lineId!=lineId){ + } else { + if (isSameStation(this.startStationInfo.stationPoint, startStationInfo) && + isSameStation(this.endStationInfo.stationPoint, endStationInfo) + ) { + if (this.lineId != lineId) { resetStation() cleanRoutePoints() TrajectoryCache.deleteCatcheFile() stationDistance.clear() } - }else{ + } else { resetStation() if (this.lineId == 0L || this.lineId == null) { // 兼容老MAP 不返回轨迹id lineID - }else { + } else { if (this.lineId != lineId) {// bus 切换站点不会切线路 cleanRoutePoints() TrajectoryCache.deleteCatcheFile() @@ -196,11 +220,11 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ } } - private fun isSameStation(stationOne: MogoLocation?,stationTwo: MogoLocation?):Boolean{ - if(stationOne==null||stationTwo==null){ + private fun isSameStation(stationOne: MogoLocation?, stationTwo: MogoLocation?): Boolean { + if (stationOne == null || stationTwo == null) { return false } - if(stationOne.longitude==stationTwo.longitude&&stationOne.latitude==stationTwo.latitude){ + if (stationOne.longitude == stationTwo.longitude && stationOne.latitude == stationTwo.latitude) { return true } return false @@ -218,7 +242,7 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ endCalculateDistanceLoop() return } - if(it.latitude==0.0&&it.longitude==0.0){ + if (it.latitude == 0.0 && it.longitude == 0.0) { return } calculateRouteSumLength(it) @@ -228,11 +252,11 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ /** * 暂停路距计算 */ - fun suspendCalculate(){ + fun suspendCalculate() { endCalculateDistanceLoop() } - fun reStartCalculate(){ + fun reStartCalculate() { startCalculateDistanceLoop() } @@ -240,9 +264,12 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ * 启动路距计算 */ private fun startCalculateDistanceLoop() { - BizLoopManager.setLoopFunction(TAGDISTANCE, LoopInfo(1, ::calculateDistance, - scheduler = Schedulers.computation() - )) + BizLoopManager.setLoopFunction( + TAGDISTANCE, LoopInfo( + 1, ::calculateDistance, + scheduler = Schedulers.computation() + ) + ) d(M_OCHCOMMON + TAG, "开始路距计算") } @@ -260,7 +287,8 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ location: MogoLocation, ) { val autoPilotState = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state - val locationInfo = "自动驾驶状态:$autoPilotState line信息:${lineId}定位信息:${location.latitude},${location.longitude},${location.heading} 当前速度:${location.gnssSpeed}" + val locationInfo = + "自动驾驶状态:$autoPilotState line信息:${lineId}定位信息:${location.latitude},${location.longitude},${location.heading} 当前速度:${location.gnssSpeed}" if (mRoutePoints.isNullOrEmpty()) return // 计算起始站点在轨迹中的信息 这个是一个常量 if (startStationInfo.stationPoint != null @@ -270,14 +298,19 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ ) { //要前往的站在轨迹中对应的点的信息 val startStationInfo = CoordinateCalculateRouteUtil.getNearestPointInfo( - preCarLocationIndexInTrajectory, mRoutePoints!!.size,mRoutePoints!!, startStationInfo.stationPoint!!,1 + preCarLocationIndexInTrajectory, + mRoutePoints!!.size, + mRoutePoints!!, + startStationInfo.stationPoint!!, + 1 ) this.startStationInfo.isNext = startStationInfo.second this.startStationInfo.index = startStationInfo.first this.startStationInfo.distance = startStationInfo.third preCarLocationIndexInTrajectory = startStationInfo.first - val calculateData = "距离起始站点最近的点:${startStationInfo.first} 点在站的后面:${startStationInfo.second} 距离点的距离:${startStationInfo.third}" - writeLog(calculateData,locationInfo) + val calculateData = + "距离起始站点最近的点:${startStationInfo.first} 点在站的后面:${startStationInfo.second} 距离点的距离:${startStationInfo.third}" + writeLog(calculateData, locationInfo) } // 计算结束站点在轨迹中的信息 这个是一个常量可以缓存 @@ -288,18 +321,23 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ ) { //要前往的站在轨迹中对应的点 val endStationInfo = CoordinateCalculateRouteUtil.getNearestPointInfo( - preCarLocationIndexInTrajectory,mRoutePoints!!.size, mRoutePoints!!, endStationInfo.stationPoint!!,3 + preCarLocationIndexInTrajectory, + mRoutePoints!!.size, + mRoutePoints!!, + endStationInfo.stationPoint!!, + 3 ) this.endStationInfo.isNext = endStationInfo.second this.endStationInfo.index = endStationInfo.first this.endStationInfo.distance = endStationInfo.third - val calculateData = "距离结束站点最近的点:${endStationInfo.first} 点在站的后面:${endStationInfo.second} 距离点的距离:${endStationInfo.third}" + val calculateData = + "距离结束站点最近的点:${endStationInfo.first} 点在站的后面:${endStationInfo.second} 距离点的距离:${endStationInfo.third}" writeLog(calculateData, locationInfo) } try { if (endStationInfo.stationPoint != null - && endStationInfo.isNext!= null + && endStationInfo.isNext != null && endStationInfo.index != null && endStationInfo.distance != null && startStationInfo.stationPoint != null @@ -309,39 +347,44 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ ) { calculateStationDistance() } - }catch (e:Exception){ - e(M_OCHCOMMON+ TAG,"计算两个站点间的距离") + } catch (e: Exception) { + e(M_OCHCOMMON + TAG, "计算两个站点间的距离") } - val carLocationInfo:Triple - if(endStationInfo.isNext==true){ + val carLocationInfo: Triple + if (endStationInfo.isNext == true) { // 计算车的位置在轨迹中的信息 这个是一个变量可以缓存 carLocationInfo = CoordinateCalculateRouteUtil.getNearestPointInfo( - preCarLocationIndexInTrajectory,endStationInfo.index!!, mRoutePoints!!, location,2 + preCarLocationIndexInTrajectory, endStationInfo.index!!, mRoutePoints!!, location, 2 ) - }else{ + } else { carLocationInfo = CoordinateCalculateRouteUtil.getNearestPointInfo( - preCarLocationIndexInTrajectory,endStationInfo.index!!+1, mRoutePoints!!, location,2 + preCarLocationIndexInTrajectory, + endStationInfo.index!! + 1, + mRoutePoints!!, + location, + 2 ) } - val calculateData = "距离结束站点最近的点:${carLocationInfo.first} 点在站的后面:${carLocationInfo.second} 距离点的距离:${carLocationInfo.third}" + val calculateData = + "距离结束站点最近的点:${carLocationInfo.first} 点在站的后面:${carLocationInfo.second} 距离点的距离:${carLocationInfo.third}" writeLog(calculateData, locationInfo) - if(carLocationInfo.second==null||carLocationInfo.third>1_000){ + if (carLocationInfo.second == null || carLocationInfo.third > 1_000) { preCarLocationIndexInTrajectory = 0 return } var maxDisatance = 0.0f - if(carLocationInfo.second==true){ - if(carLocationInfo.first>0) { - maxDisatance = mRoutePointsDistance?.get(carLocationInfo.first - 1)?:0f + if (carLocationInfo.second == true) { + if (carLocationInfo.first > 0) { + maxDisatance = mRoutePointsDistance?.get(carLocationInfo.first - 1) ?: 0f } - }else{ - maxDisatance = mRoutePointsDistance?.get(carLocationInfo.first)?:0f + } else { + maxDisatance = mRoutePointsDistance?.get(carLocationInfo.first) ?: 0f } - if(carLocationInfo.third>maxDisatance){ + if (carLocationInfo.third > maxDisatance) { preCarLocationIndexInTrajectory = 0 - writeLog("到点的距离${carLocationInfo.third},最大距离${maxDisatance}",locationInfo) + writeLog("到点的距离${carLocationInfo.third},最大距离${maxDisatance}", locationInfo) return } @@ -349,28 +392,28 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ // 距离回调 try { - if(distanceListeners.size>0) { - invokeDistance(carLocationInfo, location,locationInfo) + if (distanceListeners.size > 0) { + invokeDistance(carLocationInfo, location, locationInfo) } - }catch (e:Exception){ - e(M_OCHCOMMON+ TAG,"距离计算错误") + } catch (e: Exception) { + e(M_OCHCOMMON + TAG, "距离计算错误") } // 不带站点轨迹回调 try { - if(trajectoryListeners.size>0) { + if (trajectoryListeners.size > 0) { invokeTrajectory(carLocationInfo, location) } - }catch (e:Exception){ - e(M_OCHCOMMON+ TAG,"轨迹线(轨迹两头)计算错误") + } catch (e: Exception) { + e(M_OCHCOMMON + TAG, "轨迹线(轨迹两头)计算错误") } // 只展示站点之间轨迹 try { - if(trajectoryWithStationListeners.size>0) { + if (trajectoryWithStationListeners.size > 0) { invokeTrajectoryWithStation(carLocationInfo, location) } - }catch (e:Exception){ - e(M_OCHCOMMON+ TAG,"轨迹线(站点两头)计算错误") + } catch (e: Exception) { + e(M_OCHCOMMON + TAG, "轨迹线(站点两头)计算错误") } } @@ -381,12 +424,12 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ private fun calculateStationDistance() { var lastSumLength = 0f val key = getKey() - if (stationDistance[key] !=null) { + if (stationDistance[key] != null) { return } - val stationIndex = endStationInfo.index?:0 - if (startStationInfo.index!! < stationIndex-1) { + val stationIndex = endStationInfo.index ?: 0 + if (startStationInfo.index!! < stationIndex - 1) { // subList 是[) 需要的是[] val subList = mRoutePoints!!.subList(startStationInfo.index!!, stationIndex + 1) // 轨迹点所有的距离 @@ -397,7 +440,7 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ } else {// isNext = false lastSumLength += stationDistance } - if (startStationInfo.isNext==true) {// 是否是下一个 true 下一个 + if (startStationInfo.isNext == true) {// 是否是下一个 true 下一个 lastSumLength += startStationInfo.distance!! } else { lastSumLength -= startStationInfo.distance!! @@ -409,10 +452,10 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ lastPoints!!.longitude, lastPoints.latitude ) } - d(M_OCHCOMMON+ TAG,"两站点距离:$lastSumLength") + d(M_OCHCOMMON + TAG, "两站点距离:$lastSumLength") stationDistance[key] = lastSumLength - if(distanceListeners.size>0) { + if (distanceListeners.size > 0) { distanceListeners.forEach { //val tag = it.key val listener = it.value @@ -430,11 +473,11 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ carLocationInfo: Triple, location: MogoLocation, locationInfo: String - ){ + ) { var lastSumLength = 0f - val stationIndex = endStationInfo.index?:0 - if (carLocationInfo.first < stationIndex-1) { + val stationIndex = endStationInfo.index ?: 0 + if (carLocationInfo.first < stationIndex - 1) { // subList 是[) 需要的是[] val subList = mRoutePoints!!.subList(carLocationInfo.first, stationIndex + 1) // 轨迹点所有的距离 @@ -457,13 +500,13 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ location.longitude, location.latitude ) } - d(M_OCHCOMMON+ TAG,"距离终点:$lastSumLength") - if(lastSumLength>maxDistanceAllPoint){ + d(M_OCHCOMMON + TAG, "距离终点:$lastSumLength") + if (lastSumLength > maxDistanceAllPoint) { // 大于最大值需要需要删除此次计算 - writeLog("距离终点:$lastSumLength",locationInfo) + writeLog("距离终点:$lastSumLength", locationInfo) return } - if(distanceListeners.size>0) { + if (distanceListeners.size > 0) { distanceListeners.forEach { //val tag = it.key val listener = it.value @@ -479,15 +522,15 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ if (mRoutePoints.isNullOrEmpty()) return val routeArrivied = mutableListOf() val routeArriving = mutableListOf() - if(carLocationInfo.second==true){// isNext = true - routeArrivied.addAll(mRoutePoints!!.subList(0,carLocationInfo.first)) - routeArriving.addAll(mRoutePoints!!.subList(carLocationInfo.first,mRoutePoints!!.size)) - }else{// isNext = false - val indexNext = carLocationInfo.first+1 - routeArrivied.addAll(mRoutePoints!!.subList(0,indexNext)) - routeArriving.addAll(mRoutePoints!!.subList(indexNext,mRoutePoints!!.size)) + if (carLocationInfo.second == true) {// isNext = true + routeArrivied.addAll(mRoutePoints!!.subList(0, carLocationInfo.first)) + routeArriving.addAll(mRoutePoints!!.subList(carLocationInfo.first, mRoutePoints!!.size)) + } else {// isNext = false + val indexNext = carLocationInfo.first + 1 + routeArrivied.addAll(mRoutePoints!!.subList(0, indexNext)) + routeArriving.addAll(mRoutePoints!!.subList(indexNext, mRoutePoints!!.size)) } - if(trajectoryListeners.size>0) { + if (trajectoryListeners.size > 0) { trajectoryListeners.forEach { //val tag = it.key val listener = it.value @@ -510,10 +553,10 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ && startStationInfo.index != null && startStationInfo.distance != null ) { - if(startStationInfo.isNext==true){ + if (startStationInfo.isNext == true) { fromCut = startStationInfo.index!! - }else{ - fromCut = startStationInfo.index!!+1 + } else { + fromCut = startStationInfo.index!! + 1 } } @@ -522,25 +565,25 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ && endStationInfo.index != null && endStationInfo.distance != null ) { - if(endStationInfo.isNext==true){ + if (endStationInfo.isNext == true) { endCut = endStationInfo.index!! - }else{ - endCut = endStationInfo.index!!+1 + } else { + endCut = endStationInfo.index!! + 1 } } - d(M_OCHCOMMON+ TAG,"根据站点切个:第一个点:$fromCut 最后一个点$endCut") - if(carLocationInfo.second==true){// isNext = true - routeArrivied.addAll(mRoutePoints!!.subList(fromCut,carLocationInfo.first)) - routeArriving.addAll(mRoutePoints!!.subList(carLocationInfo.first,endCut)) - }else{// isNext = false - val indexNext = carLocationInfo.first+1 - routeArrivied.addAll(mRoutePoints!!.subList(fromCut,indexNext)) - routeArriving.addAll(mRoutePoints!!.subList(indexNext,endCut)) + d(M_OCHCOMMON + TAG, "根据站点切个:第一个点:$fromCut 最后一个点$endCut") + if (carLocationInfo.second == true) {// isNext = true + routeArrivied.addAll(mRoutePoints!!.subList(fromCut, carLocationInfo.first)) + routeArriving.addAll(mRoutePoints!!.subList(carLocationInfo.first, endCut)) + } else {// isNext = false + val indexNext = carLocationInfo.first + 1 + routeArrivied.addAll(mRoutePoints!!.subList(fromCut, indexNext)) + routeArriving.addAll(mRoutePoints!!.subList(indexNext, endCut)) } routeArrivied.add(0, startStationInfo.stationPoint!!) routeArriving.add(endStationInfo.stationPoint!!) - if(trajectoryWithStationListeners.size>0) { + if (trajectoryWithStationListeners.size > 0) { trajectoryWithStationListeners.forEach { //val tag = it.key val listener = it.value @@ -549,23 +592,23 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ } } -// @ChainLog( + // @ChainLog( // linkChainLog = ChainConstant.CHAIN_TYPE_OCH, // linkCode = ChainConstant.CHAIN_SOURCE_OCH, // nodeAliasCode = ChainConstant.CHAIN_CODE_OCH_COMMON_DISTANCE, // paramIndexes = [0,1] // ) private fun writeLog(carLocationInfo: String, location: String) { - d(M_OCHCOMMON+ TAG,carLocationInfo) - d(M_OCHCOMMON+ TAG,location) + d(M_OCHCOMMON + TAG, carLocationInfo) + d(M_OCHCOMMON + TAG, location) } /** * 距离站点的距离 */ - private fun distanceWithStartStation():String{ - if (startStationInfo.stationPoint==null) { + private fun distanceWithStartStation(): String { + if (startStationInfo.stationPoint == null) { return "请选择起始结束站点" } val currentPoint = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02() @@ -575,9 +618,9 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ startStationInfo.stationPoint!!.longitude, startStationInfo.stationPoint!!.latitude ) - return if(distance <= OchCommonConst.AUTOMATIC_PLANNING_MAX_DISTANCE){ + return if (distance <= OchCommonConst.AUTOMATIC_PLANNING_MAX_DISTANCE) { "" - }else{ + } else { "距离起始站点过远:${distance}米" } } @@ -644,24 +687,24 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ * 返回空为可启动自驾 * 返回其他不可启动自驾 返回为原因 */ - fun canStartAutopilot(lineId: Long?):String{ - if(lineId==null){ + fun canStartAutopilot(lineId: Long?): String { + if (lineId == null) { return "请确认线路ID" } try { - if(mRoutePoints.isNullOrEmpty()){ + if (mRoutePoints.isNullOrEmpty()) { // 判断距离起始站的距离 // 没有收到过轨迹 // 收到过轨迹 且底盘没有在自动驾驶中(没办法申请轨迹) 自驾中重启底盘的形式 val redCatche = TrajectoryCache.redCatche(lineId.toString()) - return if(redCatche.isNullOrEmpty()){ + return if (redCatche.isNullOrEmpty()) { distanceWithStartStation() - }else{ + } else { distanceWithTrajectory(redCatche) } - }else { + } else { return if (this.lineId == 0L || this.lineId == null) { distanceWithTrajectory(mRoutePoints!!) } else { @@ -673,7 +716,7 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{ } } } - }catch (e:Exception){ + } catch (e: Exception) { e.printStackTrace() } return ""