opt
This commit is contained in:
@@ -176,7 +176,7 @@ android {
|
||||
// 分享时是否隐藏 adas
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'false'
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
}
|
||||
// e系列,采用Launcher方案
|
||||
e8xx {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.common.utils;
|
||||
package com.mogo.utils;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
@@ -19,10 +19,8 @@ public class CoordinateUtils {
|
||||
if ( outOfChina( lat, lon ) ) {
|
||||
return new double[]{lat, lon};
|
||||
}
|
||||
double dLat = transformLat( lon - 105.0,
|
||||
lat - 35.0 );
|
||||
double dLon = transformLon( lon - 105.0,
|
||||
lat - 35.0 );
|
||||
double dLat = transformLat( lon - 105.0, lat - 35.0 );
|
||||
double dLon = transformLon( lon - 105.0, lat - 35.0 );
|
||||
double radLat = lat / 180.0 * Math.PI;
|
||||
double magic = Math.sin( radLat );
|
||||
magic = 1 - ee * magic * magic;
|
||||
@@ -34,26 +32,18 @@ public class CoordinateUtils {
|
||||
}
|
||||
|
||||
public static double transformLat( double x, double y ) {
|
||||
double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y
|
||||
+ 0.2 * Math.sqrt( x > 0 ? x : -x );
|
||||
ret += ( 20.0 * Math.sin( 6.0 * x * Math.PI ) + 20.0 * Math.sin( 2.0 * x
|
||||
* Math.PI ) ) * 2.0 / 3.0;
|
||||
ret += ( 20.0 * Math.sin( y * Math.PI ) + 40.0 * Math.sin( y / 3.0
|
||||
* Math.PI ) ) * 2.0 / 3.0;
|
||||
ret += ( 160.0 * Math.sin( y / 12.0 * Math.PI ) + 320 * Math.sin( y
|
||||
* Math.PI / 30.0 ) ) * 2.0 / 3.0;
|
||||
double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt( x > 0 ? x : -x );
|
||||
ret += ( 20.0 * Math.sin( 6.0 * x * Math.PI ) + 20.0 * Math.sin( 2.0 * x * Math.PI ) ) * 2.0 / 3.0;
|
||||
ret += ( 20.0 * Math.sin( y * Math.PI ) + 40.0 * Math.sin( y / 3.0 * Math.PI ) ) * 2.0 / 3.0;
|
||||
ret += ( 160.0 * Math.sin( y / 12.0 * Math.PI ) + 320 * Math.sin( y * Math.PI / 30.0 ) ) * 2.0 / 3.0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static double transformLon( double x, double y ) {
|
||||
double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1
|
||||
* Math.sqrt( x > 0 ? x : -x );
|
||||
ret += ( 20.0 * Math.sin( 6.0 * x * Math.PI ) + 20.0 * Math.sin( 2.0 * x
|
||||
* Math.PI ) ) * 2.0 / 3.0;
|
||||
ret += ( 20.0 * Math.sin( x * Math.PI ) + 40.0 * Math.sin( x / 3.0
|
||||
* Math.PI ) ) * 2.0 / 3.0;
|
||||
ret += ( 150.0 * Math.sin( x / 12.0 * Math.PI ) + 300.0 * Math.sin( x
|
||||
/ 30.0 * Math.PI ) ) * 2.0 / 3.0;
|
||||
double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt( x > 0 ? x : -x );
|
||||
ret += ( 20.0 * Math.sin( 6.0 * x * Math.PI ) + 20.0 * Math.sin( 2.0 * x * Math.PI ) ) * 2.0 / 3.0;
|
||||
ret += ( 20.0 * Math.sin( x * Math.PI ) + 40.0 * Math.sin( x / 3.0 * Math.PI ) ) * 2.0 / 3.0;
|
||||
ret += ( 150.0 * Math.sin( x / 12.0 * Math.PI ) + 300.0 * Math.sin( x / 30.0 * Math.PI ) ) * 2.0 / 3.0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -65,4 +55,25 @@ public class CoordinateUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static final double[] transformGcj02toWgs84( double lat, double lng ) {
|
||||
double[] var10000;
|
||||
if ( outOfChina( lat, lng ) ) {
|
||||
var10000 = new double[]{lng, lat};
|
||||
} else {
|
||||
double dlat = transformLat( lng - 105.0D, lat - 35.0D );
|
||||
double dlng = transformLon( lng - 105.0D, lat - 35.0D );
|
||||
double radlat = lat / 180.0D * Math.PI;
|
||||
double magic = Math.sin( radlat );
|
||||
magic = ( double ) 1 - 0.006693421622965943D * magic * magic;
|
||||
double sqrtmagic = Math.sqrt( magic );
|
||||
dlat = dlat * 180.0D / ( 6335552.717000426D / ( magic * sqrtmagic ) * Math.PI );
|
||||
dlng = dlng * 180.0D / ( 6378245.0D / sqrtmagic * Math.cos( radlat ) * Math.PI );
|
||||
double mglat = lat + dlat;
|
||||
double mglng = lng + dlng;
|
||||
var10000 = new double[]{lng * ( double ) 2 - mglng, lat * ( double ) 2 - mglat};
|
||||
}
|
||||
|
||||
return var10000;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.CoordinatesTransformer;
|
||||
import com.mogo.map.IMogoMapApiBuilder;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MapApiPath;
|
||||
@@ -114,6 +115,11 @@ class AMapApiBuilder implements IMogoMapApiBuilder {
|
||||
return IconTypeUtils.getResIdByIconType( context, iconType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoordinatesTransformer getCoordinatesTransformer() {
|
||||
return AMapCoordinatesTransformer.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init." );
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.map.impl.amap;
|
||||
|
||||
import com.mogo.map.CoordinatesTransformer;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/17
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class AMapCoordinatesTransformer implements CoordinatesTransformer {
|
||||
|
||||
private AMapCoordinatesTransformer() {
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final AMapCoordinatesTransformer INSTANCE = new AMapCoordinatesTransformer();
|
||||
}
|
||||
|
||||
public static AMapCoordinatesTransformer getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] transform( double lat, double lon ) {
|
||||
double[] coor = new double[2];
|
||||
coor[0] = lat;
|
||||
coor[1] = lon;
|
||||
return coor;
|
||||
// return new double[]{lat, lon};
|
||||
// return CoordinateUtils.transformGcj02toWgs84( lat, lon );
|
||||
}
|
||||
}
|
||||
@@ -525,6 +525,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
mMovingPointOverlay.startSmoothMove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSmoothInMs( List< MogoLatLng > points, long duration ) {
|
||||
startSmooth( points, ( ( int ) ( duration / 1000 ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfoWindowShowing() {
|
||||
if ( mMarker == null ) {
|
||||
|
||||
@@ -192,7 +192,7 @@ public class ObjectUtils {
|
||||
if ( latLng == null ) {
|
||||
return null;
|
||||
}
|
||||
return new LatLng( latLng.lat, latLng.lng );
|
||||
return new LatLng( latLng.lat, latLng.lon );
|
||||
}
|
||||
|
||||
public static MogoLatLng fromAMap( LatLonPoint point ) {
|
||||
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.1.5'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.1.8'
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.map.impl.custom;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.CoordinatesTransformer;
|
||||
import com.mogo.map.IMogoMapApiBuilder;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MapApiPath;
|
||||
@@ -116,6 +117,11 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
return IconTypeUtils.getResIdByIconType( context, iconType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoordinatesTransformer getCoordinatesTransformer() {
|
||||
return CustomMapCoordinatesTransformer.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init" );
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import com.mogo.map.CoordinatesTransformer;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/17
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class CustomMapCoordinatesTransformer implements CoordinatesTransformer {
|
||||
|
||||
private CustomMapCoordinatesTransformer() {
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final CustomMapCoordinatesTransformer INSTANCE = new CustomMapCoordinatesTransformer();
|
||||
}
|
||||
|
||||
public static CustomMapCoordinatesTransformer getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] transform( double lat, double lon ) {
|
||||
double[] coor = new double[2];
|
||||
coor[0] = lat;
|
||||
coor[1] = lon;
|
||||
return coor;
|
||||
}
|
||||
}
|
||||
@@ -52,35 +52,36 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
private MogoMarkerOptions mMogoMarkerOptions;
|
||||
private String mOwner;
|
||||
|
||||
public AMapMarkerWrapper(Marker marker, MogoMarkerOptions mogoMarkerOptions) {
|
||||
public AMapMarkerWrapper( Marker marker, MogoMarkerOptions mogoMarkerOptions ) {
|
||||
this.mMarker = marker;
|
||||
if (marker != null) {
|
||||
if ( marker != null ) {
|
||||
// 设置自研 marker 的object对象为 IMogoMarker 实例。!!!!
|
||||
marker.setMObject(this);
|
||||
MarkerWrapperClickHelper.getInstance().setMogoMarkerMap(marker.getId(),this);
|
||||
marker.setMObject( this );
|
||||
MarkerWrapperClickHelper.getInstance().setMogoMarkerMap( marker.getId(), this );
|
||||
}
|
||||
setObject(mogoMarkerOptions.getObject());
|
||||
setObject( mogoMarkerOptions.getObject() );
|
||||
this.mMogoMarkerOptions = mogoMarkerOptions;
|
||||
mMogoMarkerOptions.addObserver(this);
|
||||
mMogoMarkerOptions.addObserver( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
if (isDestroyed()) {
|
||||
public void update( Observable o, Object arg ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
setMarkerOptions(mMogoMarkerOptions);
|
||||
setMarkerOptions( mMogoMarkerOptions );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (mMogoMarkerOptions != null) {
|
||||
if ( mMogoMarkerOptions != null ) {
|
||||
mMogoMarkerOptions.deleteObservers();
|
||||
mMogoMarkerOptions = null;
|
||||
}
|
||||
if (mMarker != null) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.remove();
|
||||
mMarker.setMObject(null);
|
||||
mMarker.setMObject( null );
|
||||
mMarker.setOnInfoWindowClickListener( null );
|
||||
mMarker = null;
|
||||
}
|
||||
mMogoInfoWindowAdapter = null;
|
||||
@@ -96,45 +97,45 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
|
||||
@Override
|
||||
public void hideInfoWindow() {
|
||||
if (mMarker != null) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.hideInfoWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(float alpha) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setAlpha(alpha);
|
||||
public void setAlpha( float alpha ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setAlpha( alpha );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchor(float anchorU, float anchorV) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setAnchor(anchorU, anchorV);
|
||||
public void setAnchor( float anchorU, float anchorV ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setAnchor( anchorU, anchorV );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDraggable(boolean paramBoolean) {
|
||||
public void setDraggable( boolean paramBoolean ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setDraggable( paramBoolean );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon(Bitmap icon) {
|
||||
if (icon == null || icon.isRecycled()) {
|
||||
public void setIcon( Bitmap icon ) {
|
||||
if ( icon == null || icon.isRecycled() ) {
|
||||
return;
|
||||
}
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon(icon);
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setIcon( icon );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcons(ArrayList<Bitmap> icons) {
|
||||
if (icons == null || icons.isEmpty()) {
|
||||
public void setIcons( ArrayList< Bitmap > icons ) {
|
||||
if ( icons == null || icons.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
// ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||
@@ -153,9 +154,9 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoWindowEnable(boolean enabled) {
|
||||
if (mMarker != null) {
|
||||
if (enabled) {
|
||||
public void setInfoWindowEnable( boolean enabled ) {
|
||||
if ( mMarker != null ) {
|
||||
if ( enabled ) {
|
||||
mMarker.showInfoWindow();
|
||||
} else {
|
||||
mMarker.hideInfoWindow();
|
||||
@@ -164,20 +165,20 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerOptions(MogoMarkerOptions opt) {
|
||||
public void setMarkerOptions( MogoMarkerOptions opt ) {
|
||||
|
||||
final MarkerOptions options = ObjectUtils.fromMogo(opt);
|
||||
if (options == null) {
|
||||
final MarkerOptions options = ObjectUtils.fromMogo( opt );
|
||||
if ( options == null ) {
|
||||
return;
|
||||
}
|
||||
if (mMarker != null) {
|
||||
mMarker.setMarkerOptions(options);
|
||||
setObject(opt.getObject());
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setMarkerOptions( options );
|
||||
setObject( opt.getObject() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObject(Object object) {
|
||||
public void setObject( Object object ) {
|
||||
mObject = object;
|
||||
}
|
||||
|
||||
@@ -187,89 +188,89 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeriod(int period) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setPeriod(period);
|
||||
public void setPeriod( int period ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setPeriod( period );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(double lat, double lng) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setPosition(new LonLatPoint(lng,lat));
|
||||
public void setPosition( double lat, double lng ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setPosition( new LonLatPoint( lng, lat ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getPosition() {
|
||||
if (mMarker != null) {
|
||||
if ( mMarker != null ) {
|
||||
final LonLatPoint latLng = mMarker.getPosition();
|
||||
return ObjectUtils.fromAMap(latLng);
|
||||
return ObjectUtils.fromAMap( latLng );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotateAngle(float rotate) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setRotateAngle(rotate);
|
||||
public void setRotateAngle( float rotate ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setRotateAngle( rotate );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSnippet(String snippet) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setSnippet(snippet);
|
||||
public void setSnippet( String snippet ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setSnippet( snippet );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(String title) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setTitle(title);
|
||||
public void setTitle( String title ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setTitle( title );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToTop() {
|
||||
if (mMarker != null) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setToTop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setVisible(visible);
|
||||
public void setVisible( boolean visible ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setVisible( visible );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZIndex(int zIndex) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setZIndex(zIndex);
|
||||
public void setZIndex( int zIndex ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setZIndex( zIndex );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showInfoWindow() {
|
||||
if (mMarker != null) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.showInfoWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMarkerClickListener(IMogoMarkerClickListener listener) {
|
||||
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
|
||||
mMogoMarkerClickListener = listener;
|
||||
if(mMarker != null){
|
||||
mMarker.setOnMarkClickListener(new OnMarkClickListener() {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setOnMarkClickListener( new OnMarkClickListener() {
|
||||
@Override
|
||||
public void onMarkClick(@NotNull Marker marker) {
|
||||
if(mMogoMarkerClickListener!= null){
|
||||
mMogoMarkerClickListener.onMarkerClicked(AMapMarkerWrapper.this);
|
||||
}
|
||||
public void onMarkClick( @NotNull Marker marker ) {
|
||||
if ( mMogoMarkerClickListener != null ) {
|
||||
mMogoMarkerClickListener.onMarkerClicked( AMapMarkerWrapper.this );
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +280,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoWindowAdapter(IMogoInfoWindowAdapter adapter) {
|
||||
public void setInfoWindowAdapter( IMogoInfoWindowAdapter adapter ) {
|
||||
mMogoInfoWindowAdapter = adapter;
|
||||
}
|
||||
|
||||
@@ -289,11 +290,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerIconView(IMogoMarkerIconViewCreator creator) {
|
||||
if (creator != null) {
|
||||
View iconView = creator.createView(this);
|
||||
if (iconView != null) {
|
||||
mMarker.setIcon(iconView);
|
||||
public void setMarkerIconView( IMogoMarkerIconViewCreator creator ) {
|
||||
if ( creator != null ) {
|
||||
View iconView = creator.createView( this );
|
||||
if ( iconView != null ) {
|
||||
mMarker.setIcon( iconView );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -304,25 +305,25 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(String mOwner) {
|
||||
public void setOwner( String mOwner ) {
|
||||
this.mOwner = mOwner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner() {
|
||||
if (mOwner != null) {
|
||||
if ( mOwner != null ) {
|
||||
return mOwner;
|
||||
}
|
||||
if (mMogoMarkerOptions != null) {
|
||||
if ( mMogoMarkerOptions != null ) {
|
||||
return mMogoMarkerOptions.getOwner();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionByPixels(Point position) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setPosition(MapTools.INSTANCE.fromScreenLocation(position));
|
||||
public void setPositionByPixels( Point position ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setPosition( MapTools.INSTANCE.fromScreenLocation( position ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,11 +337,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator) {
|
||||
if (isDestroyed()) {
|
||||
public void startScaleAnimation( float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
startScaleAnimation(fromX, toX, fromY, toY, duration, interpolator,null);
|
||||
startScaleAnimation( fromX, toX, fromY, toY, duration, interpolator, null );
|
||||
// ScaleAnimation animationScale = new ScaleAnimation(fromX, toX, fromY, toY);
|
||||
// animationScale.setDuration(duration);
|
||||
// animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
|
||||
@@ -351,129 +352,134 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, OnMarkerAnimationListener listener) {
|
||||
if (isDestroyed()) {
|
||||
public void startScaleAnimation( float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
MarkerScaleAnimation animationScale = new MarkerScaleAnimation(fromX, toX);
|
||||
animationScale.setDuration(duration*1000);
|
||||
MarkerScaleAnimation animationScale = new MarkerScaleAnimation( fromX, toX );
|
||||
animationScale.setDuration( duration * 1000 );
|
||||
// animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
|
||||
// animationScale.setInterpolator(interpolator);
|
||||
animationScale.setAnimationListener(new MarkerAnimationListener() {
|
||||
animationScale.setAnimationListener( new MarkerAnimationListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(@NotNull Animation animation) {
|
||||
if (isDestroyed()) {
|
||||
public void onAnimationEnd( @NotNull Animation animation ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if (listener != null) {
|
||||
if ( listener != null ) {
|
||||
listener.onAnimEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(@NotNull Animation animation) {
|
||||
public void onAnimationRepeat( @NotNull Animation animation ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(@NotNull Animation animation) {
|
||||
if (isDestroyed()) {
|
||||
public void onAnimationStart( @NotNull Animation animation ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if (listener != null) {
|
||||
if ( listener != null ) {
|
||||
listener.onAnimStart();
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mMarker.setMarkerScaleAnimation(animationScale);
|
||||
mMarker.setMarkerScaleAnimation( animationScale );
|
||||
mMarker.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJumpAnimation(float high, long duration, Interpolator interpolator, OnMarkerAnimationListener listener) {
|
||||
if (isDestroyed() || high <= 0.0f || interpolator == null || duration < 0) {
|
||||
public void startJumpAnimation( float high, long duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
|
||||
if ( isDestroyed() || high <= 0.0f || interpolator == null || duration < 0 ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final LonLatPoint latLng = ObjectUtils.fromMogo(getPosition());
|
||||
final LonLatPoint latLng = ObjectUtils.fromMogo( getPosition() );
|
||||
// Point point = AMapWrapper.getAMap().getProjection().toScreenLocation(latLng);
|
||||
// point.y -= WindowUtils.dip2px(AbsMogoApplication.getApp(), high);
|
||||
// LatLng target = AMapWrapper.getAMap().getProjection().fromScreenLocation(point);
|
||||
//使用TranslateAnimation,填写一个需要移动的目标点
|
||||
MarkerTranslateAnimation animation = new MarkerTranslateAnimation(latLng);
|
||||
MarkerTranslateAnimation animation = new MarkerTranslateAnimation( latLng );
|
||||
// animation.setInterpolator(interpolator);
|
||||
animation.setAnimationListener(new MarkerAnimationListener() {
|
||||
animation.setAnimationListener( new MarkerAnimationListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(@NotNull Animation animation) {
|
||||
if (isDestroyed()) {
|
||||
public void onAnimationEnd( @NotNull Animation animation ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if (listener != null) {
|
||||
if ( listener != null ) {
|
||||
listener.onAnimEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(@NotNull Animation animation) {
|
||||
public void onAnimationRepeat( @NotNull Animation animation ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(@NotNull Animation animation) {
|
||||
if (isDestroyed()) {
|
||||
public void onAnimationStart( @NotNull Animation animation ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if (listener != null) {
|
||||
if ( listener != null ) {
|
||||
listener.onAnimStart();
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
//整个移动所需要的时间
|
||||
animation.setDuration(duration*1000);
|
||||
animation.setDuration( duration * 1000 );
|
||||
//设置动画
|
||||
mMarker.setTranslateAnimation(animation);
|
||||
mMarker.setTranslateAnimation( animation );
|
||||
mMarker.startAnimation();
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "error.");
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickable(boolean clickable) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setClickable(clickable);
|
||||
public void setClickable( boolean clickable ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setClickable( clickable );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSmooth(List<MogoLatLng> points, int duration) {
|
||||
if (isDestroyed()) {
|
||||
public void startSmooth( List< MogoLatLng > points, int duration ) {
|
||||
startSmoothInMs( points, duration * 1000 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSmoothInMs( List< MogoLatLng > points, long duration ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mMarker == null) {
|
||||
if ( mMarker == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (points == null || points.isEmpty()) {
|
||||
if ( points == null || points.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<LonLatPoint> newPoints = new ArrayList<>();
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
LonLatPoint point = ObjectUtils.fromMogo(points.get(i));
|
||||
if (point == null) {
|
||||
List< LonLatPoint > newPoints = new ArrayList<>();
|
||||
for ( int i = 0; i < points.size(); i++ ) {
|
||||
LonLatPoint point = ObjectUtils.fromMogo( points.get( i ) );
|
||||
if ( point == null ) {
|
||||
continue;
|
||||
}
|
||||
newPoints.add(point);
|
||||
newPoints.add( point );
|
||||
}
|
||||
if (newPoints.isEmpty()) {
|
||||
if ( newPoints.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
mMarker.startSmooth(newPoints,duration*1000);
|
||||
mMarker.startSmooth( newPoints, ( int ) duration );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -492,4 +498,13 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
mMarker.setGps( isGps );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use3DResource( int model3D ) {
|
||||
try {
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().marker3DIcon( model3D ) );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "use3DResource" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,11 +68,9 @@ public class ObjectUtils {
|
||||
descriptors.add( new BitmapDescriptor( icon ) );
|
||||
}
|
||||
}
|
||||
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo( opt );
|
||||
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.position( new LonLatPoint( opt.getLongitude(), opt.getLatitude() ) )
|
||||
.markerIcon( descriptor )
|
||||
.anchor( opt.getU(), opt.getV() )
|
||||
// .icons( descriptors )
|
||||
// .period( opt.getPeriod() )
|
||||
@@ -85,6 +83,10 @@ public class ObjectUtils {
|
||||
// .draggable( opt.isDraggable() )
|
||||
.setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
|
||||
.zIndex( opt.getzIndex() );
|
||||
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo( opt );
|
||||
if ( descriptor != null ) {
|
||||
markerOptions.markerIcon( descriptor );
|
||||
}
|
||||
if ( opt.getIcon3DRes() != 0 ) {
|
||||
markerOptions.marker3DIcon( opt.getIcon3DRes() );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.map;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/17
|
||||
*
|
||||
* 目前整个坐标按照高德火星坐标为准,故对于高德和自研地图,需要实现不同的转换,达到适应各自地图的目的
|
||||
*/
|
||||
interface CoordinatesTransformer {
|
||||
|
||||
double[] transform( double lat, double lon );
|
||||
}
|
||||
@@ -49,4 +49,6 @@ interface IMogoMapApiBuilder extends IProvider {
|
||||
IMogoTrafficSearch getTrafficSearch();
|
||||
|
||||
int getResIdByIconType( Context context, int iconType );
|
||||
|
||||
CoordinatesTransformer getCoordinatesTransformer();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class MogoLatLng implements Parcelable {
|
||||
public MogoLatLng( double lat, double lon ) {
|
||||
this.lat = lat;
|
||||
this.lng = lon;
|
||||
this.lon = lng;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
|
||||
@@ -5,6 +5,8 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.annotation.RawRes;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
|
||||
@@ -281,14 +283,14 @@ public interface IMogoMarker {
|
||||
* @param listener
|
||||
*/
|
||||
void startScaleAnimationWithAlpha( float fromX,
|
||||
float toX,
|
||||
float fromY,
|
||||
float toY,
|
||||
float fromAlpha,
|
||||
float toAlpha,
|
||||
int duration,
|
||||
Interpolator interpolator,
|
||||
OnMarkerAnimationListener listener );
|
||||
float toX,
|
||||
float fromY,
|
||||
float toY,
|
||||
float fromAlpha,
|
||||
float toAlpha,
|
||||
int duration,
|
||||
Interpolator interpolator,
|
||||
OnMarkerAnimationListener listener );
|
||||
|
||||
|
||||
/**
|
||||
@@ -319,15 +321,32 @@ public interface IMogoMarker {
|
||||
*/
|
||||
void startSmooth( List< MogoLatLng > points, int duration );
|
||||
|
||||
/**
|
||||
* 开始平滑移动,毫秒
|
||||
*
|
||||
* @param points 坐标点
|
||||
* @param duration 时长
|
||||
*/
|
||||
void startSmoothInMs( List< MogoLatLng > points, long duration );
|
||||
|
||||
/**
|
||||
* info window 是否正在显示
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isInfoWindowShowing();
|
||||
|
||||
/**
|
||||
* 设置是否是gps
|
||||
*
|
||||
* @param isGps
|
||||
*/
|
||||
void setGps(boolean isGps);
|
||||
void setGps( boolean isGps );
|
||||
|
||||
/**
|
||||
* 使用3D资源
|
||||
*/
|
||||
default void use3DResource( @RawRes int model3D ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,9 +73,21 @@ public class MogoMarkerOptions extends Observable {
|
||||
*/
|
||||
private boolean mAutoManager = true;
|
||||
|
||||
private @RawRes int mIcon3DRes = 0;
|
||||
private @RawRes
|
||||
int mIcon3DRes = 0;
|
||||
|
||||
public MogoMarkerOptions position( MogoLatLng latLng ){
|
||||
private boolean mIs3DMode = false;
|
||||
|
||||
public MogoMarkerOptions set3DMode( boolean is3DMode ) {
|
||||
mIs3DMode = is3DMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean is3DMode() {
|
||||
return mIs3DMode;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions position( MogoLatLng latLng ) {
|
||||
if ( latLng != null ) {
|
||||
latitude( latLng.lat );
|
||||
longitude( latLng.lon );
|
||||
@@ -83,7 +95,7 @@ public class MogoMarkerOptions extends Observable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions position( MogoLocation location ){
|
||||
public MogoMarkerOptions position( MogoLocation location ) {
|
||||
if ( location != null ) {
|
||||
latitude( location.getLatitude() );
|
||||
longitude( location.getLongitude() );
|
||||
@@ -91,7 +103,7 @@ public class MogoMarkerOptions extends Observable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions position( Location location ){
|
||||
public MogoMarkerOptions position( Location location ) {
|
||||
if ( location != null ) {
|
||||
latitude( location.getLatitude() );
|
||||
longitude( location.getLongitude() );
|
||||
@@ -216,7 +228,7 @@ public class MogoMarkerOptions extends Observable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions icon3DRes(@RawRes int icon3DRes){
|
||||
public MogoMarkerOptions icon3DRes( @RawRes int icon3DRes ) {
|
||||
this.mIcon3DRes = icon3DRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mogo.map;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/17
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoCoordinatesTransformer implements CoordinatesTransformer {
|
||||
|
||||
private CoordinatesTransformer mDelegate;
|
||||
|
||||
private static volatile MogoCoordinatesTransformer sInstance;
|
||||
|
||||
private MogoCoordinatesTransformer(){
|
||||
mDelegate = MogoMapDelegateFactory.getCoordinatesTransformer();
|
||||
}
|
||||
|
||||
public static MogoCoordinatesTransformer getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( MogoCoordinatesTransformer.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new MogoCoordinatesTransformer();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] transform( double lat, double lon ) {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.transform( lat, lon );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -133,4 +133,8 @@ class MogoMapDelegateFactory {
|
||||
public static IMogoTrafficSearch getTrafficSearch() {
|
||||
return getApiBuilder().getTrafficSearch();
|
||||
}
|
||||
|
||||
public static CoordinatesTransformer getCoordinatesTransformer(){
|
||||
return getApiBuilder().getCoordinatesTransformer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -13,12 +12,7 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.constants.SafeType;
|
||||
import com.mogo.module.common.constants.VisionMode;
|
||||
import com.mogo.module.common.drawer.marker.MarkerResourceManager;
|
||||
import com.mogo.module.common.utils.CoordinateUtils;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -105,8 +99,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if ( latLon == null ) {
|
||||
continue;
|
||||
}
|
||||
double targetPos[] = CoordinateUtils.transformFromWGSToGCJ( latLon.lat, latLon.lon );
|
||||
points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
|
||||
// double targetPos[] = transformGcj02ToFitMap( latLon.lat, latLon.lon );
|
||||
// points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
|
||||
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
|
||||
}
|
||||
|
||||
} else if ( recognizedListResult.latLonList != null
|
||||
@@ -118,7 +113,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
continue;
|
||||
}
|
||||
points.add( latLng );
|
||||
points.add( endLatLon = new MogoLatLng( latLng.lat, latLon.lon ) );
|
||||
// double targetPos[] = transformGcj02ToFitMap( latLon.lat, latLon.lon );
|
||||
// points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
|
||||
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
|
||||
}
|
||||
if ( endLatLon != null ) {
|
||||
marker.setObject( endLatLon );
|
||||
@@ -172,12 +169,13 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return null;
|
||||
}
|
||||
|
||||
// double targetPos[] = transformGcj02ToFitMap( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon );
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.icon( inflateView( recognizedListResult, machineVision, curSpeed ) )
|
||||
.gps( true )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.rotate( ( float ) recognizedListResult.heading )
|
||||
// .position( new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
|
||||
.position( new MogoLatLng( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon ) );
|
||||
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_ADAS, options );
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import com.mogo.map.CoordinatesTransformer;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.CarModelType;
|
||||
import com.mogo.module.common.constants.SafeType;
|
||||
|
||||
@@ -72,4 +74,13 @@ class BaseDrawer {
|
||||
// 根据车道、行驶方向等计算出选用哪个车模图片
|
||||
return CarModelType.Other;
|
||||
}
|
||||
|
||||
private CoordinatesTransformer mTransformer;
|
||||
|
||||
protected double[] transformGcj02ToFitMap( double lat, double lon ) {
|
||||
if ( mTransformer == null ) {
|
||||
mTransformer = MogoApisHandler.getInstance().getApis().getMapServiceApi().getCoordinatesTransformer();
|
||||
}
|
||||
return mTransformer.transform( lat, lon );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -15,17 +12,10 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.constants.CarModelType;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.constants.SafeType;
|
||||
import com.mogo.module.common.constants.VisionMode;
|
||||
import com.mogo.module.common.drawer.marker.MarkerResourceManager;
|
||||
import com.mogo.module.common.entity.CloudLocationInfo;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.common.utils.CoordinateUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -80,6 +70,8 @@ class SnapshotSetDataDrawer extends BaseDrawer {
|
||||
|
||||
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
/**
|
||||
* 其他车辆、rsu 车辆数据
|
||||
*
|
||||
@@ -128,22 +120,30 @@ class SnapshotSetDataDrawer extends BaseDrawer {
|
||||
}
|
||||
mCloudSnapshotMarkersCaches.put( uniqueKey, marker );
|
||||
} else {
|
||||
marker.setGps( false );
|
||||
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
|
||||
if ( mIsVrMode ) {
|
||||
marker.use3DResource( getVrModel() );
|
||||
} else {
|
||||
marker.setIcon( ViewUtils.fromView( inflateView( cloudRoadData, machineVision, 0 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
MogoLatLng lastPosition = mLastPositions.get( uniqueKey );
|
||||
double targetPos[] = CoordinateUtils.transformFromWGSToGCJ( target.lat, target.lon );
|
||||
double lastPos[] = CoordinateUtils.transformFromWGSToGCJ( lastPosition.lat, lastPosition.lon );
|
||||
// double targetPos[] = transformGcj02ToFitMap( target.lat, target.lon );
|
||||
// double lastPos[] = transformGcj02ToFitMap( lastPosition.lat, lastPosition.lon );
|
||||
if ( lastPosition != null ) {
|
||||
if ( lastPosition.equals( target ) ) {
|
||||
marker.setPosition( lastPos[POS_LAT], lastPos[POS_LON] );
|
||||
marker.setPosition( lastPosition.lat, lastPosition.lon );
|
||||
} else {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
points.add( new MogoLatLng( lastPos[POS_LAT], lastPos[POS_LON] ) );
|
||||
points.add( new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
|
||||
marker.startSmooth( points, 1 );
|
||||
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
|
||||
points.add( new MogoLatLng( target.lat, target.lon ) );
|
||||
marker.startSmoothInMs( points, 1000L );
|
||||
}
|
||||
} else {
|
||||
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
|
||||
marker.setPosition( targetPos[POS_LAT], targetPos[POS_LON] );
|
||||
marker.setPosition( target.lat, target.lon );
|
||||
}
|
||||
}
|
||||
mLastPositions.put( uniqueKey, target );
|
||||
@@ -197,16 +197,25 @@ class SnapshotSetDataDrawer extends BaseDrawer {
|
||||
}
|
||||
|
||||
Logger.d( TAG, "draw marker uniqueKey = %s", data.getUniqueKey() );
|
||||
// double coor[] = transformGcj02ToFitMap( data.getLat(), data.getLon() );
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
|
||||
.icon( inflateView( data, machineVision, curSpeed ) )
|
||||
.gps( true )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.rotate( ( float ) data.getHeading() )
|
||||
// .position( new MogoLatLng( coor[POS_LAT], coor[POS_LON] ) );
|
||||
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
|
||||
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.icon3DRes( getVrModel() );
|
||||
} else {
|
||||
options.icon( inflateView( data, machineVision, curSpeed ) );
|
||||
}
|
||||
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
|
||||
}
|
||||
|
||||
private int getVrModel() {
|
||||
return R.raw.taxi;
|
||||
}
|
||||
|
||||
private View inflateView( CloudRoadData data, boolean machineVision, double curSpeed ) {
|
||||
View rootView = LayoutInflater.from( AbsMogoApplication.getApp() ).inflate( R.layout.module_commons_layout_car, null );
|
||||
// SafeType safeType = getSafeType( data.getDistance(), data.getSpeed(), curSpeed );
|
||||
@@ -223,28 +232,4 @@ class SnapshotSetDataDrawer extends BaseDrawer {
|
||||
iv.setImageResource( R.drawable.icon_map_marker_car_gray );
|
||||
return rootView;
|
||||
}
|
||||
|
||||
private Bitmap fromView( View view ) {
|
||||
view.setDrawingCacheEnabled( true );
|
||||
processChildView( view );
|
||||
view.destroyDrawingCache();
|
||||
view.measure( View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ), View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ) );
|
||||
view.layout( 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight() );
|
||||
Bitmap bitmap = null;
|
||||
return ( bitmap = view.getDrawingCache() ) != null ? bitmap.copy( Bitmap.Config.ARGB_8888, false ) : null;
|
||||
}
|
||||
|
||||
private void processChildView( View view ) {
|
||||
if ( !( view instanceof ViewGroup ) ) {
|
||||
if ( view instanceof TextView ) {
|
||||
( ( TextView ) view ).setHorizontallyScrolling( false );
|
||||
}
|
||||
|
||||
} else {
|
||||
for ( int var1 = 0; var1 < ( ( ViewGroup ) view ).getChildCount(); ++var1 ) {
|
||||
processChildView( ( ( ViewGroup ) view ).getChildAt( var1 ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.common.drawer.marker;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -26,6 +27,8 @@ import com.mogo.utils.logger.Logger;
|
||||
public class MapMarkerView extends MapMarkerBaseView {
|
||||
private String TAG = "MapMarkerView";
|
||||
|
||||
private FrameLayout clMarkerTopView;
|
||||
|
||||
public MapMarkerView( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
@@ -48,6 +51,7 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
protected void initView( Context context ) {
|
||||
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout, this );
|
||||
ivIcon = findViewById( R.id.ivIcon );
|
||||
clMarkerTopView = findViewById( R.id.clMarkerTopView );
|
||||
ivCar = findViewById( R.id.ivCar );
|
||||
}
|
||||
|
||||
@@ -57,7 +61,9 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow_vr );
|
||||
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_vr_bkg );
|
||||
} else {
|
||||
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_bkg );
|
||||
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow );
|
||||
}
|
||||
switch ( markerShowEntity.getMarkerType() ) {
|
||||
@@ -65,14 +71,14 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
case ModuleNames.CARD_TYPE_NOVELTY:
|
||||
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
|
||||
// 根据poiType获取对应的图片
|
||||
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
|
||||
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
|
||||
PoiWrapper poiWrapper =
|
||||
CloudPoiManager.getInstance().getWrapperByPoiType(poiType);
|
||||
if (poiWrapper != null) {
|
||||
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
|
||||
if ( poiWrapper != null ) {
|
||||
// 加载图片
|
||||
loadPoiTypeIcon(poiWrapper.getIconUrl(),poiWrapper.getIconRes());
|
||||
}else{
|
||||
Logger.e(TAG, "未能根据poiType获取对应poi信息,无法渲染marker====" + poiType);
|
||||
loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() );
|
||||
} else {
|
||||
Logger.e( TAG, "未能根据poiType获取对应poi信息,无法渲染marker====" + poiType );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mogo.module.common.entity;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.mogo.utils.CoordinateUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -19,10 +21,13 @@ public class CloudLocationInfo implements Parcelable {
|
||||
private double alt;
|
||||
private double speed;
|
||||
|
||||
public double oldLat;
|
||||
public double oldLon;
|
||||
|
||||
public CloudLocationInfo() {
|
||||
}
|
||||
|
||||
public CloudLocationInfo(CloudLocationInfo info) {
|
||||
public CloudLocationInfo( CloudLocationInfo info ) {
|
||||
this.lat = info.getLat();
|
||||
this.lon = info.getLon();
|
||||
this.heading = info.getHeading();
|
||||
@@ -32,7 +37,17 @@ public class CloudLocationInfo implements Parcelable {
|
||||
this.speed = info.speed;
|
||||
}
|
||||
|
||||
protected CloudLocationInfo(Parcel in) {
|
||||
public void convertCoor2GCJ02(){
|
||||
this.oldLat = lat;
|
||||
this.oldLon = lon;
|
||||
double[] amapCoord = CoordinateUtils.transformFromWGSToGCJ( lat, lon );
|
||||
if ( amapCoord != null ) {
|
||||
this.lat = amapCoord[0];
|
||||
this.lon = amapCoord[1];
|
||||
}
|
||||
}
|
||||
|
||||
protected CloudLocationInfo( Parcel in ) {
|
||||
lat = in.readDouble();
|
||||
lon = in.readDouble();
|
||||
heading = in.readDouble();
|
||||
@@ -43,14 +58,14 @@ public class CloudLocationInfo implements Parcelable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeDouble(lat);
|
||||
dest.writeDouble(lon);
|
||||
dest.writeDouble(heading);
|
||||
dest.writeLong(systemTime);
|
||||
dest.writeLong(satelliteTime);
|
||||
dest.writeDouble(alt);
|
||||
dest.writeDouble(speed);
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeDouble( lat );
|
||||
dest.writeDouble( lon );
|
||||
dest.writeDouble( heading );
|
||||
dest.writeLong( systemTime );
|
||||
dest.writeLong( satelliteTime );
|
||||
dest.writeDouble( alt );
|
||||
dest.writeDouble( speed );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,14 +73,14 @@ public class CloudLocationInfo implements Parcelable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<CloudLocationInfo> CREATOR = new Creator<CloudLocationInfo>() {
|
||||
public static final Creator< CloudLocationInfo > CREATOR = new Creator< CloudLocationInfo >() {
|
||||
@Override
|
||||
public CloudLocationInfo createFromParcel(Parcel in) {
|
||||
return new CloudLocationInfo(in);
|
||||
public CloudLocationInfo createFromParcel( Parcel in ) {
|
||||
return new CloudLocationInfo( in );
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudLocationInfo[] newArray(int size) {
|
||||
public CloudLocationInfo[] newArray( int size ) {
|
||||
return new CloudLocationInfo[size];
|
||||
}
|
||||
};
|
||||
@@ -74,7 +89,7 @@ public class CloudLocationInfo implements Parcelable {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
public void setLat( double lat ) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
@@ -82,7 +97,7 @@ public class CloudLocationInfo implements Parcelable {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
public void setLon( double lon ) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@@ -90,7 +105,7 @@ public class CloudLocationInfo implements Parcelable {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
public void setHeading( double heading ) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
@@ -98,7 +113,7 @@ public class CloudLocationInfo implements Parcelable {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(long systemTime) {
|
||||
public void setSystemTime( long systemTime ) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
@@ -106,7 +121,7 @@ public class CloudLocationInfo implements Parcelable {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public void setSatelliteTime(long satelliteTime) {
|
||||
public void setSatelliteTime( long satelliteTime ) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
@@ -114,7 +129,7 @@ public class CloudLocationInfo implements Parcelable {
|
||||
return alt;
|
||||
}
|
||||
|
||||
public void setAlt(double alt) {
|
||||
public void setAlt( double alt ) {
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
@@ -122,7 +137,7 @@ public class CloudLocationInfo implements Parcelable {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
public void setSpeed( double speed ) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
@@ -141,24 +156,24 @@ public class CloudLocationInfo implements Parcelable {
|
||||
|
||||
public String print() {
|
||||
return "CloudLocation{ lon: " + lon + " lat: " + lat + " heading: " + heading + " speed: "
|
||||
+ speed+"}";
|
||||
+ speed + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
public boolean equals( Object o ) {
|
||||
if ( this == o ) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
if ( o == null || getClass() != o.getClass() ) {
|
||||
return false;
|
||||
}
|
||||
CloudLocationInfo that = (CloudLocationInfo) o;
|
||||
return Double.compare(that.lat, lat) == 0 &&
|
||||
Double.compare(that.lon, lon) == 0;
|
||||
CloudLocationInfo that = ( CloudLocationInfo ) o;
|
||||
return Double.compare( that.lat, lat ) == 0 &&
|
||||
Double.compare( that.lon, lon ) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(lat, lon);
|
||||
return Objects.hash( lat, lon );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 坐标系转化
|
||||
*
|
||||
* @author linyang
|
||||
* @since 2020.10.21
|
||||
*/
|
||||
public class CoordinateSystemTransformationUtil {
|
||||
|
||||
private static final double x_PI = 52.35987755982988D;
|
||||
private static final double PI = 3.141592653589793D;
|
||||
private static final double a = 6378245.0D;
|
||||
private static final double ee = 0.006693421622965943D;
|
||||
|
||||
public static final boolean outOfChina( double lat, double lng ) {
|
||||
return lng <= 73.66D || lng >= 135.05D || lat <= 3.86D || lat >= 53.55D;
|
||||
}
|
||||
|
||||
private static final double transformLat( double lng, double lat ) {
|
||||
double ret = -100.0D + 2.0D * lng + 3.0D * lat + 0.2D * lat * lat + 0.1D * lng * lat + 0.2D * Math.sqrt( Math.abs( lng ) );
|
||||
ret += ( 20.0D * Math.sin( 6.0D * lng * 3.141592653589793D ) + 20.0D * Math.sin( 2.0D * lng * 3.141592653589793D ) ) * 2.0D / 3.0D;
|
||||
ret += ( 20.0D * Math.sin( lat * 3.141592653589793D ) + 40.0D * Math.sin( lat / 3.0D * 3.141592653589793D ) ) * 2.0D / 3.0D;
|
||||
ret += ( 160.0D * Math.sin( lat / 12.0D * 3.141592653589793D ) + ( double ) 320 * Math.sin( lat * 3.141592653589793D / 30.0D ) ) * 2.0D / 3.0D;
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static final double transformLon( double lng, double lat ) {
|
||||
double ret = 300.0D + lng + 2.0D * lat + 0.1D * lng * lng + 0.1D * lng * lat + 0.1D * Math.sqrt( Math.abs( lng ) );
|
||||
ret += ( 20.0D * Math.sin( 6.0D * lng * 3.141592653589793D ) + 20.0D * Math.sin( 2.0D * lng * 3.141592653589793D ) ) * 2.0D / 3.0D;
|
||||
ret += ( 20.0D * Math.sin( lng * 3.141592653589793D ) + 40.0D * Math.sin( lng / 3.0D * 3.141592653589793D ) ) * 2.0D / 3.0D;
|
||||
ret += ( 150.0D * Math.sin( lng / 12.0D * 3.141592653589793D ) + 300.0D * Math.sin( lng / 30.0D * 3.141592653589793D ) ) * 2.0D / 3.0D;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static final double[] transformWgsToGcj( double wgLat, double wgLon ) {
|
||||
double[] point = new double[2];
|
||||
if ( outOfChina( wgLat, wgLon ) ) {
|
||||
point[0] = wgLon;
|
||||
point[1] = wgLat;
|
||||
return point;
|
||||
} else {
|
||||
double dLat = transformLat( wgLon - 105.0D, wgLat - 35.0D );
|
||||
double dLon = transformLon( wgLon - 105.0D, wgLat - 35.0D );
|
||||
double radLat = wgLat / 180.0D * 3.141592653589793D;
|
||||
double magic = Math.sin( radLat );
|
||||
magic = ( double ) 1 - 0.006693421622965943D * magic * magic;
|
||||
double sqrtMagic = Math.sqrt( magic );
|
||||
dLat = dLat * 180.0D / ( 6335552.717000426D / ( magic * sqrtMagic ) * 3.141592653589793D );
|
||||
dLon = dLon * 180.0D / ( 6378245.0D / sqrtMagic * Math.cos( radLat ) * 3.141592653589793D );
|
||||
double mgLat = wgLat + dLat;
|
||||
double mgLon = wgLon + dLon;
|
||||
point[0] = dealRound( mgLon );
|
||||
point[1] = dealRound( mgLat );
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
||||
public static final double[] transformGcj02toWgs84( double lat, double lng ) {
|
||||
double[] var10000;
|
||||
if ( outOfChina( lat, lng ) ) {
|
||||
var10000 = new double[]{lng, lat};
|
||||
} else {
|
||||
double dlat = transformLat( lng - 105.0D, lat - 35.0D );
|
||||
double dlng = transformLon( lng - 105.0D, lat - 35.0D );
|
||||
double radlat = lat / 180.0D * 3.141592653589793D;
|
||||
double magic = Math.sin( radlat );
|
||||
magic = ( double ) 1 - 0.006693421622965943D * magic * magic;
|
||||
double sqrtmagic = Math.sqrt( magic );
|
||||
dlat = dlat * 180.0D / ( 6335552.717000426D / ( magic * sqrtmagic ) * 3.141592653589793D );
|
||||
dlng = dlng * 180.0D / ( 6378245.0D / sqrtmagic * Math.cos( radlat ) * 3.141592653589793D );
|
||||
double mglat = lat + dlat;
|
||||
double mglng = lng + dlng;
|
||||
var10000 = new double[]{dealRound( lng * ( double ) 2 - mglng ), dealRound( lat * ( double ) 2 - mglat )};
|
||||
}
|
||||
|
||||
return var10000;
|
||||
}
|
||||
|
||||
private static final double dealRound( double value ) {
|
||||
BigDecimal bg = new BigDecimal( value );
|
||||
double result = bg.setScale( 6, 4 ).doubleValue();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
@@ -15,7 +15,7 @@
|
||||
android:background="@drawable/module_services_marker_bkg"
|
||||
android:layout_height="@dimen/module_service_marker_bubble_height">
|
||||
|
||||
<ImageView
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/ivIcon"
|
||||
android:layout_width="@dimen/module_service_marker_bubble_icon_width"
|
||||
android:layout_height="@dimen/module_service_marker_bubble_icon_height"
|
||||
|
||||
@@ -7,15 +7,6 @@
|
||||
<ImageView
|
||||
android:id="@+id/module_commons_marker_car_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_common_online_car_vr_middle" />
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_commons_marker_car_speed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
android:textColor="#FF0000" />
|
||||
</FrameLayout>
|
||||
@@ -12,11 +12,7 @@ import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
@@ -29,7 +25,6 @@ import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
@@ -46,9 +41,6 @@ import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushData;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse;
|
||||
import com.mogo.module.service.onlinecar.panel.NavigationTargetInfo;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.service.refresh.AutoRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.CustomRefreshStrategy;
|
||||
@@ -71,14 +63,8 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -398,7 +384,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
intent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
mContext.sendBroadcast( intent );
|
||||
|
||||
SnapshotUploadInTime.getInstance().start( mContext );
|
||||
if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
|
||||
SnapshotUploadInTime.getInstance().start( mContext );
|
||||
}
|
||||
}
|
||||
|
||||
public void initLocationServiceProcess( Context context ) {
|
||||
|
||||
@@ -58,6 +58,9 @@ abstract class RefreshWorkThreadHandler extends Handler {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
return;
|
||||
}
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setUserInteractionStatus( TAG, true, false );
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().recoverLockMode();
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ public class MogoRTKLocation {
|
||||
cloudLocationInfo.setSpeed(location.getSpeed());
|
||||
cloudLocationInfo.setSatelliteTime(location.getTime());
|
||||
cloudLocationInfo.setSystemTime(System.currentTimeMillis());
|
||||
cloudLocationInfo.convertCoor2GCJ02();
|
||||
cacheList.add(cloudLocationInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import com.mogo.module.service.websocket.OnePerSecondSendContent;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
|
||||
import com.mogo.service.connection.WebSocketMsgType;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XObuEventEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.utils.CoordinateUtils;
|
||||
import com.mogo.module.v2x.listener.V2XLocationListener;
|
||||
import com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
@@ -22,6 +21,7 @@ import com.mogo.module.v2x.utils.DrivingDirectionUtils;
|
||||
import com.mogo.module.v2x.utils.ObuConfig;
|
||||
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.utils.CoordinateUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.mogo.module.obu.ObuConstant;
|
||||
import com.zhidao.mogo.module.obu.ObuManager;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.service.map;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.CoordinatesTransformer;
|
||||
import com.mogo.map.IMogoMapViewInstanceHandler;
|
||||
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
@@ -85,7 +86,7 @@ public interface IMogoMapService extends IProvider {
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
IMogoAimless getAimless(Context context);
|
||||
IMogoAimless getAimless( Context context );
|
||||
|
||||
/**
|
||||
* marker 操作
|
||||
@@ -136,4 +137,11 @@ public interface IMogoMapService extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoTrafficSearch getTrafficSearchApi();
|
||||
|
||||
/**
|
||||
* 坐标转换工具
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
CoordinatesTransformer getCoordinatesTransformer();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.commons.utils.MortonCode;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
import com.mogo.utils.CoordinateUtils;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
|
||||
@@ -66,8 +67,14 @@ class AdasObjectUtils {
|
||||
}
|
||||
ADASRecognizedResult result = new ADASRecognizedResult();
|
||||
result.uuid = rectBean.getUuid();
|
||||
result.lat = rectBean.getLat();
|
||||
result.lon = rectBean.getLon();
|
||||
double amapCoord[] = CoordinateUtils.transformFromWGSToGCJ( rectBean.getLat(), rectBean.getLon() );
|
||||
if ( amapCoord != null ) {
|
||||
result.lat = amapCoord[0];
|
||||
result.lon = amapCoord[1];
|
||||
} else {
|
||||
result.lat = rectBean.getLat();
|
||||
result.lon = rectBean.getLon();
|
||||
}
|
||||
result.type = Integer.valueOf( rectBean.getType() );
|
||||
result.heading = rectBean.getHeading();
|
||||
result.systemTime = Long.valueOf( rectBean.getSystemTime() );
|
||||
@@ -108,7 +115,8 @@ class AdasObjectUtils {
|
||||
recognizedListResult.distanceX = model.getDistance_x();
|
||||
recognizedListResult.distanceY = model.getDistance_y();
|
||||
}
|
||||
recognizedListResult.latLonList.add( new ADASRecognizedListResult.LatLon( model.getLat(), model.getLon() ) );
|
||||
double amapCoord[] = CoordinateUtils.transformFromWGSToGCJ( model.getLat(), model.getLon() );
|
||||
recognizedListResult.latLonList.add( new ADASRecognizedListResult.LatLon( amapCoord[0], amapCoord[1] ) );
|
||||
}
|
||||
}
|
||||
if ( result.isEmpty() ) {
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.mogo.service.impl.map;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.CoordinatesTransformer;
|
||||
import com.mogo.map.IMogoMapViewInstanceHandler;
|
||||
import com.mogo.map.MogoAimless;
|
||||
import com.mogo.map.MogoCoordinatesTransformer;
|
||||
import com.mogo.map.MogoGeoSearch;
|
||||
import com.mogo.map.MogoInputtipsSearch;
|
||||
import com.mogo.map.MogoLocationClient;
|
||||
@@ -74,7 +76,7 @@ public class MogoMapService implements IMogoMapService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoAimless getAimless(Context context) {
|
||||
public IMogoAimless getAimless( Context context ) {
|
||||
return MogoAimless.getInstance( context );
|
||||
}
|
||||
|
||||
@@ -113,6 +115,11 @@ public class MogoMapService implements IMogoMapService {
|
||||
return new MogoTrafficSearch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoordinatesTransformer getCoordinatesTransformer() {
|
||||
return MogoCoordinatesTransformer.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user