整理代码删除无用代码

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-11-08 21:00:40 +08:00
parent ae9a096663
commit 9a6adb75b8
28 changed files with 4 additions and 38100 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -19,14 +19,14 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.call.map.CallerLocationUpdaterManager;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoMapView;
import com.mogo.map.impl.custom.location.GpsTester;
import com.mogo.map.impl.custom.navi.NaviClient;
import com.mogo.map.impl.custom.utils.MogoMapUtils;
import com.mogo.map.impl.custom.utils.ObjectUtils;
@@ -39,7 +39,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.storage.SharedPrefsMgr;
@@ -115,9 +114,6 @@ public class AMapViewWrapper implements IMogoMapView,
startTime = System.currentTimeMillis();
Logger.i(TAG, "autoop--AMapViewWrapper: init");
this.mMapView = mMapView;
if (DebugConfig.isDebug()) {
GpsTester.getInstance().init(mMapView);
}
initViews();
initListeners();
this.mIMap = new AMapWrapper(this.mMapView.getMapAutoViewHelper(), this.mMapView, this);
@@ -729,7 +725,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public int getSpeedLimmit(double lon, double lat, float angle) {
return MapDataApi.INSTANCE.getLimitSpeed(lon,lat,angle);
return MapDataApi.INSTANCE.getLimitSpeed(lon, lat, angle);
}
private boolean isShowWarn;
@@ -999,10 +995,6 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMapAutoViewHelper().setMapViewPerspective(MapAutoApi.MAP_PERSPECTIVE_UP_CAR);
}
@Override
public void testGpsData() {
GpsTester.getInstance().testGpsData();
}
@Override
public void onStyleAutoChanged(boolean isVrMode) {

View File

@@ -1,60 +0,0 @@
package com.mogo.map.impl.custom.hook;
import android.content.Context;
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
/**
* @author congtaowang
* @since 2020-03-12
* <p>
* 描述
*/
public class BnHooker implements InvocationHandler {
private static final String TAG = "BnHooker";
private final Context mContext;
private Object host;
public BnHooker(MapAutoViewHelper map, Context context ) throws Exception {
mContext = context;
if ( map == null ) {
return;
}
// Field field = AMap.class.getDeclaredField( "a" );
// field.setAccessible( true );
// host = field.get( map );
// Object object = Proxy.newProxyInstance(
// BnHooker.class.getClassLoader(),
// new Class[]{
// com.amap.api.col.n3.ft.a.class,
// IAMapDelegate.class,
// IAMapListener.class,
// IAMap.class
// },
// this
// );
// field.set( map, object );
}
@Override
public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable {
// if ( method.getName().equals( "setRenderFps" ) ) {
// Logger.d( TAG, "setRenderFps" );
// if ( !NaviClient.getInstance( mContext ).isNaviing() ) {
// }
// return method.invoke( host, 10 );
// }
// if ( method.getName().equals( "drawFrame" ) ) {
// Logger.d( TAG, "drawFrame" );
// }
// return method.invoke( host, args );
return null;
}
}

View File

@@ -1,169 +0,0 @@
package com.mogo.map.impl.custom.location;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.TextureView;
import com.zhidaoauto.map.sdk.open.location.MogoLocation;
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
public
/**
* @author congtaowang
* @since 2020/12/22
*
* 描述
*/
class GpsTester {
private static volatile GpsTester sInstance;
private MapAutoView mMapAutoView;
private GpsTester() {
}
public static GpsTester getInstance() {
if ( sInstance == null ) {
synchronized ( GpsTester.class ) {
if ( sInstance == null ) {
sInstance = new GpsTester();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
public void init( MapAutoView view ) {
mMapAutoView = view;
}
private class GpsTestThreadHandler extends Handler {
public GpsTestThreadHandler( Looper looper ) {
super( looper );
}
@Override
public void handleMessage( Message msg ) {
super.handleMessage( msg );
switch ( msg.what ) {
case 1:
try {
prepareGpsData();
sendEmptyMessageDelayed( 2, 0 );
} catch ( Exception e ) {
e.printStackTrace();
}
break;
case 2:
try {
long time = readOneLineGpsDataAndSet2Map();
sendEmptyMessageDelayed( 2, time );
} catch ( Exception e ) {
e.printStackTrace();
}
break;
}
}
}
private Handler mHandler = null;
private BufferedReader br = null;
private long mLastTime = 0;
private float mLastHeading = 0;
private int step = 0;
private MogoLocation mogoLocation = new MogoLocation();
public void testGpsData() {
if ( mHandler != null ) {
return;
}
final HandlerThread ht = new HandlerThread( "gps-test-thread" );
ht.start();
mHandler = new GpsTestThreadHandler( ht.getLooper() );
mMapAutoView.getLocationClient().setIsUseExtraGPSData( true );
mHandler.sendEmptyMessage( 1 );
}
private void prepareGpsData() throws Exception {
InputStreamReader isr = new InputStreamReader( mMapAutoView.getContext().getAssets().open( "20201105_1.csv" ) );
br = new BufferedReader( isr );
}
private long readOneLineGpsDataAndSet2Map() throws Exception {
String line = br.readLine();
if ( TextUtils.isEmpty( line ) ) {
return 0;
}
long duration = 3;
String datums[] = line.split( "," );
long time = Long.valueOf( datums[0] );
mogoLocation.setProvider( "GPS_SELF" );
mogoLocation.setLon( Double.valueOf( datums[1] ) );
mogoLocation.setLat( Double.valueOf( datums[2] ) );
float angle = Float.valueOf( datums[4] );
if ( mLastTime > 0 ) {
duration = time - mLastTime;
} else {
duration = 3;
}
mogoLocation.setDuration( mogoLocation.getDuration() + duration - 2 );
mLastTime = time;
float heading = angle;
if ( heading == -100f ) {
if ( mLastHeading != 400f ) {
heading = mLastHeading;
} else {
heading = 0f;
}
}
if ( mLastHeading == 400f || Math.abs( mLastHeading - heading ) > 0.5f ) {
mLastHeading = heading;
} else {
heading = mLastHeading;
}
if ( heading < 40 ) {
mogoLocation.setHeading( heading + 4f );
} else {
mogoLocation.setHeading( heading );
}
step++;
if ( step >= 50 ) {
step = 0;
long realDuration = mogoLocation.getDuration() + 75;
realDuration = realDuration / 4;
mogoLocation.setDuration( realDuration );
mMapAutoView.getLocationClient().setExtraSelfGPSData( mogoLocation );
mogoLocation.setDuration( 0L );
return realDuration;
}
return 0;
}
}

View File

@@ -1,8 +1,6 @@
package com.mogo.map.impl.custom.marker;
import com.mogo.map.impl.custom.AMapMarkerClickHandler;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import java.util.HashMap;
import java.util.Map;

View File

@@ -1,30 +0,0 @@
package com.mogo.map.impl.custom.message;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import androidx.annotation.NonNull;
/**
* @author congtaowang
* @since 2019-12-28
* <p>
* 描述
*/
public class AMapMessageConsts {
/**
* 导航开始
*/
public static final int MSG_NAVI_START = 1000;
/**
* 取消导航
*/
public static final int MSG_NAVI_STOP = 1001;
/**
* 规划路线成功
*/
public static final int MSG_CALCULATE_SUCCESS = 1002;
}

View File

@@ -1,21 +0,0 @@
package com.mogo.map.impl.custom.message;
import com.autonavi.nge.guidance.NaviInfo;
/**
* @author congtaowang
* @since 2019-12-28
* <p>
* 消息回调
*/
public interface AMapMessageListener {
void onNaviStarted();
void onNaviStopped();
void onNaviInfoUpdat( NaviInfo naviInfo );
void onCalculateSuccess();
}

View File

@@ -1,133 +0,0 @@
package com.mogo.map.impl.custom.message;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-28
* <p>
* 描述
*/
public class AMapMessageManager {
private static volatile AMapMessageManager sInstance;
private List< AMapMessageListener > mListeners = new ArrayList<>();
private AMapMessageManager() {
}
public static AMapMessageManager getInstance() {
if ( sInstance == null ) {
synchronized ( AMapMessageManager.class ) {
if ( sInstance == null ) {
sInstance = new AMapMessageManager();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
public synchronized void registerAMapMessageListener( AMapMessageListener listener ) {
if ( !mListeners.contains( listener ) ) {
mListeners.add( listener );
}
}
public synchronized void unregisterAMapMessageListener( AMapMessageListener listener ) {
mListeners.remove( listener );
}
private Handler mHandler = new Handler( Looper.getMainLooper() ) {
@Override
public void handleMessage( @NonNull Message msg ) {
super.handleMessage( msg );
AMapMessageManager.this.handleMessage( msg );
}
};
public void sendMessage( Message msg ) {
if ( msg != null ) {
mHandler.sendMessage( msg );
}
}
public void sendMessage( int what ) {
sendMessage( what, null );
}
public void sendMessage( int what, Object obj ) {
Message msg = Message.obtain();
msg.what = what;
msg.obj = obj;
sendMessage( msg );
}
public void postNaviStarted() {
sendMessage( AMapMessageConsts.MSG_NAVI_START );
}
public void postNaviStopped() {
sendMessage( AMapMessageConsts.MSG_NAVI_STOP );
}
public void postCalculateSuccess() {
sendMessage( AMapMessageConsts.MSG_CALCULATE_SUCCESS );
}
private synchronized void handleMessage( Message msg ) {
if ( msg == null ) {
return;
}
switch ( msg.what ) {
case AMapMessageConsts.MSG_NAVI_START:
handleNaviStartedMsg();
break;
case AMapMessageConsts.MSG_NAVI_STOP:
handleNaviStoppedMsg();
break;
case AMapMessageConsts.MSG_CALCULATE_SUCCESS:
handleCalculateSuccessMsg();
break;
}
}
private void handleNaviStartedMsg() {
if ( mListeners == null ) {
return;
}
for ( AMapMessageListener listener : mListeners ) {
listener.onNaviStarted();
}
}
private void handleNaviStoppedMsg() {
if ( mListeners == null ) {
return;
}
for ( AMapMessageListener listener : mListeners ) {
listener.onNaviStopped();
}
}
private void handleCalculateSuccessMsg() {
if ( mListeners == null ) {
return;
}
for ( AMapMessageListener listener : mListeners ) {
listener.onCalculateSuccess();
}
}
}

View File

@@ -1,237 +0,0 @@
//package com.mogo.map.impl.custom.navi;
//
//import com.amap.api.navi.AMapNaviListener;
//import com.amap.api.navi.model.AMapCalcRouteResult;
//import com.amap.api.navi.model.AMapLaneInfo;
//import com.amap.api.navi.model.AMapModelCross;
//import com.amap.api.navi.model.AMapNaviCameraInfo;
//import com.amap.api.navi.model.AMapNaviCross;
//import com.amap.api.navi.model.AMapNaviInfo;
//import com.amap.api.navi.model.AMapNaviLocation;
//import com.amap.api.navi.model.AMapNaviRouteNotifyData;
//import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo;
//import com.amap.api.navi.model.AMapServiceAreaInfo;
//import com.amap.api.navi.model.AimLessModeCongestionInfo;
//import com.amap.api.navi.model.AimLessModeStat;
//import com.amap.api.navi.model.NaviInfo;
//import com.autonavi.tbt.TrafficFacilityInfo;
//import com.mogo.utils.logger.Logger;
//
///**
// * @author congtaowang
// * @since 2019-12-25
// * <p>
// * 自研导航事件:导航事件
// */
//public abstract class AMapNaviListenerAdapter implements AMapNaviListener {
//
// private static final String TAG = "AMapNaviListenerAdapter";
// protected String mLastSpeakWord;
//
// @Override
// public void onInitNaviFailure() {
//
// }
//
// @Override
// public void onInitNaviSuccess() {
//
// }
//
// @Override
// public void onStartNavi( int i ) {
//
// }
//
// @Override
// public void onTrafficStatusUpdate() {
//
// }
//
// @Override
// public void onLocationChange( AMapNaviLocation aMapNaviLocation ) {
//
// }
//
// @Override
// public void onGetNavigationText( int i, String s ) {
//
// }
//
// @Override
// public void onGetNavigationText( String s ) {
// mLastSpeakWord = s;
// Logger.d( TAG, s );
// TTSSpeaker.getInstance().speakTTS( s );
// }
//
// @Override
// public void onEndEmulatorNavi() {
//
// }
//
// @Override
// public void onArriveDestination() {
//
// }
//
// @Override
// public void onCalculateRouteFailure( int i ) {
//
// }
//
// @Override
// public void onReCalculateRouteForYaw() {
//
// }
//
// @Override
// public void onReCalculateRouteForTrafficJam() {
//
// }
//
// @Override
// public void onArrivedWayPoint( int i ) {
//
// }
//
// @Override
// public void onGpsOpenStatus( boolean b ) {
//
// }
//
// @Override
// public void onNaviInfoUpdate( NaviInfo naviInfo ) {
//
// }
//
// @Override
// public void onNaviInfoUpdated( AMapNaviInfo aMapNaviInfo ) {
//
// }
//
// @Override
// public void updateCameraInfo( AMapNaviCameraInfo[] aMapNaviCameraInfos ) {
//
// }
//
// @Override
// public void updateIntervalCameraInfo( AMapNaviCameraInfo aMapNaviCameraInfo, AMapNaviCameraInfo aMapNaviCameraInfo1, int i ) {
// if ( aMapNaviCameraInfo != null ) {
// Logger.i( TAG, "current camera speed: %d, status = %d", aMapNaviCameraInfo.getCameraSpeed(), i );
// }
// if ( aMapNaviCameraInfo1 != null ) {
// Logger.i( TAG, "current camera speed: %d, status = %d", aMapNaviCameraInfo1.getCameraSpeed(), i );
// }
// }
//
//
// @Override
// public void onServiceAreaUpdate( AMapServiceAreaInfo[] aMapServiceAreaInfos ) {
//
// }
//
// @Override
// public void showCross( AMapNaviCross aMapNaviCross ) {
//
// }
//
// @Override
// public void hideCross() {
//
// }
//
// @Override
// public void showModeCross( AMapModelCross aMapModelCross ) {
//
// }
//
// @Override
// public void hideModeCross() {
//
// }
//
// @Override
// public void showLaneInfo( AMapLaneInfo[] aMapLaneInfos, byte[] bytes, byte[] bytes1 ) {
//
// }
//
// @Override
// public void showLaneInfo( AMapLaneInfo aMapLaneInfo ) {
//
// }
//
// @Override
// public void hideLaneInfo() {
//
// }
//
// @Override
// public void onCalculateRouteSuccess( int[] ints ) {
//
// }
//
// @Override
// public void notifyParallelRoad( int i ) {
//
// }
//
// @Override
// public void OnUpdateTrafficFacility( AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos ) {
//
// }
//
// @Override
// public void OnUpdateTrafficFacility( AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo ) {
//
// }
//
// @Override
// public void OnUpdateTrafficFacility( TrafficFacilityInfo trafficFacilityInfo ) {
//
// }
//
// /**
// * 巡航回调
// * 连续5个点速度大于15km/h后触发 updateAimlessModeStatistics 回调,通过 AimLessModeStat 对象可获取巡航的连续行驶距离和连续启用时间
// *
// * @param aimLessModeStat
// */
// @Override
// public void updateAimlessModeStatistics( AimLessModeStat aimLessModeStat ) {
//
// }
//
// /**
// * 巡航回调
// * 出现拥堵长度大于500米且拥堵时间大于5分钟时会进到 updateAimlessModeCongestionInfo 回调中,通过 AimLessModeCongestionInfo 对象,可获取到道路拥堵信息(如:导致拥堵的事件类型、拥堵的状态等)
// *
// * @param aimLessModeCongestionInfo
// */
// @Override
// public void updateAimlessModeCongestionInfo( AimLessModeCongestionInfo aimLessModeCongestionInfo ) {
//
// }
//
// @Override
// public void onPlayRing( int i ) {
//
// }
//
// @Override
// public void onCalculateRouteSuccess( AMapCalcRouteResult aMapCalcRouteResult ) {
//
// }
//
// @Override
// public void onCalculateRouteFailure( AMapCalcRouteResult aMapCalcRouteResult ) {
//
// }
//
// @Override
// public void onNaviRouteNotify( AMapNaviRouteNotifyData aMapNaviRouteNotifyData ) {
//
// }
//
//
//}

View File

@@ -1,48 +0,0 @@
//package com.mogo.map.impl.custom.navi;
//
//import com.amap.api.navi.AimlessModeListener;
//import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo;
//import com.amap.api.navi.model.AimLessModeCongestionInfo;
//import com.amap.api.navi.model.AimLessModeStat;
//import com.mogo.map.impl.custom.utils.ObjectUtils;
//import com.mogo.map.navi.MogoCongestionInfo;
//import com.mogo.map.navi.MogoNaviListenerHandler;
//import com.mogo.map.navi.MogoTraffic;
//
///**
// * @author congtaowang
// * @since 2020-01-16
// * <p>
// * 巡航监听
// */
//public class AimlessModeListenerAdapter implements AimlessModeListener {
//
// @Override
// public void onUpdateTrafficFacility( AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos ) {
// MogoTraffic traffic = ObjectUtils.fromAMap( aMapNaviTrafficFacilityInfos );
// if ( traffic != null ) {
// MogoNaviListenerHandler.getInstance().onUpdateTraffic2( traffic );
// }
// }
//
// @Override
// public void onUpdateAimlessModeElecCameraInfo( AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos ) {
// MogoTraffic traffic = ObjectUtils.fromAMap( aMapNaviTrafficFacilityInfos );
// if ( traffic != null ) {
// MogoNaviListenerHandler.getInstance().onUpdateTraffic2( traffic );
// }
// }
//
// @Override
// public void updateAimlessModeStatistics( AimLessModeStat aimLessModeStat ) {
//
// }
//
// @Override
// public void updateAimlessModeCongestionInfo( AimLessModeCongestionInfo aimLessModeCongestionInfo ) {
// MogoCongestionInfo congestionInfo = ObjectUtils.fromAMap( aimLessModeCongestionInfo );
// if ( congestionInfo != null ) {
// MogoNaviListenerHandler.getInstance().onUpdateCongestion( congestionInfo );
// }
// }
//}

View File

@@ -1,181 +0,0 @@
//package com.mogo.map.impl.custom.navi;
//
//import android.content.Context;
//import android.text.TextUtils;
//
//import com.amap.api.maps.AMap;
//import com.amap.api.navi.model.AMapNaviPath;
//import com.amap.api.navi.model.AMapNaviStep;
//import com.amap.api.navi.model.NaviLatLng;
//import com.mogo.eagle.core.data.map.MogoLatLng;
//import com.mogo.map.impl.custom.overlay.RouteOverLayWrapper;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author congtaowang
// * @since 2019-12-04
// * <p>
// * 导航路径代理类
// */
//public class CalculatePathItem {
//
// private Context mContext;
// private AMap mAMap;
// private int mId;
// private AMapNaviPath mPath;
//
// private RouteOverLayWrapper mOverLazWrapper;
// private ArrayList< MogoLatLng > mPoints;
//
// public int getId() {
// return mId;
// }
//
// public AMapNaviPath getPath() {
// return mPath;
// }
//
// public RouteOverLayWrapper getOverLazWrapper( boolean createIfNull ) {
// if ( mOverLazWrapper == null && createIfNull ) {
// mOverLazWrapper = new RouteOverLayWrapper( mContext, mAMap, mPath );
// }
// return mOverLazWrapper;
// }
//
// public CalculatePathItem(Context context, AMap amap, int id, AMapNaviPath path ) {
// mContext = context;
// mAMap = amap;
// this.mId = id;
// this.mPath = path;
// }
//
// public String getStrategyName() {
// return mPath.getLabels();
// }
//
// public String getFormattedTime() {
// if ( mTimeBuilder == null ) {
// final int time = mPath.getAllTime();
// mTimeBuilder = new StringBuilder();
// fillFormatTime( time, mTimeBuilder );
// }
// 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 ) {
// // int days = seconds / ( 24 * 60 * 60 );
// // if ( days > 0 ) {
// // builder.append( days ).append( "天" );
// // }
// // seconds -= days * 24 * 60 * 60;
// int hours = seconds / ( 60 * 60 );
// if ( hours > 0 ) {
// builder.append( hours ).append( "小时" );
// }
// seconds -= hours * 60 * 60;
// int min = seconds / 60;
// builder.append( min > 1 ? min : 1 ).append( "分钟" );
// }
//
// private String mDistanceCacheStr = "";
//
// public String getFormattedDistance() {
// if ( TextUtils.isEmpty( mDistanceCacheStr ) ) {
// int distance = mPath.getAllLength();
// if ( distance == -1 ) {
// mDistanceCacheStr = "路程总程未获取";
// }
// if ( distance >= 1000 ) {
// mDistanceCacheStr = String.format( "%.1f公里", ( float ) distance / 1000 );
// } else {
// mDistanceCacheStr = distance + "米";
// }
// }
// return mDistanceCacheStr;
// }
//
// private StringBuilder mDescBuilder = null;
//
// public String getDesc() {
// if ( mDescBuilder == null ) {
// mDescBuilder = new StringBuilder();
// int lightsSize = getTrafficNumber();
// if ( lightsSize > 0 ) {
// mDescBuilder.append( "红绿灯" ).append( lightsSize ).append( "个" );
// }
// mDescBuilder.append( " " );
// mDescBuilder.append( "收费" ).append( mPath.getTollCost() ).append( "元" );
// }
//
// return mDescBuilder.toString();
// }
//
// public int getTrafficNumber() {
// int trafficLightNumber = 0;
// if ( mPath == null ) {
// return trafficLightNumber;
// }
// List<AMapNaviStep> steps = mPath.getSteps();
// for ( AMapNaviStep step : steps ) {
// trafficLightNumber += step.getTrafficLightNumber();
// }
// return trafficLightNumber;
// }
//
// public void release() {
// mContext = null;
// mAMap = null;
// mPath = null;
// if ( mOverLazWrapper != null ) {
// mOverLazWrapper.destroy();
// }
// mOverLazWrapper = null;
// if ( mPoints != null ) {
// mPoints.clear();
// }
// mPoints = null;
// }
//
// public List< MogoLatLng > getCoordList() {
// if ( mPoints == null ) {
// mPoints = new ArrayList<>();
// for ( NaviLatLng latlng : mPath.getCoordList() ) {
// MogoLatLng mogoLatLng = new MogoLatLng( latlng.getLatitude(), latlng.getLongitude() );
// mPoints.add( mogoLatLng );
// }
// }
// return mPoints;
// }
//
// public MogoLatLng getDriveStartPoint() {
// if ( mPath != null && mPath.getCoordList() != null && mPath.getCoordList().size() > 0 ) {
// NaviLatLng startPoint = mPath.getCoordList().get( 0 );
// if ( startPoint != null ) {
// return new MogoLatLng( startPoint.getLatitude(), startPoint.getLongitude() );
// }
// }
// return null;
// }
//
// public MogoLatLng getDriveEndPoint() {
// if ( mPath != null && mPath.getCoordList() != null && mPath.getCoordList().size() > 0 ) {
// NaviLatLng endPoint = mPath.getCoordList().get( mPath.getCoordList().size() - 1 );
// if ( endPoint != null ) {
// return new MogoLatLng( endPoint.getLatitude(), endPoint.getLongitude() );
// }
// }
// return null;
// }
//}

View File

@@ -1,296 +0,0 @@
//package com.mogo.map.impl.custom.navi;
//
//import android.content.Context;
//import android.graphics.Rect;
//import android.os.Trace;
//import android.text.TextUtils;
//
//import com.amap.api.maps.model.Polyline;
//import com.amap.api.navi.AMapNavi;
//import com.amap.api.navi.enums.CameraType;
//import com.amap.api.navi.enums.NaviType;
//import com.amap.api.navi.model.AMapCalcRouteResult;
//import com.amap.api.navi.model.AMapNaviCameraInfo;
//import com.amap.api.navi.model.AMapNaviLocation;
//import com.amap.api.navi.model.NaviInfo;
//import com.mogo.commons.voice.AIAssist;
//import com.mogo.eagle.core.data.map.MogoLatLng;
//import com.mogo.map.impl.custom.message.AMapMessageManager;
//import com.mogo.map.impl.custom.utils.ObjectUtils;
//import com.mogo.map.navi.MogoCalculatePath;
//import com.mogo.map.navi.MogoNaviListenerHandler;
//import com.mogo.map.navi.MogoTraffic;
//import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
//import com.mogo.utils.UiThreadHandler;
//import com.mogo.utils.logger.Logger;
//
//import java.util.List;
//
///**
// * @author congtaowang
// * @since 2019-12-25
// * <p>
// * 自研导航回调
// */
//public class NaviListenerAdapter extends AMapNaviListenerAdapter {
//
// private static final String TAG = "NaviListenerAdapter";
//
// private Context mContext;
// private AMapNavi mAMapNavi;
// private NaviClient mClient;
// /**
// * 导航状态true - 导航 onStartNavi(int) 被调用, false - 到达目的地、手动挺固执
// */
// private boolean mIsNaviing = false;
//
// /**
// * 导航是否被停止true - 手动停止或到达目的地、false - 规划路径成功、开启导航
// */
// private boolean mIsStopped = true;
//
// /**
// * 路线规划
// */
// private NaviOverlayHelper mNaviOverlayHelper;
//
// public NaviListenerAdapter( Context mContext, AMapNavi mAMapNavi, NaviClient client ) {
// this.mContext = mContext;
// this.mAMapNavi = mAMapNavi;
// this.mClient = client;
//// mNaviOverlayHelper = new NaviOverlayHelper( mAMapNavi, AMapWrapper.getAMap(), mContext );
// }
//
// public void setNaviing( boolean mIsNaviing ) {
// this.mIsNaviing = mIsNaviing;
// }
//
// public boolean isNaviing() {
// return mIsNaviing;
// }
//
// public void setStopped( boolean isStopped ) {
// this.mIsStopped = isStopped;
// }
//
// public boolean isStopped() {
// return mIsStopped;
// }
//
// public Context getContext() {
// return mContext;
// }
//
// @Override
// public void onInitNaviFailure() {
// MogoNaviListenerHandler.getInstance().onInitNaviFailure();
// }
//
// @Override
// public void onInitNaviSuccess() {
// MogoNaviListenerHandler.getInstance().onInitNaviSuccess();
// NaviClient.getInstance( mContext ).startAimlessMode();
// }
//
// @Override
// public void updateCameraInfo( AMapNaviCameraInfo[] aMapNaviCameraInfos ) {
// super.updateCameraInfo( aMapNaviCameraInfos );
// if ( aMapNaviCameraInfos == null || aMapNaviCameraInfos.length == 0 ) {
// return;
// }
// int limitSpeed = 0;
// for ( AMapNaviCameraInfo aMapNaviCameraInfo : aMapNaviCameraInfos ) {
// if ( aMapNaviCameraInfo == null ) {
// continue;
// }
// limitSpeed = aMapNaviCameraInfo.getCameraSpeed();
// if ( limitSpeed > 0 && aMapNaviCameraInfo.getCameraType() == CameraType.SPEED ) {
// MogoTraffic traffic = new MogoTraffic( MogoTraffic.TYPE_NAVI );
// traffic.setDistance( aMapNaviCameraInfo.getCameraDistance() );
// traffic.setSpeedLimit( aMapNaviCameraInfo.getCameraSpeed() );
// MogoNaviListenerHandler.getInstance().onUpdateTraffic2( traffic );
// }
//
//// switch ( aMapNaviCameraInfo.getCameraType() ) {
//// case CameraType.SPEED:
////
//// break;
//// case CameraType.SURVEILLANCE:
//// traffic.setDesc( "监控摄像" );
//// break;
//// case CameraType.TRAFFICLIGHT:
//// traffic.setDesc( "闯红灯拍照" );
//// break;
//// case CameraType.BREAKRULE:
//// traffic.setDesc( "违章拍照" );
//// break;
//// case CameraType.BUSWAY:
//// traffic.setDesc( "公交专用道摄像头" );
//// break;
//// case CameraType.EMERGENCY:
//// traffic.setDesc( "应急车道拍照" );
//// break;
//// case CameraType.BICYCLE:
//// traffic.setDesc( "非机动车道" );
//// break;
//// case CameraType.INTERVALVELOCITYSTART:
//// traffic.setDesc( "区间测速起始" );
//// break;
//// case CameraType.INTERVALVELOCITYEND:
//// traffic.setDesc( "区间测速解除" );
//// break;
//// }
// }
// if ( limitSpeed <= 0 ) {
// MogoTraffic traffic = new MogoTraffic( MogoTraffic.TYPE_NAVI );
// traffic.setDistance( 0 );
// traffic.setSpeedLimit( 0 );
// MogoNaviListenerHandler.getInstance().onUpdateTraffic2( traffic );
// }
// }
//
// @Override
// public void onStartNavi( int type ) {
//
// Logger.d( TAG, "onStartNavi type = %s", type );
// // 巡航
// if ( type != NaviType.CRUISE ) {
// setStopped( false );
// setNaviing( true );
// MogoNaviListenerHandler.getInstance().onStartNavi();
// AMapMessageManager.getInstance().postNaviStarted();
// }
// }
//
// @Override
// public void onEndEmulatorNavi() {
// stopNaviDelay( () -> {
// MogoNaviListenerHandler.getInstance().onEndEmulatorNavi();
// } );
// }
//
// @Override
// public void onArriveDestination() {
// stopNaviDelay( () -> {
// MogoNaviListenerHandler.getInstance().onArriveDestination();
// } );
// }
//
// /**
// * 避免导航结束语音播报被立刻打断的情况
// *
// * @param after 停止后的行为
// */
// private void stopNaviDelay( Runnable after ) {
// UiThreadHandler.postDelayed( () -> {
// if ( TextUtils.isEmpty( mLastSpeakWord ) || !mLastSpeakWord.contains( "结束" ) ) {
// AIAssist.getInstance( mContext ).speakTTSVoice( "到达目的地附近,本次导航结束" );
// }
// mLastSpeakWord = "";
// stopNavi();
// if ( after != null ) {
// after.run();
// }
// }, 5_000L );
// }
//
// @Override
// public void onNaviInfoUpdate( NaviInfo naviInfo ) {
// Trace.beginSection( "NaviListenerAdapter.onNaviInfoUpdate" );
// MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( ObjectUtils.fromAMap( mContext, naviInfo ) );
// mNaviOverlayHelper.handleNaviInfoUpdate( naviInfo );
// Trace.endSection();
// }
//
// @Override
// public void onCalculateRouteFailure( AMapCalcRouteResult aMapCalcRouteResult ) {
// if ( aMapCalcRouteResult != null ) {
// Logger.i( TAG, PathPlanningErrorCodeConstants.getErrorMsg( aMapCalcRouteResult.getErrorCode() ) );
// }
// MogoNaviListenerHandler.getInstance().onoCalculateFailed();
// }
//
// @Override
// public void onCalculateRouteSuccess( AMapCalcRouteResult aMapCalcRouteResult ) {
// super.onCalculateRouteSuccess( aMapCalcRouteResult );
// Logger.i( TAG, "导航规划成功" );
// setStopped( false );
// mNaviOverlayHelper.showCalculatedPaths( () -> {
// AMapMessageManager.getInstance().postCalculateSuccess();
// MogoNaviListenerHandler.getInstance().onCalculateSuccess();
// } );
// }
//
// @Override
// public void onLocationChange( AMapNaviLocation aMapNaviLocation ) {
// Trace.beginSection( "NaviListenerAdapter.onLocationChange" );
// super.onLocationChange( aMapNaviLocation );
//// mNaviOverlayHelper.handlePassedLocation( aMapNaviLocation );
// Trace.endSection();
// }
//
// public void stopNavi() {
// TTSSpeaker.getInstance().shutUp();
// mNaviOverlayHelper.clearCalculatedOverlay();
// setStopped( true );
// setNaviing( false );
// mAMapNavi.stopNavi();
// MogoNaviListenerHandler.getInstance().onStopNavi();
// AMapMessageManager.getInstance().postNaviStopped();
// }
//
// public void handleClickedPolyline( Polyline polyline ) {
// if ( mNaviOverlayHelper != null ) {
//
// mNaviOverlayHelper.handleClickedPolyline( polyline, isNaviing() );
// mAMapNavi.selectRouteId( mNaviOverlayHelper.getSelectedPathId() );
// mNaviOverlayHelper.showBoundsWithSettingBounds();
// }
// }
//
// public List< MogoCalculatePath > getCalculateStrategies() {
// if ( mNaviOverlayHelper != null ) {
// return mNaviOverlayHelper.getCalculateStrategies();
// }
// return null;
// }
//
// public List< MogoLatLng > getCalculatedPathPos() {
// if ( mNaviOverlayHelper != null ) {
// return mNaviOverlayHelper.getCalculatedPathPos();
// }
// return null;
// }
//
//
// public OnCalculatePathItemClickInteraction getItemClickInteraction() {
// if ( mNaviOverlayHelper != null ) {
// return mNaviOverlayHelper.getItemClickInteraction();
// }
// return null;
// }
//
// public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
// if ( mNaviOverlayHelper != null ) {
// mNaviOverlayHelper.setLineClickInteraction( lineClickInteraction );
// }
// }
//
// public void clearCalculatePaths() {
// if ( mNaviOverlayHelper != null ) {
// mNaviOverlayHelper.clearCalculatedOverlay();
// }
// }
//
// public void setCalculatePathDisplayBounds( Rect bounds ) {
// if ( mNaviOverlayHelper != null ) {
// mNaviOverlayHelper.setCalculatePathDisplayBounds( bounds );
// }
// }
//
// public void displayOverview( Rect bounds ) {
// if ( mNaviOverlayHelper != null ) {
// mNaviOverlayHelper.displayOverview( bounds );
// }
// }
//}

View File

@@ -1,461 +0,0 @@
//package com.mogo.map.impl.custom.navi;
//
//import android.content.Context;
//import android.graphics.Bitmap;
//import android.graphics.BitmapFactory;
//import android.graphics.Rect;
//import android.text.TextUtils;
//
//import com.amap.api.maps.AMap;
//import com.amap.api.maps.CameraUpdateFactory;
//import com.amap.api.maps.model.BitmapDescriptorFactory;
//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.Polyline;
//import com.amap.api.navi.AMapNavi;
//import com.amap.api.navi.model.AMapNaviLocation;
//import com.amap.api.navi.model.AMapNaviPath;
//import com.amap.api.navi.model.NaviInfo;
//import com.amap.api.navi.model.NaviLatLng;
//import com.mogo.eagle.core.data.map.MogoLatLng;
//import com.mogo.map.impl.custom.R;
//import com.mogo.map.impl.custom.overlay.RouteOverLayWrapper;
//import com.mogo.map.marker.MogoMarkersHandler;
//import com.mogo.map.navi.MogoCalculatePath;
//import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
//import com.mogo.utils.WindowUtils;
//import com.mogo.utils.logger.Logger;
//
//import java.util.ArrayList;
//import java.util.Comparator;
//import java.util.List;
//import java.util.Map;
//import java.util.TreeMap;
//
///**
// * @author congtaowang
// * @since 2019-12-27
// * <p>
// * 导航路径管理
// */
//public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
//
// private static final String TAG = "NaviOverlayHelper";
//
// /**
// * 选中的路径透明度
// */
// public static final float AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED = 1f;
//
// /**
// * 未选中的路径透明度
// */
// public static final float AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED = 0.3f;
//
// private AMapNavi mAMapNavi;
// private AMap mAMap;
// private Context mContext;
// // 规划的路线显示边距
// private Rect mBoundRect = null;
//
// private List< CalculatePathItem > mCalculatePathItems;
// private List< MogoCalculatePath > mPaths = new ArrayList<>();
//
// private int mSelectedPathId;
// private CalculatePathItem mSelectedCalculatePathItem;
// private OnCalculatePathItemClickInteraction mLineClickInteraction;
//
// /**
// * 起点终点marker
// */
// private List< Marker > mMarkers = new ArrayList<>();
//
// public NaviOverlayHelper( AMapNavi mAMapNavi, AMap mAMap, Context mContext ) {
// this.mAMapNavi = mAMapNavi;
// this.mAMap = mAMap;
// this.mContext = mContext;
// calculateBoundArea();
// }
//
// /**
// * 显示规划的路径
// */
// public void showCalculatedPaths( Runnable after ) {
// clearCalculatedOverlay();
// mCalculatePathItems = getSortedPaths();
// if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) {
// return;
// }
// showPathsBound( getBounds(), () -> {
// addEndPoints();
// renderPathOverlay( mCalculatePathItems );
// if ( after != null ) {
// after.run();
// }
// }, mBoundRect );
// }
//
// private LatLngBounds getBounds() {
// if ( mCalculatePathItems == null ) {
// return null;
// }
// LatLngBounds.Builder builder = new LatLngBounds.Builder();
// for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
// if ( calculatePathItem == null ) {
// continue;
// }
// try {
// LatLngBounds bounds = calculatePathItem.getPath().getBoundsForPath();
// builder.include( bounds.northeast );
// builder.include( bounds.southwest );
// } catch ( Exception e ) {
// e.printStackTrace();
// }
// }
// return builder.build();
// }
//
// /**
// * 按pathId升序排序
// *
// * @return 排序好的路径规划列表
// */
// private List< CalculatePathItem > getSortedPaths() {
// checkAMapInstance();
// final Map< Integer, AMapNaviPath > pathMap = mAMapNavi.getNaviPaths();
// if ( pathMap == null || pathMap.isEmpty() ) {
// return null;
// }
// TreeMap< Integer, AMapNaviPath > sortedMap =
// new TreeMap< Integer, AMapNaviPath >( new Comparator< Integer >() {
// @Override
// public int compare( Integer obj1, Integer obj2 ) {
// if ( obj1 != null ) {
// return obj1.compareTo( obj2 );
// }
// if ( obj2 != null ) {
// return obj2.compareTo( obj1 );
// }
// return 0;
// }
// } );
// sortedMap.putAll( pathMap );
//
// final List< CalculatePathItem > items = new ArrayList<>();
// for ( Map.Entry< Integer, AMapNaviPath > entry : sortedMap.entrySet() ) {
// if ( entry == null || entry.getKey() == null || entry.getValue() == null ) {
// continue;
// }
// items.add( new CalculatePathItem( mContext, mAMap, entry.getKey(), entry.getValue() ) );
// }
// return items;
// }
//
// private void calculateBoundArea() {
// if ( mBoundRect == null ) {
// mBoundRect = new Rect();
// final int padding = WindowUtils.dip2px( mContext, 80 );
// mBoundRect.left = padding;
// mBoundRect.right = padding;
// mBoundRect.top = padding;
// mBoundRect.bottom = padding;
// }
// }
//
// public void showBoundsWithSettingBounds() {
// showBounds( mBoundRect );
// }
//
// public void showBounds( Rect bounds ) {
// Logger.d( TAG, "showBounds" );
// showPathsBound( getBounds(), null, bounds );
// }
//
// /**
// * 将规划好的路径显示在视野内
// */
// private void showPathsBound( LatLngBounds bounds, Runnable after, Rect rect ) {
// if ( bounds == null ) {
// return;
// }
// if ( rect == null ) {
// rect = new Rect();
// }
// checkAMapInstance();
// mAMap.moveCamera( CameraUpdateFactory.newLatLngBoundsRect(
// bounds,
// rect.left,
// rect.right,
// rect.top,
// rect.bottom ) );
// if ( after != null ) {
// after.run();
// }
// }
//
// private void checkAMapInstance() {
// if ( mAMap == null ) {
//// mAMap = AMapWrapper.getAMap();
// }
// }
//
// public void renderPathOverlay( List< CalculatePathItem > paths ) {
// if ( paths == null || paths.size() == 0 ) {
// return;
// }
// for ( int i = 0; i < paths.size(); i++ ) {
// final CalculatePathItem item = paths.get( i );
// if ( item == null || item.getPath() == null ) {
// continue;
// }
// RouteOverLayWrapper wrapper = item.getOverLazWrapper( true );
// wrapper.setTrafficLightsVisible( false );
// // 默认选中第一个
// if ( i == 0 ) {
// mSelectedPathId = item.getId();
// mSelectedCalculatePathItem = item;
// //wrapper.setStartBitmap( R.drawable.ic_navi_start )
// // .setEndBitmap( R.drawable.ic_navi_target );
// mAMapNavi.selectRouteId( item.getId() );
// Logger.d( TAG, "renderPathOverlay set default path" );
// }
// wrapper.addToMap();
// wrapper.setTransparency( i == 0 ? AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED : AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED );
// }
// }
//
// public void addEndPoints() {
// if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) {
// return;
// }
//
// Bitmap bitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_endpoint );
// Bitmap startBitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_navi_start );
// Bitmap endBitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_navi_target );
// MarkerOptions options = new MarkerOptions().icon( BitmapDescriptorFactory.fromBitmap( bitmap ) ).zIndex( 0 ).anchor( 0.5f, 0.5f );
// MarkerOptions startOptions = new MarkerOptions().icon( BitmapDescriptorFactory.fromBitmap( startBitmap ) ).zIndex( 0 ).anchor( 0.5f, 1 );
// MarkerOptions endOptions = new MarkerOptions().icon( BitmapDescriptorFactory.fromBitmap( endBitmap ) ).zIndex( 0 ).anchor( 0.5f, 1 );
// for ( CalculatePathItem path : mCalculatePathItems ) {
// List< MogoLatLng > points = path.getCoordList();
// if ( points == null || points.isEmpty() ) {
// continue;
// }
// MogoLatLng startPoint = path.getDriveStartPoint();
// MogoLatLng endPoint = path.getDriveEndPoint();
// if ( startPoint == null || endPoint == null ) {
// continue;
// }
// mMarkers.add( mAMap.addMarker( options.position( new LatLng( startPoint.lat, startPoint.lng ) ) ) );
// mMarkers.add( mAMap.addMarker( options.position( new LatLng( endPoint.lat, endPoint.lng ) ) ) );
// mMarkers.add( mAMap.addMarker( startOptions.position( new LatLng( startPoint.lat, startPoint.lng ) ) ) );
// mMarkers.add( mAMap.addMarker( endOptions.position( new LatLng( endPoint.lat, endPoint.lng ) ) ) );
//
// break;
// }
// }
//
// public void clearCalculatedOverlay() {
// if ( mCalculatePathItems != null && !mCalculatePathItems.isEmpty() ) {
// for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
// if ( calculatePathItem == null ) {
// continue;
// }
// RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper( false );
// if ( wrapper != null ) {
// wrapper.destroy();
// }
// calculatePathItem.release();
// }
// mCalculatePathItems.clear();
// }
// if ( mPaths != null ) {
// mPaths.clear();
// }
// if ( !mMarkers.isEmpty() ) {
// for ( Marker mMarker : mMarkers ) {
// if ( mMarker == null ) {
// continue;
// }
// try {
// mMarker.remove();
// mMarker.destroy();
// } catch ( Exception e ) {
//
// }
// }
// }
// MogoMarkersHandler.getInstance().remove( TAG );
// }
//
// /**
// * 是否切换成功
// *
// * @param polyline 选中的线
// */
// public boolean handleClickedPolyline( Polyline polyline, boolean isNaviing ) {
// if ( polyline == null ) {
// return false;
// }
// if ( mPaths != null && !mPaths.isEmpty() ) {
// for ( MogoCalculatePath path : mPaths ) {
// if ( TextUtils.equals( path.getTagId(), polyline.getId() ) ) {
// if ( mLineClickInteraction != null ) {
// mLineClickInteraction.onItemClicked( path.getTagId() );
// break;
// }
// }
// }
// }
// return handleClickedPolyline( polyline.getId() );
// }
//
// private boolean handleClickedPolyline( String id ) {
// if ( id == null ) {
// return false;
// }
// Logger.i( TAG, "polyline id = " + id );
// mSelectedCalculatePathItem = isCalculatePolyline( id );
// if ( mSelectedCalculatePathItem == null ) {
// return false;
// }
// mSelectedPathId = mSelectedCalculatePathItem.getId();
// if ( mCalculatePathItems != null ) {
// for ( CalculatePathItem item : mCalculatePathItems ) {
// final RouteOverLayWrapper wrapper = item.getOverLazWrapper( false );
// if ( wrapper == null ) {
// continue;
// }
// wrapper.setTransparency(
// item == mSelectedCalculatePathItem
// ? AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED
// : AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED
// );
// }
// }
// return true;
// }
//
// private CalculatePathItem isCalculatePolyline( String id ) {
// CalculatePathItem result = null;
// if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) {
// return result;
// }
// for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
// if ( calculatePathItem == null ) {
// continue;
// }
// final RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper( false );
// if ( wrapper == null ) {
// continue;
// }
// if ( wrapper.getTrafficColorfulPolyline() == null ) {
// continue;
// }
// if ( TextUtils.equals( wrapper.getTrafficColorfulPolyline().getId(), id ) ) {
// result = calculatePathItem;
// }
// }
// return result;
// }
//
// public int getSelectedPathId() {
// return mSelectedPathId;
// }
//
// /**
// * 车辆拐弯时绘制转向箭头
// */
// public void handleNaviInfoUpdate( NaviInfo naviInfo ) {
// if ( mSelectedCalculatePathItem != null ) {
// RouteOverLayWrapper wrapper = mSelectedCalculatePathItem.getOverLazWrapper( false );
// if ( wrapper != null ) {
// wrapper.drawArrow( naviInfo );
// }
// }
// }
//
// public void handlePassedLocation( AMapNaviLocation location ) {
// if ( mSelectedCalculatePathItem != null ) {
// RouteOverLayWrapper wrapper = mSelectedCalculatePathItem.getOverLazWrapper( false );
// if ( wrapper != null ) {
// wrapper.updatePolyline( location );
// }
// }
// }
//
// public List< MogoCalculatePath > getCalculateStrategies() {
// if ( mCalculatePathItems != null && !mCalculatePathItems.isEmpty() ) {
// for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
// MogoCalculatePath path = new MogoCalculatePath();
// 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
// ) {
// MogoLatLng mogoLatLng =
// new MogoLatLng( latlng.getLatitude(), latlng.getLongitude() );
// mogoLatLngs.add( mogoLatLng );
// }
// path.setCoordList( mogoLatLngs );
// path.setTrafficLights( calculatePathItem.getTrafficNumber() );
// mPaths.add( path );
// final RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper( true );
// if ( wrapper == null ) {
// continue;
// }
// if ( wrapper.getTrafficColorfulPolyline() == null ) {
// continue;
// }
// path.setTagId( wrapper.getTrafficColorfulPolyline().getId() );
// }
// }
//
// return mPaths;
// }
//
// public List< MogoLatLng > getCalculatedPathPos() {
//
// if ( mSelectedCalculatePathItem != null ) {
// return mSelectedCalculatePathItem.getCoordList();
// }
// //if (mPaths != null && !mPaths.isEmpty()) {
// // return mPaths.get(0).getCoordList();
// //}
// return null;
// }
//
// @Override
// public void onItemClicked( String tagId ) {
// handleClickedPolyline( tagId );
// mAMapNavi.selectRouteId( getSelectedPathId() );
// showBounds( mBoundRect );
// }
//
// public OnCalculatePathItemClickInteraction getItemClickInteraction() {
// return this;
// }
//
// public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
// mLineClickInteraction = lineClickInteraction;
// }
//
// public void setCalculatePathDisplayBounds( Rect bounds ) {
// if ( bounds != null ) {
// mBoundRect = bounds;
// }
// }
//
// /**
// * 展示全程
// */
// public void displayOverview( Rect bounds ) {
// showBounds( bounds );
// }
//}

View File

@@ -1,92 +0,0 @@
//package com.mogo.map.impl.custom.navi;
//
//import com.amap.api.navi.enums.PathPlanningErrCode;
//
///**
// * @author congtaowang
// * @since 2019-10-18
// * <p>
// * 描述
// */
//public enum PathPlanningErrorCodeConstants {
//
// NONE( -1, "路线规划错误,请重试" ),
//
// ACCESS_TOO_FREQUENT( PathPlanningErrCode.ACCESS_TOO_FREQUENT, "访问过于频繁,请稍后再试" ),
//
// DISABLE_RESTRICT( PathPlanningErrCode.DISABLE_RESTRICT, "无法躲避限行区域,请重新规划" ),
//
// ERROR_BUF( PathPlanningErrCode.ERROR_BUF, "Buf数据格式错误" ),
//
// ERROR_CONNECTION( PathPlanningErrCode.ERROR_CONNECTION, "网络超时或网络失败。" ),
//
// ERROR_DISTANCE( PathPlanningErrCode.ERROR_DISTANCE, "起点/终点/途经点的距离太长(步行距离>100km骑行距离>1200km)" ),
//
// ERROR_ENCODER( PathPlanningErrCode.ERROR_ENCODER, "算路服务端编码失败" ),
//
// ERROR_ENDPOINT( PathPlanningErrCode.ERROR_ENDPOINT, "终点错误" ),
//
// ERROR_NAVI_PARAMS( PathPlanningErrCode.ERROR_NAVI_PARAMS, "调用直接导航 没有算路 参数错误,缺失有效的导航路径,无法开始导航" ),
//
// ERROR_NOROADFORENDPOINT( PathPlanningErrCode.ERROR_NOROADFORENDPOINT, "终点没有找到道路" ),
//
// ERROR_NOROADFORSTARTPOINT( PathPlanningErrCode.ERROR_NOROADFORSTARTPOINT, "起点没有找到道路。" ),
//
// ERROR_NOROADFORWAYPOINT( PathPlanningErrCode.ERROR_NOROADFORWAYPOINT, "途径点没有找到道路" ),
//
// ERROR_PREVIEW( PathPlanningErrCode.ERROR_PREVIEW, "路径数据缺乏预览数据" ),
//
// ERROR_PROTOCOL( PathPlanningErrCode.ERROR_PROTOCOL, "请求协议非法。" ),
//
// ERROR_STARTPOINT( PathPlanningErrCode.ERROR_STARTPOINT, "起点错误" ),
//
// ERROR_WAYPOINT( PathPlanningErrCode.ERROR_WAYPOINT, "途经点错误" ),
//
// INSUFFICIENT_PRIVILEGES( PathPlanningErrCode.INSUFFICIENT_PRIVILEGES, "无权限访问此服务。" ),
//
// INVALID_PARAMS( PathPlanningErrCode.INVALID_PARAMS, "请求参数非法。" ),
//
// INVALID_USER_KEY( PathPlanningErrCode.INVALID_USER_KEY, "用户key非法或过期请检查key是否正确" ),
//
// INVALID_USER_SCODE( PathPlanningErrCode.INVALID_USER_SCODE, "MD5安全码未通过验证,需要开发者判定key绑定的SHA1,package是否与sdk包里的一致." ),
//
// OUT_OF_SERVICE( PathPlanningErrCode.OUT_OF_SERVICE, "使用路径规划服务接口时可能出现该问题,规划点(包括起点、终点、途经点)不在中国陆地范围内" ),
//
// OVER_DIRECTION_RANGE( PathPlanningErrCode.OVER_DIRECTION_RANGE, "使用路径规划服务接口时可能出现该问题,路线计算失败,通常是由于道路起点和终点距离过长导致" ),
//
// OVER_QUOTA( PathPlanningErrCode.OVER_QUOTA, "请求超出配额。" ),
//
// SERVICE_NOT_EXIST( PathPlanningErrCode.SERVICE_NOT_EXIST, "请求服务不存在。" ),
//
// SERVICE_RESPONSE_ERROR( PathPlanningErrCode.SERVICE_RESPONSE_ERROR, "请求服务响应错误。" ),
//
// UNKNOWN_ERROR( PathPlanningErrCode.UNKNOWN_ERROR, "未知错误(可能是由于连接的网络无法访问外网)" ),
//
// USERKEY_PLAT_NOMATCH( PathPlanningErrCode.USERKEY_PLAT_NOMATCH, "请求中使用的key与绑定平台不符例如开发者申请的是js api的key却用来调web服务接口" );
//
// private int code;
// private String errorMsg;
//
// PathPlanningErrorCodeConstants( int code, String errorMsg ) {
// this.code = code;
// this.errorMsg = errorMsg;
// }
//
// public int getCode() {
// return code;
// }
//
// public String getErrorMsg() {
// return errorMsg;
// }
//
// public static String getErrorMsg( int code ) {
// for ( PathPlanningErrorCodeConstants value : PathPlanningErrorCodeConstants.values() ) {
// if ( value.getCode() == code ) {
// return value.getErrorMsg();
// }
// }
// return NONE.getErrorMsg();
// }
//
//}

View File

@@ -1,120 +0,0 @@
//package com.mogo.map.impl.custom.navi;
//
//import android.text.TextUtils;
//
//import com.mogo.commons.AbsMogoApplication;
//import com.mogo.commons.voice.AIAssist;
//import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
//
//import java.util.LinkedList;
//
///**
// * @author congtaowang
// * @since 2020-04-21
// * <p>
// * 播报导航TTS
// * <p>
// * 策略:队列缓存预播报的 tts然后上一句播完后
// */
//public class TTSSpeaker implements IMogoVoiceCmdCallBack {
//
// private static volatile TTSSpeaker sInstance;
//
// private TTSSpeaker() {
// }
//
// public static TTSSpeaker getInstance() {
// if ( sInstance == null ) {
// synchronized ( TTSSpeaker.class ) {
// if ( sInstance == null ) {
// sInstance = new TTSSpeaker();
// }
// }
// }
// return sInstance;
// }
//
// public synchronized void release() {
// sInstance = null;
// }
//
// private LinkedList< String > mWaiting = new LinkedList<>();
//
// private String mLastTts = null;
// private String mLastTtsId = null;
//
// public synchronized void speakTTS( String tts ) {
// if ( TextUtils.isEmpty( tts ) ) {
// return;
// }
// mWaiting.add( tts );
// peekAndSpeak();
// }
//
// public synchronized void shutUp() {
// if ( mLastTtsId != null ) {
// AIAssist.getInstance( AbsMogoApplication.getApp() ).shutUp( mLastTtsId, mLastTts );
// mWaiting.clear();
// mLastTtsId = null;
// mLastTts = null;
// }
// }
//
// @Override
// public void onCmdSelected( String cmd ) {
//
// }
//
// @Override
// public void onCmdAction( String speakText ) {
//
// }
//
// @Override
// public void onCmdCancel( String speakText ) {
//
// }
//
// @Override
// public void onSpeakEnd( String speakText ) {
//
// }
//
// @Override
// public void onSpeakSelectTimeOut( String speakText ) {
//
// }
//
// @Override
// public void onTTSStart( String ttsId, String tts ) {
// if ( TextUtils.equals( mLastTts, tts ) ) {
// mLastTtsId = ttsId;
// }
// }
//
// @Override
// public void onTTSEnd( String ttsId, String tts ) {
// mLastTtsId = null;
// peekAndSpeak();
// }
//
// @Override
// public void onTTSError( String ttsId, String tts ) {
// mLastTtsId = null;
// peekAndSpeak();
// }
//
// private synchronized void peekAndSpeak() {
// if ( mWaiting.isEmpty() ) {
// mLastTts = null;
// mLastTtsId = null;
// return;
// }
// if ( mLastTtsId != null ) {
// // 上一句还没有播完
// return;
// }
// mLastTts = mWaiting.pop();
// AIAssist.getInstance( AbsMogoApplication.getApp() ).speakTTSAndDuck( mLastTts, this );
// }
//}

View File

@@ -1,261 +0,0 @@
package com.mogo.map.impl.custom.overlay;
import android.text.Html;
import android.text.Spanned;
import android.widget.EditText;
import com.mogo.map.impl.custom.R;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class AMapUtil {
/**
* 判断edittext是否null
*/
public static String checkEditText(EditText editText) {
if (editText != null && editText.getText() != null
&& !(editText.getText().toString().trim().equals(""))) {
return editText.getText().toString().trim();
} else {
return "";
}
}
public static Spanned stringToSpan(String src) {
return src == null ? null : Html.fromHtml(src.replace("\n", "<br />"));
}
public static String colorFont(String src, String color) {
StringBuffer strBuf = new StringBuffer();
strBuf.append("<font color=").append(color).append(">").append(src)
.append("</font>");
return strBuf.toString();
}
public static String makeHtmlNewLine() {
return "<br />";
}
public static String makeHtmlSpace(int number) {
final String space = "&nbsp;";
StringBuilder result = new StringBuilder();
for (int i = 0; i < number; i++) {
result.append(space);
}
return result.toString();
}
public static String getFriendlyLength(int lenMeter) {
if (lenMeter > 10000) // 10 km
{
int dis = lenMeter / 1000;
return dis + ChString.Kilometer;
}
if (lenMeter > 1000) {
float dis = (float) lenMeter / 1000;
DecimalFormat fnum = new DecimalFormat("##0.0");
String dstr = fnum.format(dis);
return dstr + ChString.Kilometer;
}
if (lenMeter > 100) {
int dis = lenMeter / 50 * 50;
return dis + ChString.Meter;
}
int dis = lenMeter / 10 * 10;
if (dis == 0) {
dis = 10;
}
return dis + ChString.Meter;
}
public static boolean IsEmptyOrNullString(String s) {
return (s == null) || (s.trim().length() == 0);
}
/**
* 把LatLng对象转化为LatLonPoint对象
*/
// public static LonLatPoint convertToLatLonPoint(LatLng latlon) {
// return new LonLatPoint(latlon.latitude, latlon.longitude);
// }
/**
* 把LatLonPoint对象转化为LatLon对象
*/
// public static LatLng convertToLatLng(LatLonPoint latLonPoint) {
// return new LatLng(latLonPoint.getLatitude(), latLonPoint.getLongitude());
// }
/**
* 把集合体的LatLonPoint转化为集合体的LatLng
*/
// public static ArrayList<LatLng> convertArrList(List<LatLonPoint> shapes) {
// ArrayList<LatLng> lineShapes = new ArrayList<LatLng>();
// for (LatLonPoint point : shapes) {
// LatLng latLngTemp = AMapUtil.convertToLatLng(point);
// lineShapes.add(latLngTemp);
// }
// return lineShapes;
// }
/**
* long类型时间格式化
*/
public static String convertToTime(long time) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date(time);
return df.format(date);
}
public static final String HtmlBlack = "#000000";
public static final String HtmlGray = "#808080";
public static String getFriendlyTime(int second) {
if (second > 3600) {
int hour = second / 3600;
int miniate = (second % 3600) / 60;
return hour + "小时" + miniate + "分钟";
}
if (second >= 60) {
int miniate = second / 60;
return miniate + "分钟";
}
return second + "";
}
//路径规划方向指示和图片对应
public static int getDriveActionID(String actionName) {
if (actionName == null || actionName.equals("")) {
return R.drawable.dir3;
}
if ("左转".equals(actionName)) {
return R.drawable.dir2;
}
if ("右转".equals(actionName)) {
return R.drawable.dir1;
}
if ("向左前方行驶".equals(actionName) || "靠左".equals(actionName)) {
return R.drawable.dir6;
}
if ("向右前方行驶".equals(actionName) || "靠右".equals(actionName)) {
return R.drawable.dir5;
}
if ("向左后方行驶".equals(actionName) || "左转调头".equals(actionName)) {
return R.drawable.dir7;
}
if ("向右后方行驶".equals(actionName)) {
return R.drawable.dir8;
}
if ("直行".equals(actionName)) {
return R.drawable.dir3;
}
if ("减速行驶".equals(actionName)) {
return R.drawable.dir4;
}
return R.drawable.dir3;
}
public static int getWalkActionID(String actionName) {
if (actionName == null || actionName.equals("")) {
return R.drawable.dir13;
}
if ("左转".equals(actionName)) {
return R.drawable.dir2;
}
if ("右转".equals(actionName)) {
return R.drawable.dir1;
}
if ("向左前方".equals(actionName) || "靠左".equals(actionName) || actionName.contains("向左前方")) {
return R.drawable.dir6;
}
if ("向右前方".equals(actionName) || "靠右".equals(actionName) || actionName.contains("向右前方")) {
return R.drawable.dir5;
}
if ("向左后方".equals(actionName) || actionName.contains("向左后方")) {
return R.drawable.dir7;
}
if ("向右后方".equals(actionName) || actionName.contains("向右后方")) {
return R.drawable.dir8;
}
if ("直行".equals(actionName)) {
return R.drawable.dir3;
}
if ("通过人行横道".equals(actionName)) {
return R.drawable.dir9;
}
if ("通过过街天桥".equals(actionName)) {
return R.drawable.dir11;
}
if ("通过地下通道".equals(actionName)) {
return R.drawable.dir10;
}
return R.drawable.dir13;
}
// public static String getBusPathTitle(BusPath busPath) {
// if (busPath == null) {
// return String.valueOf("");
// }
// List<BusStep> busSetps = busPath.getSteps();
// if (busSetps == null) {
// return String.valueOf("");
// }
// StringBuffer sb = new StringBuffer();
// for (BusStep busStep : busSetps) {
// StringBuffer title = new StringBuffer();
// if (busStep.getBusLines().size() > 0) {
// for (RouteBusLineItem busline : busStep.getBusLines()) {
// if (busline == null) {
// continue;
// }
//
// String buslineName = getSimpleBusLineName(busline.getBusLineName());
// title.append(buslineName);
// title.append(" / ");
// }
//// RouteBusLineItem busline = busStep.getBusLines().get(0);
//
// sb.append(title.substring(0, title.length() - 3));
// sb.append(" > ");
// }
// if (busStep.getRailway() != null) {
// RouteRailwayItem railway = busStep.getRailway();
// sb.append(railway.getTrip() + "(" + railway.getDeparturestop().getName()
// + " - " + railway.getArrivalstop().getName() + ")");
// sb.append(" > ");
// }
// }
// return sb.substring(0, sb.length() - 3);
// }
// public static String getBusPathDes(BusPath busPath) {
// if (busPath == null) {
// return String.valueOf("");
// }
// long second = busPath.getDuration();
// String time = getFriendlyTime((int) second);
// float subDistance = busPath.getDistance();
// String subDis = getFriendlyLength((int) subDistance);
// float walkDistance = busPath.getWalkDistance();
// String walkDis = getFriendlyLength((int) walkDistance);
// return String.valueOf(time + " | " + subDis + " | 步行" + walkDis);
// }
public static String getSimpleBusLineName(String busLineName) {
if (busLineName == null) {
return String.valueOf("");
}
return busLineName.replaceAll("\\(.*?\\)", "");
}
}

View File

@@ -1,26 +0,0 @@
package com.mogo.map.impl.custom.overlay;
public class ChString {
public static final String Kilometer = "\u516c\u91cc";// "公里";
public static final String Meter = "\u7c73";// "米";
public static final String ByFoot = "\u6b65\u884c";// "步行";
public static final String To = "\u53bb\u5f80";// "去往";
public static final String Station = "\u8f66\u7ad9";// "车站";
public static final String TargetPlace = "\u76ee\u7684\u5730";// "目的地";
public static final String StartPlace = "\u51fa\u53d1\u5730";// "出发地";
public static final String About = "\u5927\u7ea6";// "大约";
public static final String Direction = "\u65b9\u5411";// "方向";
public static final String GetOn = "\u4e0a\u8f66";// "上车";
public static final String GetOff = "\u4e0b\u8f66";// "下车";
public static final String Zhan = "\u7ad9";// "站";
public static final String cross = "\u4ea4\u53c9\u8def\u53e3"; // 交叉路口
public static final String type = "\u7c7b\u522b"; // 类别
public static final String address = "\u5730\u5740"; // 地址
public static final String PrevStep = "\u4e0a\u4e00\u6b65";
public static final String NextStep = "\u4e0b\u4e00\u6b65";
public static final String Gong = "\u516c\u4ea4";
public static final String ByBus = "\u4e58\u8f66";
public static final String Arrive = "\u5230\u8FBE";// 到达
}

View File

@@ -1,376 +0,0 @@
//package com.mogo.map.impl.custom.overlay;
//
//import android.content.Context;
//import android.graphics.Color;
//
//import com.mogo.map.impl.custom.R;
//
//import java.util.ArrayList;
//import java.util.List;
//
//
///**
// * 导航路线图层类
// */
//public class DrivingRouteOverlay extends RouteOverlay {
// private DrivePath drivePath;
// private List<LatLonPoint> throughPointList;
// private List<Marker> throughPointMarkerList = new ArrayList<Marker>();
// private boolean throughPointMarkerVisible = true;
// private List<TMC> tmcs;
// private PolylineOptions mPolylineOptions;
// private PolylineOptions mPolylineOptionscolor;
// private Context mContext;
// private boolean isColorfulline = true;
// private float mWidth = 4;
// private List<LatLng> mLatLngsOfPath;
//
// public void setIsColorfulline(boolean iscolorfulline) {
// this.isColorfulline = iscolorfulline;
// }
//
// /**
// * 根据给定的参数,构造一个导航路线图层类对象。
// *
// * @param amap 地图对象。
// * @param path 导航路线规划方案。
// * @param context 当前的activity对象。
// */
// public DrivingRouteOverlay(Context context,
// AMap amap,
// DrivePath path,
// LatLonPoint start,
// LatLonPoint end,
// List<LatLonPoint> throughPointList) {
// super(context);
// mContext = context;
// mAMap = amap;
// this.drivePath = path;
// startPoint = AMapUtil.convertToLatLng(start);
// endPoint = AMapUtil.convertToLatLng(end);
// this.throughPointList = throughPointList;
//
// initBitmapDescriptor();
// }
//
// public float getRouteWidth() {
// return mWidth;
// }
//
// /**
// * 设置路线宽度
// *
// * @param mWidth 路线宽度取值范围大于0
// */
// public void setRouteWidth(float mWidth) {
// this.mWidth = mWidth;
// }
//
// /**
// * 添加驾车路线添加到地图上显示。
// */
// public void addToMap() {
// initPolylineOptions();
// try {
// if (mAMap == null) {
// return;
// }
//
// if (mWidth == 0 || drivePath == null) {
// return;
// }
// mLatLngsOfPath = new ArrayList<LatLng>();
// tmcs = new ArrayList<TMC>();
// List<DriveStep> drivePaths = drivePath.getSteps();
// mPolylineOptions.add(startPoint);
// for (int i = 0; i < drivePaths.size(); i++) {
// DriveStep step = drivePaths.get(i);
// List<LatLonPoint> latlonPoints = step.getPolyline();
// List<TMC> tmclist = step.getTMCs();
// tmcs.addAll(tmclist);
// addDrivingStationMarkers(step, convertToLatLng(latlonPoints.get(0)));
// for (LatLonPoint latlonpoint : latlonPoints) {
// mPolylineOptions.add(convertToLatLng(latlonpoint));
// mLatLngsOfPath.add(convertToLatLng(latlonpoint));
// }
// }
// mPolylineOptions.add(endPoint);
// if (startMarker != null) {
// startMarker.remove();
// startMarker = null;
// }
//
// if (endMarker != null) {
// endMarker.remove();
// endMarker = null;
// }
//// addStartAndEndMarker();
//// addThroughPointMarker();
// if (isColorfulline && tmcs.size() > 0) {
// colorWayUpdate(tmcs);
// showcolorPolyline();
// } else {
// showPolyline();
// }
//
// } catch (Throwable e) {
// e.printStackTrace();
// }
// }
//
// /**
// * 初始化线段属性
// */
// private void initPolylineOptions() {
// mPolylineOptions = null;
// mPolylineOptions = new PolylineOptions();
// mPolylineOptions.color(getDriveColor()).width(getRouteWidth());
// }
//
// private void showPolyline() {
// addPolyLine(mPolylineOptions);
// }
//
// private void showcolorPolyline() {
// addPolyLine(mPolylineOptionscolor);
// }
//
// /**
// * 根据不同的路段拥堵情况展示不同的颜色
// *
// * @param tmcSection
// */
// private void colorWayUpdate(List<TMC> tmcSection) {
// if (mAMap == null) {
// return;
// }
// if (tmcSection == null || tmcSection.size() <= 0) {
// return;
// }
// TMC segmentTrafficStatus;
// mPolylineOptionscolor = null;
// mPolylineOptionscolor = new PolylineOptions();
// mPolylineOptionscolor.width(getRouteWidth());
// List<Integer> colorList = new ArrayList<Integer>();
// List<BitmapDescriptor> bitmapDescriptors = new ArrayList<BitmapDescriptor>();
// List<LatLng> points = new ArrayList<>();
// List<Integer> texIndexList = new ArrayList<Integer>();
//// mPolylineOptionscolor.add(startPoint);
//// mPolylineOptionscolor.add(AMapUtil.convertToLatLng(tmcSection.get(0).getPolyline().get(0)));
//
// points.add(startPoint);
// points.add(AMapUtil.convertToLatLng(tmcSection.get(0).getPolyline().get(0)));
// colorList.add(getDriveColor());
// bitmapDescriptors.add(defaultRoute);
//
// BitmapDescriptor bitmapDescriptor = null;
// int textIndex = 0;
// texIndexList.add(textIndex);
// texIndexList.add(++textIndex);
// for (int i = 0; i < tmcSection.size(); i++) {
// segmentTrafficStatus = tmcSection.get(i);
// int color = getcolor(segmentTrafficStatus.getStatus());
// bitmapDescriptor = getTrafficBitmapDescriptor(segmentTrafficStatus.getStatus());
// List<LatLonPoint> mployline = segmentTrafficStatus.getPolyline();
// for (int j = 0; j < mployline.size(); j++) {
//// mPolylineOptionscolor.add(AMapUtil.convertToLatLng(mployline.get(j)));
// points.add(AMapUtil.convertToLatLng(mployline.get(j)));
// colorList.add(color);
//
// texIndexList.add(++textIndex);
// bitmapDescriptors.add(bitmapDescriptor);
// }
// }
//
// points.add(endPoint);
// colorList.add(getDriveColor());
// bitmapDescriptors.add(defaultRoute);
// texIndexList.add(++textIndex);
// mPolylineOptionscolor.addAll(points);
// mPolylineOptionscolor.colorValues(colorList);
//
//// mPolylineOptionscolor.setCustomTextureIndex(texIndexList);
//// mPolylineOptionscolor.setCustomTextureList(bitmapDescriptors);
// }
//
// private BitmapDescriptor defaultRoute = null;
// private BitmapDescriptor unknownTraffic = null;
// private BitmapDescriptor smoothTraffic = null;
// private BitmapDescriptor slowTraffic = null;
// private BitmapDescriptor jamTraffic = null;
// private BitmapDescriptor veryJamTraffic = null;
//
// private void initBitmapDescriptor() {
// defaultRoute = BitmapDescriptorFactory.fromResource( R.drawable.amap_route_color_texture_6_arrow);
// smoothTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_4_arrow);
// unknownTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_0_arrow);
// slowTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_3_arrow);
// jamTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_2_arrow);
// veryJamTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_9_arrow);
// }
//
// private BitmapDescriptor getTrafficBitmapDescriptor(String status) {
// if (status.equals("畅通")) {
// return smoothTraffic;
// } else if (status.equals("缓行")) {
// return slowTraffic;
// } else if (status.equals("拥堵")) {
// return jamTraffic;
// } else if (status.equals("严重拥堵")) {
// return veryJamTraffic;
// } else {
// return defaultRoute;
// }
// }
//
//
// private int getcolor(String status) {
// if (status.equals("畅通")) {
// return Color.GREEN;
// } else if (status.equals("缓行")) {
// return Color.YELLOW;
// } else if (status.equals("拥堵")) {
// return Color.RED;
// } else if (status.equals("严重拥堵")) {
// return Color.parseColor("#990033");
// } else {
// return Color.GREEN;
// }
// }
//
// public LatLng convertToLatLng(LatLonPoint point) {
// return new LatLng(point.getLatitude(), point.getLongitude());
// }
//
// /**
// * @param driveStep
// * @param latLng
// */
// private void addDrivingStationMarkers(DriveStep driveStep, LatLng latLng) {
// addStationMarker(new MarkerOptions()
// .position(latLng)
// .title("\u65B9\u5411:" + driveStep.getAction()
// + "\n\u9053\u8DEF:" + driveStep.getRoad())
// .snippet(driveStep.getInstruction()).visible(nodeIconVisible)
// .anchor(0.5f, 0.5f).icon(getDriveBitmapDescriptor()));
// }
//
// @Override
// protected LatLngBounds getLatLngBounds() {
// LatLngBounds.Builder b = LatLngBounds.builder();
// b.include(new LatLng(startPoint.latitude, startPoint.longitude));
// b.include(new LatLng(endPoint.latitude, endPoint.longitude));
// if (this.throughPointList != null && this.throughPointList.size() > 0) {
// for (int i = 0; i < this.throughPointList.size(); i++) {
// b.include(new LatLng(
// this.throughPointList.get(i).getLatitude(),
// this.throughPointList.get(i).getLongitude()));
// }
// }
// return b.build();
// }
//
// public void setThroughPointIconVisibility(boolean visible) {
// try {
// throughPointMarkerVisible = visible;
// if (this.throughPointMarkerList != null
// && this.throughPointMarkerList.size() > 0) {
// for (int i = 0; i < this.throughPointMarkerList.size(); i++) {
// this.throughPointMarkerList.get(i).setVisible(visible);
// }
// }
// } catch (Throwable e) {
// e.printStackTrace();
// }
// }
//
// private void addThroughPointMarker() {
// if (this.throughPointList != null && this.throughPointList.size() > 0) {
// LatLonPoint latLonPoint = null;
// for (int i = 0; i < this.throughPointList.size(); i++) {
// latLonPoint = this.throughPointList.get(i);
// if (latLonPoint != null) {
// throughPointMarkerList.add(mAMap
// .addMarker((new MarkerOptions())
// .position(
// new LatLng(latLonPoint
// .getLatitude(), latLonPoint
// .getLongitude()))
// .visible(throughPointMarkerVisible)
// .icon(getThroughPointBitDes())
// .title("\u9014\u7ECF\u70B9")));
// }
// }
// }
// }
//
// private BitmapDescriptor getThroughPointBitDes() {
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_through);
//
// }
//
// /**
// * 获取两点间距离
// *
// * @param start
// * @param end
// * @return
// */
// public static int calculateDistance(LatLng start, LatLng end) {
// double x1 = start.longitude;
// double y1 = start.latitude;
// double x2 = end.longitude;
// double y2 = end.latitude;
// return calculateDistance(x1, y1, x2, y2);
// }
//
// public static int calculateDistance(double x1, double y1, double x2, double y2) {
// final double NF_pi = 0.01745329251994329; // 弧度 PI/180
// x1 *= NF_pi;
// y1 *= NF_pi;
// x2 *= NF_pi;
// y2 *= NF_pi;
// double sinx1 = Math.sin(x1);
// double siny1 = Math.sin(y1);
// double cosx1 = Math.cos(x1);
// double cosy1 = Math.cos(y1);
// double sinx2 = Math.sin(x2);
// double siny2 = Math.sin(y2);
// double cosx2 = Math.cos(x2);
// double cosy2 = Math.cos(y2);
// double[] v1 = new double[3];
// v1[0] = cosy1 * cosx1 - cosy2 * cosx2;
// v1[1] = cosy1 * sinx1 - cosy2 * sinx2;
// v1[2] = siny1 - siny2;
// double dist = Math.sqrt(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2]);
//
// return (int) (Math.asin(dist / 2) * 12742001.5798544);
// }
//
//
// //获取指定两点之间固定距离点
// public static LatLng getPointForDis(LatLng sPt, LatLng ePt, double dis) {
// double lSegLength = calculateDistance(sPt, ePt);
// double preResult = dis / lSegLength;
// return new LatLng((ePt.latitude - sPt.latitude) * preResult + sPt.latitude, (ePt.longitude - sPt.longitude) * preResult + sPt.longitude);
// }
//
// /**
// * 去掉DriveLineOverlay上的线段和标记。
// */
// @Override
// public void removeFromMap() {
// try {
// super.removeFromMap();
// if (this.throughPointMarkerList != null
// && this.throughPointMarkerList.size() > 0) {
// for (int i = 0; i < this.throughPointMarkerList.size(); i++) {
// this.throughPointMarkerList.get(i).remove();
// }
// this.throughPointMarkerList.clear();
// }
// } catch (Throwable e) {
// e.printStackTrace();
// }
// }
//}

View File

@@ -1,36 +0,0 @@
//package com.mogo.map.impl.custom.overlay;
//
//import com.amap.api.services.route.BusRouteResult;
//import com.amap.api.services.route.DriveRouteResult;
//import com.amap.api.services.route.RideRouteResult;
//import com.amap.api.services.route.RouteSearch;
//import com.amap.api.services.route.WalkRouteResult;
//
///**
// * @author congtaowang
// * @since 2020-01-08
// * <p>
// * 描述
// */
//public abstract class OnRouteSearchListenerAdapter implements RouteSearch.OnRouteSearchListener {
//
// @Override
// public void onBusRouteSearched( BusRouteResult busRouteResult, int i ) {
//
// }
//
// @Override
// public void onDriveRouteSearched( DriveRouteResult driveRouteResult, int i ) {
//
// }
//
// @Override
// public void onWalkRouteSearched( WalkRouteResult walkRouteResult, int i ) {
//
// }
//
// @Override
// public void onRideRouteSearched( RideRouteResult rideRouteResult, int i ) {
//
// }
//}

View File

@@ -1,210 +0,0 @@
//package com.mogo.map.impl.custom.overlay;
//
//import android.content.Context;
//import android.graphics.BitmapFactory;
//import android.util.Log;
//
//import com.amap.api.maps.AMap;
//import com.amap.api.maps.model.NavigateArrowOptions;
//import com.amap.api.maps.model.Polyline;
//import com.amap.api.navi.model.AMapNaviLocation;
//import com.amap.api.navi.model.AMapNaviPath;
//import com.amap.api.navi.model.NaviInfo;
//import com.amap.api.navi.model.RouteOverlayOptions;
//import com.amap.api.navi.view.RouteOverLay;
//import com.mogo.map.impl.custom.utils.MapStyleUtils;
//import com.mogo.utils.logger.Logger;
//
//import java.lang.ref.WeakReference;
//import java.lang.reflect.Field;
//
///**
// * @author congtaowang
// * @since 2019-10-04
// * <p>
// * 路径覆盖物
// */
//public class RouteOverLayWrapper {
//
// private static final String TAG = "RouteOverLayWrapper";
//
// private final WeakReference< Context > mContextRef;
// private final AMap mAMap;
// private final AMapNaviPath mPath;
//
// private RouteOverLay mRouteOverLay;
// private boolean mIsRemoved = true;
//
// private boolean mIsTrafficLightsVisible = true;
// private int mStartBitmapResId = 0;
// private int mEndBitmapResId = 0;
// private int mZIndex = 0;
//
// private static RouteOverlayOptions sOptions;
//
// public RouteOverLayWrapper( Context context,
// AMap mAMap,
// AMapNaviPath mPath ) {
// this.mContextRef = new WeakReference<>( context );
// this.mAMap = mAMap;
// this.mPath = mPath;
// }
//
// public void addToMap() {
// if ( mContextRef == null || mContextRef.get() == null ) {
// return;
// }
// mRouteOverLay = new RouteOverLay( mAMap, mPath, mContextRef.get() );
// if ( sOptions == null ) {
// sOptions = MapStyleUtils.getRouteOverlayOptions();
// }
// mRouteOverLay.setRouteOverlayOptions( sOptions );
// mRouteOverLay.setTrafficLine( true );
// mRouteOverLay.setRouteOverlayVisible( true );
// mRouteOverLay.setTrafficLightsVisible( true );
// mRouteOverLay.setArrowOnRoute( true );
// mRouteOverLay.setZindex( mZIndex );
// mRouteOverLay.setNaviArrowVisible( true );
// mRouteOverLay.setLightsVisible( true );
// mRouteOverLay.setTrafficLightsVisible( mIsTrafficLightsVisible );
// hookRouteArrow();
//
// if ( mStartBitmapResId != 0 ) {
// try {
// mRouteOverLay.setStartPointBitmap( BitmapFactory.decodeResource( mContextRef.get().getResources(), mStartBitmapResId ) );
// } catch ( Exception e ) {
// e.printStackTrace();
// }
// } else {
// mRouteOverLay.setStartPointBitmap( null );
// }
//
// if ( mEndBitmapResId != 0 ) {
// try {
// mRouteOverLay.setEndPointBitmap( BitmapFactory.decodeResource( mContextRef.get().getResources(), mEndBitmapResId ) );
// } catch ( Exception e ) {
// e.printStackTrace();
// }
// } else {
// mRouteOverLay.setEndPointBitmap( null );
// }
//
// mRouteOverLay.addToMap();
// mIsRemoved = false;
// }
//
// public void remove() {
// Log.d( TAG, "remove" );
// if ( mRouteOverLay != null ) {
// try {
// mRouteOverLay.removeFromMap();
// mIsRemoved = true;
// } catch ( Exception e ) {
// e.printStackTrace();
// }
// }
// }
//
// /**
// * 设置透明度
// *
// * @param alpha
// */
// public void setTransparency( float alpha ) {
// if ( mRouteOverLay != null ) {
// mRouteOverLay.setTransparency( alpha );
// }
// }
//
// public RouteOverLayWrapper setTrafficLightsVisible( boolean visible ) {
// mIsTrafficLightsVisible = visible;
// return this;
// }
//
// public RouteOverLayWrapper setStartBitmap( int startBitmapResId ) {
// mStartBitmapResId = startBitmapResId;
// return this;
// }
//
// public RouteOverLayWrapper setEndBitmap( int endBitmapResId ) {
// mEndBitmapResId = endBitmapResId;
// return this;
// }
//
// public RouteOverLayWrapper setZIndex( int zIndex ) {
// mZIndex = zIndex;
// return this;
// }
//
// public int getZIndex() {
// return mZIndex;
// }
//
// @Override
// protected void finalize() throws Throwable {
// super.finalize();
// mIsRemoved = true;
// }
//
// public synchronized boolean isRemoved() {
// return mIsRemoved;
// }
//
// public void updatePolyline( AMapNaviLocation aMapNaviLocation ) {
// if ( mIsRemoved ) {
// return;
// }
// if ( mRouteOverLay != null ) {
// mRouteOverLay.updatePolyline( aMapNaviLocation );
// }
// }
//
// public void drawArrow( NaviInfo naviInfo ) {
// Log.d( TAG, "drawArrow" );
// if ( mIsRemoved ) {
// return;
// }
// if ( naviInfo == null ) {
// return;
// }
// if ( mRouteOverLay != null ) {
// try {
// mRouteOverLay.drawArrow( mRouteOverLay.getArrowPoints( naviInfo.getCurStep() ) );
// } catch ( Exception e ) {
// e.printStackTrace();
// }
// }
// }
//
// private void hookRouteArrow() {
// if ( mRouteOverLay != null && sOptions != null ) {
// try {
// Field field = mRouteOverLay.getClass().getDeclaredField( "naviArrow" );
// field.setAccessible( true );
// field.set( mRouteOverLay, mAMap.addNavigateArrow( new NavigateArrowOptions().topColor( sOptions.getArrowColor() ).width( sOptions.getLineWidth() ).sideColor( sOptions.getArrowSideColor() ) ) );
// Logger.d( TAG, "hook 成功。" );
// } catch ( Exception e ) {
// e.printStackTrace();
// }
// }
// }
//
// public Polyline getTrafficColorfulPolyline() {
// if ( mRouteOverLay != null ) {
// return mRouteOverLay.mTrafficColorfulPolyline;
// }
// return null;
// }
//
// public void destroy() {
// Log.d( TAG, "destroy" );
// if ( mRouteOverLay != null ) {
// try {
// mRouteOverLay.destroy();
// mIsRemoved = true;
// } catch ( Exception e ) {
// e.printStackTrace();
// }
// }
// }
//}

View File

@@ -1,236 +0,0 @@
//package com.mogo.map.impl.custom.overlay;
//
//import android.content.Context;
//import android.graphics.Bitmap;
//import android.graphics.Color;
//
//import com.amap.api.maps.AMap;
//import com.amap.api.maps.CameraUpdateFactory;
//import com.amap.api.maps.model.BitmapDescriptor;
//import com.amap.api.maps.model.BitmapDescriptorFactory;
//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.Polyline;
//import com.amap.api.maps.model.PolylineOptions;
//import com.mogo.map.impl.custom.R;
//
//import java.util.ArrayList;
//import java.util.List;
//
//
//public class RouteOverlay {
// protected List<Marker> stationMarkers = new ArrayList<Marker>();
// protected List<Polyline> allPolyLines = new ArrayList<Polyline>();
// protected Marker startMarker;
// protected Marker endMarker;
// protected LatLng startPoint;
// protected LatLng endPoint;
// protected AMap mAMap;
// private Context mContext;
// private Bitmap startBit, endBit, busBit, walkBit, driveBit;
// protected boolean nodeIconVisible = true;
//
// public RouteOverlay(Context context) {
// mContext = context;
// }
//
// /**
// * 去掉BusRouteOverlay上所有的Marker。
// *
// * @since V2.1.0
// */
// public void removeFromMap() {
// if (startMarker != null) {
// startMarker.remove();
//
// }
// if (endMarker != null) {
// endMarker.remove();
// }
// for (Marker marker : stationMarkers) {
// marker.remove();
// }
// for (Polyline line : allPolyLines) {
// line.remove();
// }
// destroyBit();
// }
//
// private void destroyBit() {
// if (startBit != null) {
// startBit.recycle();
// startBit = null;
// }
// if (endBit != null) {
// endBit.recycle();
// endBit = null;
// }
// if (busBit != null) {
// busBit.recycle();
// busBit = null;
// }
// if (walkBit != null) {
// walkBit.recycle();
// walkBit = null;
// }
// if (driveBit != null) {
// driveBit.recycle();
// driveBit = null;
// }
// }
//
// /**
// * 给起点Marker设置图标并返回更换图标的图片。如不用默认图片需要重写此方法。
// *
// * @return 更换的Marker图片。
// * @since V2.1.0
// */
// protected BitmapDescriptor getStartBitmapDescriptor() {
// return BitmapDescriptorFactory.fromResource( R.drawable.amap_start);
// }
//
// /**
// * 给终点Marker设置图标并返回更换图标的图片。如不用默认图片需要重写此方法。
// *
// * @return 更换的Marker图片。
// * @since V2.1.0
// */
// protected BitmapDescriptor getEndBitmapDescriptor() {
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_end);
// }
//
// /**
// * 给公交Marker设置图标并返回更换图标的图片。如不用默认图片需要重写此方法。
// *
// * @return 更换的Marker图片。
// * @since V2.1.0
// */
// protected BitmapDescriptor getBusBitmapDescriptor() {
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_bus);
// }
//
// /**
// * 给步行Marker设置图标并返回更换图标的图片。如不用默认图片需要重写此方法。
// *
// * @return 更换的Marker图片。
// * @since V2.1.0
// */
// protected BitmapDescriptor getWalkBitmapDescriptor() {
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_man);
// }
//
// protected BitmapDescriptor getDriveBitmapDescriptor() {
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_car);
// }
//
// protected void addStartAndEndMarker() {
// startMarker = mAMap.addMarker((new MarkerOptions())
// .position(startPoint).icon(getStartBitmapDescriptor())
// .title("\u8D77\u70B9"));
// // startMarker.showInfoWindow();
//
// endMarker = mAMap.addMarker((new MarkerOptions()).position(endPoint)
// .icon(getEndBitmapDescriptor()).title("\u7EC8\u70B9"));
// // mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(startPoint,
// // getShowRouteZoom()));
// }
//
// /**
// * 移动镜头到当前的视角。
// *
// * @since V2.1.0
// */
// public void zoomToSpan() {
// if (startPoint != null) {
// if (mAMap == null)
// return;
// try {
// LatLngBounds bounds = getLatLngBounds();
// mAMap.animateCamera(CameraUpdateFactory
// .newLatLngBounds(bounds, 50));
// } catch (Throwable e) {
// e.printStackTrace();
// }
// }
// }
//
// protected LatLngBounds getLatLngBounds() {
// LatLngBounds.Builder b = LatLngBounds.builder();
// b.include(new LatLng(startPoint.latitude, startPoint.longitude));
// b.include(new LatLng(endPoint.latitude, endPoint.longitude));
// for (Polyline polyline : allPolyLines) {
// for (LatLng point : polyline.getPoints()) {
// b.include(point);
// }
// }
// return b.build();
// }
//
// /**
// * 路段节点图标控制显示接口。
// *
// * @param visible true为显示节点图标false为不显示。
// * @since V2.3.1
// */
// public void setNodeIconVisibility(boolean visible) {
// try {
// nodeIconVisible = visible;
// if (this.stationMarkers != null && this.stationMarkers.size() > 0) {
// for (int i = 0; i < this.stationMarkers.size(); i++) {
// this.stationMarkers.get(i).setVisible(visible);
// }
// }
// } catch (Throwable e) {
// e.printStackTrace();
// }
// }
//
// protected void addStationMarker(MarkerOptions options) {
// if (options == null) {
// return;
// }
// Marker marker = mAMap.addMarker(options);
// if (marker != null) {
// stationMarkers.add(marker);
// }
//
// }
//
// protected void addPolyLine(PolylineOptions options) {
// if (options == null) {
// return;
// }
// Polyline polyline = mAMap.addPolyline(options);
// if (polyline != null) {
// allPolyLines.add(polyline);
// }
// }
//
// protected float getRouteWidth() {
// return 18f;
// }
//
// protected int getWalkColor() {
// return Color.parseColor("#6db74d");
// }
//
// /**
// * 自定义路线颜色。
// * return 自定义路线颜色。
// *
// * @since V2.2.1
// */
// protected int getBusColor() {
// return Color.parseColor("#537edc");
// }
//
// protected int getDriveColor() {
// return Color.parseColor("#537edc");
// }
//
// // protected int getShowRouteZoom() {
// // return 15;
// // }
//}

View File

@@ -1,97 +0,0 @@
//package com.mogo.map.impl.custom.overlay;
//
//import android.content.Context;
//
//import com.amap.api.services.core.LatLonPoint;
//import com.amap.api.services.route.DriveRouteResult;
//import com.amap.api.services.route.RouteSearch;
//import com.mogo.eagle.core.data.map.MogoLatLng;
//import com.mogo.map.impl.custom.AMapWrapper;
//import com.mogo.map.impl.custom.InterceptorHandler;
//import com.mogo.utils.logger.Logger;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author congtaowang
// * @since 2020-01-08
// * <p>
// * 给定起点、途经点,规划路径
// */
//public class RouteOverlayHelper {
//
// private static final String TAG = "RouteOverlayHelper";
//
// private static volatile RouteOverlayHelper sInstance;
//
// private DrivingRouteOverlay mDrivingRouteOverlay;
//
// private RouteOverlayHelper() {
// }
//
// public static RouteOverlayHelper getInstance() {
// if ( sInstance == null ) {
// synchronized ( RouteOverlayHelper.class ) {
// if ( sInstance == null ) {
// sInstance = new RouteOverlayHelper();
// }
// }
// }
// return sInstance;
// }
//
// public synchronized void release() {
// sInstance = null;
// }
//
// public void addRouteWay( final Context context, MogoLatLng start, MogoLatLng end, List< MogoLatLng > wayPoints ) {
// if ( wayPoints == null || wayPoints.isEmpty() ) {
// return;
// }
// if ( InterceptorHandler.getInstance().ignoreDrawRouteOverlay( context ) ) {
// Logger.w( TAG, "naviing." );
// return;
// }
//
// if ( mDrivingRouteOverlay != null ) {
// mDrivingRouteOverlay.removeFromMap();
// }
//
// RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo( new LatLonPoint( start.lat, start.lng ),
// new LatLonPoint( end.lat, end.lng ) );
// final List< LatLonPoint > ways = new ArrayList<>();
// for ( MogoLatLng wayPoint : wayPoints ) {
// ways.add( new LatLonPoint( wayPoint.lat, wayPoint.lng ) );
// }
// RouteSearch.DriveRouteQuery query = new RouteSearch.DriveRouteQuery( fromAndTo, 0, ways, null, "" );
// RouteSearch routeSearch = new RouteSearch( context );
// routeSearch.calculateDriveRouteAsyn( query );
// routeSearch.setRouteSearchListener( new OnRouteSearchListenerAdapter() {
// @Override
// public void onDriveRouteSearched( DriveRouteResult driveRouteResult, int i ) {
// super.onDriveRouteSearched( driveRouteResult, i );
// if ( i != 1000 ) {
// Logger.e( TAG, "算路失败. code = %d", i );
// return;
// }
// mDrivingRouteOverlay = new DrivingRouteOverlay( context, AMapWrapper.getAMap(),
// driveRouteResult.getPaths().get( 0 ),
// driveRouteResult.getStartPos(),
// driveRouteResult.getTargetPos(),
// null );
// mDrivingRouteOverlay.setNodeIconVisibility( false );
// mDrivingRouteOverlay.setIsColorfulline( false );
// mDrivingRouteOverlay.addToMap();
// mDrivingRouteOverlay.zoomToSpan();
// }
// } );
// }
//
// public void removeAll() {
// if ( mDrivingRouteOverlay != null ) {
// mDrivingRouteOverlay.removeFromMap();
// }
// mDrivingRouteOverlay = null;
// }
//}

View File

@@ -1,71 +0,0 @@
//package com.mogo.map.impl.custom.utils;
//
//import android.graphics.Bitmap;
//import android.graphics.Color;
//
//import com.amap.api.navi.model.RouteOverlayOptions;
//import com.mogo.commons.AbsMogoApplication;
//import com.mogo.map.impl.custom.R;
//
///**
// * @author congtaowang
// * @since 2019-10-04
// * <p>
// * 描述
// */
//public class MapStyleUtils {
//
// enum ColorEnum {
// route_overlay_line_normal( Color.parseColor( "#00C96D" ) ),
// route_overlay_line_unknown( Color.parseColor( "#3CD26E" ) ),
// route_overlay_line_slow( Color.parseColor( "#ECC71F" ) ),
// route_overlay_line_very_traffic( Color.parseColor( "#E16262" ) ),
// route_overlay_line_traffic( Color.parseColor( "#E88181" ) ),
// transparent( Color.parseColor( "#00000000" ) ),
// light_gray( Color.parseColor( "#334BD089" ) );
//
// private int color;
//
// ColorEnum( int color ) {
// this.color = color;
// }
//
// public int getColor() {
// return color;
// }
// }
//
// public static RouteOverlayOptions getRouteOverlayOptions() {
// RouteOverlayOptions options = new RouteOverlayOptions();
// // 设置导航线路的宽度
// options.setLineWidth( AbsMogoApplication.getApp().getResources().getDimension(R.dimen.path_width) );
//// // 设置交通状况情况良好下的纹理位图
//// options.setSmoothTraffic( colorToBitmap( ColorEnum.route_overlay_line_normal.getColor() ) );
//// // 设置路线的图标
//// options.setNormalRoute( colorToBitmap( ColorEnum.route_overlay_line_normal.getColor() ) );
//// // 设置交通状况未知下的纹理位图
//// options.setUnknownTraffic( colorToBitmap( ColorEnum.route_overlay_line_unknown.getColor() ) );
//// // 设置交通状况迟缓下的纹理位图
//// options.setSlowTraffic( colorToBitmap( ColorEnum.route_overlay_line_slow.getColor() ) );
//// // 设置交通状况非常拥堵下的纹理位图
//// options.setVeryJamTraffic( colorToBitmap( ColorEnum.route_overlay_line_very_traffic.getColor() ) );
//// // 设置交通状况拥堵下的纹理位图
//// options.setJamTraffic( colorToBitmap( ColorEnum.route_overlay_line_traffic.getColor() ) );
//// // 设置浮于道路上的『小箭头』图标的纹理位图
//// options.setArrowOnTrafficRoute( colorToBitmap( ColorEnum.transparent.getColor() ) );
// // 自定义走过路线纹理默认走过路线置灰功能为关需要在AMapNaviViewOptions.setAfterRouteAutoGray(boolean)打开,该方法才生效
// options.setPassRoute( colorToBitmap( ColorEnum.light_gray.getColor() ) );
//// // 设置路线虚线纹理
//// options.setFairWayRes( colorToBitmap( ColorEnum.route_overlay_line_normal.getColor() ) );
// options.setArrowColor( Color.parseColor( "#92C9FF" ) ); // 自研地图内部配置颜色
// options.setArrowSideColor( Color.parseColor( "#4F9BF2" ) ); // 自研地图内部配置颜色
// return options;
// }
//
// public static Bitmap colorToBitmap( int color ) {
// Bitmap.Config config = Bitmap.Config.ARGB_8888;
// Bitmap bitmap = Bitmap.createBitmap( 1, 1, config );
// bitmap.eraseColor( color );
// return bitmap;
// }
//}

View File

@@ -3,14 +3,13 @@ package com.mogo.map.impl.custom.utils;
import java.util.HashMap;
import java.util.Map;
public
/**
* @author congtaowang
* @since 2021/3/8
*
* 描述
*/
class ResIdCache {
public class ResIdCache {
public static Map< String, String > sMarkerCachesResMd5Values = new HashMap<>();

View File

@@ -256,10 +256,6 @@ public interface IMogoMapUIController {
int getSpeedLimmit(double lon,double lat,float angle);
default void testGpsData() {
}
/**
* 自研地图是否匹配道路
*

View File

@@ -1,7 +1,5 @@
package com.mogo.map;
import android.util.Log;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;

View File

@@ -1,10 +0,0 @@
package com.mogo.map.constants;
/**
* @author zyz
* 2020-01-14.
*/
public class BroadcastMode {
public static final int CONCISE = 1;
public static final int DETAIL = 2;
}

View File

@@ -378,9 +378,6 @@ public class MockIntentHandler implements IntentHandler {
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeTo2dMode();
}
break;
case 35://测试GPS数据
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().testGpsData();
break;
case 36:// 测试打点功能
MogoLatLng center = MogoApisHandler.getInstance().getApis()
.getMapServiceApi().getMapUIController()