Java Code Examples for com.amap.api.maps.model.LatLngBounds#Builder
The following examples show how to use
com.amap.api.maps.model.LatLngBounds#Builder .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RouteDistanceActivity.java From TraceByAmap with MIT License | 6 votes |
@Override public void onMapLoaded() { //展示出所有点 LatLngBounds.Builder builder = new LatLngBounds.Builder(); builder.include(AMapUtil.convertToLatLng(start0)); builder.include(AMapUtil.convertToLatLng(start1)); builder.include(AMapUtil.convertToLatLng(start2)); builder.include(AMapUtil.convertToLatLng(start3)); builder.include(AMapUtil.convertToLatLng(dest)); aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 100)); distanceSearch = new DistanceSearch(this); distanceSearch.setDistanceSearchListener(this); searchDistanceResult(DistanceSearch.TYPE_DRIVING_DISTANCE); }
Example 2
Source File: PoiOverlay.java From TraceByAmap with MIT License | 5 votes |
private LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); for (int i = 0; i < mPois.size(); i++) { b.include(new LatLng(mPois.get(i).getLatLonPoint().getLatitude(), mPois.get(i).getLatLonPoint().getLongitude())); } return b.build(); }
Example 3
Source File: BusLineOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
private LatLngBounds getLatLngBounds(List<LatLonPoint> coordin) { LatLngBounds.Builder b = LatLngBounds.builder(); for (int i = 0; i < coordin.size(); i++) { b.include(new LatLng(coordin.get(i).getLatitude(), coordin.get(i) .getLongitude())); } return b.build(); }
Example 4
Source File: PoiOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
private LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); for (int i = 0; i < mPois.size(); i++) { b.include(new LatLng(mPois.get(i).getLatLonPoint().getLatitude(), mPois.get(i).getLatLonPoint().getLongitude())); } return b.build(); }
Example 5
Source File: DrivingRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
@Override protected LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); b.include(new LatLng(startPoint.latitude, startPoint.longitude)); b.include(new LatLng(endPoint.latitude, endPoint.longitude)); if (this.throughPointList != null && this.throughPointList.size() > 0) { for (int i = 0; i < this.throughPointList.size(); i++) { b.include(new LatLng( this.throughPointList.get(i).getLatitude(), this.throughPointList.get(i).getLongitude())); } } return b.build(); }
Example 6
Source File: BusLineOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
private LatLngBounds getLatLngBounds(List<LatLonPoint> coordin) { LatLngBounds.Builder b = LatLngBounds.builder(); for (int i = 0; i < coordin.size(); i++) { b.include(new LatLng(coordin.get(i).getLatitude(), coordin.get(i) .getLongitude())); } return b.build(); }
Example 7
Source File: PoiOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
private LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); for (int i = 0; i < mPois.size(); i++) { b.include(new LatLng(mPois.get(i).getLatLonPoint().getLatitude(), mPois.get(i).getLatLonPoint().getLongitude())); } return b.build(); }
Example 8
Source File: DrivingRouteOverlay.java From TraceByAmap with MIT License | 5 votes |
@Override protected LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); b.include(new LatLng(startPoint.latitude, startPoint.longitude)); b.include(new LatLng(endPoint.latitude, endPoint.longitude)); if (this.throughPointList != null && this.throughPointList.size() > 0) { for (int i = 0; i < this.throughPointList.size(); i++) { b.include(new LatLng( this.throughPointList.get(i).getLatitude(), this.throughPointList.get(i).getLongitude())); } } return b.build(); }
Example 9
Source File: DrivingRouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
@Override protected LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); b.include(new LatLng(startPoint.latitude, startPoint.longitude)); b.include(new LatLng(endPoint.latitude, endPoint.longitude)); if (this.throughPointList != null && this.throughPointList.size() > 0) { for (int i = 0; i < this.throughPointList.size(); i++) { b.include(new LatLng( this.throughPointList.get(i).getLatitude(), this.throughPointList.get(i).getLongitude())); } } return b.build(); }
Example 10
Source File: PoiAroundSearchActivity.java From TraceByAmap with MIT License | 5 votes |
private LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); if(mPois != null) { int size = mPois.size(); for (int i = 0; i < size; i++) { b.include(new LatLng(mPois.get(i).getLatLonPoint().getLatitude(), mPois.get(i).getLatLonPoint().getLongitude())); } } return b.build(); }
Example 11
Source File: TruckRouteColorfulOverLay.java From TraceByAmap with MIT License | 5 votes |
@Override protected LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); b.include(new LatLng(startPoint.latitude, startPoint.longitude)); b.include(new LatLng(endPoint.latitude, endPoint.longitude)); if (this.throughPointList != null && this.throughPointList.size() > 0) { for (int i = 0; i < this.throughPointList.size(); i++) { b.include(new LatLng( this.throughPointList.get(i).getLatitude(), this.throughPointList.get(i).getLongitude())); } } return b.build(); }
Example 12
Source File: MainActivity.java From android-cluster-marker with Apache License 2.0 | 5 votes |
@Override public void onClick(Marker marker, List<ClusterItem> clusterItems) { LatLngBounds.Builder builder = new LatLngBounds.Builder(); for (ClusterItem clusterItem : clusterItems) { builder.include(clusterItem.getPosition()); } LatLngBounds latLngBounds = builder.build(); mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds, 0) ); }
Example 13
Source File: RoutePOIActivity.java From TraceByAmap with MIT License | 5 votes |
private LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); for (int i = 0; i < mPois.size(); i++) { b.include(new LatLng(mPois.get(i).getPoint().getLatitude(), mPois.get(i).getPoint().getLongitude())); } return b.build(); }
Example 14
Source File: CloudOverlay.java From TraceByAmap with MIT License | 5 votes |
private LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); for (int i = 0; i < mPois.size(); i++) { b.include(new LatLng(mPois.get(i).getLatLonPoint().getLatitude(), mPois.get(i).getLatLonPoint().getLongitude())); } return b.build(); }
Example 15
Source File: RecordShowActivity.java From RecordPath3D with Apache License 2.0 | 5 votes |
private LatLngBounds getBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); if (mOriginLatLngList == null) { return b.build(); } for (int i = 0; i < mOriginLatLngList.size(); i++) { b.include(mOriginLatLngList.get(i)); } return b.build(); }
Example 16
Source File: ShareActivity.java From TraceByAmap with MIT License | 5 votes |
/** * 添加线路marker */ private void addRouteMarker() { mAMap.clear(); addMarker(START.getLatitude(), START.getLongitude(), "", "", BitmapDescriptorFactory.fromResource(R.drawable.start)); addMarker(END.getLatitude(), END.getLongitude(), "", "", BitmapDescriptorFactory.fromResource(R.drawable.end)); LatLngBounds.Builder builder = LatLngBounds.builder(); builder.include(new LatLng(START.getLatitude(), START.getLongitude())); builder.include(new LatLng(END.getLatitude(), END.getLongitude())); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 50)); }
Example 17
Source File: TrafficActivity.java From TraceByAmap with MIT License | 4 votes |
@Override public void onRoadTrafficSearched(TrafficStatusResult roadTrafficResult, int errorCode) { Log.e("amap", "===>>>> result code " + errorCode); dissmissProgressDialog();// 隐藏对话框 aMap.clear(); LatLngBounds.Builder builder = new LatLngBounds.Builder(); for(TrafficStatusInfo trafficStatusInfo : roadTrafficResult.getRoads()) { List<LatLonPoint> list = trafficStatusInfo.getCoordinates(); if(list != null){ LatLonPoint latLonPoint = list.get(0); aMap.addText(new TextOptions().position(new LatLng(latLonPoint.getLatitude(), latLonPoint.getLongitude())).text(trafficStatusInfo.getName() + " " + trafficStatusInfo.getDirection())); List<LatLng> latLngs = new ArrayList<LatLng>(); for(LatLonPoint latLonPoint2 : list) { LatLng latLng = new LatLng(latLonPoint2.getLatitude(), latLonPoint2.getLongitude()); builder.include(latLng); latLngs.add(latLng); } int color = Color.GREEN; switch (Integer.parseInt(trafficStatusInfo.getStatus())) { case 0: { color = Color.GRAY; } break; case 1: { color = Color.GREEN; } break; case 2: { color = Color.YELLOW; } break; case 3: { color = Color.RED; } break; } aMap.addPolyline((new PolylineOptions()).addAll(latLngs).color(color)); } } LatLngBounds bounds = builder.build(); aMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds,10)); }
Example 18
Source File: RouteOverlay.java From BmapLite with GNU General Public License v3.0 | 4 votes |
protected LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); b.include(new LatLng(startPoint.latitude, startPoint.longitude)); b.include(new LatLng(endPoint.latitude, endPoint.longitude)); return b.build(); }
Example 19
Source File: RouteOverlay.java From BmapLite with Apache License 2.0 | 4 votes |
protected LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); b.include(new LatLng(startPoint.latitude, startPoint.longitude)); b.include(new LatLng(endPoint.latitude, endPoint.longitude)); return b.build(); }
Example 20
Source File: SmoothMoveActivity.java From TraceByAmap with MIT License | 4 votes |
/** * 开始移动 */ public void startMove(View view) { // if (mPolyline == null) { // ToastUtil.showShortToast(this, "请先设置路线"); // return; // } // 读取轨迹点 List<LatLng> points = readLatLngs(); // 构建 轨迹的显示区域 LatLngBounds.Builder builder = new LatLngBounds.Builder(); builder.include(points.get(0)); builder.include(points.get(points.size() - 2)); mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 50)); // 实例 MovingPointOverlay 对象 if(smoothMarker == null) { // 设置 平滑移动的 图标 marker = mAMap.addMarker(new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_car)).anchor(0.5f,0.5f)); smoothMarker = new MovingPointOverlay(mAMap, marker); } // 取轨迹点的第一个点 作为 平滑移动的启动 LatLng drivePoint = points.get(0); Pair<Integer, LatLng> pair = SpatialRelationUtil.calShortestDistancePoint(points, drivePoint); points.set(pair.first, drivePoint); List<LatLng> subList = points.subList(pair.first, points.size()); // 设置轨迹点 smoothMarker.setPoints(subList); // 设置平滑移动的总时间 单位 秒 smoothMarker.setTotalDuration(3); // 设置 自定义的InfoWindow 适配器 mAMap.setInfoWindowAdapter(infoWindowAdapter); // 显示 infowindow marker.showInfoWindow(); // 设置移动的监听事件 返回 距终点的距离 单位 米 smoothMarker.setMoveListener(new MovingPointOverlay.MoveListener() { @Override public void move(final double distance) { try { runOnUiThread(new Runnable() { @Override public void run() { if (infoWindowLayout != null && title != null) { title.setText("距离终点还有: " + (int) distance + "米"); } } }); } catch (Throwable e) { e.printStackTrace(); } } }); // 开始移动 smoothMarker.startSmoothMove(); }