This commit is contained in:
wangcongtao
2020-01-10 16:34:18 +08:00
parent 3597505a34
commit fdecf6a2de
8 changed files with 72 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ package com.mogo.map.impl.amap;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Point;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
@@ -495,7 +496,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
return null;
}
@Override public MogoLatLng getTarget() {
@Override
public MogoLatLng getTarget() {
try {
return ObjectUtils.fromAMap( mMapView.getMap().getCameraPosition().target );
} catch ( Exception e ) {
@@ -512,4 +514,16 @@ public class AMapNaviViewWrapper implements IMogoMapView,
mMapView.setViewOptions( options );
}
}
@Override
public Point getLocationPointInScreen( MogoLatLng latLng ) {
if ( checkAMapView() ) {
try {
return mMapView.getMap().getProjection().toScreenLocation( ObjectUtils.fromMogo2( latLng ) );
} catch ( Exception e ) {
return null;
}
}
return null;
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.map.impl.amap.marker;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.view.View;
import com.amap.api.maps.model.BitmapDescriptor;
@@ -281,4 +282,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
public String getOwner() {
return this.mOwner == null ? mMogoMarkerOptions.getOwner() : mOwner;
}
@Override
public void setPositionByPixels( Point position ) {
if ( mMarker != null ) {
mMarker.setPositionByPixels( position.x, position.y );
}
}
}

View File

@@ -1,5 +1,7 @@
package com.mogo.map.impl.amap.uicontroller;
import android.graphics.Point;
import com.mogo.map.MogoLatLng;
import com.mogo.map.MogoMap;
import com.mogo.map.uicontroller.EnumMapUI;
@@ -143,4 +145,12 @@ public class AMapUIController implements IMogoMapUIController {
mClient.setPointToCenter( mapCenterX, mapCenterY );
}
}
@Override
public Point getLocationPointInScreen( MogoLatLng latLng ) {
if ( mClient != null ) {
return mClient.getLocationPointInScreen( latLng );
}
return null;
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.map.marker;
import android.graphics.Bitmap;
import android.graphics.Point;
import com.mogo.map.MogoLatLng;
@@ -214,4 +215,11 @@ public interface IMogoMarker {
* @return
*/
String getOwner();
/**
* 设置marker在window的位置
*
* @param position window 的位置。
*/
void setPositionByPixels( Point position );
}

View File

@@ -1,5 +1,7 @@
package com.mogo.map.uicontroller;
import android.graphics.Point;
import com.mogo.map.MogoLatLng;
/**
@@ -102,4 +104,12 @@ public interface IMogoMapUIController {
* @param mapCenterY y 点位置x值与地图高度的比例
*/
void setPointToCenter( double mapCenterX, double mapCenterY );
/**
* 获取经纬度对应的屏幕的位置
*
* @param latLng
* @return
*/
Point getLocationPointInScreen( MogoLatLng latLng );
}

View File

@@ -1,5 +1,7 @@
package com.mogo.map;
import android.graphics.Point;
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
@@ -136,4 +138,12 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.setPointToCenter(mapCenterX, mapCenterY);
}
}
@Override
public Point getLocationPointInScreen( MogoLatLng latLng ) {
if (mDelegate != null) {
return mDelegate.getLocationPointInScreen(latLng);
}
return null;
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.module.extensions.entrance;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
@@ -15,6 +16,8 @@ import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.navi.IMogoNaviListener;
@@ -63,6 +66,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
private IMogoLocationClient mMogoLocationClient;
private IMogoNavi mMogoNavi;
private IMogoFragmentManager mMogoFragmentManager;
private IMogoMarkerManager mMogoMarkerManager;
private IMogoRegisterCenter mMogoRegisterCenter;
@@ -80,7 +84,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
@Override
protected void initViews() {
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation();
mCommonAddress = findViewById( R.id.module_entrance_id_common_address );
mSearch = findViewById( R.id.module_entrance_id_search );
@@ -97,6 +100,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mCompany = findViewById( R.id.module_entrance_id_company );
mCompany.setOnClickListener( view -> {
mMogoMarkerManager.addMarker( "tag", new MogoMarkerOptions().owner( "tag" )
.latitude( 39.000 ).longitude( 136.000 ).icon( BitmapFactory.decodeResource( getResources(), R.drawable.module_ext_ic_voice ) ).anchor( 0.5f, 0.5f ) );
} );
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
@@ -146,6 +151,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mMogoRegisterCenter.registerMogoNaviListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
mMogoRegisterCenter.registerMogoMapListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
mMogoMarkerManager = mService.getMarkerManager( getContext() );
}

View File

@@ -18,9 +18,9 @@
<action android:name="android.intent.action.MAIN" />
<!--调试用暂时开启LAUNCHER这个属性-->
<category android:name="android.intent.category.LAUNCHER" />
<!-- <category android:name="android.intent.category.LAUNCHER_APP" />-->
<!-- <category android:name="android.intent.category.HOME" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<category android:name="android.intent.category.LAUNCHER_APP" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>