终点marker 调整终点marker的添加和清除逻辑
This commit is contained in:
@@ -21,12 +21,13 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener {
|
||||
public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener{
|
||||
private static volatile MogoRouteOverlayManager sInstance;
|
||||
private Context mContext;
|
||||
private String TAG = "MogoRouteOverlayManager";
|
||||
private String TAG2 = "MogoRouteOverlayManager routes";
|
||||
private int STATUS_AUTOPILOT = 0;//0 非自动驾驶 ; 1 自动驾驶
|
||||
private MogoLatLng mEnding;
|
||||
private MogoRouteOverlayManager(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
@@ -77,15 +78,19 @@ public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener,
|
||||
latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
|
||||
}
|
||||
int listSize = latLngList.size();
|
||||
RouteOverlayDrawer.getInstance(mContext).addEndingMarker(latLngList.get(listSize - 1).lat,latLngList.get(listSize - 1).lon);
|
||||
mEnding = latLngList.get(listSize-1);
|
||||
// RouteOverlayDrawer.getInstance(mContext).addEndingMarker(latLngList.get(listSize - 1).lat,latLngList.get(listSize - 1).lon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
this.STATUS_AUTOPILOT = autoPilotStatusInfo.getControl_pilotmode();
|
||||
if (STATUS_AUTOPILOT != 1) {
|
||||
RouteOverlayDrawer.getInstance(mContext).clearMogoRouteOverlay();
|
||||
Log.d("lianglihui","onAutopilotStatusResponse:"+STATUS_AUTOPILOT);
|
||||
if (STATUS_AUTOPILOT == 1 && mEnding != null){
|
||||
RouteOverlayDrawer.getInstance(mContext).addEndingMarker(mEnding.lat,mEnding.lon);
|
||||
}else {
|
||||
RouteOverlayDrawer.getInstance(mContext).clearEndingMarker();
|
||||
RouteOverlayDrawer.getInstance(mContext).clearMogoRouteOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@ public class RouteOverlayDrawer {
|
||||
|
||||
|
||||
public void addEndingMarker(double lat,double lon){
|
||||
if (endMarker != null){
|
||||
return;
|
||||
}
|
||||
if (markderOptions == null){
|
||||
markderOptions = new MogoMarkerOptions()
|
||||
.matchOnRoadSide(true)
|
||||
@@ -101,6 +104,8 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
|
||||
public void clearEndingMarker(){
|
||||
Log.d("lianglihui","clearEndingMarker");
|
||||
endMarker = null;
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).removeMarkers(markerType);
|
||||
}
|
||||
|
||||
@@ -113,7 +118,7 @@ public class RouteOverlayDrawer {
|
||||
mPolylinePointList.add(latLng);
|
||||
}
|
||||
mPolylineColors.clear();
|
||||
mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#2AAFFD", mPolylinePointList.size()));
|
||||
mPolylineColors.addAll(ColorUtils.gradientAlpha_("#002965ED", "#FF2965ED", "#2AAFFD", mPolylinePointList.size()));
|
||||
// 线条粗细,渐变,渐变色值
|
||||
mPolylineOptions.width(12).useGradient(true).colorValues(mPolylineColors);
|
||||
if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()){
|
||||
|
||||
Reference in New Issue
Block a user