机器视觉地图绘制点
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// IMachineVisionInterface.aidl
|
||||
package com.mogo.module.common.machinevision;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
|
||||
// Declare any non-default types here with import statements
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.module.common.constants;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/27
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class AdasRecognizedType {
|
||||
//背景
|
||||
public static final int classIdBackground = 0;
|
||||
//人
|
||||
public static final int classIdPerson = 1;
|
||||
//自行车
|
||||
public static final int classIdBicycle = 2;
|
||||
//小轿车
|
||||
public static final int classIdCar = 3;
|
||||
//摩托车
|
||||
public static final int classIdMoto = 4;
|
||||
//红绿灯
|
||||
public static final int classIdTrafficSign = 5;
|
||||
//bus
|
||||
public static final int classIdTrafficBus = 6;
|
||||
//track
|
||||
public static final int classIdTrafficTruck = 8;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.module.common.constants;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/28
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class DataTypes {
|
||||
/**
|
||||
* adas识别数据
|
||||
*/
|
||||
public static final String TYPE_MARKER_ADAS = "TYPE_MARKER_ADAS";
|
||||
|
||||
/**
|
||||
* 云端下发数据
|
||||
*/
|
||||
public static final String TYPE_MARKER_CLOUD_DATA = "TYPE_MARKER_CLOUD_DATA";
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service.marker;
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
@@ -8,9 +8,10 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -61,7 +62,7 @@ class AdasRecognizedResultDrawer {
|
||||
|
||||
public void renderAdasRecognizedResult( List< ADASRecognizedListResult > resultList ) {
|
||||
if ( resultList == null || resultList.isEmpty() ) {
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers( ServiceConst.TYPE_MARKER_ADAS );
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers( DataTypes.TYPE_MARKER_ADAS );
|
||||
return;
|
||||
}
|
||||
purgeAdasRecognizedData( resultList );
|
||||
@@ -79,9 +80,9 @@ class AdasRecognizedResultDrawer {
|
||||
mAdasRecognizedMarkersCaches.put( uniqueKey, marker );
|
||||
}
|
||||
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
if ( recognizedListResult.latLonList != null
|
||||
|| recognizedListResult.latLonList.size() > 1 ) {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
for ( int j = 0; j < recognizedListResult.latLonList.size(); j++ ) {
|
||||
ADASRecognizedListResult.LatLon latLon = recognizedListResult.latLonList.get( j );
|
||||
if ( latLon == null ) {
|
||||
@@ -89,11 +90,19 @@ class AdasRecognizedResultDrawer {
|
||||
}
|
||||
points.add( new MogoLatLng( latLon.lat, latLon.lon ) );
|
||||
}
|
||||
if ( points.size() >= 1 ) {
|
||||
marker.startSmooth( points, 1000 );
|
||||
} else {
|
||||
|
||||
} else {
|
||||
// 原来的点和新的点做一个数组进行平滑移动
|
||||
MogoLatLng latLng = marker.getPosition();
|
||||
ADASRecognizedListResult.LatLon latLon = recognizedListResult.latLonList.get( 0 );
|
||||
if ( latLon == null ) {
|
||||
continue;
|
||||
}
|
||||
points.add( latLng );
|
||||
points.add( new MogoLatLng( latLng.lat, latLon.lon ) );
|
||||
}
|
||||
if ( points.size() >= 1 ) {
|
||||
marker.startSmooth( points, 1000 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,9 +152,9 @@ class AdasRecognizedResultDrawer {
|
||||
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( ServiceConst.TYPE_MARKER_ADAS )
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.icon( BitmapFactory.decodeResource( mContext.getResources(), R.drawable.map_custom_ic_current_location2 ) )
|
||||
.position( new MogoLatLng( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon ) );
|
||||
return MarkerServiceHandler.getMapService().getMarkerManager( mContext ).addMarker( ModuleNames.CARD_TYPE_ROAD_CONDITION, options );
|
||||
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( ModuleNames.CARD_TYPE_ROAD_CONDITION, options );
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service.marker;
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
@@ -8,12 +8,13 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.entity.CloudLocationInfo;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -67,7 +68,7 @@ class SnapshotSetDataDrawer {
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
public void renderSnapshotData( MogoSnapshotSetData data ) {
|
||||
public void renderSnapshotData( MogoSnapshotSetData data, boolean filterAdasData ) {
|
||||
if ( data == null || data.getAllList() == null || data.getAllList().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
@@ -76,7 +77,7 @@ class SnapshotSetDataDrawer {
|
||||
if ( cloudRoadData == null ) {
|
||||
continue;
|
||||
}
|
||||
if ( cloudRoadData.getDistance() < 50 ) {
|
||||
if ( filterAdasData && cloudRoadData.getDistance() < 50 ) {
|
||||
// 过滤 adas 识别的车辆
|
||||
continue;
|
||||
}
|
||||
@@ -89,9 +90,9 @@ class SnapshotSetDataDrawer {
|
||||
marker = drawSnapshotDataMarker( cloudRoadData );
|
||||
mCloudSnapshotMarkersCaches.put( uniqueKey, marker );
|
||||
}
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
if ( cloudRoadData.getCoordinates() != null
|
||||
|| cloudRoadData.getCoordinates().size() > 1 ) {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
for ( int j = 0; j < cloudRoadData.getCoordinates().size(); j++ ) {
|
||||
CloudLocationInfo poi = cloudRoadData.getCoordinates().get( j );
|
||||
if ( poi == null ) {
|
||||
@@ -101,11 +102,13 @@ class SnapshotSetDataDrawer {
|
||||
double lng = poi.getLon();
|
||||
points.add( new MogoLatLng( lat, lng ) );
|
||||
}
|
||||
if ( points.size() >= 1 ) {
|
||||
marker.startSmooth( points, 1000 );
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
points.add( marker.getPosition() );
|
||||
points.add( new MogoLatLng( cloudRoadData.getLat(), cloudRoadData.getLon() ) );
|
||||
}
|
||||
if ( points.size() >= 1 ) {
|
||||
marker.startSmooth( points, 1000 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,9 +159,9 @@ class SnapshotSetDataDrawer {
|
||||
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( ServiceConst.TYPE_MARKER_CLOUD_DATA )
|
||||
.owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
|
||||
.icon( BitmapFactory.decodeResource( mContext.getResources(), R.drawable.map_custom_ic_current_location2 ) )
|
||||
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
|
||||
return MarkerServiceHandler.getMapService().getMarkerManager( mContext ).addMarker( ModuleNames.CARD_TYPE_ROAD_CONDITION, options );
|
||||
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( ModuleNames.CARD_TYPE_ROAD_CONDITION, options );
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
@@ -17,8 +16,8 @@ import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.entity.CloudLocationInfo;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.common.entity.MarkerCarPois;
|
||||
import com.mogo.module.common.entity.MarkerCardResult;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
@@ -38,7 +37,6 @@ import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.utils.ViewUtils;
|
||||
import com.mogo.module.service.vrmode.VrModeController;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
|
||||
import com.mogo.service.connection.WebSocketMsgType;
|
||||
@@ -57,7 +55,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -162,7 +159,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
if ( data == null ) {
|
||||
return;
|
||||
}
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data );
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data, true );
|
||||
VrModeController.getInstance().renderMogoSnapshotSetData( data );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.machine.vision;
|
||||
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
|
||||
public
|
||||
@@ -50,6 +51,6 @@ class MachineVisionMapViewHandler {
|
||||
if ( mMachineVisionMapView == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data, false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ class ADASRecognizedListResult {
|
||||
public List< LatLon > latLonList;
|
||||
|
||||
public static class LatLon {
|
||||
|
||||
public LatLon( double lat, double lon ) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
|
||||
Reference in New Issue
Block a user