完成了在线车辆查询的增量绘制

This commit is contained in:
董宏宇
2020-01-17 18:55:00 +08:00
parent fca7651927
commit 4eb6eacdea
2 changed files with 37 additions and 18 deletions

View File

@@ -7,6 +7,7 @@ import java.util.List;
@SuppressWarnings("unused")
public class MarkerCardResult implements Serializable {
private List<String> dataType; // 要查询的类型
private List<MarkerCarChat> carChat;
private List<MarkerExploreWay> exploreWay;
private List<MarkerOnlineCar> onlineCar;
@@ -53,10 +54,19 @@ public class MarkerCardResult implements Serializable {
this.noveltyInfo = noveltyInfo;
}
public List<String> getDataType() {
return dataType;
}
public void setDataType(List<String> dataType) {
this.dataType = dataType;
}
@Override
public String toString() {
return "MarkerCardResult{" +
"carChat=" + carChat +
"dataType=" + dataType +
", carChat=" + carChat +
", exploreWay=" + exploreWay +
", onlineCar=" + onlineCar +
", shareMusic=" + shareMusic +

View File

@@ -265,14 +265,23 @@ public class MarkerServiceHandler {
*/
public static void drawMapMarker(MarkerResponse response) {
lastMarker = null;
getMarkerManager().removeMarkers();
JSONArray array = new JSONArray();
// 解析不同的Marker类型然后对应的进行绘制
if (response != null && response.getResult() != null) {
MarkerCardResult markerCardResult = response.getResult();
// 语音触发的在线车辆搜索,采用增量的形式绘制
if (markerCardResult.getDataType() != null &&
markerCardResult.getDataType().size() == 1 &&
markerCardResult.getDataType().contains(ServiceConst.CARD_TYPE_USER_DATA)) {
} else {
// 清空所有地图上绘制的Marker
getMarkerManager().removeMarkers();
}
List<MarkerCarChat> carChatList = markerCardResult.getCarChat();
List<MarkerOnlineCar> onlineCarList = markerCardResult.getOnlineCar();
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
@@ -379,26 +388,26 @@ public class MarkerServiceHandler {
break;
}
}
fillNumberTrackEventBody(array,2, num_gas_station);
fillNumberTrackEventBody(array,6, num_road_closed);
fillNumberTrackEventBody(array,5, num_traffic_check);
fillNumberTrackEventBody(array,7, num_shop_discount);
fillNumberTrackEventBody(array,8, num_fours_shop);
fillNumberTrackEventBody(array, 2, num_gas_station);
fillNumberTrackEventBody(array, 6, num_road_closed);
fillNumberTrackEventBody(array, 5, num_traffic_check);
fillNumberTrackEventBody(array, 7, num_shop_discount);
fillNumberTrackEventBody(array, 8, num_fours_shop);
}
analyticData(array);
}
}
private static void fillNumberTrackEventBody(JSONArray arr, int type, int size){
JSONObject object = new JSONObject( );
private static void fillNumberTrackEventBody(JSONArray arr, int type, int size) {
JSONObject object = new JSONObject();
try {
object.put( "type", type );
object.put( "num", size);
if ( arr != null ) {
arr.put( object );
object.put("type", type);
object.put("num", size);
if (arr != null) {
arr.put(object);
}
} catch ( JSONException e ) {
} catch (JSONException e) {
e.printStackTrace();
}
}
@@ -406,11 +415,11 @@ public class MarkerServiceHandler {
/**
* 统计地图内数据获取
*
* @param array 埋点数据
* @param array 埋点数据
*/
private static void analyticData(JSONArray array) {
try {
if ( array == null || array.length() == 0 ) {
if (array == null || array.length() == 0) {
return;
}
final Map<String, Object> properties = new HashMap<>();
@@ -432,8 +441,8 @@ public class MarkerServiceHandler {
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(markerShowEntity.getMarkerType())
.alpha( 0.7f )
.object( markerShowEntity )
.alpha(0.7f)
.object(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
options.icon(markerView);