merge aisdk

This commit is contained in:
suyong
2021-05-10 15:17:36 +08:00
205 changed files with 50634 additions and 18525 deletions

View File

@@ -1,13 +1,11 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="AUTODETECT_INDENTS" value="false" />
<JavaCodeStyleSettings>
<option name="FIELD_NAME_PREFIX" value="m" />
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" withSubpackages="false" static="false" />
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
<package name="io.ktor" withSubpackages="true" static="false" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
@@ -121,5 +119,8 @@
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@@ -30,7 +30,7 @@
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="description,since:,date" />
<option name="myAdditionalJavadocTags" value="date" />
</inspection_tool>
</profile>
</component>

View File

@@ -1,5 +1,15 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.bus">
/
<application>
<!--这里是为了测试增加的广播-->
<receiver android:name=".receiver.TestOchBusBroadcastReceiver">
<intent-filter>
<action android:name="com.bus.test_control" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -16,7 +16,7 @@ public class OchBusStation {
private double lon;
private String siteDesc;
private int siteState;
private int isCurrentSite;
private int isCurrentSite;// @see OchBusConst 是否是当前站 1是 2下一站 0普通站
private int siteColor;
private String peoples;
private int ifStop; // 是否需要停靠、1需要、0不需要

View File

@@ -9,26 +9,35 @@ import com.mogo.commons.network.Utils;
*/
public class QueryLeaveAwayPassengersRequest {
private String sn;
private int siteId;
private int endSiteId;
private int orderDispatchType = 4;
public QueryLeaveAwayPassengersRequest( int siteId ) {
public QueryLeaveAwayPassengersRequest(int siteId) {
this.sn = Utils.getSn();
this.siteId = siteId;
this.endSiteId = siteId;
}
public String getSn() {
return sn;
}
public void setSn( String sn ) {
public void setSn(String sn) {
this.sn = sn;
}
public int getSiteId() {
return siteId;
public int getEndSiteId() {
return endSiteId;
}
public void setSiteId( int siteId ) {
this.siteId = siteId;
public void setEndSiteId(int endSiteId) {
this.endSiteId = endSiteId;
}
public int getOrderDispatchType() {
return orderDispatchType;
}
public void setOrderDispatchType(int orderDispatchType) {
this.orderDispatchType = orderDispatchType;
}
}

View File

@@ -6,6 +6,8 @@ package com.mogo.och.bus.constant;
* @author tongchenfei
*/
public class OchBusConst {
// 测试用的广播
public static final String BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY = "sceneType";
// 无状态
public static final int STATION_STATUS_IDLE = 0;
// 到站

View File

@@ -1,20 +1,15 @@
package com.mogo.och.bus.fragment;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.BaseOchFragment;
import com.mogo.och.bus.R;
import com.mogo.och.bus.adapter.OchBusStationAdapter;
import com.mogo.och.bus.bean.OchBusStation;
import com.mogo.och.bus.constant.OchBusConst;
import com.mogo.och.bus.presenter.OchBusPresenter;
import com.mogo.och.view.SlidePanelView;
import com.mogo.service.adas.IMogoAdasOCHCallback;
@@ -39,7 +34,6 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
private View mBus;
// private OchBusStationAdapter adapter;
@Override
protected void initViews() {
@@ -50,10 +44,6 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
mNextStationName = findViewById( R.id.module_och_bus_order_end_station );
mEndStationFlag = findViewById( R.id.module_och_bus_end_station_tag );
// adapter = new OchBusStationAdapter( getContext() );
// rvStationList.setAdapter( adapter );
// rvStationList.setLayoutManager( new LinearLayoutManager( getContext() ) );
if ( DebugConfig.isDebug() ) {
mBus.setOnClickListener( view -> {
TipToast.shortTip( "重置了车站状态" );
@@ -67,6 +57,7 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
}
Logger.d( TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() );
// 初始化的时候设置 UI 按钮状态
switch ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() ) {
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE:
hideAutopilotBiz();
@@ -98,7 +89,9 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
/**
* 根据站点列表信息刷新车站面板,滑块面板
*
* @param stationList 车站列表信息
* @param stationList 车站列表信息
* @param currentStation 当前站点
* @param nextStation 下个站点
*/
public void refreshBusStations( List< OchBusStation > stationList, int currentStation, int nextStation ) {
if ( getActivity() == null ) {
@@ -129,15 +122,21 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
boolean isArriveAtStation = false;
boolean isArriveAtStartStation = false;
// 获取当前站点的名称
currentStationName = stationList.get( currentStation ).getSiteName();
// 是否到达起点
if ( currentStation == 0 ) {
startStationFlagVisibility = View.VISIBLE;
isArriveAtStartStation = true;
mStartStationFlag.setText( "" );
} else if ( currentStation > 0 && currentStation < stationList.size() - 1 ) {
}
// 是否到达站点
else if ( currentStation > 0 && currentStation < stationList.size() - 1 ) {
isArriveAtStation = true;
} else if ( currentStation == stationList.size() - 1 ) {
}
// 是否到达终点
else if ( currentStation == stationList.size() - 1 ) {
isArriveEndStation = true;
nextStationName = "--";
mStartStationFlag.setText( "" );
@@ -145,20 +144,23 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
endStationFlagVisibility = View.INVISIBLE;
}
// 获取下一站点名称
if ( nextStation > currentStation && nextStation <= stationList.size() - 1 ) {
nextStationName = stationList.get( nextStation ).getSiteName();
}
// 是否到达终点
if ( nextStation == stationList.size() - 1 ) {
endStationFlagVisibility = View.VISIBLE;
}
// 重置滑动按钮文字
if ( isArriveEndStation ) {
showSlidePanle( "单程结束" );
} else if ( isArriveAtStartStation ) {
showSlidePanle( "准备出发" );
} else if ( isArriveAtStation ) {
showSlidePanle( "滑动出车" );
} else if ( isArriveAtStation ) {
showSlidePanle( "准备出发" );
}
mCurrentStationName.setText( currentStationName );
@@ -189,9 +191,13 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
@Override
public void moveToEnd() {
// 开启自动驾驶到下一站
mPresenter.autoDriveToNextStation(false);
}
/**
* 设置自动驾驶可用状态
*/
public void onAutopilotEnableChange( boolean isEnable ) {
if ( isEnable ) {
showAutopilotBiz();
@@ -206,11 +212,20 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
mPresenter.onChangeOperationStatus();
}
/**
* 修改经营状态
* @param launch true-收车false-出车
*/
public void changeOperationStatus( boolean launch ) {
isOperationStatus = launch;
if ( launch ) {
tvOperationStatus.setText( "收车" );
showSlidePanle("准备出发");
showPanel();
} else {
tvOperationStatus.setText( "出车" );
hideSlidePanel();
hidPanel();
}
}
}

View File

@@ -11,6 +11,8 @@ import com.mogo.och.bus.bean.OchBusStation;
import com.mogo.och.bus.bean.OchBusStationsChangedMsg;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.List;
@@ -22,6 +24,7 @@ public
* 小巴订单管理
*/
class OchBusOrderModel {
private final String TAG = "OchBusOrderModel";
private static volatile OchBusOrderModel sInstance;
@@ -38,8 +41,14 @@ class OchBusOrderModel {
public void init() {
mContext = AbsMogoApplication.getApp();
MogoApisHandler.getInstance().getApis().getSocketManagerApi( mContext ).registerOnMessageListener( 401021, mOnOrderListener );
MogoApisHandler.getInstance().getApis().getSocketManagerApi( mContext ).registerOnMessageListener( 401020, mOnBusStationsChangedMsg );
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi( mContext )
.registerOnMessageListener( 401021, mOnOrderListener );
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi( mContext )
.registerOnMessageListener( 401020, mOnBusStationsChangedMsg );
}
private Object readResolve() {
@@ -62,6 +71,8 @@ class OchBusOrderModel {
@Override
public void onMsgReceived( OchBusOrder obj ) {
Logger.i(TAG, "401021--小巴订单:" + GsonUtil.jsonFromObject(obj));
if ( obj == null ) {
return;
}
@@ -85,6 +96,8 @@ class OchBusOrderModel {
@Override
public void onMsgReceived( OchBusStationsChangedMsg obj ) {
Logger.i(TAG, "401020--站点信息变更推送:" + GsonUtil.jsonFromObject(obj));
if ( obj == null ) {
return;
}

View File

@@ -101,9 +101,10 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* 查询小巴路线
*/
public void queryBusRoutes() {
Logger.d( TAG, "查询小巴路线");
double lat = 40.1974932972;
double lon = 116.7354579447;
lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
@@ -150,17 +151,21 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* @param site
*/
private void renderBusStationsStatus( List< OchBusStation > site ) {
Logger.d( TAG, "渲染站点信息");
int lastStopStation = getNextStopStation();
stationList.clear();
stationList.addAll( site );
for ( int i = 0; i < stationList.size(); i++ ) {
OchBusStation s = stationList.get( i );
// 是否正在开往下一站
if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING ) {
isGoingToNextStation = true;
mView.hideSlidePanel();
}
// 当前站点信息
if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING
|| s.getIsCurrentSite() == STATION_STATUS_STOPPED ) {
currentStationIndex = i;
@@ -183,6 +188,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* @param lastStopStation
*/
private void resetNextStopStation( int lastStopStation ) {
Logger.d( TAG, "重置下一站");
int nextStopStation = getNextStopStation();
if ( nextStopStation < 0 ) {
return;
@@ -223,7 +230,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
}
/**
* 在踩刹车、控制方向盘等操作后,会停止自动加水,重启自动驾驶的话相当于重新设置自动驾驶目的地
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
*/
public void restartAutopilot() {
Logger.d( TAG, "重启自动驾驶===" + isGoingToNextStation );
@@ -236,6 +243,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* 测试、重置站点状态
*/
public void debugResetStationStatus() {
Logger.d( TAG, "测试、重置站点状态");
OchBusResetRequest request = new OchBusResetRequest( Utils.getSn(), 1 );
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
mService.debugResetStationStatus( requestBody )
@@ -275,6 +284,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* 开启自动驾驶到下一站
*/
public void autoDriveToNextStation( boolean isRestart ) {
Logger.d( TAG, "开启自动驾驶到下一站");
if ( currentStationIndex >= stationList.size() - 1 ) {
// 当前站是最后一站,结束当前行程
travelOver();
@@ -352,6 +363,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* 到站后重置站点状态
*/
private void updateSiteStation() {
Logger.d( TAG, "到站后重置站点状态");
mService.updateSiteStation( new UpdateSiteStatusRequest( stationList.get( currentStationIndex ).getSiteId() ) )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
@@ -383,6 +396,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* 查询到站下车乘客
*/
private void queryLeaveAwayPassengers() {
Logger.d( TAG, "查询到站下车乘客");
mService.queryStationLeaveAwayPassengers( new QueryLeaveAwayPassengersRequest( stationList.get( currentStationIndex ).getSiteId() ) )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
@@ -410,9 +425,11 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
/**
* 播报下车乘客信息
*
* @param o
* @param awayPassengersResponse
*/
private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse o ) {
private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse awayPassengersResponse ) {
Logger.d( TAG, "播报下车乘客信息");
if ( currentStationIndex > stationList.size() - 1 ) {
return;
}
@@ -422,11 +439,11 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
if ( !station.endsWith( "" ) ) {
builder.append( "" );
}
if ( o == null || o.result == null || o.result.info == null || o.result.info.isEmpty() ) {
if ( awayPassengersResponse == null || awayPassengersResponse.result == null || awayPassengersResponse.result.info == null || awayPassengersResponse.result.info.isEmpty() ) {
//
} else {
builder.append( ",请尾号为" );
for ( QueryLeaveAwayPassengersResponse.LeaveAwayPassenger leaveAwayPassenger : o.result.info ) {
for ( QueryLeaveAwayPassengersResponse.LeaveAwayPassenger leaveAwayPassenger : awayPassengersResponse.result.info ) {
if ( leaveAwayPassenger == null ) {
continue;
}
@@ -443,6 +460,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* 行程结束
*/
private void travelOver() {
Logger.d( TAG, "行程结束");
if ( currentStationIndex >= stationList.size() ) {
Logger.e( TAG, "travel over index out of station list" );
return;
@@ -484,13 +503,16 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
Logger.d( TAG, "onStateChange: " + state );
switch ( state ) {
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
// 设置UI【自动驾驶】按钮是否展示
mView.onAutopilotEnableChange( true );
// 改变UI自动驾驶状态
mView.onAutopilotStatusChanged( false );
if ( isGoingToNextStation ) {
mView.hideSlidePanel();
}
break;
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
// 改变UI自动驾驶状态
mView.onAutopilotStatusChanged( true );
break;
default:
@@ -516,6 +538,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* 修改小巴运营状态
*/
public void onChangeOperationStatus() {
Logger.d( TAG, "修改小巴运营状态");
mService.changeOperationStatus( isWorking() ? new OchBusOperationStatusRequest().shutdown() : new OchBusOperationStatusRequest().launch() )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
@@ -552,6 +576,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* 查询运营状态
*/
public void queryOperationStatus() {
Logger.d( TAG, "查询运营状态");
mService.queryOperationStatus( new QueryOchBusOperationStatusRequest() )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
@@ -570,13 +596,13 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.d( TAG, "leave station error: " + message );
Logger.d( TAG, "查询运营状态 error: " + message );
}
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "leave station exception" );
Logger.e( TAG, e, "查询运营状态 exception" );
}
} );
}

View File

@@ -0,0 +1,40 @@
package com.mogo.och.bus.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.mogo.och.bus.constant.OchBusConst;
import com.mogo.utils.logger.Logger;
/**
* 测试小巴车的场景
*
* @author donghongyu
* @date 4/26/21 12:08 PM
*/
public class TestOchBusBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = "TestOchBusBroadcastReceiver";
private Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
try {
this.mContext = context;
int sceneType = intent.getIntExtra(OchBusConst.BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY, 0);
Logger.d(TAG, "sceneType:" + sceneType);
// 分发场景
dispatchSceneTest(sceneType);
} catch (Exception e) {
e.printStackTrace();
}
}
private void dispatchSceneTest(int sceneType) {
}
}

View File

@@ -0,0 +1,184 @@
{
"code": 0,
"msg": "",
"detailMsg": "",
"result": {
"info": [
{
"_id": "cee57b3ae07c4486b0357319368487d7",
"orderNo": "XB20210422000002",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-22 16:31:58",
"orderEndTime": "2021-04-26 10:38:13",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-22 16:31:58",
"updateTime": "2021-04-26 10:38:13",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
},
{
"_id": "ce69b1bcfb9840c6a4563bc6ef947caf",
"orderNo": "XB20210426000000",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-26 10:38:48",
"orderEndTime": "2021-04-26 10:46:16",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-26 10:38:48",
"updateTime": "2021-04-26 10:46:16",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
},
{
"_id": "cae07b56f41c4e0fa60ab3543ffc258e",
"orderNo": "XB20210426000001",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-26 10:47:05",
"orderEndTime": "2021-04-26 10:48:07",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-26 10:47:05",
"updateTime": "2021-04-26 10:48:07",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
},
{
"_id": "62bc84afbc434d01b644c74ee406e772",
"orderNo": "XB20210426000002",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-26 10:48:22",
"orderEndTime": "2021-04-26 10:50:32",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-26 10:48:22",
"updateTime": "2021-04-26 10:50:32",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
},
{
"_id": "fa3214c7a6ec411bb3d6edbc98907423",
"orderNo": "XB20210426000009",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-26 19:26:05",
"orderEndTime": "2021-04-27 14:35:50",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-26 19:26:05",
"updateTime": "2021-04-27 14:35:50",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
}
]
}
}

View File

@@ -0,0 +1,28 @@
{
"_id": "62bc84afbc434d01b644c74ee406e772",
"areaCode": "1001",
"carNum": "京NB010",
"cityCode": "010",
"createTime": "Apr 26, 2021 10:48:22 AM",
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"endStationId": 2,
"orderDispatchType": 1,
"orderNo": "XB20210426000002",
"orderStartTime": "Apr 26, 2021 10:48:22 AM",
"orderType": 10,
"sn": "F803EB2046PZD00149",
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"startStationId": 1,
"travelDistance": 1.2,
"updateTime": "Apr 26, 2021 10:48:23 AM",
"userName": "董QAD",
"userPhone": "15631204018"
}

View File

@@ -0,0 +1,69 @@
{
"code": 0,
"msg": "",
"detailMsg": "",
"result": {
"site": [
{
"lineId": 1.0,
"siteId": 1.0,
"siteName": "万集东门站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.7354579447,
40.1974932972
],
"lon": 116.7354579447,
"lat": 40.1974932972,
"siteDesc": "万集东门站",
"siteState": 1.0,
"isCurrentSite": 1.0,
"siteColor": 1.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 1.0,
"siteId": 2.0,
"siteName": "市政府前街18号",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.729134342,
40.1953113732
],
"lon": 116.729134342,
"lat": 40.1953113732,
"siteDesc": "市政府前街18号",
"siteState": 1.0,
"isCurrentSite": 3.0,
"siteColor": 2.0,
"peoples": "0",
"ifStop": 0.0
},
{
"lineId": 1.0,
"siteId": 3.0,
"siteName": "顺密路口站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.721520973,
40.1940181096
],
"lon": 116.721520973,
"lat": 40.1940181096,
"siteDesc": "顺密路口站",
"siteState": 1.0,
"isCurrentSite": 0.0,
"siteColor": 0.0,
"peoples": "0",
"ifStop": 1.0
}
]
}
}

View File

@@ -0,0 +1,109 @@
{
"code": 0,
"msg": "",
"detailMsg": "",
"result": {
"site": [
{
"lineId": 1.0,
"siteId": 1.0,
"siteName": "万集东门站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.7354579447,
40.1974932972
],
"lon": 116.7354579447,
"lat": 40.1974932972,
"siteDesc": "万集东门站",
"siteState": 1.0,
"isCurrentSite": 0.0,
"siteColor": 0.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 1.0,
"siteId": 1.0,
"siteName": "万集东门站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.7374429112,
40.2023987087
],
"lon": 116.7374429112,
"lat": 40.2023987087,
"siteDesc": "万集东门站",
"siteState": 1.0,
"isCurrentSite": 0.0,
"siteColor": 0.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 1.0,
"siteId": 2.0,
"siteName": "顺密路口站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.721520973,
40.1940181096
],
"lon": 116.721520973,
"lat": 40.1940181096,
"siteDesc": "顺密路口站",
"siteState": 1.0,
"isCurrentSite": 1.0,
"siteColor": 1.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 1.0,
"siteId": 2.0,
"siteName": "顺密路口站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.723146,
40.179637
],
"lon": 116.723146,
"lat": 40.179637,
"siteDesc": "顺密路口站",
"siteState": 1.0,
"isCurrentSite": 1.0,
"siteColor": 1.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 2.0,
"siteId": 2.0,
"siteName": "顺密路口站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.738835502,
40.2023958306
],
"lon": 116.738835502,
"lat": 40.2023958306,
"siteDesc": "顺密路口站",
"siteState": 1.0,
"isCurrentSite": 1.0,
"siteColor": 1.0,
"peoples": "0",
"ifStop": 1.0
}
]
}
}

View File

@@ -430,7 +430,10 @@ class MogoOCHTaxiModel {
@Override
public void onMsgReceived( OCHTaxiOrderResponse obj ) {
Logger.d( TAG, "收到新订单" );
if ( obj == null ) {
return;
}
Logger.d( TAG, "收到新订单" + GsonUtil.jsonFromObject(obj));
mCurrentOCHOrder = obj;
cacheOrderInfo2Native( mCurrentOCHOrder );
Location location = MogoApisHandler.getInstance()
@@ -497,6 +500,7 @@ class MogoOCHTaxiModel {
if ( obj == null ) {
return;
}
Logger.d(TAG, "订单状态被改变:" + GsonUtil.jsonFromObject(obj));
OCHOrderStatus status = OCHOrderStatus.valueOf( obj.orderDispatchType );
switch ( status ) {
case Cancel:

View File

@@ -74,6 +74,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
mEndStationName = findViewById( R.id.module_och_taxi_order_end_station );
mDistance = findViewById( R.id.module_och_taxi_order_distance );
showPanel();
initListeners();
updateOrderStatus();
if ( MogoApisHandler.getInstance()

View File

@@ -2,9 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/module_och_taxi_panel_bkg"
android:layout_width="300px"
android:layout_height="270px"
android:orientation="vertical">
<TextView

View File

@@ -0,0 +1,22 @@
{
"drivingRoutes": [
{
"lat": 40.197234,
"lon": 116.74143,
"siteId": "1.0",
"siteName": "万集东门站"
},
{
"lat": 40.1953113732,
"lon": 116.729134342,
"siteId": "2.0",
"siteName": "市政府前街18号"
}
],
"endStation": "市政府前街18号",
"orderDispatchType": 1,
"orderNo": "CZ20210430000005",
"orderType": 9,
"startStation": "万集东门站",
"travelDistance": 0.6
}

View File

@@ -0,0 +1,39 @@
{
"code": 0,
"msg": "",
"detailMsg": "",
"result": {
"_id": "5352c1d2c9d84ab3ab9ecf1e47e13bdd",
"orderNo": "CZ20210427000016",
"orderType": 9,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 10000,
"startStation": "0409第一站",
"startStationCoordinate": [
116.7389159039,
40.1992312592
],
"endStationId": 21,
"endStation": "第二十一站",
"endStationCoordinate": [
116.737866,
40.19646
],
"orderDispatchType": 1,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "Apr 27, 2021 8:55:44 PM",
"arrivedStartStationTime": "",
"arrivedEndStationTime": "",
"cityCode": "010",
"areaCode": "1001",
"createTime": "Apr 27, 2021 8:55:44 PM",
"updateTime": "Apr 27, 2021 8:55:56 PM",
"personNum": 1,
"travelDistance": 0.3,
"vehicleColour": "黑色",
"lastBrandName": "",
"headImgUrl": "https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83ep4YkeZqjiazTK87NQtYp6KMYvAdJcxNpxyJ2gibeNNheH1HFaJdX4hB15eIR3zZdGMWNanKzIn460w/132"
}
}

View File

@@ -0,0 +1,10 @@
{
"endStation": "市政府前街18号",
"endStationId": "2.0",
"orderDispatchType": 7,
"orderNo": "CZ20210430000005",
"orderType": 9,
"startStation": "万集东门站",
"startStationId": "1.0",
"travelDistance": 0.6
}

View File

@@ -6,19 +6,17 @@ import android.widget.CheckedTextView;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.Group;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.och.view.FrameAnimImageView;
import com.mogo.och.view.SlidePanelView;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
/**
* 网约车基础Fragment主要负责布局通用界面处理站点面板和通话面板互斥情况
@@ -34,9 +32,14 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
protected SlidePanelView slidePanelView;
private CheckedTextView ctvAutopilotStatus;
protected TextView tvOperationStatus;
public boolean isOperationStatus;//false-收车true-出车
private FrameLayout flStationPanelContainer;
private Group groupTestPanel;
/**
* 滑动按钮触发的事件
*/
private final SlidePanelView.OnSlidePanelMoveToEndListener onSlideToEndListener = () -> {
// 此处做一个代理,处理一下共有情况
if (getSlidePanelOnEndListener() != null) {
@@ -48,14 +51,17 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
protected int getLayoutId() {
return R.layout.module_mogo_och_base_fragment;
}
private View panelView;
@Override
protected void initViews() {
groupTestPanel = findViewById(R.id.groupTestPanel);
slidePanelView = findViewById(R.id.module_mogo_och_slide_panel);
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
tvOperationStatus = findViewById( R.id.module_mogo_och_operation_status );
tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status);
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
@@ -68,46 +74,74 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
}
});
// debug下调用测试面板
if (DebugConfig.isDebug()) {
ctvAutopilotStatus.setOnLongClickListener(v -> {
if (groupTestPanel.getVisibility() == View.VISIBLE) {
groupTestPanel.setVisibility(View.GONE);
} else {
groupTestPanel.setVisibility(View.VISIBLE);
}
return false;
});
}
onAutopilotStatusChanged(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING);
checkCallView(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isCallViewShow());
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("Och", StatusDescriptor.CALL_VIEW, callViewListener);
// 模拟 不可自动驾驶目前场景是刚开机adas还未和工控机连接
findViewById(R.id.btnAutopilotDisable).setOnClickListener(view ->
MogoApisHandler.getInstance().getApis()
.getAdasControllerApi()
.mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE, "不能使用")
);
findViewById(R.id.btnAutopilotDisable).setOnClickListener(view -> MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE, "不能使用"));
// 模拟 可自动驾驶,工控机连接正常,且处于人工干预状态
findViewById(R.id.btnAutopilotEnable).setOnClickListener(view ->
MogoApisHandler.getInstance().getApis()
.getAdasControllerApi()
.mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE, "能使用")
);
findViewById(R.id.btnAutopilotEnable).setOnClickListener(view -> MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE, "能使用"));
// 模拟 自动驾驶能力,自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
findViewById(R.id.btnAutopilotRunning).setOnClickListener(view ->
MogoApisHandler.getInstance().getApis()
.getAdasControllerApi()
.mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING, "Running")
);
findViewById(R.id.btnAutopilotRunning).setOnClickListener(view -> MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING, "Running"));
// 模拟 自动驾驶网约车回调数据
findViewById(R.id.btnAutopilotArrive).setOnClickListener(view ->
MogoApisHandler.getInstance().getApis()
.getAdasControllerApi().mockOchStatus(-1, "Arrived")
);
findViewById(R.id.btnAutopilotArrive).setOnClickListener(view -> MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockOchStatus(-1, "Running"));
tvOperationStatus.setOnClickListener( view -> {
tvOperationStatus.setOnClickListener(view -> {
onChangeOperationStatus();
} );
}
protected void onChangeOperationStatus(){
}
private void checkCallView(boolean isShown) {
if (flStationPanelContainer == null) {
return;
}
if (isShown) {
flStationPanelContainer.setTranslationY(131f);
} else {
flStationPanelContainer.setTranslationY(0f);
}
}
public void showSlidePanle(String text) {
getActivity().runOnUiThread(() -> {
slidePanelView.setText(text);
slidePanelView.setVisibility(View.VISIBLE);
});
}
protected void onChangeOperationStatus() {
}
/**
* 展示滑动按钮
*
* @param text 指定的文字
*/
public void showSlidePanle(String text) {
if (isOperationStatus) {
getActivity().runOnUiThread(() -> {
slidePanelView.setText(text);
slidePanelView.setVisibility(View.VISIBLE);
});
}
}
/**
* 隐藏滑动按钮
*/
public void hideSlidePanel() {
getActivity().runOnUiThread(() -> {
slidePanelView.setVisibility(View.GONE);
@@ -131,6 +165,9 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
});
}
/**
* 隐藏【自动驾驶】按钮
*/
public void hideAutopilotBiz() {
getActivity().runOnUiThread(() -> {
// ctvAutopilotStatus.setVisibility(View.GONE);
@@ -138,6 +175,9 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
});
}
/**
* 展示【自动驾驶】按钮
*/
public void showAutopilotBiz() {
getActivity().runOnUiThread(() -> {
ctvAutopilotStatus.setVisibility(View.VISIBLE);
@@ -145,7 +185,19 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
});
}
public View getPanelView(){
public void hidPanel(){
getActivity().runOnUiThread(()->{
flStationPanelContainer.setVisibility(View.GONE);
});
}
public void showPanel(){
getActivity().runOnUiThread(()->{
flStationPanelContainer.setVisibility(View.VISIBLE);
});
}
public View getPanelView() {
return panelView;
}
@@ -153,16 +205,9 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
return null;
}
private final IMogoStatusChangedListener callViewListener = (descriptor, isTrue) -> {
if (descriptor == StatusDescriptor.CALL_VIEW) {
checkCallView(isTrue);
}
};
@Override
public void onDestroyView() {
super.onDestroyView();
MogoApisHandler.getInstance().getApis().getStatusManagerApi().unregisterStatusChangedListener("Och", StatusDescriptor.CALL_VIEW, callViewListener);
}
/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -3,8 +3,8 @@
android:shape="rectangle">
<corners android:radius="@dimen/module_mogo_och_autopilot_status_bg_corner" />
<gradient
android:startColor="#FF405591"
android:endColor="#FF28376B"
android:startColor="#323C6F"
android:endColor="#323C6F"
android:angle="315"/>
</shape>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:radius="17px" />
<solid android:color="#3B4577"/>
</shape>
</item>
<item
android:bottom="3px"
android:left="3px"
android:right="3px"
android:top="3px">
<shape>
<corners android:radius="17px" />
<solid android:color="#3B4577"/>
</shape>
</item>
</layer-list>

View File

@@ -4,16 +4,17 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="@dimen/module_mogo_och_margin_left"
android:paddingBottom="@dimen/module_mogo_och_margin_bottom">
<CheckedTextView
android:id="@+id/module_mogo_och_autopilot_status"
android:layout_width="@dimen/module_mogo_och_autopilot_status_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:layout_marginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
android:background="@drawable/module_mogo_och_autopilot_status_bg"
android:drawableLeft="@drawable/module_och_bus_ic_autopilot"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:paddingLeft="35px"
android:text="自动驾驶"
@@ -30,9 +31,13 @@
android:layout_width="300px"
android:layout_height="270px"
android:layout_marginTop="16px"
android:background="@drawable/module_och_panel_bkg"
android:elevation="@dimen/dp_10"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@+id/module_mogo_och_autopilot_status"
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status"
app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call" />
app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
tools:visibility="visible" />
<CheckedTextView
android:id="@+id/module_mogo_och_operation_status"
@@ -40,13 +45,14 @@
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:background="@drawable/module_mogo_och_operation_status_bg"
android:gravity="center"
android:elevation="@dimen/dp_10"
android:text="开启"
android:textAlignment="center"
android:textColor="@color/module_mogo_och_autopilot_text_color_selector"
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
app:layout_constraintLeft_toLeftOf="@+id/module_mogo_och_autopilot_status" />
<com.mogo.och.view.SlidePanelView
android:id="@+id/module_mogo_och_slide_panel"
@@ -64,7 +70,6 @@
android:background="#f00"
android:text="Disable"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -75,8 +80,7 @@
android:background="#0f0"
android:text="Enable"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotDisable" />
<Button
@@ -86,8 +90,7 @@
android:background="#00f"
android:text="Running"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotEnable" />
<Button
@@ -97,14 +100,15 @@
android:background="#f00"
android:text="Arrived"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
<androidx.constraintlayout.widget.Group
android:id="@+id/groupTestPanel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable,btnAutopilotRunning" />
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable,btnAutopilotRunning"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -621,7 +621,6 @@ dependencies {
apply from: "./functions/perform.gradle"
// apply from: "./functions/baseservices.gradle"
apply from: "./functions/socketpush.gradle"
// apply from: "./functions/gpssimulator.gradle"
apply from: "./functions/leftpanel.gradle"
apply from: "./functions/skin.gradle"
apply from: "./functions/crashreport.gradle"

View File

@@ -1,11 +0,0 @@
// 基于后台轨迹模拟的gps模拟服务
project.dependencies {
if (Boolean.valueOf(RELEASE)) {
debugImplementation rootProject.ext.dependencies.gpssimulatornoop
releaseImplementation rootProject.ext.dependencies.gpssimulatornoop
} else {
debugImplementation project(':modules:mogo-module-gps-simulator-noop')
releaseImplementation project(':modules:mogo-module-gps-simulator-noop')
}
}

View File

@@ -158,7 +158,7 @@ ext {
gpssimulatordebug : "com.mogo.module:module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
adasapi : "com.zhidao.autopilot.support:adas:1.0.6.14",
adasapi : "com.zhidao.autopilot.support:adas:1.0.6.15",
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.1.5.2",
// 个人中心的SDK

View File

@@ -42,6 +42,8 @@ dependencies {
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.accountsdk
api rootProject.ext.dependencies.mogoaicloudrealtime
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogoutils
api rootProject.ext.dependencies.ttsbase

View File

@@ -1,7 +1,5 @@
package com.mogo.commons.debug;
import android.text.TextUtils;
/**
* @author congtaowang
* @since 2019-12-23
@@ -28,7 +26,7 @@ public class DebugConfig {
*
* @param sDebug true - 调试模式 false - 非调试模式
*/
public static void setDebug( boolean sDebug ) {
public static void setDebug(boolean sDebug) {
DebugConfig.sDebug = sDebug;
}
@@ -69,7 +67,7 @@ public class DebugConfig {
*/
public static final int AI_TYPE_SPEECH = 2;
private static int sAIType = AI_TYPE_TXZ;
private static final int sAIType = AI_TYPE_TXZ;
/**
* 自研车机
@@ -116,7 +114,7 @@ public class DebugConfig {
* {@link #NET_MODE_DEMO}
* {@link #NET_MODE_RELEASE}
*/
public static void setNetMode( int netMode ) {
public static void setNetMode(int netMode) {
DebugConfig.sNetMode = netMode;
}
@@ -129,7 +127,7 @@ public class DebugConfig {
return sLaunchLocationService;
}
public static void setLaunchLocationService( boolean launchLocationService ) {
public static void setLaunchLocationService(boolean launchLocationService) {
DebugConfig.sLaunchLocationService = launchLocationService;
}
@@ -142,7 +140,7 @@ public class DebugConfig {
return sUseCustomNavi;
}
public static void setUseCustomNavi( boolean sUseCustomNavi ) {
public static void setUseCustomNavi(boolean sUseCustomNavi) {
DebugConfig.sUseCustomNavi = sUseCustomNavi;
}
@@ -151,7 +149,7 @@ public class DebugConfig {
*
* @param type {@link #CAR_MACHINE_TYPE_SELF_INNOVATE} {@link #CAR_MACHINE_TYPE_BYD}
*/
public static void setCarMachineType( int type ) {
public static void setCarMachineType(int type) {
sCarMachineType = type;
}
@@ -173,7 +171,7 @@ public class DebugConfig {
return sIsLauncher;
}
public static void setLauncher( boolean isLauncher ) {
public static void setLauncher(boolean isLauncher) {
DebugConfig.sIsLauncher = isLauncher;
}
@@ -183,7 +181,7 @@ public class DebugConfig {
return sRequestOnlineCarData;
}
public static void setRequestOnlineCarData( boolean sRequestOnlineCarData ) {
public static void setRequestOnlineCarData(boolean sRequestOnlineCarData) {
DebugConfig.sRequestOnlineCarData = sRequestOnlineCarData;
}
@@ -193,7 +191,7 @@ public class DebugConfig {
return sUseCustomMap;
}
public static void setUseCustomMap( boolean sUseCustomMap ) {
public static void setUseCustomMap(boolean sUseCustomMap) {
DebugConfig.sUseCustomMap = sUseCustomMap;
}
@@ -206,13 +204,13 @@ public class DebugConfig {
return sActiveAIAssistFlag;
}
public static void setActiveAIAssistFlag( boolean sActiveAIAssistFlag ) {
public static void setActiveAIAssistFlag(boolean sActiveAIAssistFlag) {
DebugConfig.sActiveAIAssistFlag = sActiveAIAssistFlag;
}
private static boolean useMockObuData;
public static void setUseMockObuData( boolean use ) {
public static void setUseMockObuData(boolean use) {
useMockObuData = use;
}
@@ -231,13 +229,13 @@ public class DebugConfig {
*
* @param sProductFlavor
*/
public static void setProductFlavor( String sProductFlavor ) {
public static void setProductFlavor(String sProductFlavor) {
DebugConfig.sProductFlavor = sProductFlavor;
}
private static String sSocketAppId;
public static void setSocketAppId( String sSocketAppId ) {
public static void setSocketAppId(String sSocketAppId) {
DebugConfig.sSocketAppId = sSocketAppId;
}
@@ -254,14 +252,14 @@ public class DebugConfig {
return sRoadEventAnimated;
}
public static void setRoadEventAnimated( boolean sRoadEventAnimated ) {
public static void setRoadEventAnimated(boolean sRoadEventAnimated) {
DebugConfig.sRoadEventAnimated = sRoadEventAnimated;
}
private static boolean sLoadGuideModule = false;
public static void setLoadGuideModule( boolean sLoadGuideModule ) {
public static void setLoadGuideModule(boolean sLoadGuideModule) {
DebugConfig.sLoadGuideModule = sLoadGuideModule;
}
@@ -277,7 +275,7 @@ public class DebugConfig {
private static boolean isSkinSupported = false;
public static void setSkinSupported( boolean isSkinSupported ) {
public static void setSkinSupported(boolean isSkinSupported) {
DebugConfig.isSkinSupported = isSkinSupported;
}
@@ -290,7 +288,7 @@ public class DebugConfig {
*/
private static boolean isSupportedSearchDestinationOnlineCarList = false;
public static void setSupportedSearchDestinationOnlineCarList( boolean isSupportedSearchDestinationOnlineCarList ) {
public static void setSupportedSearchDestinationOnlineCarList(boolean isSupportedSearchDestinationOnlineCarList) {
DebugConfig.isSupportedSearchDestinationOnlineCarList = isSupportedSearchDestinationOnlineCarList;
}
@@ -303,7 +301,7 @@ public class DebugConfig {
*/
private static boolean isScheduleCalculateNotHomeCompanyDistanceForPush = false;
public static void setScheduleCalculateNotHomeCompanyDistanceForPush( boolean isScheduleCalculateNotHomeCompanyDistanceForPush ) {
public static void setScheduleCalculateNotHomeCompanyDistanceForPush(boolean isScheduleCalculateNotHomeCompanyDistanceForPush) {
DebugConfig.isScheduleCalculateNotHomeCompanyDistanceForPush = isScheduleCalculateNotHomeCompanyDistanceForPush;
}
@@ -316,7 +314,7 @@ public class DebugConfig {
*/
private static boolean isSupportLauncherCardRefreshStrategy = false;
public static void setSupportLauncherCardRefreshStrategy( boolean isSupportLauncherCardRefreshStrategy ) {
public static void setSupportLauncherCardRefreshStrategy(boolean isSupportLauncherCardRefreshStrategy) {
DebugConfig.isSupportLauncherCardRefreshStrategy = isSupportLauncherCardRefreshStrategy;
}
@@ -330,7 +328,7 @@ public class DebugConfig {
return obuType;
}
public static void setObuType( int type ) {
public static void setObuType(int type) {
obuType = type;
}
@@ -339,7 +337,7 @@ public class DebugConfig {
*/
private static boolean needRequestUserInfo = false;
public static void setNeedRequestUserInfo( boolean needRequestUserInfo ) {
public static void setNeedRequestUserInfo(boolean needRequestUserInfo) {
DebugConfig.needRequestUserInfo = needRequestUserInfo;
}
@@ -356,13 +354,13 @@ public class DebugConfig {
return isMapBased;
}
public static void setMapBased( boolean isMapBased ) {
public static void setMapBased(boolean isMapBased) {
DebugConfig.isMapBased = isMapBased;
}
private static boolean isNeedLoadGuideModule = true;
public static void setNeedLoadGuideModule( boolean isNeedLoadGuideModule ) {
public static void setNeedLoadGuideModule(boolean isNeedLoadGuideModule) {
DebugConfig.isNeedLoadGuideModule = isNeedLoadGuideModule;
}
@@ -376,7 +374,7 @@ public class DebugConfig {
return isNeedHideAdasWhenShare;
}
public static void setNeedHideAdasWhenShare( boolean isNeedHideAdas ) {
public static void setNeedHideAdasWhenShare(boolean isNeedHideAdas) {
DebugConfig.isNeedHideAdasWhenShare = isNeedHideAdas;
}
@@ -389,7 +387,7 @@ public class DebugConfig {
return sIsNeedUploadCoordinatesInTime;
}
public static void setNeedUploadCoordinatesInTime( boolean sIsNeedUploadCoordinatesInTime ) {
public static void setNeedUploadCoordinatesInTime(boolean sIsNeedUploadCoordinatesInTime) {
DebugConfig.sIsNeedUploadCoordinatesInTime = sIsNeedUploadCoordinatesInTime;
}
@@ -402,7 +400,7 @@ public class DebugConfig {
return sIsUseAdasRtkLocationInfo;
}
public static void setUseAdasRtkLocationInfo( boolean sIsUseAdasRtkLocationInfo ) {
public static void setUseAdasRtkLocationInfo(boolean sIsUseAdasRtkLocationInfo) {
DebugConfig.sIsUseAdasRtkLocationInfo = sIsUseAdasRtkLocationInfo;
}
@@ -412,17 +410,17 @@ public class DebugConfig {
return sIsNotSmooth;
}
public static void setNotSmooth( boolean sIsNotSmooth ) {
public static void setNotSmooth(boolean sIsNotSmooth) {
DebugConfig.sIsNotSmooth = sIsNotSmooth;
}
public static boolean isOCHModule() {
return sProductFlavor != null && sProductFlavor.startsWith( "foch" );
return sProductFlavor != null && sProductFlavor.startsWith("foch");
}
public static int sSelfCarSpeedYOffset = 20;
public static void setSelfCarSpeedYOffset( int sSelfCarSpeedYOffset ) {
public static void setSelfCarSpeedYOffset(int sSelfCarSpeedYOffset) {
DebugConfig.sSelfCarSpeedYOffset = sSelfCarSpeedYOffset;
}
@@ -436,20 +434,28 @@ public class DebugConfig {
public static final int sDownloadSnapshot = 2;
public static final int sAutoPilotStatus = 3;
public static final int sDownloadLink = 4;
public static final int sLon = 5;
public static final int sLat = 6;
public static String[] sStatus = new String[]{
"false",
"false",
"false",
"0",
"false"
"false",
"0",
"0"
};
public synchronized static void setStatus( int type, boolean status ) {
sStatus[type] = String.valueOf( status );
public synchronized static void setStatus(int type, boolean status) {
sStatus[type] = String.valueOf(status);
}
public synchronized static void setAutoPilotStatus( String status ) {
public synchronized static void setStatusData(int type, double data) {
sStatus[type] = String.valueOf(data);
}
public synchronized static void setAutoPilotStatus(String status) {
sStatus[sAutoPilotStatus] = status;
}
@@ -457,21 +463,29 @@ public class DebugConfig {
return sStatus[sAutoPilotStatus];
}
public synchronized static String getStatus( int type, boolean set2False ) {
public synchronized static String getStatus(int type, boolean set2False) {
String result = sStatus[type];
if ( set2False ) {
if (set2False) {
sStatus[type] = "false";
}
return result;
}
public synchronized static String getStatusData(int type){
if(type > 4){
return sStatus[type].toString();
}else{
return "0";
}
}
private static boolean isUseAdasRecognize = true;
public static void setUseAdasRecognize(boolean status) {
isUseAdasRecognize = status;
}
public static boolean isUseAdasRecognize(){
public static boolean isUseAdasRecognize() {
return isUseAdasRecognize;
}
}

View File

@@ -83,4 +83,37 @@ public class ColorUtils {
return gradientColorArr;
}
/**
* 获取一组渐变色数组
*
* @param startColor 开始颜色
* @param endColor 结束颜色
* @param step 步长
* @return 生成的梯度颜色集合
*/
public static List<Integer> getGradientAlpha(String startColor, String centerColor, String endColor, int step) {
// 将HEX转为RGB
int[] sColor = hexToArgb(startColor);
int[] cColor = hexToArgb(centerColor);
int[] eColor = hexToArgb(endColor);
// 生成渐变色
List<Integer> gradientColorArr = new ArrayList<>();
if (step >= 3) {
// 开始颜色
gradientColorArr.add(Color.argb(sColor[0], sColor[1], sColor[2], sColor[3]));
// 中间颜色
for (int i = 0; i < (step - 2); i++) {
gradientColorArr.add(Color.argb(cColor[0], cColor[1], cColor[2], cColor[3]));
}
//结束颜色
gradientColorArr.add(Color.argb(eColor[0], eColor[1], eColor[2], eColor[3]));
} else {
gradientColorArr.add(Color.argb(cColor[0], cColor[1], cColor[2], cColor[3]));
}
return gradientColorArr;
}
}

View File

@@ -156,21 +156,21 @@ LOGLIB_VERSION = 1.0.4
######## MogoAiCloudSDK Version
# 网络请求
MOGO_NETWORK_VERSION=1.0.71
MOGO_NETWORK_VERSION=1.0.84
# 鉴权
MOGO_PASSPORT_VERSION=1.0.71
MOGO_PASSPORT_VERSION=1.0.84
# 常链接
MOGO_SOCKET_VERSION=1.0.71
MOGO_SOCKET_VERSION=1.0.84
# 数据采集
MOGO_REALTIME_VERSION=1.0.71
MOGO_REALTIME_VERSION=1.0.84
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.0.71
MOGO_TANLU_VERSION=1.0.84
# 直播推流
MOGO_LIVE_VERSION=1.0.71
MOGO_LIVE_VERSION=1.0.84
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.0.71
#ADAS HIGHT
MOGO_ADASHIGH_VERSION = '1.1.3'
MOGO_TRAFFICLIVE_VERSION=1.0.84
######## Foundation MogoAiCloud Module
# mogoAiCloud apk services
@@ -184,4 +184,4 @@ MOGO_AICLOUD_SERVICES_SDK_VERSION=1.0.0-SNAPSHOT
applicationId=com.mogo.launcer
applicationName=IntelligentPilot
versionCode=80007
versionName=8.0.7
versionName=8.0.7

View File

@@ -50,6 +50,8 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.utils.WindowUtils;
import com.mogo.utils.logger.Logger;
@@ -478,6 +480,16 @@ public class AMapNaviViewWrapper implements IMogoMapView,
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode) {
}
@Override
public VisualAngleMode getCurrentMapVisualAngle() {
return null;
}
private void setUIMode( EnumMapUI ui, AMapNaviViewOptions options ) {
this.mCurrentUIMode = ui;
switch ( ui ) {
@@ -1037,4 +1049,14 @@ public class AMapNaviViewWrapper implements IMogoMapView,
mMapView.getMap().moveCamera( CameraUpdateFactory.changeBearing( bearing ) );
}
}
@Override
public long getTileId(double lon, double lat) {
return getMap().getUIController().getTileId(lon,lat);
}
@Override
public void setAdasRecognizedResult(ADASRecognizedResult result) {
}
}

View File

@@ -8,7 +8,6 @@ import android.location.Location;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.Trace;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Interpolator;
@@ -28,7 +27,6 @@ import com.amap.api.maps.model.Polyline;
import com.amap.api.maps.model.animation.Animation;
import com.amap.api.maps.model.animation.TranslateAnimation;
import com.amap.api.navi.model.NaviInfo;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoMapView;
import com.mogo.map.MogoLatLng;
@@ -47,6 +45,8 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.utils.NetworkUtils;
import com.mogo.utils.WindowUtils;
import com.mogo.utils.logger.Logger;
@@ -383,6 +383,16 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode) {
}
@Override
public VisualAngleMode getCurrentMapVisualAngle() {
return null;
}
private boolean checkMapView() {
if ( mMapView == null || mMapView.getMap() == null ) {
Logger.e( TAG, "高德mapView实例为空请检查" );
@@ -810,4 +820,14 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMap().moveCamera( CameraUpdateFactory.changeBearing( bearing ) );
}
}
@Override
public long getTileId(double lon, double lat) {
return getMap().getUIController().getTileId(lon,lat);
}
@Override
public void setAdasRecognizedResult(ADASRecognizedResult result) {
}
}

View File

@@ -267,6 +267,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
}
}
@Override
public String getMarkerAssInfo() {
return null;
}
@Override
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
mMogoMarkerClickListener = listener;

View File

@@ -7,13 +7,14 @@ import android.view.View;
import android.view.animation.Interpolator;
import com.mogo.map.MogoLatLng;
import com.mogo.map.MogoMap;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.utils.logger.Logger;
import java.util.List;
@@ -91,6 +92,16 @@ public class AMapUIController implements IMogoMapUIController {
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode) {
}
@Override
public VisualAngleMode getCurrentMapVisualAngle() {
return null;
}
@Override
public void moveToCenter(MogoLatLng latLng, boolean animate) {
if (mClient != null) {
@@ -298,4 +309,16 @@ public class AMapUIController implements IMogoMapUIController {
mClient.changeBearing( bearing );
}
}
@Override
public void setAdasRecognizedResult(ADASRecognizedResult result) {
if ( mClient != null ) {
mClient.setAdasRecognizedResult(result);
}
}
@Override
public long getTileId(double lon, double lat) {
return 0;
}
}

View File

@@ -67,7 +67,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.8'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.21'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
}

View File

@@ -0,0 +1,14 @@
group:com.zhidaoauto.machine:map:1.0.0-vr-
version note:
8.5.15
增加限速接口:
MapDataApi.getLimitSpeed(lon: Double,lat: Double,angle: Float)
8.5.16
增加远中近视角切换接口:
mapAutoView.getMapAutoViewHelper()?.setMapViewVisualAngle(type
type 0=近景 1=中景 2=远景
视角切换监听事件
mapAutoView.setOnMapViewVisualAngleChangeListener

View File

@@ -1,16 +1,18 @@
package com.mogo.map.impl.custom;
import android.util.Log;
import com.mogo.map.impl.custom.marker.AMapMarkerWrapper;
import com.mogo.map.impl.custom.marker.MarkerWrapperClickHelper;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.marker.MogoMarkersHandler;
import com.mogo.utils.logger.Logger;
import com.zhidaoauto.map.sdk.open.marker.Marker;
import java.util.Map;
import static com.mogo.map.marker.MarkerType.MAP_STATIC;
/**
* @author congtaowang
* @since 2019-12-24
@@ -25,9 +27,9 @@ public class AMapMarkerClickHandler {
}
public static AMapMarkerClickHandler getInstance() {
if ( sInstance == null ) {
synchronized ( AMapMarkerClickHandler.class ) {
if ( sInstance == null ) {
if (sInstance == null) {
synchronized (AMapMarkerClickHandler.class) {
if (sInstance == null) {
sInstance = new AMapMarkerClickHandler();
}
}
@@ -44,23 +46,32 @@ public class AMapMarkerClickHandler {
return sInstance;
}
public boolean handleMarkerClicked( Marker marker ) {
if ( marker == null ) {
public boolean handleMarkerClicked(Marker marker) {
if (marker == null) {
return false;
}
Map< String, IMogoMarker > mogoMarkerMap = MarkerWrapperClickHelper.getInstance().getMogoMarkerMap();
if ( mogoMarkerMap.containsKey( marker.getId() ) ) {
IMogoMarker mogoMarker = mogoMarkerMap.get( marker.getId() );
//地图道路上静态数暂时只过滤traffic类型下发点击事件
if (MarkerWrapperClickHelper.getInstance().isStaticMarker(marker.getId())){
IMogoMarker iMogoMarker = new AMapMarkerWrapper(marker,new MogoMarkerOptions());
iMogoMarker.setOwner(MAP_STATIC); //TODO 后续可能由于类型比较多需要owner匹配机制,以及控制owner细粒度
Logger.d("AMapMarkerWrapper", "traffic marker 点击回调");
return MogoMarkersHandler.getInstance().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();
Logger.d( "AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker );
if ( listener != null ) {
boolean result = listener.onMarkerClicked( mogoMarker );
if ( result ) {
Logger.d("AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker);
if (listener != null) {
boolean result = listener.onMarkerClicked(mogoMarker);
if (result) {
return true;
}
}
return MogoMarkersHandler.getInstance().onMarkerClicked( mogoMarker );
return MogoMarkersHandler.getInstance().onMarkerClicked(mogoMarker);
}
return false;
}
}

View File

@@ -9,7 +9,6 @@ import android.location.Location;
import android.os.Bundle;
import android.os.Trace;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@@ -17,8 +16,8 @@ import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.TextView;
import com.autonavi.nge.map.LonLat;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoMapView;
import com.mogo.map.MogoLatLng;
@@ -35,10 +34,11 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener;
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener;
@@ -46,6 +46,7 @@ import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapTouchListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapViewVisualAngleChangeListener;
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
@@ -57,7 +58,6 @@ import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
import com.zhidaoauto.map.sdk.open.marker.Marker;
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
import com.zhidaoauto.map.sdk.open.tools.MapTools;
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
@@ -67,12 +67,14 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import static com.mogo.map.uicontroller.VisualAngleMode.MODE_CLOSE_SIGHT;
import static com.mogo.map.uicontroller.VisualAngleMode.MODE_LONG_SIGHT;
import static com.mogo.map.uicontroller.VisualAngleMode.MODE_MEDIUM_SIGHT;
public class AMapViewWrapper implements IMogoMapView,
IMogoMapUIController,
LocationListener,
@@ -83,28 +85,26 @@ public class AMapViewWrapper implements IMogoMapView,
OnMapTouchListener,
OnMarkClickListener,
OnMapStyleListener,
MapStyleController.IMapStyleAutoChangedListener {
MapStyleController.IMapStyleAutoChangedListener, OnMapViewVisualAngleChangeListener {
private static final String TAG = "AMapViewWrapper";
private final MapAutoView mMapView;
private IMogoMap mIMap;
private final IMogoMap mIMap;
private AMapMarkerClickHandler mMarkerClickHandler;
private EnumMapUI mCurrentCarUIMode;
private boolean mIsCarLocked = false;
private int mLockZoom = 16;
private long startTime;
private float mDefaultZoomLevel = 16.0f;
private final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
.carCursorRes(R.drawable.map_api_ic_current_location2)
.naviCursorRes(R.drawable.ic_amap_navi_cursor)
.build();
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
private Location mLastDriveLocationShadow = null;
private EnumMapUI mCurrentCarUIMode;
private EnumMapUI mCurrentUI;
private VisualAngleMode mVisualAngleMode = MODE_MEDIUM_SIGHT;
private int mLockZoom = 16;
private long startTime;
private float mDefaultZoomLevel = 16.0f;
private boolean mIsCarLocked = false;
private boolean mIsLightStyle = false;
private boolean mMapLoaded = false;
private boolean mIsFirstLocated = true;
@@ -207,8 +207,9 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_ZOOM);
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_ROTATE);
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_3D);
mMapView.setMOnCameraChangeListener(this);
mMapView.setOnCameraChangeListener(this);
mMapView.setOnMapStyleListener(this);
mMapView.setOnMapViewVisualAngleChangeListener(this);
Logger.d(TAG, "styleop - initListeners - setOnMapStyleListener - view %s", mMapView);
// mMapView.setOnPolylineClickListener( this );
@@ -271,7 +272,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnMapTouchListener(null);
mMapView.setOnMapClickListener(null);
mMapView.getLocationClient().unRegisterListener(this);
mMapView.setMOnCameraChangeListener(null);
mMapView.setOnCameraChangeListener(null);
mSelfMarker = null;
Logger.d(TAG, "map onDestroy");
}
@@ -374,6 +375,21 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode) {
MapAutoViewHelper mapAutoViewHelper = mMapView.getMapAutoViewHelper();
if (mapAutoViewHelper != null) {
Logger.d(TAG," 用户更改视距 currentThread : " + Thread.currentThread().getName());
mVisualAngleMode = angelMode;
mapAutoViewHelper.setMapViewVisualAngle(angelMode.getCode());
}
}
@Override
public VisualAngleMode getCurrentMapVisualAngle() {
return mVisualAngleMode;
}
@Override
public void moveToCenter(MogoLatLng latLng) {
moveToCenter(latLng, true);
@@ -706,8 +722,6 @@ public class AMapViewWrapper implements IMogoMapView,
} else {
if (mCarCursorOption.getCarCursorRes() != 0) {
style.myLocationIcon(mCarCursorOption.getCarCursorRes());
} else {
style.myLocationIcon(mCarCursorOption.getCarCursorRes());
}
}
mMapView.getMapAutoViewHelper().setMyLocationStyle(style);
@@ -729,6 +743,13 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
@Override
public long getTileId(double lon, double lat) {
return getMap().getUIController().getTileId(lon, lat);
}
private boolean isShowWarn;
@Override
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
Location sysLocation = new Location(location.getProvider());
@@ -764,12 +785,47 @@ public class AMapViewWrapper implements IMogoMapView,
try {
mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker();
mSelfMarker.setInfoWindowEnable(true);
} catch (Exception e) {
}
} else {
// 通过不同的方向类型来改变车模目前暂定三种模型drawlevel 1 绿,2 黄,3 红,绿色的时候需要把相应的切换为默认模型
// if (mAdasResult != null) {
// Logger.d("liyz", " mAdasResult.drawlevel = " + mAdasResult.drawlevel);
// if (mAdasResult.drawlevel == 1 && isShowWarn) {
// mSelfMarker.marker3DIcon(R.raw.car);
// isShowWarn = false;
// } else if (mAdasResult.drawlevel == 2) { //不处理
//
// } else if (mAdasResult.drawlevel == 3 && !isShowWarn) {
// //继续判断相应的方位,目前是只有 前方 TODO
// mSelfMarker.marker3DIcon(R.raw.qfpz);
// isShowWarn = true;
// }
// } else {
//// mSelfMarker.marker3DIcon(R.raw.car);
// }
// UiThreadHandler.postDelayed( () -> {
// if (!isShowWarn) {
// mSelfMarker.marker3DIcon(R.raw.qfpz);
// isShowWarn = true;
// }
// }, 6_000L );
}
showSelfSpeed(location.getSpeed());
}
private ADASRecognizedResult mAdasResult;
@Override
public void setAdasRecognizedResult(ADASRecognizedResult result) {
mAdasResult = result;
}
private TextView mSpeedView = null;
private int mLastYOffset = 20;
@@ -796,13 +852,13 @@ public class AMapViewWrapper implements IMogoMapView,
String speedVal = String.valueOf(speedIntVal);
String infoResName = ResIdCache.getVal(speedVal);
int offset = 20;
if ( !mMapView.getMapAutoViewHelper().getLockMode() ) {
if (!mMapView.getMapAutoViewHelper().getLockMode()) {
offset = 30;
}
if ( offset != mLastYOffset ) {
if (offset != mLastYOffset) {
mLastYOffset = offset;
}
mSelfMarker.setInfoWindowOffset( 0, offset );
mSelfMarker.setInfoWindowOffset(0, offset);
if (TextUtils.isEmpty(infoResName)) {
if (mSpeedView == null) {
mSpeedView = new TextView(mMapView.getContext());
@@ -829,6 +885,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onMapLoaded() {
Logger.i(TAG, "autoop--onMapLoaded: ");
mMapView.getMapAutoViewHelper().setRenderFrequency(true, 50);
MogoMapListenerHandler.getInstance().onMapLoaded();
mMapLoaded = true;
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
@@ -865,6 +922,26 @@ public class AMapViewWrapper implements IMogoMapView,
// Logger.i( TAG, "mapop--onMapStatusChanged-: " + type + "," + value );
}
@Override
public void onMapViewVisualAngleChange(int i) {
Logger.d(TAG," 地图自动更改视距 currentThread : " + Thread.currentThread().getName());
mVisualAngleMode = getVisualAngleMode(i);
MogoMapListenerHandler.getInstance().onMapVisualAngleChanged(mVisualAngleMode);
}
private VisualAngleMode getVisualAngleMode(int mode) {
switch (mode) {
case 0:
return MODE_CLOSE_SIGHT;
case 1:
return MODE_MEDIUM_SIGHT;
case 2:
return MODE_LONG_SIGHT;
default:
throw new IllegalStateException("mode is unCorrect");
}
}
@Override
public void onCameraChange(int type, int value) {
// Logger.i( TAG, "mapop--onCameraChange-: " + type + "," + value );
@@ -958,7 +1035,7 @@ public class AMapViewWrapper implements IMogoMapView,
/**
* 切换到车头朝上
*/
private void change2CarUp(){
private void change2CarUp() {
mMapView.getMapAutoViewHelper().setMapViewPerspective(MapAutoApi.MAP_PERSPECTIVE_UP_CAR);
}
@@ -1029,9 +1106,9 @@ public class AMapViewWrapper implements IMogoMapView,
bean.setAcceleration(acceleration);
bean.setAlt(alt);
bean.setSystemTime(systemTime);
bean.setSatelliteTime( satelliteTime );
bean.setSatelliteTime(satelliteTime);
bean.setReceiverDataTime(receiverDataTime);
bean.setAdasSatelliteTime( adasSatelliteTime );
bean.setAdasSatelliteTime(adasSatelliteTime);
bean.setLon(lon);
bean.setGnss_speed(((float) speed));
bean.setLat(lat);
@@ -1063,24 +1140,24 @@ public class AMapViewWrapper implements IMogoMapView,
/**
* 带缓存的道路匹配算法
*
* <p>
* 使用{@link MapDataApi#INSTANCE#getSinglePointMatchRoad()}这个方法获取道路数据会存在一定耗时目前是4-10ms因为请求频繁为了
* 减小这部分耗时使用一个ConcurrentHashMap{@link #roadCacheMap}缓存道路数据此缓存是以目标车id为key道路数据为value以此减少
* 道路数据获取次数。
*
* <p>
* 当出现道路改变的情况需要重新获取道路数据采用递归的方式重获道路数据以及添加缓存为了避免一直获取不到道路数据一直递归增加useCache参数跳出递归。
*
* <p>
* 道路改变的情况主要分为:
* 1. 目标车距离道路中心线距离超过阈值 matchThreshold取路宽的1/4为阈值
* 2. 目标车到道路中心线的映射点不在道路上(此判断在{@link PointInterpolatorUtil#mergeToRoad(double, double, List)}),也就是说已经驶出了这条道路
* 1. 目标车距离道路中心线距离超过阈值 matchThreshold取路宽的1/4为阈值
* 2. 目标车到道路中心线的映射点不在道路上(此判断在{@link PointInterpolatorUtil#mergeToRoad(double, double, List)}),也就是说已经驶出了这条道路
*
* @param id 目标车唯一标识
* @param lon 目标车经度
* @param lat 目标车纬度
* @param angle 目标车角度
* @param id 目标车唯一标识
* @param lon 目标车经度
* @param lat 目标车纬度
* @param angle 目标车角度
* @param isGpsLocation true-使用gps定位数据
* @param isRTK true-使用rtk数据
* @param usdCache true-使用道路缓存 false-不使用道路缓存
* @param isRTK true-使用rtk数据
* @param usdCache true-使用道路缓存 false-不使用道路缓存
* @return double[]{匹配后经度,匹配后纬度,目标车距离车道中心线距离},若匹配后经纬度值为-1则没有匹配成功
*/
private double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK, boolean usdCache) {
@@ -1089,10 +1166,10 @@ public class AMapViewWrapper implements IMogoMapView,
RoadCacheWrapper roadCache = roadCacheMap.get(id);
double matchThreshold = -1;
if (roadCache == null||roadCache == noCache) {
if (roadCache == null || roadCache == noCache) {
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(((float) wgs[0]), ((float) wgs[1]), ((float) angle), isGpsLocation, isRTK);
if (singlePointRoadInfo != null && singlePointRoadInfo.getCoords() != null && !singlePointRoadInfo.getCoords().isEmpty()) {
Log.i("timer-matchRoad-4", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + singlePointRoadInfo.getRoadId());
// Log.i("timer-matchRoad-4", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + singlePointRoadInfo.getRoadId());
roadCache = new RoadCacheWrapper(singlePointRoadInfo.getCoords());
roadCache.setLaneWidth(singlePointRoadInfo.getLaneWidth());
// 在地图上画点的测试方法
@@ -1118,7 +1195,7 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
Log.i("timer-matchRoad-1", "cost " + (System.currentTimeMillis() - start) + "ms");
// Log.i("timer-matchRoad-1", "cost " + (System.currentTimeMillis() - start) + "ms");
if (roadCache != null
&& roadCache.getRoad() != null
&& !roadCache.getRoad().isEmpty()) {
@@ -1127,19 +1204,19 @@ public class AMapViewWrapper implements IMogoMapView,
matchThreshold = roadCache.getLaneWidth() / 4;
double[] matchedPoint = PointInterpolatorUtil.mergeToRoad(wgs[0], wgs[1], roadCache.getRoad());
if (matchThreshold>0&&matchedPoint[2] > 0 && matchedPoint[2] <= matchThreshold) {
if (matchThreshold > 0 && matchedPoint[2] > 0 && matchedPoint[2] <= matchThreshold) {
// 目标车在阈值范围内
roadCacheMap.put(id, roadCache);
Log.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms");
// Logger.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms");
return matchedPoint;
// Log.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: "+roadCache.getLastLat());
// Logger.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: "+roadCache.getLastLat());
} else if (matchedPoint[2] > matchThreshold && matchedPoint[2] < 1.5) {
// 目标车在阈值范围外,也就是说距离道路中心线太远了,就不吸附了
return null;
} else {
// 目标车到道路中心线的映射点不在道路上也就是已经使出了缓存的那条道路需要重新获取一条道路用useCache这个参数来避免重复递归
roadCacheMap.put(id, noCache);
Log.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + roadCache.getLastLat());
// Logger.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + roadCache.getLastLat());
if (usdCache) {
return matchRoad(id, lon, lat, angle, isGpsLocation, isRTK, false);
} else {
@@ -1152,12 +1229,13 @@ public class AMapViewWrapper implements IMogoMapView,
}
@Override
public String getMarkerInfoResName( String speedVal ) {
return ResIdCache.getVal( speedVal );
public String getMarkerInfoResName(String speedVal) {
return ResIdCache.getVal(speedVal);
}
@Override
public void setMarkerInfoResName(String speedVal, String val) {
ResIdCache.putVal(speedVal, val);
}
}

View File

@@ -2,7 +2,6 @@ package com.mogo.map.impl.custom;
import android.content.Context;
import android.graphics.Point;
import android.util.Log;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoUiSettings;
@@ -51,13 +50,13 @@ public class AMapWrapper implements IMogoMap {
private IMogoUiSettings mUiSettings;
public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) {
Logger.i(TAG, "autoop--AMapWrapper: init"+this);
Logger.i(TAG, "autoop--AMapWrapper: init" + this);
this.mAMap = map;
sAMap = map;
this.mMapView = mapView;
mUIcontroller = controller;
// 设置实现自定义 info window
MapAutoApi.INSTANCE.setInfoWindowAdapter( new AMapInfoWindowAdapter() );
MapAutoApi.INSTANCE.setInfoWindowAdapter(new AMapInfoWindowAdapter());
AMapUIController.getInstance().initClient(mUIcontroller);
}
@@ -83,7 +82,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public IMogoMarker addMarker(String tag, MogoMarkerOptions options) {
Logger.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null)+",this:"+this);
Logger.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null) + ",this:" + this);
if (!checkAMap()) {
return null;
}
@@ -134,7 +133,7 @@ public class AMapWrapper implements IMogoMap {
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++){
for (int i = 0; i < data.size(); i++) {
markers.add(new Marker(data.get(i)));
}
if (markers == null || markers.isEmpty()) {
@@ -168,7 +167,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public void setPointToCenter(int x, int y) {
if (checkAMap()) {
LonLatPoint lonLatPoint = MapTools.INSTANCE.fromScreenLocation(new Point(x,y));
LonLatPoint lonLatPoint = MapTools.INSTANCE.fromScreenLocation(new Point(x, y));
mAMap.setCenter(lonLatPoint);
}
}
@@ -176,21 +175,21 @@ public class AMapWrapper implements IMogoMap {
@Override
public void setTouchPoiEnable(boolean touchPoiEnable) {
if (checkAMap()) {
mAMap.setTouchPoiEnable( touchPoiEnable );
mAMap.setTouchPoiEnable(touchPoiEnable);
}
}
@Override
public void setTrafficEnable(boolean enable) {
if (checkAMap()) {
mAMap.setTraffic( enable );
mAMap.setTraffic(enable);
}
}
@Override
public void showBuildings(boolean enabled) {
if (checkAMap()) {
mAMap.showBuildings( enabled );
mAMap.showBuildings(enabled);
}
}
@@ -204,7 +203,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public void showMapText(boolean enable) {
if (checkAMap()) {
mAMap.showMapText( enable );
mAMap.showMapText(enable);
}
}
@@ -217,7 +216,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public float getScalePerPixel() {
if ( checkAMap() ) {
if (checkAMap()) {
return mAMap.getScalePerPixel();
}
return 0;
@@ -247,19 +246,19 @@ public class AMapWrapper implements IMogoMap {
@Override
public IMogoPolyline addPolyline(MogoPolylineOptions options) {
if ( checkAMap() ) {
PolylineOptions polylineOptions = ObjectUtils.fromMogo( options );
if (checkAMap()) {
PolylineOptions polylineOptions = ObjectUtils.fromMogo(options);
Logger.d(TAG, "addPolyline %s", polylineOptions.toString());
if ( polylineOptions == null ) {
if (polylineOptions == null) {
return null;
}
Polyline polyline = null;
if (polylineOptions.getLineWidth() > 0){
if (polylineOptions.getLineWidth() > 0) {
polyline = mAMap.drawThickLine(polylineOptions);
}else {
} else {
polyline = mAMap.drawLine(polylineOptions);
}
return new AMapPolylineWrapper( polyline, options );
return new AMapPolylineWrapper(polyline, options);
}
return null;
}

View File

@@ -264,6 +264,14 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
}
}
@Override
public String getMarkerAssInfo() {
if ( mMarker != null ) {
return mMarker.getMarkeOptions().getAssInfo();
}
return null;
}
@Override
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
mMogoMarkerClickListener = listener;

View File

@@ -1,5 +1,6 @@
package com.mogo.map.impl.custom.marker;
import com.mogo.map.impl.custom.AMapMarkerClickHandler;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
@@ -10,9 +11,16 @@ public class MarkerWrapperClickHelper {
private volatile static MarkerWrapperClickHelper markerWrapperClickHelper;
private Map<String, IMogoMarker> mogoMarkerMap = new HashMap<>();
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);
}
@@ -30,4 +38,8 @@ public class MarkerWrapperClickHelper {
}
return markerWrapperClickHelper;
}
public boolean isStaticMarker(String id){
return id.contains("traffic");
}
}

View File

@@ -13,6 +13,9 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import org.json.JSONObject;
@@ -36,9 +39,9 @@ public class AMapUIController implements IMogoMapUIController {
}
public static AMapUIController getInstance() {
if ( sInstance == null ) {
synchronized ( AMapUIController.class ) {
if ( sInstance == null ) {
if (sInstance == null) {
synchronized (AMapUIController.class) {
if (sInstance == null) {
sInstance = new AMapUIController();
}
}
@@ -46,7 +49,7 @@ public class AMapUIController implements IMogoMapUIController {
return sInstance;
}
public void initClient( IMogoMapUIController client ) {
public void initClient(IMogoMapUIController client) {
this.mClient = client;
}
@@ -55,87 +58,102 @@ public class AMapUIController implements IMogoMapUIController {
}
@Override
public void setTrafficEnabled( boolean visible ) {
if ( mClient != null ) {
mClient.setTrafficEnabled( visible );
public void setTrafficEnabled(boolean visible) {
if (mClient != null) {
mClient.setTrafficEnabled(visible);
}
}
@Override
public MapControlResult changeZoom( boolean zoom ) {
if ( mClient != null ) {
return mClient.changeZoom( zoom );
public MapControlResult changeZoom(boolean zoom) {
if (mClient != null) {
return mClient.changeZoom(zoom);
}
return MapControlResult.ERROR;
}
@Override
public MapControlResult changeZoom( float zoom ) {
if ( mClient != null ) {
return mClient.changeZoom( zoom );
public MapControlResult changeZoom(float zoom) {
if (mClient != null) {
return mClient.changeZoom(zoom);
}
return MapControlResult.ERROR;
}
@Override
public void changeMapMode( EnumMapUI mode ) {
if ( mClient != null ) {
mClient.changeMapMode( mode );
public void changeMapMode(EnumMapUI mode) {
if (mClient != null) {
mClient.changeMapMode(mode);
}
}
@Override
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
if ( mClient != null ) {
mClient.moveToCenter( latLng, animate );
public void changeMapVisualAngle(VisualAngleMode angelMode) {
if (mClient != null) {
mClient.changeMapVisualAngle(angelMode);
}
}
@Override
public void showMyLocation( boolean visible ) {
if ( mClient != null ) {
mClient.showMyLocation( visible );
public VisualAngleMode getCurrentMapVisualAngle() {
if (mClient != null) {
return mClient.getCurrentMapVisualAngle();
}
return null;
}
@Override
public void moveToCenter(MogoLatLng latLng, boolean animate) {
if (mClient != null) {
mClient.moveToCenter(latLng, animate);
}
}
@Override
public void showMyLocation( View view ) {
if ( mClient != null ) {
mClient.showMyLocation( view );
public void showMyLocation(boolean visible) {
if (mClient != null) {
mClient.showMyLocation(visible);
}
}
@Override
public void showMyLocation(View view) {
if (mClient != null) {
mClient.showMyLocation(view);
}
}
@Override
public void recoverLockMode() {
if ( mClient != null ) {
if (mClient != null) {
mClient.recoverLockMode();
}
}
@Override
public void loseLockMode() {
if ( mClient != null ) {
if (mClient != null) {
mClient.loseLockMode();
}
}
@Override
public void setLockZoom( int var1 ) {
if ( mClient != null ) {
mClient.setLockZoom( var1 );
public void setLockZoom(int var1) {
if (mClient != null) {
mClient.setLockZoom(var1);
}
}
@Override
public void displayOverview( Rect bounds ) {
if ( mClient != null ) {
mClient.displayOverview( bounds );
public void displayOverview(Rect bounds) {
if (mClient != null) {
mClient.displayOverview(bounds);
}
}
@Override
public float getScalePerPixel() {
if ( mClient != null ) {
if (mClient != null) {
return mClient.getScalePerPixel();
}
return 0;
@@ -143,7 +161,7 @@ public class AMapUIController implements IMogoMapUIController {
@Override
public float getZoomLevel() {
if ( mClient != null ) {
if (mClient != null) {
return mClient.getZoomLevel();
}
return 0;
@@ -151,15 +169,15 @@ public class AMapUIController implements IMogoMapUIController {
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
if ( mClient != null ) {
return mClient.getRoadWidth(lon,lat,angle,isGpsLocation,isRTK);
if (mClient != null) {
return mClient.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
}
return 0;
}
@Override
public MogoLatLng getCameraNorthEastPosition() {
if ( mClient != null ) {
if (mClient != null) {
return mClient.getCameraNorthEastPosition();
}
return null;
@@ -167,7 +185,7 @@ public class AMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getCameraSouthWestPosition() {
if ( mClient != null ) {
if (mClient != null) {
return mClient.getCameraSouthWestPosition();
}
return null;
@@ -175,119 +193,124 @@ public class AMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getWindowCenterLocation() {
if ( mClient != null ) {
if (mClient != null) {
return mClient.getWindowCenterLocation();
}
return null;
}
@Override
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
if ( mClient != null ) {
mClient.setPointToCenter( mapCenterX, mapCenterY );
public void setPointToCenter(double mapCenterX, double mapCenterY) {
if (mClient != null) {
mClient.setPointToCenter(mapCenterX, mapCenterY);
}
}
@Override
public Point getLocationPointInScreen( MogoLatLng latLng ) {
if ( mClient != null ) {
return mClient.getLocationPointInScreen( latLng );
public Point getLocationPointInScreen(MogoLatLng latLng) {
if (mClient != null) {
return mClient.getLocationPointInScreen(latLng);
}
return null;
}
@Override
public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
if ( mClient != null ) {
return mClient.getLocationMogoLatLngInScreen( point );
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
if (mClient != null) {
return mClient.getLocationMogoLatLngInScreen(point);
}
return null;
}
@Override
public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator,
long duration ) {
if ( mClient != null ) {
mClient.startJumpAnimation( marker, high, interpolator, duration );
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
long duration) {
if (mClient != null) {
mClient.startJumpAnimation(marker, high, interpolator, duration);
}
}
@Override
public void setRenderFps( int fps ) {
if ( mClient != null ) {
mClient.setRenderFps( fps );
public void setRenderFps(int fps) {
if (mClient != null) {
mClient.setRenderFps(fps);
}
}
@Override
public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
if ( mClient != null ) {
mClient.showBounds( tag, carPosition, lonLats, bound, lockCarPosition );
public void showBounds(String tag, MogoLatLng carPosition, List<MogoLatLng> lonLats, Rect bound, boolean lockCarPosition) {
if (mClient != null) {
mClient.showBounds(tag, carPosition, lonLats, bound, lockCarPosition);
}
}
@Override
public void forceRender() {
if ( mClient != null ) {
if (mClient != null) {
mClient.forceRender();
}
}
@Override
public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception {
if ( mClient != null ) {
return mClient.calculateLineDistance( p1, p2 );
public float calculateLineDistance(MogoLatLng p1, MogoLatLng p2) throws Exception {
if (mClient != null) {
return mClient.calculateLineDistance(p1, p2);
}
return 0;
}
@Override
public EnumMapUI getCurrentUiMode() {
if ( mClient != null ) {
if (mClient != null) {
return mClient.getCurrentUiMode();
}
return null;
}
@Override
public void changeMyLocation( Location location ) {
if ( mClient != null ) {
mClient.changeMyLocation( location );
public void changeMyLocation(Location location) {
if (mClient != null) {
mClient.changeMyLocation(location);
}
}
@Override
public boolean isCarLocked() {
if ( mClient != null ) {
if (mClient != null) {
return mClient.isCarLocked();
}
return false;
}
@Override
public void setCarCursorOption( CarCursorOption option ) {
if ( mClient != null ) {
mClient.setCarCursorOption( option );
public void setCarCursorOption(CarCursorOption option) {
if (mClient != null) {
mClient.setCarCursorOption(option);
}
}
@Override
public MapCameraPosition getMapCameraPosition() {
if ( mClient != null ) {
if (mClient != null) {
return mClient.getMapCameraPosition();
}
return null;
}
@Override
public void changeBearing( float bearing ) {
if ( mClient != null ) {
mClient.changeBearing( bearing );
public void changeBearing(float bearing) {
if (mClient != null) {
mClient.changeBearing(bearing);
}
}
@Override
public void setAnchorScale( float x, float y ) {
public long getTileId(double lon, double lat) {
return MapAutoApi.INSTANCE.getTileID(lon, lat, 13); // 13为默认获取瓦片层级级别
}
@Override
public void setAnchorScale(float x, float y) {
}
@@ -297,51 +320,51 @@ public class AMapUIController implements IMogoMapUIController {
}
@Override
public void setAnchorRate( float rate ) {
public void setAnchorRate(float rate) {
}
@Override
public void rtkEnable( boolean enable ) {
if ( mClient != null ) {
mClient.rtkEnable( enable );
public void rtkEnable(boolean enable) {
if (mClient != null) {
mClient.rtkEnable(enable);
}
}
@Override
public void syncLocation2Map( JSONObject data ) {
if ( mClient != null ) {
mClient.syncLocation2Map( data );
public void syncLocation2Map(JSONObject data) {
if (mClient != null) {
mClient.syncLocation2Map(data);
}
}
@Override
public void openVrMode( boolean zoomGestureEnable ) {
if ( mClient != null ) {
mClient.openVrMode( zoomGestureEnable );
public void openVrMode(boolean zoomGestureEnable) {
if (mClient != null) {
mClient.openVrMode(zoomGestureEnable);
}
}
@Override
public double[] matchRoad( String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK ) {
if ( mClient != null ) {
return mClient.matchRoad( id, lon, lat, angle, isGpsLocation, isRTK );
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK) {
if (mClient != null) {
return mClient.matchRoad(id, lon, lat, angle, isGpsLocation, isRTK);
}
return null;
}
@Override
public String getMarkerInfoResName( String speedVal ) {
if ( mClient != null ) {
return mClient.getMarkerInfoResName( speedVal );
public String getMarkerInfoResName(String speedVal) {
if (mClient != null) {
return mClient.getMarkerInfoResName(speedVal);
}
return null;
}
@Override
public void setMarkerInfoResName( String speedVal, String val ) {
if ( mClient != null ) {
mClient.setMarkerInfoResName( speedVal, val );
public void setMarkerInfoResName(String speedVal, String val) {
if (mClient != null) {
mClient.setMarkerInfoResName(speedVal, val);
}
}
@@ -351,4 +374,11 @@ public class AMapUIController implements IMogoMapUIController {
mClient.clearRoadCacheById(id);
}
}
@Override
public void setAdasRecognizedResult(ADASRecognizedResult result) {
if (mClient != null) {
mClient.setAdasRecognizedResult(result);
}
}
}

View File

@@ -735,6 +735,7 @@ public class ObjectUtils {
}
target.setLineWidth( options.getWidth() );
target.setColor( options.getColor() );
target.setGps(options.gps());
// target.zIndex( options.getWidth() );
// target.visible( options.isVisible() );
//// target.geodesic( options.isGeodesic() );

Binary file not shown.

View File

@@ -3,9 +3,9 @@ package com.mogo.map.listener;
import android.view.MotionEvent;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.VisualAngleMode;
/**
* @author congtaowang
@@ -18,42 +18,56 @@ public interface IMogoMapListener {
/**
* 地图加载完毕
*/
default void onMapLoaded(){};
default void onMapLoaded() {
}
/**
* 地图点击
*
* @param motionEvent
*/
default void onTouch( MotionEvent motionEvent ){};
default void onTouch(MotionEvent motionEvent) {
}
/**
* 地图上的任意poi点击
*
* @param poi
*/
default void onPOIClick( MogoPoi poi ){};
default void onPOIClick(MogoPoi poi) {
}
/**
* 地图点击
*
* @param latLng
*/
default void onMapClick( MogoLatLng latLng ){}
default void onMapClick(MogoLatLng latLng) {
}
/**
* 地图锁定
*
* @param isLock
*/
default void onLockMap( boolean isLock ){}
default void onLockMap(boolean isLock) {
}
/**
* 地图白天黑夜、导航视角切换
*
* @param ui
*/
default void onMapModeChanged( EnumMapUI ui ){}
default void onMapModeChanged(EnumMapUI ui) {
}
/**
* 地图视距切换回调
*
* @param visualAngleMode
*/
default void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
}
/**
* @param latLng 中点的经纬度
@@ -61,5 +75,6 @@ public interface IMogoMapListener {
* @param tilt 倾斜度
* @param bearing 旋转角度
*/
default void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ){}
default void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) {
}
}

View File

@@ -3,10 +3,9 @@ package com.mogo.map.listener;
import android.view.MotionEvent;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.VisualAngleMode;
/**
* @author congtaowang
@@ -22,9 +21,9 @@ public class MogoMapListenerHandler implements IMogoMapListener, IMogoMapListene
}
public static MogoMapListenerHandler getInstance() {
if ( sInstance == null ) {
synchronized ( MogoMapListenerHandler.class ) {
if ( sInstance == null ) {
if (sInstance == null) {
synchronized (MogoMapListenerHandler.class) {
if (sInstance == null) {
sInstance = new MogoMapListenerHandler();
}
}
@@ -42,7 +41,7 @@ public class MogoMapListenerHandler implements IMogoMapListener, IMogoMapListene
private IMogoMapListener mDelegateListener = null;
@Override
public void registerHostMapListener( IMogoMapListener listener ) {
public void registerHostMapListener(IMogoMapListener listener) {
mDelegateListener = listener;
}
@@ -53,50 +52,57 @@ public class MogoMapListenerHandler implements IMogoMapListener, IMogoMapListene
@Override
public void onMapLoaded() {
if ( mDelegateListener != null ) {
if (mDelegateListener != null) {
mDelegateListener.onMapLoaded();
}
}
@Override
public void onTouch( MotionEvent motionEvent ) {
if ( mDelegateListener != null ) {
mDelegateListener.onTouch( motionEvent );
public void onTouch(MotionEvent motionEvent) {
if (mDelegateListener != null) {
mDelegateListener.onTouch(motionEvent);
}
}
@Override
public void onPOIClick( MogoPoi poi ) {
if ( mDelegateListener != null ) {
mDelegateListener.onPOIClick( poi );
public void onPOIClick(MogoPoi poi) {
if (mDelegateListener != null) {
mDelegateListener.onPOIClick(poi);
}
}
@Override
public void onMapClick( MogoLatLng latLng ) {
if ( mDelegateListener != null ) {
mDelegateListener.onMapClick( latLng );
public void onMapClick(MogoLatLng latLng) {
if (mDelegateListener != null) {
mDelegateListener.onMapClick(latLng);
}
}
@Override
public void onLockMap( boolean isLock ) {
if ( mDelegateListener != null ) {
mDelegateListener.onLockMap( isLock );
public void onLockMap(boolean isLock) {
if (mDelegateListener != null) {
mDelegateListener.onLockMap(isLock);
}
}
@Override
public void onMapModeChanged( EnumMapUI ui ) {
if ( mDelegateListener != null ) {
mDelegateListener.onMapModeChanged( ui );
public void onMapModeChanged(EnumMapUI ui) {
if (mDelegateListener != null) {
mDelegateListener.onMapModeChanged(ui);
}
}
@Override
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
if ( mDelegateListener != null ) {
mDelegateListener.onMapChanged( location, zoom, tilt, bearing );
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
if (mDelegateListener != null) {
mDelegateListener.onMapVisualAngleChanged(visualAngleMode);
}
}
@Override
public void onMapChanged(MogoLatLng location, float zoom, float tilt, float bearing) {
if (mDelegateListener != null) {
mDelegateListener.onMapChanged(location, zoom, tilt, bearing);
}
}
}

View File

@@ -37,7 +37,7 @@ public class MogoLocationListenerRegister implements IMogoLocationListenerRegist
return sInstance;
}
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
private final Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
/**
* 注册定位回调

View File

@@ -167,6 +167,12 @@ public interface IMogoMarker {
*/
void showInfoWindow();
/**
* Marker对象 AssInfo
* @return marker对象assInfo
*/
String getMarkerAssInfo();
/**
* 设置点击事件
*

View File

@@ -14,5 +14,16 @@ public interface IMogoMarkerClickListener {
* @param marker
* @return true - 事件已经处理完毕不继续往下传,否则继续往下传
*/
boolean onMarkerClicked( IMogoMarker marker );
default boolean onMarkerClicked(IMogoMarker marker){
return false;
};
/**
* 地图上静态Marker点击事件传递
* @param marker
* @return true - 事件已经处理完毕不继续往下传,否则继续往下传
*/
default boolean onStaticMarkerClicked(IMogoMarker marker){
return false;
};
}

View File

@@ -0,0 +1,7 @@
package com.mogo.map.marker;
public class MarkerType {
public static final String MAP_STATIC = "mapStatic";
public static final String MAP_STATIC_TRAFFIC = "trafficcamera";
}

View File

@@ -383,6 +383,11 @@ public class MogoMarkerOptions extends Observable {
return mAnchorColor;
}
public MogoMarkerOptions setGps(boolean gps) {
isGps = gps;
return this;
}
@Override
public String toString() {
return "MogoMarkerOptions{" +

View File

@@ -34,7 +34,7 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
return sInstance;
}
private Map< String, List< IMogoMarker > > mServicesMarkers = new ConcurrentHashMap<>();
private final Map< String, List< IMogoMarker > > mServicesMarkers = new ConcurrentHashMap<>();
private MogoMarkersHandler() {
}
@@ -121,6 +121,14 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
return false;
}
@Override
public boolean onStaticMarkerClicked(IMogoMarker marker) {
if ( mDelegate != null ) {
return mDelegate.onStaticMarkerClicked( marker );
}
return false;
}
/**
* @param tag 需要保留的类型
*/

View File

@@ -19,7 +19,7 @@ import java.util.List;
*/
public class MogoPolylineOptions {
private List< MogoLatLng > mPoints;
private List<MogoLatLng> mPoints;
private float mWidth = 10.0F;
private int mColor = Color.BLACK;
private float mZIndex = 0.0F;
@@ -30,7 +30,8 @@ public class MogoPolylineOptions {
private float mTransparency = 1.0F;
private boolean mIsAboveMaskLayer = false;
private boolean mIsPointsUpdated = false;
private List< Integer > mColorValues;
private boolean mGps = false;
private List<Integer> mColorValues;
public MogoPolylineOptions() {
this.mPoints = new ArrayList<>();
@@ -42,9 +43,9 @@ public class MogoPolylineOptions {
* @param points
* @return
*/
public MogoPolylineOptions points( List< MogoLatLng > points ) {
public MogoPolylineOptions points(List<MogoLatLng> points) {
this.mPoints.clear();
this.mPoints.addAll( points );
this.mPoints.addAll(points);
this.mIsPointsUpdated = true;
return this;
}
@@ -55,22 +56,22 @@ public class MogoPolylineOptions {
* @param points
* @return
*/
public MogoPolylineOptions add( MogoLatLng... points ) {
if ( points != null ) {
this.mPoints.addAll( Arrays.asList( points ) );
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 ) );
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() ) );
public MogoPolylineOptions add(MogoLocation location) {
if (location != null) {
this.mPoints.add(new MogoLatLng(location.getLatitude(), location.getLongitude()));
}
return this;
}
@@ -78,7 +79,7 @@ public class MogoPolylineOptions {
/**
* 设置线宽
*/
public MogoPolylineOptions width( float width ) {
public MogoPolylineOptions width(float width) {
this.mWidth = width;
return this;
}
@@ -89,7 +90,7 @@ public class MogoPolylineOptions {
* @param color
* @return
*/
public MogoPolylineOptions color( @ColorInt int color ) {
public MogoPolylineOptions color(@ColorInt int color) {
this.mColor = color;
return this;
}
@@ -100,7 +101,7 @@ public class MogoPolylineOptions {
* @param zIndex
* @return
*/
public MogoPolylineOptions zIndex( float zIndex ) {
public MogoPolylineOptions zIndex(float zIndex) {
this.mZIndex = zIndex;
return this;
}
@@ -111,7 +112,7 @@ public class MogoPolylineOptions {
* @param isVisible
* @return
*/
public MogoPolylineOptions visible( boolean isVisible ) {
public MogoPolylineOptions visible(boolean isVisible) {
this.mIsVisible = isVisible;
return this;
}
@@ -122,7 +123,7 @@ public class MogoPolylineOptions {
* @param isGeodesic
* @return
*/
public MogoPolylineOptions geodesic( boolean isGeodesic ) {
public MogoPolylineOptions geodesic(boolean isGeodesic) {
this.mIsGeodesic = isGeodesic;
return this;
}
@@ -133,7 +134,7 @@ public class MogoPolylineOptions {
* @param isDottedLine
* @return
*/
public MogoPolylineOptions dottedLine( boolean isDottedLine ) {
public MogoPolylineOptions dottedLine(boolean isDottedLine) {
this.mIsDottedLine = isDottedLine;
return this;
}
@@ -144,7 +145,7 @@ public class MogoPolylineOptions {
* @param isGradient
* @return
*/
public MogoPolylineOptions useGradient( boolean isGradient ) {
public MogoPolylineOptions useGradient(boolean isGradient) {
this.mIsGradient = isGradient;
return this;
}
@@ -155,7 +156,7 @@ public class MogoPolylineOptions {
* @param transparency
* @return
*/
public MogoPolylineOptions transparency( float transparency ) {
public MogoPolylineOptions transparency(float transparency) {
this.mTransparency = transparency;
return this;
}
@@ -164,7 +165,7 @@ public class MogoPolylineOptions {
* @param isAboveMaskLayer
* @return
*/
public MogoPolylineOptions aboveMaskLayer( boolean isAboveMaskLayer ) {
public MogoPolylineOptions aboveMaskLayer(boolean isAboveMaskLayer) {
this.mIsAboveMaskLayer = isAboveMaskLayer;
return this;
}
@@ -173,12 +174,20 @@ public class MogoPolylineOptions {
* @param colors
* @return
*/
public MogoPolylineOptions colorValues( List< Integer > colors ) {
public MogoPolylineOptions colorValues(List<Integer> colors) {
mColorValues = colors;
return this;
}
public boolean gps() {
return mGps;
}
public List< MogoLatLng > getPoints() {
public MogoPolylineOptions setGps(boolean gps) {
mGps = gps;
return this;
}
public List<MogoLatLng> getPoints() {
return mPoints;
}
@@ -222,7 +231,7 @@ public class MogoPolylineOptions {
return mIsPointsUpdated;
}
public List< Integer > getColorValues() {
public List<Integer> getColorValues() {
return mColorValues;
}
}

View File

@@ -11,51 +11,70 @@ public enum EnumMapUI {
/**
* 正北朝上2D
*/
NorthUP_2D( 0, 1 ),
NorthUP_2D(0, 1),
/**
* 车头朝上2D
*/
CarUp_2D( 1, 2 ),
CarUp_2D(1, 2),
/**
* 3D,只能头朝上
*/
CarUp_3D( 2, 0 ),
CarUp_3D(2, 0),
/**
* 白天模式
*/
Type_Light( 3, 5 ),
Type_Light(3, 5),
/**
* 夜晚模式
*/
Type_Night( 4, 4 ),
Type_Night(4, 4),
/**
* 夜晚模式
*/
Type_AUTO_LIGHT_Night( 5, 3 ),
Type_AUTO_LIGHT_Night(5, 3),
/**
* 自研地图的VR模式
*/
Type_VR( 0, 0 );
Type_VR(0, 0),
/**
* 视距远景
*/
MODE_LONG_SIGHT(6, 7),
/**
* 视距中景
*/
MODE_MEDIUM_SIGHT(7, 8),
/**
* 视距近景
*/
MODE_CLOSE_SIGHT(8, 6);
private int next;
private int code;
EnumMapUI( int code, int next ) {
EnumMapUI(int code, int next) {
this.code = code;
this.next = next;
}
public EnumMapUI next() {
for ( EnumMapUI value : EnumMapUI.values() ) {
if ( value.code == next ) {
for (EnumMapUI value : EnumMapUI.values()) {
if (value.code == next) {
return value;
}
}
return this;
}
public int getCode(){
return code;
}
}

View File

@@ -6,12 +6,12 @@ import android.location.Location;
import android.view.View;
import android.view.animation.Interpolator;
import androidx.annotation.DrawableRes;
import androidx.annotation.Nullable;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
import com.mogo.realtime.entity.ADASRecognizedResult;
import org.json.JSONObject;
@@ -28,50 +28,64 @@ public interface IMogoMapUIController {
/**
* 实时路况
*/
void setTrafficEnabled( boolean visible );
void setTrafficEnabled(boolean visible);
/**
* 地图缩放
*
* @param zoomIn true - 放大 false - 缩小
*/
MapControlResult changeZoom( boolean zoomIn );
MapControlResult changeZoom(boolean zoomIn);
/**
* 修改缩放级别
*/
MapControlResult changeZoom( float zoom );
MapControlResult changeZoom(float zoom);
/**
* 切换2D/3D模式
*
* @param mode true - 3D模式 false - 2D模式
*/
void changeMapMode( EnumMapUI mode );
void changeMapMode(EnumMapUI mode);
/**
* 切换3D模式下远距中距近距视角
*
* @param angelMode {@link VisualAngleMode}
*/
void changeMapVisualAngle(VisualAngleMode angelMode);
/**
* 获得当前地图视距模式
*
* @return {@link VisualAngleMode}
*/
VisualAngleMode getCurrentMapVisualAngle();
/**
* 将地图移动至当前位置
*/
default void moveToCenter( MogoLatLng latLng ) {
moveToCenter( latLng, false );
default void moveToCenter(MogoLatLng latLng) {
moveToCenter(latLng, false);
}
/**
* 将地图移动至当前位置
*/
void moveToCenter( MogoLatLng latLng, boolean animate );
void moveToCenter(MogoLatLng latLng, boolean animate);
/**
* 显示我的位置
*
* @param visible true - 显示 false - 不显示
*/
void showMyLocation( boolean visible );
void showMyLocation(boolean visible);
/**
* @param view
*/
void showMyLocation( View view );
void showMyLocation(View view);
/**
* 强调自车位置,加个动画突显一下自车位置
@@ -83,7 +97,7 @@ public interface IMogoMapUIController {
*
* @param location
*/
void changeMyLocation( Location location );
void changeMyLocation(Location location);
/**
* 锁车
@@ -100,14 +114,14 @@ public interface IMogoMapUIController {
*
* @param var1 级别 3-20
*/
void setLockZoom( int var1 );
void setLockZoom(int var1);
/**
* 预览全程
*
* @param bounds 显示范围
*/
void displayOverview( Rect bounds );
void displayOverview(Rect bounds);
/**
* 获取比例尺数据
@@ -147,17 +161,17 @@ public interface IMogoMapUIController {
* @param mapCenterX x 点位置x值与地图宽度的比例
* @param mapCenterY y 点位置x值与地图高度的比例
*/
void setPointToCenter( double mapCenterX, double mapCenterY );
void setPointToCenter(double mapCenterX, double mapCenterY);
/**
* 获取经纬度对应的屏幕的位置
*/
Point getLocationPointInScreen( MogoLatLng latLng );
Point getLocationPointInScreen(MogoLatLng latLng);
/**
* 获取像素点对应的经纬度
*/
MogoLatLng getLocationMogoLatLngInScreen( Point point );
MogoLatLng getLocationMogoLatLngInScreen(Point point);
/**
* marker 跳跃动画
@@ -170,13 +184,13 @@ public interface IMogoMapUIController {
* @param duration 动画时间
*/
@Deprecated
void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator,
long duration );
void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
long duration);
/**
* 设置刷新帧率
*/
void setRenderFps( int fps );
void setRenderFps(int fps);
/**
* @param tag 调用业务
@@ -185,7 +199,7 @@ public interface IMogoMapUIController {
* @param bound 地图上可显示的范围
* @param lockCarPosition 是否锁定车辆位置
*/
void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition );
void showBounds(String tag, MogoLatLng carPosition, List<MogoLatLng> lonLats, Rect bound, boolean lockCarPosition);
/**
* 强制刷新地图
@@ -199,7 +213,7 @@ public interface IMogoMapUIController {
* @param p2
* @return
*/
float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception;
float calculateLineDistance(MogoLatLng p1, MogoLatLng p2) throws Exception;
/**
* 当前的视图模式
@@ -221,7 +235,7 @@ public interface IMogoMapUIController {
* @param option 为空时使用
* 默认配置
*/
void setCarCursorOption( @Nullable CarCursorOption option );
void setCarCursorOption(@Nullable CarCursorOption option);
/**
* 获取地图视图描述快照
@@ -235,13 +249,25 @@ public interface IMogoMapUIController {
*
* @param bearing
*/
void changeBearing( float bearing );
void changeBearing(float bearing);
default void setAnchorScale( float x, float y ) {
void setAdasRecognizedResult(ADASRecognizedResult result);
/**
* 获取瓦片id
*
* @param lon 经度
* @param lat 纬度
* @return 瓦片id
*/
long getTileId(double lon, double lat);
default void setAnchorScale(float x, float y) {
}
default void setAnchorRate( float rate ) {
default void setAnchorRate(float rate) {
}
@@ -254,7 +280,7 @@ public interface IMogoMapUIController {
*
* @param enable
*/
default void rtkEnable( boolean enable ) {
default void rtkEnable(boolean enable) {
}
@@ -267,7 +293,7 @@ public interface IMogoMapUIController {
*
* @param data
*/
default void syncLocation2Map( JSONObject data ) {
default void syncLocation2Map(JSONObject data) {
}
@@ -276,7 +302,7 @@ public interface IMogoMapUIController {
*
* @param zoomGestureEnable 是否支持手势缩放改变地图样式
*/
default void openVrMode( boolean zoomGestureEnable ) {
default void openVrMode(boolean zoomGestureEnable) {
}
@@ -290,7 +316,7 @@ public interface IMogoMapUIController {
* @param isRTK
* @return
*/
default double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK ) {
default double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK) {
return null;
}
@@ -300,19 +326,21 @@ public interface IMogoMapUIController {
/**
* 获取车速资源缓存 id
*
* @param speedVal
* @return
*/
default String getMarkerInfoResName(String speedVal){
default String getMarkerInfoResName(String speedVal) {
return "";
}
/**
* 获取车速资源缓存 id
*
* @param speedVal
* @return
*/
default void setMarkerInfoResName(String speedVal, String val){
default void setMarkerInfoResName(String speedVal, String val) {
}
}

View File

@@ -0,0 +1,10 @@
package com.mogo.map.uicontroller;
public interface IMogoMapVisualAngle {
boolean isLongSight();
boolean isCloseSight();
boolean isMediumSight();
}

View File

@@ -0,0 +1,44 @@
package com.mogo.map.uicontroller;
public enum VisualAngleMode implements IMogoMapVisualAngle {
/**
* 视距近景
*/
MODE_CLOSE_SIGHT(0),
/**
* 视距中景
*/
MODE_MEDIUM_SIGHT(1),
/**
* 视距远景
*/
MODE_LONG_SIGHT(2);
private int code;
VisualAngleMode(int code) {
this.code = code;
}
public int getCode() {
return code;
}
@Override
public boolean isLongSight() {
return code == MODE_LONG_SIGHT.getCode();
}
@Override
public boolean isCloseSight() {
return code == MODE_CLOSE_SIGHT.getCode();
}
@Override
public boolean isMediumSight() {
return code == MODE_MEDIUM_SIGHT.getCode();
}
}

View File

@@ -3,7 +3,6 @@ package com.mogo.map;
import android.graphics.Point;
import android.graphics.Rect;
import android.location.Location;
import android.util.Log;
import android.view.View;
import android.view.animation.Interpolator;
@@ -13,6 +12,8 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.utils.logger.Logger;
import org.json.JSONObject;
@@ -38,9 +39,9 @@ public class MogoMapUIController implements IMogoMapUIController {
}
public static MogoMapUIController getInstance() {
if ( sInstance == null ) {
synchronized ( MogoMapUIController.class ) {
if ( sInstance == null ) {
if (sInstance == null) {
synchronized (MogoMapUIController.class) {
if (sInstance == null) {
sInstance = new MogoMapUIController();
}
}
@@ -48,7 +49,7 @@ public class MogoMapUIController implements IMogoMapUIController {
return sInstance;
}
public void setDelegate( IMogoMapUIController mDelegate ) {
public void setDelegate(IMogoMapUIController mDelegate) {
this.mDelegate = mDelegate;
}
@@ -57,77 +58,94 @@ public class MogoMapUIController implements IMogoMapUIController {
}
@Override
public void setTrafficEnabled( boolean visible ) {
public void setTrafficEnabled(boolean visible) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setTrafficEnabled( visible );
if (mDelegate != null) {
mDelegate.setTrafficEnabled(visible);
}
}
@Override
public MapControlResult changeZoom( boolean zoom ) {
public MapControlResult changeZoom(boolean zoom) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.changeZoom( zoom );
if (mDelegate != null) {
return mDelegate.changeZoom(zoom);
}
return MapControlResult.ERROR;
}
@Override
public MapControlResult changeZoom( float zoom ) {
public MapControlResult changeZoom(float zoom) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.changeZoom( zoom );
if (mDelegate != null) {
return mDelegate.changeZoom(zoom);
}
return MapControlResult.ERROR;
}
@Override
public void changeMapMode( EnumMapUI mode ) {
public void changeMapMode(EnumMapUI mode) {
initDelegate();
if ( mDelegate != null ) {
Logger.d( TAG, "set type: %s", mode.name() );
mDelegate.changeMapMode( mode );
}
}
@Override
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.moveToCenter( latLng, animate );
if (mDelegate != null) {
Logger.d(TAG, "set type: %s", mode.name());
mDelegate.changeMapMode(mode);
}
}
@Override
public void showMyLocation( boolean visible ) {
public void changeMapVisualAngle(VisualAngleMode angelMode) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.showMyLocation( visible );
if (mDelegate != null) {
Logger.d(TAG, "set VisualAngle: %s", angelMode.name());
mDelegate.changeMapVisualAngle(angelMode);
}
}
@Override
public VisualAngleMode getCurrentMapVisualAngle() {
initDelegate();
if (mDelegate != null) {
return mDelegate.getCurrentMapVisualAngle();
}
return null;
}
@Override
public void moveToCenter(MogoLatLng latLng, boolean animate) {
initDelegate();
if (mDelegate != null) {
mDelegate.moveToCenter(latLng, animate);
}
}
@Override
public void showMyLocation(boolean visible) {
initDelegate();
if (mDelegate != null) {
mDelegate.showMyLocation(visible);
}
}
@Override
public void emphasizeMyLocation() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
mDelegate.emphasizeMyLocation();
}
}
@Override
public void showMyLocation( View view ) {
public void showMyLocation(View view) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.showMyLocation( view );
if (mDelegate != null) {
mDelegate.showMyLocation(view);
}
}
@Override
public void recoverLockMode() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
mDelegate.recoverLockMode();
}
}
@@ -135,31 +153,31 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void loseLockMode() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
mDelegate.loseLockMode();
}
}
@Override
public void setLockZoom( int var1 ) {
public void setLockZoom(int var1) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setLockZoom( var1 );
if (mDelegate != null) {
mDelegate.setLockZoom(var1);
}
}
@Override
public void displayOverview( Rect bounds ) {
public void displayOverview(Rect bounds) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.displayOverview( bounds );
if (mDelegate != null) {
mDelegate.displayOverview(bounds);
}
}
@Override
public float getScalePerPixel() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getScalePerPixel();
}
return 0;
@@ -168,7 +186,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public float getZoomLevel() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getZoomLevel();
}
return 0;
@@ -177,7 +195,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
}
@@ -187,7 +205,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getCameraNorthEastPosition() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getCameraNorthEastPosition();
}
return null;
@@ -196,7 +214,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getCameraSouthWestPosition() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getCameraSouthWestPosition();
}
return null;
@@ -205,75 +223,75 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getWindowCenterLocation() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getWindowCenterLocation();
}
return null;
}
@Override
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
public void setPointToCenter(double mapCenterX, double mapCenterY) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setPointToCenter( mapCenterX, mapCenterY );
if (mDelegate != null) {
mDelegate.setPointToCenter(mapCenterX, mapCenterY);
}
}
@Override
public Point getLocationPointInScreen( MogoLatLng latLng ) {
public Point getLocationPointInScreen(MogoLatLng latLng) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getLocationPointInScreen( latLng );
if (mDelegate != null) {
return mDelegate.getLocationPointInScreen(latLng);
}
return null;
}
@Override
public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getLocationMogoLatLngInScreen( point );
if (mDelegate != null) {
return mDelegate.getLocationMogoLatLngInScreen(point);
}
return null;
}
@Override
public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator, long duration ) {
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator, long duration) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.startJumpAnimation( marker, high, interpolator, duration );
if (mDelegate != null) {
mDelegate.startJumpAnimation(marker, high, interpolator, duration);
}
}
@Override
public void setRenderFps( int fps ) {
public void setRenderFps(int fps) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setRenderFps( fps );
if (mDelegate != null) {
mDelegate.setRenderFps(fps);
}
}
@Override
public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
public void showBounds(String tag, MogoLatLng carPosition, List<MogoLatLng> lonLats, Rect bound, boolean lockCarPosition) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.showBounds( tag, carPosition, lonLats, bound, lockCarPosition );
if (mDelegate != null) {
mDelegate.showBounds(tag, carPosition, lonLats, bound, lockCarPosition);
}
}
@Override
public void forceRender() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
mDelegate.forceRender();
}
}
@Override
public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception {
public float calculateLineDistance(MogoLatLng p1, MogoLatLng p2) throws Exception {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.calculateLineDistance( p1, p2 );
if (mDelegate != null) {
return mDelegate.calculateLineDistance(p1, p2);
}
return 0;
}
@@ -281,67 +299,72 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public EnumMapUI getCurrentUiMode() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getCurrentUiMode();
}
return null;
}
@Override
public void changeMyLocation( Location location ) {
public void changeMyLocation(Location location) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.changeMyLocation( location );
if (mDelegate != null) {
mDelegate.changeMyLocation(location);
}
}
@Override
public boolean isCarLocked() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.isCarLocked();
}
return false;
}
@Override
public void setCarCursorOption( CarCursorOption option ) {
public void setCarCursorOption(CarCursorOption option) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setCarCursorOption( option );
if (mDelegate != null) {
mDelegate.setCarCursorOption(option);
}
}
@Override
public MapCameraPosition getMapCameraPosition() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getMapCameraPosition();
}
return null;
}
@Override
public void changeBearing( float bearing ) {
public void changeBearing(float bearing) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.changeBearing( bearing );
if (mDelegate != null) {
mDelegate.changeBearing(bearing);
}
}
@Override
public void rtkEnable( boolean enable ) {
public long getTileId(double lon, double lat) {
return mDelegate.getTileId(lon, lat);
}
@Override
public void rtkEnable(boolean enable) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.rtkEnable( enable );
if (mDelegate != null) {
mDelegate.rtkEnable(enable);
}
}
@Override
public void syncLocation2Map( JSONObject data ) {
public void syncLocation2Map(JSONObject data) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.syncLocation2Map( data );
if (mDelegate != null) {
mDelegate.syncLocation2Map(data);
}
}
@@ -351,42 +374,42 @@ public class MogoMapUIController implements IMogoMapUIController {
}
private void initDelegate() {
if ( mDelegate == null ) {
if (mDelegate == null) {
mDelegate = MogoMapDelegateFactory.getMapUIControllerDelegate();
}
}
@Override
public void openVrMode( boolean zoomGestureEnable ) {
public void openVrMode(boolean zoomGestureEnable) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.openVrMode( zoomGestureEnable );
if (mDelegate != null) {
mDelegate.openVrMode(zoomGestureEnable);
}
}
@Override
public double[] matchRoad( String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK ) {
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.matchRoad( id, lon, lat, angle, isGpsLocation, isRTK );
if (mDelegate != null) {
return mDelegate.matchRoad(id, lon, lat, angle, isGpsLocation, isRTK);
}
return null;
}
@Override
public String getMarkerInfoResName( String speedVal ) {
public String getMarkerInfoResName(String speedVal) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getMarkerInfoResName( speedVal );
if (mDelegate != null) {
return mDelegate.getMarkerInfoResName(speedVal);
}
return null;
}
@Override
public void setMarkerInfoResName( String speedVal, String val ) {
public void setMarkerInfoResName(String speedVal, String val) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setMarkerInfoResName( speedVal, val );
if (mDelegate != null) {
mDelegate.setMarkerInfoResName(speedVal, val);
}
}
@@ -397,4 +420,12 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.clearRoadCacheById(id);
}
}
@Override
public void setAdasRecognizedResult(ADASRecognizedResult result) {
initDelegate();
if (mDelegate != null) {
mDelegate.setAdasRecognizedResult(result);
}
}
}

View File

@@ -7,7 +7,6 @@ import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.annotation.Nullable;
@@ -16,14 +15,11 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.main.MainActivity;
import com.mogo.module.main.cards.MogoModulesManager;
import com.mogo.module.main.utils.DisplayEffectsHelper;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.och.IMogoOCH;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.service.v2x.IV2XListener;
import com.mogo.utils.logger.Logger;
@@ -38,7 +34,7 @@ import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_T
*
* @author tongchenfei
*/
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMogoStatusChangedListener, IV2XListener {
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IV2XListener {
private static final String TAG = "MainLauncherActivity";
protected boolean mIsHomeKeyDown = false;
private static Handler handlerV2XEvent = new Handler();
@@ -53,9 +49,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
DebugConfig.setNeedRequestUserInfo(true);
Log.d(TAG, "onCreate");
mServiceApis.getV2XListenerManager().registerIntentListener(MogoReceiver.ACTION_V2X_FRONT_WARNING, this);
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG,
StatusDescriptor.VR_MODE, this);
DisplayEffectsHelper.getInstance().init(clSpecialEffect);
}
@Override
@@ -164,28 +157,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
Logger.d(TAG, "send msg to AI Voice");
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
FrameLayout.LayoutParams entranceParams = ((FrameLayout.LayoutParams) mEntrance.getLayoutParams());
if (isTrue) {
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode);
mLeftShadowFrame.setVisibility(View.GONE);
mApps.setVisibility(View.GONE);
} else {
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_id_entrance_fragment_container_marginLeft);
mLeftShadowFrame.setVisibility(View.VISIBLE);
mApps.setVisibility(View.VISIBLE);
}
mEntrance.setLayoutParams(entranceParams);
if (descriptor == StatusDescriptor.VR_MODE) {
if (isTrue) {
clSpecialEffect.setVisibility(View.VISIBLE);
} else {
clSpecialEffect.setVisibility(View.GONE);
}
}
}
@Override
public void warningChangedWithDirection(int type) {
@@ -252,4 +224,16 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
EXPIRE_TIMER = ALL_EXPIRE_TIMER;
}
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
super.onStatusChanged(descriptor,isTrue);
if (isTrue) {
mLeftShadowFrame.setVisibility(View.GONE);
mApps.setVisibility(View.GONE);
} else {
mLeftShadowFrame.setVisibility(View.VISIBLE);
mApps.setVisibility(View.VISIBLE);
}
}
}

View File

@@ -50,7 +50,6 @@
:modules:mogo-module-push-noop
:modules:mogo-module-push
:libraries:tanlulib
:libraries:mogo-tanlu-api
:modules:mogo-module-monitor
:modules:mogo-module-splash
:modules:mogo-module-splash-noop

View File

@@ -6,6 +6,7 @@ import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.VisualAngleMode;
/**
* @author congtaowang
@@ -45,6 +46,11 @@ public abstract class MogoMapListenerAdapter implements IMogoMapListener {
}
@Override
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
}
@Override
public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) {

View File

@@ -9,34 +9,37 @@ public
*/
enum AdasRecognizedType {
//背景
classIdBackground( "background", 0 ),
classIdBackground("background", 0),
//人
classIdPerson( "person", 1 ),
classIdPerson("person", 1),
//自行车
classIdBicycle( "bicycle", 2 ),
classIdBicycle("bicycle", 2),
//小轿车
classIdCar( "car", 3 ),
classIdCar("car", 3),
//摩托车
classIdMoto( "moto", 4 ),
classIdMoto("moto", 4),
//红绿灯
classIdTrafficSign( "traffic_sign", 5 ),
classIdTrafficSign("traffic_sign", 5),
//bus
classIdTrafficBus( "traffic_bus", 6 ),
classIdTrafficBus("traffic_bus", 6),
//truck
classIdTrafficTruck( "traffic_truck", 8 ),
classIdTrafficTruck("traffic_truck", 8),
//stopLine
classIdStopLine("warning_stop_line",9),
classIdStopLine("warning_stop_line", 9),
//预警箭头
classIdWarningArrows("warning_arrows",10);
classIdWarningArrows("warning_arrows", 10),
AdasRecognizedType( int code ) {
//未知物体
classIdUnKnow("unKnow", 100);
AdasRecognizedType(int code) {
this.code = code;
}
private String res = "";
private int code = -1;
AdasRecognizedType( String res, int code ) {
AdasRecognizedType(String res, int code) {
this.res = res;
this.code = code;
}
@@ -53,14 +56,18 @@ enum AdasRecognizedType {
classIdTrafficTruck,
classIdStopLine,
classIdWarningArrows,
classIdUnKnow,
};
public String getRes() {
return res;
}
public static AdasRecognizedType valueFrom( int code ) {
if ( code >= 0 && code < VAL.length ) {
public static AdasRecognizedType valueFrom(int code) {
if (code == 100) {
return classIdUnKnow;
}
if (code >= 0 && code < VAL.length) {
return VAL[code];
}
return null;

View File

@@ -199,7 +199,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
recognizedListResult.lat = matchLonLat[1];
mLastPositions.put( uniqueKey, recognizedListResult );
Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
// Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
newAdasRecognizedMarkersCaches.put( uniqueKey, marker );
if ( lastPosition != null ) {

View File

@@ -194,7 +194,8 @@ class BaseDrawer {
|| recognizedType == AdasRecognizedType.classIdBicycle
|| recognizedType == AdasRecognizedType.classIdPerson
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|| recognizedType == AdasRecognizedType.classIdTrafficTruck;
|| recognizedType == AdasRecognizedType.classIdTrafficTruck
|| recognizedType == AdasRecognizedType.classIdUnKnow; //todo unKnow物体绘制
}
/**
@@ -207,7 +208,8 @@ class BaseDrawer {
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
return recognizedType != AdasRecognizedType.classIdBicycle
&& recognizedType != AdasRecognizedType.classIdMoto
&& recognizedType != AdasRecognizedType.classIdPerson;
&& recognizedType != AdasRecognizedType.classIdPerson
&& recognizedType != AdasRecognizedType.classIdUnKnow; //todo unKnow物体不绘制车速
}
/**
@@ -230,6 +232,8 @@ class BaseDrawer {
return R.raw.stopline;
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
return R.raw.arraw;
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) { //todo unKnow物体3D模型
return R.raw.othercar;
}
return R.raw.people;
}
@@ -248,6 +252,9 @@ class BaseDrawer {
if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
return "#D8D8D8FF";
}
if (recognizedType == AdasRecognizedType.classIdUnKnow){ //todo unKnow颜色绘制
return "#FF2894FF";
}
// 距离策略
double[] coordinates = getCurCoordinates();
double distance = CoordinateUtils.calculateLineDistance(lon, lat, coordinates[0], coordinates[1]) * 100;

View File

@@ -9,7 +9,10 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.drawer.marker.EmptyMarkerView;
import com.mogo.module.common.drawer.marker.IMarkerView;
import com.mogo.module.common.drawer.marker.MapMarker3DResAdapter;
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
import com.mogo.module.common.drawer.marker.OnlineCarMarkerView;
import com.mogo.module.common.entity.MarkerExploreWay;
@@ -41,9 +44,9 @@ class MarkerDrawer {
}
public static MarkerDrawer getInstance() {
if ( sInstance == null ) {
synchronized ( MarkerDrawer.class ) {
if ( sInstance == null ) {
if (sInstance == null) {
synchronized (MarkerDrawer.class) {
if (sInstance == null) {
sInstance = new MarkerDrawer();
}
}
@@ -60,46 +63,61 @@ class MarkerDrawer {
return sInstance;
}
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener ) {
return drawMapMarkerImpl( markerShowEntity, false, zIndex, 0, listener );
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener) {
return drawMapMarkerImpl(markerShowEntity, false, zIndex, 0, listener);
}
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, IMogoMarkerClickListener listener ) {
return drawMapMarkerImpl( markerShowEntity, matchRoadSide, zIndex, 0, listener );
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, IMogoMarkerClickListener listener) {
return drawMapMarkerImpl(markerShowEntity, matchRoadSide, zIndex, 0, listener);
}
/**
* add marker, {@link OnlineCarDrawer 如果是需要在3D模式下显示则需要设置 {@link MogoMarkerOptions icon3DRes 资源id}}
*
* @param markerShowEntity marker展示数据结构体
* @param matchRoadSide 设置是否道路吸附,暂时没用到这个字段
* @param zIndex zOrder
* @param icon3DRes 3D Res资源
* @param listener marker回调
* @param matchRoadSide 设置是否道路吸附,暂时没用到这个字段
* @param zIndex zOrder
* @param icon3DRes 3D Res资源
* @param listener marker回调
* @return {@link IMogoMarker}
*/
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, int icon3DRes, IMogoMarkerClickListener listener ) {
if ( markerShowEntity == null || markerShowEntity.getMarkerLocation() == null ) {
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, int icon3DRes, IMogoMarkerClickListener listener) {
if (markerShowEntity == null || markerShowEntity.getMarkerLocation() == null) {
return null;
}
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes( icon3DRes ).set3DMode(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()).matchOnRoadSide( matchRoadSide ).owner( markerShowEntity.getMarkerType() ).zIndex( zIndex ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() );
IMarkerView markerView = MapMarkerAdapter.getMarkerView( AbsMogoApplication.getApp(), markerShowEntity, options );
if ( markerView instanceof OnlineCarMarkerView ) {
try {
options.icon( markerView.getBitmap( ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getCarInfo().getVehicleType() ) );
} catch ( Exception e ) {
options.icon( markerView.getBitmap( 0 ) );
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes(icon3DRes).set3DMode(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()).matchOnRoadSide(matchRoadSide).owner(markerShowEntity.getMarkerType()).zIndex(zIndex).object(markerShowEntity).latitude(markerShowEntity.getMarkerLocation().getLat()).longitude(markerShowEntity.getMarkerLocation().getLon());
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
Object bindObj = markerShowEntity.getBindObj();
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
options.icon3DRes(MapMarker3DResAdapter.getMarker3DRes(poiType));
}
options.anchor( 0.5f, 0.5f );
}
IMarkerView markerView = MapMarkerAdapter.getMarkerView(AbsMogoApplication.getApp(), markerShowEntity, options);
if (markerView instanceof OnlineCarMarkerView) {
try {
options.icon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
} catch (Exception e) {
options.icon(markerView.getBitmap(0));
}
options.anchor(0.5f, 0.5f);
} else {
options.icon( markerView.getView() );
options.icon(markerView.getView());
}
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).addMarker( markerShowEntity.getMarkerType(), options );
if ( marker != null ) {
marker.setOwner( markerShowEntity.getMarkerType() );
markerView.setMarker( marker );
marker.setOnMarkerClickListener( listener );
markerShowEntity.setMarker( marker );
if (options.getIcon3DRes() != 0) {
options.icon(new EmptyMarkerView(AbsMogoApplication.getApp()));
options.icon(markerView.getBitmap(0));
}
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).addMarker(markerShowEntity.getMarkerType(), options);
if (marker != null) {
marker.setOwner(markerShowEntity.getMarkerType());
markerView.setMarker(marker);
marker.setOnMarkerClickListener(listener);
markerShowEntity.setMarker(marker);
}
return marker;
}
@@ -111,42 +129,42 @@ class MarkerDrawer {
* @param newList
* @return
*/
public Map< String, IMogoMarker > purgeMarkerData( List newList, String markerType ) {
public Map<String, IMogoMarker> purgeMarkerData(List newList, String markerType) {
final long start = System.currentTimeMillis();
Map< String, IMogoMarker > existMap = new HashMap<>();
List< IMogoMarker > allCarsList = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).getMarkers( markerType );
if ( allCarsList == null || allCarsList.isEmpty() ) {
Map<String, IMogoMarker> existMap = new HashMap<>();
List<IMogoMarker> allCarsList = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).getMarkers(markerType);
if (allCarsList == null || allCarsList.isEmpty()) {
return existMap;
}
if ( newList == null || newList.isEmpty() ) {
if (newList == null || newList.isEmpty()) {
return existMap;
}
Map< String, IMogoMarker > allMap = new HashMap<>();
for ( IMogoMarker marker : allCarsList ) {
String sn = getPrimaryKeyFromMarker( marker );
allMap.put( sn, marker );
Map<String, IMogoMarker> allMap = new HashMap<>();
for (IMogoMarker marker : allCarsList) {
String sn = getPrimaryKeyFromMarker(marker);
allMap.put(sn, marker);
}
for ( Object entity : newList ) {
String sn = getPrimaryKeyFromEntity( entity );
if ( allMap.containsKey( sn ) ) {
if ( !isNewVehicleType( entity, allMap.get( sn ) ) ) {
existMap.put( sn, allMap.get( sn ) );
for (Object entity : newList) {
String sn = getPrimaryKeyFromEntity(entity);
if (allMap.containsKey(sn)) {
if (!isNewVehicleType(entity, allMap.get(sn))) {
existMap.put(sn, allMap.get(sn));
}
}
}
for ( String sn : allMap.keySet() ) {
if ( !existMap.containsKey( sn ) ) {
IMogoMarker dirtyMarker = allMap.get( sn );
allCarsList.remove( dirtyMarker );
if ( dirtyMarker != null ) {
for (String sn : allMap.keySet()) {
if (!existMap.containsKey(sn)) {
IMogoMarker dirtyMarker = allMap.get(sn);
allCarsList.remove(dirtyMarker);
if (dirtyMarker != null) {
dirtyMarker.destroy();
}
}
}
allMap.clear();
Logger.i( "timer", "purge data cost " + ( System.currentTimeMillis() - start ) + "ms" );
Logger.i("timer", "purge data cost " + (System.currentTimeMillis() - start) + "ms");
return existMap;
}
@@ -156,74 +174,74 @@ class MarkerDrawer {
* @param list
* @return
*/
public int getAppropriateSize( int maxAmount, List list ) {
if ( list == null ) {
public int getAppropriateSize(int maxAmount, List list) {
if (list == null) {
return 0;
}
return Math.min( maxAmount, list.size() );
return Math.min(maxAmount, list.size());
}
private boolean isNewVehicleType( Object object, IMogoMarker marker ) {
if ( object instanceof MarkerOnlineCar
private boolean isNewVehicleType(Object object, IMogoMarker marker) {
if (object instanceof MarkerOnlineCar
&& marker != null
&& marker.getObject() instanceof MarkerShowEntity
&& ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerOnlineCar ) {
&& ((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerOnlineCar) {
try {
return ( ( MarkerOnlineCar ) object ).getCarInfo().getVehicleType()
!= ( ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() ).getCarInfo().getVehicleType();
} catch ( Exception e ) {
return ((MarkerOnlineCar) object).getCarInfo().getVehicleType()
!= ((MarkerOnlineCar) ((MarkerShowEntity) marker.getObject()).getBindObj()).getCarInfo().getVehicleType();
} catch (Exception e) {
}
}
return false;
}
public String getPrimaryKeyFromEntity( Object entity ) {
if ( entity instanceof MarkerExploreWay ) {
String id = ( ( MarkerExploreWay ) entity ).getInfoId();
if ( !TextUtils.isEmpty( id ) ) {
public String getPrimaryKeyFromEntity(Object entity) {
if (entity instanceof MarkerExploreWay) {
String id = ((MarkerExploreWay) entity).getInfoId();
if (!TextUtils.isEmpty(id)) {
return id;
}
}
return getCarSnFromEntity( entity );
return getCarSnFromEntity(entity);
}
private String getPrimaryKeyFromMarker( IMogoMarker marker ) {
if ( marker == null || marker.getObject() == null || marker.isDestroyed() ) {
private String getPrimaryKeyFromMarker(IMogoMarker marker) {
if (marker == null || marker.getObject() == null || marker.isDestroyed()) {
return null;
}
if ( !( marker.getObject() instanceof MarkerShowEntity ) ) {
if (!(marker.getObject() instanceof MarkerShowEntity)) {
return null;
}
return getPrimaryKeyFromEntity( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() );
return getPrimaryKeyFromEntity(((MarkerShowEntity) marker.getObject()).getBindObj());
}
private String getCarSnFromEntity( Object entity ) {
private String getCarSnFromEntity(Object entity) {
try {
if ( entity instanceof MarkerOnlineCar ) {
return ( ( MarkerOnlineCar ) entity ).getUserInfo().getSn();
} else if ( entity instanceof MarkerShareMusic ) {
return ( ( MarkerShareMusic ) entity ).getUserInfo().getSn();
} else if ( entity instanceof MarkerNoveltyInfo ) {
return ( ( MarkerNoveltyInfo ) entity ).getSn();
} else if ( entity instanceof MarkerExploreWay ) {
return ( ( MarkerExploreWay ) entity ).getUserInfo().getSn();
if (entity instanceof MarkerOnlineCar) {
return ((MarkerOnlineCar) entity).getUserInfo().getSn();
} else if (entity instanceof MarkerShareMusic) {
return ((MarkerShareMusic) entity).getUserInfo().getSn();
} else if (entity instanceof MarkerNoveltyInfo) {
return ((MarkerNoveltyInfo) entity).getSn();
} else if (entity instanceof MarkerExploreWay) {
return ((MarkerExploreWay) entity).getUserInfo().getSn();
}
} catch ( Exception e ) {
} catch (Exception e) {
}
return "";
}
public String getCarSnFromMarker( IMogoMarker marker ) {
if ( marker == null || marker.getObject() == null || marker.isDestroyed() ) {
public String getCarSnFromMarker(IMogoMarker marker) {
if (marker == null || marker.getObject() == null || marker.isDestroyed()) {
return null;
}
if ( !( marker.getObject() instanceof MarkerShowEntity ) ) {
if (!(marker.getObject() instanceof MarkerShowEntity)) {
return null;
}
return getCarSnFromEntity( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() );
return getCarSnFromEntity(((MarkerShowEntity) marker.getObject()).getBindObj());
}
/**
@@ -233,9 +251,9 @@ class MarkerDrawer {
* @param point2 点二坐标
* @return 两坐标的距离 单位M
*/
public static float calculateLineDistance( MogoLatLng point1, MogoLatLng point2 ) {
if ( point1 != null && point2 != null ) {
return calculateLineDistance( point1.lon, point1.lat, point2.lon, point2.lat );
public static float calculateLineDistance(MogoLatLng point1, MogoLatLng point2) {
if (point1 != null && point2 != null) {
return calculateLineDistance(point1.lon, point1.lat, point2.lon, point2.lat);
} else {
return 0.0F;
}
@@ -248,7 +266,7 @@ class MarkerDrawer {
* @param lat2
* @return 两坐标的距离 单位M
*/
public static float calculateLineDistance( double lon1, double lat1, double lon2, double lat2 ) {
return CoordinateUtils.calculateLineDistance( lon1, lat1, lon2, lat2 );
public static float calculateLineDistance(double lon1, double lat1, double lon2, double lat2) {
return CoordinateUtils.calculateLineDistance(lon1, lat1, lon2, lat2);
}
}

View File

@@ -87,8 +87,8 @@ class RoadConditionDrawer {
try {
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, true, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
mogoMarker.setInfoWindowAdapter( new RoadConditionInfoWindow3DAdapter( markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions() ) );
mogoMarker.showInfoWindow();
// mogoMarker.setInfoWindowAdapter( new RoadConditionInfoWindow3DAdapter( markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions() ) );
// mogoMarker.showInfoWindow();
} else {
if ( DebugConfig.isRoadEventAnimated() ) {
post2AddAndStartAnimation( markerShowEntity, i * 100L, listener );

View File

@@ -91,19 +91,21 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
MogoLatLng mogoLatLng = new MogoLatLng(data.getCollisionLat(), data.getCollisionLon());
//2D资源图片位置调整
MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 5, 180);
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180);
// MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 5, 180);
// MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180);
IMogoMarker marker = drawMarker(markerShowEntity);
Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection());
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(data.getType()));
//识别物
marker.addDynamicAnchorPosition(new MogoLatLng(
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
//识别物下方的红色圆圈
bottomMarker.addDynamicAnchorPosition(new MogoLatLng(
data.getDirection() == 1 ? stopLineNew.lat : newLocation.getLat(),
data.getDirection() == 1 ? stopLineNew.lon : newLocation.getLon()), (float) data.getHeading(), 5000);
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
// bottomMarker.addDynamicAnchorPosition(new MogoLatLng(
// data.getDirection() == 1 ? stopLineNew.lat : newLocation.getLat(),
// data.getDirection() == 1 ? stopLineNew.lon : newLocation.getLon()), (float) data.getHeading(), 5000);
//移动完成以后3s后消失
UiThreadHandler.postDelayed(() -> {
marker.remove();
@@ -112,15 +114,32 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
}
//根据识别物类型 (行人0/自行车1/摩托车2/小汽车3/公交车4)获取3D模型(对应查看getModelRes)
private int modeResType(int dataType) {
switch (dataType) {
case 0:
return 1;
case 1:
return 2;
case 2:
return 4;
case 3:
return 3;
case 4:
return 6;
}
return 1;
}
public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity) {
public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity, int modeResType) {
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
.longitude(markerShowEntity.getMarkerLocation().getLon())
.setGps(false);
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(1)); //TODO
options.icon3DRes(getModelRes(modeResType)); //TODO
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
@@ -134,6 +153,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
.latitude(location.getLat())
.longitude(location.getLon())
.set3DMode(true)
.setGps(false)
.controlAngle(true)
.icon3DRes(getModelRes(type))
.anchorColor("#FB3C3CFF")
@@ -152,6 +172,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
.latitude(newLocation.getLat())
.longitude(newLocation.getLon())
.anchor(1.0f, 1.0f)
.setGps(false)
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
optionsRipple
.icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
@@ -192,10 +213,10 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
.longitude(markerShowEntity.getMarkerLocation().getLon())
.setGps(false);
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(9));
options.anchorColor("#FB3C3CFF");
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);

View File

@@ -0,0 +1,55 @@
package com.mogo.module.common.drawer.marker;
import android.content.Context;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.R;
import com.mogo.module.common.entity.MarkerShowEntity;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_ACCIDENT;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_BLOCK_UP;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_FOG;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_ICE;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_LIVING;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_PONDING;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_ROAD_WORK;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.TRAFFIC_CHECK;
/**
* created by wujifei on 2021/4/28 18:04
* describe:地图Marker的3d资源适配器
*/
public class MapMarker3DResAdapter {
public static int getMarker3DRes(String poiType) {
int res = 0;
switch (poiType) {
case FOURS_BLOCK_UP:
res = R.raw.v2x_yongdu;
break;
case FOURS_ACCIDENT:
res = R.raw.v2x_shigu;
break;
case FOURS_LIVING:
res = R.raw.v2x_shishilukuang;
break;
case FOURS_FOG:
res = R.raw.v2x_nongwu;
break;
case TRAFFIC_CHECK:
res = R.raw.v2x_jiaotongjiancha;
break;
case FOURS_ROAD_WORK:
res = R.raw.v2x_daolushigong;
break;
case FOURS_ICE:
res = R.raw.v2x_daolujiebing;
break;
case FOURS_PONDING:
res = R.raw.v2x_daolujishui;
break;
}
return res;
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.module.common.uploadintime;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.utils.logger.Logger;
@@ -9,14 +10,13 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public
/*
* @author congtaowang
* @since 2020/12/14
*
* 实时坐标数据处理中心
*/
class SnapshotLocationController {
public class SnapshotLocationController {
private static final String TAG = "SnapshotLocationController";
@@ -26,9 +26,9 @@ class SnapshotLocationController {
}
public static SnapshotLocationController getInstance() {
if ( sInstance == null ) {
synchronized ( SnapshotLocationController.class ) {
if ( sInstance == null ) {
if (sInstance == null) {
synchronized (SnapshotLocationController.class) {
if (sInstance == null) {
sInstance = new SnapshotLocationController();
}
}
@@ -43,10 +43,10 @@ class SnapshotLocationController {
private CloudLocationInfo mLastLocationInfo = null;
// GPS(1s1次) RTK(OS侧)缓存数据,
private final List< CloudLocationInfo > mLocationList = new ArrayList<>();
private final List<CloudLocationInfo> mLocationList = new ArrayList<>();
// adda 工控机数据缓存
private final List< CloudLocationInfo > mMachineCacheList = new ArrayList<>();
private final List<CloudLocationInfo> mMachineCacheList = new ArrayList<>();
private int mDataAccuracy = 0;
private double mCurSpeed;
@@ -58,15 +58,15 @@ class SnapshotLocationController {
*
* @param cli {@link CloudLocationInfo}
*/
public void syncLocationInfo( CloudLocationInfo cli ) {
if ( cli == null ) {
public void syncLocationInfo(CloudLocationInfo cli) {
if (cli == null) {
return;
}
mLastLocationInfo = cli;
mCurSpeed = cli.getSpeed();
mCurLon = cli.getLon();
mCurLat = cli.getLat();
mLocationList.add( cli );
mLocationList.add(cli);
}
/**
@@ -74,32 +74,39 @@ class SnapshotLocationController {
*
* @param data JSON结构化数据
*/
public void syncAdasLocationInfo( JSONObject data ) {
if ( data == null ) {
public void syncAdasLocationInfo(JSONObject data) {
if (data == null) {
return;
}
DebugConfig.setStatus( DebugConfig.sLocation, true );
Logger.d( TAG, "同步到rtk数据" );
double lon = data.optDouble( "lon", -1 );
double lat = data.optDouble( "lat", -1 );
double alt = data.optDouble( "alt", -1 );
double heading = data.optDouble( "heading", -1 );
double acceleration = data.optDouble( "acceleration", -1 );
double yawRate = data.optDouble( "yawRate", -1 );
double speed = data.optDouble( "speed", -1 );
long satelliteTime = data.optLong( "satelliteTime" );
long systemTime = data.optLong( "systemTime" );
//测试面板状态同步
DebugConfig.setStatus(DebugConfig.sLocation, true);
Logger.d(TAG, "同步到rtk数据");
double lon = data.optDouble("lon", -1);
double lat = data.optDouble("lat", -1);
double alt = data.optDouble("alt", -1);
double heading = data.optDouble("heading", -1);
double acceleration = data.optDouble("acceleration", -1);
double yawRate = data.optDouble("yawRate", -1);
double speed = data.optDouble("speed", -1);
long satelliteTime = data.optLong("satelliteTime");
long systemTime = data.optLong("systemTime");
//测试面板状态同步
DebugConfig.setStatusData(DebugConfig.sLon, lon);
DebugConfig.setStatusData(DebugConfig.sLat, lat);
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
cloudLocationInfo.setAlt( alt );
cloudLocationInfo.setHeading( heading );
cloudLocationInfo.setLat( lat );
cloudLocationInfo.setLon( lon );
cloudLocationInfo.setSpeed( speed );
cloudLocationInfo.setSatelliteTime( satelliteTime );
cloudLocationInfo.setSystemTime( systemTime );
cloudLocationInfo.setAlt(alt);
cloudLocationInfo.setHeading(heading);
cloudLocationInfo.setLat(lat);
cloudLocationInfo.setLon(lon);
cloudLocationInfo.setSpeed(speed);
cloudLocationInfo.setSatelliteTime(satelliteTime);
cloudLocationInfo.setSystemTime(systemTime);
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat)));
mLastLocationInfo = cloudLocationInfo;
mMachineCacheList.add( cloudLocationInfo );
mMachineCacheList.add(cloudLocationInfo);
mCurSpeed = cloudLocationInfo.getSpeed();
mCurLon = cloudLocationInfo.getLon();
@@ -111,29 +118,29 @@ class SnapshotLocationController {
*
* @return 坐标合集
*/
public List< CloudLocationInfo > getSendLocationData() {
public List<CloudLocationInfo> getSendLocationData() {
List< CloudLocationInfo > list = null;
if ( mMachineCacheList != null ) {
List<CloudLocationInfo> list = null;
if (mMachineCacheList != null) {
mDataAccuracy = 1;
list = new ArrayList<>( mMachineCacheList );
list = new ArrayList<>(mMachineCacheList);
mMachineCacheList.clear();
}
if ( list == null || list.isEmpty() ) {
if (list == null || list.isEmpty()) {
mDataAccuracy = 0;
if ( mLocationList != null ) {
list = new ArrayList<>( mLocationList );
if (mLocationList != null) {
list = new ArrayList<>(mLocationList);
mLocationList.clear();
}
}
if ( list == null || list.isEmpty() ) {
if ( mLastLocationInfo != null ) {
if (list == null || list.isEmpty()) {
if (mLastLocationInfo != null) {
list = new ArrayList();
list.add( mLastLocationInfo );
list.add(mLastLocationInfo);
mLastLocationInfo = null;
}
}
Logger.d( TAG, "upload loc size = %s", list == null ? 0 : list.size() );
//Logger.d( TAG, "upload loc size = %s", list == null ? 0 : list.size() );
return list;
}
@@ -143,7 +150,7 @@ class SnapshotLocationController {
* @return 精度
*/
public int getDataAccuracy() {
Logger.d( TAG, "upload loc accuracy = %s", mDataAccuracy );
//Logger.d( TAG, "upload loc accuracy = %s", mDataAccuracy );
return mDataAccuracy;
}

View File

@@ -45,6 +45,7 @@ import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.dialog.WMDialog;
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
@@ -1082,6 +1083,11 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
// }
}
@Override
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
//todo visual
}
private static final int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
//求助已通知周围XX位车主
private final IMogoOnMessageListener<String> seekHelpNoticeListener =

View File

@@ -8,6 +8,7 @@ import android.util.Log;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.extensions.R;
@@ -40,16 +41,18 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
mContext = context;
MoGoAiCloudRealTime.registerOnMsgListener(this);
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoMarkerClickListener(PushDataType.TYPE_PUSH_CAMERA_DATA, marker -> {
//点击的marker的具体数据
if (mCloudRoadData != null && !TextUtils.isEmpty(mCloudRoadData.getRtmpUrl())) {
CameraLiveManager.getInstance().init(mCloudRoadData);
} else {
Logger.e(TAG, " onMarkerClicked mCloudRoadData == null ");
TipToast.shortTip("直播流地址为空");
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoMarkerClickListener(PushDataType.TYPE_PUSH_CAMERA_DATA, new IMogoMarkerClickListener() {
@Override
public boolean onMarkerClicked(IMogoMarker marker) {
//点击的marker的具体数据
if (mCloudRoadData != null && !TextUtils.isEmpty(mCloudRoadData.getRtmpUrl())) {
CameraLiveManager.getInstance().init(mCloudRoadData);
} else {
Logger.e(TAG, " onMarkerClicked mCloudRoadData == null ");
TipToast.shortTip("直播流地址为空");
}
return false;
}
return false;
});
// loadMarker(false);
@@ -182,12 +185,12 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
@Override
public void onMsgSend(long id) {
Logger.d(TAG, "onMsgSend id : " + id);
//Logger.d(TAG, "onMsgSend id : " + id);
}
@Override
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
Logger.d(TAG, "onMsgReceived mogoSnapshotSetData " + mogoSnapshotSetData);
//Logger.d(TAG, "onMsgReceived mogoSnapshotSetData " + mogoSnapshotSetData);
renderMarker(mogoSnapshotSetData);
}
}

View File

@@ -30,7 +30,7 @@
android:id="@+id/fl_speed"
android:layout_width="@dimen/dp_300"
android:layout_height="@dimen/dp_300"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/yi_biao_pan_bg_nor"
android:elevation="@dimen/dp_10"

View File

@@ -1 +0,0 @@
/build

View File

@@ -1 +0,0 @@
# GPS 轨迹模拟接口 Debug 实现

View File

@@ -1,55 +0,0 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation "org.java-websocket:Java-WebSocket:1.4.0"
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.gpssimulator
implementation rootProject.ext.dependencies.mogoserviceapi
} else {
implementation project(':foudations:mogo-utils')
implementation project(":foudations:mogo-commons")
implementation project(':modules:mogo-module-gps-simulator')
implementation project(':services:mogo-service-api')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,2 +0,0 @@
#-----GPS-DEBUG-SIMULATOR-----
-keep class com.mogo.module.gps.simulator.CationVo.*{*;}

View File

@@ -1,3 +0,0 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-gps-simulator-debug
VERSION_CODE=1

View File

@@ -1,24 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-----GPS-DEBUG-SIMULATOR-----
-keep class com.mogo.module.gps.simulator.CationVo.*{*;}

View File

@@ -1,2 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.gps.simulator.debug" />

View File

@@ -1,134 +0,0 @@
package com.mogo.module.gps.simulator;
/**
* @author zyz
* 2020-04-08.
*/
public class CationVo {
/**
* vehicleSpeed : 1.0
* instantSpeed : 1.0
* lon : 116.401615
* lat : 39.968812
* carStatus : 1
* direction : 267
* sn : ZD801C1928L00371
* locationTime : 1586339911534
* distance : 0.0
* adCode : 2
* cityCode : 3
* vehicleType : 0
*/
private float vehicleSpeed;
private double instantSpeed;
private double lon;
private double lat;
private int carStatus;
private int direction;
private String sn;
private long locationTime;
private double distance;
private String adCode;
private String cityCode;
private int vehicleType;
public float getVehicleSpeed() {
return vehicleSpeed;
}
public void setVehicleSpeed( float vehicleSpeed ) {
this.vehicleSpeed = vehicleSpeed;
}
public double getInstantSpeed() {
return instantSpeed;
}
public void setInstantSpeed( double instantSpeed ) {
this.instantSpeed = instantSpeed;
}
public double getLon() {
return lon;
}
public void setLon( double lon ) {
this.lon = lon;
}
public double getLat() {
return lat;
}
public void setLat( double lat ) {
this.lat = lat;
}
public int getCarStatus() {
return carStatus;
}
public void setCarStatus( int carStatus ) {
this.carStatus = carStatus;
}
public int getDirection() {
return direction;
}
public void setDirection( int direction ) {
this.direction = direction;
}
public String getSn() {
return sn;
}
public void setSn( String sn ) {
this.sn = sn;
}
public long getLocationTime() {
return locationTime;
}
public void setLocationTime( long locationTime ) {
this.locationTime = locationTime;
}
public double getDistance() {
return distance;
}
public void setDistance( double distance ) {
this.distance = distance;
}
public String getAdCode() {
return adCode;
}
public void setAdCode( String adCode ) {
this.adCode = adCode;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode( String cityCode ) {
this.cityCode = cityCode;
}
public int getVehicleType() {
return vehicleType;
}
public void setVehicleType( int vehicleType ) {
this.vehicleType = vehicleType;
}
}

View File

@@ -1,46 +0,0 @@
package com.mogo.module.gps.simulator;
import com.mogo.utils.logger.Logger;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.drafts.Draft_6455;
import org.java_websocket.handshake.ServerHandshake;
import java.net.URI;
/**
* @author zyz
* 2020-04-07.
*/
public class JWebSocketClient extends WebSocketClient {
public JWebSocketClient( URI serverUri ) {
super( serverUri, new Draft_6455() );
}
@Override
public void onOpen( ServerHandshake handshakedata ) {
Logger.d( "JWebSocketClient", "onOpen()" );
bindSN();
}
private void bindSN() {
String data = String.format( "{ \"sn\": \"%s\", \"bind\": true }", Utils.getSn() );
send( data );
}
@Override
public void onMessage( String message ) {
Logger.e( "JWebSocketClient", "onMessage()" );
}
@Override
public void onClose( int code, String reason, boolean remote ) {
Logger.d( "JWebSocketClient", "onClose()" );
}
@Override
public void onError( Exception ex ) {
Logger.d( "JWebSocketClient", "onError()" );
}
}

View File

@@ -1,37 +0,0 @@
package com.mogo.module.gps.simulator;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.utils.UiThreadHandler;
/**
* @author congtaowang
* @since 2020-04-13
* <p>
* 描述
*/
@Route( path = GpsSimulatorConstants.API_PATH )
public class MogoGpsSimulatorManagerDebug implements IMogoGpsSimulatorManager {
private static final String TAG = "MogoGpsSimulatorManagerDebug";
@Override
public void open() {
WebSocketManager.getInstance().connect();
}
@Override
public void close() {
WebSocketManager.getInstance().disConnect();
UiThreadHandler.postDelayed( () -> {
WebSocketManager.destroy();
}, 1_000L );
}
@Override
public void init( Context context ) {
}
}

View File

@@ -1,50 +0,0 @@
package com.mogo.module.gps.simulator;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.utils.storage.SharedPrefsMgr;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Created by congtaowang on 2018/3/29.
*/
class Utils {
public static final String GET = "get";
public static final String GSM_SERIAL = "gsm.serial";
public static final String FOTA_VERSION = "ro.fota.version";
public static final String PROPERTIES = "android.os.SystemProperties";
public static String getSn() {
if ( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE ) {
return SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).getString( "allocated_sn" );
}
return getSystemProperties( GSM_SERIAL );
}
public static String getFotaVersion() {
return getSystemProperties( FOTA_VERSION );
}
public static String getSystemProperties( String name ) {
String value = "";
try {
Class< ? > c = Class.forName( PROPERTIES );
Method get = c.getMethod( GET, String.class );
value = ( String ) get.invoke( c, name );
} catch ( ClassNotFoundException var3 ) {
var3.printStackTrace();
} catch ( NoSuchMethodException var4 ) {
var4.printStackTrace();
} catch ( InvocationTargetException var5 ) {
var5.printStackTrace();
} catch ( IllegalAccessException var6 ) {
var6.printStackTrace();
}
return value;
}
}

View File

@@ -1,166 +0,0 @@
package com.mogo.module.gps.simulator;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import org.java_websocket.handshake.ServerHandshake;
import org.json.JSONObject;
import java.net.URI;
import java.util.Iterator;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @author zyz
* 2020-04-07.
*/
public class WebSocketManager {
private static final String TAG = "WebSocketManager";
private static Object sLock = new Object();
private static WebSocketManager sWebSocketManager;
private IMogoNavi mNavi;
private JWebSocketClient mClient;
private URI mUri;
private IMogoServiceApis mServiceApis;
private ExecutorService mService;
public static WebSocketManager getInstance() {
if ( sWebSocketManager == null ) {
synchronized ( sLock ) {
if ( sWebSocketManager == null ) {
sWebSocketManager = new WebSocketManager();
}
}
}
return sWebSocketManager;
}
private WebSocketManager() {
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
mNavi = mServiceApis.getMapServiceApi().getNavi( AbsMogoApplication.getApp() );
mUri = URI.create( "ws://152.136.10.223:4001/realtimeLocations-ws" );
mClient = new JWebSocketClient( mUri ) {
@Override
public void onMessage( String message ) {
try {
parseMessage( message );
} catch ( Exception e ) {
Logger.e( TAG, e, "error." );
}
}
@Override
public void onOpen( ServerHandshake handshakedata ) {
super.onOpen( handshakedata );
UiThreadHandler.post( () -> {
TipToast.shortTip( "模拟GPS开启成功" );
mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() ).stop();
} );
}
@Override
public void onClose( int code, String reason, boolean remote ) {
super.onClose( code, reason, remote );
UiThreadHandler.post( () -> {
TipToast.shortTip( "模拟GPS关闭成功" );
mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() ).start();
} );
shutdownServiceQuietly();
}
};
initThreadService();
}
private void parseMessage( String jsonStr ) throws Exception {
//message就是接收到的消息
Logger.d( TAG, jsonStr );
JSONObject jsonObject = new JSONObject( jsonStr );
if ( jsonObject.has( "detailMsg" ) ) {
Logger.d( TAG, "绑定成功" );
} else if ( jsonObject.has( "realTimeLocationVo" ) ) {
Logger.d( TAG, "收到定位消息" );
CationVo realTimeLocationVo = GsonUtil.objectFromJson( jsonObject.getString( "realTimeLocationVo" ), CationVo.class );
UiThreadHandler.post( () -> {
mNavi.setExtraGPSData(
realTimeLocationVo.getLon(),
realTimeLocationVo.getLat(),
realTimeLocationVo.getVehicleSpeed(),
1,
realTimeLocationVo.getDirection(),
realTimeLocationVo.getLocationTime()
);
Iterator< IMogoLocationListener > listeners = mServiceApis.getRegisterCenterApi().getLocationListeners();
MogoLocation location = new MogoLocation();
location.setLatitude( realTimeLocationVo.getLat() );
location.setLongitude( realTimeLocationVo.getLon() );
location.setSpeed( realTimeLocationVo.getVehicleSpeed() );
location.setAccuracy( 1 );
location.setTime( realTimeLocationVo.getLocationTime() );
if ( listeners != null ) {
while ( listeners.hasNext() ) {
listeners.next().onLocationChanged( location );
}
}
} );
}
}
public void connect() {
if ( mClient == null ) {
return;
}
mNavi.setUseExtraGPSData( true );
mService.execute( () -> {
try {
mClient.connectBlocking();
Logger.d( TAG, "connectBlocking done." );
} catch ( Exception e ) {
Logger.e( TAG, e, "error." );
}
} );
}
private void initThreadService() {
if ( mService == null || mService.isShutdown() ) {
mService = Executors.newSingleThreadExecutor();
}
}
public void disConnect() {
mNavi.setUseExtraGPSData( false );
mService.execute( () -> {
try {
mClient.closeBlocking();
Logger.d( TAG, "close done." );
} catch ( InterruptedException e ) {
Logger.e( TAG, e, "error." );
}
} );
}
public static void destroy() {
sWebSocketManager = null;
}
private void shutdownServiceQuietly() {
if ( mService != null && !mService.isShutdown() ) {
mService.shutdown();
}
mService = null;
}
}

Some files were not shown because too many files have changed in this diff Show More