This commit is contained in:
wangcongtao
2020-05-13 16:32:08 +08:00
parent 8bb106bd03
commit 448323e182
19 changed files with 352 additions and 234 deletions

View File

@@ -55,7 +55,7 @@ public class CalculatePathItem {
return mPath.getLabels();
}
public String getTime() {
public String getFormattedTime() {
if ( mTimeBuilder == null ) {
final int time = mPath.getAllTime();
mTimeBuilder = new StringBuilder();
@@ -64,6 +64,14 @@ public class CalculatePathItem {
return mTimeBuilder.toString();
}
public int getTime(){
return mPath.getAllTime();
}
public int getDistance(){
return mPath.getAllLength();
}
private StringBuilder mTimeBuilder;
private void fillFormatTime( int seconds, StringBuilder builder ) {
@@ -83,7 +91,7 @@ public class CalculatePathItem {
private String mDistanceCacheStr = "";
public String getDistance() {
public String getFormattedDistance() {
if ( TextUtils.isEmpty( mDistanceCacheStr ) ) {
int distance = mPath.getAllLength();
if ( distance == -1 ) {

View File

@@ -13,7 +13,6 @@ import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.LatLngBounds;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.MarkerOptions;
import com.amap.api.maps.model.MarkerOptionsCreator;
import com.amap.api.maps.model.Polyline;
import com.amap.api.navi.AMapNavi;
import com.amap.api.navi.model.AMapNaviLocation;
@@ -21,15 +20,12 @@ import com.amap.api.navi.model.AMapNaviPath;
import com.amap.api.navi.model.NaviInfo;
import com.amap.api.navi.model.NaviLatLng;
import com.mogo.map.MogoLatLng;
import com.mogo.map.MogoMap;
import com.mogo.map.impl.amap.AMapWrapper;
import com.mogo.map.impl.amap.R;
import com.mogo.map.impl.amap.overlay.RouteOverLayWrapper;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.marker.MogoMarkersHandler;
import com.mogo.map.navi.MogoCalculatePath;
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WindowUtils;
import com.mogo.utils.logger.Logger;
@@ -394,10 +390,12 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
if ( mCalculatePathItems != null && !mCalculatePathItems.isEmpty() ) {
for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
MogoCalculatePath path = new MogoCalculatePath();
path.setDistance( calculatePathItem.getDistance() );
path.setFormattedDistance( calculatePathItem.getFormattedDistance() );
path.setPathId( calculatePathItem.getId() );
path.setStrategyName( calculatePathItem.getStrategyName() );
path.setFormattedTime( calculatePathItem.getFormattedTime() );
path.setTime( calculatePathItem.getTime() );
path.setDistance( calculatePathItem.getDistance() );
List< NaviLatLng > coordList = calculatePathItem.getPath().getCoordList();
ArrayList< MogoLatLng > mogoLatLngs = new ArrayList<>();
for ( NaviLatLng latlng : coordList