|
@ -331,7 +331,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
331
|
331
|
rela_paopao = (RelativeLayout) findViewById(R.id.rela_paopao);
|
332
|
332
|
ll_share_ui = (LinearLayout) findViewById(R.id.ll_share_ui);
|
333
|
333
|
|
334
|
|
|
335
|
334
|
iv_back = (ImageView) findViewById(R.id.iv_back);
|
336
|
335
|
iv_back.setOnClickListener(this);
|
337
|
336
|
tv_route_no1 = (TextView) findViewById(R.id.tv_route_no1);
|
|
@ -417,8 +416,7 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
417
|
416
|
aMapNavi.addAMapNaviListener(this);
|
418
|
417
|
aMapNavi.setUseInnerVoice(true);
|
419
|
418
|
MyLocationStyle myLocationStyle = new MyLocationStyle();
|
420
|
|
myLocationStyle.myLocationIcon(com.amap.api.maps.model.BitmapDescriptorFactory
|
421
|
|
.fromResource(R.drawable.point_icon));// 设置小蓝点的图标
|
|
419
|
myLocationStyle.myLocationIcon(com.amap.api.maps.model.BitmapDescriptorFactory.fromResource(R.drawable.point_icon));// 设置小蓝点的图标
|
422
|
420
|
amap.setMyLocationStyle(myLocationStyle);
|
423
|
421
|
//获得地图的最大和最小缩放级别
|
424
|
422
|
geocoderSearch = new GeocodeSearch(this);
|
|
@ -594,7 +592,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
594
|
592
|
OkHttpUtils.get().url(url).build().execute(new StringCallback() {
|
595
|
593
|
@Override
|
596
|
594
|
public void onError(Call call, Exception e) {
|
597
|
|
|
598
|
595
|
}
|
599
|
596
|
|
600
|
597
|
@Override
|
|
@ -1015,42 +1012,34 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
1015
|
1012
|
|
1016
|
1013
|
@Override
|
1017
|
1014
|
public void notifyParallelRoad(int i) {
|
1018
|
|
|
1019
|
1015
|
}
|
1020
|
1016
|
|
1021
|
1017
|
@Override
|
1022
|
1018
|
public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos) {
|
1023
|
|
|
1024
|
1019
|
}
|
1025
|
1020
|
|
1026
|
1021
|
@Override
|
1027
|
1022
|
public void updateAimlessModeStatistics(AimLessModeStat aimLessModeStat) {
|
1028
|
|
|
1029
|
1023
|
}
|
1030
|
1024
|
|
1031
|
1025
|
@Override
|
1032
|
1026
|
public void updateAimlessModeCongestionInfo(AimLessModeCongestionInfo aimLessModeCongestionInfo) {
|
1033
|
|
|
1034
|
1027
|
}
|
1035
|
1028
|
|
1036
|
1029
|
@Override
|
1037
|
1030
|
public void onPlayRing(int i) {
|
1038
|
|
|
1039
|
1031
|
}
|
1040
|
1032
|
|
1041
|
1033
|
@Override
|
1042
|
1034
|
public void onCalculateRouteSuccess(AMapCalcRouteResult aMapCalcRouteResult) {
|
1043
|
|
|
1044
|
1035
|
}
|
1045
|
1036
|
|
1046
|
1037
|
@Override
|
1047
|
1038
|
public void onCalculateRouteFailure(AMapCalcRouteResult aMapCalcRouteResult) {
|
1048
|
|
|
1049
|
1039
|
}
|
1050
|
1040
|
|
1051
|
1041
|
@Override
|
1052
|
1042
|
public void onNaviRouteNotify(AMapNaviRouteNotifyData aMapNaviRouteNotifyData) {
|
1053
|
|
|
1054
|
1043
|
}
|
1055
|
1044
|
|
1056
|
1045
|
|
|
@ -1475,11 +1464,8 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
1475
|
1464
|
ll = new LatLng(Double.parseDouble(list.get(i).getPoi_wei()), Double.parseDouble(list.get(i).getPoi_jing()));
|
1476
|
1465
|
} else if (position <= 13) {
|
1477
|
1466
|
double dwei = Double.parseDouble(list.get(i).getPoi_wei());
|
1478
|
|
// System.out.print("wei:"+l.get(i).getPoi_wei());
|
1479
|
1467
|
double djing = Double.parseDouble(list.get(i).getPoi_jing());
|
1480
|
|
// System.out.println("jing:"+l.get(i).getPoi_jing());
|
1481
|
1468
|
getGaode(djing, dwei);
|
1482
|
|
|
1483
|
1469
|
ll = new LatLng(Double.parseDouble(gd_wei), Double.parseDouble(gd_jing));
|
1484
|
1470
|
}
|
1485
|
1471
|
if (String.valueOf(list.get(i).getId()).equals(p1) && !list.get(i).getSuit_car().equals("宝马") && !list.get(i).getSuit_car().equals("特斯拉")) {
|
|
@ -1761,8 +1747,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
1761
|
1747
|
//
|
1762
|
1748
|
@Override
|
1763
|
1749
|
public void onCameraChangeFinish(CameraPosition cameraPosition) {
|
1764
|
|
// LogUtils.e(currentMarker);
|
1765
|
|
LogUtils.e("onCameraChangeFinish");
|
1766
|
1750
|
if (canRefreshMarker == true) {
|
1767
|
1751
|
if (null != currentMarker) {
|
1768
|
1752
|
resetPreviousMarker(currentMarker);
|
|
@ -2332,7 +2316,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2332
|
2316
|
LatLng ll = new LatLng(Double.parseDouble(start_wei), Double.parseDouble(start_jing));
|
2333
|
2317
|
float distance = AMapUtils.calculateLineDistance(new LatLng(ll.latitude
|
2334
|
2318
|
, ll.longitude), marker.getPosition());
|
2335
|
|
// Toast.makeText(getApplicationContext(),Util.getDistance(d),Toast.LENGTH_SHORT).show();
|
2336
|
2319
|
mInfoWindowDistance.setText(Util.getDistance(distance));
|
2337
|
2320
|
//infowinow中站名称的显示
|
2338
|
2321
|
TextView mInfoWindowName = infoWindow.findViewById(R.id.evsdk_tv_info_name);
|
|
@ -2358,7 +2341,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2358
|
2341
|
routeTwo.clear();
|
2359
|
2342
|
routeThree.clear();
|
2360
|
2343
|
exchangeView(1);
|
2361
|
|
// if (list_zhong.size() <= 3) {
|
2362
|
2344
|
if (!zhan_id.equals(p1) && !zhan_id.equals(p2) && !zhan_id.equals(p3)) {
|
2363
|
2345
|
if (list_zhong.size() < 3) {
|
2364
|
2346
|
zhan = new Zhan();
|
|
@ -2372,13 +2354,9 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2372
|
2354
|
list_zhong.add(zhan);
|
2373
|
2355
|
Log.e("size===", list_zhong.size() + "");
|
2374
|
2356
|
if (list_zhong.size() > 0) {
|
2375
|
|
// tv_navigation_route.setBackgroundResource(R.drawable.bg_route_btn_green);
|
2376
|
|
// tv_save_route.setBackgroundResource(R.drawable.bg_route_btn_green);
|
2377
|
2357
|
canRoute = true;
|
2378
|
2358
|
canSave = true;
|
2379
|
2359
|
} else {
|
2380
|
|
// tv_navigation_route.setBackgroundResource(R.drawable.bg_route_btn_grey);
|
2381
|
|
// tv_save_route.setBackgroundResource(R.drawable.bg_route_btn_grey);
|
2382
|
2360
|
canRoute = false;
|
2383
|
2361
|
canSave = false;
|
2384
|
2362
|
}
|
|
@ -2422,13 +2400,9 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2422
|
2400
|
}
|
2423
|
2401
|
}
|
2424
|
2402
|
if (list_zhong.size() > 0) {
|
2425
|
|
// tv_navigation_route.setBackgroundResource(R.drawable.bg_route_btn_green);
|
2426
|
|
// tv_save_route.setBackgroundResource(R.drawable.bg_route_btn_green);
|
2427
|
2403
|
canRoute = true;
|
2428
|
2404
|
canSave = true;
|
2429
|
2405
|
} else {
|
2430
|
|
// tv_navigation_route.setBackgroundResource(R.drawable.bg_route_btn_grey);
|
2431
|
|
// tv_save_route.setBackgroundResource(R.drawable.bg_route_btn_grey);
|
2432
|
2406
|
canRoute = false;
|
2433
|
2407
|
canSave = false;
|
2434
|
2408
|
}
|
|
@ -2456,15 +2430,10 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2456
|
2430
|
}
|
2457
|
2431
|
if (strategyFlag >= 0) {
|
2458
|
2432
|
aMapNavi.calculateDriveRoute(startList, endList, zhongList, strategyFlag);
|
2459
|
|
// Toast.makeText(getApplicationContext(), "策略:" + strategyFlag, Toast.LENGTH_LONG).show();
|
2460
|
2433
|
}
|
2461
|
|
// aMapNavi.calculateDriveRoute(startList, endList, zhongList, PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES);
|
2462
|
2434
|
dialog.show();
|
2463
|
2435
|
|
2464
|
2436
|
}
|
2465
|
|
// }else {
|
2466
|
|
// Toast.makeText(getApplicationContext(),"您已经选择了三个途经点",Toast.LENGTH_SHORT).show();
|
2467
|
|
// }
|
2468
|
2437
|
}
|
2469
|
2438
|
});
|
2470
|
2439
|
LinearLayout mInfoWindow = infoWindow.findViewById(R.id.evsdk_rl_infowindow);
|
|
@ -2585,8 +2554,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2585
|
2554
|
}
|
2586
|
2555
|
|
2587
|
2556
|
private void getGaode(Double jing, Double wei) {
|
2588
|
|
// Log.e("jing", jing + "");
|
2589
|
|
// Log.e("wei", wei + "");
|
2590
|
2557
|
double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
|
2591
|
2558
|
double gg_lon;
|
2592
|
2559
|
double gg_lat;
|
|
@ -2595,10 +2562,8 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2595
|
2562
|
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
|
2596
|
2563
|
gg_lon = z * Math.cos(theta);
|
2597
|
2564
|
gd_jing = String.valueOf(gg_lon);
|
2598
|
|
// Log.e("gg_lon", gg_lon + "");
|
2599
|
2565
|
gg_lat = z * Math.sin(theta);
|
2600
|
2566
|
gd_wei = String.valueOf(gg_lat);
|
2601
|
|
// Log.e("gg_lat", gg_lat + "");
|
2602
|
2567
|
}
|
2603
|
2568
|
|
2604
|
2569
|
private void showSimpleBottomSheetGrid() {
|
|
@ -2627,7 +2592,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2627
|
2592
|
}
|
2628
|
2593
|
}
|
2629
|
2594
|
}).build();
|
2630
|
|
// build.
|
2631
|
2595
|
build.show();
|
2632
|
2596
|
iv_screenShot.setEnabled(true);
|
2633
|
2597
|
}
|
|
@ -2652,10 +2616,7 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2652
|
2616
|
return;
|
2653
|
2617
|
}
|
2654
|
2618
|
try {
|
2655
|
|
FileOutputStream fos = new FileOutputStream(
|
2656
|
|
Environment.getExternalStorageDirectory() + "/test_"
|
2657
|
|
+ sdf.format(new Date()) + ".png");
|
2658
|
|
boolean b = bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
|
|
2619
|
FileOutputStream fos = new FileOutputStream(Environment.getExternalStorageDirectory() + "/test_" + sdf.format(new Date()) + ".png");
|
2659
|
2620
|
try {
|
2660
|
2621
|
fos.flush();
|
2661
|
2622
|
} catch (IOException e) {
|
|
@ -2666,14 +2627,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2666
|
2627
|
} catch (IOException e) {
|
2667
|
2628
|
e.printStackTrace();
|
2668
|
2629
|
}
|
2669
|
|
StringBuffer buffer = new StringBuffer();
|
2670
|
|
if (b) {
|
2671
|
|
// buffer.append("截屏成功 ");
|
2672
|
|
|
2673
|
|
} else {
|
2674
|
|
// buffer.append("截屏失败 ");
|
2675
|
|
}
|
2676
|
|
|
2677
|
2630
|
|
2678
|
2631
|
} catch (FileNotFoundException e) {
|
2679
|
2632
|
e.printStackTrace();
|
|
@ -2807,10 +2760,7 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2807
|
2760
|
float scaleHeight = ((float) newHeight) / height;
|
2808
|
2761
|
// 缩放图片动作
|
2809
|
2762
|
matrix.postScale(scaleWidth, scaleHeight);
|
2810
|
|
Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, (int) width,
|
2811
|
|
(int) height, matrix, true);
|
2812
|
|
// iv_2.setImageBitmap(bitmap);
|
2813
|
|
// tv_2.setText(bitmap.getRowBytes() * bitmap.getHeight() + "");
|
|
2763
|
Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, (int) width, (int) height, matrix, true);
|
2814
|
2764
|
return bitmap;
|
2815
|
2765
|
}
|
2816
|
2766
|
|
|
@ -2845,8 +2795,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2845
|
2795
|
e.printStackTrace();
|
2846
|
2796
|
}
|
2847
|
2797
|
mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
|
2848
|
|
Log.e("!!!", "下载图片");
|
2849
|
|
// Toast.makeText(RoutePlanMapActivity.this,"保存成功",Toast.LENGTH_SHORT).show();
|
2850
|
2798
|
try {
|
2851
|
2799
|
fOut.flush();
|
2852
|
2800
|
} catch (IOException e) {
|
|
@ -2869,8 +2817,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2869
|
2817
|
if (list != null && list.size() > 0) {
|
2870
|
2818
|
if (amap == null)
|
2871
|
2819
|
return;
|
2872
|
|
// LatLngBounds bounds = LatLngBounds.builder().include(new LatLng(boundArray[1], boundArray[0])).include(new LatLng(boundArray[3], boundArray[2])).build();
|
2873
|
|
// amap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 10));
|
2874
|
2820
|
}
|
2875
|
2821
|
}
|
2876
|
2822
|
|
|
@ -2894,9 +2840,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2894
|
2840
|
if (i == 1000) {
|
2895
|
2841
|
if (result != null && result.getRegeocodeAddress() != null
|
2896
|
2842
|
&& result.getRegeocodeAddress().getFormatAddress() != null) {
|
2897
|
|
// tv_address.setText(result.getRegeocodeAddress().getFormatAddress());
|
2898
|
|
// tv_name.setText("[当前位置]");
|
2899
|
|
// rl_now.setClickable(true);
|
2900
|
2843
|
pl = result.getRegeocodeAddress().getPois();
|
2901
|
2844
|
if (tag.equals("start")) {
|
2902
|
2845
|
tv_start.setText(pl.get(0).getTitle());
|
|
@ -2905,12 +2848,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2905
|
2848
|
tv_end.setText(pl.get(0).getTitle());
|
2906
|
2849
|
save_end_name = pl.get(0).getTitle();
|
2907
|
2850
|
}
|
2908
|
|
|
2909
|
|
// adapter = new RouteSelectPointActivity.POIAdapter();
|
2910
|
|
// list_poi.setAdapter(adapter);
|
2911
|
|
// list_poi.setEnabled(true);
|
2912
|
|
|
2913
|
|
|
2914
|
2851
|
}
|
2915
|
2852
|
}
|
2916
|
2853
|
}
|
|
@ -2926,7 +2863,7 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2926
|
2863
|
OkHttpUtils.get().url(url).build().execute(new StringCallback() {
|
2927
|
2864
|
@Override
|
2928
|
2865
|
public void onError(Call call, Exception e) {
|
2929
|
|
|
|
2866
|
e.printStackTrace();
|
2930
|
2867
|
}
|
2931
|
2868
|
|
2932
|
2869
|
@Override
|
|
@ -2967,7 +2904,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
2967
|
2904
|
|
2968
|
2905
|
@Override
|
2969
|
2906
|
public void onResponse(String response) {
|
2970
|
|
// Log.e(TAG, "onResponse: response="+response );
|
2971
|
2907
|
}
|
2972
|
2908
|
});
|
2973
|
2909
|
}
|
|
@ -3037,13 +2973,7 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
3037
|
2973
|
|
3038
|
2974
|
//必须告诉AMapNavi 你最后选择的哪条路
|
3039
|
2975
|
aMapNavi.selectRouteId(routeIds[routeNum - 1]);
|
3040
|
|
// Toast.makeText(this, "导航距离:" + (aMapNavi.getNaviPaths()).get(routeIds[0]).getAllLength() + "m" + "\n" + "导航时间:" + (aMapNavi.getNaviPaths()).get(routeIds[0]).getAllTime() + "s", Toast.LENGTH_SHORT).show();
|
3041
|
|
// Toast.makeText(this, "导航时间:" + (aMapNavi.getNaviPaths()).get(routeIds[2]).getStrategy() + "z", Toast.LENGTH_SHORT).show();
|
3042
|
2976
|
final List<NaviLatLng> nlll = (aMapNavi.getNaviPaths()).get(routeIds[routeNum - 1]).getCoordList();
|
3043
|
|
|
3044
|
|
// Toast.makeText(this, (aMapNavi.getNaviPaths()).get(routeIds[2]).getStrategy(), Toast.LENGTH_SHORT).show();
|
3045
|
|
|
3046
|
|
|
3047
|
2977
|
routeIndex++;
|
3048
|
2978
|
|
3049
|
2979
|
chooseRouteSuccess = true;
|
|
@ -3065,7 +2995,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
|
3065
|
2995
|
final zhan_list markerInfo = (zhan_list) bundle.getSerializable("info");
|
3066
|
2996
|
View infoWindow = getLayoutInflater().inflate(R.layout.evsdk_layout_infowindow, null);
|
3067
|
2997
|
getZhanInfo(String.valueOf(markerInfo.getId()), markerInfo, marker, infoWindow);
|
3068
|
|
// routeShowPresenter.getSingleZhanInfo(String.valueOf(markerInfo.getId()), BaseConstants.DENZA_VERSION, infoWindow, marker);
|
3069
|
2998
|
try {
|
3070
|
2999
|
Thread.sleep(300);
|
3071
|
3000
|
} catch (InterruptedException e) {
|