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

@@ -0,0 +1,12 @@
package com.mogo.map;
/**
* @author congtaowang
* @since 2019-12-25
* <p>
* 销毁
*/
public interface IDestroyable {
void destroy();
}

View File

@@ -0,0 +1,25 @@
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

@@ -0,0 +1,109 @@
package com.mogo.map;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.uicontroller.IMogoMapUIController;
import java.util.ArrayList;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 地图控制接口
*/
public interface IMogoMap {
/**
* 获取地图ui控制器可以控制内置ui缩放按钮、指北针等是否显示及部分手势滑动、双指缩放等是否可用。
*
* @return
*/
IMogoUiSettings getUiSettings();
/**
* 操作地图视图
*
* @return
*/
IMogoMapUIController getUIController();
/**
* 在地图上添一个图片标记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

@@ -0,0 +1,21 @@
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

@@ -0,0 +1,68 @@
package com.mogo.map;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* 图层控制
*/
public interface IMogoUiSettings {
/**
* 设置比例尺功能是否可用。
*/
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

@@ -0,0 +1,115 @@
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

@@ -0,0 +1,49 @@
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

@@ -0,0 +1,44 @@
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,25 @@
package com.mogo.map.exception;
/**
* @author congtaowang
* @since 2019-12-19
* <p>
* 异常
*/
public class MogoMapException extends RuntimeException {
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

@@ -0,0 +1,57 @@
package com.mogo.map.listener;
import android.view.MotionEvent;
import com.mogo.map.MogoLatLng;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.uicontroller.EnumMapUI;
/**
* @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 );
/**
* 地图点击
*
* @param latLng
*/
void onMapClick( MogoLatLng latLng );
/**
* 地图锁定
*
* @param isLock
*/
void onLockMap( boolean isLock );
/**
* 地图白天黑夜、导航视角切换
*
* @param ui
*/
void onMapModeChanged( EnumMapUI ui );
}

View File

@@ -0,0 +1,24 @@
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

@@ -0,0 +1,106 @@
package com.mogo.map.listener;
import android.view.MotionEvent;
import com.mogo.map.MogoLatLng;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.uicontroller.EnumMapUI;
/**
* @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 );
}
}
}
@Override
public void onMapClick( MogoLatLng latLng ) {
if ( mDelegateListener != null ) {
synchronized ( mDelegateListener ) {
mDelegateListener.onMapClick( latLng );
}
}
}
@Override
public void onLockMap( boolean isLock ) {
if ( mDelegateListener != null ) {
synchronized ( mDelegateListener ) {
mDelegateListener.onLockMap( isLock );
}
}
}
@Override
public void onMapModeChanged( EnumMapUI ui ) {
if ( mDelegateListener != null ) {
synchronized ( mDelegateListener ) {
mDelegateListener.onMapModeChanged( ui );
}
}
}
}

View File

@@ -0,0 +1,43 @@
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( IMogoLocationListener listener );
/**
* 注销定位回调
*
* @param listener
*/
void removeLocationListener( IMogoLocationListener listener );
MogoLocation getLastKnowLocation();
}

View File

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

View File

@@ -0,0 +1,362 @@
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

@@ -0,0 +1,14 @@
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

@@ -0,0 +1,174 @@
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( int 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

@@ -0,0 +1,18 @@
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

@@ -0,0 +1,43 @@
package com.mogo.map.marker;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-25
* <p>
* 地图 marker 管理
*/
public interface IMogoMarkerManager {
/**
* 添加marker
*
* @param tag 标识调用者
* @param options
* @return
*/
IMogoMarker addMarker( String tag, MogoMarkerOptions options );
/**
* 添加多个marker
*
* @param tag 标识调用者
* @param options
* @return
*/
List< IMogoMarker > addMarkers( String tag, ArrayList< MogoMarkerOptions > options, boolean moveToCenter );
/**
* 移除某一个类、某个模块的markers
*
* @param tag
*/
void removeMarkers( String tag );
/**
* 移除地图上所有markers
*/
void removeMarkers();
}

View File

@@ -0,0 +1,222 @@
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 int zIndex = 0;
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( int 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 int getzIndex() {
return zIndex;
}
}

View File

@@ -0,0 +1,89 @@
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

@@ -0,0 +1,76 @@
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

@@ -0,0 +1,70 @@
package com.mogo.map.navi;
import com.mogo.map.MogoLatLng;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-25
* <p>
* 导航操作
*/
public interface IMogoNavi {
/**
* 开启路径规划并导航
*
* @param endPoint 目的地
*/
void naviTo( MogoLatLng endPoint );
/**
* 开启路径规划并导航
*
* @param endPoint 目的地
* @param config 规划路线策略
*/
void naviTo( MogoLatLng endPoint, MogoNaviConfig config );
/**
* 开启路径规划并导航
*
* @param endPoint 导航目的地
* @param wayPoints 途经点
*/
void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints );
/**
* 开启路径规划并导航
*
* @param endPoint 导航目的地
* @param wayPoints 途经点
* @param config 规划路线策略
*/
void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints, MogoNaviConfig config );
/**
* 重新算路
*
* @param config 规划路线策略
*/
void reCalculateRoute( MogoNaviConfig config );
/**
* 退出导航
*/
void stopNavi();
/**
* 开始导航
*/
void startNavi();
/**
* 是否正在导航
*
* @return
*/
boolean isNaviing();
}

View File

@@ -0,0 +1,37 @@
package com.mogo.map.navi;
/**
* @author congtaowang
* @since 2019-12-25
* <p>
* 导航监听
*/
public interface IMogoNaviListener {
/**
* 导航初始化失败
*/
void onInitNaviFailure();
/**
* 导航初始化成功
*/
void onInitNaviSuccess();
/**
* 导航引导信息
*
* @param naviinfo
*/
void onNaviInfoUpdate( MogoNaviInfo naviinfo );
/**
* 导航开始回调
*/
void onStartNavi();
/**
* 导航停止:包括到达目的地和主动停止导航
*/
void onStopNavi();
}

View File

@@ -0,0 +1,22 @@
package com.mogo.map.navi;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 地图操作回调
*/
public interface IMogoNaviListenerRegister {
/**
* 注册导航回调,各业务模块不用关注
*
* @param listener 回调函数
*/
void registerHostNaviListener( IMogoNaviListener listener );
/**
* 注销导航回调,各业务模块不用关注
*/
void unregisterHostNaviListener();
}

View File

@@ -0,0 +1,121 @@
package com.mogo.map.navi;
/**
* @author congtaowang
* @since 2019-12-25
* <p>
* 导航参数
*/
public class MogoNaviConfig {
/**
* 是否躲避拥堵
*/
private boolean congestion = false;
/**
* 不走高速
*/
private boolean avoidSpeed = false;
/**
* 避免收费
*/
private boolean cost = false;
/**
* 高速优先
*/
private boolean highSpeed = false;
/**
* 是否多路线算路
*/
private boolean multipleRoute = true;
/**
* 是否是正式的导航
* <p>
* false 为模拟导航
*/
private boolean realNavi = true;
/**
* 是否躲避拥堵
*/
public MogoNaviConfig congestion( boolean congestion ) {
this.congestion = congestion;
return this;
}
/**
* 不走高速
*/
public MogoNaviConfig avoidSpeed( boolean avoidSpeed ) {
this.avoidSpeed = avoidSpeed;
this.highSpeed = false;
return this;
}
/**
* 避免收费
*/
public MogoNaviConfig cost( boolean cost ) {
this.cost = cost;
this.highSpeed = false;
return this;
}
/**
* 高速优先
*/
public MogoNaviConfig highSpeed( boolean highSpeed ) {
this.highSpeed = highSpeed;
this.avoidSpeed = false;
this.cost = false;
return this;
}
/**
* 是否多路线算路
*/
public MogoNaviConfig multipleRoute( boolean multipleRoute ) {
this.multipleRoute = multipleRoute;
return this;
}
/**
* 导航模式
*
* @param realNavi true - 正式导航, false - 模拟导航
* @return
*/
public MogoNaviConfig realNavi( boolean realNavi ) {
this.realNavi = realNavi;
return this;
}
public boolean isCongestion() {
return congestion;
}
public boolean isAvoidSpeed() {
return avoidSpeed;
}
public boolean isCost() {
return cost;
}
public boolean isHighSpeed() {
return highSpeed;
}
public boolean isMultipleRoute() {
return multipleRoute;
}
public boolean isRealNavi() {
return realNavi;
}
}

View File

@@ -0,0 +1,161 @@
package com.mogo.map.navi;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author congtaowang
* @since 2019-12-25
* <p>
* 导航引导信息
*/
public class MogoNaviInfo implements Parcelable {
/**
* 当前路线名称
*/
private String currentRoadName;
/**
* 导航过程中当前的车速
*/
private int currentSpeed;
/**
* 当前路段剩余距离
*/
private int curStepRetainDistance;
/**
* 当前路段剩余时间
*/
private int curStepRetainTime;
/**
* 导航转向图标
*/
private int iconType;
/**
* 下条路名
*/
private String nextRoadName;
/**
* 剩余时间(秒)
*/
private int pathRetainTime;
/**
* 剩余距离
*/
private int pathRetainDistance;
public String getCurrentRoadName() {
return currentRoadName;
}
public void setCurrentRoadName( String currentRoadName ) {
this.currentRoadName = currentRoadName;
}
public int getCurrentSpeed() {
return currentSpeed;
}
public void setCurrentSpeed( int currentSpeed ) {
this.currentSpeed = currentSpeed;
}
public int getCurStepRetainDistance() {
return curStepRetainDistance;
}
public void setCurStepRetainDistance( int curStepRetainDistance ) {
this.curStepRetainDistance = curStepRetainDistance;
}
public int getCurStepRetainTime() {
return curStepRetainTime;
}
public void setCurStepRetainTime( int curStepRetainTime ) {
this.curStepRetainTime = curStepRetainTime;
}
public int getIconType() {
return iconType;
}
public void setIconType( int iconType ) {
this.iconType = iconType;
}
public String getNextRoadName() {
return nextRoadName;
}
public void setNextRoadName( String nextRoadName ) {
this.nextRoadName = nextRoadName;
}
public int getPathRetainTime() {
return pathRetainTime;
}
public void setPathRetainTime( int pathRetainTime ) {
this.pathRetainTime = pathRetainTime;
}
public int getPathRetainDistance() {
return pathRetainDistance;
}
public void setPathRetainDistance( int pathRetainDistance ) {
this.pathRetainDistance = pathRetainDistance;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.currentRoadName );
dest.writeInt( this.currentSpeed );
dest.writeInt( this.curStepRetainDistance );
dest.writeInt( this.curStepRetainTime );
dest.writeInt( this.iconType );
dest.writeString( this.nextRoadName );
dest.writeInt( this.pathRetainTime );
dest.writeInt( this.pathRetainDistance );
}
public MogoNaviInfo() {
}
protected MogoNaviInfo( Parcel in ) {
this.currentRoadName = in.readString();
this.currentSpeed = in.readInt();
this.curStepRetainDistance = in.readInt();
this.curStepRetainTime = in.readInt();
this.iconType = in.readInt();
this.nextRoadName = in.readString();
this.pathRetainTime = in.readInt();
this.pathRetainDistance = in.readInt();
}
public static final Parcelable.Creator< MogoNaviInfo > CREATOR = new Parcelable.Creator< MogoNaviInfo >() {
@Override
public MogoNaviInfo createFromParcel( Parcel source ) {
return new MogoNaviInfo( source );
}
@Override
public MogoNaviInfo[] newArray( int size ) {
return new MogoNaviInfo[size];
}
};
}

View File

@@ -0,0 +1,80 @@
package com.mogo.map.navi;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* 地图监听注册管理
*/
public class MogoNaviListenerHandler implements IMogoNaviListener, IMogoNaviListenerRegister {
private static volatile MogoNaviListenerHandler sInstance;
private MogoNaviListenerHandler() {
}
public static MogoNaviListenerHandler getInstance() {
if ( sInstance == null ) {
synchronized ( MogoNaviListenerHandler.class ) {
if ( sInstance == null ) {
sInstance = new MogoNaviListenerHandler();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
/**
* 上层模块代理对象
*/
private IMogoNaviListener mDelegateListener = null;
@Override
public void registerHostNaviListener( IMogoNaviListener listener ) {
mDelegateListener = listener;
}
@Override
public void unregisterHostNaviListener() {
mDelegateListener = null;
}
@Override
public synchronized void onInitNaviFailure() {
if ( mDelegateListener != null ) {
mDelegateListener.onInitNaviFailure();
}
}
@Override
public synchronized void onInitNaviSuccess() {
if ( mDelegateListener != null ) {
mDelegateListener.onInitNaviSuccess();
}
}
@Override
public synchronized void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
if ( mDelegateListener != null ) {
mDelegateListener.onNaviInfoUpdate( naviinfo );
}
}
@Override
public synchronized void onStartNavi() {
if ( mDelegateListener != null ) {
mDelegateListener.onStartNavi();
}
}
@Override
public synchronized void onStopNavi() {
if ( mDelegateListener != null ) {
mDelegateListener.onStopNavi();
}
}
}

View File

@@ -0,0 +1,58 @@
package com.mogo.map.search.geo;
import com.mogo.map.IDestroyable;
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 extends IDestroyable {
/**
* 添加异步编码回调
*
* @param listener
*/
void setGeoSearchListener( IMogoGeoSearchListener listener );
/**
* 同步获取逆地理编码地址
*
* @param query
* @return
* @throws MogoMapException
*/
@Deprecated
MogoRegeocodeAddress getFromLocation( MogoRegeocodeQuery query ) throws MogoMapException;
/**
* 同步获取地理编码地址列表
*
* @param query
* @return
* @throws MogoMapException
*/
@Deprecated
List< MogoGeocodeAddress > getFromLocationName( MogoGeocodeQuery query ) throws MogoMapException;
/**
* 异步获取逆地理编码
*
* @param query
*/
void getFromLocationAsyn( MogoRegeocodeQuery query );
/**
* 同步获取地理编码回调
*
* @param query
*/
void getFromLocationNameAsyn( MogoGeocodeQuery query );
}

View File

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

View File

@@ -0,0 +1,99 @@
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

@@ -0,0 +1,66 @@
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

@@ -0,0 +1,108 @@
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

@@ -0,0 +1,103 @@
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

@@ -0,0 +1,23 @@
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

@@ -0,0 +1,75 @@
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

@@ -0,0 +1,64 @@
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

@@ -0,0 +1,355 @@
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

@@ -0,0 +1,63 @@
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

@@ -0,0 +1,231 @@
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

@@ -0,0 +1,53 @@
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

@@ -0,0 +1,98 @@
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

@@ -0,0 +1,98 @@
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

@@ -0,0 +1,121 @@
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

@@ -0,0 +1,63 @@
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

@@ -0,0 +1,88 @@
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 int radius;
private String latlngType;
private String poiType;
public MogoLatLng getPoint() {
return point;
}
public void setPoint( MogoLatLng point ) {
this.point = point;
}
public int getRadius() {
return radius;
}
public void setRadius( int 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.readInt();
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

@@ -0,0 +1,14 @@
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 );
}

View File

@@ -0,0 +1,23 @@
package com.mogo.map.search.inputtips;
import com.mogo.map.IDestroyable;
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 extends IDestroyable {
void setQuery( MogoInputtipsQuery query );
void setInputtipsListener( IMogoInputtipsListener listener );
void requestInputtipsAsyn();
}

View File

@@ -0,0 +1,120 @@
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

@@ -0,0 +1,58 @@
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

@@ -0,0 +1,58 @@
package com.mogo.map.search.poisearch;
import com.mogo.map.IDestroyable;
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 extends IDestroyable {
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

@@ -0,0 +1,22 @@
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

@@ -0,0 +1,24 @@
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

@@ -0,0 +1,142 @@
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

@@ -0,0 +1,159 @@
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];
}
};
}

View File

@@ -0,0 +1,56 @@
package com.mogo.map.uicontroller;
/**
* @author congtaowang
* @since 2019-12-26
* <p>
* 地图样式
*/
public enum EnumMapUI {
/**
* 正北朝上2D
*/
NorthUP_2D( 0, 1 ),
/**
* 车头朝上2D
*/
CarUp_2D( 1, 2 ),
/**
* 3D,只能头朝上
*/
CarUp_3D( 2, 0 ),
/**
* 白天模式
*/
Type_Light( 3, 4 ),
/**
* 夜晚模式
*/
Type_Night( 4, 3 ),
/**
* 导航模式
*/
Type_Navi( 5, 5 );
private int next;
private int code;
EnumMapUI( int code, int next ) {
this.code = code;
this.next = next;
}
public EnumMapUI next() {
for ( EnumMapUI value : EnumMapUI.values() ) {
if ( value.code == next ) {
return value;
}
}
return this;
}
}

View File

@@ -0,0 +1,53 @@
package com.mogo.map.uicontroller;
/**
* @author congtaowang
* @since 2019-12-26
* <p>
* 地图UI控制
*/
public interface IMogoMapUIController {
/**
* 实时路况
*
* @param visible
*/
void setTrafficEnabled( boolean visible );
/**
* 地图缩放
*
* @param zoomIn true - 方法 false - 缩小
*/
void changeZoom( boolean zoomIn );
/**
* 切换2D/3D模式
*
* @param mode true - 3D模式 false - 2D模式
*/
void changeMapMode( EnumMapUI mode );
/**
* 将地图移动至当前位置
*/
void moveToCurrentLocation();
/**
* 显示我的位置
*
* @param visible true - 显示 false - 不显示
*/
void showMyLocation( boolean visible );
/**
* 解锁锁车
*/
void recoverLockMode();
/**
* 预览全程
*/
void displayOverview();
}