From addf3ea68b0b1b37545449985ea111e1c1576610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Thu, 9 Jan 2020 18:44:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E8=A1=8Cmarker=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/service/MarkerServiceHandler.java | 116 +++++++++--------- 1 file changed, 60 insertions(+), 56 deletions(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java index 36bc7852a3..1513b239bd 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java @@ -75,61 +75,7 @@ public class MarkerServiceHandler { @Override public void onMsgReceived(MarkerResponse response) { Logger.e(TAG, "===" + response); - - getMarkerManager().removeMarkers(); - - // 解析不同的Marker类型,然后对应的进行绘制 - if (response != null && response.getResult() != null) { - MarkerCardResult markerCardResult = response.getResult(); - - List carChat = markerCardResult.getCarChat(); - List onlineCar = markerCardResult.getOnlineCar(); - List exploreWay = markerCardResult.getExploreWay(); - List shareMusic = markerCardResult.getShareMusic(); - - if (carChat != null) { - for (MarkerCarChat markerCarChat : carChat) { - MarkerLocation markerLocation = markerCarChat.getLocation(); - drawMapMarker( - markerCarChat.getType(), - markerCarChat, - markerLocation); - } - } - - if (onlineCar != null) { - for (MarkerOnlineCar markerOnlineCar : onlineCar) { - MarkerLocation markerLocation = markerOnlineCar.getLocation(); - drawMapMarker( - markerOnlineCar.getType(), - markerOnlineCar, - markerLocation); - } - } - - if (exploreWay != null) { - for (MarkerExploreWay markerExploreWay : exploreWay) { - MarkerLocation markerLocation = markerExploreWay.getLocation(); - drawMapMarker( - markerExploreWay.getType(), - markerExploreWay, - markerLocation); - } - } - - if (shareMusic != null) { - for (MarkerShareMusic markerShareMusic : shareMusic) { - MarkerLocation markerLocation = markerShareMusic.getLocation(); - drawMapMarker( - markerShareMusic.getType(), - markerShareMusic, - markerLocation); - } - } - - } - getMapUIController().changeZoom(10); - + drawMapMarker(response); } }); } @@ -173,6 +119,65 @@ public class MarkerServiceHandler { } + /** + * 绘制Marker + */ + public static void drawMapMarker(MarkerResponse response) { + getMarkerManager().removeMarkers(); + + // 解析不同的Marker类型,然后对应的进行绘制 + if (response != null && response.getResult() != null) { + MarkerCardResult markerCardResult = response.getResult(); + + List carChat = markerCardResult.getCarChat(); + List onlineCar = markerCardResult.getOnlineCar(); + List exploreWay = markerCardResult.getExploreWay(); + List shareMusic = markerCardResult.getShareMusic(); + + if (carChat != null) { + for (MarkerCarChat markerCarChat : carChat) { + MarkerLocation markerLocation = markerCarChat.getLocation(); + drawMapMarker( + markerCarChat.getType(), + markerCarChat, + markerLocation); + } + } + + if (onlineCar != null) { + for (MarkerOnlineCar markerOnlineCar : onlineCar) { + MarkerLocation markerLocation = markerOnlineCar.getLocation(); + drawMapMarker( + markerOnlineCar.getType(), + markerOnlineCar, + markerLocation); + } + } + + if (exploreWay != null) { + for (MarkerExploreWay markerExploreWay : exploreWay) { + MarkerLocation markerLocation = markerExploreWay.getLocation(); + drawMapMarker( + markerExploreWay.getType(), + markerExploreWay, + markerLocation); + } + } + + if (shareMusic != null) { + for (MarkerShareMusic markerShareMusic : shareMusic) { + MarkerLocation markerLocation = markerShareMusic.getLocation(); + drawMapMarker( + markerShareMusic.getType(), + markerShareMusic, + markerLocation); + } + } + + } + getMapUIController().changeZoom(10); + } + /** * 绘制Marker * @@ -197,7 +202,6 @@ public class MarkerServiceHandler { marker.setInfoWindowAdapter(markerInfoWindowAdapter); marker.setOnMarkerClickListener(mogoMarkerClickListener); marker.setObject(bindObject); - }