opt
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 地图抽象
|
||||
*/
|
||||
public interface IMogoMapViewCreator {
|
||||
|
||||
IMogoMapView create( Context context);
|
||||
}
|
||||
@@ -3,14 +3,10 @@ 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
|
||||
@@ -22,7 +18,10 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
|
||||
private static final String TAG = "MogoBaseMapView";
|
||||
|
||||
private IMogoMapView mMapView;
|
||||
protected IMogoMapView mMapView;
|
||||
|
||||
protected IMogoMapView mAMapView;
|
||||
protected IMogoMapView mCustomMapView;
|
||||
|
||||
public MogoBaseMapView( Context context ) {
|
||||
this( context, null );
|
||||
@@ -37,28 +36,15 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
init( context );
|
||||
}
|
||||
|
||||
protected 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." );
|
||||
}
|
||||
private void init( Context context ) {
|
||||
addDleMaps();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建地图实例
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected abstract IMogoMapView createMapView( Context context );
|
||||
protected abstract void addDleMaps();
|
||||
|
||||
public abstract void display2DMap( boolean invokeCreateAuto, boolean invokeResumeAuto );
|
||||
|
||||
public abstract void displayVRMap( boolean invokeCreateAuto, boolean invokeResumeAuto );
|
||||
|
||||
@Override
|
||||
public void onCreate( Bundle bundle ) {
|
||||
@@ -109,8 +95,4 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IMogoMapView getMapView() {
|
||||
return mMapView;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mogo.map;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
@@ -40,6 +42,21 @@ public class MogoLatLng implements Parcelable {
|
||||
return lon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o ) {
|
||||
if ( this == o ) return true;
|
||||
if ( o == null || getClass() != o.getClass() ) return false;
|
||||
MogoLatLng latLng = ( MogoLatLng ) o;
|
||||
return Double.compare( latLng.lat, lat ) == 0 &&
|
||||
Double.compare( latLng.lon, lon ) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash( lat, lng, lon );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoLatLng{" +
|
||||
|
||||
@@ -6,7 +6,7 @@ package com.mogo.map.location;
|
||||
* <p>
|
||||
* 定位接口
|
||||
*/
|
||||
public interface IMogoLocationClient {
|
||||
public interface IMogoLocationClient extends IMogoLocationListenerRegister {
|
||||
|
||||
/**
|
||||
* 开始定位
|
||||
@@ -25,20 +25,6 @@ public interface IMogoLocationClient {
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* 注册定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void addLocationListener( IMogoLocationListener listener );
|
||||
|
||||
/**
|
||||
* 注销定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void removeLocationListener( IMogoLocationListener listener );
|
||||
|
||||
/**
|
||||
* 返回上一次有效定位
|
||||
*
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 地图监听注册管理
|
||||
*/
|
||||
public interface IMogoLocationListenerRegister {
|
||||
|
||||
/**
|
||||
* 注册定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void addLocationListener( IMogoLocationListener listener );
|
||||
|
||||
/**
|
||||
* 注销定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void removeLocationListener( IMogoLocationListener listener );
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
import java.sql.ClientInfoStatus;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 地图监听注册管理
|
||||
*/
|
||||
public class MogoLocationListenerRegister implements IMogoLocationListenerRegister {
|
||||
|
||||
private static volatile MogoLocationListenerRegister sInstance;
|
||||
|
||||
private MogoLocationListenerRegister() {
|
||||
}
|
||||
|
||||
public static MogoLocationListenerRegister getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationListenerRegister.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoLocationListenerRegister();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
|
||||
/**
|
||||
* 注册定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
if ( listener == null ) {
|
||||
return;
|
||||
}
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.add( listener );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
if ( listener == null ) {
|
||||
return;
|
||||
}
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.remove( listener );
|
||||
}
|
||||
}
|
||||
|
||||
public Set< IMogoLocationListener > getListeners() {
|
||||
return sListeners;
|
||||
}
|
||||
}
|
||||
@@ -324,4 +324,10 @@ public interface IMogoMarker {
|
||||
* @return
|
||||
*/
|
||||
boolean isInfoWindowShowing();
|
||||
|
||||
/**
|
||||
* 设置是否是gps
|
||||
* @param isGps
|
||||
*/
|
||||
void setGps(boolean isGps);
|
||||
}
|
||||
|
||||
@@ -308,4 +308,29 @@ public class MogoMarkerOptions extends Observable {
|
||||
this.mAutoManager = autoManager;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoMarkerOptions{" +
|
||||
"latitude=" + latitude +
|
||||
", longitude=" + longitude +
|
||||
", title='" + title + '\'' +
|
||||
", snippet='" + snippet + '\'' +
|
||||
", icon=" + icon +
|
||||
", icons=" + icons +
|
||||
", period=" + period +
|
||||
", rotate=" + rotate +
|
||||
", flat=" + flat +
|
||||
", visible=" + visible +
|
||||
", inifoWindowEnable=" + inifoWindowEnable +
|
||||
", alpha=" + alpha +
|
||||
", isGps=" + isGps +
|
||||
", u=" + u +
|
||||
", v=" + v +
|
||||
", draggable=" + draggable +
|
||||
", offsetX=" + offsetX +
|
||||
", offsetY=" + offsetY +
|
||||
", zIndex=" + zIndex +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface IMogoCarLocationChangedListenerRegister {
|
||||
|
||||
/**
|
||||
* 注册车辆位置变化监听,非业务使用
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener );
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
* <p>
|
||||
* 导航操作
|
||||
*/
|
||||
public interface IMogoNavi {
|
||||
public interface IMogoNavi extends IMogoCarLocationChangedListenerRegister, IMogoOperationListenerRegister{
|
||||
|
||||
/**
|
||||
* 开启路径规划并导航
|
||||
@@ -97,12 +97,6 @@ public interface IMogoNavi {
|
||||
*/
|
||||
OnCalculatePathItemClickInteraction getItemClickInteraction();
|
||||
|
||||
|
||||
/**
|
||||
* 设置线条点击回调
|
||||
*/
|
||||
void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction );
|
||||
|
||||
/**
|
||||
* 清除规划的路线
|
||||
*/
|
||||
@@ -151,13 +145,6 @@ public interface IMogoNavi {
|
||||
*/
|
||||
Location getCarLocation2();
|
||||
|
||||
/**
|
||||
* 注册车辆位置变化监听,非业务使用
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener );
|
||||
|
||||
/**
|
||||
* 打开巡航模式
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface IMogoOperationListenerRegister {
|
||||
|
||||
/**
|
||||
* 设置线条点击回调
|
||||
*/
|
||||
void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoCarLocationChangedListenerRegister implements IMogoCarLocationChangedListenerRegister {
|
||||
|
||||
private static volatile MogoCarLocationChangedListenerRegister sInstance;
|
||||
private IMogoCarLocationChangedListener2 listener;
|
||||
|
||||
private MogoCarLocationChangedListenerRegister(){}
|
||||
|
||||
public static MogoCarLocationChangedListenerRegister getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( MogoCarLocationChangedListenerRegister.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new MogoCarLocationChangedListenerRegister();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册车辆位置变化监听,非业务使用
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public IMogoCarLocationChangedListener2 getListener() {
|
||||
return listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoOperationListenerRegister implements IMogoOperationListenerRegister {
|
||||
|
||||
private static volatile MogoOperationListenerRegister sInstance;
|
||||
private OnCalculatePathItemClickInteraction itemClickInteraction;
|
||||
|
||||
private MogoOperationListenerRegister(){}
|
||||
|
||||
public static MogoOperationListenerRegister getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( MogoOperationListenerRegister.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new MogoOperationListenerRegister();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置线条点击回调
|
||||
*/
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction ) {
|
||||
this.itemClickInteraction = itemClickInteraction;
|
||||
}
|
||||
|
||||
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
return itemClickInteraction;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import com.mogo.map.MogoLatLng;
|
||||
*/
|
||||
public class MogoPoiSearchQuery implements Parcelable {
|
||||
|
||||
private String query;
|
||||
private String query = "";
|
||||
private String category;
|
||||
private String city;
|
||||
private String building;
|
||||
|
||||
@@ -35,7 +35,12 @@ public enum EnumMapUI {
|
||||
/**
|
||||
* 夜晚模式
|
||||
*/
|
||||
Type_AUTO_LIGHT_Night( 5, 3 );
|
||||
Type_AUTO_LIGHT_Night( 5, 3 ),
|
||||
|
||||
/**
|
||||
* 自研地图的VR模式
|
||||
*/
|
||||
Type_VR( 0, 0 );
|
||||
|
||||
private int next;
|
||||
private int code;
|
||||
|
||||
@@ -50,8 +50,8 @@ public interface IMogoMapUIController {
|
||||
/**
|
||||
* 将地图移动至当前位置
|
||||
*/
|
||||
default void moveToCenter( MogoLatLng latLng ){
|
||||
moveToCenter(latLng, false);
|
||||
default void moveToCenter( MogoLatLng latLng ) {
|
||||
moveToCenter( latLng, false );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,7 +225,16 @@ public interface IMogoMapUIController {
|
||||
|
||||
/**
|
||||
* 切换地图视图视角
|
||||
*
|
||||
* @param bearing
|
||||
*/
|
||||
void changeBearing(float bearing);
|
||||
void changeBearing( float bearing );
|
||||
|
||||
default void setAnchorScale( float x, float y ) {
|
||||
|
||||
}
|
||||
|
||||
default void setAnchorRate( float rate ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user