This commit is contained in:
wangcongtao
2020-12-22 11:21:53 +08:00
parent 181ab87807
commit ea3518b676
23 changed files with 130 additions and 37 deletions

View File

@@ -1,6 +1,7 @@
package com.mogo.utils;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@@ -19,8 +20,11 @@ public class ViewUtils {
view.destroyDrawingCache();
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
Bitmap bitmap = null;
return (bitmap = view.getDrawingCache()) != null ? bitmap.copy(Bitmap.Config.ARGB_8888, false) : null;
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas( bitmap );
view.draw( canvas );
return bitmap;
// return (bitmap = view.getDrawingCache()) != null ? bitmap.copy(Bitmap.Config.ARGB_8888, false) : null;
}
public static void processChildView(View view) {

View File

@@ -23,7 +23,10 @@ public class AMapMarkerClickHandler {
final IMogoMarkerClickListener listener = mogoMarker.getOnMarkerClickListener();
Logger.d( "AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker );
if ( listener != null ) {
listener.onMarkerClicked( mogoMarker );
boolean result = listener.onMarkerClicked( mogoMarker );
if ( result ) {
return true;
}
}
return MogoMarkersHandler.getInstance().onMarkerClicked( mogoMarker );
}

View File

@@ -67,7 +67,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.3.3'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.1'
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -21,12 +21,13 @@ public class AMapMarkerClickHandler {
private static volatile AMapMarkerClickHandler sInstance;
private AMapMarkerClickHandler(){}
private AMapMarkerClickHandler() {
}
public static AMapMarkerClickHandler getInstance(){
if( sInstance == null ){
synchronized( AMapMarkerClickHandler.class ) {
if( sInstance == null ){
public static AMapMarkerClickHandler getInstance() {
if ( sInstance == null ) {
synchronized ( AMapMarkerClickHandler.class ) {
if ( sInstance == null ) {
sInstance = new AMapMarkerClickHandler();
}
}
@@ -34,7 +35,7 @@ public class AMapMarkerClickHandler {
return sInstance;
}
public synchronized void release(){
public synchronized void release() {
sInstance = null;
}
@@ -47,13 +48,16 @@ public class AMapMarkerClickHandler {
if ( marker == null ) {
return false;
}
Map<String, IMogoMarker> mogoMarkerMap = MarkerWrapperClickHelper.getInstance().getMogoMarkerMap();
if ( mogoMarkerMap.containsKey(marker.getId())) {
IMogoMarker mogoMarker = mogoMarkerMap.get(marker.getId());
Map< String, IMogoMarker > mogoMarkerMap = MarkerWrapperClickHelper.getInstance().getMogoMarkerMap();
if ( mogoMarkerMap.containsKey( marker.getId() ) ) {
IMogoMarker mogoMarker = mogoMarkerMap.get( marker.getId() );
final IMogoMarkerClickListener listener = mogoMarker.getOnMarkerClickListener();
Logger.d( "AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker );
if ( listener != null ) {
listener.onMarkerClicked( mogoMarker );
boolean result = listener.onMarkerClicked( mogoMarker );
if ( result ) {
return true;
}
}
return MogoMarkersHandler.getInstance().onMarkerClicked( mogoMarker );
}

View File

@@ -339,13 +339,11 @@ public class AMapViewWrapper implements IMogoMapView,
if ( mMapView.getMapAutoViewHelper() != null ) {
switch ( ui ) {
case CarUp_2D:
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_2D );
break;
case CarUp_3D:
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_3D );
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_UP_CAR );
break;
case NorthUP_2D:
mMapView.getMapAutoViewHelper().setRotateGesturesEnabled( false );
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_UP_NORTH );
break;
}
}

View File

@@ -59,6 +59,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
marker.setMObject( this );
MarkerWrapperClickHelper.getInstance().setMogoMarkerMap( marker.getId(), this );
}
marker.setSaveBitmapEnable( true );
setObject( mogoMarkerOptions.getObject() );
this.mMogoMarkerOptions = mogoMarkerOptions;
mMogoMarkerOptions.addObserver( this );

View File

@@ -126,15 +126,15 @@ public class ObjectUtils {
location.setLongitude( aLocation.getLon() );
location.setAltitude( aLocation.getAltitude() );
// location.setTime( aLocation.getTime() );
// location.setBearing( aLocation.getBearing() );
location.setBearing( aLocation.getHeading() );
// location.setAccuracy( aLocation.getAccuracy() );
// location.setCityCode( aLocation.getCityCode() );
// location.setCityName( aLocation.getCity() );
location.setCityCode( aLocation.getCityCode() );
location.setCityName( aLocation.getCity() );
location.setProvider( aLocation.getProvider() );
// location.setAddress( aLocation.getAddress() );
// location.setDistrict( aLocation.getDistrict() );
// location.setProvince( aLocation.getProvince() );
// location.setAdCode( aLocation.getAdCode() );
location.setAddress( aLocation.getAddress() );
location.setDistrict( aLocation.getDistrict() );
location.setProvince( aLocation.getProvince() );
location.setAdCode( aLocation.getAdCode() );
// location.setLocationDetail( aLocation.getLocationDetail() );
// location.setPoiName( aLocation.getPoiName() );
// location.setAoiName( aLocation.getAoiName() );

View File

@@ -78,7 +78,7 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
}
public synchronized Map< String, List< IMogoMarker > > getAllMarkers() {
public synchronized Map< String, List< IMogoMarker > > getAllMarkers() {
return mServicesMarkers;
}

View File

@@ -54,7 +54,7 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
mIndicator = findViewById( R.id.module_apps_id_indicator );
mIndicator.setOpenPadding( true );
ViewPagerSpeedScroller.attach(getContext(), mAppsPager, 1000);
// ViewPagerSpeedScroller.attach(getContext(), mAppsPager, 1000);
}
@NonNull

View File

@@ -22,7 +22,7 @@ enum AdasRecognizedType {
classIdTrafficSign( "traffic_sign", 5 ),
//bus
classIdTrafficBus( "traffic_bus", 6 ),
//track
//truck
classIdTrafficTruck( "traffic_truck", 8 );
AdasRecognizedType( int code ) {

View File

@@ -13,6 +13,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
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 com.mogo.utils.ViewUtils;
@@ -79,6 +80,12 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
if ( recognizedListResult == null ) {
continue;
}
// 暂时只显示车辆
if ( isCarType( recognizedListResult.type ) ) {
continue;
}
IMogoMarker marker = null;
String uniqueKey = recognizedListResult.uuid;
if ( TextUtils.isEmpty( uniqueKey ) ) {

View File

@@ -2,6 +2,7 @@ package com.mogo.module.common.drawer;
import com.mogo.map.CoordinatesTransformer;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.constants.CarModelType;
import com.mogo.module.common.constants.SafeType;
@@ -83,4 +84,14 @@ class BaseDrawer {
}
return mTransformer.transform( lat, lon );
}
protected boolean isCarType( int type ) {
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
if ( recognizedType != AdasRecognizedType.classIdCar
|| recognizedType != AdasRecognizedType.classIdTrafficBus
|| recognizedType != AdasRecognizedType.classIdTrafficTruck ) {
return false;
}
return true;
}
}

View File

@@ -10,14 +10,18 @@ import android.widget.ImageView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
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.api.CallChatApi;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.entity.CloudRoadData;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.logger.Logger;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
import com.zhidao.carchattingprovider.MogoDriverInfo;
import java.util.ArrayList;
import java.util.HashMap;
@@ -32,7 +36,7 @@ public
*
* 云端数据绘制
*/
class SnapshotSetDataDrawer extends BaseDrawer {
class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListener {
private static final String TAG = "SnapshotSetDataDrawer";
@@ -84,8 +88,7 @@ class SnapshotSetDataDrawer extends BaseDrawer {
boolean machineVision ) {
if ( data == null || (
( data.getAllList() == null || data.getAllList().isEmpty() ) &&
( data.getNearList() == null || data.getNearList().isEmpty() )
) ) {
( data.getNearList() == null || data.getNearList().isEmpty() ) ) ) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( DataTypes.TYPE_MARKER_CLOUD_DATA );
return;
}
@@ -101,12 +104,21 @@ class SnapshotSetDataDrawer extends BaseDrawer {
mPurseCounter++;
if ( mPurseCounter >= 100 ) {
mPurseCounter = 0;
purgeCloudSnapshotData( allDatumsList );
}
purgeCloudSnapshotData( allDatumsList );
for ( CloudRoadData cloudRoadData : allDatumsList ) {
if ( cloudRoadData == null ) {
continue;
}
// 暂时只显示车辆
if ( TextUtils.isEmpty( cloudRoadData.getSn() ) ) {
if ( isCarType( cloudRoadData.getType() ) ) {
continue;
}
}
IMogoMarker marker = null;
String uniqueKey = cloudRoadData.getUniqueKey();
if ( TextUtils.isEmpty( uniqueKey ) ) {
@@ -121,6 +133,9 @@ class SnapshotSetDataDrawer extends BaseDrawer {
if ( marker == null ) {
continue;
}
if ( !TextUtils.isEmpty( cloudRoadData.getSn() ) ) {
bindClickListener( marker );
}
mCloudSnapshotMarkersCaches.put( uniqueKey, marker );
} else {
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
@@ -128,6 +143,7 @@ class SnapshotSetDataDrawer extends BaseDrawer {
if ( mIsVrMode ) {
marker.use3DResource( getVrModel( cloudRoadData ) );
} else {
marker.getMogoMarkerOptions().set3DMode( false );
marker.setIcon( ViewUtils.fromView( inflateView( cloudRoadData, machineVision, 0 ) ) );
}
}
@@ -142,7 +158,7 @@ class SnapshotSetDataDrawer extends BaseDrawer {
List< MogoLatLng > points = new ArrayList<>();
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
points.add( new MogoLatLng( target.lat, target.lon ) );
marker.startSmoothInMs( points, SystemClock.elapsedRealtime() - mLastReceiveTime );
marker.startSmoothInMs( points, 500L );
}
} else {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
@@ -154,6 +170,13 @@ class SnapshotSetDataDrawer extends BaseDrawer {
}
}
private void bindClickListener( IMogoMarker marker ) {
if ( marker == null || marker.isDestroyed() ) {
return;
}
marker.setOnMarkerClickListener( this );
}
/**
* 过滤本次数据中,不存在的 marker
*
@@ -206,6 +229,7 @@ class SnapshotSetDataDrawer extends BaseDrawer {
.owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
.anchor( 0.5f, 0.5f )
.rotate( ( float ) data.getHeading() )
.object( data )
// .position( new MogoLatLng( coor[POS_LAT], coor[POS_LON] ) );
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
@@ -256,4 +280,32 @@ class SnapshotSetDataDrawer extends BaseDrawer {
return R.drawable.icon_map_marker_car_gray;
}
}
@Override
public boolean onMarkerClicked( IMogoMarker marker ) {
if ( marker != null && !marker.isDestroyed() ) {
if ( marker.getObject() instanceof CloudRoadData ) {
showCarCallPanel( ( ( CloudRoadData ) marker.getObject() ) );
}
}
return true;
}
private void showCarCallPanel( CloudRoadData data ) {
MogoDriverInfo driverInfo = new MogoDriverInfo();
driverInfo.setLat( data.getLat() );
driverInfo.setLon( data.getLon() );
driverInfo.setSn( data.getSn() );
ICarsChattingProvider carChatting = CallChatApi.getInstance().getApiProvider();
if ( carChatting != null ) {
try {
carChatting.showUserWindow( TAG, driverInfo, mContext );
} catch ( Exception e ) {
Logger.e( TAG, e, "showCarCallPanel" );
}
}
}
}

View File

@@ -22,6 +22,7 @@ import com.mogo.module.common.R;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.storage.SharedPrefsMgr;
/**
* 自车图标工具类
@@ -44,6 +45,10 @@ public class MyLocationUtil {
private static final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
.build();
public static void setMyLocationIconUrl(Context context){
setMyLocationIconUrl( context, SharedPrefsMgr.getInstance( context ).getString( "MY_LOCATION_CONFIG", "" ) );
}
public static void setMyLocationIconUrl(Context context, String url) {
if (url == null || url.isEmpty()) {
return;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1066,7 +1066,7 @@
<dimen name="module_service_marker_dot_marginTop">4dp</dimen>
<dimen name="module_service_marker_bubble_width">100px</dimen>
<dimen name="module_service_marker_bubble_vr_width">55px</dimen>
<dimen name="module_service_marker_bubble_height">117px</dimen>
<dimen name="module_service_marker_bubble_height">130px</dimen>
<dimen name="module_service_marker_bubble_vr_height">69px</dimen>
<dimen name="module_service_marker_bubble_icon_width">60px</dimen>
<dimen name="module_service_marker_bubble_icon_height">60px</dimen>

View File

@@ -9,6 +9,7 @@ import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.search.geo.IMogoGeoSearch;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
@@ -75,7 +76,7 @@ public class ExtensionServiceManager {
isInit = true;
mContext = context;
mMogoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
mMogoServiceApis = MogoApisHandler.getInstance().getApis();
mMapService = mMogoServiceApis.getMapServiceApi();
mImageLoader = mMogoServiceApis.getImageLoaderApi();

View File

@@ -72,7 +72,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
mMogoMap.getUIController().recoverLockMode();// 启动锁车
}
// 根据本地配置设置自车图标
MyLocationUtil.setMyLocationIconUrl( getContext(), SharedPrefsMgr.getInstance( getContext() ).getString( "MY_LOCATION_CONFIG", "" ) );
MyLocationUtil.setMyLocationIconUrl( getContext() );
}
@NonNull

View File

@@ -59,6 +59,7 @@ public class MogoRTKLocation {
}
private void sendLocationData() {
if (rtkLocationListener != null) {
List<CloudLocationInfo> list = new ArrayList<>(cacheList);
rtkLocationListener.onLocationChanged(list);

View File

@@ -102,6 +102,12 @@ class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
content.self = locationResult;
content.adas = recognizedResults;
if ( content.self == null &&
( content.adas == null || content.adas.isEmpty() ) ) {
return;
}
MarkerServiceHandler.getApis().getWebSocketManagerApi( mContext ).sendMsg( content, new IMogoOnWebSocketMessageListener() {
@Override
public WebSocketMsgType getDownLinkType() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -111,7 +111,7 @@ public class MogoADASController implements IMogoADASController {
@Override
public void onRectData( RectInfo rectInfo ) {
// 物体识别返回
Logger.d( TAG, "onRectData = %s", rectInfo.toString() );
// Logger.d( TAG, "onRectData = %s", rectInfo.toString() );
mLastFrameData = rectInfo;
handleAdasRecognizedData( rectInfo );
}