This commit is contained in:
wangcongtao
2019-12-24 20:07:25 +08:00
parent fea6d0bc61
commit 42fca28aae
19 changed files with 393 additions and 35 deletions

View File

@@ -27,7 +27,7 @@ import java.util.List;
public interface IMogoMapService extends IProvider, IMogoMapListenerRegister {
/**
* 获取定位服务实例
* 获取定位服务实例,全局唯一
*
* @param context
* @return
@@ -37,18 +37,20 @@ public interface IMogoMapService extends IProvider, IMogoMapListenerRegister {
/**
* 添加marker
*
* @param tag 标识调用者
* @param options
* @return
*/
IMogoMarker addMarker( MogoMarkerOptions options );
IMogoMarker addMarker( String tag, MogoMarkerOptions options );
/**
* 添加多个marker
*
* @param tag 标识调用者
* @param options
* @return
*/
List< IMogoMarker > addMarkers( ArrayList< MogoMarkerOptions > options, boolean moveToCenter );
List< IMogoMarker > addMarkers( String tag, ArrayList< MogoMarkerOptions > options, boolean moveToCenter );
/**
* 获取关键字搜索地址服务
@@ -87,4 +89,16 @@ public interface IMogoMapService extends IProvider, IMogoMapListenerRegister {
* @return
*/
IMogoPoiSearch getPoiSearch( Context context, MogoPoiSearchQuery query );
/**
* 移除某一个类、某个模块的markers
*
* @param tag
*/
void removeMarkers( String tag );
/**
* 移除地图上所有markers
*/
void removeMarkers();
}

View File

@@ -8,7 +8,9 @@ import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.MogoLocationClient;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.marker.MogoMarkersHandler;
import com.mogo.map.search.geo.IMogoGeoSearch;
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
import com.mogo.map.search.geo.MogoGeoSearch;
@@ -39,18 +41,18 @@ public class MogoMapService implements IMogoMapService {
}
@Override
public IMogoMarker addMarker( MogoMarkerOptions options ) {
public IMogoMarker addMarker( String tag, MogoMarkerOptions options ) {
try {
return MogoMap.getInstance().getMogoMap().addMarker( options );
return MogoMap.getInstance().getMogoMap().addMarker( tag, options );
} catch ( Exception e ) {
return null;
}
}
@Override
public List< IMogoMarker > addMarkers( ArrayList< MogoMarkerOptions > options, boolean moveToCenter ) {
public List< IMogoMarker > addMarkers( String tag, ArrayList< MogoMarkerOptions > options, boolean moveToCenter ) {
try {
return MogoMap.getInstance().getMogoMap().addMarkers( options, moveToCenter );
return MogoMap.getInstance().getMogoMap().addMarkers( tag, options, moveToCenter );
} catch ( Exception e ) {
return null;
}
@@ -81,6 +83,16 @@ public class MogoMapService implements IMogoMapService {
return new MogoPoiSearch( context, query );
}
@Override
public void removeMarkers( String tag ) {
MogoMarkersHandler.getInstance().remove( tag );
}
@Override
public void removeMarkers() {
MogoMarkersHandler.getInstance().removeAll();
}
@Override
public void init( Context context ) {