opt
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Trace;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMap;
|
||||
@@ -44,6 +48,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.OnInfoWindowClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||
@@ -92,6 +97,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private boolean mMapLoaded = false;
|
||||
private boolean mIsFirstLocated = true;
|
||||
private boolean mIsDelayed = false;
|
||||
private Marker mSelfMarker;
|
||||
|
||||
public AMapViewWrapper( MapAutoView mMapView ) {
|
||||
startTime = System.currentTimeMillis();
|
||||
@@ -252,6 +258,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mMapView.setOnMapClickListener( null );
|
||||
mMapView.getLocationClient().unRegisterListener( this );
|
||||
mMapView.setMOnCameraChangeListener( null );
|
||||
mSelfMarker = null;
|
||||
Logger.d( TAG, "map onDestroy" );
|
||||
}
|
||||
}
|
||||
@@ -742,6 +749,47 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
MapStyleController.getInstance().onLocationChanged( location, this );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mSelfMarker == null ) {
|
||||
try {
|
||||
mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker();
|
||||
mSelfMarker.setInfoWindowEnable( true );
|
||||
mSelfMarker.setInfoWindowOffset( 0, -200 );
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
showSelfSpeed( location.getSpeed() );
|
||||
}
|
||||
|
||||
private float mLastSpeed = 0;
|
||||
private TextView mSpeedView = null;
|
||||
|
||||
private void showSelfSpeed( float speed ) {
|
||||
|
||||
if ( !checkAMapView() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mSelfMarker == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mCurrentUI != EnumMapUI.Type_VR ) {
|
||||
mSelfMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
if ( Math.abs( mLastSpeed - speed ) > 0 ) {
|
||||
if ( mSpeedView == null ) {
|
||||
mSpeedView = new TextView( mMapView.getContext() );
|
||||
mSpeedView.setTextColor( Color.WHITE );
|
||||
mSpeedView.setTypeface( Typeface.defaultFromStyle( Typeface.BOLD ) );
|
||||
mSpeedView.setShadowLayer( 10f, 5F, 5F, Color.BLACK );
|
||||
mSpeedView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ) );
|
||||
}
|
||||
mSpeedView.setText( String.valueOf( ( ( int ) ( speed * 3.6 ) ) ) );
|
||||
mSelfMarker.setInfoWindowView( mSpeedView );
|
||||
} else {
|
||||
mSelfMarker.hideInfoWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -931,6 +979,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
double heading = data.optDouble( "heading", -1 );
|
||||
double acceleration = data.optDouble( "acceleration", -1 );
|
||||
double yawRate = data.optDouble( "yawRate", -1 );
|
||||
double speed = data.optDouble( "speed", -1 );
|
||||
if ( lon == -1 ) {
|
||||
return;
|
||||
}
|
||||
@@ -941,6 +990,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
bean.setAcceleration( acceleration );
|
||||
bean.setAlt( alt );
|
||||
bean.setLon( lon );
|
||||
bean.setGnss_speed( ( ( float ) speed ) );
|
||||
bean.setLat( lat );
|
||||
mMapView.getLocationClient().updateRTKAutoPilotLocation( bean );
|
||||
Logger.d( TAG, "使用rtk定位数据" );
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class AMapInfoWindowAdapter implements InfoWindowAdapter, OnInfoWin
|
||||
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getMObject() );
|
||||
IMogoInfoWindowAdapter delegate = mogoMarker.getInfoWindowAdapter();
|
||||
if ( delegate != null ) {
|
||||
final View infoView = delegate.getInfoWindow( mogoMarker );
|
||||
final View infoView = delegate.getInfoWindow( mogoMarker );
|
||||
marker.setOnInfoWindowClickListener( this );
|
||||
return infoView;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public final class AMapInfoWindowAdapter implements InfoWindowAdapter, OnInfoWin
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View getInfoContents(@Nullable Marker marker) {
|
||||
public View getInfoContents( @Nullable Marker marker ) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
@Override
|
||||
public void use3DResource( int model3D ) {
|
||||
try {
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor("#00FF00").marker3DIcon( model3D ) );
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor( "#00FF00" ).marker3DIcon( model3D ) );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "use3DResource" );
|
||||
}
|
||||
@@ -514,4 +514,13 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
public void setAnchorColor( String anchorColor ) {
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor( anchorColor ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInfoWindowView( View view ) {
|
||||
try {
|
||||
mMarker.setInfoWindowView( view );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user