对外开放了绘制marker的方法
This commit is contained in:
@@ -9,7 +9,6 @@ import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.module.service.entity.MarkerResponse;
|
||||
import com.mogo.module.service.marker.MapMarkerInfoView;
|
||||
import com.mogo.module.service.marker.MapMarkerView;
|
||||
import com.mogo.module.service.marker.MarkerInfoWindowAdapter;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -20,8 +19,6 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
@@ -44,7 +41,10 @@ public class MarkerServiceHandler {
|
||||
private static IMogoSocketManager mMogoSocketManager;
|
||||
private static MarkerInfoWindowAdapter markerInfoWindowAdapter;
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
public static void init(final Context context) {
|
||||
mContext = context;
|
||||
mMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation(context);
|
||||
mImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation(context);
|
||||
mMarkerManager = mMapService.getMarkerManager(context);
|
||||
@@ -67,27 +67,8 @@ public class MarkerServiceHandler {
|
||||
public void onMsgReceived(MarkerResponse obj) {
|
||||
Logger.e("donghongyu", "===" + obj);
|
||||
|
||||
MapMarkerInfoView mapMarkerInfoView = new MapMarkerInfoView(context);
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(context);
|
||||
|
||||
ArrayList<MogoMarkerOptions> optionsList = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner(TAG)
|
||||
.latitude(37.974525d + new Random().nextDouble())
|
||||
.longitude(116.41733d + new Random().nextDouble());
|
||||
// if (i % 2 == 0) {
|
||||
// options.icon(mapMarkerInfoView);
|
||||
// } else {
|
||||
// options.icon(mapMarkerView);
|
||||
// }
|
||||
options.icon(mapMarkerInfoView);
|
||||
optionsList.add(options);
|
||||
}
|
||||
List<IMogoMarker> iMogoMarkers = getMarkerManager().addMarkers(TAG, optionsList, true);
|
||||
for (IMogoMarker iMogoMarker : iMogoMarkers) {
|
||||
iMogoMarker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
iMogoMarker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
drawMapMarker();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,4 +108,18 @@ public class MarkerServiceHandler {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void drawMapMarker() {
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.icon(mapMarkerView)
|
||||
.owner(TAG)
|
||||
.latitude(38.574525d + new Random().nextDouble())
|
||||
.longitude(115.41733d + new Random().nextDouble());
|
||||
IMogoMarker marker = getMarkerManager().addMarker(TAG, options);
|
||||
marker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user