|
|
|
|
@@ -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" );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|