[Change]
增加接口
/**
* 获取车道中心线信息
*/
fun getCenterLineInfo(lon: Double, lat: Double, angle: Float): CenterLine?
Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEVA;
|
||||
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_300;
|
||||
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS;
|
||||
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_TOP;
|
||||
@@ -22,6 +21,7 @@ import android.view.View;
|
||||
import com.mogo.commons.constants.SharedPrefsConstants;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.MapRoadInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
@@ -94,7 +94,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
OnMapTouchListener,
|
||||
OnMarkClickListener,
|
||||
OnMapStyleListener,
|
||||
MapStyleController.IMapStyleAutoChangedListener,
|
||||
OnMapViewVisualAngleChangeListener,
|
||||
OnRoadInfoListener {
|
||||
|
||||
@@ -108,14 +107,10 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
.naviCursorRes(R.drawable.ic_amap_navi_cursor)
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
private EnumMapUI mCurrentCarUIMode;
|
||||
private EnumMapUI mCurrentUI;
|
||||
private VisualAngleMode mVisualAngleMode = MODE_MEDIUM_SIGHT;
|
||||
|
||||
private int mLockZoom = 16;
|
||||
private long startTime;
|
||||
private float mDefaultZoomLevel = 16.0f;
|
||||
private boolean mIsCarLocked = false;
|
||||
private boolean mIsLightStyle = false;
|
||||
private boolean mMapLoaded = false;
|
||||
private boolean mIsFirstLocated = true;
|
||||
@@ -125,7 +120,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private volatile String mRoadId = null;
|
||||
|
||||
public AMapViewWrapper(MapAutoView mMapView) {
|
||||
startTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.i(TAG, "autoop--AMapViewWrapper: init");
|
||||
this.mMapView = mMapView;
|
||||
initViews();
|
||||
@@ -151,7 +145,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
//修改自车模型,未来需区分车的类型
|
||||
options.setMyLocationStyle(options.getMyLocationStyle().myLocationIcon(HdMapBuildConfig.currentCarVrIconRes, true));
|
||||
// MapAutoApi.INSTANCE.getMyLocationStyle().myLocationIcon(HdMapBuildConfig.currentCarVrIconRes, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +172,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if (roadId != null && !TextUtils.isEmpty(roadId)) {
|
||||
CallerLogger.INSTANCE.d(TAG, "onRoadIdInfo::" + roadId);
|
||||
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnRoadIdGet(roadId);
|
||||
} else {
|
||||
} else {
|
||||
CallerLogger.INSTANCE.d(TAG, "onRoadIdInfo::null");
|
||||
}
|
||||
}
|
||||
@@ -213,10 +206,10 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
LonLatPoint p2 = points.get(points.size() - 1);
|
||||
double distanceOfCarToStopLine = MapDataApi.INSTANCE.getNearstFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.longitude, p1.latitude, p2.longitude, p2.latitude) * 10_0000;
|
||||
stopInfo.setDistanceOfCarToStopLine(distanceOfCarToStopLine);
|
||||
CallerLogger.INSTANCE.d(TAG, "onStopLineInfo: --- distance: "+ distanceOfCarToStopLine);
|
||||
CallerLogger.INSTANCE.d(TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
|
||||
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnStopLineGet(stopInfo);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (carLoc != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "onStopLineInfo::null, car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
|
||||
}
|
||||
@@ -373,32 +366,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if (checkAMapView()) {
|
||||
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
|
||||
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
|
||||
// TODO 这里临时修改关闭2D
|
||||
// switch (ui) {
|
||||
// case CarUp_2D:
|
||||
// case CarUp_3D:
|
||||
// case NorthUP_2D:
|
||||
// setUIMode(ui);
|
||||
// break;
|
||||
// case Type_VR:
|
||||
// mMapView.getMapAutoViewHelper().setScaleVRMode(true);
|
||||
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
|
||||
// return;
|
||||
// case Type_Light:
|
||||
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false);
|
||||
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY);
|
||||
// mIsLightStyle = true;
|
||||
// break;
|
||||
// case Type_Night:
|
||||
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false);
|
||||
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT);
|
||||
// mIsLightStyle = false;
|
||||
// break;
|
||||
// case Type_AUTO_LIGHT_Night:
|
||||
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(true);
|
||||
// break;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,7 +471,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "锁车");
|
||||
mMapView.getMapAutoViewHelper().setLockMode(true);
|
||||
mIsCarLocked = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,12 +481,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "解锁锁车");
|
||||
mMapView.getMapAutoViewHelper().setLockMode(false);
|
||||
mIsCarLocked = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom(int var1) {
|
||||
mLockZoom = var1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -653,12 +613,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
return MogoMapUtils.calculateLineDistance(ObjectUtils.fromMogo(p1), ObjectUtils.fromMogo(p2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
return mCurrentCarUIMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation(Location location) {
|
||||
}
|
||||
@@ -739,10 +693,15 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedLimmit(double lon, double lat, float angle) {
|
||||
public int getLimitSpeed(double lon, double lat, float angle) {
|
||||
return MapDataApi.INSTANCE.getLimitSpeed(lon, lat, angle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CenterLine getCenterLineInfo(double lon, double lat, float angle) {
|
||||
return ObjectUtils.transformCenterLine(MapDataApi.INSTANCE.getCenterLineInfo(lon, lat, angle));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
|
||||
MogoLocation mLastLocation = ObjectUtils.fromLocation(location);
|
||||
@@ -786,7 +745,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mIsFirstLocated = true;
|
||||
mIsDelayed = false;
|
||||
CallerLogger.INSTANCE.d(TAG, "同步定位:" + GsonUtils.toJson(location));
|
||||
MapStyleController.getInstance().onLocationChanged(location, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -940,26 +898,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mMapView.getMapAutoViewHelper().setMapViewPerspective(MapAutoApi.MAP_PERSPECTIVE_UP_CAR);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStyleAutoChanged(boolean isVrMode) {
|
||||
if (isVrMode) {
|
||||
if (mCurrentUI != EnumMapUI.Type_VR) {
|
||||
CallerLogger.INSTANCE.d(TAG, "自动切换为vr模式");
|
||||
changeMapMode(EnumMapUI.Type_VR);
|
||||
}
|
||||
} else {
|
||||
if (mCurrentUI == EnumMapUI.Type_VR) {
|
||||
CallerLogger.INSTANCE.d(TAG, "自动切换为2D模式");
|
||||
if (mIsLightStyle) {
|
||||
changeMapMode(EnumMapUI.Type_Light);
|
||||
} else {
|
||||
changeMapMode(EnumMapUI.Type_Night);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean mRtkEnable = false;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-10
|
||||
* <p>
|
||||
* 拦截器
|
||||
*/
|
||||
public interface Interrupter {
|
||||
|
||||
/**
|
||||
* 是否拦截
|
||||
* @return true - 拦截, false - 不拦截
|
||||
*/
|
||||
boolean interrupt();
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-10
|
||||
* <p>
|
||||
* 地图视图中心点
|
||||
*/
|
||||
public class MapCenterPoint {
|
||||
|
||||
public final double x;
|
||||
public final double y;
|
||||
|
||||
public MapCenterPoint( double x, double y ) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.zhidaoauto.map.sdk.open.location.MogoLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/25
|
||||
*
|
||||
* 地图样式控制
|
||||
*/
|
||||
class MapStyleController {
|
||||
|
||||
|
||||
private static volatile MapStyleController sInstance;
|
||||
|
||||
private boolean mIsInVrMode = false;
|
||||
|
||||
private List< VrAreaFilter > mVrAreaFilters = new ArrayList<>();
|
||||
|
||||
private MapStyleController() {
|
||||
mVrAreaFilters.add( new ShunYiArea() );
|
||||
mVrAreaFilters.add( new OCHArea() );
|
||||
// mVrAreaFilters.add( new HuiXinXiJieArea() );
|
||||
}
|
||||
|
||||
public static MapStyleController getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MapStyleController.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MapStyleController();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void onLocationChanged( MogoLocation location, IMapStyleAutoChangedListener listener ) {
|
||||
if ( location == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 网约车不自动切换vr、2d模式
|
||||
if ( DebugConfig.isOCHModule() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isInVrMode = false;
|
||||
for ( VrAreaFilter vrAreaFilter : mVrAreaFilters ) {
|
||||
if ( vrAreaFilter == null ) {
|
||||
continue;
|
||||
}
|
||||
isInVrMode |= vrAreaFilter.isVrArea( location );
|
||||
if ( isInVrMode ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( isInVrMode ) {
|
||||
if ( !mIsInVrMode ) {
|
||||
// 第一次进入 vr 区域,自动变为 vr 模式
|
||||
mIsInVrMode = true;
|
||||
if ( listener != null ) {
|
||||
listener.onStyleAutoChanged( true );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( mIsInVrMode ) {
|
||||
// 驶出 vr 区域,自动变为 2d 模式
|
||||
mIsInVrMode = false;
|
||||
if ( listener != null ) {
|
||||
listener.onStyleAutoChanged( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface IMapStyleAutoChangedListener {
|
||||
void onStyleAutoChanged(boolean isVrMode);
|
||||
}
|
||||
|
||||
public interface VrAreaFilter {
|
||||
default boolean isVrArea(MogoLocation location) {
|
||||
if ( location == null ) {
|
||||
return false;
|
||||
}
|
||||
return location.getLat() > getLeftBottomLat() && location.getLon() > getLeftBottomLon()
|
||||
&& location.getLat() < getRightTopLat() && location.getLon() < getRightTopLon();
|
||||
}
|
||||
|
||||
double getLeftBottomLat();
|
||||
|
||||
double getLeftBottomLon();
|
||||
|
||||
double getRightTopLat();
|
||||
|
||||
double getRightTopLon();
|
||||
}
|
||||
|
||||
public static class ShunYiArea implements VrAreaFilter {
|
||||
|
||||
// 顺义一期高精地图范围(目前圈定了一个矩形区域,认为都是高精地图区域)
|
||||
private final double leftBottomLat = 40.18728;
|
||||
private final double leftBottomLon = 116.71194;
|
||||
private final double rightTopLat = 40.20671;
|
||||
private final double rightTopLon = 116.74804;
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLat() {
|
||||
return leftBottomLat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLon() {
|
||||
return leftBottomLon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLat() {
|
||||
return rightTopLat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLon() {
|
||||
return rightTopLon;
|
||||
}
|
||||
}
|
||||
|
||||
public static class OCHArea implements VrAreaFilter {
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLat() {
|
||||
return 39.97645;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLon() {
|
||||
return 116.41673;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLat() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLon() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static class HuiXinXiJieArea implements VrAreaFilter {
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLat() {
|
||||
return 39.96741320378243;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLon() {
|
||||
return 116.41045709250723;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLat() {
|
||||
return 39.98232698552779;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLon() {
|
||||
return 116.41879656379113;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
@@ -158,13 +159,6 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom(int var1) {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
mDelegate.setLockZoom(var1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview(Rect bounds) {
|
||||
@@ -288,14 +282,6 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
return mDelegate.getCurrentUiMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation(Location location) {
|
||||
@@ -364,13 +350,21 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedLimmit(double lon, double lat, float angle) {
|
||||
public int getLimitSpeed(double lon, double lat, float angle) {
|
||||
if (mDelegate != null) {
|
||||
return mDelegate.getSpeedLimmit(lon, lat, angle);
|
||||
return mDelegate.getLimitSpeed(lon, lat, angle);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CenterLine getCenterLineInfo(double lon, double lat, float angle) {
|
||||
if (mDelegate != null) {
|
||||
return mDelegate.getCenterLineInfo(lon, lat, angle);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rtkEnable(boolean enable) {
|
||||
initDelegate();
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public interface Scene {
|
||||
|
||||
/**
|
||||
* 普通场景
|
||||
*/
|
||||
int COMMON = 0;
|
||||
|
||||
/**
|
||||
* 选点
|
||||
*/
|
||||
int CHOOSE_POINT = 1;
|
||||
|
||||
/**
|
||||
* 导航
|
||||
*/
|
||||
int NAVI = 2;
|
||||
|
||||
/**
|
||||
* 导航 vs 道路事件
|
||||
*/
|
||||
int NAVI_WITH_ROAD_EVENT = 21;
|
||||
|
||||
/**
|
||||
* 巡航
|
||||
*/
|
||||
int AIMLESS = 3;
|
||||
|
||||
/**
|
||||
* 巡航 vs 道路事件
|
||||
*/
|
||||
int AIMLESS_WITH_ROAD_EVENT = 31;
|
||||
|
||||
/**
|
||||
* 路线规划
|
||||
*/
|
||||
int CALCULATE_PATH = 4;
|
||||
|
||||
/**
|
||||
* 分类搜索
|
||||
*/
|
||||
int CATEGORY_SEARCH = 5;
|
||||
|
||||
/**
|
||||
* V2X触发了预警场景
|
||||
*/
|
||||
int CATEGORY_V2X_EVENT = 6;
|
||||
}
|
||||
@@ -18,7 +18,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public final class AMapInfoWindowAdapter implements InfoWindowAdapter, OnInfoWindowClickListener {
|
||||
|
||||
public View getInfoWindow( Marker marker ) {
|
||||
@Override
|
||||
public View getInfoWindow(Marker marker ) {
|
||||
if ( marker.getMObject() instanceof IMogoMarker ) {
|
||||
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getMObject() );
|
||||
IMogoInfoWindowAdapter delegate = mogoMarker.getInfoWindowAdapter();
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
|
||||
@@ -130,13 +131,6 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom(int var1) {
|
||||
if (mClient != null) {
|
||||
mClient.setLockZoom(var1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview(Rect bounds) {
|
||||
if (mClient != null) {
|
||||
@@ -245,14 +239,6 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
if (mClient != null) {
|
||||
return mClient.getCurrentUiMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation(Location location) {
|
||||
if (mClient != null) {
|
||||
@@ -310,8 +296,13 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedLimmit(double lon, double lat, float angle) {
|
||||
return mClient.getSpeedLimmit(lon, lat, angle);
|
||||
public int getLimitSpeed(double lon, double lat, float angle) {
|
||||
return mClient.getLimitSpeed(lon, lat, angle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CenterLine getCenterLineInfo(double lon, double lat, float angle) {
|
||||
return mClient.getCenterLineInfo(lon, lat, angle);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,9 +5,9 @@ import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.search.geo.MogoGeocodeAddress;
|
||||
@@ -193,20 +193,6 @@ public class ObjectUtils {
|
||||
return new LonLatPoint(latLng.lon, latLng.lat);
|
||||
}
|
||||
|
||||
// public static NaviLatLng fromMogoAsNavi( MogoLatLng latLng ) {
|
||||
// if ( latLng == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// return new NaviLatLng( latLng.lat, latLng.lng );
|
||||
// }
|
||||
|
||||
// public static LatLng fromMogo2( MogoLatLng latLng ) {
|
||||
// if ( latLng == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// return new LatLng( latLng.lat, latLng.lng );
|
||||
// }
|
||||
|
||||
public static MogoLatLng fromAMap(LonLatPoint point) {
|
||||
if (point == null) {
|
||||
return null;
|
||||
@@ -214,13 +200,6 @@ public class ObjectUtils {
|
||||
return new MogoLatLng(point.getLatitude(), point.getLongitude());
|
||||
}
|
||||
|
||||
// public static MogoLatLng CameraPositionfromAMap( LatLng point ) {
|
||||
// if ( point == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// return new MogoLatLng( point.latitude, point.longitude );
|
||||
// }
|
||||
|
||||
public static GeocodeQuery fromMogo(MogoGeocodeQuery query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
@@ -237,44 +216,6 @@ public class ObjectUtils {
|
||||
return q;
|
||||
}
|
||||
|
||||
// public static MogoAoiItem fromAMap( AoiItem amapItem ) {
|
||||
// if ( amapItem == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoAoiItem mogoAoiItem = new MogoAoiItem();
|
||||
// mogoAoiItem.setAdCode( amapItem.getAdCode() );
|
||||
// mogoAoiItem.setAoiArea( amapItem.getAoiArea() );
|
||||
// mogoAoiItem.setAoiCenterPoint( fromAMap( amapItem.getAoiCenterPoint() ) );
|
||||
// mogoAoiItem.setAoiId( amapItem.getAoiId() );
|
||||
// mogoAoiItem.setAoiName( amapItem.getAoiName() );
|
||||
// return mogoAoiItem;
|
||||
// }
|
||||
//
|
||||
// public static MogoBusinessArea fromAMap( BusinessArea amapItem ) {
|
||||
// if ( amapItem == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoBusinessArea mogoBusinessArea = new MogoBusinessArea();
|
||||
// mogoBusinessArea.setCenterPoint( fromAMap( amapItem.getCenterPoint() ) );
|
||||
// mogoBusinessArea.setName( amapItem.getName() );
|
||||
// return mogoBusinessArea;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static MogoCrossroad fromAMap( Crossroad amapItem ) {
|
||||
// if ( amapItem == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoCrossroad mogoCrossroad = new MogoCrossroad();
|
||||
// mogoCrossroad.setDirection( amapItem.getDirection() );
|
||||
// mogoCrossroad.setDistance( amapItem.getDistance() );
|
||||
// mogoCrossroad.setFirstRoadId( amapItem.getFirstRoadId() );
|
||||
// mogoCrossroad.setFirstRoadName( amapItem.getFirstRoadName() );
|
||||
// mogoCrossroad.setSecondRoadId( amapItem.getSecondRoadId() );
|
||||
// mogoCrossroad.setSecondRoadName( amapItem.getSecondRoadName() );
|
||||
// return mogoCrossroad;
|
||||
// }
|
||||
|
||||
public static MogoGeocodeAddress fromAMap(GeocodeAddress address) {
|
||||
if (address == null) {
|
||||
return null;
|
||||
@@ -311,77 +252,6 @@ public class ObjectUtils {
|
||||
return mogoGeocodeResult;
|
||||
}
|
||||
|
||||
// public static MogoIndoorData fromAMap( IndoorData data ) {
|
||||
// if ( data == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoIndoorData mogoIndoorData = new MogoIndoorData();
|
||||
// mogoIndoorData.setFloor( data.getFloor() );
|
||||
// mogoIndoorData.setFloorName( data.getFloorName() );
|
||||
// mogoIndoorData.setPoiId( data.getPoiId() );
|
||||
// return mogoIndoorData;
|
||||
// }
|
||||
//
|
||||
// public static MogoPhoto fromAMap( Photo photo ) {
|
||||
// if ( photo == null ) {f
|
||||
// return null;
|
||||
// }
|
||||
// MogoPhoto mogoPhoto = new MogoPhoto();
|
||||
// mogoPhoto.setTitle( photo.getTitle() );
|
||||
// mogoPhoto.setUrl( photo.getUrl() );
|
||||
// return mogoPhoto;
|
||||
// }
|
||||
//
|
||||
// public static MogoPoiItemExtension fromAMap( PoiItemExtension poiItemExtension ) {
|
||||
// if ( poiItemExtension == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoPoiItemExtension mogoPoiItemExtension = new MogoPoiItemExtension();
|
||||
// mogoPoiItemExtension.setOpentime( poiItemExtension.getOpentime() );
|
||||
// mogoPoiItemExtension.setRating( poiItemExtension.getmRating() );
|
||||
// return mogoPoiItemExtension;
|
||||
// }
|
||||
//
|
||||
// public static MogoRegeocodeRoad fromAMap( RegeocodeRoad regeocodeRoad ) {
|
||||
// if ( regeocodeRoad == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoRegeocodeRoad mogoRegeocodeRoad = new MogoRegeocodeRoad();
|
||||
// mogoRegeocodeRoad.setDirection( regeocodeRoad.getDirection() );
|
||||
// mogoRegeocodeRoad.setDistance( regeocodeRoad.getDistance() );
|
||||
// mogoRegeocodeRoad.setId( regeocodeRoad.getId() );
|
||||
// mogoRegeocodeRoad.setName( regeocodeRoad.getName() );
|
||||
// mogoRegeocodeRoad.setPoint( fromAMap( regeocodeRoad.getLatLngPoint() ) );
|
||||
// return mogoRegeocodeRoad;
|
||||
// }
|
||||
//
|
||||
// public static MogoStreetNumber fromAMap( StreetNumber streetNumber ) {
|
||||
// if ( streetNumber == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoStreetNumber mogoStreetNumber = new MogoStreetNumber();
|
||||
// mogoStreetNumber.setDirection( streetNumber.getDirection() );
|
||||
// mogoStreetNumber.setDistance( streetNumber.getDistance() );
|
||||
// mogoStreetNumber.setLatLonPoint( fromAMap( streetNumber.getLatLonPoint() ) );
|
||||
// mogoStreetNumber.setNumber( streetNumber.getNumber() );
|
||||
// mogoStreetNumber.setStreet( streetNumber.getStreet() );
|
||||
// return mogoStreetNumber;
|
||||
// }
|
||||
|
||||
// public static MogoSubPoiItem fromAMap( SubPoiItem subPoiItem ) {
|
||||
// if ( subPoiItem == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoSubPoiItem mogoSubPoiItem = new MogoSubPoiItem();
|
||||
// mogoSubPoiItem.setDistance( subPoiItem.getDistance() );
|
||||
// mogoSubPoiItem.setPoiId( subPoiItem.getPoiId() );
|
||||
// mogoSubPoiItem.setPoint( fromAMap( subPoiItem.getLatLonPoint() ) );
|
||||
// mogoSubPoiItem.setSnippet( subPoiItem.getSnippet() );
|
||||
// mogoSubPoiItem.setSubName( mogoSubPoiItem.getSubName() );
|
||||
// mogoSubPoiItem.setSubTypeDes( mogoSubPoiItem.getSubTypeDes() );
|
||||
// mogoSubPoiItem.setTitle( mogoSubPoiItem.getTitle() );
|
||||
// return mogoSubPoiItem;
|
||||
// }
|
||||
|
||||
public static MogoPoiItem fromAMap(PoiItem poiItem) {
|
||||
if (poiItem == null) {
|
||||
@@ -398,20 +268,7 @@ public class ObjectUtils {
|
||||
mogoPoiItem.setEmail(poiItem.getEmail());
|
||||
mogoPoiItem.setEnter(fromAMap(poiItem.getEnter()));
|
||||
mogoPoiItem.setExit(fromAMap(poiItem.getExit()));
|
||||
// mogoPoiItem.setIndoorData( fromAMap( poiItem.getIndoorData() ) );
|
||||
mogoPoiItem.setParkingType(poiItem.getParkingType());
|
||||
// mogoPoiItem.setIndoorMap( poiItem.isIndoorMap() );
|
||||
// if ( poiItem.getPhotos() != null ) {
|
||||
// List< MogoPhoto > mogoPhotos = new ArrayList<>();
|
||||
// for ( Photo photo : poiItem.getPhotos() ) {
|
||||
// MogoPhoto mogoPhoto = fromAMap( photo );
|
||||
// if ( mogoPhoto != null ) {
|
||||
// mogoPhotos.add( mogoPhoto );
|
||||
// }
|
||||
// }
|
||||
// mogoPoiItem.setPhotos( mogoPhotos );
|
||||
// }
|
||||
// mogoPoiItem.setPoiExtension( fromAMap( poiItem.getPoiExtension() ) );
|
||||
mogoPoiItem.setPoiId(poiItem.getPoiId());
|
||||
mogoPoiItem.setPoint(fromAMap(poiItem.getLonLatPoint()));
|
||||
mogoPoiItem.setPostcode(poiItem.getPostcode());
|
||||
@@ -419,16 +276,6 @@ public class ObjectUtils {
|
||||
mogoPoiItem.setProvinceName(poiItem.getProvinceName());
|
||||
mogoPoiItem.setShopID(poiItem.getShopID());
|
||||
mogoPoiItem.setSnippet(poiItem.getSnippet());
|
||||
// if ( poiItem.getSubPois() != null ) {
|
||||
// List< MogoSubPoiItem > mogoSubPoiItems = new ArrayList<>();
|
||||
// for ( SubPoiItem subPois : poiItem.getSubPois() ) {
|
||||
// MogoSubPoiItem mogoSubPoiItem = fromAMap( subPois );
|
||||
// if ( mogoPoiItem != null ) {
|
||||
// mogoSubPoiItems.add( mogoSubPoiItem );
|
||||
// }
|
||||
// }
|
||||
// mogoPoiItem.setSubPois( mogoSubPoiItems );
|
||||
// }
|
||||
mogoPoiItem.setTel(poiItem.getTel());
|
||||
mogoPoiItem.setTypeCode(poiItem.getTypeCode());
|
||||
mogoPoiItem.setTitle(poiItem.getTitle());
|
||||
@@ -443,43 +290,12 @@ public class ObjectUtils {
|
||||
}
|
||||
MogoRegeocodeAddress mogoRegeocodeAddress = new MogoRegeocodeAddress();
|
||||
mogoRegeocodeAddress.setAdCode(regeocodeAddress.getAdCode());
|
||||
// if ( regeocodeAddress.getAois() != null ) {
|
||||
// List< MogoAoiItem > items = new ArrayList<>();
|
||||
// for ( AoiItem aois : regeocodeAddress.getAois() ) {
|
||||
// final MogoAoiItem mogoAoiItem = fromAMap( aois );
|
||||
// if ( mogoAoiItem != null ) {
|
||||
// items.add( mogoAoiItem );
|
||||
// }
|
||||
// }
|
||||
// mogoRegeocodeAddress.setAois( items );
|
||||
// }
|
||||
|
||||
mogoRegeocodeAddress.setBuilding(regeocodeAddress.getBuilding());
|
||||
// if ( regeocodeAddress.getBusinessAreas() != null ) {
|
||||
// List< MogoBusinessArea > mogoBusinessAreas = new ArrayList<>();
|
||||
// for ( BusinessArea businessArea : regeocodeAddress.getBusinessAreas() ) {
|
||||
// MogoBusinessArea mogoBusinessArea = fromAMap( businessArea );
|
||||
// if ( mogoBusinessArea != null ) {
|
||||
// mogoBusinessAreas.add( mogoBusinessArea );
|
||||
// }
|
||||
// }
|
||||
// mogoRegeocodeAddress.setBusinessAreas( mogoBusinessAreas );
|
||||
// }
|
||||
|
||||
mogoRegeocodeAddress.setCity(regeocodeAddress.getCity());
|
||||
mogoRegeocodeAddress.setCityCode(regeocodeAddress.getCityCode());
|
||||
mogoRegeocodeAddress.setCountry(regeocodeAddress.getCountry());
|
||||
// if ( regeocodeAddress.getCrossroads() != null ) {
|
||||
// List< MogoCrossroad > mogoCrossroads = new ArrayList<>();
|
||||
// for ( Crossroad crossroad : regeocodeAddress.getCrossroads() ) {
|
||||
//
|
||||
// MogoCrossroad mogoCrossroad = fromAMap( crossroad );
|
||||
// if ( mogoCrossroad != null ) {
|
||||
// mogoCrossroads.add( mogoCrossroad );
|
||||
// }
|
||||
// }
|
||||
// mogoRegeocodeAddress.setCrossroads( mogoCrossroads );
|
||||
// }
|
||||
mogoRegeocodeAddress.setDistrict(regeocodeAddress.getDistrict());
|
||||
mogoRegeocodeAddress.setFormatAddress(regeocodeAddress.getFormatAddress());
|
||||
mogoRegeocodeAddress.setNeighborhood(regeocodeAddress.getNeighborhood());
|
||||
@@ -493,17 +309,6 @@ public class ObjectUtils {
|
||||
mogoRegeocodeAddress.setPois(mogoPoiItems);
|
||||
}
|
||||
mogoRegeocodeAddress.setProvince(regeocodeAddress.getProvince());
|
||||
// if ( regeocodeAddress.getRoads() != null ) {
|
||||
// List< MogoRegeocodeRoad > mogoRegeocodeRoads = new ArrayList<>();
|
||||
// for ( RegeocodeRoad road : regeocodeAddress.getRoads() ) {
|
||||
// MogoRegeocodeRoad mogoRegeocodeRoad = fromAMap( road );
|
||||
// if ( mogoRegeocodeRoad != null ) {
|
||||
// mogoRegeocodeRoads.add( mogoRegeocodeRoad );
|
||||
// }
|
||||
// }
|
||||
// mogoRegeocodeAddress.setRoads( mogoRegeocodeRoads );
|
||||
// }
|
||||
// mogoRegeocodeAddress.setStreetNumber( fromAMap( regeocodeAddress.getStreetNumber() ) );
|
||||
mogoRegeocodeAddress.setTowncode(regeocodeAddress.getTowncode());
|
||||
mogoRegeocodeAddress.setTownship(regeocodeAddress.getTownship());
|
||||
return mogoRegeocodeAddress;
|
||||
@@ -544,23 +349,12 @@ public class ObjectUtils {
|
||||
return mogoTip;
|
||||
}
|
||||
|
||||
// public static MogoPoi fromAMap( Poi poi ) {
|
||||
// if ( poi == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoPoi mogoPoi = new MogoPoi();
|
||||
// mogoPoi.setCoordinate( fromAMap( poi.getCoordinate() ) );
|
||||
// mogoPoi.setName( poi.getName() );
|
||||
// mogoPoi.setPoiId( poi.getPoiId() );
|
||||
// return mogoPoi;
|
||||
// }
|
||||
|
||||
public static MogoPoiSearchQuery fromAMap(Query query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery(query.getKeyword(), query.getCategory(), query.getCity());
|
||||
// mogoPoiSearchQuery.setBuilding( query.getBuilding() );
|
||||
mogoPoiSearchQuery.setCityLimit(query.getCityLimit());
|
||||
mogoPoiSearchQuery.setDistanceSort(query.getDistanceSort());
|
||||
mogoPoiSearchQuery.setLocation(fromAMap(query.getLocation()));
|
||||
@@ -575,9 +369,9 @@ public class ObjectUtils {
|
||||
}
|
||||
Query psq = new Query(query.getQuery(), "", "");
|
||||
String category = getCategory(query.getQuery());
|
||||
if (!category.equals(""))
|
||||
if (!category.equals("")) {
|
||||
psq = new Query("", "", getCategory(query.getQuery()));
|
||||
// psq.setBuilding( query.getBuilding() );
|
||||
}
|
||||
psq.setCityLimit(query.isCityLimit());
|
||||
psq.setDistanceSort(query.isDistanceSort());
|
||||
psq.setLocation(fromMogo(query.getLocation()));
|
||||
@@ -673,11 +467,6 @@ public class ObjectUtils {
|
||||
if (options.getColorValues() != null) {
|
||||
target.colorValues(options.getColorValues());
|
||||
}
|
||||
// target.transparency( options.getTransparency() );
|
||||
// target.aboveMaskLayer( options.isAboveMaskLayer() );
|
||||
// target.lineCapType( PolylineOptions.LineCapType.LineCapRound );
|
||||
// target.lineJoinType( PolylineOptions.LineJoinType.LineJoinRound );
|
||||
// target.setDottedLineType( PolylineOptions.DOTTEDLINE_TYPE_CIRCLE );
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -704,4 +493,35 @@ public class ObjectUtils {
|
||||
}
|
||||
return category;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换对象
|
||||
*
|
||||
* @return 转换后的对象
|
||||
*/
|
||||
public static CenterLine transformCenterLine(com.zhidaoauto.map.sdk.open.road.CenterLine centerLine) {
|
||||
CenterLine resultCenterLine = null;
|
||||
if (centerLine != null) {
|
||||
resultCenterLine.setId(centerLine.id);
|
||||
resultCenterLine.setLane_id(centerLine.lane_id);
|
||||
resultCenterLine.setAngle(centerLine.angle);
|
||||
resultCenterLine.setRoad_id(centerLine.road_id);
|
||||
resultCenterLine.setTile_id(centerLine.tile_id);
|
||||
ArrayList<com.mogo.eagle.core.data.map.LonLatPoint> arrayList = new ArrayList<>();
|
||||
for (com.zhidaoauto.map.sdk.open.query.LonLatPoint point : centerLine.points) {
|
||||
com.mogo.eagle.core.data.map.LonLatPoint lonLatPoint = new com.mogo.eagle.core.data.map.LonLatPoint();
|
||||
lonLatPoint.setAltitude(point.altitude);
|
||||
lonLatPoint.setAngle(point.angle);
|
||||
lonLatPoint.setDistance(point.distance);
|
||||
lonLatPoint.setLatitude(point.latitude);
|
||||
lonLatPoint.setLongitude(point.longitude);
|
||||
lonLatPoint.setProvider(point.provider);
|
||||
lonLatPoint.setSpeed(point.speed);
|
||||
lonLatPoint.setDuration(point.duration);
|
||||
arrayList.add(lonLatPoint);
|
||||
}
|
||||
resultCenterLine.setPoints(arrayList);
|
||||
}
|
||||
return resultCenterLine;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user