opt
This commit is contained in:
@@ -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 ) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -86,7 +86,7 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
|
||||
if ( marker == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !mServicesMarkers.containsKey( tag ) ) {
|
||||
if ( mServicesMarkers.get( tag ) == null ) {
|
||||
mServicesMarkers.put( tag, new ArrayList< IMogoMarker >() );
|
||||
}
|
||||
mServicesMarkers.get( tag ).add( marker );
|
||||
@@ -96,7 +96,7 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
|
||||
if ( markers == null || markers.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
if ( !mServicesMarkers.containsKey( tag ) ) {
|
||||
if ( mServicesMarkers.get( tag ) == null ) {
|
||||
mServicesMarkers.put( tag, new ArrayList< IMogoMarker >() );
|
||||
}
|
||||
mServicesMarkers.get( tag ).addAll( markers );
|
||||
|
||||
@@ -11,44 +11,44 @@ public interface IMogoNaviListener {
|
||||
/**
|
||||
* 导航初始化失败
|
||||
*/
|
||||
void onInitNaviFailure();
|
||||
default void onInitNaviFailure(){}
|
||||
|
||||
/**
|
||||
* 导航初始化成功
|
||||
*/
|
||||
void onInitNaviSuccess();
|
||||
default void onInitNaviSuccess(){}
|
||||
|
||||
/**
|
||||
* 导航引导信息
|
||||
*
|
||||
* @param naviinfo
|
||||
*/
|
||||
void onNaviInfoUpdate( MogoNaviInfo naviinfo );
|
||||
default void onNaviInfoUpdate( MogoNaviInfo naviinfo ){}
|
||||
|
||||
/**
|
||||
* 导航开始回调
|
||||
*/
|
||||
void onStartNavi();
|
||||
default void onStartNavi(){}
|
||||
|
||||
/**
|
||||
* 导航停止:包括到达目的地和主动停止导航
|
||||
*/
|
||||
void onStopNavi();
|
||||
default void onStopNavi(){}
|
||||
|
||||
/**
|
||||
* 路径规划成功
|
||||
*/
|
||||
void onCalculateSuccess();
|
||||
default void onCalculateSuccess(){}
|
||||
|
||||
/**
|
||||
* 路径规划失败
|
||||
*/
|
||||
void onoCalculateFailed();
|
||||
default void onoCalculateFailed(){}
|
||||
|
||||
/**
|
||||
* 巡航信息发生改变
|
||||
* Deprecated, use {@link IMogoAimlessModeListener#onUpdateTraffic2(MogoTraffic)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
void onUpdateTraffic( MogoTraffic traffic );
|
||||
default void onUpdateTraffic( MogoTraffic traffic ){}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ public interface IMogoNaviListener2 extends IMogoNaviListener {
|
||||
/**
|
||||
* 实际导航结束
|
||||
*/
|
||||
void onArriveDestination();
|
||||
default void onArriveDestination() { }
|
||||
|
||||
/**
|
||||
* 模拟导航结束
|
||||
*/
|
||||
void onEndEmulatorNavi();
|
||||
default void onEndEmulatorNavi(){}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,14 @@ public class MogoCalculatePath {
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private String mTime;
|
||||
private String mFormattedTime;
|
||||
private int mTime;
|
||||
|
||||
/**
|
||||
* 距离
|
||||
*/
|
||||
private String mDistance;
|
||||
private String mFormattedDistance;
|
||||
private int mDistance;
|
||||
|
||||
/**
|
||||
* 红绿灯个数
|
||||
@@ -69,20 +71,20 @@ public class MogoCalculatePath {
|
||||
this.mStrategyName = mStrategyName;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return mTime;
|
||||
public String getFormattedTime() {
|
||||
return mFormattedTime;
|
||||
}
|
||||
|
||||
public void setTime( String mTime ) {
|
||||
this.mTime = mTime;
|
||||
public void setFormattedTime( String mTime ) {
|
||||
this.mFormattedTime = mTime;
|
||||
}
|
||||
|
||||
public String getDistance() {
|
||||
return mDistance;
|
||||
public String getFormattedDistance() {
|
||||
return mFormattedDistance;
|
||||
}
|
||||
|
||||
public void setDistance( String mDistance ) {
|
||||
this.mDistance = mDistance;
|
||||
public void setFormattedDistance( String mDistance ) {
|
||||
this.mFormattedDistance = mDistance;
|
||||
}
|
||||
|
||||
public int getTrafficLights() {
|
||||
@@ -125,4 +127,22 @@ public class MogoCalculatePath {
|
||||
public void setPathId( int mPathId ) {
|
||||
this.mPathId = mPathId;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return mTime;
|
||||
}
|
||||
|
||||
public MogoCalculatePath setTime( int time ) {
|
||||
this.mTime = time;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDistance() {
|
||||
return mDistance;
|
||||
}
|
||||
|
||||
public MogoCalculatePath setDistance( int distance ) {
|
||||
this.mDistance = distance;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.map;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.impl.amap.InterceptorHandler;
|
||||
import com.mogo.map.impl.amap.overlay.RouteOverlayHelper;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
@@ -54,6 +53,7 @@ public class MogoMarkerManager implements IMogoMarkerManager {
|
||||
try {
|
||||
return MogoMap.getInstance().getMogoMap().addMarker( tag, options );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, Log.getStackTraceString( e ) );
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user