254 修改车前引导线绘制逻辑 以优化车前引导线展现效果
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.mogo.module.service.routeoverlay;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||
@@ -19,6 +18,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListen
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.utils.DrivingDirectionUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -36,6 +36,8 @@ public class MogoRouteOverlayManager implements
|
||||
private int STATUS_AUTOPILOT = 0;//0 非自动驾驶 ; 1 自动驾驶
|
||||
private MogoLatLng mEnding;
|
||||
private MogoLocation mLocation;
|
||||
private List<MogoLatLng> mTrajectoryList = new ArrayList<>();
|
||||
|
||||
private MogoRouteOverlayManager(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
@@ -92,9 +94,8 @@ public class MogoRouteOverlayManager implements
|
||||
mogoLatLngs.add(new MogoLatLng(a.getLat(), a.getLon()));
|
||||
}
|
||||
}
|
||||
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1){
|
||||
RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(mogoLatLngs);
|
||||
}
|
||||
|
||||
mTrajectoryList = mogoLatLngs;
|
||||
builder.append("}");
|
||||
//Log.d(TAG,builder.toString());
|
||||
}
|
||||
@@ -157,6 +158,36 @@ public class MogoRouteOverlayManager implements
|
||||
@Override
|
||||
public void onLocationChanged(@Nullable MogoLocation location) {
|
||||
mLocation = location;
|
||||
if (mTrajectoryList.isEmpty()){
|
||||
return;
|
||||
}
|
||||
ArrayList list = new ArrayList();
|
||||
for (MogoLatLng latLng:mTrajectoryList) {
|
||||
if(!isPointOnCarFront(mLocation,latLng)){
|
||||
list.add(latLng);
|
||||
}
|
||||
}
|
||||
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1){
|
||||
RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(list);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPointOnCarFront(MogoLocation carLocal, MogoLatLng pointLocal) {
|
||||
double carLon = carLocal.getLongitude();
|
||||
double carLat = carLocal.getLatitude();
|
||||
double poiLon = pointLocal.lon;
|
||||
double poiLat = pointLocal.lat;
|
||||
float carAngle = carLocal.getBearing();
|
||||
|
||||
// 计算车辆与点之间的夹角
|
||||
int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
carLon, carLat, poiLon, poiLat, (int) carAngle);
|
||||
// Log.e(TAG,"diffAngle:"+diffAngle);
|
||||
if (diffAngle <= 90) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user