This commit is contained in:
tongchenfei
2021-03-10 15:44:36 +08:00
23 changed files with 4527 additions and 97 deletions

View File

@@ -26,6 +26,7 @@ class MapStyleController {
private MapStyleController() {
mVrAreaFilters.add( new ShunYiArea() );
mVrAreaFilters.add( new OCHArea() );
mVrAreaFilters.add( new HuiXinXiJieArea() );
}
public static MapStyleController getInstance() {
@@ -160,4 +161,27 @@ class MapStyleController {
return 0;
}
}
public static class HuiXinXiJieArea implements VrAreaFilter {
@Override
public double getLeftBottomLat() {
return 39.96741320378243;
}
@Override
public double getLeftBottomLon() {
return 116.41045709250723;
}
@Override
public double getRightTopLat() {
return 39.98232698552779;
}
@Override
public double getRightTopLon() {
return 116.41879656379113;
}
}
}

View File

@@ -468,7 +468,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
return;
}
List< LonLatPoint > newPoints = new ArrayList<>();
ArrayList< LonLatPoint > newPoints = new ArrayList<>();
for ( int i = 0; i < points.size(); i++ ) {
LonLatPoint point = ObjectUtils.fromMogo( points.get( i ) );
if ( point == null ) {
@@ -480,6 +480,35 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
return;
}
// MarkerTranslateAnimation animation = new MarkerTranslateAnimation( newPoints );
// animation.setDuration( duration );
// animation.setAnimationListener( new MarkerAnimationListener() {
// @Override
// public void onAnimationStart( @NotNull Animation animation ) {
//
// }
//
// @Override
// public void onAnimationEnd( @NotNull Animation animation ) {
//
// }
//
// long lastTime = 0L;
//
// @Override
// public void onAnimationRepeat( @NotNull Animation animation ) {
// if ( lastTime == 0L ) {
// lastTime = System.currentTimeMillis();
// return;
// }
// Logger.d( TAG, "frame cost = %s", System.currentTimeMillis() - lastTime );
// lastTime = System.currentTimeMillis();
// }
// } );
// mMarker.setTranslateAnimation( animation );
// mMarker.startAnimation();
mMarker.startSmooth( newPoints, ( int ) duration );
// mMarker.addDynamicAnchorPostion( newPoints.get( newPoints.size() - 1 ), ( int ) duration );
}

View File

@@ -5,6 +5,7 @@ import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.MogoMarkerOptions;
@@ -22,7 +23,10 @@ import com.mogo.map.search.poisearch.MogoPoiResult;
import com.mogo.map.search.poisearch.MogoSearchBound;
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.utils.logger.Logger;
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo;
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
@@ -65,11 +69,26 @@ public class ObjectUtils {
if ( icon == null || icon.isRecycled() ) {
continue;
}
descriptors.add( new BitmapDescriptor( icon ) );
}
}
// 吸附到路边
// if ( opt.isMatchOnRoadSide() ) {
// double coors[] = new double[]{opt.getLongitude(), opt.getLatitude()};
// if ( !opt.isGps() ) {
// coors = CoordinateUtils.transformGcj02toWgs84( opt.getLatitude(), opt.getLongitude() );
// opt.gps( true );
// }
// if ( coors != null ) {
// SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad( ( ( float ) coors[0] ), ( ( float ) coors[1] ), ( ( float ) opt.getRotate() ), true, true );
// double data[] = PointInterpolatorUtil.mergeToRoad( coors[0], coors[1], singlePointRoadInfo.getCoords() );
// if ( data != null ) {
// opt.longitude( data[0] ).latitude( data[1] );
// }
// }
// }
MarkerOptions markerOptions = new MarkerOptions()
.position( new LonLatPoint( opt.getLongitude(), opt.getLatitude() ) )
.anchor( opt.getU(), opt.getV() )
@@ -85,7 +104,7 @@ public class ObjectUtils {
// .draggable( opt.isDraggable() )
.setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
.zIndex( opt.getzIndex() );
if ( !TextUtils.isEmpty( opt.getResName() )) {
if ( !TextUtils.isEmpty( opt.getResName() ) ) {
markerOptions.setMarkerIconName( opt.getResName() );
markerOptions.vrEnable( opt.is3DMode() );
} else {

View File

@@ -17,35 +17,6 @@ public class PointInterpolatorUtil {
private static final String TAG = "PointInterpolatorUtil";
private static final int DISTANCE_THRESHOLD = 2;
/**
* 在两点之间插值
*
* @param start
* @param end
* @param frameInterval
* @return
*/
public static List< MogoLatLng > interpolate( MogoLatLng start, MogoLatLng end, long frameInterval ) {
if ( start == null || end == null ) {
return null;
}
long locInterval = end.time - start.time;
int interpolateFrame = ( int ) ( locInterval / frameInterval ) - 1;
List< MogoLatLng > arrayList = new ArrayList<>();
arrayList.add( start );
if ( interpolateFrame > 0 ) {
double lonStep = ( end.lon - start.lon ) / ( interpolateFrame + 1 );
double latStep = ( end.lat - start.lat ) / ( interpolateFrame + 1 );
for ( int i = 0; i < interpolateFrame; i++ ) {
double lon = start.lon + lonStep * ( i + 1 );
double lat = start.lat + latStep * ( i + 1 );
arrayList.add( new MogoLatLng( lon, lat ) );
}
}
arrayList.add( end );
return arrayList;
}
/**
* 在(x1,y1) (x2,y2)中间插入一些点,使每两个点之间距离<={@link #DISTANCE_THRESHOLD},利用如下公式进行计算
* xn = x1 + (x2 - x1)*n/a