This commit is contained in:
wangcongtao
2020-12-18 10:55:17 +08:00
parent bb85ba8cd1
commit 036d85df1e
35 changed files with 533 additions and 382 deletions

View File

@@ -0,0 +1,47 @@
package com.mogo.map;
public
/**
* @author congtaowang
* @since 2020/12/17
*
* 描述
*/
class MogoCoordinatesTransformer implements CoordinatesTransformer {
private CoordinatesTransformer mDelegate;
private static volatile MogoCoordinatesTransformer sInstance;
private MogoCoordinatesTransformer(){
mDelegate = MogoMapDelegateFactory.getCoordinatesTransformer();
}
public static MogoCoordinatesTransformer getInstance(){
if( sInstance == null ){
synchronized( MogoCoordinatesTransformer.class ) {
if( sInstance == null ){
sInstance = new MogoCoordinatesTransformer();
}
}
}
return sInstance;
}
public synchronized void release(){
sInstance = null;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
@Override
public double[] transform( double lat, double lon ) {
if ( mDelegate != null ) {
return mDelegate.transform( lat, lon );
}
return null;
}
}

View File

@@ -133,4 +133,8 @@ class MogoMapDelegateFactory {
public static IMogoTrafficSearch getTrafficSearch() {
return getApiBuilder().getTrafficSearch();
}
public static CoordinatesTransformer getCoordinatesTransformer(){
return getApiBuilder().getCoordinatesTransformer();
}
}