地图依赖重构
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
@@ -27,12 +26,13 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.MapParams;
|
||||
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapTouchListener;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
|
||||
@@ -52,8 +52,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, LocationListener, OnMapLoadedListener, MapStatusListener, OnCameraChangeListener,
|
||||
OnMapClickListener, OnMapTouchListener, OnMarkClickListener {
|
||||
public class AMapViewWrapper implements IMogoMapView,
|
||||
IMogoMapUIController,
|
||||
LocationListener,
|
||||
OnMapLoadedListener,
|
||||
MapStatusListener,
|
||||
OnCameraChangeListener,
|
||||
OnMapClickListener,
|
||||
OnMapTouchListener,
|
||||
OnMarkClickListener,
|
||||
OnMapStyleListener {
|
||||
|
||||
private static final String TAG = "AMapViewWrapper";
|
||||
private final MapAutoView mMapView;
|
||||
@@ -73,6 +81,8 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
|
||||
private Location mLastDriveLocationShadow = null;
|
||||
|
||||
public AMapViewWrapper( MapAutoView mMapView ) {
|
||||
startTime = System.currentTimeMillis();
|
||||
Logger.i( TAG, "autoop--AMapViewWrapper: init" );
|
||||
@@ -163,7 +173,6 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
|
||||
// mMapView.setOnPolylineClickListener( this );
|
||||
// mMapView.setAMapNaviViewListener( this );
|
||||
// mMapView.setOnCameraChangeListener( this );
|
||||
//
|
||||
// final AMap aMap = mMapView.getMap();
|
||||
// if ( aMap != null ) {
|
||||
@@ -195,8 +204,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
mMapView.onCreate( bundle );
|
||||
Logger.d( TAG, "map onCreate" );
|
||||
initMapView();
|
||||
|
||||
// initMyLocation();
|
||||
initMyLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +248,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
@Override
|
||||
public void setTrafficEnabled( boolean visible ) {
|
||||
if ( checkAMapView() ) {
|
||||
// mMapView.getMapAutoViewHelper().setTraffic(visible);
|
||||
mMapView.getMapAutoViewHelper().setTraffic( visible );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,28 +300,29 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
return;
|
||||
}
|
||||
if ( checkAMapView() ) {
|
||||
// switch (ui) {
|
||||
// case CarUp_2D:
|
||||
// case CarUp_3D:
|
||||
// case NorthUP_2D:
|
||||
// break;
|
||||
// case Type_VR:
|
||||
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
|
||||
// //setUIMode( ui, options );
|
||||
// return;
|
||||
// case Type_Light:
|
||||
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false);
|
||||
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY);
|
||||
// break;
|
||||
// case Type_Night:
|
||||
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false);
|
||||
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT);
|
||||
// break;
|
||||
// case Type_AUTO_LIGHT_Night:
|
||||
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(true);
|
||||
// break;
|
||||
}
|
||||
switch ( ui ) {
|
||||
case CarUp_2D:
|
||||
case CarUp_3D:
|
||||
case NorthUP_2D:
|
||||
break;
|
||||
case Type_VR:
|
||||
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_VR );
|
||||
setUIMode( ui );
|
||||
return;
|
||||
case Type_Light:
|
||||
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
|
||||
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_DAY );
|
||||
break;
|
||||
case Type_Night:
|
||||
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
|
||||
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_NIGHT );
|
||||
break;
|
||||
case Type_AUTO_LIGHT_Night:
|
||||
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( true );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -442,7 +451,6 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
return getMap().getScalePerPixel();
|
||||
@@ -458,7 +466,6 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
return ObjectUtils.fromAMap( MapTools.INSTANCE.getVisibleRegion().getRightTopPoint() );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraSouthWestPosition() {
|
||||
try {
|
||||
@@ -482,11 +489,8 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
@Override
|
||||
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
|
||||
if ( checkAMapView() ) {
|
||||
// if (DebugConfig.isDebug()) {
|
||||
// Logger.d(TAG, Log.getStackTraceString(new Throwable()));
|
||||
// }
|
||||
// Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY );
|
||||
// mMapView.getMapAutoViewHelper().setPointToCenter( ( float ) mapCenterX, ( float ) mapCenterY );
|
||||
Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY );
|
||||
mMapView.getMapAutoViewHelper().setPointToCenter( ( float ) mapCenterX, ( float ) mapCenterY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,7 +662,21 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
sysLocation.setAltitude( location.getAltitude() );
|
||||
sysLocation.setLatitude( location.getLat() );
|
||||
sysLocation.setLongitude( location.getLon() );
|
||||
sysLocation.setProvider( location.getProvider() );
|
||||
sysLocation.setAccuracy( location.getAcceleration() );
|
||||
sysLocation.setTime( location.getDuration() );
|
||||
sysLocation.setBearing( location.getHeading() );
|
||||
sysLocation.setSpeed( location.getSpeed() );
|
||||
|
||||
if ( sysLocation.getSpeed() > 0 ) {
|
||||
mLastDriveLocationShadow = sysLocation;
|
||||
} else {
|
||||
if ( ( int ) sysLocation.getBearing() == 0
|
||||
&& mLastDriveLocationShadow != null ) {
|
||||
// TODO: 2020/12/12 停车时自车图标方向调整
|
||||
}
|
||||
}
|
||||
|
||||
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
|
||||
}
|
||||
|
||||
@@ -741,4 +759,11 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
public void emphasizeMyLocation() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeMapStyle( int i ) {
|
||||
if ( i == MapParams.MAP_STYLE_VR ) {
|
||||
MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_VR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.IMogoMapApiBuilder;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MapApiPath;
|
||||
import com.mogo.map.impl.custom.location.ALocationClient;
|
||||
import com.mogo.map.impl.custom.navi.NaviClient;
|
||||
import com.mogo.map.impl.custom.search.GeocodeSearchClient;
|
||||
import com.mogo.map.impl.custom.search.InputtipsSearch;
|
||||
import com.mogo.map.impl.custom.search.PoiSearchClient;
|
||||
import com.mogo.map.impl.custom.search.RoadSearchClient;
|
||||
import com.mogo.map.impl.custom.uicontroller.AMapUIController;
|
||||
import com.mogo.map.impl.custom.utils.IconTypeUtils;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.search.drive.IMogoRoadSearch;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.MapParams;
|
||||
import com.zhidaoauto.map.sdk.open.NavAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.NavParams;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/9
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MapApiPath.PATH )
|
||||
class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
|
||||
private static final String TAG = "CustomMapApiBuilder";
|
||||
|
||||
@Override
|
||||
public IMogoGeoSearch getGeoSearch( Context context ) {
|
||||
return new GeocodeSearchClient( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoInputtipsSearch getInputtipsSearch( Context context, MogoInputtipsQuery query ) {
|
||||
return new InputtipsSearch( context, query );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationClient getLocationClient( Context context ) {
|
||||
return new ALocationClient( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getMapUIController() {
|
||||
return AMapUIController.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNavi getNavi( Context context ) {
|
||||
return NaviClient.getInstance( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPoiSearch getPoiSearchClient( Context context, MogoPoiSearchQuery query ) {
|
||||
return new PoiSearchClient( context, query );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoRoadSearch getRoadSearch() {
|
||||
return new RoadSearchClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoAimless getAimless( Context context ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMapView( Context context ) {
|
||||
// do not implements.
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapView getMapView( Context context ) {
|
||||
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
|
||||
// .setCachePath( "sdcard/tiles_vr" )
|
||||
.setStyleDir( "sdcard/shmdata_asset/mogo_style" )
|
||||
.setHdmapPath( "sdcard/shmdata/hdmapData" )
|
||||
.setDebugMode( true )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter( 0.5f, 0.8f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_NIGHT ) , NavParams.Companion.init() );
|
||||
MapAutoView mapAutoView = new MapAutoView( context );
|
||||
IMogoMapView mapView = new AMapViewWrapper( mapAutoView );
|
||||
return mapView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTrafficSearch getTrafficSearch() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResIdByIconType( Context context, int iconType ) {
|
||||
return IconTypeUtils.getResIdByIconType( context, iconType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init" );
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,13 @@ public class CustomMapView implements IMogoMapViewCreator {
|
||||
@Override
|
||||
public IMogoMapView create( Context context ) {
|
||||
if ( mapView == null ) {
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( false )
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init()
|
||||
.setCachePath( "sdcard/tiles_vr" )
|
||||
.setDebugMode( false )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter( 0.5f, 0.8f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_VR ) );
|
||||
.setPointToCenter( 0.5f, 0.8f ) );
|
||||
}
|
||||
MapAutoView mapAutoView = new MapAutoView( context );
|
||||
mapView = new AMapViewWrapper( mapAutoView );
|
||||
|
||||
@@ -12,64 +12,125 @@ import android.util.SparseArray;
|
||||
*/
|
||||
public class IconTypeUtils {
|
||||
|
||||
public class IconType {
|
||||
public static final int NONE = 0;
|
||||
public static final int DEFAULT = 1;
|
||||
public static final int LEFT = 2;
|
||||
public static final int RIGHT = 3;
|
||||
public static final int LEFT_FRONT = 4;
|
||||
public static final int RIGHT_FRONT = 5;
|
||||
public static final int LEFT_BACK = 6;
|
||||
public static final int RIGHT_BACK = 7;
|
||||
public static final int LEFT_TURN_AROUND = 8;
|
||||
public static final int STRAIGHT = 9;
|
||||
public static final int ARRIVED_WAYPOINT = 10;
|
||||
public static final int ENTER_ROUNDABOUT = 11;
|
||||
public static final int OUT_ROUNDABOUT = 12;
|
||||
public static final int ARRIVED_SERVICE_AREA = 13;
|
||||
public static final int ARRIVED_TOLLGATE = 14;
|
||||
public static final int ARRIVED_DESTINATION = 15;
|
||||
public static final int ARRIVED_TUNNEL = 16;
|
||||
public static final int ENTRY_LEFT_RING = 17;
|
||||
public static final int LEAVE_LEFT_RING = 18;
|
||||
public static final int U_TURN_RIGHT = 19;
|
||||
public static final int SPECIAL_CONTINUE = 20;
|
||||
public static final int ENTRY_RING_LEFT = 21;
|
||||
public static final int ENTRY_RING_RIGHT = 22;
|
||||
public static final int ENTRY_RING_CONTINUE = 23;
|
||||
public static final int ENTRY_RING_UTURN = 24;
|
||||
public static final int ENTRY_LEFT_RING_LEFT = 25;
|
||||
public static final int ENTRY_LEFT_RING_RIGHT = 26;
|
||||
public static final int ENTRY_LEFT_RING_CONTINUE = 27;
|
||||
public static final int ENTRY_LEFTRINGU_TURN = 28;
|
||||
public static final int CROSSWALK = 29;
|
||||
public static final int OVERPASS = 30;
|
||||
public static final int UNDERPASS = 31;
|
||||
public static final int SQUARE = 32;
|
||||
public static final int PARK = 33;
|
||||
public static final int STAIRCASE = 34;
|
||||
public static final int LIFT = 35;
|
||||
public static final int CABLEWAY = 36;
|
||||
public static final int SKY_CHANNEL = 37;
|
||||
public static final int CHANNEL = 38;
|
||||
public static final int WALK_ROAD = 39;
|
||||
public static final int CRUISE_ROUTE = 40;
|
||||
public static final int SIGHTSEEING_BUSLINE = 41;
|
||||
public static final int SLIDEWAY = 42;
|
||||
public static final int LADDER = 43;
|
||||
public static final int SLOPE = 44;
|
||||
public static final int BRIDGE = 45;
|
||||
public static final int FERRY = 46;
|
||||
public static final int SUBWAY = 47;
|
||||
public static final int ENTER_BUILDING = 48;
|
||||
public static final int LEAVE_BUILDING = 49;
|
||||
public static final int BY_ELEVATOR = 50;
|
||||
public static final int BY_STAIR = 51;
|
||||
public static final int BY_ESCALATOR = 52;
|
||||
public static final int LOW_TRAFFIC_CROSS = 53;
|
||||
public static final int LOW_CROSS = 54;
|
||||
|
||||
public IconType() {
|
||||
}
|
||||
}
|
||||
|
||||
private static SparseArray< String > sIconName = new SparseArray<>();
|
||||
|
||||
static {
|
||||
// sIconName.put( IconType.ARRIVED_DESTINATION, "到达目的地" );
|
||||
// sIconName.put( IconType.ARRIVED_SERVICE_AREA, "到达服务区" );
|
||||
// sIconName.put( IconType.ARRIVED_TOLLGATE, "到达收费站" );
|
||||
// sIconName.put( IconType.ARRIVED_TUNNEL, "到达隧道" );
|
||||
// sIconName.put( IconType.ARRIVED_WAYPOINT, "到达途经点" );
|
||||
// sIconName.put( IconType.BRIDGE, "通过桥" );
|
||||
// sIconName.put( IconType.BY_ELEVATOR, "电梯换层" );
|
||||
// sIconName.put( IconType.BY_ESCALATOR, "扶梯换层" );
|
||||
// sIconName.put( IconType.BY_STAIR, "楼梯换层" );
|
||||
// sIconName.put( IconType.CABLEWAY, "通过索道" );
|
||||
// sIconName.put( IconType.CHANNEL, "通过通道" );
|
||||
// sIconName.put( IconType.CROSSWALK, "通过人行横道" );
|
||||
// sIconName.put( IconType.CRUISE_ROUTE, "通过游船路线" );
|
||||
// sIconName.put( IconType.DEFAULT, "自车" );
|
||||
// sIconName.put( IconType.ENTER_BUILDING, "进入建筑物" );
|
||||
// sIconName.put( IconType.ENTER_ROUNDABOUT, "进入环岛" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING, "进入环岛" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING_CONTINUE, "绕环岛直行" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING_LEFT, "绕环岛左转" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING_RIGHT, "绕环岛右转" );
|
||||
// sIconName.put( IconType.ENTRY_LEFTRINGU_TURN, "绕环岛调头" );
|
||||
// sIconName.put( IconType.ENTRY_RING_CONTINUE, "绕环岛直行" );
|
||||
// sIconName.put( IconType.ENTRY_RING_LEFT, "绕环岛左转" );
|
||||
// sIconName.put( IconType.ENTRY_RING_RIGHT, "绕环岛右转" );
|
||||
// sIconName.put( IconType.ENTRY_RING_UTURN, "绕环岛调头" );
|
||||
// sIconName.put( IconType.FERRY, "通过轮渡" );
|
||||
// sIconName.put( IconType.LADDER, "通过阶梯" );
|
||||
// sIconName.put( IconType.LEAVE_BUILDING, "离开建筑物" );
|
||||
// sIconName.put( IconType.LEAVE_LEFT_RING, "驶出环岛" );
|
||||
// sIconName.put( IconType.LEFT, "左转" );
|
||||
// sIconName.put( IconType.LEFT_BACK, "左后" );
|
||||
// sIconName.put( IconType.LEFT_FRONT, "左前方" );
|
||||
// sIconName.put( IconType.LEFT_TURN_AROUND, "左转掉头" );
|
||||
// sIconName.put( IconType.LIFT, "通过直梯" );
|
||||
// sIconName.put( IconType.LOW_CROSS, "通过普通路口" );
|
||||
// sIconName.put( IconType.LOW_TRAFFIC_CROSS, "红绿灯路口" );
|
||||
// sIconName.put( IconType.NONE, "无定义" );
|
||||
// sIconName.put( IconType.OUT_ROUNDABOUT, "驶出环岛" );
|
||||
// sIconName.put( IconType.OVERPASS, "通过过街天桥" );
|
||||
// sIconName.put( IconType.PARK, "通过公园" );
|
||||
// sIconName.put( IconType.RIGHT, "右转" );
|
||||
// sIconName.put( IconType.RIGHT_BACK, "右后方" );
|
||||
// sIconName.put( IconType.RIGHT_FRONT, "右前方" );
|
||||
// sIconName.put( IconType.SIGHTSEEING_BUSLINE, "通过观光车路线" );
|
||||
// sIconName.put( IconType.SKY_CHANNEL, "通过空中通道" );
|
||||
// sIconName.put( IconType.SLIDEWAY, "通过滑道" );
|
||||
// sIconName.put( IconType.SLOPE, "通过斜坡" );
|
||||
// sIconName.put( IconType.SPECIAL_CONTINUE, "顺行" );
|
||||
// sIconName.put( IconType.SQUARE, "通过广场" );
|
||||
// sIconName.put( IconType.STAIRCASE, "通过扶梯" );
|
||||
// sIconName.put( IconType.STRAIGHT, "直行" );
|
||||
// sIconName.put( IconType.SUBWAY, "通过地铁通道" );
|
||||
// sIconName.put( IconType.U_TURN_RIGHT, "右转掉头" );
|
||||
// sIconName.put( IconType.UNDERPASS, "通过地下通道" );
|
||||
// sIconName.put( IconType.WALK_ROAD, "通过行人道路" );
|
||||
sIconName.put( IconType.ARRIVED_DESTINATION, "到达目的地" );
|
||||
sIconName.put( IconType.ARRIVED_SERVICE_AREA, "到达服务区" );
|
||||
sIconName.put( IconType.ARRIVED_TOLLGATE, "到达收费站" );
|
||||
sIconName.put( IconType.ARRIVED_TUNNEL, "到达隧道" );
|
||||
sIconName.put( IconType.ARRIVED_WAYPOINT, "到达途经点" );
|
||||
sIconName.put( IconType.BRIDGE, "通过桥" );
|
||||
sIconName.put( IconType.BY_ELEVATOR, "电梯换层" );
|
||||
sIconName.put( IconType.BY_ESCALATOR, "扶梯换层" );
|
||||
sIconName.put( IconType.BY_STAIR, "楼梯换层" );
|
||||
sIconName.put( IconType.CABLEWAY, "通过索道" );
|
||||
sIconName.put( IconType.CHANNEL, "通过通道" );
|
||||
sIconName.put( IconType.CROSSWALK, "通过人行横道" );
|
||||
sIconName.put( IconType.CRUISE_ROUTE, "通过游船路线" );
|
||||
sIconName.put( IconType.DEFAULT, "自车" );
|
||||
sIconName.put( IconType.ENTER_BUILDING, "进入建筑物" );
|
||||
sIconName.put( IconType.ENTER_ROUNDABOUT, "进入环岛" );
|
||||
sIconName.put( IconType.ENTRY_LEFT_RING, "进入环岛" );
|
||||
sIconName.put( IconType.ENTRY_LEFT_RING_CONTINUE, "绕环岛直行" );
|
||||
sIconName.put( IconType.ENTRY_LEFT_RING_LEFT, "绕环岛左转" );
|
||||
sIconName.put( IconType.ENTRY_LEFT_RING_RIGHT, "绕环岛右转" );
|
||||
sIconName.put( IconType.ENTRY_LEFTRINGU_TURN, "绕环岛调头" );
|
||||
sIconName.put( IconType.ENTRY_RING_CONTINUE, "绕环岛直行" );
|
||||
sIconName.put( IconType.ENTRY_RING_LEFT, "绕环岛左转" );
|
||||
sIconName.put( IconType.ENTRY_RING_RIGHT, "绕环岛右转" );
|
||||
sIconName.put( IconType.ENTRY_RING_UTURN, "绕环岛调头" );
|
||||
sIconName.put( IconType.FERRY, "通过轮渡" );
|
||||
sIconName.put( IconType.LADDER, "通过阶梯" );
|
||||
sIconName.put( IconType.LEAVE_BUILDING, "离开建筑物" );
|
||||
sIconName.put( IconType.LEAVE_LEFT_RING, "驶出环岛" );
|
||||
sIconName.put( IconType.LEFT, "左转" );
|
||||
sIconName.put( IconType.LEFT_BACK, "左后" );
|
||||
sIconName.put( IconType.LEFT_FRONT, "左前方" );
|
||||
sIconName.put( IconType.LEFT_TURN_AROUND, "左转掉头" );
|
||||
sIconName.put( IconType.LIFT, "通过直梯" );
|
||||
sIconName.put( IconType.LOW_CROSS, "通过普通路口" );
|
||||
sIconName.put( IconType.LOW_TRAFFIC_CROSS, "红绿灯路口" );
|
||||
sIconName.put( IconType.NONE, "无定义" );
|
||||
sIconName.put( IconType.OUT_ROUNDABOUT, "驶出环岛" );
|
||||
sIconName.put( IconType.OVERPASS, "通过过街天桥" );
|
||||
sIconName.put( IconType.PARK, "通过公园" );
|
||||
sIconName.put( IconType.RIGHT, "右转" );
|
||||
sIconName.put( IconType.RIGHT_BACK, "右后方" );
|
||||
sIconName.put( IconType.RIGHT_FRONT, "右前方" );
|
||||
sIconName.put( IconType.SIGHTSEEING_BUSLINE, "通过观光车路线" );
|
||||
sIconName.put( IconType.SKY_CHANNEL, "通过空中通道" );
|
||||
sIconName.put( IconType.SLIDEWAY, "通过滑道" );
|
||||
sIconName.put( IconType.SLOPE, "通过斜坡" );
|
||||
sIconName.put( IconType.SPECIAL_CONTINUE, "顺行" );
|
||||
sIconName.put( IconType.SQUARE, "通过广场" );
|
||||
sIconName.put( IconType.STAIRCASE, "通过扶梯" );
|
||||
sIconName.put( IconType.STRAIGHT, "直行" );
|
||||
sIconName.put( IconType.SUBWAY, "通过地铁通道" );
|
||||
sIconName.put( IconType.U_TURN_RIGHT, "右转掉头" );
|
||||
sIconName.put( IconType.UNDERPASS, "通过地下通道" );
|
||||
sIconName.put( IconType.WALK_ROAD, "通过行人道路" );
|
||||
}
|
||||
|
||||
private static int lastIconType = 0;
|
||||
|
||||
@@ -59,12 +59,12 @@ import java.util.List;
|
||||
*/
|
||||
public class ObjectUtils {
|
||||
|
||||
public static MarkerOptions fromMogo(MogoMarkerOptions opt ) {
|
||||
public static MarkerOptions fromMogo( MogoMarkerOptions opt ) {
|
||||
|
||||
if ( opt == null ) {
|
||||
return null;
|
||||
}
|
||||
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
|
||||
final ArrayList< Bitmap > icons = opt.getIcons();
|
||||
if ( icons != null && !icons.isEmpty() ) {
|
||||
for ( Bitmap icon : icons ) {
|
||||
@@ -72,14 +72,14 @@ public class ObjectUtils {
|
||||
continue;
|
||||
}
|
||||
|
||||
descriptors.add( new BitmapDescriptor(icon) );
|
||||
descriptors.add( new BitmapDescriptor( icon ) );
|
||||
}
|
||||
}
|
||||
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo( opt );
|
||||
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.position( new LonLatPoint(opt.getLongitude(), opt.getLatitude() ) )
|
||||
.markerIcon(descriptor )
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.position( new LonLatPoint( opt.getLongitude(), opt.getLatitude() ) )
|
||||
.markerIcon( descriptor )
|
||||
.anchor( opt.getU(), opt.getV() )
|
||||
// .icons( descriptors )
|
||||
// .period( opt.getPeriod() )
|
||||
@@ -92,11 +92,11 @@ public class ObjectUtils {
|
||||
// .draggable( opt.isDraggable() )
|
||||
.setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
|
||||
.zIndex( opt.getzIndex() );
|
||||
if(!TextUtils.isEmpty(opt.getTitle())){
|
||||
markerOptions.title(opt.getTitle());
|
||||
if ( !TextUtils.isEmpty( opt.getTitle() ) ) {
|
||||
markerOptions.title( opt.getTitle() );
|
||||
}
|
||||
if(!TextUtils.isEmpty(opt.getSnippet())){
|
||||
markerOptions.snippet(opt.getSnippet());
|
||||
if ( !TextUtils.isEmpty( opt.getSnippet() ) ) {
|
||||
markerOptions.snippet( opt.getSnippet() );
|
||||
}
|
||||
return markerOptions;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public class ObjectUtils {
|
||||
if ( latLng == null ) {
|
||||
return null;
|
||||
}
|
||||
return new LonLatPoint( latLng.lon,latLng.lat);
|
||||
return new LonLatPoint( latLng.lon, latLng.lat );
|
||||
}
|
||||
|
||||
// public static NaviLatLng fromMogoAsNavi( MogoLatLng latLng ) {
|
||||
@@ -194,7 +194,7 @@ public class ObjectUtils {
|
||||
return q;
|
||||
}
|
||||
|
||||
public static RegeocodeQuery fromMogo(MogoRegeocodeQuery query ) {
|
||||
public static RegeocodeQuery fromMogo( MogoRegeocodeQuery query ) {
|
||||
if ( query == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public class ObjectUtils {
|
||||
}
|
||||
MogoGeocodeResult mogoGeocodeResult = new MogoGeocodeResult();
|
||||
final List< MogoGeocodeAddress > addresses = new ArrayList<>();
|
||||
List< GeocodeAddress > list = result.getGeocodeAddressList();
|
||||
List< GeocodeAddress > list = result.getGeocodeAddressList();
|
||||
for ( GeocodeAddress geocodeAddress : list ) {
|
||||
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap( geocodeAddress );
|
||||
if ( mogoGeocodeAddress != null ) {
|
||||
@@ -348,7 +348,7 @@ public class ObjectUtils {
|
||||
// return mogoSubPoiItem;
|
||||
// }
|
||||
|
||||
public static MogoPoiItem fromAMap( PoiItem poiItem) {
|
||||
public static MogoPoiItem fromAMap( PoiItem poiItem ) {
|
||||
if ( poiItem == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -450,7 +450,7 @@ public class ObjectUtils {
|
||||
mogoRegeocodeAddress.setNeighborhood( regeocodeAddress.getNeighborhood() );
|
||||
if ( regeocodeAddress.getPoiList() != null ) {
|
||||
List< MogoPoiItem > mogoPoiItems = new ArrayList<>();
|
||||
List<PoiItem> list = regeocodeAddress.getPoiList();
|
||||
List< PoiItem > list = regeocodeAddress.getPoiList();
|
||||
for ( PoiItem pois : list ) {
|
||||
MogoPoiItem mogoPoiItem = fromAMap( pois );
|
||||
mogoPoiItems.add( mogoPoiItem );
|
||||
@@ -483,7 +483,7 @@ public class ObjectUtils {
|
||||
return mogoRegeocodeResult;
|
||||
}
|
||||
|
||||
public static InputtipsQuery fromMogo(MogoInputtipsQuery query ) {
|
||||
public static InputtipsQuery fromMogo( MogoInputtipsQuery query ) {
|
||||
if ( query == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -534,14 +534,14 @@ public class ObjectUtils {
|
||||
return mogoPoiSearchQuery;
|
||||
}
|
||||
|
||||
public static Query fromMogo(MogoPoiSearchQuery query ) {
|
||||
if ( query == null || query.getQuery() == null) {
|
||||
public static Query fromMogo( MogoPoiSearchQuery query ) {
|
||||
if ( query == null || query.getQuery() == null ) {
|
||||
return null;
|
||||
}
|
||||
Query psq = new Query(query.getQuery(), "", "");
|
||||
String category = getCategory(query.getQuery());
|
||||
if(!category.equals(""))
|
||||
psq = new Query( "", "", getCategory(query.getQuery()));
|
||||
Query psq = new Query( query.getQuery(), "", "" );
|
||||
String category = getCategory( query.getQuery() );
|
||||
if ( !category.equals( "" ) )
|
||||
psq = new Query( "", "", getCategory( query.getQuery() ) );
|
||||
// psq.setBuilding( query.getBuilding() );
|
||||
psq.setCityLimit( query.isCityLimit() );
|
||||
psq.setDistanceSort( query.isDistanceSort() );
|
||||
@@ -608,7 +608,7 @@ public class ObjectUtils {
|
||||
}
|
||||
MogoPoiResult mogoPoiResult = new MogoPoiResult();
|
||||
if ( result.getItems() != null ) {
|
||||
final List<PoiSearchItem> poiItems = result.getItems();
|
||||
final List< PoiSearchItem > poiItems = result.getItems();
|
||||
final ArrayList< MogoPoiItem > mogoPoiItems = new ArrayList<>( poiItems.size() );
|
||||
for ( PoiSearchItem poiItem : poiItems ) {
|
||||
mogoPoiItems.add( fromAMap( poiItem.getPoi() ) );
|
||||
@@ -692,7 +692,7 @@ public class ObjectUtils {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public static PolylineOptions fromMogo(MogoPolylineOptions options ) {
|
||||
public static PolylineOptions fromMogo( MogoPolylineOptions options ) {
|
||||
if ( options == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -705,11 +705,11 @@ public class ObjectUtils {
|
||||
target.setLonLatPoints( points );
|
||||
}
|
||||
target.setLineWidth( options.getWidth() );
|
||||
target.setColor( options.getColor() );
|
||||
target.setColor( options.getColor());
|
||||
// target.zIndex( options.getWidth() );
|
||||
// target.visible( options.isVisible() );
|
||||
//// target.geodesic( options.isGeodesic() );
|
||||
target.setDottedLine( options.isDottedLine() );
|
||||
// target.setDottedLine( options.isDottedLine() );
|
||||
target.useGradient( options.isGradient() );
|
||||
if ( options.getColorValues() != null ) {
|
||||
target.colorValues( options.getColorValues() );
|
||||
@@ -736,17 +736,17 @@ public class ObjectUtils {
|
||||
return new MapCameraPosition( fromAMap( position.getTarget() ), position.getBearing(), position.getTilt(), position.getZoom() );
|
||||
}
|
||||
|
||||
private static String getCategory(String key){
|
||||
private static String getCategory( String key ) {
|
||||
String category = "";
|
||||
if(key.equals("加油站")){
|
||||
category= "6";
|
||||
}else if(key.equals("停车场")){
|
||||
category= "12";
|
||||
}else if(key.equals("餐馆")){
|
||||
category= "22";
|
||||
}else if(key.equals("洗车")){
|
||||
category= "8";
|
||||
}else if(key.equals("厕所")){
|
||||
if ( key.equals( "加油站" ) ) {
|
||||
category = "6";
|
||||
} else if ( key.equals( "停车场" ) ) {
|
||||
category = "12";
|
||||
} else if ( key.equals( "餐馆" ) ) {
|
||||
category = "22";
|
||||
} else if ( key.equals( "洗车" ) ) {
|
||||
category = "8";
|
||||
} else if ( key.equals( "厕所" ) ) {
|
||||
|
||||
}
|
||||
return category;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_map_amap_my_location_bg_size">360px</dimen>
|
||||
<dimen name="module_map_amap_my_location_icon_width">63px</dimen>
|
||||
<dimen name="module_map_amap_my_location_icon_height">96px</dimen>
|
||||
</resources>
|
||||
@@ -1,4 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="path_width">60px</dimen>
|
||||
<dimen name="module_map_amap_my_location_icon_width">36px</dimen>
|
||||
<dimen name="module_map_amap_my_location_icon_height">53px</dimen>
|
||||
<dimen name="module_map_amap_my_location_bg_size">194px</dimen>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user