Complete small map draw line and remove line

This commit is contained in:
董宏宇
2021-06-28 15:45:40 +08:00
parent bbcfc07a4d
commit 4a5110b5de
20 changed files with 368 additions and 107 deletions

View File

@@ -35,6 +35,7 @@ import com.mogo.service.module.IMogoSearchManager;
import com.mogo.service.share.IMogoShareManager;
import com.mogo.service.share.IMogoTanluProvider;
import com.mogo.service.share.IMogoTrafficUploadProvider;
import com.mogo.service.smp.IMogoSmallMapProvider;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
import com.mogo.service.strategy.IMogoRefreshStrategyController;
@@ -98,6 +99,7 @@ public class V2XServiceManager {
private static V2XStatusManager mV2XStatusManager;
private static V2XSocketManager mV2XSocketManager;
private static V2XCalculateServer mV2XCalculateServer;
private static IMogoSmallMapProvider mSmallMapProvider;
// 下面的是重构后的代码,建议
@@ -139,6 +141,8 @@ public class V2XServiceManager {
mIMogoTanluProvider = mMogoServiceApis.getTanluApi();
mIMogoTrafficUploadProvider = mMogoServiceApis.getTrafficUploadApi();
mMogoOnlineCarListPanelProvider = mMogoServiceApis.getOnlineCarPanelApi();
mSmallMapProvider = mMogoServiceApis.getSmallMapProviderApi();
//事件面板
mIEventPanelProvider = mMogoServiceApis.getEventPanelManager();
@@ -190,6 +194,10 @@ public class V2XServiceManager {
return mMapService;
}
public static IMogoSmallMapProvider getMogoSmallMapProvider() {
return mSmallMapProvider;
}
public static IMogoOverlayManager getMogoOverlayManager() {
return mMogoOverlayManager;
}

View File

@@ -7,12 +7,10 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.map.MogoLatLng;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes;
@@ -167,6 +165,11 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver {
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
V2XServiceManager.getMoGoStatusManager().setSeekHelping(MODULE_NAME, true);
} else if (sceneType == 20) {// 小地图绘制线
List<MogoLatLng> coordinates = TestOnLineCarUtils.getTestCoordinates();
V2XServiceManager.getMogoSmallMapProvider().drawablePolyline(coordinates);
} else if (sceneType == 21) {// 小地图清除绘制线
V2XServiceManager.getMogoSmallMapProvider().clearPolyline();
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.module.v2x.utils;
import com.mogo.map.MogoLatLng;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.V2XMessageEntity;
@@ -7,7 +8,6 @@ import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
import com.mogo.utils.network.utils.GsonUtil;
@@ -465,6 +465,7 @@ public class TestOnLineCarUtils {
}
return null;
}
/**
* 自车求助测试数据
*/
@@ -486,4 +487,30 @@ public class TestOnLineCarUtils {
}
/**
* 返回绘制线路测试数据
*
* @return
*/
public static List<MogoLatLng> getTestCoordinates() {
try {
InputStream inputStream = V2XUtils.getApp()
.getResources()
.openRawResource(R.raw.test_coordinates2);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
return GsonUtil.arrayFromJson(baos.toString(), MogoLatLng.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}