This commit is contained in:
wangcongtao
2019-12-27 19:56:30 +08:00
parent 522c5e2dbf
commit ae9ddcb369
308 changed files with 6608 additions and 607 deletions

View File

@@ -1,25 +0,0 @@
package com.mogo.map;
import android.os.Bundle;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 生命周期
*/
public interface ILifeCycle {
void onCreate( Bundle bundle );
void onResume();
void onPause();
void onDestroy();
void onSaveInstanceState( Bundle outState );
// mapview only.
void onLowMemory();
}

View File

@@ -1,101 +0,0 @@
package com.mogo.map;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import java.util.ArrayList;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 地图控制接口
*/
public interface IMogoMap {
/**
* 获取地图ui控制器可以控制内置ui缩放按钮、指北针等是否显示及部分手势滑动、双指缩放等是否可用。
*
* @return
*/
IUiSettings getUiSettings();
/**
* 在地图上添一个图片标记marker对象。
*
* @param tag 标识服务
* @param options
* @return
*/
IMogoMarker addMarker( String tag, MogoMarkerOptions options );
/**
* 在地图上添一组图片标记marker对象并设置是否改变地图状态以至于所有的marker对象都在当前地图可视区域范围内显示。
*
* @param tag 标识服务
* @param options
* @param moveToCenter
* @return
*/
ArrayList< IMogoMarker > addMarkers( String tag, ArrayList< MogoMarkerOptions > options, boolean moveToCenter );
/**
* 从地图上删除所有的overlaymarkercirclepolyline 等对象)。
*/
void clear();
/**
* 从地图上删除所有的覆盖物markercirclepolyline 等对象但myLocationOverlay内置定位覆盖物除外。
*
* @param isKeepMyLocationOverlay
*/
void clear( boolean isKeepMyLocationOverlay );
/**
* 设置屏幕上的某个像素点为地图中心点。
*
* @param x
* @param y
*/
void setPointToCenter( int x, int y );
/**
* 设置地图POI是否允许点击。
*
* @param touchPoiEnable
*/
void setTouchPoiEnable( boolean touchPoiEnable );
/**
* 设置是否打开交通路况图层。
*
* @param enable
*/
void setTrafficEnable( boolean enable );
/**
* 设置是否显示3D建筑物默认显示。
*
* @param enabled
*/
void showBuildings( boolean enabled );
/**
* 设置是否显示室内地图,默认不显示。
*
* @param enable
*/
void showIndoorMap( boolean enable );
/**
* 设置是否显示底图文字标注,默认显示。
*
* @param enable
*/
void showMapText( boolean enable );
/**
* 停止当前执行的改变地图状态的动画。
*/
void stopAnimation();
}

View File

@@ -1,21 +0,0 @@
package com.mogo.map;
import android.view.View;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 地图抽象
*/
public interface IMogoMapView extends ILifeCycle {
/**
* 获取地图实例
*
* @return 地图实例
*/
View getMapView();
IMogoMap getMap();
}

View File

@@ -1,68 +0,0 @@
package com.mogo.map;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 图层控制
*/
public interface IUiSettings {
/**
* 设置比例尺功能是否可用。
*/
void setScaleControlsEnabled( boolean enabled );
/**
* 这个方法设置了地图是否允许显示缩放按钮。如果允许,则在地图上显示。
*
* @param enabled
*/
void setZoomControlsEnabled( boolean enabled );
/**
* 这个方法设置了地图是否允许显示指南针
*
* @param enabled
*/
void setCompassEnabled( boolean enabled );
/**
* 设置定位按钮是否显示
*
* @param enabled
*/
void setMyLocationButtonEnabled( boolean enabled );
/**
* 这个方法设置了地图是否允许通过手势来移动。如果允许,则用户可以通过按住地图移动来改变可视区域。
* 如果禁止,则不支持此功能。 这个设置不会影响用户在程序里对地图的移动。 默认移动手势为可用。
*
* @param enabled
*/
void setScrollGesturesEnabled( boolean enabled );
/**
* 这个方法设置了地图是否允许通过手势来缩放。
* 如果允许,则用户可以通过双击地图或双指在地图上捏合来绽放地图。
* 这个设置不会影响缩放按钮的功能, 也不会影响程序对地图的操控。 默认允许通过手势缩放地图。
*
* @param enabled
*/
void setZoomGesturesEnabled( boolean enabled );
void setTiltGesturesEnabled( boolean enabled );
void setRotateGesturesEnabled( boolean enabled );
/**
* 设置当前地图是否支持所有手势。这个设置不影响用户在点击屏幕上的按钮(如缩放按钮)的效果,也不影响用户在程序里对地图的操作。
*
* @param enabled
*/
void setAllGesturesEnabled( boolean enabled );
void setIndoorSwitchEnabled( boolean enabled );
void setLogoEnable( boolean enabled );
}

View File

@@ -1,115 +0,0 @@
package com.mogo.map;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.mogo.utils.logger.Logger;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 对地图的基本抽象
*/
public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle {
private static final String TAG = "MogoBaseMapView";
private IMogoMapView mMapView;
public MogoBaseMapView( Context context ) {
this( context, null );
}
public MogoBaseMapView( Context context, @Nullable AttributeSet attrs ) {
this( context, attrs, 0 );
}
public MogoBaseMapView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
super( context, attrs, defStyleAttr );
init( context );
}
private void init( Context context ) {
mMapView = createMapView( context );
if ( mMapView != null ) {
final View mapView = mMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
MogoMap.getInstance().init( context, getMap() );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
}
/**
* 创建地图实例
*
* @param context
* @return
*/
protected abstract IMogoMapView createMapView( Context context );
@Override
public void onCreate( Bundle bundle ) {
if ( mMapView != null ) {
mMapView.onCreate( bundle );
}
}
@Override
public void onResume() {
if ( mMapView != null ) {
mMapView.onResume();
}
}
@Override
public void onPause() {
if ( mMapView != null ) {
mMapView.onPause();
}
}
@Override
public void onDestroy() {
if ( mMapView != null ) {
mMapView.onDestroy();
}
}
@Override
public void onSaveInstanceState( Bundle outState ) {
if ( mMapView != null ) {
mMapView.onSaveInstanceState( outState );
}
}
@Override
public void onLowMemory() {
if ( mMapView != null ) {
mMapView.onLowMemory();
}
}
public IMogoMap getMap() {
if ( mMapView != null ) {
return mMapView.getMap();
}
return null;
}
public IMogoMapView getMapView() {
return mMapView;
}
}

View File

@@ -1,9 +1,13 @@
package com.mogo.map.search.geo;
package com.mogo.map;
import android.content.Context;
import com.mogo.map.amap.search.GeocodeSearchClient;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.impl.amap.search.GeocodeSearchClient;
import com.mogo.map.search.geo.IMogoGeoSearch;
import com.mogo.map.search.geo.IMogoGeoSearchListener;
import com.mogo.map.search.geo.MogoGeocodeAddress;
import com.mogo.map.search.geo.MogoRegeocodeAddress;
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
@@ -59,4 +63,12 @@ public class MogoGeoSearch implements IMogoGeoSearch {
mDelegate.getFromLocationNameAsyn( query );
}
}
@Override
public void destroy() {
if ( mDelegate != null ) {
mDelegate.destroy();
}
mDelegate = null;
}
}

View File

@@ -0,0 +1,16 @@
package com.mogo.map;
import android.content.Context;
/**
* @author congtaowang
* @since 2019-12-26
* <p>
* 描述
*/
public class MogoInitor {
public static void init( Context context ) {
}
}

View File

@@ -1,13 +1,12 @@
package com.mogo.map.search.inputtips;
package com.mogo.map;
import android.content.Context;
import com.mogo.map.amap.search.InputtipsSearch;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.impl.amap.search.InputtipsSearch;
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-20
@@ -44,10 +43,10 @@ public class MogoInputtipsSearch implements IMogoInputtipsSearch {
}
@Override
public List< MogoTip > requestInputtips() throws MogoMapException {
public void destroy() {
if ( mDelegate != null ) {
return mDelegate.requestInputtips();
mDelegate.destroy();
}
return null;
mDelegate = null;
}
}

View File

@@ -1,49 +0,0 @@
package com.mogo.map;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 经纬度
*/
public class MogoLatLng implements Parcelable {
public final double lat;
public final double lng;
public MogoLatLng( double lat, double lng ) {
this.lat = lat;
this.lng = lng;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeDouble( this.lat );
dest.writeDouble( this.lng );
}
protected MogoLatLng( Parcel in ) {
this.lat = in.readDouble();
this.lng = in.readDouble();
}
public static final Parcelable.Creator< MogoLatLng > CREATOR = new Parcelable.Creator< MogoLatLng >() {
@Override
public MogoLatLng createFromParcel( Parcel source ) {
return new MogoLatLng( source );
}
@Override
public MogoLatLng[] newArray( int size ) {
return new MogoLatLng[size];
}
};
}

View File

@@ -1,8 +1,11 @@
package com.mogo.map.location;
package com.mogo.map;
import android.content.Context;
import com.mogo.map.amap.location.LocationClient;
import com.mogo.map.impl.amap.location.ALocationClient;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.MogoLocation;
/**
* @author congtaowang
@@ -14,7 +17,7 @@ public class MogoLocationClient implements IMogoLocationClient {
private static volatile MogoLocationClient sInstance;
private MogoLocationClient( Context context ) {
mDelegate = LocationClient.getInstance( context );
mDelegate = ALocationClient.getInstance( context );
}
public static MogoLocationClient getInstance( Context context ) {
@@ -52,14 +55,14 @@ public class MogoLocationClient implements IMogoLocationClient {
}
@Override
public void addLocationListener( ILocationListener listener ) {
public void addLocationListener( IMogoLocationListener listener ) {
if ( mDelegate != null ) {
mDelegate.addLocationListener( listener );
}
}
@Override
public void removeLocationListener( ILocationListener listener ) {
public void removeLocationListener( IMogoLocationListener listener ) {
if ( mDelegate != null ) {
mDelegate.removeLocationListener( listener );
}

View File

@@ -1,44 +0,0 @@
package com.mogo.map;
import android.content.Context;
/**
* @author congtaowang
* @since 2019-12-20
* <p>
* 描述
*/
public class MogoMap {
private IMogoMap mMap;
private Context mContext;
private static volatile MogoMap sInstance;
private MogoMap() {
}
public static MogoMap getInstance() {
if ( sInstance == null ) {
synchronized ( MogoMap.class ) {
if ( sInstance == null ) {
sInstance = new MogoMap();
}
}
}
return sInstance;
}
public void init( Context context, IMogoMap map ) {
this.mContext = context;
this.mMap = map;
}
public Context getContext() {
return mContext;
}
public IMogoMap getMogoMap() {
return mMap;
}
}

View File

@@ -0,0 +1,86 @@
package com.mogo.map;
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
/**
* @author congtaowang
* @since 2019-12-26
* <p>
* 描述
*/
public class MogoMapUIController implements IMogoMapUIController {
private IMogoMapUIController mDelegate;
private static volatile MogoMapUIController sInstance;
private MogoMapUIController() {
mDelegate = AMapUIController.getInstance();
}
public static MogoMapUIController getInstance() {
if ( sInstance == null ) {
synchronized ( MogoMapUIController.class ) {
if ( sInstance == null ) {
sInstance = new MogoMapUIController();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
@Override
public void setTrafficEnabled( boolean visible ) {
if ( mDelegate != null ) {
mDelegate.setTrafficEnabled( visible );
}
}
@Override
public void changeZoom( boolean zoom ) {
if ( mDelegate != null ) {
mDelegate.changeZoom( zoom );
}
}
@Override
public void changeMapMode( EnumMapUI mode ) {
if ( mDelegate != null ) {
mDelegate.changeMapMode( mode );
}
}
@Override
public void moveToCurrentLocation() {
if ( mDelegate != null ) {
mDelegate.moveToCurrentLocation();
}
}
@Override
public void showMyLocation( boolean visible ) {
if ( mDelegate != null ) {
mDelegate.showMyLocation( visible );
}
}
@Override
public void recoverLockMode() {
if ( mDelegate != null ) {
mDelegate.recoverLockMode();
}
}
@Override
public void displayOverview() {
if ( mDelegate != null ) {
mDelegate.displayOverview();
}
}
}

View File

@@ -1,12 +1,13 @@
package com.mogo.map;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import androidx.annotation.Nullable;
import com.amap.api.navi.AMapNaviView;
import com.mogo.map.amap.AMapNaviViewWrapper;
import com.mogo.map.impl.amap.AMapBaseMapView;
/**
* @author congtaowang
@@ -14,7 +15,7 @@ import com.mogo.map.amap.AMapNaviViewWrapper;
* <p>
* 地图实例
*/
public class MogoMapView extends MogoBaseMapView {
public class MogoMapView extends AMapBaseMapView implements ILifeCycle {
public MogoMapView( Context context ) {
super( context );
@@ -29,7 +30,42 @@ public class MogoMapView extends MogoBaseMapView {
}
@Override
protected IMogoMapView createMapView( Context context ) {
return new AMapNaviViewWrapper( new AMapNaviView( context ) );
public IMogoMap getMap() {
return super.getMap();
}
@Override
public void onCreate( Bundle bundle ) {
super.onCreate( bundle );
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onSaveInstanceState( Bundle outState ) {
super.onSaveInstanceState( outState );
}
@Override
public void onLowMemory() {
super.onLowMemory();
}
@Override
public IMogoMapView getMapView() {
return super.getMapView();
}
}

View File

@@ -0,0 +1,75 @@
package com.mogo.map;
import android.content.Context;
import com.mogo.map.impl.amap.InterceptorHandler;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.marker.MogoMarkersHandler;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-20
* <p>
* marker 管理实现
*/
public class MogoMarkerManager implements IMogoMarkerManager {
private static volatile MogoMarkerManager sInstance;
private Context mApplicationContext;
private MogoMarkerManager( Context context ) {
if ( context != null ) {
mApplicationContext = context.getApplicationContext();
}
}
public static MogoMarkerManager getInstance( Context context ) {
if ( sInstance == null ) {
synchronized ( MogoMarkerManager.class ) {
if ( sInstance == null ) {
sInstance = new MogoMarkerManager( context );
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
@Override
public IMogoMarker addMarker( String tag, MogoMarkerOptions options ) {
try {
return MogoMap.getInstance().getMogoMap().addMarker( tag, options );
} catch ( Exception e ) {
return null;
}
}
@Override
public List< IMogoMarker > addMarkers( String tag, ArrayList< MogoMarkerOptions > options, boolean moveToCenter ) {
try {
return MogoMap.getInstance().getMogoMap().addMarkers( tag, options, moveToCenter );
} catch ( Exception e ) {
return null;
}
}
@Override
public void removeMarkers( String tag ) {
MogoMarkersHandler.getInstance().remove( tag );
}
@Override
public void removeMarkers() {
MogoMarkersHandler.getInstance().removeAll();
}
}

View File

@@ -0,0 +1,98 @@
package com.mogo.map;
import android.content.Context;
import com.mogo.map.impl.amap.navi.NaviClient;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.navi.MogoNaviConfig;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-25
* <p>
* 导航代理
*/
public class MogoNavi implements IMogoNavi {
private IMogoNavi mDelegate;
private static volatile MogoNavi sInstance;
private MogoNavi( Context context ) {
mDelegate = NaviClient.getInstance( context );
}
public static MogoNavi getInstance( Context context ) {
if ( sInstance == null ) {
synchronized ( MogoNavi.class ) {
if ( sInstance == null ) {
sInstance = new MogoNavi( context );
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
@Override
public void naviTo( MogoLatLng endPoint ) {
if ( mDelegate != null ) {
mDelegate.naviTo( endPoint );
}
}
@Override
public void naviTo( MogoLatLng endPoint, MogoNaviConfig config ) {
if ( mDelegate != null ) {
mDelegate.naviTo( endPoint, config );
}
}
@Override
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints ) {
if ( mDelegate != null ) {
mDelegate.naviTo( endPoint, wayPoints );
}
}
@Override
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints, MogoNaviConfig config ) {
if ( mDelegate != null ) {
mDelegate.naviTo( endPoint, wayPoints, config );
}
}
@Override
public void reCalculateRoute( MogoNaviConfig config ) {
if ( mDelegate != null ) {
mDelegate.reCalculateRoute( config );
}
}
@Override
public void stopNavi() {
if ( mDelegate != null ) {
mDelegate.stopNavi();
}
}
@Override
public void startNavi() {
if ( mDelegate != null ) {
mDelegate.startNavi();
}
}
@Override
public boolean isNaviing() {
if ( mDelegate != null ) {
return mDelegate.isNaviing();
}
return false;
}
}

View File

@@ -1,10 +1,14 @@
package com.mogo.map.search.poisearch;
package com.mogo.map;
import android.content.Context;
import com.mogo.map.amap.search.PoiSearchClient;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.impl.amap.search.PoiSearchClient;
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;
/**
@@ -71,4 +75,12 @@ public class MogoPoiSearch implements IMogoPoiSearch {
mDelegate.setBound( bound );
}
}
@Override
public void destroy() {
if ( mDelegate != null ) {
mDelegate.destroy();
}
mDelegate = null;
}
}

View File

@@ -1,27 +0,0 @@
package com.mogo.map.amap;
import com.amap.api.maps.model.Marker;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* marker 点击事件处理
*/
public class AMapMarkerClickHandler {
public boolean handleMarkerClicked( Marker marker ) {
if ( marker == null ) {
return false;
}
if ( marker.getObject() instanceof IMogoMarker ) {
final IMogoMarkerClickListener listener = ( ( IMogoMarker ) marker.getObject() ).getOnMarkerClickListener();
if ( listener != null ) {
return listener.onMarkerClicked( ( ( IMogoMarker ) marker.getObject() ) );
}
}
return false;
}
}

View File

@@ -1,139 +0,0 @@
package com.mogo.map.amap;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import com.amap.api.maps.AMap;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.Poi;
import com.amap.api.navi.AMapNaviView;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoMapView;
import com.mogo.map.amap.utils.ObjectUtils;
import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 代理高德导航地图
*/
public class AMapNaviViewWrapper implements IMogoMapView,
AMap.OnMarkerClickListener,
AMap.OnMapLoadedListener,
AMap.OnMapTouchListener,
AMap.OnPOIClickListener {
private final AMapNaviView mMapView;
private IMogoMap mIMap;
private AMapMarkerClickHandler mMarkerClickHandler;
public AMapNaviViewWrapper( AMapNaviView mapView ) {
this.mMapView = mapView;
mMapView.setOnMarkerClickListener( this );
mMarkerClickHandler = new AMapMarkerClickHandler();
mMapView.setOnMapLoadedListener( this );
mMapView.setOnMapTouchListener( this );
if ( mMapView.getMap() != null ) {
mMapView.getMap().setOnPOIClickListener( this );
}
}
@Override
public View getMapView() {
return mMapView;
}
@Override
public IMogoMap getMap() {
if ( mMapView != null ) {
if ( mIMap == null ) {
mIMap = new AMapWrapper( mMapView.getMap() );
}
}
return mIMap;
}
@Override
public void onCreate( Bundle bundle ) {
if ( mMapView != null ) {
mMapView.onCreate( bundle );
}
}
@Override
public void onResume() {
if ( mMapView != null ) {
mMapView.onResume();
}
}
@Override
public void onPause() {
if ( mMapView != null ) {
mMapView.onPause();
}
}
@Override
public void onDestroy() {
if ( mMapView != null ) {
mMapView.onDestroy();
}
}
@Override
public void onSaveInstanceState( Bundle outState ) {
if ( mMapView != null ) {
mMapView.onSaveInstanceState( outState );
}
}
@Override
public void onLowMemory() {
}
/**
* 地图marker点击
*
* @param marker
* @return
*/
@Override
public boolean onMarkerClick( Marker marker ) {
return mMarkerClickHandler.handleMarkerClicked( marker );
}
/**
* 地图加载完毕
*/
@Override
public void onMapLoaded() {
MogoMapListenerHandler.getInstance().onMapLoaded();
}
/**
* 地图点击回调
*
* @param motionEvent
*/
@Override
public void onTouch( MotionEvent motionEvent ) {
MogoMapListenerHandler.getInstance().onTouch( motionEvent );
}
/**
* POI 点击
*
* @param poi
*/
@Override
public void onPOIClick( Poi poi ) {
MogoMapListenerHandler.getInstance().onPOIClick( ObjectUtils.fromAMap( poi ) );
}
}

View File

@@ -1,104 +0,0 @@
package com.mogo.map.amap;
import com.amap.api.maps.UiSettings;
import com.mogo.map.IUiSettings;
import java.lang.reflect.Method;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 代理高德地图UiSettings
*/
public class AMapUiSettingsWrapper implements IUiSettings {
private UiSettings mUiSettings;
public AMapUiSettingsWrapper( UiSettings mUiSettings ) {
this.mUiSettings = mUiSettings;
}
@Override
public void setScaleControlsEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setScaleControlsEnabled( enabled );
}
}
@Override
public void setZoomControlsEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setZoomControlsEnabled( enabled );
}
}
@Override
public void setCompassEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setCompassEnabled( enabled );
}
}
@Override
public void setMyLocationButtonEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setMyLocationButtonEnabled( enabled );
}
}
@Override
public void setScrollGesturesEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setScrollGesturesEnabled( enabled );
}
}
@Override
public void setZoomGesturesEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setZoomGesturesEnabled( enabled );
}
}
@Override
public void setTiltGesturesEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setTiltGesturesEnabled( enabled );
}
}
@Override
public void setRotateGesturesEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setRotateGesturesEnabled( enabled );
}
}
@Override
public void setAllGesturesEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setAllGesturesEnabled( enabled );
}
}
@Override
public void setIndoorSwitchEnabled( boolean enabled ) {
if ( mUiSettings != null ) {
mUiSettings.setIndoorSwitchEnabled( enabled );
}
}
@Override
public void setLogoEnable( boolean enabled ) {
if ( mUiSettings != null ) {
try {
Method method = mUiSettings.getClass().getMethod( "setLogoEnable", boolean.class );
method.setAccessible( true );
method.invoke( mUiSettings, enabled );
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
}

View File

@@ -1,159 +0,0 @@
package com.mogo.map.amap;
import com.amap.api.maps.AMap;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.MarkerOptions;
import com.mogo.map.IMogoMap;
import com.mogo.map.IUiSettings;
import com.mogo.map.amap.marker.AMapInfoWindowAdapter;
import com.mogo.map.amap.marker.AMapMarkerWrapper;
import com.mogo.map.amap.utils.ObjectUtils;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.marker.MogoMarkersHandler;
import java.util.ArrayList;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 代理高德AMap
*/
public class AMapWrapper implements IMogoMap {
private AMap mAMap;
private IUiSettings mUiSettings;
public AMapWrapper( AMap map ) {
this.mAMap = map;
// 设置实现自定义 info window
mAMap.setInfoWindowAdapter( new AMapInfoWindowAdapter() );
}
@Override
public IUiSettings getUiSettings() {
if ( mUiSettings == null ) {
mUiSettings = new AMapUiSettingsWrapper( mAMap.getUiSettings() );
}
return mUiSettings;
}
@Override
public IMogoMarker addMarker( String tag, MogoMarkerOptions options ) {
if ( mAMap == null ) {
return null;
}
MarkerOptions markerOptions = ObjectUtils.fromMogo( options );
if ( markerOptions == null ) {
return null;
}
final IMogoMarker mogoMarker = new AMapMarkerWrapper( mAMap.addMarker( markerOptions ) );
MogoMarkersHandler.getInstance().add( tag, mogoMarker );
return mogoMarker;
}
@Override
public ArrayList< IMogoMarker > addMarkers( String tag, ArrayList< MogoMarkerOptions > options, boolean moveToCenter ) {
if ( mAMap == null ) {
return null;
}
if ( options == null || options.isEmpty() ) {
return null;
}
ArrayList< Marker > markers = null;
ArrayList< MarkerOptions > markerOptions = new ArrayList<>();
ArrayList< IMogoMarker > mogoMarkers = new ArrayList<>();
for ( MogoMarkerOptions option : options ) {
if ( option == null ) {
continue;
}
MarkerOptions mo = ObjectUtils.fromMogo( option );
if ( mo == null ) {
continue;
}
markerOptions.add( mo );
}
if ( markerOptions.isEmpty() ) {
return null;
}
markers = mAMap.addMarkers( markerOptions, moveToCenter );
if ( markers == null || markers.isEmpty() ) {
return null;
}
for ( Marker marker : markers ) {
if ( marker == null ) {
continue;
}
mogoMarkers.add( new AMapMarkerWrapper( marker ) );
}
MogoMarkersHandler.getInstance().add( tag, mogoMarkers );
return mogoMarkers;
}
@Override
public void clear() {
if ( mAMap != null ) {
mAMap.clear();
}
}
@Override
public void clear( boolean isKeepMyLocationOverlay ) {
if ( mAMap != null ) {
mAMap.clear( isKeepMyLocationOverlay );
}
}
@Override
public void setPointToCenter( int x, int y ) {
if ( mAMap != null ) {
mAMap.setPointToCenter( x, y );
}
}
@Override
public void setTouchPoiEnable( boolean touchPoiEnable ) {
if ( mAMap != null ) {
mAMap.setTouchPoiEnable( touchPoiEnable );
}
}
@Override
public void setTrafficEnable( boolean enable ) {
if ( mAMap != null ) {
mAMap.setTrafficEnabled( enable );
}
}
@Override
public void showBuildings( boolean enabled ) {
if ( mAMap != null ) {
mAMap.showBuildings( enabled );
}
}
@Override
public void showIndoorMap( boolean enable ) {
if ( mAMap != null ) {
mAMap.showIndoorMap( enable );
}
}
@Override
public void showMapText( boolean enable ) {
if ( mAMap != null ) {
mAMap.showMapText( enable );
}
}
@Override
public void stopAnimation() {
if ( mAMap != null ) {
mAMap.stopAnimation();
}
}
}

View File

@@ -1,117 +0,0 @@
package com.mogo.map.amap.location;
import android.content.Context;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.mogo.map.amap.utils.ObjectUtils;
import com.mogo.map.location.ILocationListener;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.MogoLocation;
import com.mogo.utils.logger.Logger;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 高德定位
*/
public class LocationClient implements IMogoLocationClient {
private static final String TAG = "LocationClient";
private static volatile LocationClient sInstance;
private static Set< ILocationListener > sListeners = new HashSet<>( 10 );
private static MogoLocation sLastLocation = new MogoLocation();
private LocationClient( Context context ) {
mClient = new AMapLocationClient( context );
mClient.setLocationListener( new InternalLocationListener() );
}
public static LocationClient getInstance( Context context ) {
if ( sInstance == null ) {
synchronized ( LocationClient.class ) {
if ( sInstance == null ) {
sInstance = new LocationClient( context );
}
}
}
return sInstance;
}
private AMapLocationClient mClient;
@Override
public void start() {
start( 2_000L );
}
@Override
public void start( long interval ) {
stop();
AMapLocationClientOption option = new AMapLocationClientOption();
option.setLocationMode( AMapLocationClientOption.AMapLocationMode.Hight_Accuracy );
option.setNeedAddress( true );
option.setInterval( interval );
if ( mClient != null ) {
mClient.setLocationOption( option );
}
mClient.startLocation();
}
@Override
public void stop() {
if ( mClient != null ) {
mClient.stopLocation();
}
}
@Override
public void addLocationListener( ILocationListener listener ) {
if ( listener != null ) {
synchronized ( sListeners ) {
sListeners.add( listener );
}
}
}
@Override
public void removeLocationListener( ILocationListener listener ) {
if ( listener != null ) {
synchronized ( sListeners ) {
sListeners.remove( listener );
}
}
}
@Override
public MogoLocation getLastKnowLocation() {
return sLastLocation;
}
private static class InternalLocationListener implements AMapLocationListener {
@Override
public void onLocationChanged( AMapLocation aMapLocation ) {
if ( aMapLocation == null ||
aMapLocation.getLatitude() == 0.0D ||
aMapLocation.getLongitude() == 0.0D ) {
return;
}
Logger.d( TAG, aMapLocation.toString() );
sLastLocation = ObjectUtils.fromAMap( aMapLocation );
synchronized ( sListeners ) {
Iterator< ILocationListener > listenerIterator = sListeners.iterator();
while ( listenerIterator.hasNext() ) {
listenerIterator.next().onLocationChanged( sLastLocation.clone() );
}
}
}
}
}

View File

@@ -1,35 +0,0 @@
package com.mogo.map.amap.marker;
import android.view.View;
import com.amap.api.maps.AMap;
import com.amap.api.maps.model.Marker;
import com.mogo.map.marker.IMogoInfoWindowAdapter;
import com.mogo.map.marker.IMogoMarker;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* 自定义infowindow
*/
public final class AMapInfoWindowAdapter implements AMap.InfoWindowAdapter {
@Override
public View getInfoWindow( Marker marker ) {
if ( marker.getObject() instanceof IMogoMarker ) {
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getObject() );
IMogoInfoWindowAdapter delegate = mogoMarker.getInfoWindowAdapter();
if ( delegate != null ) {
return delegate.getInfoWindow( mogoMarker );
}
}
return null;
}
@Override
public View getInfoContents( Marker marker ) {
return null;
}
}

View File

@@ -1,243 +0,0 @@
package com.mogo.map.amap.marker;
import android.graphics.Bitmap;
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.Marker;
import com.amap.api.maps.model.MarkerOptions;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoInfoWindowAdapter;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.amap.utils.ObjectUtils;
import java.util.ArrayList;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 代理高德marker
*/
public class AMapMarkerWrapper implements IMogoMarker {
private Marker mMarker;
private Object mObject;
private IMogoMarkerClickListener mMogoMarkerClickListener;
private IMogoInfoWindowAdapter mMogoInfoWindowAdapter;
private boolean mIsDestroy = false;
public AMapMarkerWrapper( Marker mMarker ) {
this.mMarker = mMarker;
if ( mMarker != null ) {
// 设置高德 marker 的object对象为 IMogoMarker 实例。!!!!
mMarker.setObject( this );
}
}
@Override
public void destroy() {
if ( mMarker != null ) {
mMarker.destroy();
mMarker.setObject( null );
mMarker = null;
}
mMogoInfoWindowAdapter = null;
mMogoMarkerClickListener = null;
mObject = null;
mIsDestroy = true;
}
@Override
public void remove() {
destroy();
}
@Override
public void hideInfoWindow() {
if ( mMarker != null ) {
mMarker.hideInfoWindow();
}
}
@Override
public void setAlpha( float alpha ) {
if ( mMarker != null ) {
mMarker.setAlpha( alpha );
}
}
@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() ) {
return;
}
if ( mMarker != null ) {
mMarker.setIcon( BitmapDescriptorFactory.fromBitmap( icon ) );
}
}
@Override
public void setIcons( ArrayList< Bitmap > icons ) {
if ( icons == null || icons.isEmpty() ) {
return;
}
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
for ( Bitmap icon : icons ) {
if ( icon == null || icon.isRecycled() ) {
continue;
}
descriptors.add( BitmapDescriptorFactory.fromBitmap( icon ) );
}
if ( descriptors.isEmpty() ) {
return;
}
if ( mMarker != null ) {
mMarker.setIcons( descriptors );
}
}
@Override
public void setInfoWindowEnable( boolean enabled ) {
if ( mMarker != null ) {
mMarker.setInfoWindowEnable( enabled );
}
}
@Override
public void setMarkerOptions( MogoMarkerOptions opt ) {
final MarkerOptions options = ObjectUtils.fromMogo( opt );
if ( options == null ) {
return;
}
if ( mMarker != null ) {
mMarker.setMarkerOptions( options );
}
}
@Override
public void setObject( Object object ) {
mObject = object;
}
@Override
public Object getObject() {
return mObject;
}
@Override
public void setPeriod( int period ) {
if ( mMarker != null ) {
mMarker.setPeriod( period );
}
}
@Override
public void setPosition( double lat, double lng ) {
if ( mMarker != null ) {
mMarker.setPosition( new LatLng( lat, lng ) );
}
}
@Override
public MogoLatLng getPosition() {
if ( mMarker != null ) {
final LatLng latLng = mMarker.getPosition();
return ObjectUtils.fromAMap( latLng );
}
return null;
}
@Override
public void setRotateAngle( float rotate ) {
if ( mMarker != null ) {
mMarker.setRotateAngle( rotate );
}
}
@Override
public void setSnippet( String snippet ) {
if ( mMarker != null ) {
mMarker.setSnippet( snippet );
}
}
@Override
public void setTitle( String title ) {
if ( mMarker != null ) {
mMarker.setTitle( title );
}
}
@Override
public void setToTop() {
if ( mMarker != null ) {
mMarker.setToTop();
}
}
@Override
public void setVisible( boolean visible ) {
if ( mMarker != null ) {
mMarker.setVisible( visible );
}
}
@Override
public void setZIndex( float zIndex ) {
if ( mMarker != null ) {
mMarker.setZIndex( zIndex );
}
}
@Override
public void showInfoWindow() {
if ( mMarker != null ) {
mMarker.showInfoWindow();
}
}
@Override
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
mMogoMarkerClickListener = listener;
}
@Override
public IMogoMarkerClickListener getOnMarkerClickListener() {
return mMogoMarkerClickListener;
}
@Override
public void setInfoWindowAdapter( IMogoInfoWindowAdapter adapter ) {
mMogoInfoWindowAdapter = adapter;
}
@Override
public IMogoInfoWindowAdapter getInfoWindowAdapter() {
return mMogoInfoWindowAdapter;
}
@Override
public boolean isDestroyed() {
return mIsDestroy;
}
}

View File

@@ -1,101 +0,0 @@
package com.mogo.map.amap.search;
import android.content.Context;
import com.amap.api.services.core.AMapException;
import com.amap.api.services.geocoder.GeocodeAddress;
import com.amap.api.services.geocoder.GeocodeResult;
import com.amap.api.services.geocoder.GeocodeSearch;
import com.amap.api.services.geocoder.RegeocodeAddress;
import com.amap.api.services.geocoder.RegeocodeResult;
import com.mogo.map.amap.utils.ObjectUtils;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.search.geo.IMogoGeoSearch;
import com.mogo.map.search.geo.IMogoGeoSearchListener;
import com.mogo.map.search.geo.MogoGeocodeAddress;
import com.mogo.map.search.geo.MogoRegeocodeAddress;
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 地理编码/逆地理编码高德实现
*/
public class GeocodeSearchClient implements IMogoGeoSearch, GeocodeSearch.OnGeocodeSearchListener {
private GeocodeSearch mClient;
private IMogoGeoSearchListener mListener;
public GeocodeSearchClient( Context context ) {
mClient = new GeocodeSearch( context );
mClient.setOnGeocodeSearchListener( this );
}
@Override
public void setGeoSearchListener( IMogoGeoSearchListener listener ) {
mListener = listener;
}
@Override
public MogoRegeocodeAddress getFromLocation( MogoRegeocodeQuery query ) throws MogoMapException {
try {
RegeocodeAddress regeocodeAddress = mClient.getFromLocation( ObjectUtils.fromMogo( query ) );
return ObjectUtils.fromAMap( regeocodeAddress );
} catch ( AMapException e ) {
throw new MogoMapException( e );
}
}
@Override
public List< MogoGeocodeAddress > getFromLocationName( MogoGeocodeQuery query ) throws MogoMapException {
try {
List< GeocodeAddress > geocodeAddress = mClient.getFromLocationName( ObjectUtils.fromMogo( query ) );
if ( geocodeAddress != null ) {
List< MogoGeocodeAddress > mogoGeocodeAddresses = new ArrayList<>();
for ( GeocodeAddress address : geocodeAddress ) {
MogoGeocodeAddress mogoGeocodeAddress = ObjectUtils.fromAMap( address );
if ( mogoGeocodeAddress != null ) {
mogoGeocodeAddresses.add( mogoGeocodeAddress );
}
}
return mogoGeocodeAddresses;
}
return new ArrayList<>();
} catch ( AMapException e ) {
throw new MogoMapException( e );
}
}
@Override
public void getFromLocationAsyn( MogoRegeocodeQuery query ) {
if ( mClient != null ) {
mClient.getFromLocationAsyn( ObjectUtils.fromMogo( query ) );
}
}
@Override
public void getFromLocationNameAsyn( MogoGeocodeQuery query ) {
if ( mClient != null ) {
mClient.getFromLocationNameAsyn( ObjectUtils.fromMogo( query ) );
}
}
@Override
public void onRegeocodeSearched( RegeocodeResult regeocodeResult, int i ) {
if ( mListener != null ) {
mListener.onRegeocodeSearched( ObjectUtils.fromAMap( regeocodeResult ), i );
}
}
@Override
public void onGeocodeSearched( GeocodeResult geocodeResult, int i ) {
if ( mListener != null ) {
mListener.onGeocodeSearched( ObjectUtils.fromAMap( geocodeResult ), i );
}
}
}

View File

@@ -1,84 +0,0 @@
package com.mogo.map.amap.search;
import android.content.Context;
import com.amap.api.services.core.AMapException;
import com.amap.api.services.help.Inputtips;
import com.amap.api.services.help.InputtipsQuery;
import com.amap.api.services.help.Tip;
import com.mogo.map.amap.utils.ObjectUtils;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
import com.mogo.map.search.inputtips.MogoTip;
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-20
* <p>
* 高德地图 inputtips搜索实现
*/
public class InputtipsSearch implements IMogoInputtipsSearch, Inputtips.InputtipsListener {
private Inputtips mClient;
private InputtipsQuery mQuery;
private IMogoInputtipsListener mListener;
public InputtipsSearch( Context context, MogoInputtipsQuery query ) {
mQuery = ObjectUtils.fromMogo( query );
mClient = new Inputtips( context, mQuery );
mClient.setInputtipsListener( this );
}
@Override
public void setQuery( MogoInputtipsQuery query ) {
this.mQuery = ObjectUtils.fromMogo( query );
}
@Override
public void setInputtipsListener( IMogoInputtipsListener listener ) {
this.mListener = listener;
}
@Override
public void requestInputtipsAsyn() {
if ( mClient != null ) {
mClient.requestInputtipsAsyn();
}
}
@Override
public List< MogoTip > requestInputtips() throws MogoMapException {
try {
List< Tip > tips = mClient.requestInputtips();
List< MogoTip > mogoTips = getResult( tips );
return mogoTips;
} catch ( AMapException e ) {
throw new MogoMapException( e );
}
}
@Override
public void onGetInputtips( List< Tip > list, int i ) {
if ( mListener != null ) {
mListener.onGetInputtips( getResult( list ), i );
}
}
private List< MogoTip > getResult( List< Tip > tips ) {
List< MogoTip > mogoTips = new ArrayList<>();
if ( tips != null ) {
for ( Tip tip : tips ) {
MogoTip mogoTip = ObjectUtils.fromAMap( tip );
if ( mogoTip != null ) {
mogoTips.add( mogoTip );
}
}
}
return mogoTips;
}
}

View File

@@ -1,122 +0,0 @@
package com.mogo.map.amap.search;
import android.content.Context;
import com.amap.api.services.core.AMapException;
import com.amap.api.services.core.PoiItem;
import com.amap.api.services.poisearch.PoiResult;
import com.amap.api.services.poisearch.PoiSearch;
import com.mogo.map.amap.utils.ObjectUtils;
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.utils.logger.Logger;
/**
* @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, PoiSearch.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 ) {
mQuery = query;
mClient = new PoiSearch( context, ObjectUtils.fromMogo( mQuery ) );
mClient.setOnPoiSearchListener( this );
}
@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 {
PoiResult search = mClient.searchPOI();
return ObjectUtils.fromAMap( search );
} catch ( AMapException 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 ( AMapException 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( bound ) );
}
}
@Override
public void onPoiSearched( PoiResult poiResult, int errorCode ) {
if ( errorCode != 1000 ) {
Logger.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 != 1000 ) {
Logger.e( TAG, "errorcode is %d", errorCode );
}
if ( mListener != null ) {
mListener.onPoiItemSearched( ObjectUtils.fromAMap( poiItem ), errorCode );
}
}
}

View File

@@ -1,594 +0,0 @@
package com.mogo.map.amap.utils;
import android.graphics.Bitmap;
import com.amap.api.location.AMapLocation;
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.MarkerOptions;
import com.amap.api.maps.model.Poi;
import com.amap.api.services.core.LatLonPoint;
import com.amap.api.services.core.PoiItem;
import com.amap.api.services.geocoder.AoiItem;
import com.amap.api.services.geocoder.BusinessArea;
import com.amap.api.services.geocoder.GeocodeAddress;
import com.amap.api.services.geocoder.GeocodeQuery;
import com.amap.api.services.geocoder.GeocodeResult;
import com.amap.api.services.geocoder.RegeocodeAddress;
import com.amap.api.services.geocoder.RegeocodeQuery;
import com.amap.api.services.geocoder.RegeocodeResult;
import com.amap.api.services.geocoder.RegeocodeRoad;
import com.amap.api.services.geocoder.StreetNumber;
import com.amap.api.services.help.InputtipsQuery;
import com.amap.api.services.help.Tip;
import com.amap.api.services.poisearch.IndoorData;
import com.amap.api.services.poisearch.Photo;
import com.amap.api.services.poisearch.PoiItemExtension;
import com.amap.api.services.poisearch.PoiResult;
import com.amap.api.services.poisearch.PoiSearch;
import com.amap.api.services.poisearch.SubPoiItem;
import com.amap.api.services.road.Crossroad;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.search.geo.MogoAoiItem;
import com.mogo.map.search.geo.MogoBusinessArea;
import com.mogo.map.search.geo.MogoCrossroad;
import com.mogo.map.search.geo.MogoGeocodeAddress;
import com.mogo.map.search.geo.MogoGeocodeResult;
import com.mogo.map.search.geo.MogoIndoorData;
import com.mogo.map.search.geo.MogoPhoto;
import com.mogo.map.search.geo.MogoPoiItem;
import com.mogo.map.search.geo.MogoPoiItemExtension;
import com.mogo.map.search.geo.MogoRegeocodeAddress;
import com.mogo.map.search.geo.MogoRegeocodeResult;
import com.mogo.map.search.geo.MogoRegeocodeRoad;
import com.mogo.map.search.geo.MogoStreetNumber;
import com.mogo.map.search.geo.MogoSubPoiItem;
import com.mogo.map.search.inputtips.MogoTip;
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
import com.mogo.map.search.poisearch.MogoPoiResult;
import com.mogo.map.search.poisearch.MogoSearchBound;
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 业务对象和实际对象转换
*/
public class ObjectUtils {
public static MarkerOptions fromMogo( MogoMarkerOptions opt ) {
if ( opt == null ) {
return null;
}
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
final ArrayList< Bitmap > icons = opt.getIcons();
if ( icons != null && !icons.isEmpty() ) {
for ( Bitmap icon : icons ) {
if ( icon == null || icon.isRecycled() ) {
continue;
}
descriptors.add( BitmapDescriptorFactory.fromBitmap( icon ) );
}
}
return new MarkerOptions()
.position( new LatLng( opt.getLatitude(), opt.getLongitude() ) )
.title( opt.getTitle() )
.snippet( opt.getSnippet() )
.icon( BitmapDescriptorFactory.fromBitmap( opt.getIcon() ) )
.icons( descriptors )
.period( opt.getPeriod() )
.rotateAngle( opt.getRotate() )
.setFlat( opt.isFlat() )
.visible( opt.isVisible() )
.infoWindowEnable( opt.isInifoWindowEnable() )
.alpha( opt.getAlpha() )
.setGps( opt.isGps() )
.anchor( opt.getU(), opt.getV() )
.draggable( opt.isDraggable() )
.setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
.zIndex( opt.getzIndex() );
}
public static MogoLocation fromAMap( AMapLocation aLocation ) {
if ( aLocation == null ) {
return null;
}
MogoLocation location = new MogoLocation();
location.setLocType( aLocation.getLocationType() );
location.setSpeed( aLocation.getSpeed() );
location.setLatitude( aLocation.getLatitude() );
location.setLongitude( aLocation.getLongitude() );
location.setAltitude( aLocation.getAltitude() );
location.setTime( aLocation.getTime() );
location.setBearing( aLocation.getBearing() );
location.setAccuracy( aLocation.getAccuracy() );
location.setCityCode( aLocation.getCityCode() );
location.setCityName( aLocation.getCity() );
location.setProvider( aLocation.getProvider() );
location.setAddress( aLocation.getAddress() );
location.setDistrict( aLocation.getDistrict() );
location.setProvince( aLocation.getProvince() );
location.setAdCode( aLocation.getAdCode() );
location.setLocationDetail( aLocation.getLocationDetail() );
location.setPoiName( aLocation.getPoiName() );
location.setAoiName( aLocation.getAoiName() );
location.setErrCode( aLocation.getErrorCode() );
location.setErrInfo( aLocation.getErrorInfo() );
location.setStreetNum( aLocation.getStreetNum() );
location.setDescription( aLocation.getDescription() );
location.setBuildingId( aLocation.getBuildingId() );
location.setFloor( aLocation.getFloor() );
location.setGpsAccuracyStatus( aLocation.getGpsAccuracyStatus() );
location.setSatellite( aLocation.getSatellites() );
return location;
}
public static LatLonPoint fromMogo( MogoLatLng latLng ) {
if ( latLng == null ) {
return null;
}
return new LatLonPoint( 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( LatLonPoint point ) {
if ( point == null ) {
return null;
}
return new MogoLatLng( point.getLatitude(), point.getLongitude() );
}
public static MogoLatLng fromAMap( 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;
}
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() ), query.getRadius(), query.getLatlngType() );
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;
}
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.getLatLonPoint() ) );
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<>();
for ( GeocodeAddress geocodeAddress : result.getGeocodeAddressList() ) {
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap( geocodeAddress );
if ( mogoGeocodeAddress != null ) {
addresses.add( mogoGeocodeAddress );
}
}
mogoGeocodeResult.setAddresses( addresses );
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 ) {
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 ) {
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.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.getLatLonPoint() ) );
mogoPoiItem.setPostcode( poiItem.getPostcode() );
mogoPoiItem.setProvinceCode( poiItem.getProvinceCode() );
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() );
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() );
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() );
if ( regeocodeAddress.getPois() != null ) {
List< MogoPoiItem > mogoPoiItems = new ArrayList<>();
for ( PoiItem pois : regeocodeAddress.getPois() ) {
MogoPoiItem mogoPoiItem = fromAMap( pois );
mogoPoiItems.add( mogoPoiItem );
}
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;
}
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.getPoint() ) );
mogoTip.setTypeCode( tip.getTypeCode() );
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( PoiSearch.Query query ) {
if ( query == null ) {
return null;
}
MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery( query.getQueryString(), query.getCategory(), query.getCity() );
mogoPoiSearchQuery.setBuilding( query.getBuilding() );
mogoPoiSearchQuery.setCityLimit( query.getCityLimit() );
mogoPoiSearchQuery.setDistanceSort( query.isDistanceSort() );
mogoPoiSearchQuery.setLocation( fromAMap( query.getLocation() ) );
mogoPoiSearchQuery.setPageNum( query.getPageNum() );
mogoPoiSearchQuery.setPageSize( query.getPageSize() );
return mogoPoiSearchQuery;
}
public static PoiSearch.Query fromMogo( MogoPoiSearchQuery query ) {
if ( query == null ) {
return null;
}
PoiSearch.Query psq = new PoiSearch.Query( query.getQuery(), query.getCategory(), query.getCity() );
psq.setBuilding( query.getBuilding() );
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( PoiSearch.SearchBound bound ) {
if ( bound == null ) {
return null;
}
if ( bound.getShape() == PoiSearch.SearchBound.BOUND_SHAPE ) {
return new MogoSearchBound( fromAMap( bound.getCenter() ), bound.getRange(), bound.isDistanceSort() );
} else if ( bound.getShape() == PoiSearch.SearchBound.POLYGON_SHAPE ) {
return new MogoSearchBound( fromAMap( bound.getPolyGonList() ) );
} else if ( bound.getShape() == PoiSearch.SearchBound.RECTANGLE_SHAPE ) {
return new MogoSearchBound( fromAMap( bound.getLowerLeft() ), fromAMap( bound.getUpperRight() ) );
}
return null;
}
public static List< MogoLatLng > fromAMap( List< LatLonPoint > latLngs ) {
if ( latLngs == null ) {
return null;
}
List< MogoLatLng > result = new ArrayList<>( latLngs.size() );
for ( LatLonPoint latLng : latLngs ) {
result.add( fromAMap( latLng ) );
}
return result;
}
public static List< LatLonPoint > fromMogo( List< MogoLatLng > latLngs ) {
if ( latLngs == null ) {
return null;
}
List< LatLonPoint > result = new ArrayList<>( latLngs.size() );
for ( MogoLatLng latLng : latLngs ) {
result.add( fromMogo( latLng ) );
}
return result;
}
public static PoiSearch.SearchBound fromMogo( MogoSearchBound bound ) {
if ( bound == null ) {
return null;
}
if ( bound.getShape() == MogoSearchBound.SHAPE_BOUND ) {
return new PoiSearch.SearchBound( fromMogo( bound.getCenterPoint() ), bound.getRadiusInMeters(), bound.isDistanceSort() );
} else if ( bound.getShape() == MogoSearchBound.SHAPE_POLYGON ) {
return new PoiSearch.SearchBound( fromMogo( bound.getPolyGonList() ) );
} else if ( bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE ) {
return new PoiSearch.SearchBound( fromMogo( bound.getLowerLeft() ), fromMogo( bound.getUpperRight() ) );
}
return null;
}
public static MogoPoiResult fromAMap( PoiResult result ) {
if ( result == null ) {
return null;
}
MogoPoiResult mogoPoiResult = new MogoPoiResult();
if ( result.getPois() != null ) {
final List< PoiItem > poiItems = result.getPois();
final ArrayList< MogoPoiItem > mogoPoiItems = new ArrayList<>( poiItems.size() );
for ( PoiItem poiItem : poiItems ) {
mogoPoiItems.add( fromAMap( poiItem ) );
}
mogoPoiResult.setPois( mogoPoiItems );
}
return mogoPoiResult;
}
}

View File

@@ -1,25 +0,0 @@
package com.mogo.map.exception;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 异常
*/
public class MogoMapException extends Exception {
public MogoMapException() {
}
public MogoMapException( String message ) {
super( message );
}
public MogoMapException( String message, Throwable cause ) {
super( message, cause );
}
public MogoMapException( Throwable cause ) {
super( cause );
}
}

View File

@@ -1,33 +0,0 @@
package com.mogo.map.listener;
import android.view.MotionEvent;
import com.mogo.map.model.MogoPoi;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 地图操作回调
*/
public interface IMogoMapListener {
/**
* 地图加载完毕
*/
void onMapLoaded();
/**
* 地图点击
*
* @param motionEvent
*/
void onTouch( MotionEvent motionEvent );
/**
* 地图上的任意poi点击
*
* @param poi
*/
void onPOIClick( MogoPoi poi );
}

View File

@@ -1,24 +0,0 @@
package com.mogo.map.listener;
import com.mogo.map.exception.MogoMapException;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 地图操作回调
*/
public interface IMogoMapListenerRegister {
/**
* 注册地图事件
*
* @param listener 回调事件
*/
void registerHostMapListener( IMogoMapListener listener );
/**
* 反注册注册地图事件
*/
void unregisterHostMapListener();
}

View File

@@ -1,76 +0,0 @@
package com.mogo.map.listener;
import android.view.MotionEvent;
import com.mogo.map.model.MogoPoi;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* 地图监听注册管理
*/
public class MogoMapListenerHandler implements IMogoMapListener, IMogoMapListenerRegister {
private static volatile MogoMapListenerHandler sInstance;
private MogoMapListenerHandler() {
}
public static MogoMapListenerHandler getInstance() {
if ( sInstance == null ) {
synchronized ( MogoMapListenerHandler.class ) {
if ( sInstance == null ) {
sInstance = new MogoMapListenerHandler();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
/**
* 上层模块代理对象
*/
private IMogoMapListener mDelegateListener = null;
@Override
public void registerHostMapListener( IMogoMapListener listener ) {
mDelegateListener = listener;
}
@Override
public void unregisterHostMapListener() {
mDelegateListener = null;
}
@Override
public void onMapLoaded() {
if ( mDelegateListener != null ) {
synchronized ( mDelegateListener ) {
mDelegateListener.onMapLoaded();
}
}
}
@Override
public void onTouch( MotionEvent motionEvent ) {
if ( mDelegateListener != null ) {
synchronized ( mDelegateListener ) {
mDelegateListener.onTouch( motionEvent );
}
}
}
@Override
public void onPOIClick( MogoPoi poi ) {
if ( mDelegateListener != null ) {
synchronized ( mDelegateListener ) {
mDelegateListener.onPOIClick( poi );
}
}
}
}

View File

@@ -1,17 +0,0 @@
package com.mogo.map.location;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 定位回调
*/
public interface ILocationListener {
/**
* 定位发生改变
*
* @param location 新定位点
*/
void onLocationChanged( MogoLocation location );
}

View File

@@ -1,43 +0,0 @@
package com.mogo.map.location;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 定位接口
*/
public interface IMogoLocationClient {
/**
* 开始定位
*/
void start();
/**
* 开始定位
*
* @param interval 默认定位间隔
*/
void start( long interval );
/**
* 停止定位
*/
void stop();
/**
* 注册定位回调
*
* @param listener
*/
void addLocationListener( ILocationListener listener );
/**
* 注销定位回调
*
* @param listener
*/
void removeLocationListener( ILocationListener listener );
MogoLocation getLastKnowLocation();
}

View File

@@ -1,362 +0,0 @@
package com.mogo.map.location;
import android.os.Parcel;
import android.os.Parcelable;
public class MogoLocation implements Cloneable, Parcelable {
private int locType = 0;
private double latitude = 0;
private double longitude = 0;
private double altitude = 0;
private long time = 0;
private float bearing = 0;
private float accuracy = 0;
private float speed = 0;
private String cityName = "";
private String cityCode = "";
private String provider = "";
private String address = "";
private String district = "";
private String province = "";
private String adCode = "";
private String locationDetail = "";
private String poiName = "";
private String aoiName = "";
private int errCode = 0;
private String errInfo = "";
private String streetNum = "";
private String description = "";
private String buildingId = "";
private String floor = "";
private int gpsAccuracyStatus = 0;
private int satellite = 0;
public float getBearing() {
return bearing;
}
public void setBearing( float bearing ) {
this.bearing = bearing;
}
public float getAccuracy() {
return accuracy;
}
public void setAccuracy( float accuracy ) {
this.accuracy = accuracy;
}
public String getProvider() {
return provider;
}
public void setProvider( String provider ) {
this.provider = provider;
}
public float getSpeed() {
return speed;
}
public void setSpeed( float speed ) {
this.speed = speed;
}
public String getLocationDetail() {
return locationDetail;
}
public void setLocationDetail( String locationDetail ) {
this.locationDetail = locationDetail;
}
public String getPoiName() {
return poiName;
}
public void setPoiName( String poiName ) {
this.poiName = poiName;
}
public String getAoiName() {
return aoiName;
}
public void setAoiName( String aoiName ) {
this.aoiName = aoiName;
}
public int getErrCode() {
return errCode;
}
public void setErrCode( int errCode ) {
this.errCode = errCode;
}
public String getErrInfo() {
return errInfo;
}
public void setErrInfo( String errInfo ) {
this.errInfo = errInfo;
}
public String getStreetNum() {
return streetNum;
}
public void setStreetNum( String streetNum ) {
this.streetNum = streetNum;
}
public String getDescription() {
return description;
}
public void setDescription( String description ) {
this.description = description;
}
public String getBuildingId() {
return buildingId;
}
public void setBuildingId( String buildingId ) {
this.buildingId = buildingId;
}
public String getFloor() {
return floor;
}
public void setFloor( String floor ) {
this.floor = floor;
}
public int getGpsAccuracyStatus() {
return gpsAccuracyStatus;
}
public void setGpsAccuracyStatus( int gpsAccuracyStatus ) {
this.gpsAccuracyStatus = gpsAccuracyStatus;
}
public int getSatellite() {
return satellite;
}
public void setSatellite( int satellite ) {
this.satellite = satellite;
}
public MogoLocation() {
}
@Override
public String toString() {
return "MogoLocation{" +
"locType=" + locType +
", latitude=" + latitude +
", longitude=" + longitude +
", altitude=" + altitude +
", time=" + time +
", bearing=" + bearing +
", accuracy=" + accuracy +
", speed=" + speed +
", cityName='" + cityName + '\'' +
", cityCode='" + cityCode + '\'' +
", provider='" + provider + '\'' +
", address='" + address + '\'' +
", district='" + district + '\'' +
", province='" + province + '\'' +
", adCode='" + adCode + '\'' +
", locationDetail='" + locationDetail + '\'' +
", poiName='" + poiName + '\'' +
", aoiName='" + aoiName + '\'' +
", errCode=" + errCode +
", errInfo='" + errInfo + '\'' +
", streetNum='" + streetNum + '\'' +
", description='" + description + '\'' +
", buildingId='" + buildingId + '\'' +
", floor='" + floor + '\'' +
", gpsAccuracyStatus=" + gpsAccuracyStatus +
", satellite=" + satellite +
'}';
}
public double getAltitude() {
return altitude;
}
public void setAltitude( double altitude ) {
this.altitude = altitude;
}
public String getAddress() {
return address;
}
public void setAddress( String address ) {
this.address = address;
}
public String getDistrict() {
return district;
}
public void setDistrict( String district ) {
this.district = district;
}
public String getProvince() {
return province;
}
public void setProvince( String province ) {
this.province = province;
}
public String getAdCode() {
return adCode;
}
public void setAdCode( String adCode ) {
this.adCode = adCode;
}
public int getLocType() {
return locType;
}
public void setLocType( int locType ) {
this.locType = locType;
}
public double getLatitude() {
return latitude;
}
public void setLatitude( double latitude ) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude( double longitude ) {
this.longitude = longitude;
}
public long getTime() {
return time;
}
public void setTime( long time ) {
this.time = time;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode( String cityCode ) {
this.cityCode = cityCode;
}
public String getCityName() {
return cityName;
}
public void setCityName( String cityName ) {
this.cityName = cityName;
}
@Override
public MogoLocation clone() {
try {
return ( MogoLocation ) super.clone();
} catch ( CloneNotSupportedException e ) {
e.printStackTrace();
}
return this;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeInt( this.locType );
dest.writeDouble( this.latitude );
dest.writeDouble( this.longitude );
dest.writeDouble( this.altitude );
dest.writeLong( this.time );
dest.writeFloat( this.bearing );
dest.writeFloat( this.accuracy );
dest.writeFloat( this.speed );
dest.writeString( this.cityName );
dest.writeString( this.cityCode );
dest.writeString( this.provider );
dest.writeString( this.address );
dest.writeString( this.district );
dest.writeString( this.province );
dest.writeString( this.adCode );
dest.writeString( this.locationDetail );
dest.writeString( this.poiName );
dest.writeString( this.aoiName );
dest.writeInt( this.errCode );
dest.writeString( this.errInfo );
dest.writeString( this.streetNum );
dest.writeString( this.description );
dest.writeString( this.buildingId );
dest.writeString( this.floor );
dest.writeInt( this.gpsAccuracyStatus );
dest.writeInt( this.satellite );
}
protected MogoLocation( Parcel in ) {
this.locType = in.readInt();
this.latitude = in.readDouble();
this.longitude = in.readDouble();
this.altitude = in.readDouble();
this.time = in.readLong();
this.bearing = in.readFloat();
this.accuracy = in.readFloat();
this.speed = in.readFloat();
this.cityName = in.readString();
this.cityCode = in.readString();
this.provider = in.readString();
this.address = in.readString();
this.district = in.readString();
this.province = in.readString();
this.adCode = in.readString();
this.locationDetail = in.readString();
this.poiName = in.readString();
this.aoiName = in.readString();
this.errCode = in.readInt();
this.errInfo = in.readString();
this.streetNum = in.readString();
this.description = in.readString();
this.buildingId = in.readString();
this.floor = in.readString();
this.gpsAccuracyStatus = in.readInt();
this.satellite = in.readInt();
}
public static final Parcelable.Creator< MogoLocation > CREATOR = new Parcelable.Creator< MogoLocation >() {
@Override
public MogoLocation createFromParcel( Parcel source ) {
return new MogoLocation( source );
}
@Override
public MogoLocation[] newArray( int size ) {
return new MogoLocation[size];
}
};
}

View File

@@ -1,14 +0,0 @@
package com.mogo.map.marker;
import android.view.View;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* 自定义 infowindow 适配器
*/
public interface IMogoInfoWindowAdapter {
View getInfoWindow( IMogoMarker marker );
}

View File

@@ -1,174 +0,0 @@
package com.mogo.map.marker;
import android.graphics.Bitmap;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.IMogoLocationClient;
import java.util.ArrayList;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 地图 marker 抽象
*/
public interface IMogoMarker {
/**
* 删除当前marker并销毁Marker的图片等资源
*/
void destroy();
/**
* 删除当前marker。
*/
void remove();
/**
* 隐藏Marker覆盖物的信息窗口。
*/
void hideInfoWindow();
/**
* 设置Marker覆盖物的透明度
*
* @param alpha
*/
void setAlpha( float alpha );
/**
* 设置Marker覆盖物的锚点比例。
*
* @param anchorU
* @param anchorV
*/
void setAnchor( float anchorU, float anchorV );
/**
* 设置Marker覆盖物是否允许拖拽。
*
* @param paramBoolean
*/
void setDraggable( boolean paramBoolean );
/**
* 设置 Marker覆盖物的图标
*
* @param bitmap
*/
void setIcon( Bitmap bitmap );
/**
* 设置 Marker 的图标集合,相同图案的 icon 的 marker 最好使用同一个 BitmapDescriptor 对象以节省内存空间。
*
* @param icons
*/
void setIcons( ArrayList< Bitmap > icons );
/**
* 设置Marker覆盖物的InfoWindow是否允许显示,默认为true
* 设置为false之后, 调用Marker.showInfoWindow() 将不会生效
*
* @param enabled
*/
void setInfoWindowEnable( boolean enabled );
/**
* 设置Marker覆盖物的属性选项类 通过markerOption 给marker设置属性
*
* @param opt
*/
void setMarkerOptions( MogoMarkerOptions opt );
void setObject( Object object );
Object getObject();
/**
* 设置多少帧刷新一次图片资源Marker动画的间隔时间值越小动画越快。
*
* @param period
*/
void setPeriod( int period );
/**
* 设置位置
*
* @param lat
* @param lng
*/
void setPosition( double lat, double lng );
MogoLatLng getPosition();
/**
* 设置Marker覆盖物图片旋转的角度从正北开始逆时针计算。
*
* @param rotate
*/
void setRotateAngle( float rotate );
/**
* 设置Marker 覆盖物的文字片段。
*
* @param snippet
*/
void setSnippet( String snippet );
/**
* 设置Marker 覆盖物的标题。
*
* @param title
*/
void setTitle( String title );
/**
* 设置当前marker在最上面。
*/
void setToTop();
/**
* 设置 Marker 覆盖物的可见属性。
*
* @param visible
*/
void setVisible( boolean visible );
/**
* 设置Marker覆盖物的z轴值。
*
* @param zIndex
*/
void setZIndex( float zIndex );
/**
* 显示 Marker 覆盖物的信息窗口。
*/
void showInfoWindow();
/**
* 设置点击事件
*
* @param listener
*/
void setOnMarkerClickListener( IMogoMarkerClickListener listener );
/**
* 获取点击事件
*
* @return
*/
IMogoMarkerClickListener getOnMarkerClickListener();
/**
* 设置自定义infowindow代理对象
*
* @param adapter
*/
void setInfoWindowAdapter( IMogoInfoWindowAdapter adapter );
IMogoInfoWindowAdapter getInfoWindowAdapter();
boolean isDestroyed();
}

View File

@@ -1,18 +0,0 @@
package com.mogo.map.marker;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* marker 点击事件
*/
public interface IMogoMarkerClickListener {
/**
* 事件是否继续往下传递
*
* @param marker
* @return true - 时间已经处理完毕不继续往下传,否则继续往下传
*/
boolean onMarkerClicked( IMogoMarker marker );
}

View File

@@ -1,10 +0,0 @@
package com.mogo.map.marker;
/**
* @author congtaowang
* @since 2019-12-20
* <p>
* 描述
*/
public class MogoMarker {
}

View File

@@ -1,222 +0,0 @@
package com.mogo.map.marker;
import android.graphics.Bitmap;
import java.util.ArrayList;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 地图marker
*/
public class MogoMarkerOptions {
private double latitude;
private double longitude;
// 设置 Marker覆盖物 的标题
private String title;
// 设置 Marker覆盖物的 文字描述
private String snippet;
// 设置Marker覆盖物的图标。
private Bitmap icon;
// 设置Marker覆盖物的动画帧图标列表多张图片模拟gif的效果。
private ArrayList< Bitmap > icons;
// 设置多少帧刷新一次图片资源Marker动画的间隔时间值越小动画越快。
private int period = 20;
// 设置Marker覆盖物的图片旋转角度从正北开始逆时针计算。
private float rotate;
// 设置Marker覆盖物是否平贴地图。
private boolean flat = false;
// 设置Marker覆盖物是否可见。
private boolean visible = true;
// 设置Marker覆盖物的InfoWindow是否允许显示
private boolean inifoWindowEnable = true;
// 设置Marker覆盖物的透明度
private float alpha = 1.0f;
// Marker覆盖物的坐标是否是Gps
private boolean isGps = false;
// Marker覆盖物锚点在水平范围的比例。
private float u = 0.5f;
// Marker覆盖物锚点垂直范围的比例。
private float v = 0.5f;
// 设置Marker覆盖物是否可拖拽。
private boolean draggable = false;
// Marker覆盖物的InfoWindow相对X 轴的Marker的偏移
private int offsetX = 0;
// Marker覆盖物的InfoWindow相对Y 轴的Marker的偏移
private int offsetY = 0;
// 设置Marker覆盖物 zIndex。
private float zIndex = 0.0f;
public MogoMarkerOptions latitude( double latitude ) {
this.latitude = latitude;
return this;
}
public MogoMarkerOptions longitude( double longitude ) {
this.longitude = longitude;
return this;
}
public MogoMarkerOptions title( String title ) {
this.title = title;
return this;
}
public MogoMarkerOptions snippet( String snippet ) {
this.snippet = snippet;
return this;
}
public MogoMarkerOptions icon( Bitmap icon ) {
this.icon = icon;
return this;
}
public MogoMarkerOptions icons( ArrayList< Bitmap > icons ) {
this.icons = icons;
return this;
}
public MogoMarkerOptions period( int period ) {
this.period = period;
if ( this.period < 1 ) {
this.period = 1;
}
return this;
}
public MogoMarkerOptions rotate( float rotate ) {
this.rotate = rotate;
return this;
}
public MogoMarkerOptions flat( boolean flat ) {
this.flat = flat;
return this;
}
public MogoMarkerOptions visible( boolean visible ) {
this.visible = visible;
return this;
}
public MogoMarkerOptions inifoWindowEnable( boolean inifoWindowEnable ) {
this.inifoWindowEnable = inifoWindowEnable;
return this;
}
public MogoMarkerOptions alpha( float alpha ) {
this.alpha = alpha;
return this;
}
public MogoMarkerOptions gps( boolean gps ) {
isGps = gps;
return this;
}
public MogoMarkerOptions anchor( float u, float v ) {
this.u = u;
this.v = v;
return this;
}
public MogoMarkerOptions draggable( boolean draggable ) {
this.draggable = draggable;
return this;
}
public MogoMarkerOptions setInfoWindowOffset( int offsetX, int offsetY ) {
this.offsetX = offsetX;
this.offsetY = offsetY;
return this;
}
public MogoMarkerOptions zIndex( float zIndex ) {
this.zIndex = zIndex;
return this;
}
public double getLatitude() {
return latitude;
}
public double getLongitude() {
return longitude;
}
public String getTitle() {
return title;
}
public String getSnippet() {
return snippet;
}
public Bitmap getIcon() {
return icon;
}
public ArrayList< Bitmap > getIcons() {
return icons;
}
public int getPeriod() {
return period;
}
public float getRotate() {
return rotate;
}
public boolean isFlat() {
return flat;
}
public boolean isVisible() {
return visible;
}
public boolean isInifoWindowEnable() {
return inifoWindowEnable;
}
public float getAlpha() {
return alpha;
}
public boolean isGps() {
return isGps;
}
public float getU() {
return u;
}
public float getV() {
return v;
}
public boolean isDraggable() {
return draggable;
}
public int getOffsetX() {
return offsetX;
}
public int getOffsetY() {
return offsetY;
}
public float getzIndex() {
return zIndex;
}
}

View File

@@ -1,89 +0,0 @@
package com.mogo.map.marker;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* 管理地图上的所有marker
*/
public class MogoMarkersHandler {
private static volatile MogoMarkersHandler sInstance;
public static MogoMarkersHandler getInstance() {
if ( sInstance == null ) {
synchronized ( MogoMarkersHandler.class ) {
if ( sInstance == null ) {
sInstance = new MogoMarkersHandler();
}
}
}
return sInstance;
}
private Map< String, List< IMogoMarker > > mServicesMarkers = new HashMap<>();
private MogoMarkersHandler() {
}
public synchronized void release() {
sInstance = null;
}
public synchronized void removeAll() {
final Collection< List< IMogoMarker > > mogoMarkers = mServicesMarkers.values();
for ( List< IMogoMarker > mogoMarkerList : mogoMarkers ) {
if ( mogoMarkerList != null && !mogoMarkerList.isEmpty() ) {
for ( IMogoMarker mogoMarker : mogoMarkerList ) {
try {
mogoMarker.destroy();
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
}
mServicesMarkers.clear();
}
public synchronized void remove( String tag ) {
List< IMogoMarker > mogoMarkerList = mServicesMarkers.remove( tag );
if ( mogoMarkerList != null && !mogoMarkerList.isEmpty() ) {
for ( IMogoMarker mogoMarker : mogoMarkerList ) {
try {
mogoMarker.destroy();
} catch ( Exception e ) {
e.printStackTrace();
}
}
mogoMarkerList.clear();
}
}
public synchronized void add( String tag, IMogoMarker marker ) {
if ( marker == null ) {
return;
}
if ( !mServicesMarkers.containsKey( tag ) ) {
mServicesMarkers.put( tag, new ArrayList< IMogoMarker >() );
}
mServicesMarkers.get( tag ).add( marker );
}
public synchronized void add( String tag, List< IMogoMarker > markers ) {
if ( markers == null || markers.isEmpty() ) {
return;
}
if ( !mServicesMarkers.containsKey( tag ) ) {
mServicesMarkers.put( tag, new ArrayList< IMogoMarker >() );
}
mServicesMarkers.get( tag ).addAll( markers );
}
}

View File

@@ -1,76 +0,0 @@
package com.mogo.map.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* 地图上的poi
*/
public class MogoPoi implements Parcelable {
private String name;
private MogoLatLng coordinate;
private String poiId;
public String getName() {
return name;
}
public void setName( String name ) {
this.name = name;
}
public MogoLatLng getCoordinate() {
return coordinate;
}
public void setCoordinate( MogoLatLng coordinate ) {
this.coordinate = coordinate;
}
public String getPoiId() {
return poiId;
}
public void setPoiId( String poiId ) {
this.poiId = poiId;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.name );
dest.writeParcelable( this.coordinate, flags );
dest.writeString( this.poiId );
}
public MogoPoi() {
}
protected MogoPoi( Parcel in ) {
this.name = in.readString();
this.coordinate = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.poiId = in.readString();
}
public static final Parcelable.Creator< MogoPoi > CREATOR = new Parcelable.Creator< MogoPoi >() {
@Override
public MogoPoi createFromParcel( Parcel source ) {
return new MogoPoi( source );
}
@Override
public MogoPoi[] newArray( int size ) {
return new MogoPoi[size];
}
};
}

View File

@@ -1,55 +0,0 @@
package com.mogo.map.search.geo;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 地理/逆地理位置搜索
*/
public interface IMogoGeoSearch {
/**
* 添加异步编码回调
*
* @param listener
*/
void setGeoSearchListener( IMogoGeoSearchListener listener );
/**
* 同步获取逆地理编码地址
*
* @param query
* @return
* @throws MogoMapException
*/
MogoRegeocodeAddress getFromLocation( MogoRegeocodeQuery query ) throws MogoMapException;
/**
* 同步获取地理编码地址列表
*
* @param query
* @return
* @throws MogoMapException
*/
List< MogoGeocodeAddress > getFromLocationName( MogoGeocodeQuery query ) throws MogoMapException;
/**
* 异步获取逆地理编码
*
* @param query
*/
void getFromLocationAsyn( MogoRegeocodeQuery query );
/**
* 同步获取地理编码回调
*
* @param query
*/
void getFromLocationNameAsyn( MogoGeocodeQuery query );
}

View File

@@ -1,26 +0,0 @@
package com.mogo.map.search.geo;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 逆地理/地理编码回调
*/
public interface IMogoGeoSearchListener {
/**
* 逆地理编码(根据经纬度获取地理位置信息)
*
* @param regeocodeResult
* @param rCode
*/
void onRegeocodeSearched( MogoRegeocodeResult regeocodeResult, int rCode );
/**
* 根据名称和城市获取地理位置信息
*
* @param geocodeResult
* @param i
*/
void onGeocodeSearched( MogoGeocodeResult geocodeResult, int i );
}

View File

@@ -1,99 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoAoiItem implements Parcelable {
private String aoiId;
private String aoiName;
private String adCode;
private MogoLatLng aoiCenterPoint;
private float aoiArea;
public String getAoiId() {
return aoiId;
}
public void setAoiId( String aoiId ) {
this.aoiId = aoiId;
}
public String getAoiName() {
return aoiName;
}
public void setAoiName( String aoiName ) {
this.aoiName = aoiName;
}
public String getAdCode() {
return adCode;
}
public void setAdCode( String adCode ) {
this.adCode = adCode;
}
public MogoLatLng getAoiCenterPoint() {
return aoiCenterPoint;
}
public void setAoiCenterPoint( MogoLatLng aoiCenterPoint ) {
this.aoiCenterPoint = aoiCenterPoint;
}
public float getAoiArea() {
return aoiArea;
}
public void setAoiArea( float aoiArea ) {
this.aoiArea = aoiArea;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.aoiId );
dest.writeString( this.aoiName );
dest.writeString( this.adCode );
dest.writeParcelable( this.aoiCenterPoint, flags );
dest.writeFloat( this.aoiArea );
}
public MogoAoiItem() {
}
protected MogoAoiItem( Parcel in ) {
this.aoiId = in.readString();
this.aoiName = in.readString();
this.adCode = in.readString();
this.aoiCenterPoint = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.aoiArea = in.readFloat();
}
public static final Parcelable.Creator< MogoAoiItem > CREATOR = new Parcelable.Creator< MogoAoiItem >() {
@Override
public MogoAoiItem createFromParcel( Parcel source ) {
return new MogoAoiItem( source );
}
@Override
public MogoAoiItem[] newArray( int size ) {
return new MogoAoiItem[size];
}
};
}

View File

@@ -1,66 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoBusinessArea implements Parcelable {
private MogoLatLng centerPoint;
private String name;
public MogoLatLng getCenterPoint() {
return centerPoint;
}
public void setCenterPoint( MogoLatLng centerPoint ) {
this.centerPoint = centerPoint;
}
public String getName() {
return name;
}
public void setName( String name ) {
this.name = name;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeParcelable( this.centerPoint, flags );
dest.writeString( this.name );
}
public MogoBusinessArea() {
}
protected MogoBusinessArea( Parcel in ) {
this.centerPoint = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.name = in.readString();
}
public static final Parcelable.Creator< MogoBusinessArea > CREATOR = new Parcelable.Creator< MogoBusinessArea >() {
@Override
public MogoBusinessArea createFromParcel( Parcel source ) {
return new MogoBusinessArea( source );
}
@Override
public MogoBusinessArea[] newArray( int size ) {
return new MogoBusinessArea[size];
}
};
}

View File

@@ -1,108 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoCrossroad implements Parcelable {
private float distance;
private String direction;
private String firstRoadId;
private String firstRoadName;
private String secondRoadId;
private String secondRoadName;
public float getDistance() {
return distance;
}
public void setDistance( float distance ) {
this.distance = distance;
}
public String getDirection() {
return direction;
}
public void setDirection( String direction ) {
this.direction = direction;
}
public String getFirstRoadId() {
return firstRoadId;
}
public void setFirstRoadId( String firstRoadId ) {
this.firstRoadId = firstRoadId;
}
public String getFirstRoadName() {
return firstRoadName;
}
public void setFirstRoadName( String firstRoadName ) {
this.firstRoadName = firstRoadName;
}
public String getSecondRoadId() {
return secondRoadId;
}
public void setSecondRoadId( String secondRoadId ) {
this.secondRoadId = secondRoadId;
}
public String getSecondRoadName() {
return secondRoadName;
}
public void setSecondRoadName( String secondRoadName ) {
this.secondRoadName = secondRoadName;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeFloat( this.distance );
dest.writeString( this.direction );
dest.writeString( this.firstRoadId );
dest.writeString( this.firstRoadName );
dest.writeString( this.secondRoadId );
dest.writeString( this.secondRoadName );
}
public MogoCrossroad() {
}
protected MogoCrossroad( Parcel in ) {
this.distance = in.readFloat();
this.direction = in.readString();
this.firstRoadId = in.readString();
this.firstRoadName = in.readString();
this.secondRoadId = in.readString();
this.secondRoadName = in.readString();
}
public static final Parcelable.Creator< MogoCrossroad > CREATOR = new Parcelable.Creator< MogoCrossroad >() {
@Override
public MogoCrossroad createFromParcel( Parcel source ) {
return new MogoCrossroad( source );
}
@Override
public MogoCrossroad[] newArray( int size ) {
return new MogoCrossroad[size];
}
};
}

View File

@@ -1,103 +0,0 @@
package com.mogo.map.search.geo;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* geo 搜索位置信息
*/
public class MogoGeocodeAddress {
private String formatAddress;
private String province;
private String city;
private String district;
private String township;
private String neighborhood;
private String building;
private String adcode;
private MogoLatLng latlng;
private String level;
public String getFormatAddress() {
return formatAddress;
}
public void setFormatAddress( String formatAddress ) {
this.formatAddress = formatAddress;
}
public String getProvince() {
return province;
}
public void setProvince( String province ) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity( String city ) {
this.city = city;
}
public String getDistrict() {
return district;
}
public void setDistrict( String district ) {
this.district = district;
}
public String getTownship() {
return township;
}
public void setTownship( String township ) {
this.township = township;
}
public String getNeighborhood() {
return neighborhood;
}
public void setNeighborhood( String neighborhood ) {
this.neighborhood = neighborhood;
}
public String getBuilding() {
return building;
}
public void setBuilding( String building ) {
this.building = building;
}
public String getAdcode() {
return adcode;
}
public void setAdcode( String adcode ) {
this.adcode = adcode;
}
public MogoLatLng getLatlng() {
return latlng;
}
public void setLatlng( MogoLatLng latlng ) {
this.latlng = latlng;
}
public String getLevel() {
return level;
}
public void setLevel( String level ) {
this.level = level;
}
}

View File

@@ -1,23 +0,0 @@
package com.mogo.map.search.geo;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 地理编码搜索结果
*/
public class MogoGeocodeResult {
private List< MogoGeocodeAddress > addresses = new ArrayList<>();
public List< MogoGeocodeAddress > getAddresses() {
return addresses;
}
public void setAddresses( List< MogoGeocodeAddress > addresses ) {
this.addresses = addresses;
}
}

View File

@@ -1,75 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoIndoorData implements Parcelable {
private String poiId;
private int floor;
private String floorName;
public String getPoiId() {
return poiId;
}
public void setPoiId( String poiId ) {
this.poiId = poiId;
}
public int getFloor() {
return floor;
}
public void setFloor( int floor ) {
this.floor = floor;
}
public String getFloorName() {
return floorName;
}
public void setFloorName( String floorName ) {
this.floorName = floorName;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.poiId );
dest.writeInt( this.floor );
dest.writeString( this.floorName );
}
public MogoIndoorData() {
}
protected MogoIndoorData( Parcel in ) {
this.poiId = in.readString();
this.floor = in.readInt();
this.floorName = in.readString();
}
public static final Parcelable.Creator< MogoIndoorData > CREATOR = new Parcelable.Creator< MogoIndoorData >() {
@Override
public MogoIndoorData createFromParcel( Parcel source ) {
return new MogoIndoorData( source );
}
@Override
public MogoIndoorData[] newArray( int size ) {
return new MogoIndoorData[size];
}
};
}

View File

@@ -1,64 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoPhoto implements Parcelable {
private String title;
private String url;
public String getTitle() {
return title;
}
public void setTitle( String title ) {
this.title = title;
}
public String getUrl() {
return url;
}
public void setUrl( String url ) {
this.url = url;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.title );
dest.writeString( this.url );
}
public MogoPhoto() {
}
protected MogoPhoto( Parcel in ) {
this.title = in.readString();
this.url = in.readString();
}
public static final Parcelable.Creator< MogoPhoto > CREATOR = new Parcelable.Creator< MogoPhoto >() {
@Override
public MogoPhoto createFromParcel( Parcel source ) {
return new MogoPhoto( source );
}
@Override
public MogoPhoto[] newArray( int size ) {
return new MogoPhoto[size];
}
};
}

View File

@@ -1,355 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoPoiItem implements Parcelable {
private String businessArea;
private String adName;
private String cityName;
private String provinceName;
private String typeDes;
private String tel;
private String adCode;
private String poiId;
private int distance;
private String title;
private String snippet;
private MogoLatLng point;
private String cityCode;
private MogoLatLng enter;
private MogoLatLng exit;
private String website;
private String postcode;
private String email;
private String direction;
private boolean indoorMap;
private String provinceCode;
private String parkingType;
private List< MogoSubPoiItem > subPois = new ArrayList<>();
private MogoIndoorData indoorData;
private List< MogoPhoto > photos = new ArrayList<>();
private MogoPoiItemExtension poiExtension;
private String typeCode;
private String shopID;
public String getBusinessArea() {
return businessArea;
}
public void setBusinessArea( String businessArea ) {
this.businessArea = businessArea;
}
public String getAdName() {
return adName;
}
public void setAdName( String adName ) {
this.adName = adName;
}
public String getCityName() {
return cityName;
}
public void setCityName( String cityName ) {
this.cityName = cityName;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName( String provinceName ) {
this.provinceName = provinceName;
}
public String getTypeDes() {
return typeDes;
}
public void setTypeDes( String typeDes ) {
this.typeDes = typeDes;
}
public String getTel() {
return tel;
}
public void setTel( String tel ) {
this.tel = tel;
}
public String getAdCode() {
return adCode;
}
public void setAdCode( String adCode ) {
this.adCode = adCode;
}
public String getPoiId() {
return poiId;
}
public void setPoiId( String poiId ) {
this.poiId = poiId;
}
public int getDistance() {
return distance;
}
public void setDistance( int distance ) {
this.distance = distance;
}
public String getTitle() {
return title;
}
public void setTitle( String title ) {
this.title = title;
}
public String getSnippet() {
return snippet;
}
public void setSnippet( String snippet ) {
this.snippet = snippet;
}
public MogoLatLng getPoint() {
return point;
}
public void setPoint( MogoLatLng point ) {
this.point = point;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode( String cityCode ) {
this.cityCode = cityCode;
}
public MogoLatLng getEnter() {
return enter;
}
public void setEnter( MogoLatLng enter ) {
this.enter = enter;
}
public MogoLatLng getExit() {
return exit;
}
public void setExit( MogoLatLng exit ) {
this.exit = exit;
}
public String getWebsite() {
return website;
}
public void setWebsite( String website ) {
this.website = website;
}
public String getPostcode() {
return postcode;
}
public void setPostcode( String postcode ) {
this.postcode = postcode;
}
public String getEmail() {
return email;
}
public void setEmail( String email ) {
this.email = email;
}
public String getDirection() {
return direction;
}
public void setDirection( String direction ) {
this.direction = direction;
}
public boolean isIndoorMap() {
return indoorMap;
}
public void setIndoorMap( boolean indoorMap ) {
this.indoorMap = indoorMap;
}
public String getProvinceCode() {
return provinceCode;
}
public void setProvinceCode( String provinceCode ) {
this.provinceCode = provinceCode;
}
public String getParkingType() {
return parkingType;
}
public void setParkingType( String parkingType ) {
this.parkingType = parkingType;
}
public List< MogoSubPoiItem > getSubPois() {
return subPois;
}
public void setSubPois( List< MogoSubPoiItem > subPois ) {
this.subPois = subPois;
}
public MogoIndoorData getIndoorData() {
return indoorData;
}
public void setIndoorData( MogoIndoorData indoorData ) {
this.indoorData = indoorData;
}
public List< MogoPhoto > getPhotos() {
return photos;
}
public void setPhotos( List< MogoPhoto > photos ) {
this.photos = photos;
}
public MogoPoiItemExtension getPoiExtension() {
return poiExtension;
}
public void setPoiExtension( MogoPoiItemExtension poiExtension ) {
this.poiExtension = poiExtension;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode( String typeCode ) {
this.typeCode = typeCode;
}
public String getShopID() {
return shopID;
}
public void setShopID( String shopID ) {
this.shopID = shopID;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.businessArea );
dest.writeString( this.adName );
dest.writeString( this.cityName );
dest.writeString( this.provinceName );
dest.writeString( this.typeDes );
dest.writeString( this.tel );
dest.writeString( this.adCode );
dest.writeString( this.poiId );
dest.writeInt( this.distance );
dest.writeString( this.title );
dest.writeString( this.snippet );
dest.writeParcelable( this.point, flags );
dest.writeString( this.cityCode );
dest.writeParcelable( this.enter, flags );
dest.writeParcelable( this.exit, flags );
dest.writeString( this.website );
dest.writeString( this.postcode );
dest.writeString( this.email );
dest.writeString( this.direction );
dest.writeByte( this.indoorMap ? ( byte ) 1 : ( byte ) 0 );
dest.writeString( this.provinceCode );
dest.writeString( this.parkingType );
dest.writeTypedList( this.subPois );
dest.writeParcelable( this.indoorData, flags );
dest.writeTypedList( this.photos );
dest.writeParcelable( this.poiExtension, flags );
dest.writeString( this.typeCode );
dest.writeString( this.shopID );
}
public MogoPoiItem() {
}
protected MogoPoiItem( Parcel in ) {
this.businessArea = in.readString();
this.adName = in.readString();
this.cityName = in.readString();
this.provinceName = in.readString();
this.typeDes = in.readString();
this.tel = in.readString();
this.adCode = in.readString();
this.poiId = in.readString();
this.distance = in.readInt();
this.title = in.readString();
this.snippet = in.readString();
this.point = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.cityCode = in.readString();
this.enter = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.exit = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.website = in.readString();
this.postcode = in.readString();
this.email = in.readString();
this.direction = in.readString();
this.indoorMap = in.readByte() != 0;
this.provinceCode = in.readString();
this.parkingType = in.readString();
this.subPois = in.createTypedArrayList( MogoSubPoiItem.CREATOR );
this.indoorData = in.readParcelable( MogoIndoorData.class.getClassLoader() );
this.photos = in.createTypedArrayList( MogoPhoto.CREATOR );
this.poiExtension = in.readParcelable( MogoPoiItemExtension.class.getClassLoader() );
this.typeCode = in.readString();
this.shopID = in.readString();
}
public static final Creator< MogoPoiItem > CREATOR = new Creator< MogoPoiItem >() {
@Override
public MogoPoiItem createFromParcel( Parcel source ) {
return new MogoPoiItem( source );
}
@Override
public MogoPoiItem[] newArray( int size ) {
return new MogoPoiItem[size];
}
};
}

View File

@@ -1,63 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoPoiItemExtension implements Parcelable {
private String opentime;
private String rating;
public String getOpentime() {
return opentime;
}
public void setOpentime( String opentime ) {
this.opentime = opentime;
}
public String getRating() {
return rating;
}
public void setRating( String rating ) {
this.rating = rating;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.opentime );
dest.writeString( this.rating );
}
public MogoPoiItemExtension() {
}
protected MogoPoiItemExtension( Parcel in ) {
this.opentime = in.readString();
this.rating = in.readString();
}
public static final Parcelable.Creator< MogoPoiItemExtension > CREATOR = new Parcelable.Creator< MogoPoiItemExtension >() {
@Override
public MogoPoiItemExtension createFromParcel( Parcel source ) {
return new MogoPoiItemExtension( source );
}
@Override
public MogoPoiItemExtension[] newArray( int size ) {
return new MogoPoiItemExtension[size];
}
};
}

View File

@@ -1,231 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 逆地理编码地址
*/
public class MogoRegeocodeAddress implements Parcelable {
private String formatAddress;
private String province;
private String city;
private String cityCode;
private String adCode;
private String district;
private String township;
private String neighborhood;
private String building;
private MogoStreetNumber streetNumber;
private List< MogoRegeocodeRoad > roads;
private List< MogoPoiItem > pois;
private List< MogoCrossroad > crossroads;
private List< MogoBusinessArea > businessAreas;
private List< MogoAoiItem > aois;
private String towncode;
private String country;
public String getFormatAddress() {
return formatAddress;
}
public void setFormatAddress( String formatAddress ) {
this.formatAddress = formatAddress;
}
public String getProvince() {
return province;
}
public void setProvince( String province ) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity( String city ) {
this.city = city;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode( String cityCode ) {
this.cityCode = cityCode;
}
public String getAdCode() {
return adCode;
}
public void setAdCode( String adCode ) {
this.adCode = adCode;
}
public String getDistrict() {
return district;
}
public void setDistrict( String district ) {
this.district = district;
}
public String getTownship() {
return township;
}
public void setTownship( String township ) {
this.township = township;
}
public String getNeighborhood() {
return neighborhood;
}
public void setNeighborhood( String neighborhood ) {
this.neighborhood = neighborhood;
}
public String getBuilding() {
return building;
}
public void setBuilding( String building ) {
this.building = building;
}
public MogoStreetNumber getStreetNumber() {
return streetNumber;
}
public void setStreetNumber( MogoStreetNumber streetNumber ) {
this.streetNumber = streetNumber;
}
public List< MogoRegeocodeRoad > getRoads() {
return roads;
}
public void setRoads( List< MogoRegeocodeRoad > roads ) {
this.roads = roads;
}
public List< MogoPoiItem > getPois() {
return pois;
}
public void setPois( List< MogoPoiItem > pois ) {
this.pois = pois;
}
public List< MogoCrossroad > getCrossroads() {
return crossroads;
}
public void setCrossroads( List< MogoCrossroad > crossroads ) {
this.crossroads = crossroads;
}
public List< MogoBusinessArea > getBusinessAreas() {
return businessAreas;
}
public void setBusinessAreas( List< MogoBusinessArea > businessAreas ) {
this.businessAreas = businessAreas;
}
public List< MogoAoiItem > getAois() {
return aois;
}
public void setAois( List< MogoAoiItem > aois ) {
this.aois = aois;
}
public String getTowncode() {
return towncode;
}
public void setTowncode( String towncode ) {
this.towncode = towncode;
}
public String getCountry() {
return country;
}
public void setCountry( String country ) {
this.country = country;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.formatAddress );
dest.writeString( this.province );
dest.writeString( this.city );
dest.writeString( this.cityCode );
dest.writeString( this.adCode );
dest.writeString( this.district );
dest.writeString( this.township );
dest.writeString( this.neighborhood );
dest.writeString( this.building );
dest.writeParcelable( this.streetNumber, flags );
dest.writeTypedList( this.roads );
dest.writeTypedList( this.pois );
dest.writeTypedList( this.crossroads );
dest.writeTypedList( this.businessAreas );
dest.writeTypedList( this.aois );
dest.writeString( this.towncode );
dest.writeString( this.country );
}
public MogoRegeocodeAddress() {
}
protected MogoRegeocodeAddress( Parcel in ) {
this.formatAddress = in.readString();
this.province = in.readString();
this.city = in.readString();
this.cityCode = in.readString();
this.adCode = in.readString();
this.district = in.readString();
this.township = in.readString();
this.neighborhood = in.readString();
this.building = in.readString();
this.streetNumber = in.readParcelable( MogoStreetNumber.class.getClassLoader() );
this.roads = in.createTypedArrayList( MogoRegeocodeRoad.CREATOR );
this.pois = in.createTypedArrayList( MogoPoiItem.CREATOR );
this.crossroads = in.createTypedArrayList( MogoCrossroad.CREATOR );
this.businessAreas = in.createTypedArrayList( MogoBusinessArea.CREATOR );
this.aois = in.createTypedArrayList( MogoAoiItem.CREATOR );
this.towncode = in.readString();
this.country = in.readString();
}
public static final Parcelable.Creator< MogoRegeocodeAddress > CREATOR = new Parcelable.Creator< MogoRegeocodeAddress >() {
@Override
public MogoRegeocodeAddress createFromParcel( Parcel source ) {
return new MogoRegeocodeAddress( source );
}
@Override
public MogoRegeocodeAddress[] newArray( int size ) {
return new MogoRegeocodeAddress[size];
}
};
}

View File

@@ -1,53 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 逆地理编码结果
*/
public class MogoRegeocodeResult implements Parcelable {
private MogoRegeocodeAddress regeocodeAddress;
public MogoRegeocodeAddress getRegeocodeAddress() {
return regeocodeAddress;
}
public void setRegeocodeAddress( MogoRegeocodeAddress regeocodeAddress ) {
this.regeocodeAddress = regeocodeAddress;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeParcelable( this.regeocodeAddress, flags );
}
public MogoRegeocodeResult() {
}
protected MogoRegeocodeResult( Parcel in ) {
this.regeocodeAddress = in.readParcelable( MogoRegeocodeAddress.class.getClassLoader() );
}
public static final Parcelable.Creator< MogoRegeocodeResult > CREATOR = new Parcelable.Creator< MogoRegeocodeResult >() {
@Override
public MogoRegeocodeResult createFromParcel( Parcel source ) {
return new MogoRegeocodeResult( source );
}
@Override
public MogoRegeocodeResult[] newArray( int size ) {
return new MogoRegeocodeResult[size];
}
};
}

View File

@@ -1,98 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoRegeocodeRoad implements Parcelable {
private String id;
private String name;
private float distance;
private String direction;
private MogoLatLng point;
public String getId() {
return id;
}
public void setId( String id ) {
this.id = id;
}
public String getName() {
return name;
}
public void setName( String name ) {
this.name = name;
}
public float getDistance() {
return distance;
}
public void setDistance( float distance ) {
this.distance = distance;
}
public String getDirection() {
return direction;
}
public void setDirection( String direction ) {
this.direction = direction;
}
public MogoLatLng getPoint() {
return point;
}
public void setPoint( MogoLatLng point ) {
this.point = point;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.id );
dest.writeString( this.name );
dest.writeFloat( this.distance );
dest.writeString( this.direction );
dest.writeParcelable( this.point, flags );
}
public MogoRegeocodeRoad() {
}
protected MogoRegeocodeRoad( Parcel in ) {
this.id = in.readString();
this.name = in.readString();
this.distance = in.readFloat();
this.direction = in.readString();
this.point = in.readParcelable( MogoLatLng.class.getClassLoader() );
}
public static final Parcelable.Creator< MogoRegeocodeRoad > CREATOR = new Parcelable.Creator< MogoRegeocodeRoad >() {
@Override
public MogoRegeocodeRoad createFromParcel( Parcel source ) {
return new MogoRegeocodeRoad( source );
}
@Override
public MogoRegeocodeRoad[] newArray( int size ) {
return new MogoRegeocodeRoad[size];
}
};
}

View File

@@ -1,98 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoStreetNumber implements Parcelable {
private String street;
private String number;
private MogoLatLng latLonPoint;
private String direction;
private float distance;
public String getStreet() {
return street;
}
public void setStreet( String street ) {
this.street = street;
}
public String getNumber() {
return number;
}
public void setNumber( String number ) {
this.number = number;
}
public MogoLatLng getLatLonPoint() {
return latLonPoint;
}
public void setLatLonPoint( MogoLatLng latLonPoint ) {
this.latLonPoint = latLonPoint;
}
public String getDirection() {
return direction;
}
public void setDirection( String direction ) {
this.direction = direction;
}
public float getDistance() {
return distance;
}
public void setDistance( float distance ) {
this.distance = distance;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.street );
dest.writeString( this.number );
dest.writeParcelable( this.latLonPoint, flags );
dest.writeString( this.direction );
dest.writeFloat( this.distance );
}
public MogoStreetNumber() {
}
protected MogoStreetNumber( Parcel in ) {
this.street = in.readString();
this.number = in.readString();
this.latLonPoint = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.direction = in.readString();
this.distance = in.readFloat();
}
public static final Parcelable.Creator< MogoStreetNumber > CREATOR = new Parcelable.Creator< MogoStreetNumber >() {
@Override
public MogoStreetNumber createFromParcel( Parcel source ) {
return new MogoStreetNumber( source );
}
@Override
public MogoStreetNumber[] newArray( int size ) {
return new MogoStreetNumber[size];
}
};
}

View File

@@ -1,121 +0,0 @@
package com.mogo.map.search.geo;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 描述
*/
public class MogoSubPoiItem implements Parcelable {
private String poiId;
private String title;
private String subName;
private int distance;
private MogoLatLng point;
private String snippet;
private String subTypeDes;
public String getPoiId() {
return poiId;
}
public void setPoiId( String poiId ) {
this.poiId = poiId;
}
public String getTitle() {
return title;
}
public void setTitle( String title ) {
this.title = title;
}
public String getSubName() {
return subName;
}
public void setSubName( String subName ) {
this.subName = subName;
}
public int getDistance() {
return distance;
}
public void setDistance( int distance ) {
this.distance = distance;
}
public MogoLatLng getPoint() {
return point;
}
public void setPoint( MogoLatLng point ) {
this.point = point;
}
public String getSnippet() {
return snippet;
}
public void setSnippet( String snippet ) {
this.snippet = snippet;
}
public String getSubTypeDes() {
return subTypeDes;
}
public void setSubTypeDes( String subTypeDes ) {
this.subTypeDes = subTypeDes;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.poiId );
dest.writeString( this.title );
dest.writeString( this.subName );
dest.writeInt( this.distance );
dest.writeParcelable( this.point, flags );
dest.writeString( this.snippet );
dest.writeString( this.subTypeDes );
}
public MogoSubPoiItem() {
}
protected MogoSubPoiItem( Parcel in ) {
this.poiId = in.readString();
this.title = in.readString();
this.subName = in.readString();
this.distance = in.readInt();
this.point = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.snippet = in.readString();
this.subTypeDes = in.readString();
}
public static final Parcelable.Creator< MogoSubPoiItem > CREATOR = new Parcelable.Creator< MogoSubPoiItem >() {
@Override
public MogoSubPoiItem createFromParcel( Parcel source ) {
return new MogoSubPoiItem( source );
}
@Override
public MogoSubPoiItem[] newArray( int size ) {
return new MogoSubPoiItem[size];
}
};
}

View File

@@ -1,63 +0,0 @@
package com.mogo.map.search.geo.query;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 地理编码查询条件
*/
public class MogoGeocodeQuery implements Parcelable {
private String locationName;
private String city;
public String getLocationName() {
return locationName;
}
public void setLocationName( String locationName ) {
this.locationName = locationName;
}
public String getCity() {
return city;
}
public void setCity( String city ) {
this.city = city;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.locationName );
dest.writeString( this.city );
}
public MogoGeocodeQuery() {
}
protected MogoGeocodeQuery( Parcel in ) {
this.locationName = in.readString();
this.city = in.readString();
}
public static final Parcelable.Creator< MogoGeocodeQuery > CREATOR = new Parcelable.Creator< MogoGeocodeQuery >() {
@Override
public MogoGeocodeQuery createFromParcel( Parcel source ) {
return new MogoGeocodeQuery( source );
}
@Override
public MogoGeocodeQuery[] newArray( int size ) {
return new MogoGeocodeQuery[size];
}
};
}

View File

@@ -1,88 +0,0 @@
package com.mogo.map.search.geo.query;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 逆地理编码查询条件
*/
public class MogoRegeocodeQuery implements Parcelable {
private MogoLatLng point;
private float radius;
private String latlngType;
private String poiType;
public MogoLatLng getPoint() {
return point;
}
public void setPoint( MogoLatLng point ) {
this.point = point;
}
public float getRadius() {
return radius;
}
public void setRadius( float radius ) {
this.radius = radius;
}
public String getLatlngType() {
return latlngType;
}
public void setLatlngType( String latlngType ) {
this.latlngType = latlngType;
}
public String getPoiType() {
return poiType;
}
public void setPoiType( String poiType ) {
this.poiType = poiType;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeParcelable( this.point, flags );
dest.writeFloat( this.radius );
dest.writeString( this.latlngType );
dest.writeString( this.poiType );
}
public MogoRegeocodeQuery() {
}
protected MogoRegeocodeQuery( Parcel in ) {
this.point = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.radius = in.readFloat();
this.latlngType = in.readString();
this.poiType = in.readString();
}
public static final Parcelable.Creator< MogoRegeocodeQuery > CREATOR = new Parcelable.Creator< MogoRegeocodeQuery >() {
@Override
public MogoRegeocodeQuery createFromParcel( Parcel source ) {
return new MogoRegeocodeQuery( source );
}
@Override
public MogoRegeocodeQuery[] newArray( int size ) {
return new MogoRegeocodeQuery[size];
}
};
}

View File

@@ -1,14 +0,0 @@
package com.mogo.map.search.inputtips;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-20
* <p>
* 描述
*/
public interface IMogoInputtipsListener {
void onGetInputtips( List< MogoTip > result, int code );
}

View File

@@ -1,24 +0,0 @@
package com.mogo.map.search.inputtips;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-20
* <p>
* 描述
*/
public interface IMogoInputtipsSearch {
void setQuery( MogoInputtipsQuery query );
void setInputtipsListener( IMogoInputtipsListener listener );
void requestInputtipsAsyn();
List< MogoTip > requestInputtips() throws MogoMapException;
}

View File

@@ -1,120 +0,0 @@
package com.mogo.map.search.inputtips;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-20
* <p>
* inputtips 搜索结果
*/
public class MogoTip implements Parcelable {
private String poiID;
private MogoLatLng point;
private String name;
private String district;
private String adCode;
private String address;
private String typeCode;
public String getPoiID() {
return poiID;
}
public void setPoiID( String poiID ) {
this.poiID = poiID;
}
public MogoLatLng getPoint() {
return point;
}
public void setPoint( MogoLatLng point ) {
this.point = point;
}
public String getName() {
return name;
}
public void setName( String name ) {
this.name = name;
}
public String getDistrict() {
return district;
}
public void setDistrict( String district ) {
this.district = district;
}
public String getAdCode() {
return adCode;
}
public void setAdCode( String adCode ) {
this.adCode = adCode;
}
public String getAddress() {
return address;
}
public void setAddress( String address ) {
this.address = address;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode( String typeCode ) {
this.typeCode = typeCode;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.poiID );
dest.writeParcelable( this.point, flags );
dest.writeString( this.name );
dest.writeString( this.district );
dest.writeString( this.adCode );
dest.writeString( this.address );
dest.writeString( this.typeCode );
}
public MogoTip() {
}
protected MogoTip( Parcel in ) {
this.poiID = in.readString();
this.point = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.name = in.readString();
this.district = in.readString();
this.adCode = in.readString();
this.address = in.readString();
this.typeCode = in.readString();
}
public static final Parcelable.Creator< MogoTip > CREATOR = new Parcelable.Creator< MogoTip >() {
@Override
public MogoTip createFromParcel( Parcel source ) {
return new MogoTip( source );
}
@Override
public MogoTip[] newArray( int size ) {
return new MogoTip[size];
}
};
}

View File

@@ -1,58 +0,0 @@
package com.mogo.map.search.inputtips.query;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-20
* <p>
* inputtips 搜索条件
*/
public class MogoInputtipsQuery {
private String keyword;
private String city;
private String type;
private boolean cityLimit;
private MogoLatLng location;
public String getKeyword() {
return keyword;
}
public void setKeyword( String keyword ) {
this.keyword = keyword;
}
public String getCity() {
return city;
}
public void setCity( String city ) {
this.city = city;
}
public String getType() {
return type;
}
public void setType( String type ) {
this.type = type;
}
public boolean isCityLimit() {
return cityLimit;
}
public void setCityLimit( boolean cityLimit ) {
this.cityLimit = cityLimit;
}
public MogoLatLng getLocation() {
return location;
}
public void setLocation( MogoLatLng location ) {
this.location = location;
}
}

View File

@@ -1,57 +0,0 @@
package com.mogo.map.search.poisearch;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.search.geo.MogoPoiItem;
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* poi 搜索
*/
public interface IMogoPoiSearch {
void setPoiSearchListener( IMogoPoiSearchListener listener );
/**
* 异步搜索poi信息
*/
void searchPOIAsyn();
/**
* 同步搜索poi信息
*
* @return
*/
MogoPoiResult searchPOI() throws MogoMapException;
/**
* 设置查询条件
*
* @param query
*/
void setQuery( MogoPoiSearchQuery query );
/**
* 根据poiId搜索详情同步
*
* @param poiId
* @return
*/
MogoPoiItem searchPOIId( String poiId ) throws MogoMapException;
/**
* 根据poiId搜索详情异步
*
* @param poiId
*/
void searchPOIIdAsyn( String poiId );
/**
* 周边检索POI
*
* @param bound
*/
void setBound( MogoSearchBound bound );
}

View File

@@ -1,22 +0,0 @@
package com.mogo.map.search.poisearch;
import com.mogo.map.search.geo.MogoPoiItem;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* poi 检索结果回调
*/
public interface IMogoPoiSearchListener {
/**
* 返回POI搜索异步处理的结果。
*/
void onPoiSearched( MogoPoiResult result, int errorCode );
/**
* poi ID 检索结果回调方法
*/
void onPoiItemSearched( MogoPoiItem item, int errorCode );
}

View File

@@ -1,24 +0,0 @@
package com.mogo.map.search.poisearch;
import com.mogo.map.search.geo.MogoPoiItem;
import java.util.ArrayList;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* poi搜索结果集
*/
public class MogoPoiResult {
private ArrayList< MogoPoiItem > pois;
public ArrayList< MogoPoiItem > getPois() {
return pois;
}
public void setPois( ArrayList< MogoPoiItem > pois ) {
this.pois = pois;
}
}

View File

@@ -1,142 +0,0 @@
package com.mogo.map.search.poisearch;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* 周边搜索范围
*/
public class MogoSearchBound implements Parcelable {
public static final String SHAPE_BOUND = "Bound";
public static final String SHAPE_RECTANGLE = "Rectangle";
public static final String SHAPE_POLYGON = "Polygon";
/**
* 中心点
*/
private MogoLatLng centerPoint;
/**
* 半径:米
*/
private int radiusInMeters;
/**
* 搜索范围的形状
*/
private String shape;
/**
* 按距离排序
*/
private boolean isDistanceSort;
/**
* 左下角
*/
private MogoLatLng lowerLeft;
/**
* 右上角
*/
private MogoLatLng upperRight;
/**
* 范围搜索地点列表
*/
private List< MogoLatLng > polyGonList;
public MogoSearchBound( MogoLatLng centerPoint, int radiusInMeters ) {
this( centerPoint, radiusInMeters, true );
}
public MogoSearchBound( MogoLatLng centerPoint, int radiusInMeters, boolean isDistanceSort ) {
this.centerPoint = centerPoint;
this.radiusInMeters = radiusInMeters;
this.isDistanceSort = isDistanceSort;
this.shape = SHAPE_BOUND;
}
public MogoSearchBound( MogoLatLng lowerLeft, MogoLatLng upperRight ) {
this.lowerLeft = lowerLeft;
this.upperRight = upperRight;
this.shape = SHAPE_RECTANGLE;
}
public MogoSearchBound( List< MogoLatLng > polyGonList ) {
this.polyGonList = polyGonList;
this.shape = SHAPE_POLYGON;
}
public MogoLatLng getCenterPoint() {
return centerPoint;
}
public int getRadiusInMeters() {
return radiusInMeters;
}
public String getShape() {
return shape;
}
public boolean isDistanceSort() {
return isDistanceSort;
}
public MogoLatLng getLowerLeft() {
return lowerLeft;
}
public MogoLatLng getUpperRight() {
return upperRight;
}
public List< MogoLatLng > getPolyGonList() {
return polyGonList;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeParcelable( this.centerPoint, flags );
dest.writeInt( this.radiusInMeters );
dest.writeString( this.shape );
dest.writeByte( this.isDistanceSort ? ( byte ) 1 : ( byte ) 0 );
dest.writeParcelable( this.lowerLeft, flags );
dest.writeParcelable( this.upperRight, flags );
dest.writeTypedList( this.polyGonList );
}
protected MogoSearchBound( Parcel in ) {
this.centerPoint = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.radiusInMeters = in.readInt();
this.shape = in.readString();
this.isDistanceSort = in.readByte() != 0;
this.lowerLeft = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.upperRight = in.readParcelable( MogoLatLng.class.getClassLoader() );
this.polyGonList = in.createTypedArrayList( MogoLatLng.CREATOR );
}
public static final Parcelable.Creator< MogoSearchBound > CREATOR = new Parcelable.Creator< MogoSearchBound >() {
@Override
public MogoSearchBound createFromParcel( Parcel source ) {
return new MogoSearchBound( source );
}
@Override
public MogoSearchBound[] newArray( int size ) {
return new MogoSearchBound[size];
}
};
}

View File

@@ -1,159 +0,0 @@
package com.mogo.map.search.poisearch.query;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* poi 搜索查询条件
*/
public class MogoPoiSearchQuery implements Parcelable {
private String query;
private String category;
private String city;
private String building;
private int pageNum;
private int pageSize;
private boolean isCityLimit;
private boolean isSubPois;
private boolean isDistanceSort;
private MogoLatLng location;
/**
* @param query 查询字符串,多个关键字用“|”分割
* @param category 类型的组合,比如定义如下组合:餐馆|电影院|景点
*/
public MogoPoiSearchQuery( String query, String category ) {
this.query = query;
this.category = category;
this.city = null;
}
/**
* @param query 查询字符串,多个关键字用“|”分割
* @param category 类型的组合,比如定义如下组合:餐馆|电影院|景点
*/
public MogoPoiSearchQuery( String query, String category, String city ) {
this.query = query;
this.category = category;
this.city = city;
}
public String getBuilding() {
return building;
}
public void setBuilding( String building ) {
this.building = building;
}
public String getQuery() {
return query;
}
public String getCategory() {
return category;
}
public String getCity() {
return city;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum( int pageNum ) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize( int pageSize ) {
this.pageSize = pageSize;
}
public boolean isCityLimit() {
return isCityLimit;
}
public void setCityLimit( boolean cityLimit ) {
isCityLimit = cityLimit;
}
public boolean isSubPois() {
return isSubPois;
}
public void setSubPois( boolean subPois ) {
isSubPois = subPois;
}
public boolean isDistanceSort() {
return isDistanceSort;
}
public void setDistanceSort( boolean distanceSort ) {
isDistanceSort = distanceSort;
}
public MogoLatLng getLocation() {
return location;
}
public void setLocation( MogoLatLng location ) {
this.location = location;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.building );
dest.writeString( this.category );
dest.writeString( this.city );
dest.writeInt( this.pageNum );
dest.writeInt( this.pageSize );
dest.writeByte( this.isCityLimit ? ( byte ) 1 : ( byte ) 0 );
dest.writeByte( this.isSubPois ? ( byte ) 1 : ( byte ) 0 );
dest.writeByte( this.isDistanceSort ? ( byte ) 1 : ( byte ) 0 );
dest.writeParcelable( this.location, flags );
}
public MogoPoiSearchQuery() {
}
protected MogoPoiSearchQuery( Parcel in ) {
this.building = in.readString();
this.category = in.readString();
this.city = in.readString();
this.pageNum = in.readInt();
this.pageSize = in.readInt();
this.isCityLimit = in.readByte() != 0;
this.isSubPois = in.readByte() != 0;
this.isDistanceSort = in.readByte() != 0;
this.location = in.readParcelable( MogoLatLng.class.getClassLoader() );
}
public static final Parcelable.Creator< MogoPoiSearchQuery > CREATOR = new Parcelable.Creator< MogoPoiSearchQuery >() {
@Override
public MogoPoiSearchQuery createFromParcel( Parcel source ) {
return new MogoPoiSearchQuery( source );
}
@Override
public MogoPoiSearchQuery[] newArray( int size ) {
return new MogoPoiSearchQuery[size];
}
};
}