Merge branch 'dev_minibus-d_230425_3.2.0' into merge320tomaster
This commit is contained in:
@@ -56,6 +56,10 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
//移除aar包中的proto文件
|
||||
packagingOptions {
|
||||
exclude '**/*.proto'
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.zhjt.mogo.adas.data.bean;
|
||||
|
||||
/**
|
||||
* 监控事件报告中定义的事件以及解释
|
||||
* 根据MAP2.11.0消息定义编写
|
||||
* 根据MAP3.3.1事件定义编写
|
||||
*/
|
||||
public class MogoReport {
|
||||
public static final String RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED";
|
||||
@@ -68,6 +68,7 @@ public class MogoReport {
|
||||
public static final String ACTION_CHECK_NETWORK = "ACTION_CHECK_NETWORK";
|
||||
public static final String ACTION_TRY_AGAIN_LATER = "ACTION_TRY_AGAIN_LATER";
|
||||
public static final String ACTION_REMOTEPILOT_REQUEST = "ACTION_REMOTEPILOT_REQUEST";
|
||||
public static final String ACTION_MANUAL_HANDLE_REQUEST = "ACTION_MANUAL_HANDLE_REQUEST";
|
||||
|
||||
public enum Action {
|
||||
|
||||
@@ -79,7 +80,9 @@ public class MogoReport {
|
||||
CHECK_GEAR(ACTION_CHECK_GEAR, "检查车辆档位等影响自动驾驶的因素"),
|
||||
CHECK_NETWORK(ACTION_CHECK_NETWORK, "检查网络连接和路由器等影响通信的因素"),
|
||||
TRY_AGAIN_LATER(ACTION_TRY_AGAIN_LATER, "请稍后重试"),
|
||||
REMOTEPILOT_REQUEST(ACTION_REMOTEPILOT_REQUEST, "请求远程驾驶");
|
||||
REMOTEPILOT_REQUEST(ACTION_REMOTEPILOT_REQUEST, "请求远程驾驶"),
|
||||
MANUAL_HANDLE_REQUEST(ACTION_MANUAL_HANDLE_REQUEST, "请安全员注意接管"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 消息Action code
|
||||
@@ -114,6 +117,10 @@ public class MogoReport {
|
||||
return CHECK_NETWORK.desc;
|
||||
case ACTION_TRY_AGAIN_LATER:
|
||||
return TRY_AGAIN_LATER.desc;
|
||||
case ACTION_REMOTEPILOT_REQUEST:
|
||||
return REMOTEPILOT_REQUEST.desc;
|
||||
case ACTION_MANUAL_HANDLE_REQUEST:
|
||||
return MANUAL_HANDLE_REQUEST.desc;
|
||||
default:
|
||||
return actionCode;
|
||||
}
|
||||
@@ -151,6 +158,7 @@ public class MogoReport {
|
||||
String DATA_NOT_EXIST = "EMAP_DATA_NOT_EXIST";//无法加载到正确的sqlite文件
|
||||
String TRA_NOT_EXIST = "EMAP_TRA_NOT_EXIST";//无法找到轨迹文件
|
||||
String TRA_LOAD_FAILED = "EMAP_TRA_LOAD_FAILED";//加载轨迹文件失败
|
||||
String ENGINE_INIT_FAILED = "EMAP_ENGINE_INIT_FAILED";//引擎初始化失败,包括轨迹路径不存在;vehicle_config.txt加载失败
|
||||
String EXIT_AUTOPILOT_FOR_PLANNING = "EMAP_EXIT_AUTOPILOT_FOR_PLANNING";//因planning掉帧强退自动驾驶
|
||||
String EXIT_AUTOPILOT_FOR_LOCATION = "EMAP_EXIT_AUTOPILOT_FOR_LOCATION";//因location掉帧强退自动驾驶
|
||||
String EXIT_AUTOPILOT_FOR_CHASSIS = "EMAP_EXIT_AUTOPILOT_FOR_CHASSIS";//因底盘消息掉帧强退自动驾驶
|
||||
@@ -170,12 +178,17 @@ public class MogoReport {
|
||||
String ENTRY_AUTOPILOT_FOR_ACCEL = "EMAP_ENTRY_AUTOPILOT_FOR_ACCEL";//加速踏板干预未进自驾
|
||||
String ENTRY_AUTOPILOT_FOR_STEER = "EMAP_ENTRY_AUTOPILOT_FOR_STEER";//方向盘干预未进自驾
|
||||
String ENTRY_AUTOPILOT_FOR_GEAR_SWITCH = "EMAP_ENTRY_AUTOPILOT_FOR_GEAR_SWITCH";//档位切换干预未进自驾
|
||||
String ENTRY_AUTOPILOT_FOR_DISTANCE = "EMAP_ENTRY_AUTOPILOT_FOR_DISTANCE";//因planning起点距离太远不可进自驾
|
||||
String ENTRY_AUTOPILOT_FOR_VEHICLE_ERROR = "EMAP_ENTRY_AUTOPILOT_FOR_VEHICLE_ERROR";//车辆故障需要保修,故障原因见msg信息
|
||||
String ENTRY_AUTOPILOT_FOR_CHASSIS_FAULT = "EMAP_ENTRY_AUTOPILOT_FOR_CHASSIS_FAULT ";//底盘异常,需要下电重启
|
||||
String ENTRY_AUTOPILOT_FOR_UNKNOWN = "EMAP_ENTRY_AUTOPILOT_FOR_UNKNOWN ";//进自驾原因确实未知,必须联系软硬件技术进行排查
|
||||
String ENTRY_AUTOPILOT_FOR_OTHER_CTL = "EMAP_ENTRY_AUTOPILOT_FOR_OTHER_CTL";//其他干预未进自驾,请检查仪表盘和开关项(如双闪,制动灯灯等 可在msg中补充原因信息)
|
||||
String HADMAP_ENGINE_NO_ROUTING_INFO = "EMAP_HADMAP_ENGINE_NO_ROUTING_INFO";//hadmap_engine算路失败或未找到轨迹文件导致的轨迹文件信息未发布
|
||||
String HADMAP_NO_TRAJECTORY = "EMAP_HADMAP_NO_TRAJECTORY";//hadmap未发布全局路径
|
||||
String HADMAP_PLANNING_NO_TRAJECTORY = "EMAP_HADMAP_PLANNING_NO_TRAJECTORY";//local_planning未发布局部轨迹
|
||||
String CONTROL_ABNORMAL_COMMAND = "EMAP_CONTROL_ABNORMAL_COMMAND";//controller发布的控制指令异常
|
||||
String CAN_ADAPTER_NO_CHASSIS_INFO = "EMAP_CAN_ADAPTER_NO_CHASSIS_INFO";//can_adapter未成功转发地盘信息
|
||||
String TRAJECTORY_LOST_WHEN_AUTOPILOT = "EMAP_TRAJECTORY_LOST_WHEN_AUTOPILOT";//自驾状态,但是全局轨迹丢失超过1.5s
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,6 +230,14 @@ public class MogoReport {
|
||||
String FAULT = "ESYS_FAULT";//master启动10分钟,仍有agent未连接
|
||||
String REBOOT_WARNING = "ESYS_REBOOT_WARNING";//命令重启不完全提示(部分模块没有关闭成功)
|
||||
String CAN_MSG_LOST = "ESYS_CAN_MSG_LOST";//master接收底盘消息超时
|
||||
|
||||
/*******update_config_simple 配置(包含轨迹)下载相关异常*******/
|
||||
String CONFIG_UPDATING_SPEED_JUMP = "ESYS_CONFIG_UPDATING_SPEED_JUMP";//文件下载速度跳变,低于阈值
|
||||
String CONFIG_UPDATING_INPUT_PARAM_ABNORMAL = "ESYS_CONFIG_UPDATING_INPUT_PARAM_ABNORMAL";//配置下载传入参数异常
|
||||
String CONFIG_UPDATING_DNS_ERROR = "ESYS_CONFIG_UPDATING_DNS_ERROR";//DNS解析异常
|
||||
String CONFIG_UPDATING_URL_NOT_ARRIVED = "ESYS_CONFIG_UPDATING_URL_NOT_ARRIVED";//url不可达
|
||||
String CONFIG_UPDATING_MD5_CHECK_ERROR = "ESYS_CONFIG_UPDATING_MD5_CHECK_ERROR";//md5检查失败
|
||||
String CONFIG_UPDATING_REJECT_SAME_TRAJ_TASK = "ESYS_CONFIG_UPDATING_REJECT_SAME_TRAJ_TASK";//拒绝同名轨迹任务
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,9 +247,13 @@ public class MogoReport {
|
||||
String IN_INIT = "ESSM_IN_INIT";//SSM初始化,非任何模式,拒绝进入自动驾驶/平行驾驶
|
||||
String IN_EXIT = "ESSM_IN_EXIT";//SSM处于停止模式,拒绝进入自动驾驶/平行驾驶
|
||||
String AUTOPILOT_UNREADY = "ESSM_AUTOPILOT_UNREADY";//因自动驾驶状态未就绪拒绝自驾
|
||||
String AUTOPILOT_KEY_NODE_BORKEN = "ESSM_AUTOPILOT_KEY_NODE_BORKEN";//因自驾驾驶关键节点挂掉拒绝自动驾驶
|
||||
String REMOTEPILOT_UNREADY = "ESSM_REMOTEPILOT_UNREADY";//因平行驾驶状态未就绪拒绝平行驾驶
|
||||
String MAP_IMAGE_DIFF = "ESSM_MAP_IMAGE_DIFF";//同镜像Agent存在版本不一致的问题
|
||||
String MAP_IMAGE_DIFF = "ESSM_MAP_IMAGE_DIFF";//Agent镜像存在版本不一致的问题
|
||||
String COLD_START_TIMEOUT = "ESSM_COLD_START_TIMEOUT";//系统冷启动超时未完成
|
||||
String HAVE_AGENT_LOST_CONNECT = "ESSM_HAVE_AGENT_LOST_CONNECT";//存在agent失联
|
||||
String IGNORED_CMD_DUE_PAD_CONTROL = "ESSM_IGNORED_CMD_DUE_PAD_CONTROL ";//pad自驾中,拒绝云控的自驾命令
|
||||
String IGNORED_CMD_DUE_AICLOUD_CONTROL = "ESSM_IGNORED_CMD_DUE_AICLOUD_CONTROL ";//云控自驾中,拒绝pad的自驾命令
|
||||
}
|
||||
|
||||
interface EAGENT {
|
||||
@@ -275,7 +300,8 @@ public class MogoReport {
|
||||
* 平行驾驶相关异常
|
||||
*/
|
||||
interface EPARALLEL {
|
||||
String AICLOUD_CONNECTION_ERROR = "EPARALLEL_AICLOUD_CONNECTION_ERROR";//平行驾驶长连接异常
|
||||
String AICLOUD_CONNECTION_ERROR = "EPARALLEL_AICLOUD_CONNECTION_ERROR";//平行驾驶长连接异常 断网(此时不符合平行驾驶条件) 平行驾驶退出到自驾,同时减速停车
|
||||
String AICLOUD_NETWORK_WEAK = "EPARALLEL_AICLOUD_NETWORK_WEAK";//车端系统检测到弱网 弱网 平行驾驶退出到自驾,同时减速停车
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -343,6 +369,7 @@ public class MogoReport {
|
||||
String REOMTEPILOT_RUNING = "ISYS_REOMTEPILOT_RUNING";//平行驾驶运行中
|
||||
String SYSTEM_IN_IDLE = "ISYS_SYSTEM_IN_IDLE";//系统进入空闲状态
|
||||
String SYSTEM_OUT_IDLE = "ISYS_SYSTEM_OUT_IDLE";//系统退出空闲状态
|
||||
String ALREADY_AUTOPILOT_STATE = "ISYS_ALREADY_AUTOPILOT_STATE";//已经在自驾状态驾驶,忽略自驾命令
|
||||
|
||||
/*******轨迹下载相关*******/
|
||||
String INIT_TRAJECTORY_START = "ISYS_INIT_TRAJECTORY_START";//轨迹管理_轨迹开始下载
|
||||
@@ -367,6 +394,7 @@ public class MogoReport {
|
||||
interface ISSM {
|
||||
String INIT = "ISSM_INIT";//SSM系统上电初始化
|
||||
String RESTARTED = "ISSM_RESTARTED";//SSM系统发生重启
|
||||
String HAVE_AGENT_CONNECTED = "ISSM_HAVE_AGENT_CONNECTED";//agent已连接成功
|
||||
|
||||
// String MODE_XX_START = "ISSM_MODE_XX_START";//SSM变更模式开始
|
||||
// String MODE_XX_FINISH = "ISSM_MODE_XX_FINISH";//SSM变更模式完成(第一次ready
|
||||
|
||||
@@ -146,7 +146,8 @@ message TrackedObject
|
||||
repeated Location polygon = 15;
|
||||
geometry.Point center = 16;
|
||||
AdditionalAttribute add_attribute = 17; // 事件类型
|
||||
reserved 18 to 100;
|
||||
double angle = 18; //相对于自车x轴的角度,左正右负
|
||||
reserved 19 to 100;
|
||||
string strUuid = 101;//String类型车辆ID
|
||||
}
|
||||
|
||||
@@ -324,7 +325,7 @@ message CarConfigResp
|
||||
string carType = 9; //车辆类型
|
||||
string subCarType = 10; //车辆子类型
|
||||
reserved 11 to 100;
|
||||
int32 mapVersion = 101;//dockVersion解析出版本号,解析失败为-1。例如:"MAP-taxi_RoboTaxi_df_2.8.0.3_20220928_test" 解析结果为:280
|
||||
int32 mapVersion = 101;//dockVersion解析出版本号,仅用于版本对比,解析失败为-1。例如:"MAP-taxi_RoboTaxi_df_2.8.0.3_20220928_test" 解析结果为:20800
|
||||
bool isDF = 102;//车型是否是东风
|
||||
bool isHQ = 103;//车型是否是红旗
|
||||
bool isJinlv = 104;//车型是否是金旅小巴
|
||||
@@ -372,7 +373,8 @@ message GlobalPathReq
|
||||
// message definition for MsgTypeGlobalPathResp
|
||||
message GlobalPathResp
|
||||
{
|
||||
repeated Location wayPoints = 1;
|
||||
repeated Location wayPoints = 1;
|
||||
uint64 lineId = 2; //路线id
|
||||
}
|
||||
|
||||
// message definition for MsgTypeTrafficLightData
|
||||
@@ -595,13 +597,13 @@ message PlanningActionMsg
|
||||
//message definition for MsgTypeSetParamReq
|
||||
message SetOneParam
|
||||
{
|
||||
uint32 type = 1; // 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
|
||||
uint32 type = 1; // 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
|
||||
// 3:AEB开关(bool) 0:关闭自动紧急制动功能 1:启用自动紧急制动功能
|
||||
// 4:限制绕障开关(bool) 0:正常绕障 1:限制绕障 默认0
|
||||
// 5:停车让行线前避让等待开关(bool) 0:停车让行线前无需等待 1:停车让行线前需要等待 默认0
|
||||
// 6:地图限速功能开关(bool) 0:不使用地图限速功能 1:使用地图限速功能 默认0
|
||||
// 7:环岛模式开关(bool) 0:普通模式 1:环岛模式 默认0
|
||||
// 8:弱网减速停车策略开关(bool) 0:关闭弱网减速停车策略 1:使用弱网减速停车策略
|
||||
// 8:弱网减速停车策略开关(bool) 0:关闭弱网减速停车策略 1:使用弱网减速停车策略
|
||||
// 9:m1拼接视频自车位置参数(string), 格式:x,y,width,height
|
||||
string value = 2; // 转成字符串的值
|
||||
}
|
||||
@@ -700,3 +702,4 @@ message SessionInfo
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,6 +70,10 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
import chassis.SpecialVehicleTaskCmdOuterClass;
|
||||
import common.HeaderOuterClass;
|
||||
import mogo.telematics.ParamSetCmdOuterClass;
|
||||
import function_state_management.FSMStatusReasonQueryOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import okio.ByteString;
|
||||
@@ -226,7 +227,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
dispatchHandlers.put(MessagePad.MessageType.MsgTypeObuWarningData, new DispatchHandler(MessagePad.MessageType.MsgTypeObuWarningData, this));
|
||||
|
||||
//惯导信息
|
||||
// dispatchHandlers.put(MessagePad.MessageType.MsgTypeGnssInfo, new DispatchHandler(MessagePad.MessageType.MsgTypeGnssInfo, this));
|
||||
dispatchHandlers.put(MessagePad.MessageType.MsgTypeGnssInfo, new DispatchHandler(MessagePad.MessageType.MsgTypeGnssInfo, this));
|
||||
//底盘信息
|
||||
// dispatchHandlers.put(MessagePad.MessageType.MsgTypeVehicleState, new DispatchHandler(MessagePad.MessageType.MsgTypeVehicleState, this));
|
||||
//自动驾驶状态
|
||||
@@ -421,15 +422,15 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
public static void calculateTimeConsumingOnDispatchRaw(String who, long receiveTime) {
|
||||
if (CupidLogUtils.isEnableLog()) {
|
||||
long time = SystemClock.elapsedRealtime() - receiveTime;
|
||||
CupidLogUtils.i("TimeConsuming", who + " 从接收到解析耗时=" + time + "毫秒");
|
||||
CupidLogUtils.i("TimeConsuming", who + " 接收时间=" + receiveTime + " 解析耗时=" + time + "毫秒");
|
||||
}
|
||||
}
|
||||
|
||||
//TODO 计算耗时 临时测试
|
||||
public static void calculateTimeConsumingBusiness(String who, long receiveTime) {
|
||||
public static void calculateTimeConsumingBusiness(String who, long oldTime) {
|
||||
if (CupidLogUtils.isEnableLog()) {
|
||||
long time = SystemClock.elapsedRealtime() - receiveTime;
|
||||
CupidLogUtils.i("TimeConsuming", who + " 业务处理耗时=" + time + "毫秒");
|
||||
long time = SystemClock.elapsedRealtime() - oldTime;
|
||||
CupidLogUtils.i("TimeConsuming", who + " 业务开始时间=" + oldTime + " 业务耗时=" + time + "毫秒");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,7 +483,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
|
||||
@Override
|
||||
public AdasOptions getAdasOptions() {
|
||||
return adasOptions;
|
||||
return adasOptions == null ? new AdasOptions.Builder().build() : adasOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1241,17 +1242,47 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
return subscribeInterface != null && subscribeInterface.subscribeInterface(role, type, messageType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 给Planning发送靠边停车指令
|
||||
*
|
||||
* @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持
|
||||
* @return boolean 是否加入发送队列
|
||||
*/
|
||||
@Override
|
||||
public boolean sendPlanningPullOverCmd(int pullOverCmd) {
|
||||
return sendPlanningCmd(pullOverCmd, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给Planning发送变道指令
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策
|
||||
* @return boolean 是否加入发送队列
|
||||
*/
|
||||
@Override
|
||||
public boolean sendPlanningLaneChangeCmd(int laneChangeCmd) {
|
||||
return sendPlanningCmd(-1, laneChangeCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给Planning发送指令
|
||||
*
|
||||
* @param cmd 命令 0: default 1: 靠边停车 2:重新起步
|
||||
* @return boolean
|
||||
* @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持
|
||||
* @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策 TODO laneChangeCmd 目前仅襄阳牌照考试支持
|
||||
* @return boolean 是否加入发送队列
|
||||
*/
|
||||
@Override
|
||||
public boolean sendPlanningCmd(int cmd) {
|
||||
MessagePad.PlanningCmd planningCmd = MessagePad.PlanningCmd.newBuilder()
|
||||
.setPullOverCmd(MessagePad.PullOverCmd.newBuilder().setCmd(cmd))
|
||||
.build();
|
||||
public boolean sendPlanningCmd(int pullOverCmd, int laneChangeCmd) {
|
||||
MessagePad.PlanningCmd.Builder build = MessagePad.PlanningCmd.newBuilder();
|
||||
if (pullOverCmd > -1) {
|
||||
build.setPullOverCmd(MessagePad.PullOverCmd.newBuilder().setCmd(pullOverCmd));
|
||||
}
|
||||
if (laneChangeCmd > -1) {
|
||||
build.setLaneChangeCmd(MessagePad.LaneChangeCmd.newBuilder().setCmd(laneChangeCmd));
|
||||
}
|
||||
MessagePad.PlanningCmd planningCmd = build.build();
|
||||
return sendPBMessage(MessageType.TYPE_SEND_PLANNING_CMD.typeCode, planningCmd.toByteArray());
|
||||
}
|
||||
|
||||
@@ -1497,6 +1528,8 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
* 设置参数命令
|
||||
*
|
||||
* @param type 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
|
||||
* 3:AEB开关(bool) 4:限制绕障开关(bool)
|
||||
* 5:停车让行线前避让等待开关(bool) 6:地图限速功能开关(bool)
|
||||
* @param value 转成字符串的值
|
||||
* @return boolean
|
||||
*/
|
||||
@@ -1519,7 +1552,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
*/
|
||||
@Override
|
||||
public boolean sendDetouring(int enable) {
|
||||
return sendSetParamReq(1, String.valueOf(enable));
|
||||
return sendSetParamReq(Constants.PARAM_TYPE.DETOURING, String.valueOf(enable));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1530,7 +1563,121 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
*/
|
||||
@Override
|
||||
public boolean sendDetouringSpeed(double speed) {
|
||||
return sendSetParamReq(2, String.valueOf(speed));
|
||||
return sendSetParamReq(Constants.PARAM_TYPE.DETOURING_SPEED, String.valueOf(speed));
|
||||
}
|
||||
|
||||
/**
|
||||
* AEB开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:关闭,1:开启
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendAebCmd(int enable) {
|
||||
return sendSetParamReq(Constants.PARAM_TYPE.AEB, String.valueOf(enable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 限制绕障开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:正常绕障 1:限制绕障 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendLaneChangeRestrainValid(int enable) {
|
||||
return sendSetParamReq(Constants.PARAM_TYPE.LANE_CHANGE_RESTRAIN_VALID, String.valueOf(enable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 停车让行线前避让等待开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:停车让行线前无需避让等待 1:停车让行线前需要避让等待 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendStopYieldValid(int enable) {
|
||||
return sendSetParamReq(Constants.PARAM_TYPE.STOP_YIELD_VALID, String.valueOf(enable));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 地图限速功能开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:不使用地图限速功能 1:使用地图限速功能 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendHadmapSpeedLimitValid(int enable) {
|
||||
return sendSetParamReq(Constants.PARAM_TYPE.HADMAP_SPEED_LIMIT_VALID, String.valueOf(enable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 环岛模式开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:普通模式 1:环岛模式 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendRampThetaValid(int enable) {
|
||||
return sendSetParamReq(Constants.PARAM_TYPE.RAMP_THETA_VALID, String.valueOf(enable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 弱网减速停车策略开关
|
||||
*
|
||||
* @param enable 0:关闭弱网减速停车策略 1:使用弱网减速停车策略
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendWeakNetSlowDown(int enable) {
|
||||
return sendSetParamReq(Constants.PARAM_TYPE.WEAK_NET_SLOW_DOWN, String.valueOf(enable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部参数
|
||||
* 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq)}
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendGetAllParamReq() {
|
||||
return sendGetParamReq(Constants.PARAM_TYPE.UNKNOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数获取请求
|
||||
* 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq)}
|
||||
*
|
||||
* @param paramType 参数类型{@link Constants.PARAM_TYPE}
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendGetParamReq(@Define.ParamType int paramType) {
|
||||
MessagePad.SetParamReq req;
|
||||
if (paramType == Constants.PARAM_TYPE.UNKNOWN) {
|
||||
req = MessagePad.SetParamReq
|
||||
.newBuilder()
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(Constants.PARAM_TYPE.DETOURING))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(Constants.PARAM_TYPE.DETOURING_SPEED))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(Constants.PARAM_TYPE.AEB))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(Constants.PARAM_TYPE.LANE_CHANGE_RESTRAIN_VALID))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(Constants.PARAM_TYPE.STOP_YIELD_VALID))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(Constants.PARAM_TYPE.HADMAP_SPEED_LIMIT_VALID))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(Constants.PARAM_TYPE.RAMP_THETA_VALID))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(Constants.PARAM_TYPE.WEAK_NET_SLOW_DOWN))
|
||||
.build();
|
||||
} else {
|
||||
req = MessagePad.SetParamReq
|
||||
.newBuilder()
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(paramType))
|
||||
.build();
|
||||
}
|
||||
return sendPBMessage(MessageType.TYPE_SEND_GET_PARAM_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1577,6 +1724,42 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
return sendPBMessage(MessageType.TYPE_SEND_BAG_MANAGER_CMD.typeCode, bagManager.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制V2N数据给车端PnC
|
||||
*
|
||||
* @param switchCmd true为发给PnC,false为不发给PnC
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendV2nToPncCmd(boolean switchCmd) {
|
||||
return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N, switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盲区数据开关
|
||||
*
|
||||
* @param switchCmd 数据开关
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBlindAreaCmd(boolean switchCmd) {
|
||||
return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea, switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置参数命令V2
|
||||
*/
|
||||
|
||||
private <T> boolean sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType paramSetType, T value) {
|
||||
ParamSetCmdOuterClass.ParamSetCmd.Builder builder = ParamSetCmdOuterClass.ParamSetCmd.newBuilder()
|
||||
.setSrc(1)
|
||||
.setType(paramSetType);
|
||||
if (paramSetType == ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea || paramSetType == ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N) {
|
||||
builder.setBoolValue((Boolean) value);
|
||||
}
|
||||
ParamSetCmdOuterClass.ParamSetCmd req = builder.build();
|
||||
return sendPBMessage(MessageType.TYPE_SEND_SET_PARAM_REQ_V2.typeCode, req.toByteArray());
|
||||
}
|
||||
/**
|
||||
* FSM状态原因查询
|
||||
* 当FSMFunctionStates的类型是XXX_DRIVING_OFF时查询OFF的原因
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -49,6 +50,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
private volatile MessagePad.CarConfigResp carConfig;
|
||||
private static final String ADAS_VERSION = BuildConfig.VERSION_NAME;
|
||||
private final Pattern pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
|
||||
|
||||
private AdasChannel mChannel;
|
||||
|
||||
public static AdasManager getInstance() {
|
||||
@@ -100,6 +102,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
*/
|
||||
public synchronized void create(AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener) {
|
||||
if (mChannel != null) {
|
||||
mChannel.disconnect();
|
||||
carConfig = null;
|
||||
mChannel = null;
|
||||
}
|
||||
@@ -612,15 +615,51 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return mChannel != null && mChannel.subscribeInterface(role, type, messageType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给Planning发送靠边停车指令
|
||||
*
|
||||
* @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持
|
||||
* @return boolean 是否加入发送队列
|
||||
*/
|
||||
@Override
|
||||
public boolean sendPlanningPullOverCmd(int pullOverCmd) {
|
||||
return mChannel != null && mChannel.sendPlanningPullOverCmd(pullOverCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给Planning发送变道指令
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策
|
||||
* @return boolean 是否加入发送队列
|
||||
*/
|
||||
@Override
|
||||
public boolean sendPlanningLaneChangeCmd(int laneChangeCmd) {
|
||||
return mChannel != null && mChannel.sendPlanningLaneChangeCmd(laneChangeCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给Planning发送指令
|
||||
*
|
||||
* @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持
|
||||
* @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策 TODO laneChangeCmd 目前仅襄阳牌照考试支持
|
||||
* @return boolean 是否加入发送队列
|
||||
*/
|
||||
@Override
|
||||
public boolean sendPlanningCmd(int pullOverCmd, int laneChangeCmd) {
|
||||
return mChannel != null && mChannel.sendPlanningCmd(pullOverCmd, laneChangeCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给Planning发送 靠边停车 指令
|
||||
* TODO 已废弃 新接口{@link AdasManager#sendPlanningPullOverCmd(int)}
|
||||
*
|
||||
* @param cmd 命令 0: default 1: 靠边停车 2:重新起步
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean sendPlanningCmd(int cmd) {
|
||||
return mChannel != null && mChannel.sendPlanningCmd(cmd);
|
||||
return mChannel != null && mChannel.sendPlanningPullOverCmd(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -802,6 +841,100 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return mChannel != null && mChannel.sendDetouringSpeed(speed);
|
||||
}
|
||||
|
||||
/**
|
||||
* AEB开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:关闭,1:开启
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendAebCmd(int enable) {
|
||||
return mChannel != null && mChannel.sendAebCmd(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 限制绕障开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:正常绕障 1:限制绕障 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendLaneChangeRestrainValid(int enable) {
|
||||
return mChannel != null && mChannel.sendLaneChangeRestrainValid(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停车让行线前避让等待开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:停车让行线前无需避让等待 1:停车让行线前需要避让等待 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendStopYieldValid(int enable) {
|
||||
return mChannel != null && mChannel.sendStopYieldValid(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图限速功能开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:不使用地图限速功能 1:使用地图限速功能 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendHadmapSpeedLimitValid(int enable) {
|
||||
return mChannel != null && mChannel.sendHadmapSpeedLimitValid(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 环岛模式开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:普通模式 1:环岛模式 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendRampThetaValid(int enable) {
|
||||
return mChannel != null && mChannel.sendRampThetaValid(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 弱网减速停车策略开关
|
||||
*
|
||||
* @param enable 0:关闭弱网减速停车策略 1:使用弱网减速停车策略
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendWeakNetSlowDown(int enable) {
|
||||
return mChannel != null && mChannel.sendWeakNetSlowDown(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部参数
|
||||
* 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq)}
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendGetAllParamReq() {
|
||||
return mChannel != null && mChannel.sendGetAllParamReq();
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数获取请求
|
||||
* 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq)}
|
||||
*
|
||||
* @param paramType 参数类型{@link Constants.PARAM_TYPE}
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendGetParamReq(@Define.ParamType int paramType) {
|
||||
return mChannel != null && mChannel.sendGetParamReq(paramType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发生行程相关
|
||||
* type=1或2的时 需要参数 lineName
|
||||
@@ -831,6 +964,28 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return mChannel != null && mChannel.sendBagManagerCmd(bagManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制V2N数据给车端PnC
|
||||
*
|
||||
* @param switchCmd true为发给PnC,false为不发给PnC
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendV2nToPncCmd(boolean switchCmd) {
|
||||
return mChannel != null && mChannel.sendV2nToPncCmd(switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盲区数据开关
|
||||
*
|
||||
* @param switchCmd 数据开关
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBlindAreaCmd(boolean switchCmd) {
|
||||
return mChannel != null && mChannel.sendBlindAreaCmd(switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* FSM状态原因查询
|
||||
* 当FSMFunctionStates的类型是XXX_DRIVING_OFF时查询OFF的原因
|
||||
@@ -998,7 +1153,11 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
|
||||
/**
|
||||
* 解析版本 格式 xxx.xxx.xxx(x的数量不固定)
|
||||
* 如果用于比较,仅适用于除个位数非0的字符串,例如:"12.03.04" 解析出为120304可能无法正常对比
|
||||
* 仅用于版本比较,不能用于展示
|
||||
* 例如:
|
||||
* "12.03.04" 解析结果:120304
|
||||
* "2.11.0" 解析结果:21100
|
||||
* "3.0.0" 解析结果:30000
|
||||
* 目前已用于DockerVersion和MaserVersion的解析
|
||||
*
|
||||
* @param ver 版本字符串 例如:"MAP-taxi_RoboTaxi_df_2.8.0.3_20220928_test" 解析结果为:280
|
||||
@@ -1010,7 +1169,11 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
|
||||
/**
|
||||
* 解析版本 格式 xxx.xxx.xxx(x的数量不固定)
|
||||
* 如果用于比较,仅适用于非个位数非0的字符串,例如:"12.03.04" 解析出为120304可能无法正常对比
|
||||
* 仅用于版本比较,不能用于展示
|
||||
* 例如:
|
||||
* "12.03.04" 解析结果:120304
|
||||
* "2.11.0" 解析结果:21100
|
||||
* "3.0.0" 解析结果:30000
|
||||
* 目前已用于DockerVersion和MaserVersion的解析
|
||||
*
|
||||
* @param isUseAll 是否使用全部截取数据 true:表示 12.34.56 截取之后 123456 false:表示12.34.56 截取之后 12
|
||||
@@ -1025,8 +1188,12 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
if (matcher.find()) {
|
||||
String group = matcher.group();
|
||||
if (!TextUtils.isEmpty(group)) {
|
||||
String format = "%02d";
|
||||
if (isUseAll) {
|
||||
group = group.replace(".", "");
|
||||
String[] temp = group.split("\\.");
|
||||
group = String.format(Locale.getDefault(), format, Integer.parseInt(temp[0]));
|
||||
group += String.format(Locale.getDefault(), format, Integer.parseInt(temp[1]));
|
||||
group += String.format(Locale.getDefault(), format, Integer.parseInt(temp[2]));
|
||||
} else {
|
||||
group = group.split("\\.")[0];
|
||||
}
|
||||
|
||||
@@ -326,13 +326,31 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
boolean subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull MessageType messageType);
|
||||
|
||||
/**
|
||||
* 给Planning发送靠边停车指令
|
||||
*
|
||||
* @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持
|
||||
* @return boolean 是否加入发送队列
|
||||
*/
|
||||
boolean sendPlanningPullOverCmd(int pullOverCmd);
|
||||
|
||||
/**
|
||||
* 给Planning发送变道指令
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策
|
||||
* @return boolean 是否加入发送队列
|
||||
*/
|
||||
boolean sendPlanningLaneChangeCmd(int laneChangeCmd);
|
||||
|
||||
/**
|
||||
* 给Planning发送指令
|
||||
*
|
||||
* @param cmd 命令 0: default 1: 靠边停车 2:重新起步
|
||||
* @return boolean
|
||||
* @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持
|
||||
* @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策 TODO laneChangeCmd 目前仅襄阳牌照考试支持
|
||||
* @return boolean 是否加入发送队列
|
||||
*/
|
||||
boolean sendPlanningCmd(int cmd);
|
||||
boolean sendPlanningCmd(int pullOverCmd, int laneChangeCmd);
|
||||
|
||||
/**
|
||||
* 福田清扫车业务指令下发
|
||||
@@ -488,6 +506,77 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
boolean sendDetouringSpeed(double speed);
|
||||
|
||||
/**
|
||||
* AEB开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:关闭,1:开启
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendAebCmd(int enable);
|
||||
|
||||
/**
|
||||
* 限制绕障开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:正常绕障 1:限制绕障 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendLaneChangeRestrainValid(int enable);
|
||||
|
||||
|
||||
/**
|
||||
* 停车让行线前避让等待开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:停车让行线前无需避让等待 1:停车让行线前需要避让等待 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendStopYieldValid(int enable);
|
||||
|
||||
|
||||
/**
|
||||
* 地图限速功能开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:不使用地图限速功能 1:使用地图限速功能 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendHadmapSpeedLimitValid(int enable);
|
||||
|
||||
/**
|
||||
* 环岛模式开关
|
||||
* TODO 目前仅襄阳牌照考试支持
|
||||
*
|
||||
* @param enable 0:普通模式 1:环岛模式 默认0
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendRampThetaValid(int enable);
|
||||
|
||||
/**
|
||||
* 弱网减速停车策略开关
|
||||
*
|
||||
* @param enable 0:关闭弱网减速停车策略 1:使用弱网减速停车策略
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendWeakNetSlowDown(int enable);
|
||||
|
||||
/**
|
||||
* 获取全部参数
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendGetAllParamReq();
|
||||
|
||||
/**
|
||||
* 参数获取请求
|
||||
*
|
||||
* @param paramType
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendGetParamReq(@Define.ParamType int paramType);
|
||||
|
||||
|
||||
/**
|
||||
* 发生行程相关
|
||||
* type=1或2的时 需要参数 lineName
|
||||
@@ -511,6 +600,22 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
boolean sendBagManagerCmd(BagManagerOuterClass.BagManager bagManager);
|
||||
|
||||
/**
|
||||
* 控制V2N数据给车端PnC
|
||||
*
|
||||
* @param switchCmd true为发给PnC,false为不发给PnC
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendV2nToPncCmd(boolean switchCmd);
|
||||
|
||||
/**
|
||||
* 盲区数据开关
|
||||
*
|
||||
* @param switchCmd 数据开关
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendBlindAreaCmd(boolean switchCmd);
|
||||
|
||||
/**
|
||||
* FSM状态原因查询
|
||||
* 当FSMFunctionStates的类型是XXX_DRIVING_OFF时查询OFF的原因
|
||||
|
||||
@@ -4,9 +4,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.support.obu.ObuScene;
|
||||
import com.zhidao.support.adas.high.bean.AdasParam;
|
||||
import com.zhidao.support.adas.high.common.MessageType;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask;
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask;
|
||||
@@ -21,6 +24,8 @@ import chassis.ChassisStatesOuterClass;
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import function_state_management.FunctionStates;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.v2x.MogoV2X;
|
||||
import mogo.v2x.RoadOverviewEvents;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import perception.TrafficLightOuterClass;
|
||||
import planning.RoboSweeperTaskIndexOuterClass;
|
||||
@@ -366,6 +371,38 @@ public interface OnAdasListener {
|
||||
*/
|
||||
void onBagManagerCmd(MessagePad.Header header, BagManagerOuterClass.BagManager bagManager);
|
||||
|
||||
/**
|
||||
* 主车附近事件推送
|
||||
*
|
||||
* @param header 头
|
||||
* @param rsi 数据
|
||||
*/
|
||||
void onV2nCongestionEvent(@NotNull MessagePad.Header header, @NotNull MogoV2X.RSI_PB rsi);
|
||||
|
||||
/**
|
||||
* 主车路径全局事件推送
|
||||
*
|
||||
* @param header 头
|
||||
* @param roadOverview 主车路径全局事件推送
|
||||
* @param construct 施工
|
||||
* @param triangle 三角牌
|
||||
* @param congestion 拥堵
|
||||
* @param parkingViolation 违停 ---包含 静态障碍车
|
||||
*/
|
||||
void onV2nGlobalPathEvents(@NotNull MessagePad.Header header, @NotNull RoadOverviewEvents.RoadOverviewData roadOverview, @Nullable MogoV2X.RSI_PB construct, @Nullable MogoV2X.RSI_PB triangle, @Nullable MogoV2X.RSI_PB congestion, @Nullable MogoV2X.RSM_PB parkingViolation);
|
||||
|
||||
/**
|
||||
* 参数获取应答
|
||||
* <p>
|
||||
* 调用{@link AdasManager#sendGetAllParamReq()}或{@link AdasManager#sendGetParamReq(int)}
|
||||
* 如果对应的value是空串,说明没有这个param或者get失败了。重启后值还是在redis里
|
||||
*
|
||||
* @param header 头
|
||||
* @param getParamResp 配置参数
|
||||
* @param adasParam 解析后的配置参数
|
||||
*/
|
||||
void onGetParamResp(@NotNull MessagePad.Header header, @NotNull MessagePad.SetParamReq getParamResp, @NotNull AdasParam adasParam);
|
||||
|
||||
/**
|
||||
* M1拼接视频 10Hz
|
||||
* 此接口需要订阅,默认不发送数据
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* 工控机配置参数
|
||||
* -1表示未知,说明没有这个param或者get失败
|
||||
*/
|
||||
public class AdasParam {
|
||||
/**
|
||||
* 绕障类功能开关
|
||||
* -1:未知 0:关闭 1:开启
|
||||
*/
|
||||
public final int detouringCmd;
|
||||
/**
|
||||
* 变道绕障的目标障碍物速度阈值
|
||||
* -1:未知
|
||||
*/
|
||||
public final double detouringSpeed;
|
||||
/**
|
||||
* AEB开关
|
||||
* -1:未知 0:关闭自动紧急制动功能 1:启用自动紧急制动功能
|
||||
*/
|
||||
public final int aebCmd;
|
||||
/**
|
||||
* 限制绕障开关
|
||||
* -1:未知 0(默认):正常绕障 1:限制绕障
|
||||
*/
|
||||
public final int laneChangeRestrainValid;
|
||||
/**
|
||||
* 停车让行线前避让等待开关
|
||||
* -1:未知 0(默认):停车让行线前无需等待 1:停车让行线前需要等待
|
||||
*/
|
||||
public final int stopYieldValid;
|
||||
/**
|
||||
* 地图限速功能开关
|
||||
* -1:未知 0(默认):不使用地图限速功能 1:使用地图限速功能
|
||||
*/
|
||||
public final int hadmapSpeedLimitValid;
|
||||
/**
|
||||
* 环岛模式开关
|
||||
* -1:未知 0(默认):普通模式 1:环岛模式
|
||||
*/
|
||||
public final int rampThetaValid;
|
||||
/**
|
||||
* 弱网减速停车策略开关
|
||||
* -1:未知 0:关闭弱网减速停车策略 1(默认):使用弱网减速停车策略
|
||||
*/
|
||||
public final int weakNetSlowDown;
|
||||
|
||||
public AdasParam(MessagePad.SetParamReq param) {
|
||||
int detouringCmd = -1;
|
||||
double detouringSpeed = -1.0;
|
||||
int aebCmd = -1;
|
||||
int laneChangeRestrainValid = -1;
|
||||
int stopYieldValid = -1;
|
||||
int hadmapSpeedLimitValid = -1;
|
||||
int rampThetaValid = -1;
|
||||
int weakNetSlowDown = -1;
|
||||
if (param != null) {
|
||||
int size = param.getReqsCount();
|
||||
if (size > 0) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
MessagePad.SetOneParam oneParam = param.getReqs(i);
|
||||
int type = oneParam.getType();
|
||||
String value = oneParam.getValue();
|
||||
if (type == Constants.PARAM_TYPE.DETOURING) {
|
||||
if (!TextUtils.isEmpty(value)) {
|
||||
detouringCmd = Integer.parseInt(value);
|
||||
}
|
||||
} else if (type == Constants.PARAM_TYPE.DETOURING_SPEED) {
|
||||
if (!TextUtils.isEmpty(value)) {
|
||||
detouringSpeed = Double.parseDouble(value);
|
||||
}
|
||||
} else if (type == Constants.PARAM_TYPE.AEB) {
|
||||
if (!TextUtils.isEmpty(value)) {
|
||||
aebCmd = Integer.parseInt(value);
|
||||
}
|
||||
} else if (type == Constants.PARAM_TYPE.LANE_CHANGE_RESTRAIN_VALID) {
|
||||
if (!TextUtils.isEmpty(value)) {
|
||||
laneChangeRestrainValid = Integer.parseInt(value);
|
||||
}
|
||||
} else if (type == Constants.PARAM_TYPE.STOP_YIELD_VALID) {
|
||||
if (!TextUtils.isEmpty(value)) {
|
||||
stopYieldValid = Integer.parseInt(value);
|
||||
}
|
||||
} else if (type == Constants.PARAM_TYPE.HADMAP_SPEED_LIMIT_VALID) {
|
||||
if (!TextUtils.isEmpty(value)) {
|
||||
hadmapSpeedLimitValid = Integer.parseInt(value);
|
||||
}
|
||||
} else if (type == Constants.PARAM_TYPE.RAMP_THETA_VALID) {
|
||||
if (!TextUtils.isEmpty(value)) {
|
||||
rampThetaValid = Integer.parseInt(value);
|
||||
}
|
||||
} else if (type == Constants.PARAM_TYPE.WEAK_NET_SLOW_DOWN) {
|
||||
if (!TextUtils.isEmpty(value)) {
|
||||
weakNetSlowDown = Integer.parseInt(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.detouringCmd = detouringCmd;
|
||||
this.detouringSpeed = detouringSpeed;
|
||||
this.aebCmd = aebCmd;
|
||||
this.laneChangeRestrainValid = laneChangeRestrainValid;
|
||||
this.stopYieldValid = stopYieldValid;
|
||||
this.hadmapSpeedLimitValid = hadmapSpeedLimitValid;
|
||||
this.rampThetaValid = rampThetaValid;
|
||||
this.weakNetSlowDown = weakNetSlowDown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "绕障类功能开关=" + (detouringCmd == -1 ? "未知" : detouringCmd == 0 ? "关" : "开") +
|
||||
"\n变道绕障的目标障碍物速度阈值=" + (detouringSpeed == -1 ? "未知" : detouringSpeed + "m/s") +
|
||||
"\nAEB开关=" + (aebCmd == -1 ? "未知" : aebCmd == 0 ? "关" : "开") +
|
||||
"\n限制绕障开关=" + (laneChangeRestrainValid == -1 ? "未知" : laneChangeRestrainValid == 0 ? "正常绕障" : "限制绕障") +
|
||||
"\n停车让行线前避让等待开关=" + (stopYieldValid == -1 ? "未知" : stopYieldValid == 0 ? "无需等待" : "等待") +
|
||||
"\n地图限速功能开关=" + (hadmapSpeedLimitValid == -1 ? "未知" : hadmapSpeedLimitValid == 0 ? "不使用" : "使用") +
|
||||
"\n环岛模式开关=" + (rampThetaValid == -1 ? "未知" : rampThetaValid == 0 ? "普通模式" : "环岛模式") +
|
||||
"\n弱网减速停车策略开关=" + (weakNetSlowDown == -1 ? "未知" : weakNetSlowDown == 0 ? "关闭" : "使用");
|
||||
}
|
||||
}
|
||||
@@ -120,4 +120,18 @@ public class Constants {
|
||||
int OLD_CHASSIS = 1;//老底盘
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数类型
|
||||
*/
|
||||
public interface PARAM_TYPE {
|
||||
int UNKNOWN = -1;
|
||||
int DETOURING = 1;//绕障类功能开关
|
||||
int DETOURING_SPEED = 2;//变道绕障的目标障碍物速度阈值
|
||||
int AEB = 3;//AEB开关
|
||||
int LANE_CHANGE_RESTRAIN_VALID = 4;//限制绕障开关
|
||||
int STOP_YIELD_VALID = 5;//停车让行线前避让等待开关
|
||||
int HADMAP_SPEED_LIMIT_VALID = 6;//地图限速功能开关
|
||||
int RAMP_THETA_VALID = 7;//环岛模式开关
|
||||
int WEAK_NET_SLOW_DOWN = 8;//弱网减速停车策略开关
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,4 +54,12 @@ public final class Define {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface AutopilotStartStatus {
|
||||
}
|
||||
|
||||
@IntDef(flag = true, value = {Constants.PARAM_TYPE.DETOURING, Constants.PARAM_TYPE.DETOURING_SPEED,
|
||||
Constants.PARAM_TYPE.AEB, Constants.PARAM_TYPE.LANE_CHANGE_RESTRAIN_VALID,
|
||||
Constants.PARAM_TYPE.STOP_YIELD_VALID, Constants.PARAM_TYPE.HADMAP_SPEED_LIMIT_VALID,
|
||||
Constants.PARAM_TYPE.RAMP_THETA_VALID, Constants.PARAM_TYPE.WEAK_NET_SLOW_DOWN})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ParamType {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,11 @@ public enum MessageType {
|
||||
TYPE_SEND_BAG_MANAGER_CMD(MessagePad.MessageType.MsgTypeBagManagerCmd, "Bag管理请求"),
|
||||
TYPE_RECEIVE_BAG_MANAGER_CMD(MessagePad.MessageType.MsgTypeBagManagerCmd, "Bag管理应答"),
|
||||
TYPE_SEND_PLANNING_CMD(MessagePad.MessageType.MsgTypePlanningCmd, "给Planning指令"),
|
||||
TYPE_SEND_SET_PARAM_REQ_V2(MessagePad.MessageType.MsgTypeSetParamReqV2, "设置参数命令V2"),
|
||||
TYPE_RECEIVE_V2N_CONGESTION_EVENT(MessagePad.MessageType.MsgTypeV2nCongestionEvent, "主车附近事件推送"),
|
||||
TYPE_RECEIVE_V2N_GLOBAL_PATH_EVENTS(MessagePad.MessageType.MsgTypeV2nGlobalPathEvents, "主车路径全局事件推送"),
|
||||
TYPE_SEND_GET_PARAM_REQ(MessagePad.MessageType.MsgTypeGetParamReq, "参数获取请求"),
|
||||
TYPE_RECEIVE_GET_PARAM_RESP(MessagePad.MessageType.MsgTypeGetParamResp, "参数获取应答"),
|
||||
TYPE_SEND_SWEEPER_CLOUD_TASK_CMD(MessagePad.MessageType.MsgTypeTaskCmd, "发送清扫车指令到云控"),
|
||||
TYPE_RECEIVE_SWEEPER_CLOUD_TASK_CMD(MessagePad.MessageType.MsgTypeTaskCmd, "云控下发清扫车任务指令"),
|
||||
TYPE_SEND_FSM_STATUS_REASON_QUERY_REQ(MessagePad.MessageType.MsgTypeFSMStatusReasonQueryReq, "FSM状态原因查询"),
|
||||
|
||||
@@ -27,8 +27,10 @@ public class AutopilotAbility250 {
|
||||
private static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "};
|
||||
private volatile Timer timer;
|
||||
private ChassisStatesOuterClass.ChassisStates chassisStates;
|
||||
private int mapVersion = -1;//工控机版本
|
||||
|
||||
public AutopilotAbility250() {
|
||||
public AutopilotAbility250(int mapVersion) {
|
||||
this.mapVersion = mapVersion;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,12 +58,12 @@ public class AutopilotAbility250 {
|
||||
version = AdasManager.getInstance().parseVersion(false, masterVersion);
|
||||
}
|
||||
//SSM 3版本兼容
|
||||
if (version > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
|
||||
if (mapVersion >= 30400 && version > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
if (!isAutopilotAbility) {
|
||||
unableAutopilotReason = statusInfo.getAutoPilotUnreadyReason();
|
||||
}
|
||||
} else if (version > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
|
||||
} else if (mapVersion >= 21000 && version > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
if (!isAutopilotAbility) {
|
||||
SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList();
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zhidao.support.adas.high.common.autopilot.ability;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
@@ -164,24 +163,24 @@ public class AutopilotAbilityManager {
|
||||
|
||||
private void initAutopilotAbility() {
|
||||
//目前只有MAP330的清扫车用的新的FSM状态原因查询
|
||||
if (mapVersion >= 330 && isFutianSweeper) {
|
||||
Log.i(TAG, "是否可以启动自动驾驶能力检测使用330版本");
|
||||
if (mapVersion >= 30300 && isFutianSweeper) {
|
||||
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用330版本");
|
||||
stop230();
|
||||
stop250();
|
||||
if (autopilotAbility330 == null) {
|
||||
autopilotAbility330 = new AutopilotAbility330();
|
||||
autopilotAbility330.start();
|
||||
}
|
||||
} else if (mapVersion >= 250) {
|
||||
Log.i(TAG, "是否可以启动自动驾驶能力检测使用250版本");
|
||||
} else if (mapVersion >= 20500) {
|
||||
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用250版本");
|
||||
stop230();
|
||||
stop330();
|
||||
if (autopilotAbility250 == null) {
|
||||
autopilotAbility250 = new AutopilotAbility250();
|
||||
autopilotAbility250 = new AutopilotAbility250(mapVersion);
|
||||
autopilotAbility250.start();
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG, "是否可以启动自动驾驶能力检测使用230版本");
|
||||
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用230版本");
|
||||
stop250();
|
||||
stop330();
|
||||
if (autopilotAbility230 == null) {
|
||||
@@ -231,7 +230,7 @@ public class AutopilotAbilityManager {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mapVersion == -1 && AdasManager.getInstance().getIpcConnectionStatus() == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
mapVersion = 230;
|
||||
mapVersion = 20300;
|
||||
initAutopilotAbility();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AdasParam;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* 参数获取应答
|
||||
*/
|
||||
public class GetParamRespMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.SetParamReq getParamResp = MessagePad.SetParamReq.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
|
||||
AdasChannel.calculateTimeConsumingOnDispatchRaw("参数获取应答", raw.receiveTime);
|
||||
long nowTime = 0;
|
||||
if (CupidLogUtils.isEnableLog())
|
||||
nowTime = SystemClock.elapsedRealtime();
|
||||
if (adasListener != null) {
|
||||
adasListener.onGetParamResp(raw.getHeader(), getParamResp, new AdasParam(getParamResp));
|
||||
}
|
||||
AdasChannel.calculateTimeConsumingBusiness("参数获取应答", nowTime);
|
||||
// CupidLogUtils.e("到站提醒--->" + arrivalNotification.toString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,6 +38,9 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
private IMsg bagManagerMessage;//Bag管理应答
|
||||
private IMsg backCameraVideoMessage;//清扫车后摄像头
|
||||
private IMsg pointCloudMessage;//3D点云
|
||||
private IMsg v2nCongestionEventMessage;//主车附近事件推送
|
||||
private IMsg v2nGlobalPathEventsMessage;//主车路径全局事件推送
|
||||
private IMsg getParamRespMessage;//参数获取应答
|
||||
private IMsg sweeperCloudTaskMessage;//云控下发清扫车任务指令
|
||||
private IMsg m1StitchedVideoMessage;//M1拼接视频
|
||||
private IMsg fSMStatusReasonRespondMessage;//FSM状态原因查询
|
||||
@@ -200,6 +203,24 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
backCameraVideoMessage = new BackCameraVideoMessage();
|
||||
}
|
||||
return backCameraVideoMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_V2N_CONGESTION_EVENT.typeCode) {
|
||||
//主车附近事件推送
|
||||
if (v2nCongestionEventMessage == null) {
|
||||
v2nCongestionEventMessage = new V2nCongestionEventMessage();
|
||||
}
|
||||
return v2nCongestionEventMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_V2N_GLOBAL_PATH_EVENTS.typeCode) {
|
||||
//主车路径全局事件推送
|
||||
if (v2nGlobalPathEventsMessage == null) {
|
||||
v2nGlobalPathEventsMessage = new V2nGlobalPathEventsMessage();
|
||||
}
|
||||
return v2nGlobalPathEventsMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_GET_PARAM_RESP.typeCode) {
|
||||
//参数获取应答
|
||||
if (getParamRespMessage == null) {
|
||||
getParamRespMessage = new GetParamRespMessage();
|
||||
}
|
||||
return getParamRespMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_SWEEPER_CLOUD_TASK_CMD.typeCode) {
|
||||
//云控下发清扫车任务指令
|
||||
if (sweeperCloudTaskMessage == null) {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
|
||||
import mogo.v2x.MogoV2X;
|
||||
|
||||
/**
|
||||
* 主车附近事件推送
|
||||
*/
|
||||
public class V2nCongestionEventMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MogoV2X.RSI_PB rsi = MogoV2X.RSI_PB.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
|
||||
AdasChannel.calculateTimeConsumingOnDispatchRaw("主车附近事件推送", raw.receiveTime);
|
||||
long nowTime = 0;
|
||||
if (CupidLogUtils.isEnableLog())
|
||||
nowTime = SystemClock.elapsedRealtime();
|
||||
if (adasListener != null) {
|
||||
adasListener.onV2nCongestionEvent(raw.getHeader(), rsi);
|
||||
}
|
||||
AdasChannel.calculateTimeConsumingBusiness("主车附近事件推送", nowTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
|
||||
import mogo.v2x.MogoV2X;
|
||||
import mogo.v2x.RoadOverviewEvents;
|
||||
|
||||
/**
|
||||
* 主车路径全局事件推送
|
||||
*/
|
||||
public class V2nGlobalPathEventsMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
RoadOverviewEvents.RoadOverviewData roadOverview = RoadOverviewEvents.RoadOverviewData.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
|
||||
MogoV2X.RSI_PB construct = null;
|
||||
MogoV2X.RSI_PB triangle = null;
|
||||
MogoV2X.RSI_PB congestion = null;
|
||||
MogoV2X.RSM_PB parkingViolation = null;
|
||||
//施工 RSI_PB
|
||||
ByteString constructData = roadOverview.getConstructData();
|
||||
if (!constructData.isEmpty()) {
|
||||
construct = MogoV2X.RSI_PB.parseFrom(constructData);
|
||||
}
|
||||
//三角牌 RSI_PB
|
||||
ByteString triangleData = roadOverview.getTriangleData();
|
||||
if (!triangleData.isEmpty()) {
|
||||
triangle = MogoV2X.RSI_PB.parseFrom(triangleData);
|
||||
}
|
||||
//拥堵 RSI_PB
|
||||
ByteString congestionData = roadOverview.getCongestionData();
|
||||
if (!congestionData.isEmpty()) {
|
||||
congestion = MogoV2X.RSI_PB.parseFrom(congestionData);
|
||||
}
|
||||
//违停 ---包含 静态障碍车 RSM_PB
|
||||
ByteString parkingViolationData = roadOverview.getParkingViolationData();
|
||||
if (!parkingViolationData.isEmpty()) {
|
||||
parkingViolation = MogoV2X.RSM_PB.parseFrom(parkingViolationData);
|
||||
}
|
||||
AdasChannel.calculateTimeConsumingOnDispatchRaw("主车路径全局事件推送", raw.receiveTime);
|
||||
long nowTime = 0;
|
||||
if (CupidLogUtils.isEnableLog())
|
||||
nowTime = SystemClock.elapsedRealtime();
|
||||
if (adasListener != null) {
|
||||
adasListener.onV2nGlobalPathEvents(raw.getHeader(), roadOverview, construct, triangle, congestion, parkingViolation);
|
||||
}
|
||||
AdasChannel.calculateTimeConsumingBusiness("主车路径全局事件推送", nowTime);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ plugins {
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.center.CenterLine;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.overlay.line.Polyline;
|
||||
import com.mogo.map.overlay.point.Point;
|
||||
import com.mogo.map.overlay.proxy.line.IMapPolylineOverlay;
|
||||
import com.mogo.map.overlay.proxy.point.IMapPointOverlay;
|
||||
import com.mogo.map.road.RoadNameInfo;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
@@ -37,19 +33,9 @@ public interface IMogoMap {
|
||||
*/
|
||||
IMogoMapUIController getUIController();
|
||||
|
||||
/**
|
||||
* 在地图上添一个图片标记(marker)对象。
|
||||
*
|
||||
* @param tag 标识服务
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoMarker addMarker(String tag, MogoMarkerOptions options);
|
||||
IMapPointOverlay addPoint(Point.Options options);
|
||||
|
||||
/**
|
||||
* 清除所有marker
|
||||
*/
|
||||
void clearAllMarkers();
|
||||
IMapPolylineOverlay addLine(Polyline.Options options);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
@@ -80,16 +66,6 @@ public interface IMogoMap {
|
||||
*/
|
||||
void removeMarker(String uuidString);
|
||||
|
||||
/**
|
||||
* 在地图上添一组图片标记(marker)对象,并设置是否改变地图状态以至于所有的marker对象都在当前地图可视区域范围内显示。
|
||||
*
|
||||
* @param tag 标识服务
|
||||
* @param options
|
||||
* @param moveToCenter
|
||||
* @return
|
||||
*/
|
||||
ArrayList<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter);
|
||||
|
||||
/**
|
||||
* 从地图上删除所有的overlay(marker,circle,polyline 等对象)。
|
||||
*/
|
||||
@@ -124,6 +100,14 @@ public interface IMogoMap {
|
||||
*/
|
||||
void changeZoom(float zoom);
|
||||
|
||||
|
||||
/**
|
||||
* 改变地图缩放级别的别一种方式
|
||||
*
|
||||
* @param zoom 缩放等级
|
||||
*/
|
||||
void changeZoom2(float zoom);
|
||||
|
||||
/**
|
||||
* 获取缩放比例
|
||||
*
|
||||
@@ -136,14 +120,6 @@ public interface IMogoMap {
|
||||
*/
|
||||
float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK);
|
||||
|
||||
/**
|
||||
* 添加线段
|
||||
*
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoPolyline addPolyline(MogoPolylineOptions options);
|
||||
|
||||
/**
|
||||
* 获取行驶方向一定长度的中心线
|
||||
*
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.mogo.map.identity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 地图 marker 管理
|
||||
*/
|
||||
public interface IMogoIdentifyManager {
|
||||
|
||||
|
||||
/**
|
||||
* 要移除的感知数据uuid
|
||||
*
|
||||
* @param uuidString
|
||||
*/
|
||||
void removeMarker(String uuidString);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList);
|
||||
|
||||
/**
|
||||
* 添加感知使用到的3d模型
|
||||
*
|
||||
* @param type
|
||||
* @param modelRes
|
||||
*/
|
||||
String addPreVehicleModel(int type, int modelRes);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 自定义 infowindow 适配器
|
||||
*/
|
||||
public interface IMogoInfoWindowAdapter {
|
||||
|
||||
/**
|
||||
* 获取infowindow的布局
|
||||
*
|
||||
* @param marker
|
||||
* @return
|
||||
*/
|
||||
View getInfoWindow( IMogoMarker marker );
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 地图 marker 抽象
|
||||
*/
|
||||
public interface IMogoMarker {
|
||||
|
||||
/**
|
||||
* 删除当前marker并销毁Marker的图片等资源
|
||||
*/
|
||||
void destroy();
|
||||
|
||||
/**
|
||||
* 删除当前marker。
|
||||
*/
|
||||
void remove();
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*
|
||||
* @param alpha
|
||||
*/
|
||||
void setAlpha( float alpha );
|
||||
|
||||
/**
|
||||
* 设置 Marker覆盖物的图标
|
||||
*
|
||||
* @param bitmap
|
||||
*/
|
||||
void setIcon( Bitmap bitmap );
|
||||
|
||||
/**
|
||||
* 设置 Marker 的图标集合,相同图案的 icon 的 marker 最好使用同一个 BitmapDescriptor 对象以节省内存空间。
|
||||
*
|
||||
* @param icons
|
||||
*/
|
||||
void setIcons( ArrayList< Bitmap > icons );
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的属性选项类 通过markerOption 给marker设置属性
|
||||
*
|
||||
* @param opt
|
||||
*/
|
||||
void setMarkerOptions( MogoMarkerOptions opt );
|
||||
|
||||
/**
|
||||
* 可以存储业务相关的数据
|
||||
*
|
||||
* @param object
|
||||
*/
|
||||
void setObject( Object object );
|
||||
|
||||
/**
|
||||
* @return 用户设置的 object 对象
|
||||
*/
|
||||
Object getObject();
|
||||
|
||||
/**
|
||||
* 设置位置
|
||||
*
|
||||
* @param lat
|
||||
* @param lng
|
||||
*/
|
||||
void setPosition( double lat, double lng );
|
||||
|
||||
/**
|
||||
* 获取坐标点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoLatLng getPosition();
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物图片旋转的角度,从正北开始,逆时针计算。
|
||||
*
|
||||
* @param rotate
|
||||
*/
|
||||
void setRotateAngle( float rotate );
|
||||
|
||||
/**
|
||||
* 设置Marker 覆盖物的标题。
|
||||
*
|
||||
* @param title
|
||||
*/
|
||||
void setTitle( String title );
|
||||
|
||||
/**
|
||||
* 设置当前marker在最上面。
|
||||
*/
|
||||
void setToTop();
|
||||
|
||||
/**
|
||||
* 设置 Marker 覆盖物的可见属性。
|
||||
*
|
||||
* @param visible
|
||||
*/
|
||||
void setVisible( boolean visible );
|
||||
|
||||
|
||||
/**
|
||||
* 设置点击事件
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void setOnMarkerClickListener( IMogoMarkerClickListener listener );
|
||||
|
||||
/**
|
||||
* 获取点击事件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMarkerClickListener getOnMarkerClickListener();
|
||||
|
||||
/**
|
||||
* 自定义 infowindow 样式接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoInfoWindowAdapter getInfoWindowAdapter();
|
||||
|
||||
/**
|
||||
* 是否被销毁
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDestroyed();
|
||||
|
||||
/**
|
||||
* 设置marker的归属模块
|
||||
*
|
||||
* @param mOwner
|
||||
*/
|
||||
void setOwner( String mOwner );
|
||||
|
||||
/**
|
||||
* 获取marker的归属模块
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getOwner();
|
||||
|
||||
/**
|
||||
* Marker 配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoMarkerOptions getMogoMarkerOptions();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 缩放动画
|
||||
*
|
||||
* @param fromX
|
||||
* @param toX
|
||||
* @param fromY
|
||||
* @param toY
|
||||
* @param duration
|
||||
* @param interpolator
|
||||
* @param listener
|
||||
*/
|
||||
void startScaleAnimation( float fromX,
|
||||
float toX,
|
||||
float fromY,
|
||||
float toY,
|
||||
int duration,
|
||||
Interpolator interpolator,
|
||||
OnMarkerAnimationListener listener );
|
||||
|
||||
/**
|
||||
* 是否是否可点击
|
||||
*
|
||||
* @param clickable
|
||||
*/
|
||||
void setClickable( boolean clickable );
|
||||
|
||||
|
||||
/**
|
||||
* 设置是否是gps
|
||||
*
|
||||
* @param isGps
|
||||
*/
|
||||
void setGps( boolean isGps );
|
||||
|
||||
/**
|
||||
* 设置3D车模颜色
|
||||
*
|
||||
* @param anchorColor
|
||||
*/
|
||||
default void setAnchorColor( String anchorColor ) {
|
||||
|
||||
}
|
||||
|
||||
default void addDynamicAnchorPosition( MogoLatLng latLng, float angle, long duration ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 marker 内部使用资源内容 md5
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
default String getMarkerResName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* marker 点击事件
|
||||
*/
|
||||
public interface IMogoMarkerClickListener {
|
||||
|
||||
/**
|
||||
* 事件是否继续往下传递
|
||||
*
|
||||
* @param marker
|
||||
* @return true - 事件已经处理完毕不继续往下传,否则继续往下传
|
||||
*/
|
||||
default boolean onMarkerClicked(IMogoMarker marker){
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* 地图上静态Marker点击事件传递
|
||||
* @param marker
|
||||
* @return true - 事件已经处理完毕不继续往下传,否则继续往下传
|
||||
*/
|
||||
default boolean onStaticMarkerClicked(IMogoMarker marker){
|
||||
return false;
|
||||
};
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 地图操作回调
|
||||
*/
|
||||
public interface IMogoMarkerClickListenerRegister {
|
||||
|
||||
/**
|
||||
* 注册marker回调,各业务模块不用关注
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerMarkerClickListener(String tag, IMogoMarkerClickListener listener );
|
||||
|
||||
|
||||
/**
|
||||
* 注销marker回调,各业务模块不需要关注
|
||||
*/
|
||||
void unregisterMarkerClickListener(String tag);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-29
|
||||
* <p>
|
||||
* 动态变换 marker 样式接口
|
||||
*/
|
||||
public interface IMogoMarkerIconViewCreator {
|
||||
|
||||
/**
|
||||
* 返回自定义marker样式
|
||||
*
|
||||
* @param marker marker 的数据
|
||||
* @return
|
||||
*/
|
||||
View createView( IMogoMarker marker );
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 地图 marker 管理
|
||||
*/
|
||||
public interface IMogoMarkerManager {
|
||||
|
||||
/**
|
||||
* 添加marker
|
||||
*
|
||||
* @param tag 标识调用者
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoMarker addMarker(String tag, MogoMarkerOptions options);
|
||||
|
||||
/**
|
||||
* 添加多个marker
|
||||
*
|
||||
* @param tag 标识调用者
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
List<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter);
|
||||
|
||||
/**
|
||||
* 清除所有marker
|
||||
*/
|
||||
void clearAllMarker();
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList);
|
||||
|
||||
/**
|
||||
* 添加感知使用到的3d模型
|
||||
*
|
||||
* @param type
|
||||
* @param modelRes
|
||||
*/
|
||||
String addPreVehicleModel(int type, int modelRes);
|
||||
|
||||
/**
|
||||
* 要移除的感知数据uuid
|
||||
*
|
||||
* @param uuidString
|
||||
*/
|
||||
void removeMarker(String uuidString);
|
||||
|
||||
/**
|
||||
* 移除某一个类型、某个模块的 markers
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
void removeMarkers(String tag);
|
||||
|
||||
/**
|
||||
* 移除地图上添加的所有markers
|
||||
*/
|
||||
void removeMarkers();
|
||||
|
||||
/**
|
||||
* 显示地图上添加的所有markers
|
||||
*/
|
||||
void visibleAllMarkers();
|
||||
|
||||
/**
|
||||
* 隐藏地图上添加的所有markers
|
||||
*/
|
||||
void inVisibleAllMarkers();
|
||||
|
||||
/**
|
||||
* 隐藏除了某些类别的所有marker {@link MogoMarkerOptions Owner}
|
||||
*
|
||||
* @param owner
|
||||
*/
|
||||
void inVisibleWithoutMarkers(String... owner); //todo 后续需要把Owner类别统一起来,基类下沉,此接口为临时方案,应该设计为隐藏某一类元素
|
||||
|
||||
/**
|
||||
* 获取某种类型的全部marker。
|
||||
*
|
||||
* @param tag 业务类型
|
||||
* @return
|
||||
*/
|
||||
List<IMogoMarker> getMarkers(String tag);
|
||||
|
||||
/**
|
||||
* 获取所有类型的marker。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Map<String, List<IMogoMarker>> getAllMarkers();
|
||||
|
||||
/**
|
||||
* 仅保留指定类型的tag
|
||||
*
|
||||
* @param tag 需要保留的类型
|
||||
*/
|
||||
void removeMarkersExcept(String tag);
|
||||
|
||||
/**
|
||||
* 添加搜索路线
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param startPoint 起点
|
||||
* @param endPoint 终点
|
||||
* @param wayPoints 途经点
|
||||
*/
|
||||
void addRouteWay(Context context, MogoLatLng startPoint, MogoLatLng endPoint, List<MogoLatLng> wayPoints);
|
||||
|
||||
/**
|
||||
* 移除添加的导航预测路线
|
||||
*/
|
||||
void removeRouteWayOverlay();
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
public class MarkerType {
|
||||
|
||||
public static final String MAP_STATIC = "mapStatic";
|
||||
public static final String MAP_STATIC_TRAFFIC = "trafficcamera";
|
||||
}
|
||||
@@ -1,460 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.location.Location;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.RawRes;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Observable;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 地图marker
|
||||
*/
|
||||
public class MogoMarkerOptions extends Observable {
|
||||
|
||||
// marker 唯一标记
|
||||
private String uuid;
|
||||
private int markerType;
|
||||
private double latitude;
|
||||
private double longitude;
|
||||
// 设置 Marker覆盖物 的标题
|
||||
private String title;
|
||||
// 设置 Marker覆盖物的 文字描述
|
||||
private String snippet;
|
||||
// 设置Marker覆盖物的图标。
|
||||
private Bitmap icon;
|
||||
// 设置Marker覆盖物的动画帧图标列表,多张图片模拟gif的效果。
|
||||
private ArrayList< Bitmap > icons;
|
||||
// 设置多少帧刷新一次图片资源,Marker动画的间隔时间,值越小动画越快。
|
||||
private int period = 20;
|
||||
// 设置Marker覆盖物的图片旋转角度,从正北开始,逆时针计算。
|
||||
private float rotate;
|
||||
// 设置Marker覆盖物是否平贴地图。
|
||||
private boolean flat = false;
|
||||
// 设置Marker覆盖物是否可见。
|
||||
private boolean visible = true;
|
||||
// 设置Marker覆盖物的InfoWindow是否允许显示
|
||||
private boolean inifoWindowEnable = true;
|
||||
// 设置Marker覆盖物的透明度
|
||||
private float alpha = 1.0f;
|
||||
|
||||
// 设置Marker覆盖物的缩放
|
||||
private float scale = 1.0f;
|
||||
|
||||
// Marker覆盖物的坐标是否是Gps
|
||||
private boolean isGps = false;
|
||||
|
||||
// Marker覆盖物锚点在水平范围的比例。
|
||||
private float u = 0.5f;
|
||||
// Marker覆盖物锚点垂直范围的比例。
|
||||
private float v = 1f;
|
||||
|
||||
// 设置Marker覆盖物是否可拖拽。
|
||||
private boolean draggable = false;
|
||||
|
||||
// Marker覆盖物的InfoWindow相对X 轴的Marker的偏移
|
||||
private int offsetX = 0;
|
||||
// Marker覆盖物的InfoWindow相对Y 轴的Marker的偏移
|
||||
private int offsetY = 0;
|
||||
|
||||
// 设置Marker覆盖物 zIndex。
|
||||
private int zIndex = 0;
|
||||
// 自定义样式
|
||||
private View mIconView;
|
||||
// marker 归属模块
|
||||
private String mOwner;
|
||||
|
||||
private Object mObject;
|
||||
|
||||
/**
|
||||
* 是否加入marker管理
|
||||
*/
|
||||
private boolean mAutoManager = true;
|
||||
|
||||
private @RawRes
|
||||
int mIcon3DRes = 0;
|
||||
private String mAnchorColor;
|
||||
|
||||
private boolean mIs3DMode = false;
|
||||
|
||||
private boolean mIsControlAngle = false;
|
||||
|
||||
/**
|
||||
* 资源名称,便于缓存重复使用,和mIcon3DRes、mIconView、icon等冲突,需要县设置
|
||||
*/
|
||||
private String mResName;
|
||||
|
||||
/**
|
||||
* 吸附在车道上
|
||||
*/
|
||||
private boolean mMatchOnRoadSide = true;
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public int getMarkerType() {
|
||||
return markerType;
|
||||
}
|
||||
|
||||
public void setMarkerType(int markerType) {
|
||||
this.markerType = markerType;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions matchOnRoadSide(boolean matchOnRoadSide ) {
|
||||
this.mMatchOnRoadSide = matchOnRoadSide;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMatchOnRoadSide() {
|
||||
return mMatchOnRoadSide;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions resName( String resName ) {
|
||||
this.mResName = resName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getResName() {
|
||||
return mResName;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions controlAngle( boolean controlAngle ) {
|
||||
this.mIsControlAngle = controlAngle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isControlAngle() {
|
||||
return mIsControlAngle;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions set3DMode( boolean is3DMode ) {
|
||||
mIs3DMode = is3DMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean is3DMode() {
|
||||
return mIs3DMode;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions position( MogoLatLng latLng ) {
|
||||
if ( latLng != null ) {
|
||||
latitude( latLng.lat );
|
||||
longitude( latLng.lon );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions position( MogoLocation location ) {
|
||||
if ( location != null ) {
|
||||
latitude( location.getLatitude() );
|
||||
longitude( location.getLongitude() );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions position( Location location ) {
|
||||
if ( location != null ) {
|
||||
latitude( location.getLatitude() );
|
||||
longitude( location.getLongitude() );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions latitude( double latitude ) {
|
||||
this.latitude = latitude;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions longitude( double longitude ) {
|
||||
this.longitude = longitude;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions title( String title ) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions snippet( String snippet ) {
|
||||
this.snippet = snippet;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 优先使用icon作为marker资源
|
||||
*
|
||||
* @param icon
|
||||
* @return
|
||||
*/
|
||||
public MogoMarkerOptions icon( Bitmap icon ) {
|
||||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions icons( ArrayList< Bitmap > icons ) {
|
||||
this.icons = icons;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions period( int period ) {
|
||||
this.period = period;
|
||||
if ( this.period < 1 ) {
|
||||
this.period = 1;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions rotate( float rotate ) {
|
||||
this.rotate = rotate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions flat( boolean flat ) {
|
||||
this.flat = flat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions visible( boolean visible ) {
|
||||
this.visible = visible;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions inifoWindowEnable( boolean inifoWindowEnable ) {
|
||||
this.inifoWindowEnable = inifoWindowEnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions alpha( float alpha ) {
|
||||
this.alpha = alpha;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions scale( float scale ) {
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MogoMarkerOptions gps( boolean gps ) {
|
||||
isGps = gps;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions anchor( float u, float v ) {
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions draggable( boolean draggable ) {
|
||||
this.draggable = draggable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions setInfoWindowOffset( int offsetX, int offsetY ) {
|
||||
this.offsetX = offsetX;
|
||||
this.offsetY = offsetY;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions zIndex( int zIndex ) {
|
||||
this.zIndex = zIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions data(Object object ) {
|
||||
this.mObject = object;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义marker图层样式,优先使用 icon {@link #icon(Bitmap)}作为marker资源
|
||||
*
|
||||
* @param iconView
|
||||
* @return
|
||||
*/
|
||||
public MogoMarkerOptions icon( View iconView ) {
|
||||
this.mIconView = iconView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions owner( String owner ) {
|
||||
this.mOwner = owner;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions icon3DRes( @RawRes int icon3DRes ) {
|
||||
this.mIcon3DRes = icon3DRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions anchorColor( String anchorColor ) {
|
||||
this.mAnchorColor = anchorColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getSnippet() {
|
||||
return snippet;
|
||||
}
|
||||
|
||||
public Bitmap getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public ArrayList< Bitmap > getIcons() {
|
||||
return icons;
|
||||
}
|
||||
|
||||
public int getPeriod() {
|
||||
return period;
|
||||
}
|
||||
|
||||
public float getRotate() {
|
||||
return rotate;
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
return flat;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public boolean isInifoWindowEnable() {
|
||||
return inifoWindowEnable;
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return alpha;
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public boolean isGps() {
|
||||
return isGps;
|
||||
}
|
||||
|
||||
public float getU() {
|
||||
return u;
|
||||
}
|
||||
|
||||
public float getV() {
|
||||
return v;
|
||||
}
|
||||
|
||||
public boolean isDraggable() {
|
||||
return draggable;
|
||||
}
|
||||
|
||||
public int getOffsetX() {
|
||||
return offsetX;
|
||||
}
|
||||
|
||||
public int getOffsetY() {
|
||||
return offsetY;
|
||||
}
|
||||
|
||||
public int getzIndex() {
|
||||
return zIndex;
|
||||
}
|
||||
|
||||
public View getIconView() {
|
||||
return mIconView;
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
public Object getObject() {
|
||||
return mObject;
|
||||
}
|
||||
|
||||
public boolean isAutoManager() {
|
||||
return mAutoManager;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions autoManager( boolean autoManager ) {
|
||||
this.mAutoManager = autoManager;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getIcon3DRes() {
|
||||
return mIcon3DRes;
|
||||
}
|
||||
|
||||
public String getAnchorColor() {
|
||||
return mAnchorColor;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions setGps(boolean gps) {
|
||||
isGps = gps;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoMarkerOptions{" +
|
||||
"uuid='" + uuid + '\'' +
|
||||
", markerType=" + markerType +
|
||||
", latitude=" + latitude +
|
||||
", longitude=" + longitude +
|
||||
", title='" + title + '\'' +
|
||||
", snippet='" + snippet + '\'' +
|
||||
", icon=" + icon +
|
||||
", icons=" + icons +
|
||||
", period=" + period +
|
||||
", rotate=" + rotate +
|
||||
", flat=" + flat +
|
||||
", visible=" + visible +
|
||||
", inifoWindowEnable=" + inifoWindowEnable +
|
||||
", alpha=" + alpha +
|
||||
", scale=" + scale +
|
||||
", isGps=" + isGps +
|
||||
", u=" + u +
|
||||
", v=" + v +
|
||||
", draggable=" + draggable +
|
||||
", offsetX=" + offsetX +
|
||||
", offsetY=" + offsetY +
|
||||
", zIndex=" + zIndex +
|
||||
", mIconView=" + mIconView +
|
||||
", mOwner='" + mOwner + '\'' +
|
||||
", mObject=" + mObject +
|
||||
", mAutoManager=" + mAutoManager +
|
||||
", mIcon3DRes=" + mIcon3DRes +
|
||||
", mAnchorColor='" + mAnchorColor + '\'' +
|
||||
", mIs3DMode=" + mIs3DMode +
|
||||
", mIsControlAngle=" + mIsControlAngle +
|
||||
", mResName='" + mResName + '\'' +
|
||||
", mMatchOnRoadSide=" + mMatchOnRoadSide +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
package com.mogo.map.marker
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.text.TextUtils
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.function.Consumer
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
*
|
||||
*
|
||||
* 管理地图上的所有marker
|
||||
*/
|
||||
class MogoMarkersHandler private constructor() : IMogoMarkerClickListener,
|
||||
IMogoMarkerClickListenerRegister {
|
||||
|
||||
companion object {
|
||||
val mogoMarkersHandler by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
MogoMarkersHandler()
|
||||
}
|
||||
}
|
||||
|
||||
private val mMap: ConcurrentHashMap<String, IMogoMarkerClickListener> = ConcurrentHashMap()
|
||||
private val mServicesMarkers: MutableMap<String, MutableList<IMogoMarker>?> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
override fun registerMarkerClickListener(tag: String, listener: IMogoMarkerClickListener) {
|
||||
if (mMap.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
mMap[tag] = listener
|
||||
}
|
||||
|
||||
override fun unregisterMarkerClickListener(tag: String) {
|
||||
if (!mMap.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
mMap.remove(tag)
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Synchronized
|
||||
fun visibleAll() {
|
||||
mServicesMarkers.values.stream()
|
||||
.filter { mogoMarkerList: List<IMogoMarker>? -> mogoMarkerList != null && !mogoMarkerList.isEmpty() }
|
||||
.forEach { mogoMarkerList: List<IMogoMarker>? ->
|
||||
mogoMarkerList!!.forEach(
|
||||
Consumer { mogoMarker: IMogoMarker -> mogoMarker.setVisible(true) })
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Synchronized
|
||||
fun inVisibleAll() {
|
||||
mServicesMarkers.values.stream()
|
||||
.filter { mogoMarkerList: List<IMogoMarker>? -> mogoMarkerList != null && !mogoMarkerList.isEmpty() }
|
||||
.forEach { mogoMarkerList: List<IMogoMarker>? ->
|
||||
mogoMarkerList!!.forEach(
|
||||
Consumer { mogoMarker: IMogoMarker -> mogoMarker.setVisible(false) })
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Synchronized
|
||||
fun inVisibleMarkers(vararg owner: String?) {
|
||||
mServicesMarkers.values.stream()
|
||||
.filter { mogoMarkerList: List<IMogoMarker>? -> mogoMarkerList != null && !mogoMarkerList.isEmpty() }
|
||||
.forEach { mogoMarkerList: List<IMogoMarker>? ->
|
||||
mogoMarkerList!!.forEach(
|
||||
Consumer { mogoMarker: IMogoMarker ->
|
||||
if (TextUtils.isEmpty(mogoMarker.owner)) {
|
||||
mogoMarker.setVisible(false)
|
||||
}
|
||||
if (!Arrays.asList(*owner).contains(mogoMarker.owner)) {
|
||||
mogoMarker.setVisible(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun removeAll() {
|
||||
val mogoMarkers: Collection<List<IMogoMarker>?> = mServicesMarkers.values
|
||||
for (mogoMarkerList in mogoMarkers) {
|
||||
if (mogoMarkerList != null && !mogoMarkerList.isEmpty()) {
|
||||
for (mogoMarker in mogoMarkerList) {
|
||||
try {
|
||||
mogoMarker.destroy()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mServicesMarkers.clear()
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun remove(tag: String) {
|
||||
val mogoMarkerList = mServicesMarkers.remove(tag)
|
||||
if (mogoMarkerList != null && !mogoMarkerList.isEmpty()) {
|
||||
for (mogoMarker in mogoMarkerList) {
|
||||
try {
|
||||
mogoMarker.destroy()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
mogoMarkerList.clear()
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun getMarkers(tag: String): List<IMogoMarker>? {
|
||||
return mServicesMarkers[tag]
|
||||
}
|
||||
|
||||
@get:Synchronized
|
||||
val allMarkers: Map<String, MutableList<IMogoMarker>?>
|
||||
get() = mServicesMarkers
|
||||
|
||||
@Synchronized
|
||||
fun add(tag: String, marker: IMogoMarker?) {
|
||||
if (marker == null) {
|
||||
return
|
||||
}
|
||||
if (mServicesMarkers[tag] == null) {
|
||||
mServicesMarkers[tag] = ArrayList()
|
||||
}
|
||||
mServicesMarkers[tag]!!.add(marker)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun add(tag: String, markers: List<IMogoMarker>?) {
|
||||
if (markers == null || markers.isEmpty()) {
|
||||
return
|
||||
}
|
||||
if (mServicesMarkers[tag] == null) {
|
||||
mServicesMarkers[tag] = ArrayList()
|
||||
}
|
||||
mServicesMarkers[tag]!!.addAll(markers)
|
||||
}
|
||||
|
||||
override fun onMarkerClicked(marker: IMogoMarker): Boolean {
|
||||
val iMogoMarker = mMap[marker.owner]
|
||||
return iMogoMarker?.onMarkerClicked(marker) ?: false
|
||||
}
|
||||
|
||||
override fun onStaticMarkerClicked(marker: IMogoMarker): Boolean {
|
||||
val iMogoMarker = mMap[marker.owner]
|
||||
return iMogoMarker?.onStaticMarkerClicked(marker) ?: false
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tag 需要保留的类型
|
||||
*/
|
||||
fun deleteAllExcept(tag: String) {
|
||||
if (TextUtils.isEmpty(tag)) {
|
||||
return
|
||||
}
|
||||
val mogoMarkerList = mServicesMarkers.remove(tag)
|
||||
for (value in mServicesMarkers.values) {
|
||||
if (value != null && value.isNotEmpty()) {
|
||||
for (mogoMarker in value) {
|
||||
mogoMarker.destroy()
|
||||
}
|
||||
value.clear()
|
||||
}
|
||||
}
|
||||
mServicesMarkers[tag] = mogoMarkerList
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.map.marker.anim;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-22
|
||||
* <p>
|
||||
* marker 动画监听
|
||||
*/
|
||||
public interface OnMarkerAnimationListener {
|
||||
|
||||
default void onAnimStart() {
|
||||
}
|
||||
|
||||
default void onAnimEnd() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.mogo.map.overlay
|
||||
|
||||
import com.mogo.map.overlay.core.*
|
||||
import com.mogo.map.overlay.line.*
|
||||
import com.mogo.map.overlay.point.*
|
||||
import com.mogo.map.overlay.point.Point.Options as PointOptions
|
||||
import com.mogo.map.overlay.line.Polyline.Options as LineOptions
|
||||
|
||||
interface IMoGoOverlayManager {
|
||||
|
||||
fun showOrUpdatePoint(options: PointOptions): Point?
|
||||
|
||||
fun hidePoint(id: String)
|
||||
|
||||
fun hidePoint(p: Point)
|
||||
|
||||
fun hideAllPointsInOwner(owner: String)
|
||||
|
||||
fun hideAllPointsInLevel(level: Level)
|
||||
|
||||
fun hideAllPoints()
|
||||
|
||||
fun removePoint(id: String)
|
||||
|
||||
fun removePoint(p: Point)
|
||||
|
||||
fun removeAllPointsInOwner(owner: String)
|
||||
|
||||
fun removeAllPointsInLevel(level: Level)
|
||||
|
||||
fun removeAllPoints()
|
||||
|
||||
fun showAllPoints()
|
||||
|
||||
fun showAllPointsInOwner(owner: String)
|
||||
|
||||
fun showAllPointsInLevel(level: Level)
|
||||
|
||||
fun showPoint(id: String)
|
||||
|
||||
fun showOrUpdateLine(options: LineOptions): Polyline?
|
||||
|
||||
fun hideLine(id: String)
|
||||
|
||||
fun hideLine(p: Polyline)
|
||||
|
||||
fun hideAllLinesInOwner(owner: String)
|
||||
|
||||
fun hideAllLinesInLevel(level: Level)
|
||||
|
||||
fun hideAllLines()
|
||||
|
||||
fun removeLine(id: String)
|
||||
|
||||
fun removeLine(p: Polyline)
|
||||
|
||||
fun removeAllLinesInOwner(owner: String)
|
||||
|
||||
fun removeAllLinesInLevel(level: Level)
|
||||
|
||||
fun removeAllLines()
|
||||
|
||||
fun showAllLines()
|
||||
|
||||
fun showAllLinesInOwner(owner: String)
|
||||
|
||||
fun showAllLinesInLevel(level: Level)
|
||||
|
||||
fun showLine(id: String)
|
||||
|
||||
fun hideAllPointsExceptIds(vararg ids: String)
|
||||
|
||||
fun hideAllPointsExceptOwners(vararg owners: String)
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 覆盖物
|
||||
*/
|
||||
public interface IMogoOverlayManager {
|
||||
|
||||
/**
|
||||
* 绘制线段
|
||||
*
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoPolyline addPolyline( MogoPolylineOptions options );
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import com.mogo.map.IDestroyable;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 线段
|
||||
*/
|
||||
public interface IMogoPolyline extends IDestroyable {
|
||||
|
||||
|
||||
/**
|
||||
* 是否已经销毁
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDestroyed();
|
||||
|
||||
/**
|
||||
* 移除
|
||||
*/
|
||||
void remove();
|
||||
|
||||
/**
|
||||
* 获取ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* 设置绘制点数据
|
||||
*
|
||||
* @param lonLats
|
||||
*/
|
||||
void setPoints( List< MogoLatLng > lonLats );
|
||||
|
||||
/**
|
||||
* 获取点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List< MogoLatLng > getPoints();
|
||||
|
||||
/**
|
||||
* 测地线
|
||||
*
|
||||
* @param draw
|
||||
*/
|
||||
void setGeodesic( boolean draw );
|
||||
|
||||
/**
|
||||
* 是否设置了测地线
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isGeodesic();
|
||||
|
||||
/**
|
||||
* 虚线
|
||||
*
|
||||
* @param dottedLine
|
||||
*/
|
||||
void setDottedLine( boolean dottedLine );
|
||||
|
||||
/**
|
||||
* 是否是虚线
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDottedLine();
|
||||
|
||||
/**
|
||||
* 设置线宽
|
||||
*
|
||||
* @param width
|
||||
*/
|
||||
void setWidth( float width );
|
||||
|
||||
/**
|
||||
* 获取线宽
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getWidth();
|
||||
|
||||
/**
|
||||
* 设置线条颜色
|
||||
*
|
||||
* @param color
|
||||
*/
|
||||
void setColor( @ColorInt int color );
|
||||
|
||||
/**
|
||||
* 获取线条颜色
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ColorInt
|
||||
int getColor();
|
||||
|
||||
/**
|
||||
* 设置Z轴
|
||||
*/
|
||||
void setZIndex( float zIndex );
|
||||
|
||||
/**
|
||||
* 获取Z轴
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getZIndex();
|
||||
|
||||
/**
|
||||
* 设置显示/隐藏
|
||||
*/
|
||||
void setVisible( boolean visible );
|
||||
|
||||
/**
|
||||
* 是否可见
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isVisible();
|
||||
|
||||
/**
|
||||
* 设置透明度
|
||||
*
|
||||
* @param transparency
|
||||
*/
|
||||
void setTransparency( float transparency );
|
||||
|
||||
/**
|
||||
* 设置配置项
|
||||
*/
|
||||
void setOption( MogoPolylineOptions option );
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 线段属性
|
||||
*/
|
||||
public class MogoPolylineOptions {
|
||||
|
||||
public boolean useFacade = false;
|
||||
public float maxIndex = Float.MIN_VALUE;
|
||||
private List<MogoLatLng> mPoints;
|
||||
private float mWidth = 10.0F;
|
||||
private int mColor = Color.BLACK;
|
||||
private float mZIndex = 0.0F;
|
||||
private boolean mIsVisible = true;
|
||||
private boolean mIsGeodesic = false;
|
||||
private boolean mIsDottedLine = false;
|
||||
private boolean mIsGradient = false;
|
||||
private float mTransparency = 1.0F;
|
||||
private boolean mIsAboveMaskLayer = false;
|
||||
private boolean mIsPointsUpdated = false;
|
||||
private boolean mGps = false;
|
||||
private List<Integer> mColorValues;
|
||||
|
||||
private float brightSpeed = Float.MIN_VALUE;
|
||||
|
||||
private int brightColor = -1;
|
||||
|
||||
private boolean isBrightOn = false;
|
||||
|
||||
public MogoPolylineOptions() {
|
||||
this.mPoints = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置顶点
|
||||
*
|
||||
* @param points
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions points(List<MogoLatLng> points) {
|
||||
this.mPoints.clear();
|
||||
this.mPoints.addAll(points);
|
||||
this.mIsPointsUpdated = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加顶点到集合最后
|
||||
*
|
||||
* @param points
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions add(MogoLatLng... points) {
|
||||
if (points != null) {
|
||||
this.mPoints.addAll(Arrays.asList(points));
|
||||
this.mIsPointsUpdated = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions add(double lon, double lat) {
|
||||
this.mPoints.add(new MogoLatLng(lat, lon));
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions add(MogoLocation location) {
|
||||
if (location != null) {
|
||||
this.mPoints.add(new MogoLatLng(location.getLatitude(), location.getLongitude()));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置线宽
|
||||
*/
|
||||
public MogoPolylineOptions width(float width) {
|
||||
this.mWidth = width;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置线的颜色
|
||||
*
|
||||
* @param color
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions color(@ColorInt int color) {
|
||||
this.mColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置Z轴的值
|
||||
*
|
||||
* @param zIndex
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions zIndex(float zIndex) {
|
||||
this.mZIndex = zIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否可见
|
||||
*
|
||||
* @param isVisible
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions visible(boolean isVisible) {
|
||||
this.mIsVisible = isVisible;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否绘制测地线
|
||||
*
|
||||
* @param isGeodesic
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions geodesic(boolean isGeodesic) {
|
||||
this.mIsGeodesic = isGeodesic;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是虚线
|
||||
*
|
||||
* @param isDottedLine
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions dottedLine(boolean isDottedLine) {
|
||||
this.mIsDottedLine = isDottedLine;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否使用渐变色
|
||||
*
|
||||
* @param isGradient
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions useGradient(boolean isGradient) {
|
||||
this.mIsGradient = isGradient;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions maxIndex(float maxIndex) {
|
||||
this.maxIndex = maxIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置透明度
|
||||
*
|
||||
* @param transparency
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions transparency(float transparency) {
|
||||
this.mTransparency = transparency;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions brightSpeed(float speed) {
|
||||
this.brightSpeed = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions openBright(boolean on) {
|
||||
this.isBrightOn = on;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions brightColor(int color) {
|
||||
this.brightColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions useFacade(boolean useFacade) {
|
||||
this.useFacade = useFacade;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param isAboveMaskLayer
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions aboveMaskLayer(boolean isAboveMaskLayer) {
|
||||
this.mIsAboveMaskLayer = isAboveMaskLayer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param colors
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions colorValues(List<Integer> colors) {
|
||||
mColorValues = colors;
|
||||
return this;
|
||||
}
|
||||
public boolean gps() {
|
||||
return mGps;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions setGps(boolean gps) {
|
||||
mGps = gps;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getPoints() {
|
||||
return mPoints;
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return mColor;
|
||||
}
|
||||
|
||||
public float getZIndex() {
|
||||
return mZIndex;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return mIsVisible;
|
||||
}
|
||||
|
||||
public boolean isGeodesic() {
|
||||
return mIsGeodesic;
|
||||
}
|
||||
|
||||
public boolean isDottedLine() {
|
||||
return mIsDottedLine;
|
||||
}
|
||||
|
||||
public boolean isGradient() {
|
||||
return mIsGradient;
|
||||
}
|
||||
|
||||
public boolean useFacade() {
|
||||
return useFacade;
|
||||
}
|
||||
|
||||
|
||||
public float getTransparency() {
|
||||
return mTransparency;
|
||||
}
|
||||
|
||||
public boolean isAboveMaskLayer() {
|
||||
return mIsAboveMaskLayer;
|
||||
}
|
||||
|
||||
public boolean isPointsUpdated() {
|
||||
return mIsPointsUpdated;
|
||||
}
|
||||
|
||||
public float getBrightSpeed() {
|
||||
return brightSpeed;
|
||||
}
|
||||
|
||||
public boolean isBrightOn() {
|
||||
return isBrightOn;
|
||||
}
|
||||
|
||||
public int getBrightColor() {
|
||||
return brightColor;
|
||||
}
|
||||
|
||||
public List<Integer> getColorValues() {
|
||||
return mColorValues;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.map.overlay.core
|
||||
|
||||
enum class Level(val zIndex: Int) {
|
||||
|
||||
|
||||
DEFAULT(10),
|
||||
|
||||
/**
|
||||
* 地图上Marker覆盖物
|
||||
*/
|
||||
MAP_MARKER(100),
|
||||
|
||||
/**
|
||||
* 车道中心线
|
||||
*/
|
||||
ROAD_CENTER_LINE(40000),
|
||||
|
||||
/**
|
||||
* 前车引导线
|
||||
*/
|
||||
GUIDE_ROUTE_LINE(75000),
|
||||
|
||||
|
||||
/**
|
||||
* 道路围栏区域绘制
|
||||
*/
|
||||
MAP_POLYGON(76000)
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.mogo.map.overlay.line
|
||||
|
||||
import android.graphics.*
|
||||
import android.text.TextUtils
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.map.overlay.core.*
|
||||
import com.mogo.map.overlay.proxy.line.*
|
||||
import java.util.UUID
|
||||
|
||||
data class Polyline(val id: String, val owner: String, val level: Level, val options: Options) {
|
||||
|
||||
@Volatile
|
||||
var delegate: IMapPolylineOverlay? = null
|
||||
|
||||
class Options private constructor(private val builder: Builder) {
|
||||
|
||||
val id: String = builder.id ?: throw AssertionError("id must not be null.")
|
||||
|
||||
val owner: String = builder.owner
|
||||
|
||||
val level: Level = builder.level
|
||||
|
||||
val useFacade: Boolean = builder.useFacade
|
||||
|
||||
val maxIndex: Float = builder.maxIndex
|
||||
|
||||
val points: List<MogoLatLng>? = builder.points
|
||||
|
||||
val width = builder.width
|
||||
|
||||
val color: Int = builder.color
|
||||
|
||||
val isVisible = builder.isVisible
|
||||
|
||||
val isGeodesic = builder.isGeodesic
|
||||
|
||||
val isDottedLine = builder.isDottedLine
|
||||
|
||||
val dottedLineType = builder.dottedLineType
|
||||
|
||||
val isGradient = builder.isGradient
|
||||
|
||||
val alpha = builder.alpha
|
||||
|
||||
val isUseGps = builder.isUseGps
|
||||
|
||||
val colors: List<Int>? = builder.colors
|
||||
|
||||
val isLightOn: Boolean = builder.isLightOn
|
||||
|
||||
val lightColor: Int = builder.lightColor
|
||||
|
||||
val lightSpeed: Float = builder.lightSpeed
|
||||
|
||||
fun builder(): Builder {
|
||||
return builder
|
||||
}
|
||||
|
||||
class Builder(val owner: String, val level: Level) {
|
||||
|
||||
internal var id: String? = null
|
||||
|
||||
internal var useFacade: Boolean = false
|
||||
|
||||
internal var maxIndex: Float = Float.MIN_VALUE
|
||||
|
||||
internal var points: List<MogoLatLng>? = null
|
||||
|
||||
internal var width = 10.0f
|
||||
|
||||
internal var color: Int = Color.BLACK
|
||||
|
||||
internal var isVisible = true
|
||||
|
||||
internal var isGeodesic = false
|
||||
|
||||
internal var isDottedLine = false
|
||||
|
||||
internal var dottedLineType = -1
|
||||
|
||||
internal var isGradient = false
|
||||
|
||||
internal var alpha = 1.0f
|
||||
|
||||
internal var isUseGps = false
|
||||
|
||||
internal var colors: List<Int>? = null
|
||||
|
||||
internal var isLightOn: Boolean = false
|
||||
|
||||
internal var lightColor: Int = Color.WHITE
|
||||
|
||||
internal var lightSpeed: Float = 0f
|
||||
|
||||
fun setId(id: String) = apply {
|
||||
this.id = id
|
||||
}
|
||||
|
||||
fun points(points: List<MogoLatLng>) = apply {
|
||||
this.points = points
|
||||
}
|
||||
|
||||
fun colors(colors: List<Int>) = apply {
|
||||
this.colors = colors
|
||||
}
|
||||
|
||||
fun color(color: Int) = apply {
|
||||
this.color = color
|
||||
}
|
||||
|
||||
fun setVisible(visible: Boolean) = apply {
|
||||
this.isVisible = visible
|
||||
}
|
||||
|
||||
fun setWidth(width: Float) = apply {
|
||||
this.width = width
|
||||
}
|
||||
|
||||
fun setMaxIndex(maxIndex: Float) = apply {
|
||||
this.maxIndex = maxIndex
|
||||
}
|
||||
|
||||
fun useFacade(facade: Boolean) = apply {
|
||||
this.useFacade = facade
|
||||
}
|
||||
|
||||
fun setGeodesic(isGeodesic: Boolean) = apply {
|
||||
this.isGeodesic = isGeodesic
|
||||
}
|
||||
|
||||
fun setIsDottedLine(isDottedLine: Boolean) = apply {
|
||||
this.isDottedLine = isDottedLine
|
||||
}
|
||||
|
||||
fun setDottedLineType(type: Int) = apply {
|
||||
this.dottedLineType = type
|
||||
}
|
||||
|
||||
fun setIsGradient(isGradient: Boolean) = apply {
|
||||
this.isGradient = isGradient
|
||||
}
|
||||
|
||||
fun setAlpha(alpha: Float) = apply {
|
||||
this.alpha = alpha
|
||||
}
|
||||
|
||||
fun setUseGps(isUseGps: Boolean) = apply {
|
||||
this.isUseGps = isUseGps
|
||||
}
|
||||
|
||||
fun setLightOn(isLightOn: Boolean) = apply {
|
||||
this.isLightOn = isLightOn
|
||||
}
|
||||
|
||||
fun setLightColor(color: Int) = apply {
|
||||
this.lightColor = color
|
||||
}
|
||||
|
||||
fun setLightSpeed(speed: Float) = apply {
|
||||
this.lightSpeed = speed
|
||||
}
|
||||
|
||||
fun build(): Options {
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
id = UUID.randomUUID().toString()
|
||||
}
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
throw AssertionError("id must not be null.")
|
||||
}
|
||||
return Options(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Polyline
|
||||
|
||||
if (id != other.id) return false
|
||||
if (owner != other.owner) return false
|
||||
if (level != other.level) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = id.hashCode()
|
||||
result = 31 * result + owner.hashCode()
|
||||
result = 31 * result + level.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
package com.mogo.map.overlay.point
|
||||
|
||||
import android.graphics.*
|
||||
import android.text.TextUtils
|
||||
import android.view.*
|
||||
import androidx.annotation.*
|
||||
import com.mogo.map.overlay.core.*
|
||||
import com.mogo.map.overlay.proxy.point.*
|
||||
import java.util.*
|
||||
|
||||
data class Point(val id: String, val owner: String, val level: Level, val option: Options) {
|
||||
|
||||
@Volatile
|
||||
var delegate: IMapPointOverlay? = null
|
||||
|
||||
/**
|
||||
*
|
||||
* 地图上绘制点相关的参数
|
||||
*/
|
||||
class Options private constructor(private val builder: Builder){
|
||||
|
||||
/**
|
||||
* 唯一标识,可以通过此标识,操作对点的显示和隐藏
|
||||
*/
|
||||
val id: String = builder.id ?: throw AssertionError("id must not be null")
|
||||
|
||||
/**
|
||||
* 当前地图覆盖物所在level(zIndex值在此存储)
|
||||
*/
|
||||
val level: Level = builder.level
|
||||
|
||||
/**
|
||||
* 当前地图覆盖物所属的业务类型
|
||||
*/
|
||||
val owner: String = builder.owner
|
||||
|
||||
/**
|
||||
* 绘制点的纬度
|
||||
*/
|
||||
val latitude: Double = builder.latitude ?: 0.0
|
||||
|
||||
/**
|
||||
* 绘制点的经度
|
||||
*/
|
||||
val longitude: Double = builder.longitude ?: 0.0
|
||||
|
||||
/**
|
||||
* 3D模型
|
||||
*/
|
||||
@RawRes
|
||||
val icon3DRes: Int = builder.icon3DRes
|
||||
|
||||
/**
|
||||
* 自定义样式
|
||||
*/
|
||||
val iconView: View? = builder.iconView
|
||||
|
||||
/**
|
||||
* 指定覆盖物的颜色
|
||||
*/
|
||||
val anchorColor: String? = builder.anchorColor
|
||||
|
||||
/**
|
||||
* 文字标题
|
||||
*/
|
||||
val title: String? = builder.title
|
||||
|
||||
/**
|
||||
* 文字描述
|
||||
*/
|
||||
val snippet: String? = builder.snippet
|
||||
|
||||
/**
|
||||
* 图标对应的Bitmap对象
|
||||
*/
|
||||
val icon: Bitmap? = builder.icon
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的动画帧图标列表,多张图片模拟gif的效果
|
||||
*/
|
||||
val icons: ArrayList<Bitmap>? = builder.icons
|
||||
|
||||
/**
|
||||
* 设置多少帧刷新一次图片资源,Marker动画的间隔时间,值越小动画越快
|
||||
*/
|
||||
val period = builder.period
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的图片旋转角度,从正北开始,逆时针计算
|
||||
*/
|
||||
val rotate = builder.rotate
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物是否平贴地图
|
||||
*/
|
||||
val isFlat = builder.isFlat
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物是否可见
|
||||
*/
|
||||
val isVisible = builder.isVisible
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的InfoWindow是否允许显示
|
||||
*/
|
||||
val isInfoWindowEnable = builder.isInfoWindowEnable
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*/
|
||||
val alpha = builder.alpha
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*/
|
||||
val scale = builder.scale
|
||||
|
||||
/**
|
||||
* Marker覆盖物的坐标是否是Gps
|
||||
*/
|
||||
val isGps = builder.isGps
|
||||
|
||||
/**
|
||||
* Marker覆盖物锚点在水平范围的比例
|
||||
*/
|
||||
val u = builder.u
|
||||
|
||||
/**
|
||||
* Marker覆盖物锚点垂直范围的比例
|
||||
*/
|
||||
val v = builder.v
|
||||
|
||||
/**
|
||||
* 是否是3D模型
|
||||
*/
|
||||
val is3DMode: Boolean = builder.is3DMode
|
||||
|
||||
/**
|
||||
* 是否控制角度
|
||||
*/
|
||||
val isControlAngle = builder.isControlAngle
|
||||
|
||||
/**
|
||||
* 资源名称,便于缓存重复使用,和mIcon3DRes、mIconView、icon等冲突,需要县设置
|
||||
*/
|
||||
val resName: String? = builder.resName
|
||||
|
||||
/**
|
||||
* 是否切换到当前marker所在的视角
|
||||
*/
|
||||
val moveToCenter: Boolean = builder.moveToCenter
|
||||
|
||||
fun builder(): Builder {
|
||||
return builder
|
||||
}
|
||||
|
||||
class Builder(val owner: String,val level: Level){
|
||||
|
||||
/**
|
||||
* 唯一标识,可以通过此标识,操作对点的显示和隐藏
|
||||
*/
|
||||
internal var id: String? = null
|
||||
|
||||
/**
|
||||
* 绘制点的纬度
|
||||
*/
|
||||
internal var latitude: Double? = null
|
||||
|
||||
/**
|
||||
* 绘制点的经度
|
||||
*/
|
||||
internal var longitude: Double? = null
|
||||
|
||||
/**
|
||||
* 3D模型
|
||||
*/
|
||||
@RawRes
|
||||
internal var icon3DRes = 0
|
||||
|
||||
|
||||
/**
|
||||
* 自定义样式
|
||||
*/
|
||||
internal var iconView: View? = null
|
||||
|
||||
/**
|
||||
* 指定覆盖物的颜色
|
||||
*/
|
||||
internal var anchorColor: String? = null
|
||||
|
||||
/**
|
||||
* 文字标题
|
||||
*/
|
||||
internal var title: String? = null
|
||||
|
||||
/**
|
||||
* 文字描述
|
||||
*/
|
||||
internal var snippet: String? = null
|
||||
|
||||
/**
|
||||
* 图标对应的Bitmap对象
|
||||
*/
|
||||
internal var icon: Bitmap? = null
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的动画帧图标列表,多张图片模拟gif的效果
|
||||
*/
|
||||
internal var icons: ArrayList<Bitmap>? = null
|
||||
|
||||
/**
|
||||
* 设置多少帧刷新一次图片资源,Marker动画的间隔时间,值越小动画越快
|
||||
*/
|
||||
internal var period = 0
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的图片旋转角度,从正北开始,逆时针计算
|
||||
*/
|
||||
internal var rotate = 0f
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物是否平贴地图
|
||||
*/
|
||||
internal var isFlat = false
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物是否可见
|
||||
*/
|
||||
internal var isVisible = true
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的InfoWindow是否允许显示
|
||||
*/
|
||||
internal var isInfoWindowEnable = true
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*/
|
||||
internal var alpha = 1.0f
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*/
|
||||
internal var scale = 1.0f
|
||||
|
||||
/**
|
||||
* Marker覆盖物的坐标是否是Gps
|
||||
*/
|
||||
internal var isGps = false
|
||||
|
||||
/**
|
||||
* Marker覆盖物锚点在水平范围的比例
|
||||
*/
|
||||
internal var u = 0.5f
|
||||
|
||||
/**
|
||||
* Marker覆盖物锚点垂直范围的比例
|
||||
*/
|
||||
internal var v = 0.5f
|
||||
|
||||
|
||||
/**
|
||||
* 是否是3D模型
|
||||
*/
|
||||
internal var is3DMode: Boolean = false
|
||||
|
||||
/**
|
||||
* 是否控制角度
|
||||
*/
|
||||
internal var isControlAngle = false
|
||||
|
||||
/**
|
||||
* 资源名称,便于缓存重复使用,和mIcon3DRes、mIconView、icon等冲突,需要县设置
|
||||
*/
|
||||
internal var resName: String? = null
|
||||
|
||||
|
||||
/**
|
||||
* 是否切换到当前marker所在的视角
|
||||
*/
|
||||
internal var moveToCenter: Boolean = true
|
||||
|
||||
fun setId(id: String) = apply {
|
||||
this.id = id
|
||||
}
|
||||
|
||||
fun resName(resName: String?) = apply {
|
||||
this.resName = resName
|
||||
}
|
||||
|
||||
fun controlAngle(controlAngle: Boolean) = apply {
|
||||
isControlAngle = controlAngle
|
||||
}
|
||||
|
||||
fun set3DMode(is3DMode: Boolean) = apply {
|
||||
this.is3DMode = is3DMode
|
||||
}
|
||||
|
||||
fun latitude(latitude: Double) = apply {
|
||||
this.latitude = latitude
|
||||
}
|
||||
|
||||
fun longitude(longitude: Double) = apply {
|
||||
this.longitude = longitude
|
||||
}
|
||||
|
||||
/**
|
||||
* 优先使用icon作为marker资源
|
||||
* @param icon
|
||||
* @return
|
||||
*/
|
||||
fun icon(icon: Bitmap?) = apply {
|
||||
this.icon = icon
|
||||
}
|
||||
|
||||
/**
|
||||
* 帧动画对应的图片序列
|
||||
*/
|
||||
fun icons(icons: ArrayList<Bitmap>?) = apply {
|
||||
this.icons = icons
|
||||
}
|
||||
|
||||
/**
|
||||
* 帧动画执行完成一次需要的时长,时间越短,帧动画越快
|
||||
*/
|
||||
fun period(period: Int) = apply {
|
||||
this.period = period
|
||||
if (this.period < 1) {
|
||||
this.period = 1
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* marker对应的资源的,旋转角度,正北方为0度,逆时针计算
|
||||
*/
|
||||
fun rotate(rotate: Float) = apply {
|
||||
this.rotate = rotate
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否平铺在地图上
|
||||
*/
|
||||
fun flat(flat: Boolean) = apply {
|
||||
isFlat = flat
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可见
|
||||
*/
|
||||
fun visible(visible: Boolean) = apply {
|
||||
isVisible = visible
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置地图覆盖物的透明度
|
||||
*/
|
||||
fun alpha(alpha: Float) = apply {
|
||||
this.alpha = alpha
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置地图覆盖物的缩放比例
|
||||
*/
|
||||
fun scale(scale: Float) = apply {
|
||||
this.scale = scale
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否使用GPS坐标
|
||||
*/
|
||||
fun isUseGps(gps: Boolean) = apply {
|
||||
this.isGps = gps
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置地图覆盖物锚点在水平和垂直方向的比例
|
||||
*/
|
||||
fun anchor(u: Float, v: Float) = apply {
|
||||
this.u = u
|
||||
this.v = v
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义marker图层样式,优先使用 icon [.icon]作为marker资源
|
||||
*
|
||||
* @param iconView
|
||||
* @return
|
||||
*/
|
||||
fun icon(iconView: View?) = apply {
|
||||
this.iconView = iconView
|
||||
}
|
||||
|
||||
/**
|
||||
* 3D模型对应的资源
|
||||
*/
|
||||
fun icon3DRes(@RawRes icon3DRes: Int) = apply {
|
||||
this.icon3DRes = icon3DRes
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置地图覆盖物的颜色
|
||||
*/
|
||||
fun anchorColor(anchorColor: String?) = apply {
|
||||
this.anchorColor = anchorColor
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否切换到当前marker所在的视角
|
||||
*/
|
||||
fun moveToCenter(flag: Boolean) = apply {
|
||||
this.moveToCenter = flag
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建Options对象
|
||||
*/
|
||||
fun build(): Options {
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
id = UUID.randomUUID().toString()
|
||||
}
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
throw AssertionError("id must not be null.")
|
||||
}
|
||||
return Options(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Point
|
||||
|
||||
if (id != other.id) return false
|
||||
if (owner != other.owner) return false
|
||||
if (level != other.level) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = id.hashCode()
|
||||
result = 31 * result + owner.hashCode()
|
||||
result = 31 * result + level.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.map.overlay.proxy
|
||||
|
||||
|
||||
interface IMapOverlay {
|
||||
|
||||
/**
|
||||
* 删除当前marker并销毁Marker的图片等资源
|
||||
*/
|
||||
fun destroy()
|
||||
|
||||
/**
|
||||
* 删除当前marker。
|
||||
*/
|
||||
fun remove()
|
||||
|
||||
/**
|
||||
* 设置 Marker 覆盖物的可见属性。
|
||||
*
|
||||
* @param visible
|
||||
*/
|
||||
fun setVisible(visible: Boolean)
|
||||
|
||||
/**
|
||||
* 是否已销毁
|
||||
*/
|
||||
fun isDestroyed(): Boolean
|
||||
|
||||
/**
|
||||
* 是否可见
|
||||
*/
|
||||
fun isVisible(): Boolean
|
||||
|
||||
|
||||
/**
|
||||
* 设置当前marker在最上面。
|
||||
*/
|
||||
fun setToTop()
|
||||
|
||||
/**
|
||||
* 取消当前marker在最上面
|
||||
*/
|
||||
fun setUnTop()
|
||||
|
||||
|
||||
fun onRemove(action: (id: String) -> Unit)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.map.overlay.proxy.line
|
||||
|
||||
import com.mogo.map.overlay.line.*
|
||||
import com.mogo.map.overlay.proxy.*
|
||||
|
||||
interface IMapPolylineOverlay: IMapOverlay {
|
||||
|
||||
fun setOptions(options: Polyline.Options)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.map.overlay.proxy.point
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.map.overlay.point.Point.Options
|
||||
import com.mogo.map.overlay.proxy.*
|
||||
|
||||
interface IMapPointOverlay: IMapOverlay {
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的属性选项类 通过markerOption 给marker设置属性
|
||||
*
|
||||
* @param opt
|
||||
*/
|
||||
fun setOptions(opt: Options)
|
||||
|
||||
|
||||
fun addDynamicAnchorPosition(point: MogoLatLng, angle: Float, duration: Long)
|
||||
}
|
||||
@@ -31,6 +31,13 @@ public interface IMogoMapUIController {
|
||||
*/
|
||||
MapControlResult changeZoom(float zoom);
|
||||
|
||||
|
||||
/**
|
||||
* 修改缩放级别的另一种方式
|
||||
* @param zoom 缩放比例
|
||||
*/
|
||||
void changeZoom2(float zoom);
|
||||
|
||||
/**
|
||||
* 设置地图是否是Debug模式
|
||||
*
|
||||
|
||||
@@ -3,7 +3,6 @@ plugins {
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import static com.mogo.map.marker.MarkerType.MAP_STATIC;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.marker.AMapMarkerWrapper;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MarkerWrapperClickHelper;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* marker 点击事件处理
|
||||
*/
|
||||
public class AMapMarkerClickHandler {
|
||||
|
||||
private static volatile AMapMarkerClickHandler sInstance;
|
||||
|
||||
private AMapMarkerClickHandler() {
|
||||
}
|
||||
|
||||
public static AMapMarkerClickHandler getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (AMapMarkerClickHandler.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AMapMarkerClickHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public boolean handleMarkerClicked(Marker marker) {
|
||||
if (marker == null) {
|
||||
return false;
|
||||
}
|
||||
//地图道路上静态数,暂时只过滤traffic类型下发点击事件
|
||||
if (MarkerWrapperClickHelper.getInstance().isStaticMarker(marker.getId())){
|
||||
IMogoMarker iMogoMarker = new AMapMarkerWrapper(marker,new MogoMarkerOptions());
|
||||
iMogoMarker.setOwner(MAP_STATIC); //TODO 后续可能由于类型比较多,需要owner匹配机制,以及控制owner细粒度
|
||||
CallerLogger.INSTANCE.d("AMapMarkerWrapper", "traffic marker 点击回调");
|
||||
return MogoMarkersHandler.Companion.getMogoMarkersHandler().onStaticMarkerClicked(iMogoMarker);
|
||||
}
|
||||
|
||||
Map<String, IMogoMarker> mogoMarkerMap = MarkerWrapperClickHelper.getInstance().getMogoMarkerMap();
|
||||
if (mogoMarkerMap.containsKey(marker.getId())) {
|
||||
IMogoMarker mogoMarker = mogoMarkerMap.get(marker.getId());
|
||||
final IMogoMarkerClickListener listener = mogoMarker.getOnMarkerClickListener();
|
||||
CallerLogger.INSTANCE.d("AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker);
|
||||
if (listener != null) {
|
||||
boolean result = listener.onMarkerClicked(mogoMarker);
|
||||
if (result) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return MogoMarkersHandler.Companion.getMogoMarkersHandler().onMarkerClicked(mogoMarker);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_HD_MAP_CALL;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_INIT_ON_MAP_INIT;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_INIT_ON_MAP_LOADED;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_INIT;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_HD_MAP;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_MAP;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP;
|
||||
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_300;
|
||||
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS;
|
||||
@@ -43,6 +46,7 @@ import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.hdcache.IHdCacheListener;
|
||||
import com.mogo.map.identify.MogoIdentifyManager;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.location.GDLocationClient;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
@@ -76,6 +80,7 @@ import com.zhidaoauto.map.sdk.open.location.LocationClient;
|
||||
import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerHelper;
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.road.RoadCross;
|
||||
@@ -109,8 +114,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private static final String TAG = "AMapViewWrapper";
|
||||
private final MapAutoView mMapView;
|
||||
private final IMogoMap mIMap;
|
||||
private AMapMarkerClickHandler mMarkerClickHandler;
|
||||
|
||||
private final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
|
||||
.carCursorRes(R.drawable.map_api_ic_current_location2)
|
||||
.naviCursorRes(R.drawable.ic_amap_navi_cursor)
|
||||
@@ -119,10 +122,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private EnumMapUI mCurrentUI = EnumMapUI.MAP_STYLE_NIGHT_VR;
|
||||
private VisualAngleMode mVisualAngleMode = MODE_MEDIUM_SIGHT;
|
||||
|
||||
private boolean mMapLoaded = false;
|
||||
private boolean mIsFirstLocated = true;
|
||||
private boolean mIsDelayed = false;
|
||||
|
||||
private IHdCacheListener hdCacheListener;
|
||||
|
||||
public AMapViewWrapper(MapAutoView mMapView) {
|
||||
@@ -172,6 +171,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
//设置手势是否可以缩放 isCanZoom true 可缩放 false 不可缩放
|
||||
options.setZoomGesturesEnabled(true);
|
||||
options.setScaleVRMode(true);
|
||||
options.setWeatherEnable(false);
|
||||
// options.setAllGesturesEnabled(false); //禁止全部手势
|
||||
if (options.getMyLocationStyle() != null) {
|
||||
options.getMyLocationStyle().setDisplayAnimEnable(true);
|
||||
@@ -184,7 +184,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
private void initListeners() {
|
||||
mMapView.setOnMarkClickListener(this);
|
||||
mMarkerClickHandler = AMapMarkerClickHandler.getInstance();
|
||||
mMapView.setOnMapLoadedListener(this);
|
||||
mMapView.setOnMapTouchListener(this);
|
||||
mMapView.setOnMapClickListener(this);
|
||||
@@ -345,6 +344,18 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
return MapControlResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom2(float zoom) {
|
||||
// if (isVrMold()) {
|
||||
// return;
|
||||
// }
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "changeZoom2 : " + zoom);
|
||||
if (DebugConfig.isDebug()) {
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, Log.getStackTraceString(new Throwable()));
|
||||
}
|
||||
getMap().changeZoom2(zoom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDebugMode(Boolean debugMode) {
|
||||
MapAutoApi.INSTANCE.setDebugMode(debugMode);
|
||||
@@ -368,14 +379,26 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_LINK_LOG_HD_MAP,
|
||||
linkCode = CHAIN_LINK_MAP,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_HD_MAP_CALL,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
@Override
|
||||
public void setRoamTrajectory(String trajectory) {
|
||||
mMapView.getMapAutoViewHelper().setRoamTrajectory(trajectory);
|
||||
if (checkAMapView()) {
|
||||
mMapView.getMapAutoViewHelper().setRoamTrajectory(trajectory);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRomaMode(int mode) {
|
||||
mMapView.getMapAutoViewHelper().setRoamStyle(mode,1800, MapAutoApi.ROAM_SPEED_40);
|
||||
if (checkAMapView()) {
|
||||
mMapView.getMapAutoViewHelper().setRoamStyle(mode,1800, MapAutoApi.ROAM_SPEED_40);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -406,7 +429,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if (DebugConfig.isDebug()) {
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, Log.getStackTraceString(new Throwable()));
|
||||
}
|
||||
mMapView.getMapAutoViewHelper().animateCamera(new LonLatPoint(latLng.lon, latLng.lat));
|
||||
if (checkAMapView()) {
|
||||
mMapView.getMapAutoViewHelper().animateCamera(new LonLatPoint(latLng.lon, latLng.lat));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -462,14 +487,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
public void initMyLocation() {
|
||||
if (checkAMapView()) {
|
||||
MarkerHelper.INSTANCE.addPreModel(R.raw.guangquan);
|
||||
// MarkerHelper.addPreModel(R.raw.guangquan_day)
|
||||
mMapView.getMapAutoViewHelper().setMyLocationEnabled(true);
|
||||
MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
|
||||
style.interval(1000);
|
||||
// style.anchor( 0.5F, 0.5F );
|
||||
// style.strokeColor( Color.TRANSPARENT );
|
||||
// style.strokeWidth( 0 );
|
||||
// style.radiusFillColor( Color.TRANSPARENT );
|
||||
mMapView.getMapAutoViewHelper().setMyLocationStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,7 +750,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--onMapLoaded: ");
|
||||
mMapLoaded = true;
|
||||
if (checkAMapView()) {
|
||||
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
|
||||
Trace.beginSection("timer.onCameraChangeFinish");
|
||||
@@ -757,7 +776,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void onMarkClick(@NotNull Marker markerInfo) {
|
||||
mMarkerClickHandler.handleMarkerClicked(markerInfo);
|
||||
// mMarkerClickHandler.handleMarkerClicked(markerInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -862,7 +881,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
try {
|
||||
mRtkEnable = !mRtkEnable;
|
||||
TipToast.shortTip(mRtkEnable ? "已开启rtk道路匹配" : "已开启gps道路匹配");
|
||||
mMapView.getLocationClient().rtkEnable(mRtkEnable);
|
||||
if (mMapView != null && mMapView.getLocationClient() != null) {
|
||||
mMapView.getLocationClient().rtkEnable(mRtkEnable);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAP + TAG, "rtkEnable has exception : " + e);
|
||||
}
|
||||
@@ -920,19 +941,21 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
*/
|
||||
private void loadPreVehicleModel() {
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "添加感知模型到地图中……");
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi=");
|
||||
ThreadUtils.getIoPool().submit(() -> {
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE, "添加感知模型到地图中……preVehicleStrPeople=");
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE, "添加感知模型到地图中……preVehicleStrPeople=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE, "添加感知模型到地图中……preVehicleStrBicycle=");
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE, "添加感知模型到地图中……preVehicleStrBicycle=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE, "添加感知模型到地图中……preVehicleStrTaChe=");
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE, "添加感知模型到地图中……preVehicleStrTaChe=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO, "添加感知模型到地图中……preVehicleStrMoto=");
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO, "添加感知模型到地图中……preVehicleStrMoto=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS, "添加感知模型到地图中……preVehicleStrBus=");
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS, "添加感知模型到地图中……preVehicleStrBus=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK, "添加感知模型到地图中……preVehicleStrTruck=");
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK, "添加感知模型到地图中……preVehicleStrTruck=");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -947,12 +970,12 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if (isDayMode()) {
|
||||
preVehicleStrWeiZhi =
|
||||
// 添加模型到地图中
|
||||
MogoMarkerManager.getInstance(getContext())
|
||||
MogoIdentifyManager.getInstance(getContext())
|
||||
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DIconId());
|
||||
} else {
|
||||
preVehicleStrWeiZhi =
|
||||
// 添加模型到地图中
|
||||
MogoMarkerManager.getInstance(getContext())
|
||||
MogoIdentifyManager.getInstance(getContext())
|
||||
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DNightIconId());
|
||||
}
|
||||
|
||||
@@ -1037,6 +1060,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
public void cacheHDDataByCity(IHdCacheListener listener) {
|
||||
if (mMapView.getMapAutoViewHelper() != null) {
|
||||
String gdCityCode = GDLocationClient.getInstance(getContext()).getLastCityCode();
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "gdCityCode is:" + gdCityCode);
|
||||
Integer id = HDMapUtils.getHDCityCode(gdCityCode);
|
||||
if (id != null) {
|
||||
hdCacheListener = listener;
|
||||
@@ -1052,7 +1076,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if (hdCacheListener != null) {
|
||||
hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
|
||||
}
|
||||
});
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1067,7 +1091,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if (hdCacheListener != null) {
|
||||
hdCacheListener.onMapHdCacheResult(i, state);
|
||||
}
|
||||
});
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1079,6 +1103,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
|
||||
if (mMapView.getMapAutoViewHelper() != null) {
|
||||
hdCacheListener = listener;
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "location lon is:" + location.getLongitude() + ",lat is:" + location.getLatitude());
|
||||
mMapView.getMapAutoViewHelper().cacheHDDataByCityByLonLat(location.getLongitude(), location.getLatitude(), new OnHdDataDownByCityListener() {
|
||||
@Override
|
||||
public void onMapHDDataCacheProgressByCity(int cityId, double progress) {
|
||||
@@ -1091,7 +1116,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if (hdCacheListener != null) {
|
||||
hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
|
||||
}
|
||||
});
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1106,7 +1131,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if (hdCacheListener != null) {
|
||||
hdCacheListener.onMapHdCacheResult(i, state);
|
||||
}
|
||||
});
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1117,6 +1142,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
public boolean isCityDataCached() {
|
||||
if (mMapView.getMapAutoViewHelper() != null) {
|
||||
String gdCityCode = GDLocationClient.getInstance(getContext()).getLastCityCode();
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "gdCityCode is:" + gdCityCode);
|
||||
Integer id = HDMapUtils.getHDCityCode(gdCityCode);
|
||||
if (id != null) {
|
||||
List<CityInfo> cityInfoList = mMapView.getMapAutoViewHelper().getAllCityCode();
|
||||
|
||||
@@ -1,26 +1,18 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.center.CenterLine;
|
||||
import com.mogo.map.marker.AMapInfoWindowAdapter;
|
||||
import com.mogo.map.marker.AMapMarkerWrapper;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.map.overlay.AMapPolylineWrapper;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.overlay.proxy.line.IMapPolylineOverlay;
|
||||
import com.mogo.map.overlay.proxy.point.IMapPointOverlay;
|
||||
import com.mogo.map.overlay.wrapper.point.AMapPointWrapper;
|
||||
import com.mogo.map.road.RoadNameInfo;
|
||||
import com.mogo.map.uicontroller.AMapUIController;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.utils.ObjectUtils;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
|
||||
import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BatchMarkerOptions;
|
||||
@@ -28,7 +20,6 @@ import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerHelper;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MultiPointOverlayOptions;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
@@ -55,9 +46,9 @@ public class AMapWrapper implements IMogoMap {
|
||||
private static final String TAG = "AMapWrapper";
|
||||
|
||||
private static MapAutoViewHelper sAMap;
|
||||
private IMogoMapUIController mMapUIController;
|
||||
private final IMogoMapUIController mMapUIController;
|
||||
private MapAutoViewHelper mAMap;
|
||||
private MapAutoView mMapView;
|
||||
private final MapAutoView mMapView;
|
||||
private IMogoUiSettings mUiSettings;
|
||||
|
||||
public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) {
|
||||
@@ -67,7 +58,7 @@ public class AMapWrapper implements IMogoMap {
|
||||
this.mMapView = mapView;
|
||||
mMapUIController = controller;
|
||||
// 设置实现自定义 info window
|
||||
MapAutoApi.INSTANCE.setInfoWindowAdapter(new AMapInfoWindowAdapter());
|
||||
// MapAutoApi.INSTANCE.setInfoWindowAdapter(new AMapInfoWindowAdapter());
|
||||
AMapUIController.getInstance().initClient(mMapUIController);
|
||||
}
|
||||
|
||||
@@ -92,7 +83,7 @@ public class AMapWrapper implements IMogoMap {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarker addMarker(String tag, MogoMarkerOptions options) {
|
||||
public IMapPointOverlay addPoint(com.mogo.map.overlay.point.Point.Options options) {
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
@@ -101,18 +92,28 @@ public class AMapWrapper implements IMogoMap {
|
||||
CallerLogger.INSTANCE.e(TAG, "marker参数为空");
|
||||
return null;
|
||||
}
|
||||
final IMogoMarker mogoMarker = new AMapMarkerWrapper(mAMap.addMarker(markerOptions), options);
|
||||
if (options.isAutoManager()) {
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().add(tag, mogoMarker);
|
||||
Marker delegate = mAMap.addMarker(markerOptions);
|
||||
if (delegate == null) {
|
||||
return null;
|
||||
}
|
||||
return mogoMarker;
|
||||
return new AMapPointWrapper(options.getId(), delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearAllMarkers() {
|
||||
if (sAMap != null) {
|
||||
sAMap.clearAllMarkers();
|
||||
public IMapPolylineOverlay addLine(com.mogo.map.overlay.line.Polyline.Options options) {
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
PolylineOptions polylineOptions = ObjectUtils.fromMogo(options);
|
||||
if (polylineOptions == null) {
|
||||
CallerLogger.INSTANCE.e(TAG, "polyline参数为空");
|
||||
return null;
|
||||
}
|
||||
Polyline delegate = polylineOptions.lineWidth > 0 ? mAMap.drawThickLine(polylineOptions) : mAMap.drawLine(polylineOptions);
|
||||
if (delegate == null) {
|
||||
return null;
|
||||
}
|
||||
return new com.mogo.map.overlay.wrapper.line.AMapPolylineWrapper(options.getId(), delegate);
|
||||
}
|
||||
|
||||
BatchMarkerOptions batchMarkerOptions = new BatchMarkerOptions();
|
||||
@@ -197,53 +198,6 @@ public class AMapWrapper implements IMogoMap {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter) {
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (options == null || options.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<Marker> markers = new ArrayList<>();
|
||||
ArrayList<MarkerOptions> markerOptions = new ArrayList<>();
|
||||
ArrayList<IMogoMarker> mogoMarkers = new ArrayList<>();
|
||||
for (MogoMarkerOptions option : options) {
|
||||
if (option == null) {
|
||||
continue;
|
||||
}
|
||||
MarkerOptions mo = ObjectUtils.fromMogo(option);
|
||||
if (mo == null) {
|
||||
continue;
|
||||
}
|
||||
markerOptions.add(mo);
|
||||
}
|
||||
if (markerOptions.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
MultiPointOverlayOptions multiPointOverlayOptions = new MultiPointOverlayOptions();
|
||||
multiPointOverlayOptions.setData(markerOptions);
|
||||
multiPointOverlayOptions.setMarkerIcon(R.drawable.marker_blue);
|
||||
List<MarkerOptions> data = mAMap.addMarkers(multiPointOverlayOptions).getOptions().getData();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
markers.add(new Marker(data.get(i)));
|
||||
}
|
||||
if (markers == null || markers.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < markers.size(); i++) {
|
||||
Marker marker = markers.get(i);
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
mogoMarkers.add(new AMapMarkerWrapper(marker, options.get(i)));
|
||||
}
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().add(tag, mogoMarkers);
|
||||
return mogoMarkers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (checkAMap()) {
|
||||
@@ -282,37 +236,26 @@ public class AMapWrapper implements IMogoMap {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom2(float zoom) {
|
||||
CallerLogger.INSTANCE.d(TAG, "changeZoom %s", zoom);
|
||||
if (checkAMap()) {
|
||||
mAMap.setZoomVal(zoom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZoomLevel() {
|
||||
if (checkAMap()) {
|
||||
try {
|
||||
return mAMap.getZoom();
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPolyline addPolyline(MogoPolylineOptions options) {
|
||||
if (checkAMap()) {
|
||||
PolylineOptions polylineOptions = ObjectUtils.fromMogo(options);
|
||||
CallerLogger.INSTANCE.d(TAG, "addPolyline %s", polylineOptions.toString());
|
||||
if (polylineOptions == null) {
|
||||
return null;
|
||||
}
|
||||
Polyline polyline = null;
|
||||
if (polylineOptions.getLineWidth() > 0) {
|
||||
polyline = mAMap.drawThickLine(polylineOptions);
|
||||
} else {
|
||||
polyline = mAMap.drawLine(polylineOptions);
|
||||
}
|
||||
return new AMapPolylineWrapper(polyline, options);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkAMap() {
|
||||
mAMap = mMapView.getMapAutoViewHelper();
|
||||
sAMap = mAMap;
|
||||
@@ -365,8 +308,4 @@ public class AMapWrapper implements IMogoMap {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
return mMapView.getContext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.map
|
||||
|
||||
import com.mogo.map.overlay.*
|
||||
|
||||
object MoGoOverlayManager {
|
||||
|
||||
private val impl by lazy { MoGoOverlayManagerImpl() }
|
||||
|
||||
fun overlay(): IMoGoOverlayManager = impl
|
||||
}
|
||||
@@ -68,6 +68,14 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom2(float zoom) {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
mDelegate.changeZoom2(zoom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDebugMode(Boolean debugMode) {
|
||||
initDelegate();
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.call.v2x.CallMarkersClearManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-20
|
||||
* <p>
|
||||
* marker 管理实现
|
||||
*/
|
||||
public class MogoMarkerManager implements IMogoMarkerManager {
|
||||
|
||||
private static final String TAG = "MogoMarkerManager";
|
||||
|
||||
private static volatile MogoMarkerManager sInstance;
|
||||
private Context mApplicationContext;
|
||||
|
||||
private MogoMarkerManager(Context context) {
|
||||
if (context != null) {
|
||||
mApplicationContext = context.getApplicationContext();
|
||||
}
|
||||
}
|
||||
|
||||
public static MogoMarkerManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoMarkerManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoMarkerManager(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarker addMarker(String tag, MogoMarkerOptions options) {
|
||||
try {
|
||||
return MogoMap.getInstance().getMogoMap().addMarker(tag, options);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter) {
|
||||
try {
|
||||
return MogoMap.getInstance().getMogoMap().addMarkers(tag, options, moveToCenter);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearAllMarker() {
|
||||
try{
|
||||
MogoMap.getInstance().getMogoMap().clearAllMarkers();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList) {
|
||||
try {
|
||||
MogoMap.getInstance().getMogoMap().updateBatchMarkerPosition(optionsArrayList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList) {
|
||||
try {
|
||||
MogoMap.getInstance().getMogoMap().updateBatchAiMarkerPosition(optionsArrayList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addPreVehicleModel(int type, int modelRes) {
|
||||
try {
|
||||
return MogoMap.getInstance().getMogoMap().addPreVehicleModel(type, modelRes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMarker(String uuidString) {
|
||||
try {
|
||||
MogoMap.getInstance().getMogoMap().removeMarker(uuidString);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeMarkers(String tag) {
|
||||
CallMarkersClearManager.INSTANCE.invokeClearAllMarkersOfTag(tag);
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMarkers() {
|
||||
CallMarkersClearManager.INSTANCE.invokeClearAllMarkers();
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().removeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visibleAllMarkers() {
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().visibleAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inVisibleAllMarkers() {
|
||||
CallMarkersClearManager.INSTANCE.invokeClearAllMarkers();
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().inVisibleAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inVisibleWithoutMarkers(String... owner) {
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().inVisibleMarkers(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IMogoMarker> getMarkers(String tag) {
|
||||
return MogoMarkersHandler.Companion.getMogoMarkersHandler().getMarkers(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<IMogoMarker>> getAllMarkers() {
|
||||
return MogoMarkersHandler.Companion.getMogoMarkersHandler().getAllMarkers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMarkersExcept(String tag) {
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().deleteAllExcept(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRouteWay(Context context, MogoLatLng startPoint, MogoLatLng endPoint, List<MogoLatLng> wayPoints) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRouteWayOverlay() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoOverlayManager implements IMogoOverlayManager {
|
||||
|
||||
private MogoOverlayManager() {
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final MogoOverlayManager INSTANCE = new MogoOverlayManager();
|
||||
}
|
||||
|
||||
public static MogoOverlayManager getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPolyline addPolyline(MogoPolylineOptions options) {
|
||||
try {
|
||||
return MogoMap.getInstance().getMogoMap().addPolyline(options);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mogo.map.identify;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.MogoMap;
|
||||
import com.mogo.map.identity.IMogoIdentifyManager;
|
||||
import java.util.HashMap;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-20
|
||||
* <p>
|
||||
* marker 管理实现
|
||||
*/
|
||||
public class MogoIdentifyManager implements IMogoIdentifyManager {
|
||||
|
||||
private static final String TAG = "MogoIdentifyManager";
|
||||
|
||||
private static volatile MogoIdentifyManager sInstance;
|
||||
|
||||
private MogoIdentifyManager(Context context) {}
|
||||
|
||||
public static MogoIdentifyManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoIdentifyManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoIdentifyManager(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMarker(String uuidString) {
|
||||
try {
|
||||
MogoMap.getInstance().getMogoMap().removeMarker(uuidString);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList) {
|
||||
try {
|
||||
MogoMap.getInstance().getMogoMap().updateBatchMarkerPosition(optionsArrayList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList) {
|
||||
try {
|
||||
MogoMap.getInstance().getMogoMap().updateBatchAiMarkerPosition(optionsArrayList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addPreVehicleModel(int type, int modelRes) {
|
||||
try {
|
||||
return MogoMap.getInstance().getMogoMap().addPreVehicleModel(type, modelRes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,15 @@ import com.amap.api.location.AMapLocationClientOption
|
||||
import com.amap.api.location.AMapLocationListener
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.constants.SharedPrefsConstants
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_HTTP_DNS_CITY_CODE
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.call.map.CallerGaoDeMapLocationListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
|
||||
|
||||
/**
|
||||
* 封装高德地图通过设备GPS获取到的位置信息,频率1s一次,坐标系为CJC20
|
||||
@@ -117,9 +121,11 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
|
||||
// 本地SP缓存城市Code
|
||||
val cityCode = aMapLocation.cityCode
|
||||
if (cityCode != null && cityCode.isNotEmpty()) {
|
||||
mCityCode = aMapLocation.cityCode
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
|
||||
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
|
||||
if (mCityCode.isEmpty() || mCityCode != cityCode) {
|
||||
setCityCode(cityCode)
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
|
||||
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
|
||||
}
|
||||
}
|
||||
|
||||
// 缓存经纬度
|
||||
@@ -141,6 +147,18 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS,
|
||||
linkCode = ChainConstant.CHAIN_LINK_CLOUD,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_HTTP_DNS_CITY_CODE,
|
||||
paramIndexes = [0],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
private fun setCityCode(code: String) {
|
||||
mCityCode = code
|
||||
}
|
||||
|
||||
override fun getLastCityCode(): String {
|
||||
return mCityCode
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.AMapMarkerClickHandler;
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnInfoWindowClickListener;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 自定义infowindow
|
||||
*/
|
||||
public final class AMapInfoWindowAdapter implements InfoWindowAdapter, OnInfoWindowClickListener {
|
||||
|
||||
@Override
|
||||
public View getInfoWindow(Marker marker ) {
|
||||
if ( marker.getMObject() instanceof IMogoMarker ) {
|
||||
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getMObject() );
|
||||
IMogoInfoWindowAdapter delegate = mogoMarker.getInfoWindowAdapter();
|
||||
if ( delegate != null ) {
|
||||
final View infoView = delegate.getInfoWindow( mogoMarker );
|
||||
marker.setOnInfoWindowClickListener( this );
|
||||
return infoView;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInfoWindowClick( @NotNull Marker marker ) {
|
||||
AMapMarkerClickHandler.getInstance().handleMarkerClicked( marker );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View getInfoContents( @Nullable Marker marker ) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,338 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.text.TextUtils;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.map.utils.ObjectUtils;
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.MarkerAnimationListener;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Animation;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerScaleAnimation;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 自研marker
|
||||
*/
|
||||
public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
|
||||
private final String TAG = AMapMarkerWrapper.class.getName();
|
||||
|
||||
private Marker mMarker;
|
||||
private Object mObject;
|
||||
private IMogoMarkerClickListener mMogoMarkerClickListener;
|
||||
private IMogoInfoWindowAdapter mMogoInfoWindowAdapter;
|
||||
|
||||
private boolean mIsDestroy = false;
|
||||
|
||||
private MogoMarkerOptions mMogoMarkerOptions;
|
||||
private String mOwner;
|
||||
|
||||
public AMapMarkerWrapper( Marker marker, MogoMarkerOptions mogoMarkerOptions ) {
|
||||
this.mMarker = marker;
|
||||
if ( marker != null ) {
|
||||
// 设置自研 marker 的object对象为 IMogoMarker 实例。!!!!
|
||||
marker.setMObject( this );
|
||||
if ( !TextUtils.isEmpty( mogoMarkerOptions.getAnchorColor() ) ) {
|
||||
marker.setAnchorColor( mogoMarkerOptions.getAnchorColor() );
|
||||
}
|
||||
MarkerWrapperClickHelper.getInstance().setMogoMarkerMap( marker.getId(), this );
|
||||
}
|
||||
setObject( mogoMarkerOptions.getObject() );
|
||||
this.mMogoMarkerOptions = mogoMarkerOptions;
|
||||
mMogoMarkerOptions.addObserver( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update( Observable o, Object arg ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
setMarkerOptions( mMogoMarkerOptions );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
synchronized (this) {
|
||||
if ( mMogoMarkerOptions != null ) {
|
||||
mMogoMarkerOptions.deleteObservers();
|
||||
mMogoMarkerOptions = null;
|
||||
}
|
||||
if ( mMarker != null ) {
|
||||
mMarker.remove();
|
||||
mMarker.setMObject( null );
|
||||
mMarker.setOnInfoWindowClickListener( null );
|
||||
mMarker = null;
|
||||
}
|
||||
}
|
||||
mMogoInfoWindowAdapter = null;
|
||||
mMogoMarkerClickListener = null;
|
||||
mObject = null;
|
||||
mIsDestroy = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
destroy();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setAlpha( float alpha ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setAlpha( alpha );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon( Bitmap icon ) {
|
||||
if ( icon == null || icon.isRecycled() ) {
|
||||
return;
|
||||
}
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setIcon( icon );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcons( ArrayList< Bitmap > icons ) {
|
||||
if ( icons == null || icons.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
|
||||
for ( Bitmap icon : icons ) {
|
||||
if ( icon == null || icon.isRecycled() ) {
|
||||
continue;
|
||||
}
|
||||
descriptors.add( BitmapDescriptorFactory.INSTANCE.fromBitmap( icon ) );
|
||||
}
|
||||
if ( descriptors.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setIcons( descriptors );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerOptions( MogoMarkerOptions opt ) {
|
||||
|
||||
final MarkerOptions options = ObjectUtils.fromMogo( opt );
|
||||
if ( options == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setMarkerOptions( options );
|
||||
setObject( opt.getObject() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObject( Object object ) {
|
||||
mObject = object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return mObject;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPosition( double lat, double lng ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setPosition( new LonLatPoint( lng, lat ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getPosition() {
|
||||
if ( mMarker != null ) {
|
||||
final LonLatPoint latLng = mMarker.getPosition();
|
||||
return ObjectUtils.fromAMap( latLng );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotateAngle( float rotate ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setRotateAngle( rotate );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle( String title ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setTitle( title );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToTop() {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setToTop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible( boolean visible ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setVisible( visible );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
|
||||
mMogoMarkerClickListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerClickListener getOnMarkerClickListener() {
|
||||
return mMogoMarkerClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoInfoWindowAdapter getInfoWindowAdapter() {
|
||||
return mMogoInfoWindowAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDestroyed() {
|
||||
return mIsDestroy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner( String mOwner ) {
|
||||
this.mOwner = mOwner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner() {
|
||||
if ( mOwner != null ) {
|
||||
return mOwner;
|
||||
}
|
||||
if ( mMogoMarkerOptions != null ) {
|
||||
return mMogoMarkerOptions.getOwner();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Marker getMarker() {
|
||||
return mMarker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoMarkerOptions getMogoMarkerOptions() {
|
||||
return mMogoMarkerOptions;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, final OnMarkerAnimationListener listener ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
MarkerScaleAnimation animationScale = new MarkerScaleAnimation( fromX, toX );
|
||||
animationScale.setDuration( duration );
|
||||
// animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
|
||||
// animationScale.setInterpolator(interpolator);
|
||||
animationScale.setAnimationListener( new MarkerAnimationListener() {
|
||||
@Override
|
||||
public void onAnimationEnd( @NotNull Animation animation ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
listener.onAnimEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat( @NotNull Animation animation ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart( @NotNull Animation animation ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
listener.onAnimStart();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
mMarker.setMarkerScaleAnimation( animationScale );
|
||||
mMarker.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickable( boolean clickable ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setClickable( clickable );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setGps( boolean isGps ) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setGps( isGps );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String mLastAnchorColor = "";
|
||||
|
||||
@Override
|
||||
public void setAnchorColor( String anchorColor ) {
|
||||
if ( TextUtils.equals( mLastAnchorColor, anchorColor ) ) {
|
||||
return;
|
||||
}
|
||||
if (mMogoMarkerOptions != null) {
|
||||
mMogoMarkerOptions.anchorColor( anchorColor );
|
||||
}
|
||||
|
||||
if (mMarker != null) {
|
||||
mMarker.setAnchorColor( anchorColor );
|
||||
}
|
||||
mLastAnchorColor = anchorColor;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addDynamicAnchorPosition( MogoLatLng latLng, float angle, long duration ) {
|
||||
mMarker.addDynamicAnchorPostion( new LonLatPoint( latLng.lon, latLng.lat, angle ), System.currentTimeMillis(), ( int ) duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMarkerResName() {
|
||||
if ( mMarker != null ) {
|
||||
try {
|
||||
return mMarker.getMarkeOptions().getMarkerIconName();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MarkerWrapperClickHelper {
|
||||
|
||||
private volatile static MarkerWrapperClickHelper markerWrapperClickHelper;
|
||||
|
||||
private final Map<String, IMogoMarker> mogoMarkerMap = new HashMap<>();
|
||||
|
||||
private MarkerWrapperClickHelper(){
|
||||
|
||||
}
|
||||
|
||||
public void setMogoMarkerMap(String id,IMogoMarker iMogoMarker){
|
||||
if(isStaticMarker(id)){
|
||||
return;
|
||||
}
|
||||
this.mogoMarkerMap.put(id,iMogoMarker);
|
||||
}
|
||||
|
||||
public Map<String, IMogoMarker> getMogoMarkerMap() {
|
||||
return mogoMarkerMap;
|
||||
}
|
||||
|
||||
public static MarkerWrapperClickHelper getInstance(){
|
||||
if (markerWrapperClickHelper == null) {
|
||||
synchronized (MarkerWrapperClickHelper.class) {
|
||||
if (markerWrapperClickHelper == null) {
|
||||
markerWrapperClickHelper = new MarkerWrapperClickHelper();
|
||||
}
|
||||
}
|
||||
}
|
||||
return markerWrapperClickHelper;
|
||||
}
|
||||
|
||||
public boolean isStaticMarker(String id){
|
||||
return id.contains("traffic");
|
||||
}
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.utils.ObjectUtils;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapPolylineWrapper implements IMogoPolyline {
|
||||
|
||||
private Polyline mPolyline;
|
||||
private MogoPolylineOptions mOptions;
|
||||
private boolean mIsDestroyed = false;
|
||||
|
||||
public AMapPolylineWrapper( Polyline mPolyline,
|
||||
MogoPolylineOptions mOptions ) {
|
||||
this.mPolyline = mPolyline;
|
||||
this.mOptions = mOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
mIsDestroyed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoints( List< MogoLatLng > lonLats ) {
|
||||
if ( lonLats == null || lonLats.isEmpty() ) {
|
||||
mPolyline.setPoints( new ArrayList<LonLatPoint>() );
|
||||
return;
|
||||
}
|
||||
ArrayList< LonLatPoint > points = new ArrayList<>();
|
||||
for ( MogoLatLng lonLat : lonLats ) {
|
||||
LonLatPoint latLng = ObjectUtils.fromMogo( lonLat );
|
||||
if ( latLng == null ) {
|
||||
continue;
|
||||
}
|
||||
points.add( latLng );
|
||||
}
|
||||
mPolyline.setPoints( points );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getPoints() {
|
||||
if ( mPolyline == null ) {
|
||||
return null;
|
||||
}
|
||||
ArrayList< MogoLatLng > lonLats = new ArrayList<>();
|
||||
List<LonLatPoint> points = mPolyline.getPoints();
|
||||
if ( points != null ) {
|
||||
for ( LonLatPoint latLng : points ) {
|
||||
MogoLatLng lonLat = ObjectUtils.fromAMap( latLng );
|
||||
if ( lonLat == null ) {
|
||||
continue;
|
||||
}
|
||||
lonLats.add( lonLat );
|
||||
}
|
||||
}
|
||||
return lonLats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGeodesic( boolean draw ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setGeodesic( draw );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGeodesic() {
|
||||
return mPolyline == null ? false : mPolyline.isGeodesic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDottedLine( boolean dottedLine ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setDottedLine( dottedLine );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDottedLine() {
|
||||
return mPolyline == null ? false : mPolyline.isDottedLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidth( float width ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setWidth( width );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWidth() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getWidth();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor( int color ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setColor( color );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getColor();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZIndex( float zIndex ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setZIndex( zIndex );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZIndex() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getZIndex();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible( boolean visible ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setVisible( visible );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.isVisible();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTransparency( float transparency ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setTransparency( transparency );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOption( MogoPolylineOptions option ) {
|
||||
PolylineOptions target = ObjectUtils.fromMogo( option );
|
||||
if ( target == null ) {
|
||||
return;
|
||||
}
|
||||
mOptions = option;
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setOption( target );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDestroyed() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
package com.mogo.map.overlay
|
||||
|
||||
import android.graphics.*
|
||||
import com.mogo.eagle.core.data.map.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.map.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.map.overlay.point.Point.Options
|
||||
import com.mogo.map.*
|
||||
import com.mogo.map.overlay.core.*
|
||||
import com.mogo.map.overlay.line.*
|
||||
import com.mogo.map.overlay.point.Point
|
||||
import com.mogo.map.overlay.proxy.line.*
|
||||
import com.mogo.map.overlay.proxy.point.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
|
||||
|
||||
private val points by lazy { ConcurrentHashMap<Point, IMapPointOverlay>() }
|
||||
|
||||
private val lines by lazy { ConcurrentHashMap<Polyline, IMapPolylineOverlay>() }
|
||||
|
||||
override fun showOrUpdatePoint(options: Options): Point? {
|
||||
synchronized(points) {
|
||||
val key = Point(options.id, options.owner, options.level, options)
|
||||
var point = points[key]
|
||||
try {
|
||||
if (point != null) {
|
||||
point.setOptions(options)
|
||||
return key
|
||||
} else {
|
||||
val p = MogoMap.getInstance().mogoMap.addPoint(options)
|
||||
if (p != null) {
|
||||
p.onRemove { removed ->
|
||||
val keys = points.filterKeys { it.id == removed }
|
||||
if (keys.isNotEmpty()) {
|
||||
keys.forEach {
|
||||
points.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
points[key] = p
|
||||
point = p
|
||||
return key
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
point?.also {
|
||||
key.delegate = point
|
||||
it.setToTop()
|
||||
if (options.moveToCenter) {
|
||||
moveToCenter(
|
||||
options.id,
|
||||
options.longitude,
|
||||
options.latitude,
|
||||
if (options.isGps) CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude else CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().longitude,
|
||||
if (options.isGps) CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude else CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().latitude
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
override fun hidePoint(id: String) {
|
||||
points.filter { it.key.id == id && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hidePoint(p: Point) {
|
||||
points.filter { it.key == p && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideAllPointsInOwner(owner: String) {
|
||||
points.filter { it.key.owner == owner && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideAllPointsInLevel(level: Level) {
|
||||
points.filter { it.key.level == level && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideAllPoints() {
|
||||
points.filter { it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removePoint(id: String) {
|
||||
synchronized(points) {
|
||||
val keys = ArrayList<Point>()
|
||||
points.filter { it.key.id == id }.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
keys += it.key
|
||||
}
|
||||
keys.forEach {
|
||||
points.remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun removePoint(p: Point) {
|
||||
synchronized(points) {
|
||||
val keys = ArrayList<Point>()
|
||||
points.filter { it.key == p }.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
keys += it.key
|
||||
}
|
||||
keys.forEach {
|
||||
points.remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAllPointsInOwner(owner: String) {
|
||||
synchronized(points) {
|
||||
val keys = ArrayList<Point>()
|
||||
points.filter { it.key.owner == owner }.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
keys += it.key
|
||||
}
|
||||
keys.forEach {
|
||||
points.remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAllPointsInLevel(level: Level) {
|
||||
synchronized(points) {
|
||||
val keys = ArrayList<Point>()
|
||||
points.filter { it.key.level == level && it.value.isVisible() }.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
keys += it.key
|
||||
}
|
||||
keys.forEach {
|
||||
points.remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAllPoints() {
|
||||
synchronized(points){
|
||||
points.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
}
|
||||
points.clear()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showAllPoints() {
|
||||
points.filter { !it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showAllPointsInOwner(owner: String) {
|
||||
points.filter { it.key.owner == owner && !it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showAllPointsInLevel(level: Level) {
|
||||
points.filter { it.key.level == level && !it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showPoint(id: String) {
|
||||
points.filter { it.key.id == id && !it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showOrUpdateLine(options: Polyline.Options): Polyline? {
|
||||
synchronized(lines) {
|
||||
val key = Polyline(options.id, options.owner, options.level, options)
|
||||
var line = lines[key]
|
||||
try {
|
||||
if (line != null) {
|
||||
line.setOptions(options)
|
||||
return key
|
||||
} else {
|
||||
val newLine = MogoMap.getInstance().mogoMap.addLine(options)
|
||||
if (newLine != null) {
|
||||
newLine.onRemove { removed ->
|
||||
val keys = lines.filterKeys { it.id == removed }
|
||||
if (keys.isNotEmpty()) {
|
||||
keys.forEach {
|
||||
lines.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
lines[key] = newLine
|
||||
line = newLine
|
||||
return key
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
line?.also {
|
||||
it.setToTop()
|
||||
key.delegate = it
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
private fun moveToCenter(id: String, eventLon: Double, eventLat: Double, carLon: Double, carLat: Double) {
|
||||
try {
|
||||
CallerMapUIServiceManager.getMapUIController()?.showBounds(
|
||||
id,
|
||||
MogoLatLng(carLat, carLon),
|
||||
listOf(MogoLatLng(eventLat, eventLon)),
|
||||
Rect(
|
||||
WindowUtils.dip2px(Utils.getApp(), 100f),
|
||||
WindowUtils.dip2px(Utils.getApp(), 370f),
|
||||
WindowUtils.dip2px(Utils.getApp(), 575f),
|
||||
WindowUtils.dip2px(Utils.getApp(), 100f)
|
||||
), true)
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideLine(id: String) {
|
||||
lines.filter { it.key.id == id && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideLine(p: Polyline) {
|
||||
lines.filter { it.key == p && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideAllLinesInOwner(owner: String) {
|
||||
lines.filter { it.key.owner == owner && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideAllLinesInLevel(level: Level) {
|
||||
lines.filter { it.key.level == level && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideAllLines() {
|
||||
lines.filter { it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeLine(id: String) {
|
||||
synchronized(lines) {
|
||||
val keys = ArrayList<Polyline>()
|
||||
lines.filter { it.key.id == id }.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
keys += it.key
|
||||
}
|
||||
keys.forEach {
|
||||
lines.remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeLine(p: Polyline) {
|
||||
synchronized(lines) {
|
||||
val keys = ArrayList<Polyline>()
|
||||
lines.filter { it.key == p }.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
keys += it.key
|
||||
}
|
||||
keys.forEach {
|
||||
lines.remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAllLinesInOwner(owner: String) {
|
||||
synchronized(lines) {
|
||||
val keys = ArrayList<Polyline>()
|
||||
lines.filter { it.key.owner == owner }.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
keys += it.key
|
||||
}
|
||||
keys.forEach {
|
||||
lines.remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAllLinesInLevel(level: Level) {
|
||||
synchronized(lines) {
|
||||
val keys = ArrayList<Polyline>()
|
||||
lines.filter { it.key.level == level }.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
keys += it.key
|
||||
}
|
||||
keys.forEach {
|
||||
lines.remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAllLines() {
|
||||
synchronized(lines) {
|
||||
lines.onEach {
|
||||
try {
|
||||
it.value.remove()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
try {
|
||||
it.value.destroy()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
}
|
||||
lines.clear()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showAllLines() {
|
||||
lines.filter { !it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showAllLinesInOwner(owner: String) {
|
||||
lines.filter { !it.value.isVisible() && it.key.owner == owner }.onEach {
|
||||
it.value.setVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showAllLinesInLevel(level: Level) {
|
||||
lines.filter { !it.value.isVisible() && it.key.level == level }.onEach {
|
||||
it.value.setVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showLine(id: String) {
|
||||
lines.filter { it.key.id == id && !it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideAllPointsExceptIds(vararg ids: String) {
|
||||
points.filter { !ids.contains(it.key.id) && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideAllPointsExceptOwners(vararg owners: String) {
|
||||
points.filter { !owners.contains(it.key.owner) && it.value.isVisible() }.onEach {
|
||||
it.value.setVisible(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.mogo.map.overlay.wrapper.line
|
||||
|
||||
import com.mogo.map.overlay.line.Polyline.Options
|
||||
import com.mogo.map.overlay.proxy.line.*
|
||||
import com.mogo.map.utils.ObjectUtils
|
||||
import com.zhidaoauto.map.sdk.open.poyline.*
|
||||
import java.util.concurrent.atomic.*
|
||||
|
||||
class AMapPolylineWrapper(private val id: String, private val delegate: Polyline): IMapPolylineOverlay {
|
||||
|
||||
private val isDestroyed by lazy { AtomicBoolean(false) }
|
||||
|
||||
private val isRemoved by lazy { AtomicBoolean(false) }
|
||||
|
||||
@Volatile
|
||||
private var onRemoveAction: ((id: String) -> Unit)? = null
|
||||
|
||||
override fun destroy() {
|
||||
if (isDestroyed.compareAndSet(false, true)) {
|
||||
try {
|
||||
delegate.destroy()
|
||||
} finally {
|
||||
onRemoveAction?.invoke(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun remove() {
|
||||
if (isRemoved.compareAndSet(false, true)) {
|
||||
try {
|
||||
delegate.remove()
|
||||
} finally {
|
||||
onRemoveAction?.invoke(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun setVisible(visible: Boolean) {
|
||||
if (isDestroyed.get() || isRemoved.get()) {
|
||||
return
|
||||
}
|
||||
delegate.setVisible(visible)
|
||||
}
|
||||
|
||||
override fun isDestroyed(): Boolean {
|
||||
return isDestroyed.get()
|
||||
}
|
||||
|
||||
override fun isVisible(): Boolean {
|
||||
return delegate.isVisible() ?: false
|
||||
}
|
||||
|
||||
override fun setToTop() {
|
||||
//没有对应的API
|
||||
}
|
||||
|
||||
override fun setUnTop() {
|
||||
//没有对应的API
|
||||
}
|
||||
|
||||
override fun setOptions(options: Options) {
|
||||
if (isDestroyed.get() || isRemoved.get()) {
|
||||
return
|
||||
}
|
||||
delegate.also {
|
||||
val option = ObjectUtils.fromMogo(options)
|
||||
if (option != null) {
|
||||
it.setOption(option)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRemove(action: (id: String) -> Unit) {
|
||||
onRemoveAction = action
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.mogo.map.overlay.wrapper.point
|
||||
|
||||
import com.mogo.eagle.core.data.map.*
|
||||
import com.mogo.map.overlay.point.Point.Options
|
||||
import com.mogo.map.overlay.proxy.point.*
|
||||
import com.mogo.map.utils.ObjectUtils
|
||||
import com.zhidaoauto.map.sdk.open.marker.*
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
class AMapPointWrapper(private val id: String, private val delegate: Marker): IMapPointOverlay {
|
||||
|
||||
private val isDestroyed by lazy { AtomicBoolean(false) }
|
||||
|
||||
private val isRemoved by lazy { AtomicBoolean(false) }
|
||||
|
||||
|
||||
@Volatile
|
||||
private var onRemoveAction: ((id: String) -> Unit)? = null
|
||||
|
||||
override fun destroy() {
|
||||
if (isDestroyed.compareAndSet(false, true)) {
|
||||
try {
|
||||
delegate.destroy()
|
||||
} finally {
|
||||
onRemoveAction?.invoke(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun remove() {
|
||||
if (isRemoved.compareAndSet(false, true)) {
|
||||
try {
|
||||
delegate.remove()
|
||||
} finally {
|
||||
onRemoveAction?.invoke(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun setVisible(visible: Boolean) {
|
||||
if (isDestroyed.get() || isRemoved.get()) {
|
||||
return
|
||||
}
|
||||
delegate.setVisible(visible)
|
||||
}
|
||||
|
||||
override fun isDestroyed(): Boolean {
|
||||
return isDestroyed.get()
|
||||
}
|
||||
|
||||
override fun isVisible(): Boolean {
|
||||
return delegate.isVisible()
|
||||
}
|
||||
|
||||
override fun setToTop() {
|
||||
if (isDestroyed.get() || isRemoved.get()) {
|
||||
return
|
||||
}
|
||||
delegate.setToTop()
|
||||
}
|
||||
|
||||
override fun setUnTop() {
|
||||
if (isDestroyed.get() || isRemoved.get()) {
|
||||
return
|
||||
}
|
||||
delegate.setUnTop()
|
||||
}
|
||||
|
||||
override fun setOptions(opt: Options) {
|
||||
if (isDestroyed.get() || isRemoved.get()) {
|
||||
return
|
||||
}
|
||||
delegate.setMarkerOptions(ObjectUtils.fromMogo(opt))
|
||||
}
|
||||
|
||||
override fun addDynamicAnchorPosition(point: MogoLatLng, angle: Float, duration: Long) {
|
||||
delegate.addDynamicAnchorPostion(LonLatPoint(point.lon, point.lat, angle.toDouble()), System.currentTimeMillis(), duration.toInt())
|
||||
}
|
||||
|
||||
override fun onRemove(action: (id: String) -> Unit) {
|
||||
onRemoveAction = action
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,13 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom2(float zoom) {
|
||||
if (mClient != null) {
|
||||
mClient.changeZoom2(zoom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDebugMode(Boolean debugMode) {
|
||||
if (mClient != null) {
|
||||
|
||||
@@ -7,9 +7,8 @@ import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.overlay.line.Polyline;
|
||||
import com.mogo.map.overlay.point.Point;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
|
||||
@@ -33,7 +32,7 @@ import mogo.yycp.api.proto.SocketDownData;
|
||||
*/
|
||||
public class ObjectUtils {
|
||||
|
||||
public static MarkerOptions fromMogo(MogoMarkerOptions opt) {
|
||||
public static MarkerOptions fromMogo(Point.Options opt) {
|
||||
|
||||
if (opt == null) {
|
||||
return null;
|
||||
@@ -48,9 +47,14 @@ public class ObjectUtils {
|
||||
descriptors.add(new BitmapDescriptor(icon));
|
||||
}
|
||||
}
|
||||
MarkerOptions markerOptions;
|
||||
if(TextUtils.isEmpty(opt.getId())){
|
||||
markerOptions = new MarkerOptions();
|
||||
}else{
|
||||
markerOptions = new MarkerOptions(opt.getId());
|
||||
}
|
||||
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.setGps(opt.isGps())
|
||||
markerOptions.setGps(opt.isGps())
|
||||
.position(new LonLatPoint(opt.getLongitude(), opt.getLatitude()))
|
||||
.anchor(opt.getU(), opt.getV())
|
||||
.icons(descriptors)
|
||||
@@ -59,25 +63,26 @@ public class ObjectUtils {
|
||||
.rotateAngle(opt.getRotate())
|
||||
.setFlat(opt.isFlat())
|
||||
.visible(opt.isVisible())
|
||||
.infoWindowEnable(opt.isInifoWindowEnable())
|
||||
.infoWindowEnable(opt.isInfoWindowEnable())
|
||||
.scale(opt.getScale())
|
||||
.alpha(opt.getAlpha())
|
||||
.setInfoWindowOffset(opt.getOffsetX(), opt.getOffsetY())
|
||||
.zIndex(opt.getzIndex());
|
||||
.zIndex(opt.getLevel().getZIndex());
|
||||
|
||||
try {
|
||||
if (!TextUtils.isEmpty(opt.getAnchorColor())) {
|
||||
Color.parseColor(opt.getAnchorColor());
|
||||
markerOptions.anchorColor(opt.getAnchorColor());
|
||||
String anchorColor = opt.getAnchorColor();
|
||||
if (anchorColor != null && !TextUtils.isEmpty(anchorColor)) {
|
||||
Color.parseColor(anchorColor);
|
||||
markerOptions.anchorColor(anchorColor);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
markerOptions.vrEnable(opt.is3DMode());
|
||||
if (!TextUtils.isEmpty(opt.getResName())) {
|
||||
markerOptions.setMarkerIconName(opt.getResName());
|
||||
String resName = opt.getResName();
|
||||
if (resName != null && !TextUtils.isEmpty(resName)) {
|
||||
markerOptions.setMarkerIconName(resName);
|
||||
} else {
|
||||
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo(opt);
|
||||
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo(opt.getIcon(), opt.getIconView());
|
||||
if (descriptor != null) {
|
||||
markerOptions.markerIcon(descriptor);
|
||||
}
|
||||
@@ -85,11 +90,13 @@ public class ObjectUtils {
|
||||
markerOptions.marker3DIcon(opt.getIcon3DRes());
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(opt.getTitle())) {
|
||||
markerOptions.title(opt.getTitle());
|
||||
String title = opt.getTitle();
|
||||
if (title != null && !TextUtils.isEmpty(title)) {
|
||||
markerOptions.title(title);
|
||||
}
|
||||
if (!TextUtils.isEmpty(opt.getSnippet())) {
|
||||
markerOptions.snippet(opt.getSnippet());
|
||||
String snippet = opt.getSnippet();
|
||||
if (snippet != null && !TextUtils.isEmpty(snippet)) {
|
||||
markerOptions.snippet(snippet);
|
||||
}
|
||||
return markerOptions;
|
||||
}
|
||||
@@ -107,7 +114,8 @@ public class ObjectUtils {
|
||||
markerOptions.setLat(trafficData.getLatitude());
|
||||
markerOptions.setLon(trafficData.getLongitude());
|
||||
markerOptions.setTime(Double.valueOf(trafficData.getSatelliteTime() * 1000).longValue());
|
||||
if(trafficData.getColor()!=null && !trafficData.getColor().isEmpty()){
|
||||
trafficData.getColor();
|
||||
if(!trafficData.getColor().isEmpty()){
|
||||
markerOptions.setColor(trafficData.getColor());
|
||||
}else{
|
||||
markerOptions.setColor("#00000000");
|
||||
@@ -138,68 +146,16 @@ public class ObjectUtils {
|
||||
return markerOptions;
|
||||
}
|
||||
|
||||
private static BitmapDescriptor getBitmapDescriptorFromMogo(MogoMarkerOptions options) {
|
||||
if (options == null) {
|
||||
return null;
|
||||
}
|
||||
Bitmap icon = options.getIcon();
|
||||
private static BitmapDescriptor getBitmapDescriptorFromMogo(Bitmap icon, View view) {
|
||||
if (icon != null) {
|
||||
return BitmapDescriptorFactory.INSTANCE.fromBitmap(icon);
|
||||
}
|
||||
View view = options.getIconView();
|
||||
if (view != null) {
|
||||
return BitmapDescriptorFactory.INSTANCE.fromView(view);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static MogoLocation fromLocation(com.zhidaoauto.map.sdk.open.location.MogoLocation aLocation) {
|
||||
if (aLocation == null) {
|
||||
return null;
|
||||
}
|
||||
MogoLocation location = new MogoLocation();
|
||||
|
||||
//agps 高德
|
||||
//agps_rtk 高德-高精
|
||||
if (aLocation.getProvider().isEmpty()) {
|
||||
location.setLocType(0);
|
||||
}
|
||||
if ("AGPS".equals(aLocation.getProvider())) {
|
||||
location.setLocType(1); // 定位类型为高德坐标(网路或者硬件定位)
|
||||
} else if ("AGPS_RTK".equals(aLocation.getProvider())) {
|
||||
location.setLocType(1000); // 定位类型为WGS84进行转译的坐标
|
||||
} else {
|
||||
location.setLocType(0);
|
||||
}
|
||||
location.setSatellite(4);
|
||||
location.setGnssSpeed(aLocation.getSpeed());
|
||||
location.setLatitude(aLocation.getLat());
|
||||
location.setLongitude(aLocation.getLon());
|
||||
location.setAltitude(aLocation.getAltitude());
|
||||
location.setHeading((float) aLocation.getHeading());
|
||||
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.setAccuracy( aLocation.getAccuracy() );
|
||||
// location.setTime( aLocation.getTime() );
|
||||
// location.setLocationDetail( aLocation.getLocationDetail() );
|
||||
// location.setPoiName( aLocation.getPoiName() );
|
||||
// location.setAoiName( aLocation.getAoiName() );
|
||||
// location.setErrCode( aLocation.getErrorCode() );
|
||||
// location.setErrInfo( aLocation.getErrorInfo() );
|
||||
// location.setStreetNum( aLocation.getStreetNum() );
|
||||
// location.setDescription( aLocation.getDescription() );
|
||||
// location.setBuildingId( aLocation.getBuildingId() );
|
||||
// location.setFloor( aLocation.getFloor() );
|
||||
// location.setGpsAccuracyStatus( aLocation.getGpsAccuracyStatus() );
|
||||
return location;
|
||||
}
|
||||
|
||||
public static LonLatPoint fromMogo(MogoLatLng latLng) {
|
||||
if (latLng == null) {
|
||||
return null;
|
||||
@@ -214,12 +170,12 @@ public class ObjectUtils {
|
||||
return new MogoLatLng(point.getLatitude(), point.getLongitude());
|
||||
}
|
||||
|
||||
public static PolylineOptions fromMogo(MogoPolylineOptions options) {
|
||||
public static PolylineOptions fromMogo(Polyline.Options options) {
|
||||
if (options == null) {
|
||||
return null;
|
||||
}
|
||||
PolylineOptions target = new PolylineOptions();
|
||||
target.setGps(options.gps());
|
||||
target.setGps(options.isUseGps());
|
||||
if (options.getPoints() != null) {
|
||||
List<LonLatPoint> points = new ArrayList<>();
|
||||
for (MogoLatLng point : options.getPoints()) {
|
||||
@@ -228,20 +184,24 @@ public class ObjectUtils {
|
||||
target.lonLatPoints(points);
|
||||
}
|
||||
target.setLineWidth(options.getWidth());
|
||||
target.zIndex(options.getZIndex());
|
||||
target.dottedLine(options.isDottedLine());
|
||||
target.geodesic(options.isGeodesic());
|
||||
target.dottedLineType(options.getDottedLineType());
|
||||
target.zIndex(options.getLevel().getZIndex());
|
||||
target.setColor(options.getColor());
|
||||
target.useGradient(options.isGradient());
|
||||
target.useFacade(options.useFacade);
|
||||
if (options.maxIndex >= 0f) {
|
||||
target.maxIndex = options.maxIndex;
|
||||
target.useFacade(options.getUseFacade());
|
||||
target.setVisible(options.isVisible());
|
||||
if (options.getMaxIndex() >= 0f) {
|
||||
target.maxIndex = options.getMaxIndex();
|
||||
}
|
||||
if (options.getColorValues() != null) {
|
||||
target.colorValues(options.getColorValues());
|
||||
if (options.getColors() != null) {
|
||||
target.colorValues(options.getColors());
|
||||
}
|
||||
if (options.isBrightOn()) {
|
||||
if (options.isLightOn()) {
|
||||
target.isBright = true;
|
||||
target.brightColor = options.getBrightColor();
|
||||
target.brightSpeed = options.getBrightSpeed();
|
||||
target.brightColor = options.getLightColor();
|
||||
target.brightSpeed = options.getLightSpeed();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.mogo.support.obu.model.MogoObuRsmWarningData;
|
||||
import com.mogo.support.obu.model.MogoObuRvWarningData;
|
||||
import com.mogo.support.obu.model.MogoObuSpatWarningData;
|
||||
import com.mogo.support.obu.model.MogoObuSystemBConfigData;
|
||||
import com.mogo.support.obu.model.MogoObuSystemStatusData;
|
||||
import com.mogo.support.obu.model.advance.AccFourAxes;
|
||||
import com.mogo.support.obu.model.advance.DateTime;
|
||||
import com.mogo.support.obu.model.advance.NodeId;
|
||||
@@ -31,6 +32,7 @@ import com.mogo.support.obu.model.advance.VehControl;
|
||||
import com.mogo.support.obu.model.advance.VehSize;
|
||||
import com.mogo.support.obu.model.advance.VerticalLLV;
|
||||
import com.mogo.support.obu.model.advance.WarningData;
|
||||
import com.mogo.support.obu.model.result.BaseResult;
|
||||
import com.mogo.support.obu.option.MogoObuLog;
|
||||
import com.mogo.support.obu.option.MogoObuOptions;
|
||||
import com.mogo.support.obu.upgrade.OnUpgradeListener;
|
||||
@@ -246,6 +248,17 @@ public class ObuManager {
|
||||
MogoObuManager.getInstance().unregisterTopic(topicIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* HV 数据推送周期
|
||||
* 连接成功后调用生效,OBU重启失效
|
||||
*
|
||||
* @param pushCycle 周期 单位:ms 默认值:100ms
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public void setHvInfoPushCycle(int pushCycle) {
|
||||
MogoObuManager.getInstance().setHvInfoPushCycle(pushCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* OBU SDK 日志配置
|
||||
* 支持日志输出至LogCat和写入文件
|
||||
@@ -328,6 +341,22 @@ public class ObuManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMogoObuCallResult(BaseResult result) {
|
||||
super.onMogoObuCallResult(result);
|
||||
if (listener != null) {
|
||||
listener.onObuCallResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMogoObuSystemStatus(MogoObuSystemStatusData data) {
|
||||
super.onMogoObuSystemStatus(data);
|
||||
if (listener != null) {
|
||||
listener.onObuSystemStatus(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMogoObuHvBasics(MogoObuHvBasicsData data) {
|
||||
if (listener != null) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhidao.support.obu;
|
||||
import com.mogo.support.obu.ObuScene;
|
||||
import com.mogo.support.obu.constants.Define;
|
||||
import com.mogo.support.obu.model.MogoObuSystemStatusData;
|
||||
import com.mogo.support.obu.model.result.BaseResult;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -16,6 +17,14 @@ public interface OnObuListener {
|
||||
*/
|
||||
void onConnectStatus(@Define.ConnectStatus int connectStatus);
|
||||
|
||||
/**
|
||||
* OBU 函数调用 返回状态
|
||||
*
|
||||
* @param result 调用结果
|
||||
* @since 1.0.0
|
||||
*/
|
||||
void onObuCallResult(BaseResult result);
|
||||
|
||||
/**
|
||||
* OBU 系统状态
|
||||
*
|
||||
|
||||
@@ -0,0 +1,423 @@
|
||||
package com.zhidao.support.obu.constants;
|
||||
|
||||
/**
|
||||
* obu 数据类型定义
|
||||
* 后面添加新数据类型,只需要鹰眼业务层修改就可以。obu硬件和obu的sdk都是透传
|
||||
*/
|
||||
public class MogoObuShowConstants {
|
||||
|
||||
public interface STATUS {
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
int UPDATE = 0;
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
int ADD = 1;
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
int DELETE = 2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 红绿灯预警类型
|
||||
*/
|
||||
public interface SPAT_WARNING_TYPE {
|
||||
/**
|
||||
* 无效
|
||||
*/
|
||||
int INVALID = 0;
|
||||
/**
|
||||
* 闯红灯预警(Signal Violation Warning)
|
||||
*/
|
||||
int SVW = 1;
|
||||
/**
|
||||
* 绿波通行引导(Green Light Optimal Speed Advisory)
|
||||
*/
|
||||
int GLOSA = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 交通参与者类型
|
||||
*/
|
||||
public interface PTC_TYPE {
|
||||
/**
|
||||
* 未知
|
||||
*/
|
||||
int UNKNOWN = 0;
|
||||
/**
|
||||
* 机动车
|
||||
*/
|
||||
int MOTOR_VEHICLE = 1;
|
||||
/**
|
||||
* 非机动车
|
||||
*/
|
||||
int NON_MOTOR_VEHICLE = 2;
|
||||
/**
|
||||
* 行人
|
||||
*/
|
||||
int PEDESTRIAN = 3;
|
||||
/**
|
||||
* OBU自身
|
||||
*/
|
||||
int OBU_ONESELF = 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预警类型
|
||||
*/
|
||||
public interface V2X_WARNING_TYPE {
|
||||
/**
|
||||
* 前向碰撞预警(Forward Collision Warning)
|
||||
*/
|
||||
int FCW = 0;
|
||||
/**
|
||||
* 交叉路口碰撞预警(Intersection Collision Warning)
|
||||
*/
|
||||
int ICW = 1;
|
||||
/**
|
||||
* 左转辅助预警(Left Turn Assist)
|
||||
*/
|
||||
int LTA = 2;
|
||||
/**
|
||||
* 盲区预警(Blind Spot Warning)
|
||||
*/
|
||||
int BSW = 3;
|
||||
/**
|
||||
* 变道预警(Lane Change Warning)
|
||||
*/
|
||||
int LCW = 4;
|
||||
/**
|
||||
* 逆向超车预警(Do Not Pass Warning)
|
||||
*/
|
||||
int DNPW = 5;
|
||||
/**
|
||||
* 紧急制动预警(Emergency Brake Warning)
|
||||
*/
|
||||
int EBW = 6;
|
||||
/**
|
||||
* 异常车辆提醒(Abnormal Vehicle Warning)
|
||||
*/
|
||||
int AVW = 7;
|
||||
/**
|
||||
* 失控车辆预警(Control Loss Warning)
|
||||
*/
|
||||
int CLW = 8;
|
||||
/**
|
||||
* 紧急车辆预警(Emergency Vehicle Warning)
|
||||
*/
|
||||
int EVW = 9;
|
||||
/**
|
||||
* 弱势交通参与者碰撞预警(Vulnerable Road User Collision Warning)
|
||||
*/
|
||||
int VRUCW = 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* V2V预警等级
|
||||
*/
|
||||
public interface V2X_WARNING_LEVEL {
|
||||
/**
|
||||
* 无效
|
||||
*/
|
||||
int INVALID = 0;
|
||||
/**
|
||||
* 检测到
|
||||
*/
|
||||
int DETECTED = 1;
|
||||
/**
|
||||
* 通知
|
||||
*/
|
||||
int INFORM = 2;
|
||||
/**
|
||||
* 警告
|
||||
*/
|
||||
int WARNING = 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* RSI预警类型
|
||||
*/
|
||||
public interface RSI_SCENE_TYPE {
|
||||
/**
|
||||
* 无效
|
||||
*/
|
||||
int INVALID = 0;
|
||||
/**
|
||||
* 限速信息(Speed Limit Warning)
|
||||
*/
|
||||
int SLW = 1;
|
||||
/**
|
||||
* 道路危险(Hazardous Location Warning)
|
||||
*/
|
||||
int HLW = 2;
|
||||
/**
|
||||
* 车内标牌(In-Vehicle Signage)
|
||||
*/
|
||||
int IVS = 3;
|
||||
/**
|
||||
* 前方拥堵(Traffic Jam Warning)
|
||||
*/
|
||||
int TJW = 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆和交通参与者的目标方位信息
|
||||
*/
|
||||
public interface VEH_TARGET_POSITION {
|
||||
/**
|
||||
* 同向正前方
|
||||
*/
|
||||
int AHEAD_IN_LANE = 0x11;
|
||||
/**
|
||||
* 同向邻道左前方
|
||||
*/
|
||||
int AHEAD_LEFT = 0x12;
|
||||
/**
|
||||
* 同向邻道右前方
|
||||
*/
|
||||
int AHEAD_RIGHT = 0x13;
|
||||
/**
|
||||
* 同向远道左前方
|
||||
*/
|
||||
int AHEAD_FAR_LEFT = 0x14;
|
||||
/**
|
||||
* 同向远道右前方
|
||||
*/
|
||||
int AHEAD_FAR_RIGHT = 0x15;
|
||||
/**
|
||||
* 同向正后方
|
||||
*/
|
||||
int BEHEAD_IN_LANE = 0x21;
|
||||
/**
|
||||
* 同向邻道左后方
|
||||
*/
|
||||
int BEHEAD_LEFT = 0x22;
|
||||
/**
|
||||
* 同向邻道右后方
|
||||
*/
|
||||
int BEHEAD_RIGHT = 0x23;
|
||||
/**
|
||||
* 同向远道左后方
|
||||
*/
|
||||
int BEHEAD_FAR_LEFT = 0x24;
|
||||
/**
|
||||
* 同向远道右后方
|
||||
*/
|
||||
int BEHEAD_FAR_RIGHT = 0x25;
|
||||
/**
|
||||
* 对向正前方
|
||||
*/
|
||||
int ONCOMING_IN_LANE = 0x31;
|
||||
/**
|
||||
* 对向邻道左前方
|
||||
*/
|
||||
int ONCOMING_LEFT = 0x32;
|
||||
/**
|
||||
* 对向邻道右前方
|
||||
*/
|
||||
int ONCOMING_RIGHT = 0x33;
|
||||
/**
|
||||
* 对向远道左前方
|
||||
*/
|
||||
int ONCOMING_FAR_LEFT = 0x34;
|
||||
/**
|
||||
* 对向远道右前方
|
||||
*/
|
||||
int ONCOMING_FAT_RIGHT = 0x35;
|
||||
/**
|
||||
* 路口左侧来车
|
||||
*/
|
||||
int INTERSECTION_LEFT = 0x46;
|
||||
/**
|
||||
* 路口右侧来车
|
||||
*/
|
||||
int INTERSECTION_RIGHT = 0x47;
|
||||
/**
|
||||
* 其他情况
|
||||
*/
|
||||
int UNCLASSIFIED = 0x00;
|
||||
}
|
||||
|
||||
/**
|
||||
* 交通时间或标志的目标方位信息
|
||||
*/
|
||||
public interface RTI_TARGET_POSITION {
|
||||
/**
|
||||
* 未知
|
||||
*/
|
||||
int UNKNOWN = 0x00;
|
||||
/**
|
||||
* 在事件中
|
||||
*/
|
||||
int LANE_INSID = 0x01;
|
||||
/**
|
||||
* 在事件左侧
|
||||
*/
|
||||
int LANE_LEFT = 0x02;
|
||||
/**
|
||||
* 在事件右侧
|
||||
*/
|
||||
int LANE_RIGHT = 0x03;
|
||||
/**
|
||||
* 在事件前方
|
||||
*/
|
||||
int LANE_AHEAD = 0x04;
|
||||
/**
|
||||
* 在事件后方
|
||||
*/
|
||||
int LANE_REAR = 0x05;
|
||||
/**
|
||||
* 距事件较远
|
||||
*/
|
||||
int FARAWAY = 0x06;
|
||||
/**
|
||||
* 不在同一平面
|
||||
*/
|
||||
int NOT_SOME_PLANE = 0x07;
|
||||
}
|
||||
|
||||
/**
|
||||
* 交通事件
|
||||
*/
|
||||
public interface RTE {
|
||||
/**
|
||||
* 车辆故障
|
||||
*/
|
||||
int RTI_TYPE_BREAKDOWN = 101;
|
||||
/**
|
||||
* 道路积水
|
||||
*/
|
||||
int RTI_TYPE_ROAD_WATER = 407;
|
||||
/**
|
||||
* 异常停车
|
||||
*/
|
||||
int RTI_TYPE_PARKING_VIOLATION = 412;
|
||||
/**
|
||||
* 施工占道
|
||||
*/
|
||||
int RTI_TYPE_CONSTRUCTION_RTE = 501;
|
||||
/**
|
||||
* 拥堵
|
||||
*/
|
||||
int RTI_TYPE_TJW = 707;
|
||||
/**
|
||||
* 超速行驶
|
||||
*/
|
||||
int RTI_TYPE_SPEEDING = 901;
|
||||
/**
|
||||
* 车辆逆行
|
||||
*/
|
||||
int RTI_TYPE_RETRIGRADE = 904;
|
||||
}
|
||||
|
||||
/**
|
||||
* 交通标牌
|
||||
*/
|
||||
public interface RTS {
|
||||
/**
|
||||
* 十字路口
|
||||
*/
|
||||
int RTI_TYPE_INTERSECTION = 1;
|
||||
/**
|
||||
* 急转弯
|
||||
*/
|
||||
int RTI_TYPE_SHAPR_TURNS = 2;
|
||||
/**
|
||||
* 桥梁
|
||||
*/
|
||||
int RTI_TYPE_BRIDGE = 8;
|
||||
/**
|
||||
* 行人
|
||||
*/
|
||||
int RTI_TYPE_PEDESTRIAN = 10;
|
||||
/**
|
||||
* 路滑
|
||||
*/
|
||||
int RTI_TYPE_SLIPPERY_ROAD = 17;
|
||||
/**
|
||||
* 隧道
|
||||
*/
|
||||
int RTI_TYPE_TUNNEL = 21;
|
||||
/**
|
||||
* 渡轮
|
||||
*/
|
||||
int RTI_TYPE_FERRY = 22;
|
||||
/**
|
||||
* 路面不平
|
||||
*/
|
||||
int RTI_TYPE_UNEVEN_ROAD = 24;
|
||||
/**
|
||||
* 非机动车
|
||||
*/
|
||||
int RTI_TYPE_NON_MOTOR_VEHICLE = 32;
|
||||
/**
|
||||
* 障碍
|
||||
*/
|
||||
int RTI_TYPE_OBSTACLE = 36;
|
||||
/**
|
||||
* 施工
|
||||
*/
|
||||
int RTI_TYPE_CONSTRUCTION = 38;
|
||||
/**
|
||||
* 注意合流
|
||||
*/
|
||||
int RTI_TYPE_ATTENTION_CONFLUENCE = 44;
|
||||
/**
|
||||
* 车队
|
||||
*/
|
||||
int RTI_TYPE_VEHICLE_QUEUE = 47;
|
||||
/**
|
||||
* 不通
|
||||
*/
|
||||
int RTI_TYPE_NO_PASSING = 51;
|
||||
/**
|
||||
* 禁止掉头
|
||||
*/
|
||||
int RTI_TYPE_NO_TURNING_AROUND = 75;
|
||||
/**
|
||||
* 禁止停车
|
||||
*/
|
||||
int RTI_TYPE_NO_STOPPING = 78;
|
||||
/**
|
||||
* 禁止鸣笛
|
||||
*/
|
||||
int RTI_TYPE_NO_TOOTING = 80;
|
||||
/**
|
||||
* 限速
|
||||
*/
|
||||
int RTI_TYPE_SPEED_LIMIT = 85;
|
||||
/**
|
||||
* 直行或右转
|
||||
*/
|
||||
int RTI_TYPE_GO_STRAIGHT_TURN_RIGHT = 100;
|
||||
/**
|
||||
* 人行横道
|
||||
*/
|
||||
int RTI_TYPE_PEDESTRIAN_CROSSING = 114;
|
||||
/**
|
||||
* 公交提醒
|
||||
*/
|
||||
int RTI_TYPE_BUS_WARNING = 123;
|
||||
/**
|
||||
* 右侧变窄/车道数减少
|
||||
*/
|
||||
int RTI_TYPE_NARROW_RIGHT = 163;
|
||||
/**
|
||||
* 加油站
|
||||
*/
|
||||
int RTI_TYPE_GAS_STATION = 201;
|
||||
/**
|
||||
* 学校
|
||||
*/
|
||||
int RTI_TYPE_SCHOOL = 242;
|
||||
/**
|
||||
* 事故
|
||||
*/
|
||||
int RTI_TYPE_ACCIDENT = 244;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user