[driver passenger ] 1、bus乘客屏小地图圈入自车位置 2、taxi乘客屏小地图设置四边距离,定位更新

This commit is contained in:
wangmingjun
2022-04-14 19:34:55 +08:00
parent da1ddb084b
commit 44802e6e18
6 changed files with 244 additions and 383 deletions

View File

@@ -198,6 +198,7 @@ public class BusPassengerMapDirectionView
for (int i = 0; i < mLinePointsLatLng.size(); i++) {
boundsBuilder.include(mLinePointsLatLng.get(i));
}
boundsBuilder.include(currentLatLng);
//第二个参数为四周留空宽度
mAMap.animateCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100));

View File

@@ -565,7 +565,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp routeList) {
if (null != routeList && routeList.getWayPointsList().size() > 0){
calculateRouteLineSum(TPCoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext,routeList.getWayPointsList()));
mAutopilotPlanningCallback.routeResult(routeList.getWayPointsList());
updateRouteResult(routeList.getWayPointsList());
}
}
@@ -584,6 +584,11 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
}
};
public void updateRouteResult(List<MessagePad.Location> models){
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routeResult(models);
}
}
/**
* 导航订单起点到终点 获得剩余时间,里程,预计到达时间
*/

View File

@@ -179,14 +179,6 @@ public class TaxiPassengerMapDirectionView
}
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
//更新车辆位置
if (mCarMarker != null) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "location.getBearing() = " + location.getBearing());
mCarMarker.setRotateAngle(360 - location.getBearing());
mCarMarker.setPosition(currentLatLng);
mCarMarker.setToTop();
}
if (mCoordinatesLatLng.size() > 1) {
//圈定地图显示范围
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
@@ -195,7 +187,7 @@ public class TaxiPassengerMapDirectionView
boundsBuilder.include(currentLatLng);
boundsBuilder.include(endLatLng);
//第二个参数为四周留空宽度
mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(), 100));
mAMap.animateCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 100,100,100,100));
} else {
//设置希望展示的地图缩放级别
@@ -203,6 +195,13 @@ public class TaxiPassengerMapDirectionView
.target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
mAMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
//更新车辆位置
if (mCarMarker != null) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "location.getBearing() = " + location.getBearing());
mCarMarker.setRotateAngle(360 - location.getBearing());
mCarMarker.setPosition(currentLatLng);
mCarMarker.setToTop();
}
}
@Override

View File

@@ -30,6 +30,7 @@ import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
import com.mogo.och.taxi.passenger.model.TaxiPassengerNaviToDestinationModel;
import com.mogo.och.taxi.passenger.presenter.TaxiPassengerServingOrderPresenter;
import com.mogo.och.taxi.passenger.utils.TPRouteDataTestUtils;
import com.mogo.och.taxi.passenger.utils.TaxiPassengerUtils;
import org.json.JSONArray;
@@ -121,197 +122,7 @@ public class TaxiPassengerServingOrderFragment extends
mTPOrderStatus.setOnLongClickListener(new View.OnLongClickListener() { //测试用
@Override
public boolean onLongClick(View v) {
String listStr = "{\"models\":[{\n" +
"\t\t\"lat\": 40.19927810144466,\n" +
"\t\t\"lon\": 116.73527259387767\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19927836356079,\n" +
"\t\t\"lon\": 116.73513114732762\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19927759500293,\n" +
"\t\t\"lon\": 116.73497660879111\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199264819842284,\n" +
"\t\t\"lon\": 116.73480063747202\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992510141554,\n" +
"\t\t\"lon\": 116.73463922037767\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199245872804,\n" +
"\t\t\"lon\": 116.73445960685193\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924673374912,\n" +
"\t\t\"lon\": 116.73427704009703\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924747108264,\n" +
"\t\t\"lon\": 116.7340707102972\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924828745573,\n" +
"\t\t\"lon\": 116.73385916927226\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924941093133,\n" +
"\t\t\"lon\": 116.73364048294795\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924939253381,\n" +
"\t\t\"lon\": 116.73340837408566\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924949105934,\n" +
"\t\t\"lon\": 116.73317368725336\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19925040039033,\n" +
"\t\t\"lon\": 116.73296532811216\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992515355653,\n" +
"\t\t\"lon\": 116.73277787366743\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992512720328,\n" +
"\t\t\"lon\": 116.73263377253741\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199205174954606,\n" +
"\t\t\"lon\": 116.73249773114644\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1991015743076,\n" +
"\t\t\"lon\": 116.7324219601283\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.198971862686285,\n" +
"\t\t\"lon\": 116.73239393296355\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19883883071582,\n" +
"\t\t\"lon\": 116.73237676435652\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19870171355796,\n" +
"\t\t\"lon\": 116.73236052150362\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1985491853193,\n" +
"\t\t\"lon\": 116.73234157857011\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1983890047355,\n" +
"\t\t\"lon\": 116.73232167996464\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1982209877466,\n" +
"\t\t\"lon\": 116.73230101645792\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.198037574138326,\n" +
"\t\t\"lon\": 116.73227735486083\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19787327856243,\n" +
"\t\t\"lon\": 116.73225676816314\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19771917207499,\n" +
"\t\t\"lon\": 116.73223814728027\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197548305175935,\n" +
"\t\t\"lon\": 116.73221624705808\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19739568979691,\n" +
"\t\t\"lon\": 116.73219618210774\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19724703821575,\n" +
"\t\t\"lon\": 116.73217598293311\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1970956560885,\n" +
"\t\t\"lon\": 116.73215773721505\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19697703483188,\n" +
"\t\t\"lon\": 116.73214337172284\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19687000725696,\n" +
"\t\t\"lon\": 116.73210037067965\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.196833449601726,\n" +
"\t\t\"lon\": 116.73196646708011\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19685833847804,\n" +
"\t\t\"lon\": 116.73181315361103\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.196889170203264,\n" +
"\t\t\"lon\": 116.73164355747393\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19692242860347,\n" +
"\t\t\"lon\": 116.7314555399657\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19696431701069,\n" +
"\t\t\"lon\": 116.7312261834129\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19700025925464,\n" +
"\t\t\"lon\": 116.73102774016093\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19703414798773,\n" +
"\t\t\"lon\": 116.73084270562073\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19707287604138,\n" +
"\t\t\"lon\": 116.73062835248406\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19710951629977,\n" +
"\t\t\"lon\": 116.73041744082339\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19714593807105,\n" +
"\t\t\"lon\": 116.73021414314803\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197183297026285,\n" +
"\t\t\"lon\": 116.7300057066447\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1972247359487,\n" +
"\t\t\"lon\": 116.7297751515664\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19726518822745,\n" +
"\t\t\"lon\": 116.72954958923812\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19730538240706,\n" +
"\t\t\"lon\": 116.72932440756041\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19734272112662,\n" +
"\t\t\"lon\": 116.72911631453036\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197379191549075,\n" +
"\t\t\"lon\": 116.72890982812105\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197417565369314,\n" +
"\t\t\"lon\": 116.72869447869044\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19746052080799,\n" +
"\t\t\"lon\": 116.72845641541247\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19750040582118,\n" +
"\t\t\"lon\": 116.72823569991117\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19753999704064,\n" +
"\t\t\"lon\": 116.72801998373052\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19757796882569,\n" +
"\t\t\"lon\": 116.72781280504363\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197617062364586,\n" +
"\t\t\"lon\": 116.72759949431683\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19765391602761,\n" +
"\t\t\"lon\": 116.72739776789756\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19768973009218,\n" +
"\t\t\"lon\": 116.72719980764646\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197726191028785,\n" +
"\t\t\"lon\": 116.72699719861669\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19776233489642,\n" +
"\t\t\"lon\": 116.72679516155276\n" +
"\t}]}\n";
List<MessagePad.Location> list = new ArrayList<>();
try {
JSONObject jsonObject = new JSONObject(listStr);
JSONArray jsonElements = jsonObject.getJSONArray("models");
for (int i = 0; i < jsonElements.length(); i++){
JSONObject s = jsonElements.getJSONObject(i);
MessagePad.Location.Builder routeModels = MessagePad.Location.newBuilder();
routeModels.setLatitude(s.getDouble("lat"));
routeModels.setLongitude(s.getDouble("lon"));
list.add(routeModels.build());
}
} catch (JSONException e) {
e.printStackTrace();
}
mPresenter.routeResult(list);
TPRouteDataTestUtils.converToRouteData();
return true;
}
});

File diff suppressed because one or more lines are too long