Complete small map add toward
This commit is contained in:
@@ -6,7 +6,6 @@ import android.location.Location;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -30,7 +29,6 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.view.RoundLayout;
|
||||
import com.mogo.module.small.map.animation.DirectionRotateAnimation;
|
||||
import com.mogo.module.small.map.utils.MapAssetStyleUtils;
|
||||
import com.mogo.module.small.map.view.ISmallMapDirectionView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -48,9 +46,7 @@ public class SmallMapDirectionView
|
||||
extends RelativeLayout
|
||||
implements IMogoCarLocationChangedListener2, ISmallMapDirectionView {
|
||||
|
||||
/**
|
||||
* 小地图名称
|
||||
*/
|
||||
//小地图名称
|
||||
public static final String MODULE_NAME = "SmallMap";
|
||||
|
||||
private RoundLayout rlSmallMapBorder;
|
||||
@@ -60,13 +56,11 @@ public class SmallMapDirectionView
|
||||
private Marker mStartMarker;
|
||||
private Marker mEndMarker;
|
||||
|
||||
private int lastAngle = 0;
|
||||
private int zoomLevel = 13;
|
||||
private List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private List<MogoLatLng> mCoordinatesLatLngCurrent = new ArrayList<>();
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private DirectionRotateAnimation mRotateAnimation;
|
||||
|
||||
public SmallMapDirectionView(Context context) {
|
||||
this(context, null);
|
||||
@@ -86,8 +80,6 @@ public class SmallMapDirectionView
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
mRotateAnimation = new DirectionRotateAnimation(context, null);
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
|
||||
mAMapNaviView = AbsMogoApplication.getMapNaviView();
|
||||
@@ -134,18 +126,6 @@ public class SmallMapDirectionView
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.setTrafficEnabled(false);
|
||||
|
||||
|
||||
// MyLocationStyle myLocationStyle;
|
||||
// myLocationStyle = new MyLocationStyle();//初始化定位蓝点样式类myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);//连续定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动。(1秒1次定位)如果不设置myLocationType,默认也会执行此种模式。
|
||||
// myLocationStyle.interval(1000); //设置连续定位模式下的定位间隔,只在连续定位模式下生效,单次定位模式下不会生效。单位为毫秒。
|
||||
// myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_MAP_ROTATE);//连续定位、蓝点不会移动到地图中心点,地图依照设备方向旋转,并且蓝点会跟随设备移动。
|
||||
// myLocationStyle.myLocationIcon(BitmapDescriptorFactory
|
||||
// .fromResource(R.drawable.module_small_map_view_my_location_logo));
|
||||
// mAMap.setMyLocationStyle(myLocationStyle);//设置定位蓝点的Style
|
||||
// mAMap.getUiSettings().setMyLocationButtonEnabled(false);//设置默认定位按钮是否显示,非必需设置。
|
||||
// mAMap.setMyLocationEnabled(true);// 设置为true表示启动显示定位蓝点,false表示隐藏定位蓝点并不进行定位,默认是false。
|
||||
// mAMap.setMyLocationType(AMap.LOCATION_TYPE_MAP_FOLLOW);
|
||||
|
||||
// 设置 锚点 图标
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo))
|
||||
@@ -193,12 +173,6 @@ public class SmallMapDirectionView
|
||||
LatLng currentLatLng = new LatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
|
||||
if (mCarMarker != null) {
|
||||
//mAMap.moveCamera(CameraUpdateFactory.changeBearing(latLng.getBearing()));
|
||||
|
||||
// changeAngle((int) latLng.getBearing());
|
||||
// mStartMarker.setRotateAngle(360 - latLng.getBearing());
|
||||
// mEndMarker.setRotateAngle(360 - latLng.getBearing());
|
||||
|
||||
mCarMarker.setRotateAngle(360 - latLng.getBearing());
|
||||
mCarMarker.setPosition(currentLatLng);
|
||||
mCarMarker.setToTop();
|
||||
@@ -277,28 +251,4 @@ public class SmallMapDirectionView
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改角度
|
||||
*
|
||||
* @param angle 角度 0 - 359 度旋转,相对于自身中心位置
|
||||
*/
|
||||
public void changeAngle(int angle) {
|
||||
// int tempAngle = 360 - angle;
|
||||
// if (tempAngle > 180) {
|
||||
// tempAngle = -(360 - tempAngle);
|
||||
// }
|
||||
|
||||
mRotateAnimation.setFromDegrees(lastAngle);
|
||||
mRotateAnimation.setToDegrees(angle);
|
||||
|
||||
//设置线性插值,可以解决旋转一圈后卡顿问题
|
||||
mRotateAnimation.setInterpolator(new LinearInterpolator());
|
||||
//设置旋转一圈时间
|
||||
mRotateAnimation.setDuration(300);
|
||||
//控件动画结束时是否保持动画最后的状态
|
||||
mRotateAnimation.setFillAfter(true);
|
||||
startAnimation(mRotateAnimation);
|
||||
// 刷新最后一次角度
|
||||
lastAngle = angle;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@@ -8,10 +8,9 @@
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/module_small_map_view_border_width"
|
||||
android:layout_height="@dimen/module_small_map_view_border_height"
|
||||
android:layout_height="@dimen/module_small_map_view_border_width"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="@dimen/module_small_map_padding"
|
||||
android:background="@drawable/module_small_map_view_border" />
|
||||
android:background="@drawable/module_small_map_view_border_north" />
|
||||
|
||||
<com.mogo.module.common.view.RoundLayout
|
||||
android:id="@+id/rlSmallMapBorder"
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_small_map_padding">40px</dimen>
|
||||
<dimen name="module_small_map_view_border_width">550px</dimen>
|
||||
<dimen name="module_small_map_view_width">360px</dimen>
|
||||
|
||||
<dimen name="module_small_map_view_border_width">400px</dimen>
|
||||
<dimen name="module_small_map_view_border_height">400px</dimen>
|
||||
|
||||
<dimen name="module_small_map_view_width">370px</dimen>
|
||||
<dimen name="module_small_map_view_height">370px</dimen>
|
||||
|
||||
<dimen name="module_small_map_view_x">1620px</dimen>
|
||||
<dimen name="module_small_map_view_y">780px</dimen>
|
||||
|
||||
<dimen name="module_small_map_big_view_x">0px</dimen>
|
||||
<dimen name="module_small_map_big_view_y">0px</dimen>
|
||||
<dimen name="module_small_map_big_view_width">1920px</dimen>
|
||||
<dimen name="module_small_map_big_view_height">1080px</dimen>
|
||||
</resources>
|
||||
@@ -1,18 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_small_map_padding">30px</dimen>
|
||||
|
||||
<dimen name="module_small_map_view_border_width">288px</dimen>
|
||||
<dimen name="module_small_map_view_border_height">288px</dimen>
|
||||
|
||||
<dimen name="module_small_map_view_border_width">450px</dimen>
|
||||
<dimen name="module_small_map_view_width">260px</dimen>
|
||||
<dimen name="module_small_map_view_height">260px</dimen>
|
||||
|
||||
<dimen name="module_small_map_view_x">1620px</dimen>
|
||||
<dimen name="module_small_map_view_y">780px</dimen>
|
||||
|
||||
<dimen name="module_small_map_big_view_x">0px</dimen>
|
||||
<dimen name="module_small_map_big_view_y">0px</dimen>
|
||||
<dimen name="module_small_map_big_view_width">1920px</dimen>
|
||||
<dimen name="module_small_map_big_view_height">1080px</dimen>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user