[Feat]全览模式本地数据库查数据
This commit is contained in:
@@ -9,15 +9,17 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager;
|
||||
import com.mogo.eagle.core.function.overview.ViewModelExtKt;
|
||||
import com.mogo.eagle.core.function.overview.vm.OverViewModel;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
@@ -41,8 +43,6 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
|
||||
|
||||
private MogoMapView mMogoMapView;
|
||||
private IMogoMap mMogoMap;
|
||||
private TextureMapView mNaviMapView;
|
||||
private AMap mAMap;
|
||||
|
||||
private final boolean mIsControllerByOthersStatus = false;
|
||||
|
||||
@@ -85,8 +85,6 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
|
||||
if (mMogoMap != null) {
|
||||
mMogoMap.getUIController().showMyLocation(true);
|
||||
}
|
||||
mNaviMapView = findViewById(R.id.module_gaode_id_map);
|
||||
mAMap = mNaviMapView.getMap();
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
@@ -101,6 +99,7 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
initMapView();
|
||||
queryInfStructure();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -183,6 +182,27 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
|
||||
MapPointCloudSubscriber.Companion.getInstance();
|
||||
}
|
||||
|
||||
private void queryInfStructure() {
|
||||
OverViewModel viewModel = ViewModelExtKt.obtainViewModel(this, OverViewModel.class);
|
||||
// viewModel.getInfStructures().observe(this.getViewLifecycleOwner(), infrastructures -> {
|
||||
// if (isFirst) {
|
||||
// for (Infrastructure entity : infrastructures) {
|
||||
// Double lat = Double.parseDouble(entity.getLat());
|
||||
// Double lon = Double.parseDouble(entity.getLon());
|
||||
// if (lat < 0 || lat > 90 || lon < 0 || lon > 180) {
|
||||
// continue;
|
||||
// }
|
||||
// String geoHash = GeoHash.withCharacterPrecision(lat, lon, 7).toBase32();
|
||||
// viewModel.updateGeoHash(entity.getId(), geoHash);
|
||||
// }
|
||||
// isFirst = false;
|
||||
// }
|
||||
// });
|
||||
|
||||
viewModel.getInfStructuresMap().observe(this.getViewLifecycleOwner(), InfStructureManager.INSTANCE::saveData);
|
||||
viewModel.fetchInfStructures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getUIController() {
|
||||
return mMogoMap.getUIController();
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mogo.eagle.core.function.overview
|
||||
|
||||
/**
|
||||
* 本地数据库查询出来的红绿灯、摄像头等数据
|
||||
*/
|
||||
object InfStructureManager {
|
||||
|
||||
// 每个GeoHash网格对应的新基建Bean
|
||||
private val _infMap by lazy {
|
||||
HashMap<String, ArrayList<Infrastructure>>()
|
||||
}
|
||||
|
||||
fun saveData(map: HashMap<String, java.util.ArrayList<Infrastructure>>) {
|
||||
if (_infMap.isNotEmpty()) {
|
||||
_infMap.clear()
|
||||
}
|
||||
_infMap.putAll(map)
|
||||
}
|
||||
|
||||
fun getData(): Map<String, ArrayList<Infrastructure>> = _infMap
|
||||
}
|
||||
@@ -19,7 +19,10 @@ import com.amap.api.maps.CameraUpdate;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.UiSettings;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
import com.amap.api.navi.AMapNaviListener;
|
||||
@@ -43,6 +46,7 @@ import com.amap.api.navi.model.NaviInfo;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.amap.api.navi.model.RouteOverlayOptions;
|
||||
import com.autonavi.tbt.TrafficFacilityInfo;
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
@@ -51,9 +55,13 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager;
|
||||
import com.mogo.eagle.core.function.overview.Infrastructure;
|
||||
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.common.utils.DrivingDirectionUtils;
|
||||
@@ -62,8 +70,11 @@ import com.zhidao.support.adas.high.AdasManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import ch.hsr.geohash.GeoHash;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
@@ -83,12 +94,6 @@ public class AMapCustomView
|
||||
private AMap mAMap;
|
||||
protected NaviLatLng mStartLatlng = new NaviLatLng();
|
||||
protected NaviLatLng mEndLatlng = new NaviLatLng();
|
||||
//328路线测试数据
|
||||
// protected NaviLatLng mStartLatlng = new NaviLatLng(39.969111, 116.411903);
|
||||
// protected NaviLatLng mEndLatlng = new NaviLatLng(40.037209, 116.314358);
|
||||
//顺义国展测试数据
|
||||
// mStartLatlng = new NaviLatLng(40.09383,116.51899);
|
||||
// mEndLatlng = new NaviLatLng(40.09964,116.54570);
|
||||
protected final List<NaviLatLng> sList = new ArrayList<NaviLatLng>();
|
||||
protected final List<NaviLatLng> eList = new ArrayList<NaviLatLng>();
|
||||
private int zoomLevel = 15;
|
||||
@@ -102,6 +107,10 @@ public class AMapCustomView
|
||||
private TextView overLayerView;
|
||||
private boolean calculate = false;
|
||||
|
||||
// 全局路径规划中的GeoHash网格
|
||||
private Map<String, ArrayList<Infrastructure>> pathMap = new HashMap();
|
||||
private Map<LatLng, Infrastructure> posInfMap = new HashMap();
|
||||
|
||||
public AMapCustomView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -121,27 +130,6 @@ public class AMapCustomView
|
||||
|
||||
private void initView(Context context) {
|
||||
mContext = context;
|
||||
//测试代码:路线指定路径328线路
|
||||
// mWayPointList.add(new NaviLatLng(39.968847, 116.406952));
|
||||
// mWayPointList.add(new NaviLatLng(39.969058, 116.407346));
|
||||
// mWayPointList.add(new NaviLatLng(39.968955, 116.401767));
|
||||
// mWayPointList.add(new NaviLatLng(39.968626, 116.394938));
|
||||
// mWayPointList.add(new NaviLatLng(39.968433, 116.388725));
|
||||
// mWayPointList.add(new NaviLatLng(39.968542, 116.383775));
|
||||
// mWayPointList.add(new NaviLatLng(40.037808, 116.342539));
|
||||
// mWayPointList.add(new NaviLatLng(40.037239, 116.337172));
|
||||
// mWayPointList.add(new NaviLatLng(40.035897, 116.329582));
|
||||
// mWayPointList.add(new NaviLatLng(40.036396, 116.322166));
|
||||
Log.d(TAG, "initView:" + mWayPointList.toString());
|
||||
|
||||
//顺义国展路线
|
||||
// mWayPointList.add(new NaviLatLng(40.097621,116.526495));
|
||||
// mWayPointList.add(new NaviLatLng(40.097982,116.529135));
|
||||
// mWayPointList.add(new NaviLatLng(40.098434,116.531903));
|
||||
// mWayPointList.add(new NaviLatLng(40.098828,116.534563));
|
||||
// mWayPointList.add(new NaviLatLng(40.099377,116.538651));
|
||||
// mWayPointList.add(new NaviLatLng(40.099927,116.54173));
|
||||
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
mAMapNaviView = smpView.findViewById(R.id.aMapNaviView);
|
||||
overLayerView = findViewById(R.id.overLayer);
|
||||
@@ -157,6 +145,78 @@ public class AMapCustomView
|
||||
overLayerView.setOnClickListener(v -> {
|
||||
mAMapNaviView.displayOverview();
|
||||
});
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
}
|
||||
|
||||
private void initAMapView(Context context) {
|
||||
Log.d(TAG, "initAMapView");
|
||||
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
mAMap = mAMapNaviView.getMap();
|
||||
setUpMap();
|
||||
customOptions();
|
||||
}
|
||||
|
||||
private void setUpMap() {
|
||||
// 地图文字标注
|
||||
mAMap.showMapText(true);
|
||||
// 显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.setTrafficEnabled(true);
|
||||
//设置希望展示的地图缩放级别
|
||||
mAMap.moveCamera(mCameraUpdate);
|
||||
//设置地图的样式
|
||||
UiSettings uiSettings = mAMap.getUiSettings();
|
||||
//地图缩放级别的交换按钮
|
||||
uiSettings.setZoomControlsEnabled(false);
|
||||
//所有手势
|
||||
uiSettings.setAllGesturesEnabled(true);
|
||||
//隐藏指南针
|
||||
uiSettings.setCompassEnabled(false);
|
||||
//设置倾斜手势是否可用。
|
||||
uiSettings.setTiltGesturesEnabled(true);
|
||||
//隐藏默认的定位按钮
|
||||
uiSettings.setMyLocationButtonEnabled(false);
|
||||
//设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
uiSettings.setLogoBottomMargin(-150);
|
||||
Log.d(TAG, "before onMapLoaded");
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义导航View和路况状态
|
||||
*/
|
||||
private void customOptions() {
|
||||
AMapNaviViewOptions options = mAMapNaviView.getViewOptions();
|
||||
//关闭自动绘制路线,自行绘制路线
|
||||
// options.setAutoDrawRoute(false);
|
||||
//不显示导航界面
|
||||
options.setLayoutVisible(false);
|
||||
//黑夜模式
|
||||
options.setNaviNight(true);
|
||||
//导航全程光柱
|
||||
options.setTrafficBarEnabled(false);
|
||||
//指南针
|
||||
// options.setCompassEnabled(false);
|
||||
// options.setTilt((int) tilt);
|
||||
//自车车标
|
||||
options.setCarBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_my_location_logo));
|
||||
options.setFourCornersBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.amap_custom_corner));
|
||||
options.setStartPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_dir_start));
|
||||
options.setWayPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.icon_module_small_map_four_corners));
|
||||
options.setEndPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_dir_end));
|
||||
//与走过的路线
|
||||
options.setAfterRouteAutoGray(true);
|
||||
//路线纹理自定义
|
||||
RouteOverlayOptions routeOverlayOptions = new RouteOverlayOptions();
|
||||
routeOverlayOptions.setTurnArrowIs3D(false);
|
||||
routeOverlayOptions.setUnknownTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_no));//未知路段
|
||||
routeOverlayOptions.setSmoothTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_smooth_route));
|
||||
routeOverlayOptions.setJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_bad));//拥堵路段
|
||||
routeOverlayOptions.setVeryJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_grayred));//超级拥堵路段
|
||||
routeOverlayOptions.setPassRoute(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_pass_route));//走过的路段
|
||||
options.setRouteOverlayOptions(routeOverlayOptions);
|
||||
mAMapNaviView.setViewOptions(options);
|
||||
}
|
||||
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
|
||||
@@ -190,7 +250,7 @@ public class AMapCustomView
|
||||
int state = autoPilotStatusInfo.getState();
|
||||
//0 不能自动驾驶 1 可以自动驾驶,但是在人工干预 2 自动驾驶中
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
Log.d(TAG, "自动驾驶中= %s" + String.valueOf(state));
|
||||
Log.d(TAG, "自动驾驶中 state=" + String.valueOf(state));
|
||||
if (sList.size() == 0 && eList.size() == 0 && mWayPointList.size() == 0) {
|
||||
Log.d(TAG, "sendGlobalPathReq");
|
||||
AdasManager.getInstance().sendGlobalPathReq();
|
||||
@@ -221,7 +281,7 @@ public class AMapCustomView
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotRotting(@org.jetbrains.annotations.Nullable MessagePad.GlobalPathResp globalPathResp) {
|
||||
if (calculate == true) {
|
||||
if (calculate == true && sList.size() == 0 && eList.size() == 0 && mWayPointList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
calculate = true;
|
||||
@@ -256,6 +316,8 @@ public class AMapCustomView
|
||||
Log.d(TAG, "全局路径" + list.size() + ",起点:" + sList.toString() + ",终点:" + eList.toString() + ",经点:" + mWayPointList.toString());
|
||||
//指定路径绘制导航路线
|
||||
mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy);
|
||||
|
||||
drawInfrastructureMarkers(globalPathResp);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -620,9 +682,11 @@ public class AMapCustomView
|
||||
@Override
|
||||
public void onCalculateRouteSuccess(AMapCalcRouteResult aMapCalcRouteResult) {
|
||||
Log.d(TAG, "onCalculateRouteSuccess aMapCalcRouteResult" + aMapCalcRouteResult.toString());
|
||||
mAMapNavi.startNavi(NaviType.EMULATOR);
|
||||
mAMapNaviView.displayOverview();
|
||||
|
||||
//提测修改为EMULATOR
|
||||
mAMapNavi.startNavi(NaviType.GPS);
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
mAMapNaviView.displayOverview();
|
||||
}, 2000);
|
||||
//停止导航测试代码
|
||||
// UiThreadHandler.postDelayed(() -> {
|
||||
// mAMapNavi.stopNavi();
|
||||
@@ -682,7 +746,14 @@ public class AMapCustomView
|
||||
|
||||
@Override
|
||||
public void onNaviViewLoaded() {
|
||||
|
||||
Log.d(TAG, "---onNaviViewLoaded---");
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data"))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data"));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -695,4 +766,52 @@ public class AMapCustomView
|
||||
|
||||
}
|
||||
|
||||
private void drawInfrastructureMarkers(MessagePad.GlobalPathResp globalPathResp) {
|
||||
if (globalPathResp != null) {
|
||||
if (!pathMap.isEmpty()) {
|
||||
pathMap.clear();
|
||||
}
|
||||
String geoHash;
|
||||
ArrayList<Infrastructure> infList;
|
||||
for (MessagePad.Location location : globalPathResp.getWayPointsList()) {
|
||||
geoHash = GeoHash.withCharacterPrecision(location.getLatitude(), location.getLongitude(), 7).toBase32();
|
||||
// 网格内的轨迹点只取一次
|
||||
if (!pathMap.containsKey(geoHash)) {
|
||||
// 从缓存的新基建数据中去取对应geoHash的新基建数据集合
|
||||
infList = InfStructureManager.INSTANCE.getData().get(geoHash);
|
||||
if (infList != null) {
|
||||
pathMap.put(geoHash, infList);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 绘制新基建数据
|
||||
if (!posInfMap.isEmpty()) {
|
||||
posInfMap.clear();
|
||||
}
|
||||
ArrayList<MarkerOptions> markerOptionsList = new ArrayList();
|
||||
for (ArrayList<Infrastructure> structureList : pathMap.values()) {
|
||||
for (Infrastructure structure : structureList) {
|
||||
MarkerOptions markerOption = new MarkerOptions();
|
||||
LatLng latLng = new LatLng(Double.valueOf(structure.getLat()),
|
||||
Double.valueOf(structure.getLon()));
|
||||
markerOption.position(latLng);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(), R.drawable.video_nor)
|
||||
));
|
||||
posInfMap.put(latLng, structure);
|
||||
markerOptionsList.add(markerOption);
|
||||
}
|
||||
}
|
||||
mAMap.addMarkers(markerOptionsList, false);
|
||||
mAMap.setOnMarkerClickListener(marker -> {
|
||||
Infrastructure infrastructure = posInfMap.get(marker.getPosition());
|
||||
// 如果是摄像头
|
||||
if (0 == infrastructure.getCategory() && infrastructure.getIp() != null) {
|
||||
CallerHmiManager.INSTANCE.showVideoDialog(infrastructure.getIp());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SmallMapFragment extends BaseFragment
|
||||
implements IMogoSmallMapProvider, IMoGoAutopilotPlanningListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
private final String TAG = "SmallMapFragment";
|
||||
protected SmallMapDirectionView mSmallMapDirectionView;
|
||||
protected AMapCustomView mAMapCustomView;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -62,63 +62,68 @@ public class SmallMapFragment extends BaseFragment
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mSmallMapDirectionView = mRootView.findViewById(R.id.smallMapDirectionView);
|
||||
mSmallMapDirectionView.onCreateView(savedInstanceState);
|
||||
mAMapCustomView = mRootView.findViewById(R.id.smallMapDirectionView);
|
||||
mAMapCustomView.onCreateView(savedInstanceState);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPanel() {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.setVisibility(View.VISIBLE);
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hidePanel() {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.setVisibility(View.GONE);
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawablePolyline(List<MogoLatLng> coordinates) {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.convert(coordinates);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mSmallMapDirectionView.drawablePolyline();
|
||||
}
|
||||
});
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.convert(coordinates);
|
||||
UiThreadHandler.post(() -> mAMapCustomView.drawablePolyline());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPolyline() {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mSmallMapDirectionView.clearPolyline();
|
||||
}
|
||||
});
|
||||
if (mAMapCustomView != null) {
|
||||
UiThreadHandler.post(() -> mAMapCustomView.clearPolyline());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.onResume();
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
// queryInfStructure();
|
||||
}
|
||||
|
||||
// private void queryInfStructure() {
|
||||
// mViewModel = ViewModelExtKt.obtainViewModel(this, OverViewModel.class);
|
||||
// mViewModel.getInfStructuresMap().observe(this.getViewLifecycleOwner(), map -> {
|
||||
// mAMapCustomView.updateInfStructures(map);
|
||||
// });
|
||||
// // 本地数据库查询
|
||||
// mViewModel.fetchInfStructures();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.onPause();
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.onPause();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -126,8 +131,8 @@ public class SmallMapFragment extends BaseFragment
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.onDestroy();
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.onDestroy();
|
||||
}
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<alpha
|
||||
android:duration="1000"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0"
|
||||
/>
|
||||
</set>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<alpha
|
||||
android:duration="1000"
|
||||
android:fromAlpha="0"
|
||||
android:toAlpha="1.0"
|
||||
/>
|
||||
</set>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
@@ -1,19 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<com.mogo.map.MogoMapView
|
||||
android:id="@+id/module_map_id_map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.amap.api.maps.TextureMapView
|
||||
android:id="@+id/module_gaode_id_map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
android:visibility="visible"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -6,10 +6,8 @@
|
||||
|
||||
<com.mogo.eagle.core.function.smp.SmallMapDirectionView
|
||||
android:id="@+id/smallMapDirectionView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="30px"
|
||||
android:layout_marginBottom="30px"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
|
||||
@@ -2,41 +2,45 @@
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:parentTag="RelativeLayout">
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/module_small_map_view_border_width"
|
||||
android:layout_height="@dimen/module_small_map_view_border_width"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/module_small_map_view_border" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<com.mogo.eagle.core.widget.RoundLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/rlSmallMapBorder"
|
||||
android:layout_width="@dimen/module_small_map_view_width"
|
||||
android:layout_height="@dimen/module_small_map_view_width"
|
||||
android:layout_centerInParent="true"
|
||||
app:roundLayoutRadius="360dp">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<!--TODO Hook方案在Pad上有问题,优先 效果,后面在看如何解决-->
|
||||
<!-- <com.amap.api.navi.AMapNaviView-->
|
||||
<!-- android:id="@+id/aMapNaviView"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent" />-->
|
||||
<com.amap.api.navi.AMapNaviView
|
||||
android:id="@+id/aMapNaviView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.amap.api.maps.TextureMapView
|
||||
android:id="@+id/aMapNaviView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</com.mogo.eagle.core.widget.RoundLayout>
|
||||
<TextView
|
||||
android:id="@+id/overLayer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/blue"
|
||||
android:text="全览模式"
|
||||
android:textColor="@drawable/white"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivMapBorder"
|
||||
android:layout_width="@dimen/module_small_map_border_view_width"
|
||||
android:layout_height="@dimen/module_small_map_border_view_width"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/module_small_map_view_border_north" />
|
||||
android:src="@drawable/module_small_map_view_border_north"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</merge>
|
||||
Reference in New Issue
Block a user