切换地图的逻辑修改

This commit is contained in:
wangcongtao
2020-10-25 11:08:46 +08:00
parent aafd2cd5db
commit 771e5eed13
44 changed files with 740 additions and 231 deletions

View File

@@ -0,0 +1,18 @@
package com.mogo.map.navi;
public
/**
* @author congtaowang
* @since 2020/10/23
*
* 描述
*/
interface IMogoCarLocationChangedListenerRegister {
/**
* 注册车辆位置变化监听,非业务使用
*
* @param listener
*/
void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener );
}

View File

@@ -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 );
/**
* 打开巡航模式
*/

View File

@@ -0,0 +1,17 @@
package com.mogo.map.navi;
public
/**
* @author congtaowang
* @since 2020/10/23
*
* 描述
*/
interface IMogoOperationListenerRegister {
/**
* 设置线条点击回调
*/
void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction );
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}