Merge branch 'dev2_aiSdk' into qa_yingyan_custom
# Conflicts: # libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java # libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java # libraries/map-custom/build.gradle
This commit is contained in:
@@ -6,6 +6,7 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -45,6 +46,11 @@ public abstract class MogoMapListenerAdapter implements IMogoMapListener {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) {
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
recognizedListResult.lat = matchLonLat[1];
|
||||
|
||||
mLastPositions.put( uniqueKey, recognizedListResult );
|
||||
Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
// Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
|
||||
newAdasRecognizedMarkersCaches.put( uniqueKey, marker );
|
||||
if ( lastPosition != null ) {
|
||||
|
||||
@@ -9,7 +9,10 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.drawer.marker.EmptyMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.IMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.MapMarker3DResAdapter;
|
||||
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.common.drawer.marker.OnlineCarMarkerView;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
@@ -41,9 +44,9 @@ class MarkerDrawer {
|
||||
}
|
||||
|
||||
public static MarkerDrawer getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MarkerDrawer.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MarkerDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MarkerDrawer();
|
||||
}
|
||||
}
|
||||
@@ -60,46 +63,61 @@ class MarkerDrawer {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener ) {
|
||||
return drawMapMarkerImpl( markerShowEntity, false, zIndex, 0, listener );
|
||||
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener) {
|
||||
return drawMapMarkerImpl(markerShowEntity, false, zIndex, 0, listener);
|
||||
}
|
||||
|
||||
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, IMogoMarkerClickListener listener ) {
|
||||
return drawMapMarkerImpl( markerShowEntity, matchRoadSide, zIndex, 0, listener );
|
||||
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, IMogoMarkerClickListener listener) {
|
||||
return drawMapMarkerImpl(markerShowEntity, matchRoadSide, zIndex, 0, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* add marker, {@link OnlineCarDrawer 如果是需要在3D模式下显示,则需要设置 {@link MogoMarkerOptions icon3DRes 资源id}}
|
||||
*
|
||||
* @param markerShowEntity marker展示数据结构体
|
||||
* @param matchRoadSide 设置是否道路吸附,暂时没用到这个字段
|
||||
* @param zIndex zOrder
|
||||
* @param icon3DRes 3D Res资源
|
||||
* @param listener marker回调
|
||||
* @param matchRoadSide 设置是否道路吸附,暂时没用到这个字段
|
||||
* @param zIndex zOrder
|
||||
* @param icon3DRes 3D Res资源
|
||||
* @param listener marker回调
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, int icon3DRes, IMogoMarkerClickListener listener ) {
|
||||
if ( markerShowEntity == null || markerShowEntity.getMarkerLocation() == null ) {
|
||||
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, int icon3DRes, IMogoMarkerClickListener listener) {
|
||||
if (markerShowEntity == null || markerShowEntity.getMarkerLocation() == null) {
|
||||
return null;
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes( icon3DRes ).set3DMode(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()).matchOnRoadSide( matchRoadSide ).owner( markerShowEntity.getMarkerType() ).zIndex( zIndex ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( AbsMogoApplication.getApp(), markerShowEntity, options );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
try {
|
||||
options.icon( markerView.getBitmap( ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getCarInfo().getVehicleType() ) );
|
||||
} catch ( Exception e ) {
|
||||
options.icon( markerView.getBitmap( 0 ) );
|
||||
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes(icon3DRes).set3DMode(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()).matchOnRoadSide(matchRoadSide).owner(markerShowEntity.getMarkerType()).zIndex(zIndex).object(markerShowEntity).latitude(markerShowEntity.getMarkerLocation().getLat()).longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
|
||||
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
|
||||
options.icon3DRes(MapMarker3DResAdapter.getMarker3DRes(poiType));
|
||||
}
|
||||
options.anchor( 0.5f, 0.5f );
|
||||
|
||||
}
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(AbsMogoApplication.getApp(), markerShowEntity, options);
|
||||
if (markerView instanceof OnlineCarMarkerView) {
|
||||
try {
|
||||
options.icon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
|
||||
} catch (Exception e) {
|
||||
options.icon(markerView.getBitmap(0));
|
||||
}
|
||||
options.anchor(0.5f, 0.5f);
|
||||
} else {
|
||||
options.icon( markerView.getView() );
|
||||
options.icon(markerView.getView());
|
||||
}
|
||||
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).addMarker( markerShowEntity.getMarkerType(), options );
|
||||
if ( marker != null ) {
|
||||
marker.setOwner( markerShowEntity.getMarkerType() );
|
||||
markerView.setMarker( marker );
|
||||
marker.setOnMarkerClickListener( listener );
|
||||
markerShowEntity.setMarker( marker );
|
||||
if (options.getIcon3DRes() != 0) {
|
||||
options.icon(new EmptyMarkerView(AbsMogoApplication.getApp()));
|
||||
options.icon(markerView.getBitmap(0));
|
||||
}
|
||||
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
if (marker != null) {
|
||||
marker.setOwner(markerShowEntity.getMarkerType());
|
||||
markerView.setMarker(marker);
|
||||
marker.setOnMarkerClickListener(listener);
|
||||
markerShowEntity.setMarker(marker);
|
||||
}
|
||||
return marker;
|
||||
}
|
||||
@@ -111,42 +129,42 @@ class MarkerDrawer {
|
||||
* @param newList
|
||||
* @return
|
||||
*/
|
||||
public Map< String, IMogoMarker > purgeMarkerData( List newList, String markerType ) {
|
||||
public Map<String, IMogoMarker> purgeMarkerData(List newList, String markerType) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Map< String, IMogoMarker > existMap = new HashMap<>();
|
||||
List< IMogoMarker > allCarsList = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).getMarkers( markerType );
|
||||
if ( allCarsList == null || allCarsList.isEmpty() ) {
|
||||
Map<String, IMogoMarker> existMap = new HashMap<>();
|
||||
List<IMogoMarker> allCarsList = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).getMarkers(markerType);
|
||||
if (allCarsList == null || allCarsList.isEmpty()) {
|
||||
return existMap;
|
||||
}
|
||||
if ( newList == null || newList.isEmpty() ) {
|
||||
if (newList == null || newList.isEmpty()) {
|
||||
return existMap;
|
||||
}
|
||||
|
||||
Map< String, IMogoMarker > allMap = new HashMap<>();
|
||||
for ( IMogoMarker marker : allCarsList ) {
|
||||
String sn = getPrimaryKeyFromMarker( marker );
|
||||
allMap.put( sn, marker );
|
||||
Map<String, IMogoMarker> allMap = new HashMap<>();
|
||||
for (IMogoMarker marker : allCarsList) {
|
||||
String sn = getPrimaryKeyFromMarker(marker);
|
||||
allMap.put(sn, marker);
|
||||
}
|
||||
for ( Object entity : newList ) {
|
||||
String sn = getPrimaryKeyFromEntity( entity );
|
||||
if ( allMap.containsKey( sn ) ) {
|
||||
if ( !isNewVehicleType( entity, allMap.get( sn ) ) ) {
|
||||
existMap.put( sn, allMap.get( sn ) );
|
||||
for (Object entity : newList) {
|
||||
String sn = getPrimaryKeyFromEntity(entity);
|
||||
if (allMap.containsKey(sn)) {
|
||||
if (!isNewVehicleType(entity, allMap.get(sn))) {
|
||||
existMap.put(sn, allMap.get(sn));
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( String sn : allMap.keySet() ) {
|
||||
if ( !existMap.containsKey( sn ) ) {
|
||||
IMogoMarker dirtyMarker = allMap.get( sn );
|
||||
allCarsList.remove( dirtyMarker );
|
||||
if ( dirtyMarker != null ) {
|
||||
for (String sn : allMap.keySet()) {
|
||||
if (!existMap.containsKey(sn)) {
|
||||
IMogoMarker dirtyMarker = allMap.get(sn);
|
||||
allCarsList.remove(dirtyMarker);
|
||||
if (dirtyMarker != null) {
|
||||
dirtyMarker.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
allMap.clear();
|
||||
Logger.i( "timer", "purge data cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
Logger.i("timer", "purge data cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
return existMap;
|
||||
}
|
||||
|
||||
@@ -156,74 +174,74 @@ class MarkerDrawer {
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public int getAppropriateSize( int maxAmount, List list ) {
|
||||
if ( list == null ) {
|
||||
public int getAppropriateSize(int maxAmount, List list) {
|
||||
if (list == null) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min( maxAmount, list.size() );
|
||||
return Math.min(maxAmount, list.size());
|
||||
}
|
||||
|
||||
|
||||
private boolean isNewVehicleType( Object object, IMogoMarker marker ) {
|
||||
if ( object instanceof MarkerOnlineCar
|
||||
private boolean isNewVehicleType(Object object, IMogoMarker marker) {
|
||||
if (object instanceof MarkerOnlineCar
|
||||
&& marker != null
|
||||
&& marker.getObject() instanceof MarkerShowEntity
|
||||
&& ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerOnlineCar ) {
|
||||
&& ((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerOnlineCar) {
|
||||
try {
|
||||
return ( ( MarkerOnlineCar ) object ).getCarInfo().getVehicleType()
|
||||
!= ( ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() ).getCarInfo().getVehicleType();
|
||||
} catch ( Exception e ) {
|
||||
return ((MarkerOnlineCar) object).getCarInfo().getVehicleType()
|
||||
!= ((MarkerOnlineCar) ((MarkerShowEntity) marker.getObject()).getBindObj()).getCarInfo().getVehicleType();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getPrimaryKeyFromEntity( Object entity ) {
|
||||
if ( entity instanceof MarkerExploreWay ) {
|
||||
String id = ( ( MarkerExploreWay ) entity ).getInfoId();
|
||||
if ( !TextUtils.isEmpty( id ) ) {
|
||||
public String getPrimaryKeyFromEntity(Object entity) {
|
||||
if (entity instanceof MarkerExploreWay) {
|
||||
String id = ((MarkerExploreWay) entity).getInfoId();
|
||||
if (!TextUtils.isEmpty(id)) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
return getCarSnFromEntity( entity );
|
||||
return getCarSnFromEntity(entity);
|
||||
}
|
||||
|
||||
private String getPrimaryKeyFromMarker( IMogoMarker marker ) {
|
||||
if ( marker == null || marker.getObject() == null || marker.isDestroyed() ) {
|
||||
private String getPrimaryKeyFromMarker(IMogoMarker marker) {
|
||||
if (marker == null || marker.getObject() == null || marker.isDestroyed()) {
|
||||
return null;
|
||||
}
|
||||
if ( !( marker.getObject() instanceof MarkerShowEntity ) ) {
|
||||
if (!(marker.getObject() instanceof MarkerShowEntity)) {
|
||||
return null;
|
||||
}
|
||||
return getPrimaryKeyFromEntity( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() );
|
||||
return getPrimaryKeyFromEntity(((MarkerShowEntity) marker.getObject()).getBindObj());
|
||||
}
|
||||
|
||||
private String getCarSnFromEntity( Object entity ) {
|
||||
private String getCarSnFromEntity(Object entity) {
|
||||
try {
|
||||
if ( entity instanceof MarkerOnlineCar ) {
|
||||
return ( ( MarkerOnlineCar ) entity ).getUserInfo().getSn();
|
||||
} else if ( entity instanceof MarkerShareMusic ) {
|
||||
return ( ( MarkerShareMusic ) entity ).getUserInfo().getSn();
|
||||
} else if ( entity instanceof MarkerNoveltyInfo ) {
|
||||
return ( ( MarkerNoveltyInfo ) entity ).getSn();
|
||||
} else if ( entity instanceof MarkerExploreWay ) {
|
||||
return ( ( MarkerExploreWay ) entity ).getUserInfo().getSn();
|
||||
if (entity instanceof MarkerOnlineCar) {
|
||||
return ((MarkerOnlineCar) entity).getUserInfo().getSn();
|
||||
} else if (entity instanceof MarkerShareMusic) {
|
||||
return ((MarkerShareMusic) entity).getUserInfo().getSn();
|
||||
} else if (entity instanceof MarkerNoveltyInfo) {
|
||||
return ((MarkerNoveltyInfo) entity).getSn();
|
||||
} else if (entity instanceof MarkerExploreWay) {
|
||||
return ((MarkerExploreWay) entity).getUserInfo().getSn();
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getCarSnFromMarker( IMogoMarker marker ) {
|
||||
if ( marker == null || marker.getObject() == null || marker.isDestroyed() ) {
|
||||
public String getCarSnFromMarker(IMogoMarker marker) {
|
||||
if (marker == null || marker.getObject() == null || marker.isDestroyed()) {
|
||||
return null;
|
||||
}
|
||||
if ( !( marker.getObject() instanceof MarkerShowEntity ) ) {
|
||||
if (!(marker.getObject() instanceof MarkerShowEntity)) {
|
||||
return null;
|
||||
}
|
||||
return getCarSnFromEntity( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() );
|
||||
return getCarSnFromEntity(((MarkerShowEntity) marker.getObject()).getBindObj());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,9 +251,9 @@ class MarkerDrawer {
|
||||
* @param point2 点二坐标
|
||||
* @return 两坐标的距离 单位:米(M)
|
||||
*/
|
||||
public static float calculateLineDistance( MogoLatLng point1, MogoLatLng point2 ) {
|
||||
if ( point1 != null && point2 != null ) {
|
||||
return calculateLineDistance( point1.lon, point1.lat, point2.lon, point2.lat );
|
||||
public static float calculateLineDistance(MogoLatLng point1, MogoLatLng point2) {
|
||||
if (point1 != null && point2 != null) {
|
||||
return calculateLineDistance(point1.lon, point1.lat, point2.lon, point2.lat);
|
||||
} else {
|
||||
return 0.0F;
|
||||
}
|
||||
@@ -248,7 +266,7 @@ class MarkerDrawer {
|
||||
* @param lat2
|
||||
* @return 两坐标的距离 单位:米(M)
|
||||
*/
|
||||
public static float calculateLineDistance( double lon1, double lat1, double lon2, double lat2 ) {
|
||||
return CoordinateUtils.calculateLineDistance( lon1, lat1, lon2, lat2 );
|
||||
public static float calculateLineDistance(double lon1, double lat1, double lon2, double lat2) {
|
||||
return CoordinateUtils.calculateLineDistance(lon1, lat1, lon2, lat2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ class RoadConditionDrawer {
|
||||
try {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, true, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
|
||||
mogoMarker.setInfoWindowAdapter( new RoadConditionInfoWindow3DAdapter( markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions() ) );
|
||||
mogoMarker.showInfoWindow();
|
||||
// mogoMarker.setInfoWindowAdapter( new RoadConditionInfoWindow3DAdapter( markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions() ) );
|
||||
// mogoMarker.showInfoWindow();
|
||||
} else {
|
||||
if ( DebugConfig.isRoadEventAnimated() ) {
|
||||
post2AddAndStartAnimation( markerShowEntity, i * 100L, listener );
|
||||
|
||||
@@ -91,19 +91,21 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(data.getCollisionLat(), data.getCollisionLon());
|
||||
//2D资源图片位置调整
|
||||
MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 5, 180);
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180);
|
||||
// MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 5, 180);
|
||||
// MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180);
|
||||
|
||||
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(data.getType()));
|
||||
Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection());
|
||||
//识别物
|
||||
marker.addDynamicAnchorPosition(new MogoLatLng(
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
|
||||
//识别物下方的红色圆圈
|
||||
bottomMarker.addDynamicAnchorPosition(new MogoLatLng(
|
||||
data.getDirection() == 1 ? stopLineNew.lat : newLocation.getLat(),
|
||||
data.getDirection() == 1 ? stopLineNew.lon : newLocation.getLon()), (float) data.getHeading(), 5000);
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
|
||||
// bottomMarker.addDynamicAnchorPosition(new MogoLatLng(
|
||||
// data.getDirection() == 1 ? stopLineNew.lat : newLocation.getLat(),
|
||||
// data.getDirection() == 1 ? stopLineNew.lon : newLocation.getLon()), (float) data.getHeading(), 5000);
|
||||
//移动完成以后,3s后消失
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
marker.remove();
|
||||
@@ -134,10 +136,10 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon())
|
||||
.setGps(false);
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(modeResType)); //TODO
|
||||
|
||||
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
@@ -151,6 +153,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
.latitude(location.getLat())
|
||||
.longitude(location.getLon())
|
||||
.set3DMode(true)
|
||||
.setGps(false)
|
||||
.controlAngle(true)
|
||||
.icon3DRes(getModelRes(type))
|
||||
.anchorColor("#FB3C3CFF")
|
||||
@@ -169,6 +172,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
.latitude(newLocation.getLat())
|
||||
.longitude(newLocation.getLon())
|
||||
.anchor(1.0f, 1.0f)
|
||||
.setGps(false)
|
||||
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
|
||||
optionsRipple
|
||||
.icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
|
||||
@@ -209,10 +213,10 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon())
|
||||
.setGps(false);
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(9));
|
||||
|
||||
options.anchorColor("#FB3C3CFF");
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
|
||||
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_ACCIDENT;
|
||||
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_BLOCK_UP;
|
||||
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_FOG;
|
||||
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_ICE;
|
||||
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_LIVING;
|
||||
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_PONDING;
|
||||
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_ROAD_WORK;
|
||||
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.TRAFFIC_CHECK;
|
||||
|
||||
/**
|
||||
* created by wujifei on 2021/4/28 18:04
|
||||
* describe:地图Marker的3d资源适配器
|
||||
*/
|
||||
public class MapMarker3DResAdapter {
|
||||
|
||||
public static int getMarker3DRes(String poiType) {
|
||||
int res = 0;
|
||||
switch (poiType) {
|
||||
case FOURS_BLOCK_UP:
|
||||
res = R.raw.v2x_yongdu;
|
||||
break;
|
||||
case FOURS_ACCIDENT:
|
||||
res = R.raw.v2x_shigu;
|
||||
break;
|
||||
case FOURS_LIVING:
|
||||
res = R.raw.v2x_shishilukuang;
|
||||
break;
|
||||
case FOURS_FOG:
|
||||
res = R.raw.v2x_nongwu;
|
||||
break;
|
||||
case TRAFFIC_CHECK:
|
||||
res = R.raw.v2x_jiaotongjiancha;
|
||||
break;
|
||||
case FOURS_ROAD_WORK:
|
||||
res = R.raw.v2x_daolushigong;
|
||||
break;
|
||||
case FOURS_ICE:
|
||||
res = R.raw.v2x_daolujiebing;
|
||||
break;
|
||||
case FOURS_PONDING:
|
||||
res = R.raw.v2x_daolujishui;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -10,14 +10,13 @@ import org.json.JSONObject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/12/14
|
||||
*
|
||||
* 实时坐标数据处理中心
|
||||
*/
|
||||
class SnapshotLocationController {
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/12/14
|
||||
*
|
||||
* 实时坐标数据处理中心
|
||||
*/
|
||||
public class SnapshotLocationController {
|
||||
|
||||
private static final String TAG = "SnapshotLocationController";
|
||||
|
||||
@@ -141,7 +140,7 @@ class SnapshotLocationController {
|
||||
mLastLocationInfo = null;
|
||||
}
|
||||
}
|
||||
Logger.d(TAG, "upload loc size = %s", list == null ? 0 : list.size());
|
||||
//Logger.d( TAG, "upload loc size = %s", list == null ? 0 : list.size() );
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -151,7 +150,7 @@ class SnapshotLocationController {
|
||||
* @return 精度
|
||||
*/
|
||||
public int getDataAccuracy() {
|
||||
Logger.d(TAG, "upload loc accuracy = %s", mDataAccuracy);
|
||||
//Logger.d( TAG, "upload loc accuracy = %s", mDataAccuracy );
|
||||
return mDataAccuracy;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
modules/mogo-module-common/src/main/res/raw/v2x_daolujiebing.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/v2x_daolujiebing.n3d
Normal file
Binary file not shown.
BIN
modules/mogo-module-common/src/main/res/raw/v2x_daolujishui.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/v2x_daolujishui.n3d
Normal file
Binary file not shown.
BIN
modules/mogo-module-common/src/main/res/raw/v2x_daolushigong.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/v2x_daolushigong.n3d
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
modules/mogo-module-common/src/main/res/raw/v2x_nongwu.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/v2x_nongwu.n3d
Normal file
Binary file not shown.
BIN
modules/mogo-module-common/src/main/res/raw/v2x_shigu.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/v2x_shigu.n3d
Normal file
Binary file not shown.
Binary file not shown.
BIN
modules/mogo-module-common/src/main/res/raw/v2x_yongdu.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/v2x_yongdu.n3d
Normal file
Binary file not shown.
@@ -45,6 +45,7 @@ import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
|
||||
@@ -1082,6 +1083,11 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
//todo visual
|
||||
}
|
||||
|
||||
private static final int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
|
||||
//求助已通知周围XX位车主
|
||||
private final IMogoOnMessageListener<String> seekHelpNoticeListener =
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.util.Log;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
@@ -40,16 +41,18 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
mContext = context;
|
||||
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoMarkerClickListener(PushDataType.TYPE_PUSH_CAMERA_DATA, marker -> {
|
||||
//点击的marker的具体数据
|
||||
if (mCloudRoadData != null && !TextUtils.isEmpty(mCloudRoadData.getRtmpUrl())) {
|
||||
CameraLiveManager.getInstance().init(mCloudRoadData);
|
||||
} else {
|
||||
Logger.e(TAG, " onMarkerClicked mCloudRoadData == null ");
|
||||
TipToast.shortTip("直播流地址为空");
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoMarkerClickListener(PushDataType.TYPE_PUSH_CAMERA_DATA, new IMogoMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
//点击的marker的具体数据
|
||||
if (mCloudRoadData != null && !TextUtils.isEmpty(mCloudRoadData.getRtmpUrl())) {
|
||||
CameraLiveManager.getInstance().init(mCloudRoadData);
|
||||
} else {
|
||||
Logger.e(TAG, " onMarkerClicked mCloudRoadData == null ");
|
||||
TipToast.shortTip("直播流地址为空");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// loadMarker(false);
|
||||
@@ -182,12 +185,12 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
|
||||
@Override
|
||||
public void onMsgSend(long id) {
|
||||
Logger.d(TAG, "onMsgSend id : " + id);
|
||||
//Logger.d(TAG, "onMsgSend id : " + id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
Logger.d(TAG, "onMsgReceived mogoSnapshotSetData : " + mogoSnapshotSetData);
|
||||
//Logger.d(TAG, "onMsgReceived mogoSnapshotSetData : " + mogoSnapshotSetData);
|
||||
renderMarker(mogoSnapshotSetData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
android:id="@+id/fl_speed"
|
||||
android:layout_width="@dimen/dp_300"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@drawable/yi_biao_pan_bg_nor"
|
||||
android:elevation="@dimen/dp_10"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1 +0,0 @@
|
||||
# GPS 轨迹模拟接口 Debug 实现
|
||||
@@ -1,55 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation "org.java-websocket:Java-WebSocket:1.4.0"
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.gpssimulator
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
} else {
|
||||
implementation project(':foudations:mogo-utils')
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':modules:mogo-module-gps-simulator')
|
||||
implementation project(':services:mogo-service-api')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,2 +0,0 @@
|
||||
#-----GPS-DEBUG-SIMULATOR-----
|
||||
-keep class com.mogo.module.gps.simulator.CationVo.*{*;}
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-gps-simulator-debug
|
||||
VERSION_CODE=1
|
||||
@@ -1,24 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----GPS-DEBUG-SIMULATOR-----
|
||||
-keep class com.mogo.module.gps.simulator.CationVo.*{*;}
|
||||
@@ -1,2 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.gps.simulator.debug" />
|
||||
@@ -1,134 +0,0 @@
|
||||
package com.mogo.module.gps.simulator;
|
||||
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-04-08.
|
||||
*/
|
||||
public class CationVo {
|
||||
|
||||
/**
|
||||
* vehicleSpeed : 1.0
|
||||
* instantSpeed : 1.0
|
||||
* lon : 116.401615
|
||||
* lat : 39.968812
|
||||
* carStatus : 1
|
||||
* direction : 267
|
||||
* sn : ZD801C1928L00371
|
||||
* locationTime : 1586339911534
|
||||
* distance : 0.0
|
||||
* adCode : 2
|
||||
* cityCode : 3
|
||||
* vehicleType : 0
|
||||
*/
|
||||
|
||||
private float vehicleSpeed;
|
||||
private double instantSpeed;
|
||||
private double lon;
|
||||
private double lat;
|
||||
private int carStatus;
|
||||
private int direction;
|
||||
private String sn;
|
||||
private long locationTime;
|
||||
private double distance;
|
||||
private String adCode;
|
||||
private String cityCode;
|
||||
private int vehicleType;
|
||||
|
||||
public float getVehicleSpeed() {
|
||||
return vehicleSpeed;
|
||||
}
|
||||
|
||||
public void setVehicleSpeed( float vehicleSpeed ) {
|
||||
this.vehicleSpeed = vehicleSpeed;
|
||||
}
|
||||
|
||||
public double getInstantSpeed() {
|
||||
return instantSpeed;
|
||||
}
|
||||
|
||||
public void setInstantSpeed( double instantSpeed ) {
|
||||
this.instantSpeed = instantSpeed;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon( double lon ) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat( double lat ) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public int getCarStatus() {
|
||||
return carStatus;
|
||||
}
|
||||
|
||||
public void setCarStatus( int carStatus ) {
|
||||
this.carStatus = carStatus;
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection( int direction ) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn( String sn ) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public long getLocationTime() {
|
||||
return locationTime;
|
||||
}
|
||||
|
||||
public void setLocationTime( long locationTime ) {
|
||||
this.locationTime = locationTime;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance( double distance ) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public String getAdCode() {
|
||||
return adCode;
|
||||
}
|
||||
|
||||
public void setAdCode( String adCode ) {
|
||||
this.adCode = adCode;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode( String cityCode ) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public int getVehicleType() {
|
||||
return vehicleType;
|
||||
}
|
||||
|
||||
public void setVehicleType( int vehicleType ) {
|
||||
this.vehicleType = vehicleType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.mogo.module.gps.simulator;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
import org.java_websocket.drafts.Draft_6455;
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-04-07.
|
||||
*/
|
||||
public class JWebSocketClient extends WebSocketClient {
|
||||
|
||||
public JWebSocketClient( URI serverUri ) {
|
||||
super( serverUri, new Draft_6455() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen( ServerHandshake handshakedata ) {
|
||||
Logger.d( "JWebSocketClient", "onOpen()" );
|
||||
bindSN();
|
||||
}
|
||||
|
||||
private void bindSN() {
|
||||
String data = String.format( "{ \"sn\": \"%s\", \"bind\": true }", Utils.getSn() );
|
||||
send( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage( String message ) {
|
||||
Logger.e( "JWebSocketClient", "onMessage()" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose( int code, String reason, boolean remote ) {
|
||||
Logger.d( "JWebSocketClient", "onClose()" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Exception ex ) {
|
||||
Logger.d( "JWebSocketClient", "onError()" );
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mogo.module.gps.simulator;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-13
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = GpsSimulatorConstants.API_PATH )
|
||||
public class MogoGpsSimulatorManagerDebug implements IMogoGpsSimulatorManager {
|
||||
|
||||
private static final String TAG = "MogoGpsSimulatorManagerDebug";
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
WebSocketManager.getInstance().connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
WebSocketManager.getInstance().disConnect();
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
WebSocketManager.destroy();
|
||||
}, 1_000L );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.mogo.module.gps.simulator;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Created by congtaowang on 2018/3/29.
|
||||
*/
|
||||
|
||||
class Utils {
|
||||
|
||||
public static final String GET = "get";
|
||||
public static final String GSM_SERIAL = "gsm.serial";
|
||||
public static final String FOTA_VERSION = "ro.fota.version";
|
||||
public static final String PROPERTIES = "android.os.SystemProperties";
|
||||
|
||||
public static String getSn() {
|
||||
if ( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE ) {
|
||||
return SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).getString( "allocated_sn" );
|
||||
}
|
||||
return getSystemProperties( GSM_SERIAL );
|
||||
}
|
||||
|
||||
public static String getFotaVersion() {
|
||||
return getSystemProperties( FOTA_VERSION );
|
||||
}
|
||||
|
||||
public static String getSystemProperties( String name ) {
|
||||
String value = "";
|
||||
|
||||
try {
|
||||
Class< ? > c = Class.forName( PROPERTIES );
|
||||
Method get = c.getMethod( GET, String.class );
|
||||
value = ( String ) get.invoke( c, name );
|
||||
} catch ( ClassNotFoundException var3 ) {
|
||||
var3.printStackTrace();
|
||||
} catch ( NoSuchMethodException var4 ) {
|
||||
var4.printStackTrace();
|
||||
} catch ( InvocationTargetException var5 ) {
|
||||
var5.printStackTrace();
|
||||
} catch ( IllegalAccessException var6 ) {
|
||||
var6.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package com.mogo.module.gps.simulator;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-04-07.
|
||||
*/
|
||||
public class WebSocketManager {
|
||||
|
||||
private static final String TAG = "WebSocketManager";
|
||||
|
||||
private static Object sLock = new Object();
|
||||
private static WebSocketManager sWebSocketManager;
|
||||
|
||||
private IMogoNavi mNavi;
|
||||
private JWebSocketClient mClient;
|
||||
private URI mUri;
|
||||
private IMogoServiceApis mServiceApis;
|
||||
|
||||
private ExecutorService mService;
|
||||
|
||||
public static WebSocketManager getInstance() {
|
||||
if ( sWebSocketManager == null ) {
|
||||
synchronized ( sLock ) {
|
||||
if ( sWebSocketManager == null ) {
|
||||
sWebSocketManager = new WebSocketManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sWebSocketManager;
|
||||
}
|
||||
|
||||
private WebSocketManager() {
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
mNavi = mServiceApis.getMapServiceApi().getNavi( AbsMogoApplication.getApp() );
|
||||
mUri = URI.create( "ws://152.136.10.223:4001/realtimeLocations-ws" );
|
||||
mClient = new JWebSocketClient( mUri ) {
|
||||
@Override
|
||||
public void onMessage( String message ) {
|
||||
try {
|
||||
parseMessage( message );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen( ServerHandshake handshakedata ) {
|
||||
super.onOpen( handshakedata );
|
||||
UiThreadHandler.post( () -> {
|
||||
TipToast.shortTip( "模拟GPS开启成功" );
|
||||
mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() ).stop();
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose( int code, String reason, boolean remote ) {
|
||||
super.onClose( code, reason, remote );
|
||||
UiThreadHandler.post( () -> {
|
||||
TipToast.shortTip( "模拟GPS关闭成功" );
|
||||
mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() ).start();
|
||||
} );
|
||||
shutdownServiceQuietly();
|
||||
}
|
||||
};
|
||||
initThreadService();
|
||||
}
|
||||
|
||||
private void parseMessage( String jsonStr ) throws Exception {
|
||||
//message就是接收到的消息
|
||||
Logger.d( TAG, jsonStr );
|
||||
JSONObject jsonObject = new JSONObject( jsonStr );
|
||||
if ( jsonObject.has( "detailMsg" ) ) {
|
||||
Logger.d( TAG, "绑定成功" );
|
||||
} else if ( jsonObject.has( "realTimeLocationVo" ) ) {
|
||||
Logger.d( TAG, "收到定位消息" );
|
||||
CationVo realTimeLocationVo = GsonUtil.objectFromJson( jsonObject.getString( "realTimeLocationVo" ), CationVo.class );
|
||||
UiThreadHandler.post( () -> {
|
||||
mNavi.setExtraGPSData(
|
||||
realTimeLocationVo.getLon(),
|
||||
realTimeLocationVo.getLat(),
|
||||
realTimeLocationVo.getVehicleSpeed(),
|
||||
1,
|
||||
realTimeLocationVo.getDirection(),
|
||||
realTimeLocationVo.getLocationTime()
|
||||
);
|
||||
Iterator< IMogoLocationListener > listeners = mServiceApis.getRegisterCenterApi().getLocationListeners();
|
||||
MogoLocation location = new MogoLocation();
|
||||
location.setLatitude( realTimeLocationVo.getLat() );
|
||||
location.setLongitude( realTimeLocationVo.getLon() );
|
||||
location.setSpeed( realTimeLocationVo.getVehicleSpeed() );
|
||||
location.setAccuracy( 1 );
|
||||
location.setTime( realTimeLocationVo.getLocationTime() );
|
||||
|
||||
if ( listeners != null ) {
|
||||
while ( listeners.hasNext() ) {
|
||||
listeners.next().onLocationChanged( location );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
if ( mClient == null ) {
|
||||
return;
|
||||
}
|
||||
mNavi.setUseExtraGPSData( true );
|
||||
mService.execute( () -> {
|
||||
try {
|
||||
mClient.connectBlocking();
|
||||
Logger.d( TAG, "connectBlocking done." );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void initThreadService() {
|
||||
if ( mService == null || mService.isShutdown() ) {
|
||||
mService = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
}
|
||||
|
||||
public void disConnect() {
|
||||
mNavi.setUseExtraGPSData( false );
|
||||
mService.execute( () -> {
|
||||
try {
|
||||
mClient.closeBlocking();
|
||||
Logger.d( TAG, "close done." );
|
||||
} catch ( InterruptedException e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
sWebSocketManager = null;
|
||||
}
|
||||
|
||||
private void shutdownServiceQuietly() {
|
||||
if ( mService != null && !mService.isShutdown() ) {
|
||||
mService.shutdown();
|
||||
}
|
||||
mService = null;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-gps-simulator</string>
|
||||
</resources>
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1 +0,0 @@
|
||||
# GPS 轨迹模拟接口 Release 实现
|
||||
@@ -1,50 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.gpssimulator
|
||||
} else {
|
||||
implementation project(':foudations:mogo-utils')
|
||||
implementation project(':modules:mogo-module-gps-simulator')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-gps-simulator-noop
|
||||
VERSION_CODE=1
|
||||
@@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,2 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.gps.simulator.noop" />
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.mogo.module.gps.simulator;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-13
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = GpsSimulatorConstants.API_PATH )
|
||||
public class MogoGpsSimulatorManagerNoop implements IMogoGpsSimulatorManager {
|
||||
|
||||
private static final String TAG = "MogoGpsSimulatorManagerNoop";
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
Logger.e( TAG, "no operation when release." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
Logger.e( TAG, "no operation when release." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-gps-simulator</string>
|
||||
</resources>
|
||||
1
modules/mogo-module-gps-simulator/.gitignore
vendored
1
modules/mogo-module-gps-simulator/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,5 +0,0 @@
|
||||
# GPS 轨迹模拟接口抽象
|
||||
|
||||
## 常量定义
|
||||
|
||||
## 接口
|
||||
@@ -1,36 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-gps-simulator
|
||||
VERSION_CODE=1
|
||||
@@ -1,24 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----MogoGSPSimulator-----
|
||||
-keep class com.mogo.module.gps.simulator.GpsSimulatorConstants
|
||||
@@ -1,2 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.gps.simulator" />
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mogo.module.gps.simulator;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-13
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class GpsSimulatorConstants {
|
||||
|
||||
public static final String API_PATH = "/gpssimulator/api";
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.mogo.module.gps.simulator;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-13
|
||||
* <p>
|
||||
* gps 模拟控制开关
|
||||
*/
|
||||
public interface IMogoGpsSimulatorManager extends IProvider {
|
||||
|
||||
/**
|
||||
* 打开 gps 模拟
|
||||
*/
|
||||
void open();
|
||||
|
||||
/**
|
||||
* 关闭 gps 模拟
|
||||
*/
|
||||
void close();
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-gps-simulator</string>
|
||||
</resources>
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.module.main;
|
||||
|
||||
import android.location.Location;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -20,7 +19,7 @@ import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -28,6 +27,7 @@ import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode;
|
||||
import com.zhidao.adasconfig.listener.IAdasSettingUIListener;
|
||||
import com.zhidao.adasconfig.listener.IAdasSkinStyleListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
@@ -80,6 +80,22 @@ public class EventDispatchCenter implements
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStaticMarkerClicked(IMogoMarker marker) {
|
||||
ArrayList<IMogoMarkerClickListener> list = MogoRegisterCenterHandler.getInstance().getStaticMarkerListener( marker.getOwner() );
|
||||
if(list == null){
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
for (IMogoMarkerClickListener listener : list) {
|
||||
return listener.onStaticMarkerClicked( marker );
|
||||
}
|
||||
} catch ( Exception e){
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic2( MogoTraffic traffic ) {
|
||||
Iterator< IMogoAimlessModeListener > iterator = MogoRegisterCenterHandler.getInstance().getAimlessModeListeners();
|
||||
@@ -278,6 +294,24 @@ public class EventDispatchCenter implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onMapVisualAngleChanged( visualAngleMode );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import com.mogo.commons.context.ContextHolderUtil;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
@@ -31,8 +30,9 @@ import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.v2x.IV2XListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.skin.support.SkinMode;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -50,6 +50,7 @@ import java.util.List;
|
||||
*/
|
||||
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoStatusChangedListener,
|
||||
IMogoADASControlStatusChangedListener,
|
||||
FragmentStackTransactionListener {
|
||||
|
||||
@@ -151,8 +152,9 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
super.onCreate(savedInstanceState);
|
||||
ContextHolderUtil.holdContext(this);
|
||||
mPresenter.postLoadModuleMsg();
|
||||
|
||||
NetworkUtils.listenNetStrength(this);
|
||||
DisplayEffectsHelper.getInstance().init(clSpecialEffect);
|
||||
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
@@ -402,4 +404,23 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
mServiceApis.getShareManager().releaseContext();
|
||||
mServiceApis.getSkinSupportInstallerApi().onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
FrameLayout.LayoutParams entranceParams = ((FrameLayout.LayoutParams) mEntrance.getLayoutParams());
|
||||
if (isTrue) {
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode);
|
||||
} else {
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_id_entrance_fragment_container_marginLeft);
|
||||
}
|
||||
mEntrance.setLayoutParams(entranceParams);
|
||||
if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
if (isTrue) {
|
||||
clSpecialEffect.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
clSpecialEffect.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,100 +22,110 @@ import java.util.Iterator;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_REGISTER_CENTER )
|
||||
@Route(path = MogoServicePaths.PATH_REGISTER_CENTER)
|
||||
public class MogoRegisterCenter implements IMogoRegisterCenter {
|
||||
|
||||
@Override
|
||||
public void registerMogoModuleLifecycle( String moduleName, IMogoModuleLifecycle lifecycle ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoModuleLifecycle( moduleName, lifecycle );
|
||||
public void registerMogoModuleLifecycle(String moduleName, IMogoModuleLifecycle lifecycle) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoModuleLifecycle(moduleName, lifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoModuleLifecycle( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoModuleLifecycle( moduleName );
|
||||
public void unregisterMogoModuleLifecycle(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoModuleLifecycle(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMapListener( String moduleName, IMogoMapListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoMapListener( moduleName, listener );
|
||||
public void registerMogoMapListener(String moduleName, IMogoMapListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoMapListener(moduleName, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMapListener( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoMapListener( moduleName );
|
||||
public void unregisterMogoMapListener(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoMapListener(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoNaviListener( String moduleName, IMogoNaviListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoNaviListener( moduleName, listener );
|
||||
public void registerMogoNaviListener(String moduleName, IMogoNaviListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoNaviListener(moduleName, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoNaviListener( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoNaviListener( moduleName );
|
||||
public void unregisterMogoNaviListener(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoNaviListener(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoLocationListener( String moduleName, IMogoLocationListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoLocationListener( moduleName, listener );
|
||||
public void registerMogoLocationListener(String moduleName, IMogoLocationListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoLocationListener(moduleName, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator< IMogoLocationListener > getLocationListeners() {
|
||||
public Iterator<IMogoLocationListener> getLocationListeners() {
|
||||
return MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoLocationListener( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoLocationListener( moduleName );
|
||||
public void unregisterMogoLocationListener(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoLocationListener(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMarkerClickListener( String moduleName, IMogoMarkerClickListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoMarkerClickListener( moduleName, listener );
|
||||
public void registerMogoMarkerClickListener(String moduleName, IMogoMarkerClickListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoMarkerClickListener(moduleName, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMarkerClickListener( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoMarkerClickListener( moduleName );
|
||||
public void unregisterMogoMarkerClickListener(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoMarkerClickListener(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoAimlessModeListener( String tag, IMogoAimlessModeListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoAimlessModeListener( tag, listener );
|
||||
public void registerMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoStaticMarkerClickListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoAimlessModeListener( String tag ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoAimlessModeListener( tag );
|
||||
public void unregisterMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoStaticMarkerClickListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( String tag, IMogoCarLocationChangedListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerCarLocationChangedListener( tag, listener );
|
||||
public void registerMogoAimlessModeListener(String tag, IMogoAimlessModeListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoAimlessModeListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterCarLocationChangedListener( String tag, IMogoCarLocationChangedListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterCarLocationChangedListener( tag, listener );
|
||||
public void unregisterMogoAimlessModeListener(String tag) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoAimlessModeListener(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerADASControlStatusChangedListener( String tag, IMogoADASControlStatusChangedListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerADASControlStatusChangedListener( tag, listener );
|
||||
public void registerCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerCarLocationChangedListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterADASControlStatusChangedListener( String tag ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterADASControlStatusChangedListener( tag );
|
||||
public void unregisterCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterCarLocationChangedListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator< IMogoADASControlStatusChangedListener > getAdasControlStatusChangedListeners() {
|
||||
public void registerADASControlStatusChangedListener(String tag, IMogoADASControlStatusChangedListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerADASControlStatusChangedListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterADASControlStatusChangedListener(String tag) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterADASControlStatusChangedListener(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IMogoADASControlStatusChangedListener> getAdasControlStatusChangedListeners() {
|
||||
return MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
public void init(Context context) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -27,22 +28,23 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
|
||||
private static volatile MogoRegisterCenterHandler sInstance;
|
||||
|
||||
private Map< String, IMogoModuleLifecycle > mLifecycle = new HashMap<>();
|
||||
private Map< String, IMogoMapListener > mMap = new HashMap<>();
|
||||
private Map< String, IMogoNaviListener > mNavi = new ConcurrentHashMap<>();
|
||||
private Map< String, IMogoLocationListener > mLocation = new HashMap<>();
|
||||
private Map< String, IMogoMarkerClickListener > mMarker = new HashMap<>();
|
||||
private Map< String, IMogoAimlessModeListener > mAimless = new HashMap<>();
|
||||
private Map< String, IMogoCarLocationChangedListener > mCarLocations = new ConcurrentHashMap<>();
|
||||
private Map< String, IMogoADASControlStatusChangedListener > mADAS = new HashMap<>();
|
||||
private final Map<String, IMogoModuleLifecycle> mLifecycle = new HashMap<>();
|
||||
private final Map<String, IMogoMapListener> mMap = new HashMap<>();
|
||||
private final Map<String, IMogoNaviListener> mNavi = new ConcurrentHashMap<>();
|
||||
private final Map<String, IMogoLocationListener> mLocation = new HashMap<>();
|
||||
private final Map<String, IMogoMarkerClickListener> mMarker = new HashMap<>();
|
||||
private final Map<String, ArrayList<IMogoMarkerClickListener>> mStaticMarker = new HashMap<>();
|
||||
private final Map<String, IMogoAimlessModeListener> mAimless = new HashMap<>();
|
||||
private final Map<String, IMogoCarLocationChangedListener> mCarLocations = new ConcurrentHashMap<>();
|
||||
private final Map<String, IMogoADASControlStatusChangedListener> mADAS = new HashMap<>();
|
||||
|
||||
private MogoRegisterCenterHandler() {
|
||||
}
|
||||
|
||||
public static MogoRegisterCenterHandler getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoRegisterCenterHandler.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoRegisterCenterHandler.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoRegisterCenterHandler();
|
||||
}
|
||||
}
|
||||
@@ -56,141 +58,166 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
|
||||
|
||||
@Override
|
||||
public void registerMogoModuleLifecycle( String tag, IMogoModuleLifecycle lifecycle ) {
|
||||
mLifecycle.put( tag, lifecycle );
|
||||
public void registerMogoModuleLifecycle(String tag, IMogoModuleLifecycle lifecycle) {
|
||||
mLifecycle.put(tag, lifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoModuleLifecycle( String tag ) {
|
||||
mLifecycle.remove( tag );
|
||||
public void unregisterMogoModuleLifecycle(String tag) {
|
||||
mLifecycle.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMapListener( String tag, IMogoMapListener listener ) {
|
||||
mMap.put( tag, listener );
|
||||
public void registerMogoMapListener(String tag, IMogoMapListener listener) {
|
||||
mMap.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMapListener( String tag ) {
|
||||
mMap.remove( tag );
|
||||
public void unregisterMogoMapListener(String tag) {
|
||||
mMap.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoNaviListener( String tag, IMogoNaviListener listener ) {
|
||||
mNavi.put( tag, listener );
|
||||
public void registerMogoNaviListener(String tag, IMogoNaviListener listener) {
|
||||
mNavi.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoNaviListener( String tag ) {
|
||||
mNavi.remove( tag );
|
||||
public void unregisterMogoNaviListener(String tag) {
|
||||
mNavi.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoLocationListener( String tag, IMogoLocationListener listener ) {
|
||||
mLocation.put( tag, listener );
|
||||
public void registerMogoLocationListener(String tag, IMogoLocationListener listener) {
|
||||
mLocation.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoLocationListener( String tag ) {
|
||||
mLocation.remove( tag );
|
||||
public void unregisterMogoLocationListener(String tag) {
|
||||
mLocation.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMarkerClickListener( String tag, IMogoMarkerClickListener listener ) {
|
||||
mMarker.put( tag, listener );
|
||||
public void registerMogoMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
|
||||
mMarker.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMarkerClickListener( String tag ) {
|
||||
mMarker.remove( tag );
|
||||
public void unregisterMogoMarkerClickListener(String tag) {
|
||||
mMarker.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoAimlessModeListener( String tag, IMogoAimlessModeListener listener ) {
|
||||
mAimless.put( tag, listener );
|
||||
public void registerMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
|
||||
ArrayList<IMogoMarkerClickListener> list = mStaticMarker.get(tag);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
list.add(listener);
|
||||
mStaticMarker.put(tag, list);
|
||||
}
|
||||
list.add(listener);
|
||||
mStaticMarker.put(tag, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoAimlessModeListener( String tag ) {
|
||||
mAimless.remove( tag );
|
||||
public void unregisterMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
|
||||
ArrayList<IMogoMarkerClickListener> list = mStaticMarker.get(tag);
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
list.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( String tag, IMogoCarLocationChangedListener listener ) {
|
||||
mCarLocations.put( tag, listener );
|
||||
public void registerMogoAimlessModeListener(String tag, IMogoAimlessModeListener listener) {
|
||||
mAimless.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterCarLocationChangedListener( String tag, IMogoCarLocationChangedListener listener ) {
|
||||
mCarLocations.remove( tag );
|
||||
public void unregisterMogoAimlessModeListener(String tag) {
|
||||
mAimless.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerADASControlStatusChangedListener( String tag, IMogoADASControlStatusChangedListener listener ) {
|
||||
mADAS.put( tag, listener );
|
||||
public void registerCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
mCarLocations.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterADASControlStatusChangedListener( String tag ) {
|
||||
mADAS.remove( tag );
|
||||
public void unregisterCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
mCarLocations.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
public void registerADASControlStatusChangedListener(String tag, IMogoADASControlStatusChangedListener listener) {
|
||||
mADAS.put(tag, listener);
|
||||
}
|
||||
|
||||
public IMogoModuleLifecycle getLifecycleListener( String tag ) {
|
||||
return mLifecycle.get( tag );
|
||||
@Override
|
||||
public void unregisterADASControlStatusChangedListener(String tag) {
|
||||
mADAS.remove(tag);
|
||||
}
|
||||
|
||||
public IMogoMapListener getMapListener( String tag ) {
|
||||
return mMap.get( tag );
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
}
|
||||
|
||||
public IMogoNaviListener getNaviListener( String tag ) {
|
||||
return mNavi.get( tag );
|
||||
public IMogoModuleLifecycle getLifecycleListener(String tag) {
|
||||
return mLifecycle.get(tag);
|
||||
}
|
||||
|
||||
public IMogoLocationListener getLocationListener( String tag ) {
|
||||
return mLocation.get( tag );
|
||||
public IMogoMapListener getMapListener(String tag) {
|
||||
return mMap.get(tag);
|
||||
}
|
||||
|
||||
public IMogoMarkerClickListener getMarkerListener( String tag ) {
|
||||
return mMarker.get( tag );
|
||||
public IMogoNaviListener getNaviListener(String tag) {
|
||||
return mNavi.get(tag);
|
||||
}
|
||||
|
||||
public Iterator< IMogoModuleLifecycle > getLifecycleListeners() {
|
||||
public IMogoLocationListener getLocationListener(String tag) {
|
||||
return mLocation.get(tag);
|
||||
}
|
||||
|
||||
public IMogoMarkerClickListener getMarkerListener(String tag) {
|
||||
return mMarker.get(tag);
|
||||
}
|
||||
|
||||
public ArrayList<IMogoMarkerClickListener> getStaticMarkerListener(String tag){
|
||||
return mStaticMarker.get(tag);
|
||||
}
|
||||
|
||||
public Iterator<IMogoModuleLifecycle> getLifecycleListeners() {
|
||||
return mLifecycle.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoMapListener > getMapListeners() {
|
||||
public Iterator<IMogoMapListener> getMapListeners() {
|
||||
return mMap.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoNaviListener > getNaviListeners() {
|
||||
public Iterator<IMogoNaviListener> getNaviListeners() {
|
||||
return mNavi.values().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator< IMogoLocationListener > getLocationListeners() {
|
||||
public Iterator<IMogoLocationListener> getLocationListeners() {
|
||||
return mLocation.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoMarkerClickListener > getMarkerListeners() {
|
||||
public Iterator<IMogoMarkerClickListener> getMarkerListeners() {
|
||||
return mMarker.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoAimlessModeListener > getAimlessModeListeners() {
|
||||
public Iterator<IMogoAimlessModeListener> getAimlessModeListeners() {
|
||||
return mAimless.values().iterator();
|
||||
}
|
||||
|
||||
|
||||
public Iterator< IMogoCarLocationChangedListener > getCarLocationChangedListener() {
|
||||
public Iterator<IMogoCarLocationChangedListener> getCarLocationChangedListener() {
|
||||
return mCarLocations.values().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator< IMogoADASControlStatusChangedListener > getAdasControlStatusChangedListeners() {
|
||||
public Iterator<IMogoADASControlStatusChangedListener> getAdasControlStatusChangedListeners() {
|
||||
return mADAS.values().iterator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = "/service/base/info" )
|
||||
@Route(path = "/service/base/info")
|
||||
class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
private static final String TAG = "MogoMainService";
|
||||
@@ -39,10 +39,10 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Logger.d( TAG, "基本服务启动" );
|
||||
Logger.d(TAG, "基本服务启动");
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
initAndStartLocation();
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
loadBaseModules();
|
||||
startTanluService();
|
||||
initADAS();
|
||||
@@ -56,53 +56,61 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind( Intent intent ) {
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand( Intent intent, int flags, int startId ) {
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void initAndStartLocation() {
|
||||
Logger.d( TAG, "开始定位" );
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start( 2_000L );
|
||||
Logger.d(TAG, "开始定位");
|
||||
if (mServiceApis != null) {
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp());
|
||||
mLocationClient.addLocationListener(this);
|
||||
mLocationClient.start(2_000L);
|
||||
}
|
||||
}
|
||||
|
||||
private void initGpsSimulatorListener() {
|
||||
mServiceApis.getMapServiceApi().getNavi( this ).registerCarLocationChangedListener( EventDispatchCenter.getInstance() );
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getMapServiceApi().getNavi(this).registerCarLocationChangedListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d( TAG, "加载基本模块" );
|
||||
Logger.d(TAG, "加载基本模块");
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
}
|
||||
|
||||
private void startTanluService() {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
Logger.d( TAG, "startTanluService ---------- " );
|
||||
mServiceApis.getTanluApi().startTanluService();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
Logger.d(TAG, "startTanluService ---------- ");
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getTanluApi().startTanluService();
|
||||
}
|
||||
}, 2_000L
|
||||
);
|
||||
}
|
||||
|
||||
private void initADAS() {
|
||||
mServiceApis.getAdasControllerApi().init( AbsMogoApplication.getApp() );
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getAdasControllerApi().init(AbsMogoApplication.getApp());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
EventDispatchCenter.getInstance().onLocationChanged( location );
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
EventDispatchCenter.getInstance().onLocationChanged(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if ( mLocationClient != null ) {
|
||||
mLocationClient.removeLocationListener( this );
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.removeLocationListener(this);
|
||||
mLocationClient.stop();
|
||||
mLocationClient.destroy();
|
||||
mLocationClient = null;
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
android:id="@+id/warning_right"
|
||||
android:layout_width="@dimen/dp_390"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/module_main_id_warning_view_marginLeft"
|
||||
android:layout_gravity="right"
|
||||
android:background="@drawable/module_main_warning_bkg_right"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<dimen name="module_main_header_fragment_container_marginTop">15px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">460px</dimen>
|
||||
<dimen name="module_main_id_entrance_fragment_container_marginLeft">444px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_id_left_panel_fragment_container_width">350px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding">10px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding_top">16px</dimen>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<dimen name="module_main_header_fragment_container_marginTop">30px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">830px</dimen>
|
||||
<dimen name="module_main_id_entrance_fragment_container_marginLeft">590px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding">30px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding_top">70px</dimen>
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<dimen name="module_main_header_fragment_container_marginTop">30px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">830px</dimen>
|
||||
<dimen name="module_main_id_entrance_fragment_container_marginLeft">800px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding">20px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding_top">30px</dimen>
|
||||
|
||||
@@ -33,5 +34,4 @@
|
||||
<dimen name="module_main_event_panel_fragment_paddingLeft">18px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingRight">18px</dimen>
|
||||
|
||||
<dimen name="module_main_id_warning_view_marginLeft">1530px</dimen>
|
||||
</resources>
|
||||
@@ -21,6 +21,7 @@
|
||||
<dimen name="module_main_header_fragment_container_marginTop">15px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">460px</dimen>
|
||||
<dimen name="module_main_id_entrance_fragment_container_marginLeft">444px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_id_left_panel_fragment_container_width">350px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding">10px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding_top">16px</dimen>
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
|
||||
@@ -271,8 +271,6 @@ public class MediaWindow implements MediaView{
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if (mWindowPlayPause != null){
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
|
||||
@@ -58,14 +58,12 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
// implementation rootProject.ext.dependencies.gpssimulator
|
||||
} else {
|
||||
implementation project(":libraries:mogo-map-api")
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
// implementation project(':modules:mogo-module-gps-simulator')
|
||||
}
|
||||
implementation 'com.zhidaoauto.voice.controller:api:1.0.2'
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ public class SearchApisHolder {
|
||||
private static final String TAG = "SearchApisHolder";
|
||||
|
||||
private static IMogoServiceApis sApis;
|
||||
// private static IMogoGpsSimulatorManager sGpsSimulatorManager;
|
||||
|
||||
private static PersonalInfoManagerImpl mPersonalInfoManager;
|
||||
|
||||
@@ -84,13 +83,6 @@ public class SearchApisHolder {
|
||||
return getApis().getSettingManagerApi();
|
||||
}
|
||||
|
||||
// public static IMogoGpsSimulatorManager getGpsSimulatorManager() {
|
||||
// if ( sGpsSimulatorManager == null ) {
|
||||
// sGpsSimulatorManager = ARouter.getInstance().navigation( IMogoGpsSimulatorManager.class );
|
||||
// }
|
||||
// return sGpsSimulatorManager;
|
||||
// }
|
||||
|
||||
public static IMogoSearchManager getSearchManager() {
|
||||
return getApis().getSearchManagerApi();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.mogo.module.navi.manager.SettingManager
|
||||
import com.mogo.module.navi.manager.VolumeManager
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.utils.TipToast
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import kotlinx.android.synthetic.main.fragment_navi_setting.*
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@@ -224,11 +223,6 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
|
||||
SettingManager.setGpsSimulator(isChecked)
|
||||
|
||||
// if (isChecked) {
|
||||
// SearchApisHolder.getGpsSimulatorManager().open()
|
||||
// } else {
|
||||
// SearchApisHolder.getGpsSimulatorManager().close()
|
||||
// }
|
||||
}
|
||||
tb_custom_map.isChecked = DebugConfig.isUseCustomMap()
|
||||
tb_custom_map.setOnCheckedChangeListener{ _, isChecked ->
|
||||
|
||||
@@ -60,7 +60,6 @@ dependencies {
|
||||
api rootProject.ext.dependencies.mogocommons
|
||||
api rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
// implementation rootProject.ext.dependencies.gpssimulator
|
||||
} else {
|
||||
api project(":libraries:mogo-map")
|
||||
api project(":libraries:mogo-map-api")
|
||||
@@ -68,7 +67,6 @@ dependencies {
|
||||
api project(":foudations:mogo-commons")
|
||||
api project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
// implementation project(':modules:mogo-module-gps-simulator')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,21 @@ public
|
||||
* @author congtaowang
|
||||
* @since 2021/3/26
|
||||
*
|
||||
* 描述
|
||||
* 生成测试数据,执行指令
|
||||
* java LocParse.java
|
||||
*
|
||||
* loc.txt
|
||||
* adas0.txt
|
||||
* adas1.txt
|
||||
* adas2.txt
|
||||
* adas3.txt
|
||||
* adas4.txt
|
||||
* adas5.txt
|
||||
* adas6.txt
|
||||
* adas7.txt
|
||||
* adas8.txt
|
||||
* adas9.txt
|
||||
*
|
||||
*/
|
||||
class LocParse {
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
31501
modules/mogo-module-service/src/main/assets/heng_0327.csv
Normal file
31501
modules/mogo-module-service/src/main/assets/heng_0327.csv
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,7 @@ import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
@@ -61,6 +62,7 @@ public class MarkerServiceHandler {
|
||||
private static IMogoFragmentManager sFragmentManager;
|
||||
private static ICarsChattingProvider sCarChatting;
|
||||
private static IV2XProvider sIV2XProvider;
|
||||
private static IMogoOverlayManager sIMogoOverlayManager;
|
||||
|
||||
// private static IMogoGpsSimulatorManager sGpsSimulatorManager;
|
||||
|
||||
@@ -77,6 +79,7 @@ public class MarkerServiceHandler {
|
||||
sMogoSocketManager = sApis.getSocketManagerApi( context );
|
||||
sMogoAnalytics = sApis.getAnalyticsApi();
|
||||
sMarkerManager = sMapService.getMarkerManager( context );
|
||||
sIMogoOverlayManager = sMapService.getOverlayManager(context);
|
||||
sNavi = sMapService.getNavi( context );
|
||||
sMapUIController = sMapService.getMapUIController();
|
||||
sLocationClient = sMapService.getSingletonLocationClient( context );
|
||||
@@ -87,7 +90,6 @@ public class MarkerServiceHandler {
|
||||
sADASController = sApis.getAdasControllerApi();
|
||||
sLauncher = sApis.getLauncherApi();
|
||||
sFragmentManager = sApis.getFragmentManagerApi();
|
||||
|
||||
sCarChatting = ( ICarsChattingProvider ) ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation( context );
|
||||
sIV2XProvider = sApis.getV2XListenerManager();
|
||||
|
||||
@@ -172,9 +174,13 @@ public class MarkerServiceHandler {
|
||||
return sCarChatting;
|
||||
}
|
||||
|
||||
// public static IMogoGpsSimulatorManager getGpsSimulatorManager() {
|
||||
// return sGpsSimulatorManager;
|
||||
// }
|
||||
public static IMogoOverlayManager getsIMogoOverlayManager() {
|
||||
return sIMogoOverlayManager;
|
||||
}
|
||||
|
||||
public static void setsIMogoOverlayManager(IMogoOverlayManager sIMogoOverlayManager) {
|
||||
MarkerServiceHandler.sIMogoOverlayManager = sIMogoOverlayManager;
|
||||
}
|
||||
|
||||
//TODO -------------以下方法是临时过度使用的,后面统一使用,getMapMarkerManager进行调用
|
||||
|
||||
|
||||
@@ -428,10 +428,12 @@ public class MogoServices implements IMogoMapListener,
|
||||
Logger.w( TAG, "lonLat is null." );
|
||||
return;
|
||||
}
|
||||
//请求大而全数据,刷新地图POI
|
||||
mRefreshModel.refreshExplorerWayData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
|
||||
// if ( !DebugConfig.
|
||||
// isNeedUploadCoordinatesDurationInTime() ) { //todo 实时在线车辆需要注释,否则在2D模式下不能展示
|
||||
// }
|
||||
//请求在线车辆数据,刷新地图在线车辆
|
||||
MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat );
|
||||
|
||||
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
|
||||
|
||||
@@ -169,8 +169,8 @@ public class MockIntentHandler implements IntentHandler {
|
||||
} else {
|
||||
MarkerServiceHandler.getADASController().closeADAS();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 13: {// 唤起高德地图
|
||||
double lat = intent.getFloatExtra("lat", 0.0f);
|
||||
double lon = intent.getFloatExtra("lon", 0.0f);
|
||||
@@ -218,6 +218,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
});
|
||||
MarkerServiceHandler.getNavi().naviTo(new MogoLatLng(lat, lon));
|
||||
break;
|
||||
}
|
||||
case 14: {//测试点的动画移动,模拟周边车辆移动
|
||||
List<MogoLatLng> mogoLatLngs = new ArrayList<>();
|
||||
@@ -339,14 +340,8 @@ public class MockIntentHandler implements IntentHandler {
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus(TAG, true, false);
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter(mogoLatLngs.get(0));
|
||||
WorkThreadHandler.getInstance().post(() -> marker.startSmooth(mogoLatLngs, duration));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// case 15:
|
||||
// MarkerServiceHandler.getGpsSimulatorManager().open();
|
||||
// break;
|
||||
// case 16:
|
||||
// MarkerServiceHandler.getGpsSimulatorManager().close();
|
||||
// break;
|
||||
case 17:// 查询在线车辆数据
|
||||
DebugConfig.setRequestOnlineCarData(intent.getBooleanExtra("status", true));
|
||||
break;
|
||||
@@ -626,6 +621,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
private BufferedReader roadSizeBr;
|
||||
private JSONObject locJo = null;
|
||||
|
||||
/**
|
||||
* 处理模拟单Loc数据意图
|
||||
*/
|
||||
private void handleMockSingleLocDataIntent() throws Exception {
|
||||
if (locJo == null) {
|
||||
String locLine = "{\"systemTime\":1615529718585,\"satelliteTime\":1615529718585,\"lon\":116.73573385415098,\"lat\":40.19907712731953,\"alt\":34.4018669128417,\"heading\":0.342695406938048,\"speed\":0.003303937}";
|
||||
@@ -637,6 +635,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(100, 50L);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理路侧模拟数据意图
|
||||
*/
|
||||
private void handleRoadSideMockDataIntent() throws Exception {
|
||||
if (roadSizeBr == null) {
|
||||
roadSizeBr = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("roadSide.txt")));
|
||||
@@ -680,6 +681,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
// 模拟处理当前车辆位置
|
||||
if (msg.what == 1) {
|
||||
try {
|
||||
if (!handleMockLocationIntent()) {
|
||||
@@ -694,7 +696,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
br = null;
|
||||
}
|
||||
} else if (msg.what == 21) {
|
||||
}
|
||||
// 模拟远端数据
|
||||
else if (msg.what == 21) {
|
||||
try {
|
||||
handleMockSnapshotIntent2();
|
||||
} catch (Exception e) {
|
||||
@@ -705,7 +709,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
|
||||
}
|
||||
} else if (msg.what == 3) {
|
||||
}
|
||||
// 模拟ADAS数据
|
||||
else if (msg.what == 3) {
|
||||
try {
|
||||
handleMockAdasIntent();
|
||||
} catch (Exception e) {
|
||||
@@ -720,13 +726,17 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
readers = null;
|
||||
}
|
||||
} else if (msg.what == 100) {
|
||||
}
|
||||
// 模拟单个车数据
|
||||
else if (msg.what == 100) {
|
||||
try {
|
||||
handleMockSingleLocDataIntent();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (msg.what == 101) {
|
||||
}
|
||||
// 处理路侧模拟数据意图
|
||||
else if (msg.what == 101) {
|
||||
try {
|
||||
handleRoadSideMockDataIntent();
|
||||
} catch (Exception e) {
|
||||
@@ -737,7 +747,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
roadSizeBr = null;
|
||||
}
|
||||
} else if (msg.what == 8) {
|
||||
}
|
||||
// 处理模拟Adas汽车意图
|
||||
else if (msg.what == 8) {
|
||||
try {
|
||||
handleMockAdasCarIntent();
|
||||
} catch (Exception e) {
|
||||
@@ -788,10 +800,12 @@ public class MockIntentHandler implements IntentHandler {
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
mLocDelay += 50;
|
||||
// 这里处理自车移动,延时4秒
|
||||
if (mLocDelay > 4_000L) {
|
||||
mLocationMockHandler1.sendEmptyMessageDelayed(1, 0L);
|
||||
}
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(3, 0L);
|
||||
// 延时50毫秒重复发送自己
|
||||
mTimeTickHandler.sendEmptyMessageDelayed(0, 50L);
|
||||
}
|
||||
};
|
||||
@@ -811,6 +825,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
|
||||
private BufferedReader br;
|
||||
|
||||
/**
|
||||
* 处理模拟位置意图
|
||||
*/
|
||||
private boolean handleMockLocationIntent() throws Exception {
|
||||
if (br == null) {
|
||||
br = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("loc.txt")));
|
||||
@@ -826,12 +843,16 @@ public class MockIntentHandler implements IntentHandler {
|
||||
Log.i("mock-timer-loc-map", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo(jo);
|
||||
Log.i("mock-timer-loc", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Log.i("mock-timer-loc-info",jo.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private BufferedReader br4;
|
||||
|
||||
/**
|
||||
* 模拟快照意图
|
||||
*/
|
||||
private boolean handleMockSnapshotIntent2() throws Exception {
|
||||
if (br4 == null) {
|
||||
br4 = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("snapshot.txt")));
|
||||
@@ -862,6 +883,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
private BufferedReader[] readers = null;
|
||||
private BufferedReader[] readers2 = null;
|
||||
|
||||
/**
|
||||
* 处理模拟ADAS数据意图
|
||||
*/
|
||||
private boolean handleMockAdasIntent() throws Exception {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
@@ -889,6 +913,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理模拟Adas汽车意图
|
||||
*/
|
||||
private boolean handleMockAdasCarIntent() throws Exception {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -12,6 +13,7 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
@@ -29,22 +31,25 @@ import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.polyline.LimberCollisionPolyline;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.ICallChatResponse;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@@ -52,6 +57,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -64,7 +70,6 @@ import java.util.Map;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
IMogoOnMessageListener< MarkerResponse >,
|
||||
IMogoBizActionDoneListener,
|
||||
IMogoADASControlStatusChangedListener {
|
||||
private static final String TAG = "MapMarkerManager";
|
||||
@@ -88,8 +93,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
public static synchronized MapMarkerManager getInstance() {
|
||||
synchronized ( MapMarkerManager.class ) {
|
||||
if ( mMarkerManager == null ) {
|
||||
synchronized (MapMarkerManager.class) {
|
||||
if (mMarkerManager == null) {
|
||||
mMarkerManager = new MapMarkerManager();
|
||||
}
|
||||
}
|
||||
@@ -102,73 +107,110 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param context 上下文对象
|
||||
*/
|
||||
public void init( Context context ) {
|
||||
public void init(Context context) {
|
||||
|
||||
if ( mContext != null ) {
|
||||
if (mContext != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mContext = context.getApplicationContext();
|
||||
mRefreshModel = new RefreshModel( mContext );
|
||||
CloudPoiManager.getInstance().updateFromConfig( context );
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this );
|
||||
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this );
|
||||
mRefreshModel = new RefreshModel(mContext);
|
||||
CloudPoiManager.getInstance().updateFromConfig(context);
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener(this);
|
||||
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener(TAG, this);
|
||||
|
||||
if ( CallChatApi.getInstance().getApiProvider() != null ) {
|
||||
CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener( TAG, mContext, new ICallChatResponse() {
|
||||
if (CallChatApi.getInstance().getApiProvider() != null) {
|
||||
CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener(TAG, mContext, new ICallChatResponse() {
|
||||
|
||||
@Override
|
||||
public void userWindowStatus( boolean show ) {
|
||||
public void userWindowStatus(boolean show) {
|
||||
try {
|
||||
if ( mLastCheckMarker == null ) {
|
||||
if (mLastCheckMarker == null) {
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.equals( mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA )
|
||||
&& !show ) {
|
||||
closeMarker( mLastCheckMarker );
|
||||
if (TextUtils.equals(mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)
|
||||
&& !show) {
|
||||
closeMarker(mLastCheckMarker);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} );
|
||||
});
|
||||
}
|
||||
// 下发的数据
|
||||
MoGoAiCloudRealTime.registerOnMsgListener( new IMogoCloudOnMsgListener() {
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(new IMogoCloudOnMsgListener() {
|
||||
@Override
|
||||
public void onMsgSend( long id ) {
|
||||
DebugConfig.setStatus( DebugConfig.sDownloadLink, true );
|
||||
public void onMsgSend(long id) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadLink, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( MogoSnapshotSetData mogoSnapshotSetData ) {
|
||||
DebugConfig.setStatus( DebugConfig.sDownloadSnapshot, true );
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true);
|
||||
Message msg = mSnapshotHandler.obtainMessage();
|
||||
msg.obj = mogoSnapshotSetData;
|
||||
msg.sendToTarget();
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
// adas 每隔一秒传递的数据
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> {
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback(resultList -> {
|
||||
// 绘制近景识别到的车辆
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
//绘制他车的线 lixp TODO
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(resultList);
|
||||
|
||||
//添加自车的定位图标 TODO
|
||||
//添加自车的定位图标,碰撞只有一个预警,还需要和adas 联调,
|
||||
// for ( ADASRecognizedResult result : resultList) {
|
||||
// if (result.drawlevel == 3) { //找出可能碰撞的车
|
||||
// Logger.d("liyz", "result.drawlevel == 3 ------> ");
|
||||
//// 绘制他车的线,从列表中查出可能碰撞的车的经纬度(没有或者只有一个),然后预设20米的长度
|
||||
//// 绘制碰撞的他车指引线,需要实时给数据更新 TODO
|
||||
// drawLimberCollisionPolyline(result);
|
||||
// //通过这个传值到 AMapViewWrapper,根据数据更新自车的模型数据
|
||||
// MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(result);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
||||
private Handler mSnapshotHandler = new Handler( WorkThreadHandler.newInstance( "snapshot-thread" ).getLooper() ) {
|
||||
|
||||
/**
|
||||
* 实时绘制连线
|
||||
*
|
||||
* @param result
|
||||
*/
|
||||
private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
|
||||
if (result != null) {
|
||||
IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine();
|
||||
MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon);
|
||||
MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading);
|
||||
Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat
|
||||
+ "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading);
|
||||
if (polyLine != null) {
|
||||
Log.d(TAG, "drawStopLine polyLine != null");
|
||||
polyLine.setPoints(Arrays.asList(startLatLng, endLatlng));
|
||||
} else {
|
||||
List<MogoLatLng> latLngs = new ArrayList<>();
|
||||
latLngs.add(startLatLng);
|
||||
latLngs.add(endLatlng);
|
||||
LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs);
|
||||
}
|
||||
} else {
|
||||
LimberCollisionPolyline.getInstance().clearLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final Handler mSnapshotHandler = new Handler(WorkThreadHandler.newInstance("snapshot-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.obj instanceof MogoSnapshotSetData ) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( ( ( MogoSnapshotSetData ) msg.obj ) );
|
||||
} else if ( msg.obj == null ) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( null );
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.obj instanceof MogoSnapshotSetData) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(((MogoSnapshotSetData) msg.obj));
|
||||
} else if (msg.obj == null) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -177,32 +219,32 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 地图上的Marker点击回调
|
||||
*/
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
try {
|
||||
boolean result = switchMarkerOpenStatus( marker );
|
||||
if ( !result ) {
|
||||
updateCarUserInfoWindow( marker );
|
||||
boolean result = switchMarkerOpenStatus(marker);
|
||||
if (!result) {
|
||||
updateCarUserInfoWindow(marker);
|
||||
return false;
|
||||
}
|
||||
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
|
||||
if ( marker.getObject() instanceof MarkerShowEntity ) {
|
||||
final String sn = MarkerDrawer.getInstance().getCarSnFromMarker( marker );
|
||||
if ( TextUtils.isEmpty( sn ) ) {
|
||||
if (marker.getObject() instanceof MarkerShowEntity) {
|
||||
final String sn = MarkerDrawer.getInstance().getCarSnFromMarker(marker);
|
||||
if (TextUtils.isEmpty(sn)) {
|
||||
return false;
|
||||
}
|
||||
properties.put( "sn", sn );
|
||||
if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerExploreWay ) {
|
||||
MarkerExploreWay exploreWay = ( MarkerExploreWay ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj();
|
||||
properties.put( "dbid", exploreWay.getInfoId() );
|
||||
properties.put( "type", exploreWay.getPoiType() );
|
||||
} else if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerOnlineCar ) {
|
||||
properties.put( "type", "10000" );
|
||||
properties.put("sn", sn);
|
||||
if (((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerExploreWay) {
|
||||
MarkerExploreWay exploreWay = (MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
properties.put("dbid", exploreWay.getInfoId());
|
||||
properties.put("type", exploreWay.getPoiType());
|
||||
} else if (((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerOnlineCar) {
|
||||
properties.put("type", "10000");
|
||||
}
|
||||
}
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "v2x_road_click", properties );
|
||||
} catch ( Exception e ) {
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_road_click", properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
@@ -214,57 +256,57 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param marker 地图marker抽象对象
|
||||
* @return markerOpenStatus
|
||||
*/
|
||||
private boolean switchMarkerOpenStatus( IMogoMarker marker ) {
|
||||
if ( mLastCheckMarker != null ) {
|
||||
private boolean switchMarkerOpenStatus(IMogoMarker marker) {
|
||||
if (mLastCheckMarker != null) {
|
||||
// 判断点击的是否是同一个
|
||||
if ( marker.equals( mLastCheckMarker ) ) {
|
||||
if (marker.equals(mLastCheckMarker)) {
|
||||
return false;
|
||||
}
|
||||
// 将上次选中 Marker 设置为未选中状态
|
||||
closeMarker( mLastCheckMarker );
|
||||
closeMarker(mLastCheckMarker);
|
||||
}
|
||||
|
||||
// 将当前的Marker设置为选中
|
||||
openMarker( marker );
|
||||
openMarker(marker);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 展开气泡
|
||||
private void openMarker( IMogoMarker mogoMarker ) {
|
||||
if ( mogoMarker == null ) {
|
||||
private void openMarker(IMogoMarker mogoMarker) {
|
||||
if (mogoMarker == null) {
|
||||
return;
|
||||
}
|
||||
mLastCheckMarker = mogoMarker;
|
||||
// 在线车辆点击使用infoWindow
|
||||
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
updateCarUserInfoWindow( mogoMarker );
|
||||
if (TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
updateCarUserInfoWindow(mogoMarker);
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if ( object instanceof MarkerShowEntity ) {
|
||||
MarkerShowEntity markerShowEntity = ( MarkerShowEntity ) object;
|
||||
markerShowEntity.setChecked( true );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions() );
|
||||
markerView.setMarker( mogoMarker );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
if (object instanceof MarkerShowEntity) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(true);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
markerView.setMarker(mogoMarker);
|
||||
if (markerView instanceof OnlineCarMarkerView) {
|
||||
try {
|
||||
mogoMarker.setIcon( markerView.getBitmap( ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getCarInfo().getVehicleType() ) );
|
||||
} catch ( Exception e ) {
|
||||
mogoMarker.setIcon( markerView.getBitmap( 0 ) );
|
||||
mogoMarker.setIcon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
|
||||
} catch (Exception e) {
|
||||
mogoMarker.setIcon(markerView.getBitmap(0));
|
||||
}
|
||||
} else {
|
||||
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
mogoMarker.hideInfoWindow();
|
||||
mogoMarker.showInfoWindow();
|
||||
} else {
|
||||
mogoMarker.setIcon( ViewUtils.fromView( markerView.getView() ) );
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
}
|
||||
}
|
||||
mogoMarker.setToTop();
|
||||
}
|
||||
}
|
||||
if ( !MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( mogoMarker.getPosition(), DebugConfig.isRoadEventAnimated() );
|
||||
if (!MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus(TAG, true, false);
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter(mogoMarker.getPosition(), DebugConfig.isRoadEventAnimated());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,47 +315,47 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param marker
|
||||
*/
|
||||
private void updateCarUserInfoWindow( IMogoMarker marker ) {
|
||||
if ( marker != null && !marker.isDestroyed() ) {
|
||||
private void updateCarUserInfoWindow(IMogoMarker marker) {
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
try {
|
||||
if ( !TextUtils.equals( marker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
if (!TextUtils.equals(marker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
return;
|
||||
}
|
||||
marker.setIcon( OnlineCarMarkerView.getInstance().getSelectedBitmap( getCarVehicleType( marker ) ) );
|
||||
MarkerOnlineCar onlineCar = ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj();
|
||||
CallChatApi.getInstance().showUserWindow( mContext, onlineCar );
|
||||
} catch ( Exception e ) {
|
||||
marker.setIcon(OnlineCarMarkerView.getInstance().getSelectedBitmap(getCarVehicleType(marker)));
|
||||
MarkerOnlineCar onlineCar = (MarkerOnlineCar) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
CallChatApi.getInstance().showUserWindow(mContext, onlineCar);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 折叠气泡
|
||||
private void closeMarker( IMogoMarker mogoMarker ) {
|
||||
if ( mogoMarker == null ) {
|
||||
private void closeMarker(IMogoMarker mogoMarker) {
|
||||
if (mogoMarker == null) {
|
||||
return;
|
||||
}
|
||||
// 在线车辆点击使用infoWindow
|
||||
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
mogoMarker.setIcon( OnlineCarMarkerView.getInstance().getBitmap( getCarVehicleType( mogoMarker ) ) );
|
||||
if (TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
mogoMarker.setIcon(OnlineCarMarkerView.getInstance().getBitmap(getCarVehicleType(mogoMarker)));
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if ( object != null ) {
|
||||
MarkerShowEntity markerShowEntity = ( MarkerShowEntity ) object;
|
||||
markerShowEntity.setChecked( false );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions() );
|
||||
markerView.setMarker( mogoMarker );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
if (object != null) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(false);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
markerView.setMarker(mogoMarker);
|
||||
if (markerView instanceof OnlineCarMarkerView) {
|
||||
try {
|
||||
mogoMarker.setIcon( markerView.getBitmap( ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getCarInfo().getVehicleType() ) );
|
||||
} catch ( Exception e ) {
|
||||
mogoMarker.setIcon( markerView.getBitmap( 0 ) );
|
||||
mogoMarker.setIcon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
|
||||
} catch (Exception e) {
|
||||
mogoMarker.setIcon(markerView.getBitmap(0));
|
||||
}
|
||||
} else {
|
||||
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
mogoMarker.hideInfoWindow();
|
||||
mogoMarker.showInfoWindow();
|
||||
} else {
|
||||
mogoMarker.setIcon( ViewUtils.fromView( markerView.getView() ) );
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,38 +368,38 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param marker
|
||||
* @return
|
||||
*/
|
||||
private int getCarVehicleType( IMogoMarker marker ) {
|
||||
private int getCarVehicleType(IMogoMarker marker) {
|
||||
try {
|
||||
return ( ( MarkerOnlineCar )
|
||||
( ( MarkerShowEntity ) marker.getObject() ).getBindObj() )
|
||||
return ((MarkerOnlineCar)
|
||||
((MarkerShowEntity) marker.getObject()).getBindObj())
|
||||
.getCarInfo()
|
||||
.getVehicleType();
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 绘制Marker
|
||||
public synchronized void drawMapMarker( MarkerResponse response ) {
|
||||
public synchronized void drawMapMarker(MarkerResponse response) {
|
||||
|
||||
if ( response == null || response.getResult() == null ) {
|
||||
if (response == null || response.getResult() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
|
||||
mLastDataResult = response.getResult();
|
||||
UiThreadHandler.post( this::dispatchDataToBiz );
|
||||
UiThreadHandler.post(this::dispatchDataToBiz);
|
||||
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
drawMarkerByCurrentType(mLastDataResult);
|
||||
|
||||
// 在首页时才埋点
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
|
||||
trackData( mLastDataResult );
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume()) {
|
||||
trackData(mLastDataResult);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,17 +408,21 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private synchronized void drawMarkerByCurrentType( MarkerCardResult markerCardResult ) {
|
||||
private synchronized void drawMarkerByCurrentType(MarkerCardResult markerCardResult) {
|
||||
|
||||
if ( markerCardResult == null ) {
|
||||
if (markerCardResult == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawAllMarker( markerCardResult );
|
||||
if (MarkerServiceHandler.getMapUIController().getCurrentMapVisualAngle().isLongSight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawAllMarker(markerCardResult);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -384,9 +430,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private void drawAllMarker( MarkerCardResult markerCardResult ) {
|
||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
||||
RoadConditionDrawer.getInstance().drawRoadConditionMarker( exploreWayList, ServiceConst.MAX_AMOUNT_ALL, this );
|
||||
private void drawAllMarker(MarkerCardResult markerCardResult) {
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
RoadConditionDrawer.getInstance().drawRoadConditionMarker(exploreWayList, ServiceConst.MAX_AMOUNT_ALL, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,51 +440,51 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private void trackData( MarkerCardResult markerCardResult ) {
|
||||
if ( markerCardResult == null ) {
|
||||
private void trackData(MarkerCardResult markerCardResult) {
|
||||
if (markerCardResult == null) {
|
||||
return;
|
||||
}
|
||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
|
||||
JSONArray array = new JSONArray();
|
||||
int size = 0;
|
||||
size = exploreWayList == null ? 0 : exploreWayList.size();
|
||||
final Map< String, Integer > typeCounterMap = new HashMap<>();
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get( i );
|
||||
final Map<String, Integer> typeCounterMap = new HashMap<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get(i);
|
||||
String poiType = exploreWay.getPoiType();
|
||||
int counter = 0;
|
||||
if ( !typeCounterMap.containsKey( poiType ) ) {
|
||||
if (!typeCounterMap.containsKey(poiType)) {
|
||||
counter = 0;
|
||||
} else {
|
||||
counter = typeCounterMap.get( poiType );
|
||||
counter = typeCounterMap.get(poiType);
|
||||
}
|
||||
typeCounterMap.put( poiType, counter + 1 );
|
||||
typeCounterMap.put(poiType, counter + 1);
|
||||
}
|
||||
if ( !typeCounterMap.isEmpty() ) {
|
||||
for ( Map.Entry< String, Integer > entry : typeCounterMap.entrySet() ) {
|
||||
if ( entry == null || entry.getKey() == null ) {
|
||||
if (!typeCounterMap.isEmpty()) {
|
||||
for (Map.Entry<String, Integer> entry : typeCounterMap.entrySet()) {
|
||||
if (entry == null || entry.getKey() == null) {
|
||||
continue;
|
||||
}
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put( "type", entry.getKey() );
|
||||
object.put( "num", entry.getValue() );
|
||||
array.put( object );
|
||||
} catch ( JSONException e ) {
|
||||
object.put("type", entry.getKey());
|
||||
object.put("num", entry.getValue());
|
||||
array.put(object);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if ( array.length() == 0 ) {
|
||||
if (array.length() == 0) {
|
||||
return;
|
||||
}
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "data", array.toString() );
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "v2x_data_get", properties );
|
||||
} catch ( Exception e ) {
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("data", array.toString());
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_data_get", properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -449,11 +495,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 仅在数据刷新的时候分发
|
||||
*/
|
||||
private void dispatchDataToBiz() {
|
||||
if ( mLastDataResult == null ) {
|
||||
if (mLastDataResult == null) {
|
||||
return;
|
||||
}
|
||||
List< MarkerExploreWay > exploreWayList = mLastDataResult.getExploreWay();
|
||||
dispatchDataToBis( ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList );
|
||||
List<MarkerExploreWay> exploreWayList = mLastDataResult.getExploreWay();
|
||||
dispatchDataToBis(ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,13 +508,13 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param biz
|
||||
* @param object
|
||||
*/
|
||||
private void dispatchDataToBis( String biz, Object object ) {
|
||||
if ( TextUtils.isEmpty( biz ) ) {
|
||||
private void dispatchDataToBis(String biz, Object object) {
|
||||
if (TextUtils.isEmpty(biz)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
MarkerServiceHandler.getDataManager().syncData( biz, object );
|
||||
} catch ( Exception e ) {
|
||||
MarkerServiceHandler.getDataManager().syncData(biz, object);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -479,41 +525,28 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param markerShowEntity marker 绘制数据实体
|
||||
* @return 绘制的Marker
|
||||
*/
|
||||
public synchronized IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity, int zIndex ) {
|
||||
public synchronized IMogoMarker drawMapMarker(MarkerShowEntity markerShowEntity, int zIndex) {
|
||||
try {
|
||||
return MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, zIndex, this );
|
||||
} catch ( Exception e ) {
|
||||
return MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, zIndex, this);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class< MarkerResponse > target() {
|
||||
return MarkerResponse.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( final MarkerResponse response ) {
|
||||
if ( ignoreDrawRequest() ) {
|
||||
return;
|
||||
}
|
||||
runOnTargetThread( () -> {
|
||||
drawMapMarker( response );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步绘制大而全的数据 marker
|
||||
*
|
||||
* @param response
|
||||
*/
|
||||
public void onSyncMarkerResponse( MarkerResponse response ) {
|
||||
if ( ignoreDrawRequest() ) {
|
||||
public void onSyncMarkerResponse(MarkerResponse response) {
|
||||
Logger.d(TAG, "onSyncMarkerResponse response ");
|
||||
if (ignoreDrawRequest()) {
|
||||
Logger.d(TAG, "onSyncMarkerResponse ignoreDraw ");
|
||||
return;
|
||||
}
|
||||
runOnTargetThread( () -> {
|
||||
drawMapMarker( response );
|
||||
} );
|
||||
runOnTargetThread(() -> {
|
||||
drawMapMarker(response);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -522,8 +555,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param lon
|
||||
* @param lat
|
||||
*/
|
||||
public void syncLocation( double lon, double lat ) {
|
||||
mCarLatLng = new MogoLatLng( lat, lon );
|
||||
public void syncLocation(double lon, double lat) {
|
||||
mCarLatLng = new MogoLatLng(lat, lon);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -531,9 +564,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param latlng
|
||||
*/
|
||||
public void getOnlineCarDataByAutoRefreshStrategy( MogoLatLng latlng ) {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
getOnlineCarDataImpl( latlng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
|
||||
public void getOnlineCarDataByAutoRefreshStrategy(MogoLatLng latlng) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
getOnlineCarDataImpl(latlng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -543,19 +576,19 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param limit
|
||||
* @param radius
|
||||
*/
|
||||
public void getOnlineCarDataByVoiceControl( MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius ) {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
getOnlineCarDataImpl( latLng, onlyFocus, onlySameCity, limit, radius, true );
|
||||
public void getOnlineCarDataByVoiceControl(MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
getOnlineCarDataImpl(latLng, onlyFocus, onlySameCity, limit, radius, true);
|
||||
}
|
||||
|
||||
private final Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getOnlineCarDataImpl( mCarLatLng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
|
||||
getOnlineCarDataImpl(mCarLatLng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -563,7 +596,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 移除绘制
|
||||
*/
|
||||
public void stopAutoRefresh() {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -582,81 +615,81 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius,
|
||||
boolean fitBounds ) {
|
||||
boolean fitBounds) {
|
||||
|
||||
// if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {//todo 实时在线车辆需要注释,否则在2D模式下不能展示
|
||||
// return;
|
||||
// }
|
||||
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
if ( !DebugConfig.isRequestOnlineCarData() ) {
|
||||
if (DebugConfig.isDebug()) {
|
||||
if (!DebugConfig.isRequestOnlineCarData()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( mCarLatLng == null ) {
|
||||
if (mCarLatLng == null) {
|
||||
mCarLatLng = latLng;
|
||||
}
|
||||
|
||||
if ( latLng == null ) {
|
||||
if (latLng == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ignoreOnlineCarRequest() ) {
|
||||
if (ignoreOnlineCarRequest()) {
|
||||
removeCarMarkers();
|
||||
return;
|
||||
}
|
||||
|
||||
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() {
|
||||
mRefreshModel.queryOnLineCarWithRoute(latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object o ) {
|
||||
MarkerResponse data = ( MarkerResponse ) o;
|
||||
public void onSuccess(Object o) {
|
||||
MarkerResponse data = (MarkerResponse) o;
|
||||
MarkerCardResult result = data.getResult();
|
||||
if ( result == null ) {
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List< MarkerOnlineCar > onlineCarList = result.getOnlineCar();
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
final int size = onlineCarList == null ? 0 : onlineCarList.size();
|
||||
|
||||
if ( mMarkerDisplayBounds == null ) {
|
||||
if (mMarkerDisplayBounds == null) {
|
||||
mMarkerDisplayBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_leftMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_topMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_rightMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_bottomMargin )
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_leftMargin),
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_topMargin),
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_rightMargin),
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_bottomMargin)
|
||||
);
|
||||
}
|
||||
|
||||
runOnTargetThread( () -> {
|
||||
trackData( size );
|
||||
OnlineCarDrawer.getInstance().drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng, MapMarkerManager.this );
|
||||
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
|
||||
} );
|
||||
runOnTargetThread(() -> {
|
||||
trackData(size);
|
||||
OnlineCarDrawer.getInstance().drawOnlineCarMarkers(onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng, MapMarkerManager.this);
|
||||
UiThreadHandler.postDelayed(runnable, SMOOTH_DURATION * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
private void trackData( int size ) {
|
||||
private void trackData(int size) {
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put( "type", "10000" );
|
||||
object.put( "num", size );
|
||||
array.put( object );
|
||||
} catch ( JSONException e ) {
|
||||
object.put("type", "10000");
|
||||
object.put("num", size);
|
||||
array.put(object);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if ( array.length() == 0 ) {
|
||||
if (array.length() == 0) {
|
||||
return;
|
||||
}
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "data", array.toString() );
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "v2x_data_get", properties );
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("data", array.toString());
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_data_get", properties);
|
||||
}
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -672,7 +705,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 移除在线车辆 marker
|
||||
*/
|
||||
private void removeCarMarkers() {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers(ModuleNames.CARD_TYPE_USER_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -685,14 +718,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|| MarkerServiceHandler.getMogoStatusManager().isV2XShow()
|
||||
|| !MarkerServiceHandler.getMogoStatusManager().isMainPageLaunched()
|
||||
|| !MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume()
|
||||
|| MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode();
|
||||
|| MarkerServiceHandler.getMapUIController().getCurrentMapVisualAngle().isLongSight();
|
||||
}
|
||||
|
||||
private void runOnTargetThread( Runnable runnable ) {
|
||||
if ( runnable == null ) {
|
||||
private void runOnTargetThread(Runnable runnable) {
|
||||
if (runnable == null) {
|
||||
return;
|
||||
}
|
||||
ThreadPoolService.execute( runnable );
|
||||
ThreadPoolService.execute(runnable);
|
||||
}
|
||||
|
||||
public String getCurrentModuleName() {
|
||||
@@ -700,25 +733,25 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBizActionDone( String biz, int position, Object data ) {
|
||||
if ( data instanceof MarkerShowEntity && ( ( MarkerShowEntity ) data ).getMarker() != null ) {
|
||||
switchMarkerOpenStatus( ( ( MarkerShowEntity ) data ).getMarker() );
|
||||
public void onBizActionDone(String biz, int position, Object data) {
|
||||
if (data instanceof MarkerShowEntity && ((MarkerShowEntity) data).getMarker() != null) {
|
||||
switchMarkerOpenStatus(((MarkerShowEntity) data).getMarker());
|
||||
} else {
|
||||
IMogoMarkerManager markerManager = MarkerServiceHandler.getMarkerManager();
|
||||
List< IMogoMarker > markers = markerManager.getMarkers( biz );
|
||||
if ( markers != null ) {
|
||||
List<IMogoMarker> markers = markerManager.getMarkers(biz);
|
||||
if (markers != null) {
|
||||
try {
|
||||
IMogoMarker marker = markers.get( position );
|
||||
switchMarkerOpenStatus( marker );
|
||||
} catch ( Exception e ) {
|
||||
IMogoMarker marker = markers.get(position);
|
||||
switchMarkerOpenStatus(marker);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged( EnumMapUI mapUI ) {
|
||||
switch ( mapUI ) {
|
||||
public void onMapUiModeChanged(EnumMapUI mapUI) {
|
||||
switch (mapUI) {
|
||||
case Type_Light:
|
||||
case Type_Night:
|
||||
redrawMarkerByStyleChanged();
|
||||
@@ -730,12 +763,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 重绘内容
|
||||
*/
|
||||
public void redrawMarkerByStyleChanged() {
|
||||
if ( mLastDataResult != null ) {
|
||||
runOnTargetThread( () -> {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_ROAD_CONDITION );
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
if (mLastDataResult != null) {
|
||||
runOnTargetThread(() -> {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers(ModuleNames.CARD_TYPE_ROAD_CONDITION);
|
||||
drawMarkerByCurrentType(mLastDataResult);
|
||||
mLastCheckMarker = null;
|
||||
} );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -743,8 +776,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 关闭当前点击过的 marker
|
||||
*/
|
||||
public void onCloseCurrentSelectedMarker() {
|
||||
if ( mLastCheckMarker != null && !mLastCheckMarker.isDestroyed() ) {
|
||||
closeMarker( mLastCheckMarker );
|
||||
if (mLastCheckMarker != null && !mLastCheckMarker.isDestroyed()) {
|
||||
closeMarker(mLastCheckMarker);
|
||||
mLastCheckMarker = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.mogo.module.service.polyline;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 前车碰撞的画线
|
||||
* @since 2021/4/25
|
||||
*/
|
||||
public class LimberCollisionPolyline {
|
||||
|
||||
private volatile static LimberCollisionPolyline mInstance = null;
|
||||
|
||||
private IMogoPolyline mMoGoPolyline;
|
||||
// 连接线参数
|
||||
private MogoPolylineOptions mPolylineOptions;
|
||||
// 线路径集合
|
||||
private List<MogoLatLng> mPolylinePointList;
|
||||
|
||||
|
||||
public static LimberCollisionPolyline getInstance() {
|
||||
if (mInstance == null) {
|
||||
synchronized (LimberCollisionPolyline.class) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new LimberCollisionPolyline();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
protected LimberCollisionPolyline() {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
// 绘制路径集合
|
||||
mPolylinePointList = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
public IMogoPolyline draw(float width, List<MogoLatLng> polylinePoint) {
|
||||
try {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
}
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
// colors.add(0x0DE32F46);
|
||||
colors.add(0xD9E32F46);
|
||||
colors.add(0x0DE32F46);
|
||||
|
||||
// 线条粗细,渐变,渐变色值 TODO liyz 宽度需要传过来
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
for (int i = 0; i < polylinePoint.size(); i++) {
|
||||
options.add(polylinePoint.get(i));
|
||||
}
|
||||
// 绘制线的对象
|
||||
mMoGoPolyline = MarkerServiceHandler.getsIMogoOverlayManager().addPolyline(options);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
|
||||
public IMogoPolyline getPolyLine() {
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
public void clearLine() {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mMoGoPolyline = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
Logger.d( TAG, action );
|
||||
//Logger.d( TAG, action );
|
||||
if (TextUtils.equals(VOICE_ACTION, action)) {
|
||||
String cmd = intent.getStringExtra(PARAM_COMMAND);
|
||||
if (!TextUtils.isEmpty(cmd)) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerExploreWayItem;
|
||||
@@ -34,7 +35,6 @@ import com.mogo.module.common.utils.Const;
|
||||
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
|
||||
import com.mogo.module.v2x.network.V2XRefreshCallback;
|
||||
import com.mogo.module.v2x.receiver.AdasDataBroadcastReceiver;
|
||||
import com.mogo.module.v2x.receiver.SceneBroadcastReceiver;
|
||||
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz;
|
||||
@@ -276,25 +276,26 @@ public class V2XModuleProvider implements
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 响应违章停车的POI点击
|
||||
V2XServiceManager
|
||||
.getMogoRegisterCenter()
|
||||
.registerMogoMarkerClickListener(V2XConst.MODULE_NAME,
|
||||
marker -> {
|
||||
try {
|
||||
MarkerExploreWay markerExploreWay =
|
||||
(MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
Logger.d(V2XConst.MODULE_NAME,
|
||||
"V2X===违章停车:onMarkerClicked=" + markerExploreWay);
|
||||
.registerMogoMarkerClickListener(V2XConst.MODULE_NAME, new IMogoMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
try {
|
||||
MarkerExploreWay markerExploreWay =
|
||||
(MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
Logger.d(V2XConst.MODULE_NAME,
|
||||
"V2X===违章停车:onMarkerClicked=" + markerExploreWay);
|
||||
|
||||
//直接展示弹窗
|
||||
V2XIllegalParkWindow parkScenario = new V2XIllegalParkWindow();
|
||||
parkScenario.show(markerExploreWay, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//直接展示弹窗
|
||||
V2XIllegalParkWindow parkScenario = new V2XIllegalParkWindow();
|
||||
parkScenario.show(markerExploreWay, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// 注册V2X场景Socket
|
||||
@@ -429,4 +430,14 @@ public class V2XModuleProvider implements
|
||||
public void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
//todo visual 涉及到V2X,V2N业务,视距状态切换回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.mogo.module.v2x.listener.V2XMessageListener_401009;
|
||||
import com.mogo.module.v2x.listener.V2XMessageListener_401010;
|
||||
import com.mogo.module.v2x.listener.V2XMessageListener_401011;
|
||||
import com.mogo.module.v2x.listener.V2XMessageListener_401012;
|
||||
import com.mogo.module.v2x.listener.V2XMessageListener_401020;
|
||||
import com.mogo.module.v2x.listener.V2XMessageListener_402000;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
@@ -33,7 +33,7 @@ public class V2XSocketManager {
|
||||
private V2XMessageListener_401007 v2XMessageListener_401007;
|
||||
private V2XMessageListener_401009 v2XMessageListener_401009;
|
||||
private V2XMessageListener_401010 v2XMessageListener_401010;
|
||||
private V2XMessageListener_401020 mV2XMessageListener_401020;
|
||||
private V2XMessageListener_402000 mV2XMessageListener_402000;
|
||||
|
||||
|
||||
private V2XSocketManager() {
|
||||
@@ -64,7 +64,7 @@ public class V2XSocketManager {
|
||||
}
|
||||
register401007();
|
||||
register401009();
|
||||
register401019();
|
||||
register401020();
|
||||
|
||||
// TODO 这里是前瞻需求,量产版本需要注释
|
||||
register401003();
|
||||
@@ -112,10 +112,10 @@ public class V2XSocketManager {
|
||||
.getMoGoSocketManager()
|
||||
.unregisterOnMessageListener(401009, v2XMessageListener_401009);
|
||||
}
|
||||
if (mV2XMessageListener_401020 != null) {
|
||||
if (mV2XMessageListener_402000 != null) {
|
||||
V2XServiceManager
|
||||
.getMoGoSocketManager()
|
||||
.unregisterOnMessageListener(401019, mV2XMessageListener_401020);
|
||||
.unregisterOnMessageListener(402000, mV2XMessageListener_402000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,14 +230,14 @@ public class V2XSocketManager {
|
||||
* * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52829799
|
||||
* * 最优路线推荐
|
||||
*/
|
||||
public void register401019() {
|
||||
mV2XMessageListener_401020 = new V2XMessageListener_401020();
|
||||
public void register401020() {
|
||||
mV2XMessageListener_402000 = new V2XMessageListener_402000();
|
||||
// 道路事件,在线车辆绘制
|
||||
V2XServiceManager
|
||||
.getMoGoSocketManager()
|
||||
.registerOnMessageListener(
|
||||
401020,
|
||||
mV2XMessageListener_401020
|
||||
402000,
|
||||
mV2XMessageListener_402000
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class V2XStatusManager {
|
||||
if (mLocation == null) {
|
||||
mLocation = new MogoLocation();
|
||||
}
|
||||
Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString());
|
||||
//Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString());
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,44 +4,20 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.drawer.marker.AheadCollisionView;
|
||||
import com.mogo.module.common.drawer.marker.AheadCollisionWindow3DAdapter;
|
||||
import com.mogo.module.common.drawer.marker.EmptyMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.module.common.view.MarkerBaseFloor;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.listener.V2XWarnMessageListener;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
|
||||
/**
|
||||
* desc : V2X报警事件管理,这里进行报警事件的分发处理,包括了adas数据
|
||||
*/
|
||||
public class V2XWaringManager {
|
||||
|
||||
List<MogoLatLng> lonLats = new ArrayList<>();
|
||||
private Context mContext;
|
||||
|
||||
private static V2XWaringManager mV2XWaringManager;
|
||||
@@ -84,7 +60,7 @@ public class V2XWaringManager {
|
||||
private void testData(String adasResult) {
|
||||
|
||||
try {
|
||||
int id = R.raw.scenario_warning_event_data;
|
||||
int id = R.raw.scenario_warning_event_data_right;
|
||||
switch (adasResult) {
|
||||
case "left":
|
||||
id = R.raw.scenario_warning_event_data_left;
|
||||
@@ -111,7 +87,6 @@ public class V2XWaringManager {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,43 +126,6 @@ public class V2XWaringManager {
|
||||
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
//测试数据
|
||||
testData(adasResult);
|
||||
|
||||
// adas 每隔一秒传递的他车或行人数据,避免重复。
|
||||
// V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
|
||||
// // 处理他车车身变色,这个可以使用 TODO
|
||||
// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
//
|
||||
// // adas自车定位,显示红色碰撞预警图,以及解除碰撞
|
||||
// double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
// double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
// //需要把自车的经纬度前移到车头,然后打点红色的marker
|
||||
//
|
||||
// } );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加2d的碰撞 marker
|
||||
*
|
||||
* @param markerShowEntity
|
||||
* @return
|
||||
*/
|
||||
private IMogoMarker drawMarker2dResource(MarkerShowEntity markerShowEntity) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(markerShowEntity.getMarkerLocation().getLat(), markerShowEntity.getMarkerLocation().getLon());
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180);
|
||||
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
|
||||
.latitude(newLocation.getLat())
|
||||
.longitude(newLocation.getLon())
|
||||
.anchor(1.0f, 1.0f)
|
||||
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
|
||||
optionsRipple
|
||||
.icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), optionsRipple);
|
||||
|
||||
marker.setInfoWindowAdapter(new AheadCollisionWindow3DAdapter(mContext));
|
||||
marker.showInfoWindow();
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,9 +31,13 @@ public class V2XOptimalRouteDataRes implements Serializable {
|
||||
*/
|
||||
private int most_lane_num;
|
||||
/**
|
||||
* 线性经纬度轨迹列表
|
||||
* Wgs84坐标系,线性经纬度轨迹列表
|
||||
**/
|
||||
private List<MogoLatLng> locus_list;
|
||||
/**
|
||||
* 高德坐标系Gcj,线性经纬度轨迹列表
|
||||
**/
|
||||
private List<MogoLatLng> gd_locus_list;
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
@@ -90,4 +94,12 @@ public class V2XOptimalRouteDataRes implements Serializable {
|
||||
public void setLocus_list(List<MogoLatLng> locus_list) {
|
||||
this.locus_list = locus_list;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getGd_locus_list() {
|
||||
return gd_locus_list;
|
||||
}
|
||||
|
||||
public void setGd_locus_list(List<MogoLatLng> gd_locus_list) {
|
||||
this.gd_locus_list = gd_locus_list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* @description 车路云—场景预警-云下发数据监听 最优路线推荐
|
||||
* @since: 2021/4/13
|
||||
*/
|
||||
public class V2XMessageListener_401020 implements IMogoOnMessageListener<V2XOptimalRouteDataRes> {
|
||||
public class V2XMessageListener_402000 implements IMogoOnMessageListener<V2XOptimalRouteDataRes> {
|
||||
@Override
|
||||
public Class target() {
|
||||
return V2XOptimalRouteDataRes.class;
|
||||
@@ -29,12 +29,11 @@ public class V2XMessageListener_401020 implements IMogoOnMessageListener<V2XOpti
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(V2XOptimalRouteDataRes message) {
|
||||
Logger.i(MODULE_NAME, "V2XMessageListener_401020:" + message);
|
||||
// 将接收到的数据转换成最优车道推荐的场景数据
|
||||
|
||||
if (message != null
|
||||
&& message.getLocus_list() != null
|
||||
&& !message.getLocus_list().isEmpty()) {
|
||||
&& message.getGd_locus_list() != null
|
||||
&& !message.getGd_locus_list().isEmpty()) {
|
||||
Logger.i(MODULE_NAME, "V2XMessageListener_402000:" + GsonUtil.jsonFromObject(message));
|
||||
|
||||
V2XMessageEntity<V2XOptimalRouteDataRes> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
@@ -37,7 +37,7 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
|
||||
}
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
MogoPolylineOptions options = new MogoPolylineOptions().setGps(false);
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
@@ -37,7 +37,8 @@ public class MoGoStopPolylineManager implements IMoGoStopPolylineManager {
|
||||
}
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
MogoPolylineOptions options = new MogoPolylineOptions()
|
||||
.setGps(true);
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
colors.add(0x0DE32F46);
|
||||
colors.add(0xD9E32F46);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
private static String WARNING_ARROWS = "WARNING_ARROWS";
|
||||
private V2XWarningEntity mCloundWarningInfo;
|
||||
private static String TAG = "MoGoV2XCloundDataManager";
|
||||
private boolean isSelfLineClear;
|
||||
private boolean isSelfLineClear = true;//绘制线是否已被清除
|
||||
private List fillPoints = new ArrayList();//停止线经纬度合集
|
||||
private boolean isFirstLocation = false;
|
||||
private MogoLatLng carLocation = new MogoLatLng(
|
||||
@@ -58,7 +58,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
private MogoLatLng middleLocationInStopLine;
|
||||
private V2XFrontWarningScenario mV2XScenario;
|
||||
|
||||
private static long showTime = 0;
|
||||
private static long showTime = 4000;
|
||||
private float bearing;
|
||||
|
||||
|
||||
@@ -89,6 +89,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
||||
if (cloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) { //前方 TODO
|
||||
middleLocationInStopLine = getMiddleLocationInStopLine();
|
||||
//如果是正前方类型,红色绘制区域从停止线向前绘制50米
|
||||
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, cloundWarningInfo.getAngle());
|
||||
//停止线前方画线
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
@@ -100,7 +101,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
//添加停止线marker
|
||||
handleStopLine();
|
||||
//自车画线
|
||||
drawSlefCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
}, 500);
|
||||
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
@@ -119,7 +120,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
||||
|
||||
//车辆静止的时候
|
||||
drawSlefCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
|
||||
}, 500);
|
||||
|
||||
@@ -133,6 +134,55 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警)
|
||||
*/
|
||||
private void drawSelfCarLine(double lon, double lat, float bearing) {
|
||||
if (!isSelfLineClear) {
|
||||
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
if (mCloundWarningInfo != null) {
|
||||
MogoLatLng startLatlng = null;
|
||||
MogoLatLng endLatlng = null;
|
||||
MogoLatLng addMiddleLoc = null;
|
||||
|
||||
if (!isFirstLocation) {
|
||||
carLocation = getMogoLat(new MogoLatLng(lat, lon));
|
||||
isFirstLocation = true;
|
||||
}
|
||||
//绘制线的终点(在停止线上或者预碰撞点上)
|
||||
|
||||
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
|
||||
mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
|
||||
//自车位置
|
||||
startLatlng = new MogoLatLng(lat, lon);
|
||||
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
|
||||
//扩展点为了渐变色添加
|
||||
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
|
||||
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lon + "," + startLatlng.lat +
|
||||
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
|
||||
|
||||
if (mogoPolyline != null) {
|
||||
mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
|
||||
mogoPolyline.setTransparency(0.5f);
|
||||
} else {
|
||||
DrawLineInfo info = new DrawLineInfo(); // 对象
|
||||
Log.d(TAG, "安全区域的画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
List locations = new ArrayList();
|
||||
locations.add(startLatlng);
|
||||
locations.add(addMiddleLoc);
|
||||
locations.add(endLatlng);
|
||||
info.setLocations(locations);
|
||||
info.setHeading(bearing);
|
||||
info.setWidth(mCloundWarningInfo.getRoadwidth() * 14 + 5);
|
||||
info.setDirection(mCloundWarningInfo.getDirection());
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
|
||||
}
|
||||
} else {
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 停止线绘制
|
||||
* */
|
||||
@@ -145,8 +195,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
MogoLatLng latLng = (MogoLatLng) fillPoints.get(i);
|
||||
entity.setLat(latLng.lat);
|
||||
entity.setLon(latLng.lon);
|
||||
entity.setCollisionLat(mCloundWarningInfo.getCollisionLat());
|
||||
entity.setCollisionLon(mCloundWarningInfo.getCollisionLon());
|
||||
entity.heading = mCloundWarningInfo.heading;
|
||||
V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
|
||||
}
|
||||
@@ -159,7 +207,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
/**
|
||||
* 场景如:车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
|
||||
*/
|
||||
private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng startLatLng, MogoLatLng mogoLatLng) {
|
||||
private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng
|
||||
startLatLng, MogoLatLng mogoLatLng) {
|
||||
if (info != null) {
|
||||
IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline();
|
||||
MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon);
|
||||
@@ -257,70 +306,25 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
|
||||
/**
|
||||
* 自车定位 移动完成需要 3s消失,这里何时清理,应该是没有数据的时候
|
||||
* 地图侧回调回的定位Location为高德坐标
|
||||
*/
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 lat = " + latLng.getLatitude() + "--lon =" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() && isSelfLineClear == false) {
|
||||
//当行人经纬度交点 开始画线,否则清理
|
||||
if (mCloundWarningInfo != null) {
|
||||
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
||||
}
|
||||
drawSlefCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
|
||||
drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
|
||||
}
|
||||
carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
Log.d("车行驶的轨迹---", String.valueOf(latLng.getLongitude()) + "," + String.valueOf(latLng.getLatitude()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLatLng latLng) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警)
|
||||
*/
|
||||
private void drawSlefCarLine(double lon, double lat, float bearing) {
|
||||
if (!isSelfLineClear) {
|
||||
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
if (mCloundWarningInfo != null) {
|
||||
MogoLatLng startLatlng = null;
|
||||
MogoLatLng endLatlng = null;
|
||||
MogoLatLng addMiddleLoc = null;
|
||||
|
||||
if (!isFirstLocation) {
|
||||
carLocation = getMogoLat(new MogoLatLng(lat, lon));
|
||||
isFirstLocation = true;
|
||||
}
|
||||
|
||||
//自车位置
|
||||
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
|
||||
mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
|
||||
startLatlng = new MogoLatLng(lat, lon);
|
||||
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
|
||||
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
|
||||
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lat + "," + startLatlng.lon +
|
||||
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
|
||||
|
||||
if (mogoPolyline != null) {
|
||||
mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
|
||||
mogoPolyline.setTransparency(0.5f);
|
||||
} else {
|
||||
DrawLineInfo info = new DrawLineInfo(); // 对象
|
||||
Log.d(TAG, "安全区域的画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
List locations = new ArrayList();
|
||||
locations.add(startLatlng);
|
||||
locations.add(addMiddleLoc);
|
||||
locations.add(endLatlng);
|
||||
info.setLocations(locations);
|
||||
info.setHeading(bearing);
|
||||
info.setWidth(mCloundWarningInfo.getRoadwidth() * 14 + 5);
|
||||
info.setDirection(mCloundWarningInfo.getDirection());
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
|
||||
}
|
||||
} else {
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 补点后的停止线经纬度合集
|
||||
|
||||
@@ -39,7 +39,7 @@ public class MoGoV2XPolylineManager implements IMoGoV2XPolylineManager {
|
||||
&& !V2XServiceManager.getMoGoStatusManager().isVrMode()
|
||||
) {
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
MogoPolylineOptions options = new MogoPolylineOptions().setGps(true);
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
@@ -41,7 +41,8 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
}
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
MogoPolylineOptions options = new MogoPolylineOptions()
|
||||
.setGps(false);
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
if (info.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) {
|
||||
@@ -56,7 +57,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth());
|
||||
// 线条粗细,渐变,渐变色值
|
||||
// 当前车辆位置
|
||||
options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors);
|
||||
List<MogoLatLng> locations = info.getLocations();
|
||||
for (int i = 0; i < locations.size(); i++) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user