[dev_arch_opt_3.0]
[Change] [1、删除废弃地图接口] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -6,9 +6,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.location.ALocationClient;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.search.PoiSearchClient;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.uicontroller.AMapUIController;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
@@ -35,11 +32,6 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IMogoPoiSearch getPoiSearchClient(Context context, MogoPoiSearchQuery query) {
|
||||
return new PoiSearchClient(context, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapView getMapView(Context context) {
|
||||
// MapParams mapParams = MapParams.Companion.init();
|
||||
|
||||
@@ -4,8 +4,6 @@ import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
|
||||
@@ -40,10 +38,6 @@ class MogoMapDelegateFactory {
|
||||
return getApiBuilder().getMapUIController();
|
||||
}
|
||||
|
||||
public static IMogoPoiSearch getPoiSearchClientDelegate(Context context, MogoPoiSearchQuery query) {
|
||||
return getApiBuilder().getPoiSearchClient(context, query);
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
getApiBuilder().destroy();
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.MogoSearchBound;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoPoiSearch implements IMogoPoiSearch {
|
||||
|
||||
private IMogoPoiSearch mDelegate;
|
||||
|
||||
public MogoPoiSearch( Context context, MogoPoiSearchQuery query ) {
|
||||
mDelegate = MogoMapDelegateFactory.getPoiSearchClientDelegate( context, query );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoiSearchListener( IMogoPoiSearchListener listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setPoiSearchListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchPOIAsyn() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.searchPOIAsyn();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoPoiResult searchPOI() throws MogoMapException {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.searchPOI();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuery( MogoPoiSearchQuery query ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setQuery( query );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoPoiItem searchPOIId( String poiId ) throws MogoMapException {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.searchPOIId( poiId );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchPOIIdAsyn( String poiId ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.searchPOIIdAsyn( poiId );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBound( MogoSearchBound bound ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setBound( bound );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.destroy();
|
||||
}
|
||||
mDelegate = null;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.map.utils.ObjectUtils;
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.MarkerAnimationListener;
|
||||
@@ -17,14 +14,11 @@ import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerScaleAnimation;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerTranslateAnimation;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
@@ -96,12 +90,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideInfoWindow() {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.hideInfoWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha( float alpha ) {
|
||||
@@ -110,20 +98,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchor( float anchorU, float anchorV ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setAnchor( anchorU, anchorV );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDraggable( boolean paramBoolean ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setDraggable( paramBoolean );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon( Bitmap icon ) {
|
||||
if ( icon == null || icon.isRecycled() ) {
|
||||
@@ -154,17 +128,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoWindowEnable( boolean enabled ) {
|
||||
if ( mMarker != null ) {
|
||||
if ( enabled ) {
|
||||
mMarker.showInfoWindow();
|
||||
} else {
|
||||
mMarker.hideInfoWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerOptions( MogoMarkerOptions opt ) {
|
||||
|
||||
@@ -188,12 +151,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
return mObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeriod( int period ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setPeriod( period );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition( double lat, double lng ) {
|
||||
@@ -218,13 +175,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSnippet( String snippet ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setSnippet( snippet );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle( String title ) {
|
||||
if ( mMarker != null ) {
|
||||
@@ -246,27 +196,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZIndex( int zIndex ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setZIndex( zIndex );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showInfoWindow() {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.showInfoWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMarkerAssInfo() {
|
||||
if ( mMarker != null ) {
|
||||
return mMarker.getMarkeOptions().getAssInfo();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
|
||||
@@ -278,26 +207,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
return mMogoMarkerClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoWindowAdapter( IMogoInfoWindowAdapter adapter ) {
|
||||
mMogoInfoWindowAdapter = adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoInfoWindowAdapter getInfoWindowAdapter() {
|
||||
return mMogoInfoWindowAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerIconView( IMogoMarkerIconViewCreator creator ) {
|
||||
if ( creator != null ) {
|
||||
View iconView = creator.createView( this );
|
||||
if ( iconView != null ) {
|
||||
mMarker.setIcon( iconView );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDestroyed() {
|
||||
return mIsDestroy;
|
||||
@@ -319,13 +233,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionByPixels( Point position ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setPosition( MapTools.INSTANCE.fromScreenLocation( position ) );
|
||||
}
|
||||
}
|
||||
|
||||
public Marker getMarker() {
|
||||
return mMarker;
|
||||
}
|
||||
@@ -335,13 +242,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
return mMogoMarkerOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScaleAnimation( float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
startScaleAnimation( fromX, toX, fromY, toY, duration, interpolator, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, final OnMarkerAnimationListener listener ) {
|
||||
@@ -384,55 +284,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
mMarker.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJumpAnimation(float high, long duration, Interpolator interpolator, final OnMarkerAnimationListener listener ) {
|
||||
if ( isDestroyed() || high <= 0.0f || interpolator == null || duration < 0 ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final LonLatPoint latLng = ObjectUtils.fromMogo( getPosition() );
|
||||
// Point point = AMapWrapper.getAMap().getProjection().toScreenLocation(latLng);
|
||||
// point.y -= WindowUtils.dip2px(AbsMogoApplication.getApp(), high);
|
||||
// LatLng target = AMapWrapper.getAMap().getProjection().fromScreenLocation(point);
|
||||
//使用TranslateAnimation,填写一个需要移动的目标点
|
||||
MarkerTranslateAnimation animation = new MarkerTranslateAnimation( latLng );
|
||||
// animation.setInterpolator(interpolator);
|
||||
animation.setAnimationListener( new MarkerAnimationListener() {
|
||||
@Override
|
||||
public void onAnimationEnd( @NotNull Animation animation ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
listener.onAnimEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat( @NotNull Animation animation ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart( @NotNull Animation animation ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
listener.onAnimStart();
|
||||
}
|
||||
}
|
||||
} );
|
||||
//整个移动所需要的时间
|
||||
animation.setDuration( duration * 1000 );
|
||||
//设置动画
|
||||
mMarker.setTranslateAnimation( animation );
|
||||
mMarker.startAnimation();
|
||||
} catch ( Exception e ) {
|
||||
CallerLogger.INSTANCE.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickable( boolean clickable ) {
|
||||
if ( mMarker != null ) {
|
||||
@@ -440,49 +291,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSmooth( List< MogoLatLng > points, int duration ) {
|
||||
startSmoothInMs( points, duration * 1000 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSmoothInMs( List< MogoLatLng > points, long duration ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mMarker == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( points == null || points.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList< LonLatPoint > newPoints = new ArrayList<>();
|
||||
for ( int i = 0; i < points.size(); i++ ) {
|
||||
LonLatPoint point = ObjectUtils.fromMogo( points.get( i ) );
|
||||
if ( point == null ) {
|
||||
continue;
|
||||
}
|
||||
newPoints.add( point );
|
||||
}
|
||||
if ( newPoints.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
mMarker.startSmooth( newPoints, ( int ) duration );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScaleAnimationWithAlpha( float fromX, float toX, float fromY, float toY, float fromAlpha, float toAlpha, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfoWindowShowing() {
|
||||
return mMarker.isInfoWindowShown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGps( boolean isGps ) {
|
||||
@@ -491,36 +299,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String use3DResource( int model3D ) {
|
||||
try {
|
||||
mMarker.marker3DIcon( model3D );
|
||||
return mMarker.getMarkeOptions().getMarkerIconName();
|
||||
} catch ( Exception e ) {
|
||||
CallerLogger.INSTANCE.e( TAG, e, "use3DResource" );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use3DResource( String resName ) {
|
||||
try {
|
||||
mMarker.getMarkeOptions().setVrIcon( true );
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) );
|
||||
} catch ( Exception e ) {
|
||||
CallerLogger.INSTANCE.e( TAG, e, "use3DResource" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use2DResource( String resName ) {
|
||||
try {
|
||||
mMarker.getMarkeOptions().setVrIcon( false );
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) );
|
||||
} catch ( Exception e ) {
|
||||
CallerLogger.INSTANCE.e( TAG, e, "use3DResource" );
|
||||
}
|
||||
}
|
||||
|
||||
private String mLastAnchorColor = "";
|
||||
|
||||
@@ -539,32 +317,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
mLastAnchorColor = anchorColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInfoWindowView( View view ) {
|
||||
try {
|
||||
mMarker.setInfoWindowView( view );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInfoWindowView( String viewResName ) {
|
||||
try {
|
||||
mMarker.setMarkerInfoName( viewResName );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoWindowOffset( int offsetX, int offsetY ) {
|
||||
try {
|
||||
mMarker.setInfoWindowOffset( offsetX, offsetY );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDynamicAnchorPosition( MogoLatLng latLng, float angle, long duration ) {
|
||||
@@ -583,15 +335,4 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMarkerInfoResName() {
|
||||
if ( mMarker != null ) {
|
||||
try {
|
||||
return mMarker.getMarkeOptions().getMarkerInfoName();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
package com.mogo.map.search;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.MogoSearchBound;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.utils.ObjectUtils;
|
||||
import com.zhidaoauto.map.sdk.open.query.OnPoiSearchListener;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiItem;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiSearch;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiSearchResult;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* poi搜索自研实现
|
||||
* <p>
|
||||
* 错误码对照表:https://lbs.amap.com/api/android-sdk/guide/map-tools/error-code
|
||||
*/
|
||||
public class PoiSearchClient implements IMogoPoiSearch, OnPoiSearchListener {
|
||||
|
||||
private static final String TAG = "PoiSearchClient";
|
||||
|
||||
private MogoPoiSearchQuery mQuery;
|
||||
private PoiSearch mClient;
|
||||
private IMogoPoiSearchListener mListener;
|
||||
private MogoSearchBound mBound;
|
||||
|
||||
public PoiSearchClient( Context context, MogoPoiSearchQuery query ) {
|
||||
try {
|
||||
mQuery = query;
|
||||
mClient = new PoiSearch( context, ObjectUtils.fromMogo( mQuery ) );
|
||||
mClient.setOnPoiSearchListener( this );
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoiSearchListener( IMogoPoiSearchListener listener ) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchPOIAsyn() {
|
||||
if ( mClient != null ) {
|
||||
mClient.searchPOIAsyn();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoPoiResult searchPOI() throws MogoMapException {
|
||||
if ( mClient != null ) {
|
||||
try {
|
||||
PoiSearchResult search = mClient.searchPOI();
|
||||
return ObjectUtils.fromAMap( search );
|
||||
} catch ( Exception e ) {
|
||||
throw new MogoMapException( e );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuery( MogoPoiSearchQuery query ) {
|
||||
mQuery = query;
|
||||
if ( mClient != null ) {
|
||||
mClient.setQuery( ObjectUtils.fromMogo( mQuery ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoPoiItem searchPOIId( String poiId ) throws MogoMapException {
|
||||
if ( mClient != null ) {
|
||||
try {
|
||||
PoiItem poiItem = mClient.searchPOIId( poiId );
|
||||
return ObjectUtils.fromAMap( poiItem );
|
||||
} catch ( Exception e ) {
|
||||
throw new MogoMapException( e );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchPOIIdAsyn( String poiId ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.searchPOIIdAsyn( poiId );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBound( MogoSearchBound bound ) {
|
||||
mBound = bound;
|
||||
if ( mClient != null ) {
|
||||
mClient.setBound( ObjectUtils.fromMogo( mBound ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPoiSearched( PoiSearchResult poiResult, int errorCode ) {
|
||||
if ( errorCode != 0 ) {
|
||||
CallerLogger.INSTANCE.e( TAG, "errorcode is %d", errorCode );
|
||||
}
|
||||
if ( mListener != null ) {
|
||||
mListener.onPoiSearched( ObjectUtils.fromAMap( poiResult ), errorCode );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPoiItemSearched( PoiItem poiItem, int errorCode ) {
|
||||
if ( errorCode != 0 ) {
|
||||
CallerLogger.INSTANCE.e( TAG, "errorcode is %d", errorCode );
|
||||
}
|
||||
if ( mListener != null ) {
|
||||
mListener.onPoiItemSearched( ObjectUtils.fromAMap( poiItem ), errorCode );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
mQuery = null;
|
||||
mClient = null;
|
||||
mListener = null;
|
||||
mBound = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPoiCategorySearched(@Nullable List list, int errorCode) {
|
||||
}
|
||||
}
|
||||
@@ -10,18 +10,6 @@ import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.search.geo.MogoGeocodeAddress;
|
||||
import com.mogo.map.search.geo.MogoGeocodeResult;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeAddress;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult;
|
||||
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
import com.mogo.map.search.inputtips.MogoTip;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.MogoSearchBound;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
|
||||
@@ -29,20 +17,7 @@ import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.query.GeocodeAddress;
|
||||
import com.zhidaoauto.map.sdk.open.query.GeocodeQuery;
|
||||
import com.zhidaoauto.map.sdk.open.query.GeocodeResult;
|
||||
import com.zhidaoauto.map.sdk.open.query.InputtipsQuery;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiItem;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiSearchItem;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiSearchResult;
|
||||
import com.zhidaoauto.map.sdk.open.query.Query;
|
||||
import com.zhidaoauto.map.sdk.open.query.RegeocodeAddress;
|
||||
import com.zhidaoauto.map.sdk.open.query.RegeocodeQuery;
|
||||
import com.zhidaoauto.map.sdk.open.query.RegeocodeResult;
|
||||
import com.zhidaoauto.map.sdk.open.query.SearchBound;
|
||||
import com.zhidaoauto.map.sdk.open.query.Tip;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -218,253 +193,6 @@ public class ObjectUtils {
|
||||
return new MogoLatLng(point.getLatitude(), point.getLongitude());
|
||||
}
|
||||
|
||||
public static GeocodeQuery fromMogo(MogoGeocodeQuery query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
GeocodeQuery q = new GeocodeQuery(query.getLocationName(), query.getCity());
|
||||
return q;
|
||||
}
|
||||
|
||||
public static RegeocodeQuery fromMogo(MogoRegeocodeQuery query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
RegeocodeQuery q = new RegeocodeQuery(fromMogo(query.getPoint()), 1000);
|
||||
return q;
|
||||
}
|
||||
|
||||
public static MogoGeocodeAddress fromAMap(GeocodeAddress address) {
|
||||
if (address == null) {
|
||||
return null;
|
||||
}
|
||||
MogoGeocodeAddress mogoGeocodeAddress = new MogoGeocodeAddress();
|
||||
mogoGeocodeAddress.setAdcode(address.getAdcode());
|
||||
mogoGeocodeAddress.setBuilding(address.getBuilding());
|
||||
mogoGeocodeAddress.setCity(address.getCity());
|
||||
mogoGeocodeAddress.setDistrict(address.getDistrict());
|
||||
mogoGeocodeAddress.setFormatAddress(address.getFormatAddress());
|
||||
mogoGeocodeAddress.setLatlng(fromAMap(address.getLonlat()));
|
||||
mogoGeocodeAddress.setLevel(address.getLevel());
|
||||
mogoGeocodeAddress.setNeighborhood(address.getNeighborhood());
|
||||
mogoGeocodeAddress.setProvince(address.getProvince());
|
||||
mogoGeocodeAddress.setTownship(address.getTownship());
|
||||
return mogoGeocodeAddress;
|
||||
}
|
||||
|
||||
public static MogoGeocodeResult fromAMap(GeocodeResult result) {
|
||||
if (result == null || result.getGeocodeAddressList() == null) {
|
||||
return null;
|
||||
}
|
||||
MogoGeocodeResult mogoGeocodeResult = new MogoGeocodeResult();
|
||||
final List<MogoGeocodeAddress> addresses = new ArrayList<>();
|
||||
List<GeocodeAddress> list = result.getGeocodeAddressList();
|
||||
for (GeocodeAddress geocodeAddress : list) {
|
||||
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap(geocodeAddress);
|
||||
if (mogoGeocodeAddress != null) {
|
||||
addresses.add(mogoGeocodeAddress);
|
||||
}
|
||||
}
|
||||
|
||||
mogoGeocodeResult.setAddresses(addresses);
|
||||
return mogoGeocodeResult;
|
||||
}
|
||||
|
||||
|
||||
public static MogoPoiItem fromAMap(PoiItem poiItem) {
|
||||
if (poiItem == null) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiItem mogoPoiItem = new MogoPoiItem();
|
||||
mogoPoiItem.setAdCode(poiItem.getAdCode());
|
||||
mogoPoiItem.setAdName(poiItem.getAdName());
|
||||
mogoPoiItem.setBusinessArea(poiItem.getBusinessArea());
|
||||
mogoPoiItem.setCityCode(poiItem.getCityCode());
|
||||
mogoPoiItem.setCityName(poiItem.getCityName());
|
||||
mogoPoiItem.setDirection(poiItem.getDirection());
|
||||
mogoPoiItem.setDistance(poiItem.getDistance());
|
||||
mogoPoiItem.setEmail(poiItem.getEmail());
|
||||
mogoPoiItem.setEnter(fromAMap(poiItem.getEnter()));
|
||||
mogoPoiItem.setExit(fromAMap(poiItem.getExit()));
|
||||
mogoPoiItem.setParkingType(poiItem.getParkingType());
|
||||
mogoPoiItem.setPoiId(poiItem.getPoiId());
|
||||
mogoPoiItem.setPoint(fromAMap(poiItem.getLonLatPoint()));
|
||||
mogoPoiItem.setPostcode(poiItem.getPostcode());
|
||||
mogoPoiItem.setProvinceCode(poiItem.getProvinceCode());
|
||||
mogoPoiItem.setProvinceName(poiItem.getProvinceName());
|
||||
mogoPoiItem.setShopID(poiItem.getShopID());
|
||||
mogoPoiItem.setSnippet(poiItem.getSnippet());
|
||||
mogoPoiItem.setTel(poiItem.getTel());
|
||||
mogoPoiItem.setTypeCode(poiItem.getTypeCode());
|
||||
mogoPoiItem.setTitle(poiItem.getTitle());
|
||||
mogoPoiItem.setTypeDes(poiItem.getTypeDes());
|
||||
mogoPoiItem.setWebsite(poiItem.getWebsite());
|
||||
return mogoPoiItem;
|
||||
}
|
||||
|
||||
public static MogoRegeocodeAddress fromAMap(RegeocodeAddress regeocodeAddress) {
|
||||
if (regeocodeAddress == null) {
|
||||
return null;
|
||||
}
|
||||
MogoRegeocodeAddress mogoRegeocodeAddress = new MogoRegeocodeAddress();
|
||||
mogoRegeocodeAddress.setAdCode(regeocodeAddress.getAdCode());
|
||||
|
||||
mogoRegeocodeAddress.setBuilding(regeocodeAddress.getBuilding());
|
||||
|
||||
mogoRegeocodeAddress.setCity(regeocodeAddress.getCity());
|
||||
mogoRegeocodeAddress.setCityCode(regeocodeAddress.getCityCode());
|
||||
mogoRegeocodeAddress.setCountry(regeocodeAddress.getCountry());
|
||||
mogoRegeocodeAddress.setDistrict(regeocodeAddress.getDistrict());
|
||||
mogoRegeocodeAddress.setFormatAddress(regeocodeAddress.getFormatAddress());
|
||||
mogoRegeocodeAddress.setNeighborhood(regeocodeAddress.getNeighborhood());
|
||||
if (regeocodeAddress.getPoiList() != null) {
|
||||
List<MogoPoiItem> mogoPoiItems = new ArrayList<>();
|
||||
List<PoiItem> list = regeocodeAddress.getPoiList();
|
||||
for (PoiItem pois : list) {
|
||||
MogoPoiItem mogoPoiItem = fromAMap(pois);
|
||||
mogoPoiItems.add(mogoPoiItem);
|
||||
}
|
||||
mogoRegeocodeAddress.setPois(mogoPoiItems);
|
||||
}
|
||||
mogoRegeocodeAddress.setProvince(regeocodeAddress.getProvince());
|
||||
mogoRegeocodeAddress.setTowncode(regeocodeAddress.getTowncode());
|
||||
mogoRegeocodeAddress.setTownship(regeocodeAddress.getTownship());
|
||||
return mogoRegeocodeAddress;
|
||||
}
|
||||
|
||||
public static MogoRegeocodeResult fromAMap(RegeocodeResult regeocodeResult) {
|
||||
if (regeocodeResult == null) {
|
||||
return null;
|
||||
}
|
||||
MogoRegeocodeResult mogoRegeocodeResult = new MogoRegeocodeResult();
|
||||
mogoRegeocodeResult.setRegeocodeAddress(fromAMap(regeocodeResult.getRegeocodeAddress()));
|
||||
return mogoRegeocodeResult;
|
||||
}
|
||||
|
||||
public static InputtipsQuery fromMogo(MogoInputtipsQuery query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
InputtipsQuery inputtipsQuery = new InputtipsQuery(query.getKeyword(), query.getCity());
|
||||
inputtipsQuery.setCityLimit(query.isCityLimit());
|
||||
inputtipsQuery.setLocation(fromMogo(query.getLocation()));
|
||||
inputtipsQuery.setType(query.getType());
|
||||
return inputtipsQuery;
|
||||
}
|
||||
|
||||
public static MogoTip fromAMap(Tip tip) {
|
||||
if (tip == null) {
|
||||
return null;
|
||||
}
|
||||
MogoTip mogoTip = new MogoTip();
|
||||
mogoTip.setAdCode(tip.getAdcode());
|
||||
mogoTip.setAddress(tip.getAddress());
|
||||
mogoTip.setDistrict(tip.getDistrict());
|
||||
mogoTip.setName(tip.getName());
|
||||
mogoTip.setPoiID(tip.getPoiID());
|
||||
mogoTip.setPoint(fromAMap(tip.getLatPoint()));
|
||||
mogoTip.setTypeCode(tip.getTypeCode());
|
||||
return mogoTip;
|
||||
}
|
||||
|
||||
|
||||
public static MogoPoiSearchQuery fromAMap(Query query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery(query.getKeyword(), query.getCategory(), query.getCity());
|
||||
mogoPoiSearchQuery.setCityLimit(query.getCityLimit());
|
||||
mogoPoiSearchQuery.setDistanceSort(query.getDistanceSort());
|
||||
mogoPoiSearchQuery.setLocation(fromAMap(query.getLocation()));
|
||||
mogoPoiSearchQuery.setPageNum(query.getPageNum());
|
||||
mogoPoiSearchQuery.setPageSize(query.getPageSize());
|
||||
return mogoPoiSearchQuery;
|
||||
}
|
||||
|
||||
public static Query fromMogo(MogoPoiSearchQuery query) {
|
||||
if (query == null || query.getQuery() == null) {
|
||||
return null;
|
||||
}
|
||||
Query psq = new Query(query.getQuery(), "", "");
|
||||
String category = getCategory(query.getQuery());
|
||||
if (!category.equals("")) {
|
||||
psq = new Query("", "", getCategory(query.getQuery()));
|
||||
}
|
||||
psq.setCityLimit(query.isCityLimit());
|
||||
psq.setDistanceSort(query.isDistanceSort());
|
||||
psq.setLocation(fromMogo(query.getLocation()));
|
||||
psq.setPageNum(query.getPageNum());
|
||||
psq.setPageSize(query.getPageSize());
|
||||
return psq;
|
||||
}
|
||||
|
||||
public static MogoSearchBound fromAMap(SearchBound bound) {
|
||||
if (bound == null) {
|
||||
return null;
|
||||
}
|
||||
if (bound.getShape() == SearchBound.BOUND_SHAPE) {
|
||||
return new MogoSearchBound(fromAMap(bound.getCenter()), bound.getRange(), bound.isDistanceSort());
|
||||
} else if (bound.getShape() == SearchBound.POLYGON_SHAPE) {
|
||||
return new MogoSearchBound(fromAMap(bound.getPolyGonList()));
|
||||
} else if (bound.getShape() == SearchBound.RECTANGLE_SHAPE) {
|
||||
return new MogoSearchBound(fromAMap(bound.getLowerLeft()), fromAMap(bound.getUpperRight()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<MogoLatLng> fromAMap(List<LonLatPoint> latLngs) {
|
||||
if (latLngs == null) {
|
||||
return null;
|
||||
}
|
||||
List<MogoLatLng> result = new ArrayList<>(latLngs.size());
|
||||
for (LonLatPoint latLng : latLngs) {
|
||||
result.add(fromAMap(latLng));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<LonLatPoint> fromMogo(List<MogoLatLng> latLngs) {
|
||||
if (latLngs == null) {
|
||||
return null;
|
||||
}
|
||||
List<LonLatPoint> result = new ArrayList<>(latLngs.size());
|
||||
for (MogoLatLng latLng : latLngs) {
|
||||
result.add(fromMogo(latLng));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static SearchBound fromMogo(MogoSearchBound bound) {
|
||||
if (bound == null) {
|
||||
return null;
|
||||
}
|
||||
if (bound.getShape() == MogoSearchBound.SHAPE_BOUND) {
|
||||
return new SearchBound(fromMogo(bound.getCenterPoint()), bound.getRadiusInMeters(), bound.isDistanceSort());
|
||||
} else if (bound.getShape() == MogoSearchBound.SHAPE_POLYGON) {
|
||||
return new SearchBound(fromMogo(bound.getPolyGonList()));
|
||||
} else if (bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE) {
|
||||
return new SearchBound(fromMogo(bound.getLowerLeft()), fromMogo(bound.getUpperRight()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MogoPoiResult fromAMap(PoiSearchResult result) {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiResult mogoPoiResult = new MogoPoiResult();
|
||||
if (result.getItems() != null) {
|
||||
final List<PoiSearchItem> poiItems = result.getItems();
|
||||
final ArrayList<MogoPoiItem> mogoPoiItems = new ArrayList<>(poiItems.size());
|
||||
for (PoiSearchItem poiItem : poiItems) {
|
||||
mogoPoiItems.add(fromAMap(poiItem.getPoi()));
|
||||
}
|
||||
mogoPoiResult.setPois(mogoPoiItems);
|
||||
}
|
||||
return mogoPoiResult;
|
||||
}
|
||||
|
||||
public static PolylineOptions fromMogo(MogoPolylineOptions options) {
|
||||
if (options == null) {
|
||||
return null;
|
||||
@@ -505,22 +233,6 @@ public class ObjectUtils {
|
||||
return new MapCameraPosition(fromAMap(position.getTarget()), position.getBearing(), position.getTilt(), position.getZoom());
|
||||
}
|
||||
|
||||
private static String getCategory(String key) {
|
||||
String category = "";
|
||||
if (key.equals("加油站")) {
|
||||
category = "6";
|
||||
} else if (key.equals("停车场")) {
|
||||
category = "12";
|
||||
} else if (key.equals("餐馆")) {
|
||||
category = "22";
|
||||
} else if (key.equals("洗车")) {
|
||||
category = "8";
|
||||
} else if (key.equals("厕所")) {
|
||||
|
||||
}
|
||||
return category;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换对象
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user