代码优化

This commit is contained in:
wangcongtao
2021-03-03 10:07:02 +08:00
parent 7ca355f885
commit b37ee31e65
8 changed files with 25 additions and 14 deletions

View File

@@ -53,6 +53,7 @@ import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
import com.zhidaoauto.map.sdk.open.marker.Marker;
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
import com.zhidaoauto.map.sdk.open.marker.OnInfoWindowClickListener;
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
@@ -1020,13 +1021,22 @@ public class AMapViewWrapper implements IMogoMapView,
}
@Override
public double[] matchRoad( double lon, double lat, double angle, boolean isRTK ) {
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad( ( ( float ) lon ), ( ( float ) lat ), ( ( float ) angle ), !isRTK, isRTK );
public double[] matchRoad( double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK ) {
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad( ( ( float ) lon ), ( ( float ) lat ), ( ( float ) angle ), isGpsLocation, isRTK );
if ( singlePointRoadInfo != null
&& singlePointRoadInfo.getCoords() != null
&& !singlePointRoadInfo.getCoords().isEmpty() ) {
double matchedPoint[] = PointInterpolatorUtil.mergeToRoad(lon, lat, singlePointRoadInfo.getCoords());
return CoordinateUtils.transformWgsToGcj( matchedPoint[1], matchedPoint[0] );
double matchedPoint[] = PointInterpolatorUtil.mergeToRoad( lon, lat, singlePointRoadInfo.getCoords() );
// return CoordinateUtils.transformWgsToGcj( matchedPoint[1], matchedPoint[0] );
matchedPoint = CoordinateUtils.transformWgsToGcj( matchedPoint[1], matchedPoint[0] );
MarkerOptions options
= new MarkerOptions( );
options.markerIcon( R.drawable.marker_blue )
.position( new LonLatPoint( matchedPoint[0],matchedPoint[1] ) )
.setGps( false );
mMapView.getMapAutoViewHelper().addMarker( options );
return matchedPoint;
}
return null;
}

View File

@@ -315,9 +315,9 @@ public class AMapUIController implements IMogoMapUIController {
}
@Override
public double[] matchRoad( double lon, double lat, double angle, boolean isRTK ) {
public double[] matchRoad( double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK ) {
if ( mClient != null ) {
return mClient.matchRoad( lon, lat, angle, isRTK );
return mClient.matchRoad( lon, lat, angle, isGpsLocation, isRTK );
}
return null;
}