优化他车道路吸附变道突兀问题

This commit is contained in:
tongchenfei
2021-03-04 19:45:32 +08:00
parent 6ba2e5eeea
commit 6d5e0d952b
4 changed files with 36 additions and 12 deletions

View File

@@ -1031,9 +1031,10 @@ public class AMapViewWrapper implements IMogoMapView,
&& !singlePointRoadInfo.getCoords().isEmpty() ) {
double matchedPoint[] = PointInterpolatorUtil.mergeToRoad( wgs[0], wgs[1], singlePointRoadInfo.getCoords() );
// return CoordinateUtils.transformWgsToGcj( matchedPoint[1], matchedPoint[0] );
double[] trans = CoordinateUtils.transformWgsToGcj(matchedPoint[1], matchedPoint[0]);
matchedPoint = CoordinateUtils.transformWgsToGcj( matchedPoint[1], matchedPoint[0] );
matchedPoint[0] = trans[0];
matchedPoint[1] = trans[1];
// MarkerOptions options
// = new MarkerOptions();
// options.markerIcon( R.drawable.red )

View File

@@ -24,11 +24,10 @@ public class PointInterpolatorUtil {
* n in 1 .. a-1
* n == 0 时xn = x1
* n == a 时xn = x2
*
* <p>
* 将xn依次插入x1到x2之间
*
* @param points 待插值点集
*
* @deprecated 这个方法有问题,并不能算出来想要的值
*/
@Deprecated
@@ -63,7 +62,11 @@ public class PointInterpolatorUtil {
LonLatPoint end = road.get(closeEnd);
Logger.d(TAG, "mergeToRoad start: " + closeStart + " end: " + closeEnd);
// return getMid(start, end);
return getFoot(lon, lat, start, end);
double[] foot = getFoot(lon, lat, start, end);
float d = CoordinateUtils.calculateLineDistance(foot[0], foot[1], lon, lat);
Logger.d(TAG, "distance to mid line==" + d);
return new double[]{foot[0], foot[1], d};
}
private static int closeStart = 0;