代码优化
This commit is contained in:
@@ -54,6 +54,7 @@ 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.MultiPointOverlayOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnInfoWindowClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
@@ -1022,20 +1023,29 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
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 );
|
||||
double wgs[] = CoordinateUtils.transformGcj02toWgs84( lat, lon );
|
||||
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad( ( ( float ) wgs[0] ), ( ( float ) wgs[1] ), ( ( float ) angle ), isGpsLocation, isRTK );
|
||||
if ( singlePointRoadInfo != null
|
||||
&& singlePointRoadInfo.getCoords() != null
|
||||
&& !singlePointRoadInfo.getCoords().isEmpty() ) {
|
||||
double matchedPoint[] = PointInterpolatorUtil.mergeToRoad( lon, lat, singlePointRoadInfo.getCoords() );
|
||||
double matchedPoint[] = PointInterpolatorUtil.mergeToRoad( wgs[0], wgs[1], 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] ) )
|
||||
= new MarkerOptions();
|
||||
options.markerIcon( R.drawable.red )
|
||||
.position( new LonLatPoint( matchedPoint[0], matchedPoint[1] ) )
|
||||
.setGps( false );
|
||||
mMapView.getMapAutoViewHelper().addMarker( options );
|
||||
MarkerOptions options2
|
||||
= new MarkerOptions();
|
||||
options2.markerIcon( R.drawable.blue )
|
||||
.position( new LonLatPoint( lon, lat ) )
|
||||
.setGps( true );
|
||||
mMapView.getMapAutoViewHelper().addMarker( options2 );
|
||||
|
||||
|
||||
return matchedPoint;
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user