[Update]调整全览模式摄像头直播显示
This commit is contained in:
@@ -12,6 +12,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.Infrastructure;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
|
||||
@@ -19,7 +20,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListen
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager;
|
||||
import com.mogo.eagle.core.function.overview.Infrastructure;
|
||||
import com.mogo.eagle.core.function.overview.ViewModelExtKt;
|
||||
import com.mogo.eagle.core.function.overview.vm.OverViewModel;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
@@ -46,8 +46,7 @@ import mogo.telematics.pad.MessagePad;
|
||||
*/
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_MAP)
|
||||
public class MapFragment extends MvpFragment<MapView, MapPresenter>
|
||||
implements MapView, IMoGoMapFragmentProvider, IMoGoSkinModeChangeListener,
|
||||
IMoGoAutopilotPlanningListener {
|
||||
implements MapView, IMoGoMapFragmentProvider, IMoGoSkinModeChangeListener {
|
||||
|
||||
private static final String TAG = "MapFragment";
|
||||
|
||||
@@ -340,31 +339,4 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
|
||||
public void setDebugMode(boolean debugMode) {
|
||||
MapAutoApi.INSTANCE.setDebugMode(debugMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(@NonNull List<MessagePad.TrajectoryPoint> trajectoryInfos) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp globalPathResp) {
|
||||
if (globalPathResp != null) {
|
||||
HashMap<String, ArrayList<Infrastructure>> pathMap = new HashMap();
|
||||
String geoHash;
|
||||
ArrayList<Infrastructure> infList;
|
||||
for (MessagePad.Location location : globalPathResp.getWayPointsList()) {
|
||||
geoHash = GeoHash.withCharacterPrecision(location.getLatitude(), location.getLongitude(), 7).toBase32();
|
||||
// 网格内的轨迹点只取一次
|
||||
if (!pathMap.containsKey(geoHash)) {
|
||||
// 从缓存的新基建数据中去取对应geoHash的新基建数据集合
|
||||
infList = InfStructureManager.INSTANCE.getData().get(geoHash);
|
||||
if (infList != null) {
|
||||
pathMap.put(geoHash, infList);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 全局路径规划只回调一次,保存供全览模式所在Fragment使用
|
||||
InfStructureManager.INSTANCE.savePathData(pathMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.function.overview
|
||||
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
|
||||
/**
|
||||
* 本地数据库查询出来的红绿灯、摄像头等数据
|
||||
*/
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.mogo.eagle.core.function.overview
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "t_device")
|
||||
data class Infrastructure(
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "id")
|
||||
var id: Int,
|
||||
|
||||
@ColumnInfo(name = "category")
|
||||
var category: Int,
|
||||
|
||||
@ColumnInfo(name = "ip")
|
||||
var ip: String?,
|
||||
|
||||
@ColumnInfo(name = "lon")
|
||||
var lon: String?,
|
||||
|
||||
@ColumnInfo(name = "lat")
|
||||
var lat: String?,
|
||||
|
||||
@ColumnInfo(name = "heading")
|
||||
var heading: Int,
|
||||
|
||||
@ColumnInfo(name = "geohash")
|
||||
var geoHash: String?
|
||||
)
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.overview
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
|
||||
@Dao
|
||||
interface OverviewDao {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import androidx.room.Database
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
|
||||
@Database(entities = [Infrastructure::class], version = 1, exportSchema = false)
|
||||
abstract class OverviewDb: RoomDatabase() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.overview.vm
|
||||
|
||||
import androidx.lifecycle.*
|
||||
import com.mogo.eagle.core.function.overview.Infrastructure
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import com.mogo.eagle.core.function.overview.OverviewDao
|
||||
import kotlinx.coroutines.launch
|
||||
import java.lang.Exception
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
@@ -50,6 +52,7 @@ import com.autonavi.tbt.TrafficFacilityInfo;
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.Infrastructure;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
@@ -61,7 +64,6 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager;
|
||||
import com.mogo.eagle.core.function.overview.Infrastructure;
|
||||
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
|
||||
@@ -112,7 +114,7 @@ public class AMapCustomView
|
||||
|
||||
// 全局路径规划中的GeoHash网格
|
||||
private Map<String, ArrayList<Infrastructure>> pathMap = new HashMap();
|
||||
private Map<LatLng, Infrastructure> posInfMap = new HashMap();
|
||||
private Map<LatLng, ArrayList<Infrastructure>> posInfMap = new HashMap();
|
||||
|
||||
public AMapCustomView(Context context) {
|
||||
this(context, null);
|
||||
@@ -146,8 +148,7 @@ public class AMapCustomView
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
//设置全览模式
|
||||
overLayerView.setOnClickListener(v -> {
|
||||
CallerHmiManager.INSTANCE.hideSmallFragment();
|
||||
// mAMapNaviView.displayOverview();
|
||||
mAMapNaviView.displayOverview();
|
||||
});
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
@@ -744,51 +745,40 @@ public class AMapCustomView
|
||||
}
|
||||
ArrayList<MarkerOptions> markerOptionsList = new ArrayList();
|
||||
for (ArrayList<Infrastructure> structureList : infStruMap.values()) {
|
||||
int firstQuadrantCt = 0, secondQuadrantCt = 0, thirdQuadrantCt = 0, forthQuadrantCt = 0;
|
||||
// 每个GeoHash内根据坐标系象限分散开摄像头icon显示
|
||||
for (Infrastructure structure : structureList) {
|
||||
MarkerOptions markerOption = new MarkerOptions();
|
||||
LatLng latLng = new LatLng(Double.valueOf(structure.getLat()),
|
||||
Double.valueOf(structure.getLon()));
|
||||
markerOption.position(latLng);
|
||||
if (structure.getHeading() >= 0 && structure.getHeading() <= 90) {
|
||||
markerOption.anchor(0.5f * firstQuadrantCt, 0.5f + 0.5f * firstQuadrantCt);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_right)
|
||||
));
|
||||
firstQuadrantCt++;
|
||||
} else if (structure.getHeading() >= 90 && structure.getHeading() <= 180) {
|
||||
markerOption.anchor(0.5f * secondQuadrantCt, 0.5f * secondQuadrantCt);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_right)
|
||||
));
|
||||
secondQuadrantCt++;
|
||||
} else if (structure.getHeading() >= 180 && structure.getHeading() <= 270) {
|
||||
markerOption.anchor(0.5f + 0.5f * thirdQuadrantCt, 0.5f * thirdQuadrantCt);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_left)
|
||||
));
|
||||
thirdQuadrantCt++;
|
||||
} else {
|
||||
markerOption.anchor(0.75f + 0.25f * forthQuadrantCt, 0.75f + 0.25f * forthQuadrantCt);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_left)
|
||||
));
|
||||
forthQuadrantCt++;
|
||||
}
|
||||
posInfMap.put(latLng, structure);
|
||||
markerOptionsList.add(markerOption);
|
||||
}
|
||||
|
||||
MarkerOptions markerOption = new MarkerOptions();
|
||||
LatLng latLng = new LatLng(Double.valueOf(structureList.get(0).getLat()),
|
||||
Double.valueOf(structureList.get(0).getLon()));
|
||||
markerOption.position(latLng);
|
||||
Bitmap bitmap = getBitmap(structureList.size());
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
bitmap
|
||||
));
|
||||
posInfMap.put(latLng, structureList);
|
||||
markerOptionsList.add(markerOption);
|
||||
}
|
||||
mAMap.addMarkers(markerOptionsList, false);
|
||||
mAMap.setOnMarkerClickListener(marker -> {
|
||||
Infrastructure infrastructure = posInfMap.get(marker.getPosition());
|
||||
List<Infrastructure> infList = posInfMap.get(marker.getPosition());
|
||||
// 如果是摄像头
|
||||
if (0 == infrastructure.getCategory() && infrastructure.getIp() != null) {
|
||||
CallerHmiManager.INSTANCE.showVideoDialog(infrastructure.getIp());
|
||||
if (infList != null) {
|
||||
CallerHmiManager.INSTANCE.showVideoDialog(infList);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private Bitmap getBitmap(int count) {
|
||||
MakerWithCount marker = new MakerWithCount(getContext());
|
||||
marker.setCount(count);
|
||||
|
||||
marker.measure(View.MeasureSpec.makeMeasureSpec(110, View.MeasureSpec.EXACTLY),
|
||||
View.MeasureSpec.makeMeasureSpec(108, View.MeasureSpec.EXACTLY));
|
||||
marker.layout(0, 0, marker.getMeasuredWidth(), marker.getMeasuredHeight());
|
||||
Bitmap bitmap = Bitmap.createBitmap(marker.getWidth(), marker.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
marker.draw(new Canvas(bitmap));
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.eagle.core.function.smp
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.map.R
|
||||
import kotlinx.android.synthetic.main.view_maker_with_count.view.*
|
||||
|
||||
class MakerWithCount @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout (
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
) {
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_maker_with_count, this, true)
|
||||
}
|
||||
|
||||
fun setCount(count: Int) {
|
||||
tvNum.text = count.toString()
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager;
|
||||
import com.mogo.eagle.core.function.overview.Infrastructure;
|
||||
import com.mogo.eagle.core.data.map.Infrastructure;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="108px"
|
||||
android:maxHeight="108px"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivIcon"
|
||||
android:layout_width="80px"
|
||||
android:layout_height="86px"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="10px"
|
||||
android:background="@drawable/video_icon_right"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvNum"
|
||||
android:layout_width="38px"
|
||||
android:layout_height="38px"
|
||||
android:background="@drawable/count_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:textColor="@color/white"
|
||||
android:gravity="center"
|
||||
android:textSize="21px"
|
||||
tools:text="18"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user