增加了真实数据的marker绘制
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -5,7 +5,7 @@
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -27,7 +27,6 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
DebugConfig.setNetMode( DebugConfig.NET_MODE_QA );
|
||||
MogoModulePaths.addModule(new MogoModule(OnLineCarConstants.TAG, "CARD_TYPE_ROAD_ONLINECAR"));
|
||||
MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, "CARD_TYPE_ROAD_CODITION" ) );
|
||||
MogoModulePaths.addModule(new MogoModule( OnLineCarConstants.TAG, "CARD_TYPE_ROAD_ONLINECAR"));
|
||||
// MogoModulePaths.addModule(new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,13 @@ import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.service.entity.MarkerCarChat;
|
||||
import com.mogo.module.service.entity.MarkerCardResult;
|
||||
import com.mogo.module.service.entity.MarkerExploreWay;
|
||||
import com.mogo.module.service.entity.MarkerLocation;
|
||||
import com.mogo.module.service.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.service.entity.MarkerResponse;
|
||||
import com.mogo.module.service.entity.MarkerShareMusic;
|
||||
import com.mogo.module.service.marker.MapMarkerView;
|
||||
import com.mogo.module.service.marker.MarkerInfoWindowAdapter;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -20,6 +26,8 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -32,7 +40,7 @@ import java.util.Random;
|
||||
public class MarkerServiceHandler {
|
||||
private static final String TAG = "MarkerServiceHandler";
|
||||
|
||||
private static MogoMarkerClickListener mogoMarkerClickListener;
|
||||
private static MoGoMarkerClickListener mogoMarkerClickListener;
|
||||
|
||||
private static IMogoMapService mMapService;
|
||||
private static IMogoMarkerManager mMarkerManager;
|
||||
@@ -54,8 +62,7 @@ public class MarkerServiceHandler {
|
||||
markerInfoWindowAdapter = new MarkerInfoWindowAdapter(context, getNavi(), getImageloader());
|
||||
mMapUIController = mMapService.getMapUIController();
|
||||
|
||||
|
||||
mogoMarkerClickListener = new MogoMarkerClickListener();
|
||||
mogoMarkerClickListener = new MoGoMarkerClickListener();
|
||||
|
||||
// 长连接
|
||||
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
@@ -67,14 +74,56 @@ public class MarkerServiceHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MarkerResponse obj) {
|
||||
Logger.e("donghongyu", "===" + obj);
|
||||
public void onMsgReceived(MarkerResponse response) {
|
||||
Logger.e(TAG, "===" + response);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
drawMapMarker();
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
if (response != null && response.getResult() != null) {
|
||||
MarkerCardResult markerCardResult = response.getResult();
|
||||
|
||||
List<MarkerCarChat> carChat = markerCardResult.getCarChat();
|
||||
List<MarkerOnlineCar> onlineCar = markerCardResult.getOnlineCar();
|
||||
List<MarkerExploreWay> exploreWay = markerCardResult.getExploreWay();
|
||||
List<MarkerShareMusic> shareMusic = markerCardResult.getShareMusic();
|
||||
|
||||
ArrayList<MogoMarkerOptions> optionsList = new ArrayList<>();
|
||||
|
||||
if (carChat != null) {
|
||||
for (MarkerCarChat markerCarChat : carChat) {
|
||||
MarkerLocation markerLocation = markerCarChat.getLocation();
|
||||
drawMapMarker(markerCarChat.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (onlineCar != null) {
|
||||
for (MarkerOnlineCar markerOnlineCar : onlineCar) {
|
||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||
drawMapMarker(markerOnlineCar.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (exploreWay != null) {
|
||||
for (MarkerExploreWay markerExploreWay : exploreWay) {
|
||||
MarkerLocation markerLocation = markerExploreWay.getLocation();
|
||||
drawMapMarker(markerExploreWay.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (shareMusic != null) {
|
||||
for (MarkerShareMusic markerShareMusic : shareMusic) {
|
||||
MarkerLocation markerLocation = markerShareMusic.getLocation();
|
||||
drawMapMarker(markerShareMusic.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
List<IMogoMarker> iMogoMarkers = getMarkerManager().addMarkers(TAG, optionsList, true);
|
||||
for (IMogoMarker iMogoMarker : iMogoMarkers) {
|
||||
iMogoMarker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
iMogoMarker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,7 +155,7 @@ public class MarkerServiceHandler {
|
||||
/**
|
||||
* 地图上的Marker点击回调
|
||||
*/
|
||||
static class MogoMarkerClickListener implements IMogoMarkerClickListener {
|
||||
static class MoGoMarkerClickListener implements IMogoMarkerClickListener {
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
@@ -116,9 +165,23 @@ public class MarkerServiceHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawMapMarker(String markerTag, MarkerLocation markerLocation,
|
||||
ArrayList<MogoMarkerOptions> optionsList) {
|
||||
Logger.e(markerTag, "=====绘制Marker====");
|
||||
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.icon(mapMarkerView)
|
||||
.owner(markerTag)
|
||||
.latitude(markerLocation.getLat())
|
||||
.longitude(markerLocation.getLon());
|
||||
|
||||
optionsList.add(options);
|
||||
}
|
||||
|
||||
public static void drawMapMarker() {
|
||||
TipToast.shortTip("绘制Marker");
|
||||
Logger.e(TAG, "=====绘制Marker====");
|
||||
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
|
||||
@@ -132,5 +195,8 @@ public class MarkerServiceHandler {
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
|
||||
getMapUIController().changeZoom(false);
|
||||
|
||||
getMapUIController().changeZoom(10);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user