com.amap.api.maps.model.LatLngBounds Java Examples
The following examples show how to use
com.amap.api.maps.model.LatLngBounds.
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: GeoFence_Nearby_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); removeMarkers(); }
Example #2
Source File: PoiOverlay.java From TraceByAmap with MIT License | 6 votes |
/** * 移动镜头到当前的视角。 * @since V2.1.0 */ public void zoomToSpan() { try{ if (mPois != null && mPois.size() > 0) { if (mAMap == null) return; if(mPois.size()==1){ mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(mPois.get(0).getLatLonPoint().getLatitude(), mPois.get(0).getLatLonPoint().getLongitude()), 18f)); }else{ LatLngBounds bounds = getLatLngBounds(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 5)); } } }catch(Throwable e){ e.printStackTrace(); } }
Example #3
Source File: GeoFence_District_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); }
Example #4
Source File: GeoFence_Keyword_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); }
Example #5
Source File: GeoFence_Nearby_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); removeMarkers(); }
Example #6
Source File: GeoFence_Polygon_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); polygonPoints.clear(); removeMarkers(); }
Example #7
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 #8
Source File: GeoFence_Multiple_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); polygonPoints.clear(); removeMarkers(); }
Example #9
Source File: GeoFence_District_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); }
Example #10
Source File: GeoFence_Keyword_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); }
Example #11
Source File: GeoFence_Polygon_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); polygonPoints.clear(); removeMarkers(); }
Example #12
Source File: GeoFence_Multiple_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
private void drawFence(GeoFence fence) { switch (fence.getType()) { case GeoFence.TYPE_ROUND : case GeoFence.TYPE_AMAPPOI : drawCircle(fence); break; case GeoFence.TYPE_POLYGON : case GeoFence.TYPE_DISTRICT : drawPolygon(fence); break; default : break; } // 设置所有maker显示在当前可视区域地图中 LatLngBounds bounds = boundsBuilder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150)); polygonPoints.clear(); removeMarkers(); }
Example #13
Source File: AMapViewManager.java From react-native-amap with MIT License | 6 votes |
@ReactProp(name = "region") public void setRegion(MapView mapView, @Nullable ReadableMap region) { if (region == null) return; AMap map = mapView.getMap(); Double lat = region.getDouble("latitude"); Double lng = region.getDouble("longitude"); Double lngDelta = region.getDouble("longitudeDelta"); Double latDelta = region.getDouble("latitudeDelta"); LatLngBounds bounds = new LatLngBounds( new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest new LatLng(lat + latDelta / 2, lng + lngDelta / 2) // northeast ); if (mapView.getHeight() <= 0 || mapView.getWidth() <= 0) { map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 10)); boundsToMove = bounds; } else { map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0)); } }
Example #14
Source File: PoiOverlay.java From BmapLite with Apache License 2.0 | 6 votes |
/** * 移动镜头到当前的视角。 * @since V2.1.0 */ public void zoomToSpan() { try{ if (mPois != null && mPois.size() > 0) { if (mAMap == null) return; if(mPois.size()==1){ mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(mPois.get(0).getLatLonPoint().getLatitude(), mPois.get(0).getLatLonPoint().getLongitude()), 18f)); }else{ LatLngBounds bounds = getLatLngBounds(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 5)); } } }catch(Throwable e){ e.printStackTrace(); } }
Example #15
Source File: GroundOverlayActivity.java From TraceByAmap with MIT License | 6 votes |
/** * 往地图上添加一个groundoverlay覆盖物 */ private void addOverlayToMap() { amap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(39.936713, 116.386475), 18));// 设置当前地图显示为北京市恭王府 LatLngBounds bounds = new LatLngBounds.Builder() .include(new LatLng(39.935029, 116.384377)) .include(new LatLng(39.939577, 116.388331)).build(); amap.addGroundOverlay(new GroundOverlayOptions() .anchor(0.5f, 0.5f) .transparency(0.7f) // .zIndex(GlobalConstants.ZindexLine - 1) .image(BitmapDescriptorFactory .fromResource(R.drawable.groundoverlay)) .positionFromBounds(bounds)); }
Example #16
Source File: PoiOverlay.java From BmapLite with GNU General Public License v3.0 | 6 votes |
/** * 移动镜头到当前的视角。 * @since V2.1.0 */ public void zoomToSpan() { try{ if (mPois != null && mPois.size() > 0) { if (mAMap == null) return; if(mPois.size()==1){ mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(mPois.get(0).getLatLonPoint().getLatitude(), mPois.get(0).getLatLonPoint().getLongitude()), 18f)); }else{ LatLngBounds bounds = getLatLngBounds(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 5)); } } }catch(Throwable e){ e.printStackTrace(); } }
Example #17
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 #18
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 #19
Source File: BusLineOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
/** * 移动镜头到当前的视角。 * * @since V2.1.0 */ public void zoomToSpan() { if (mAMap == null) return; try { List<LatLonPoint> coordin = mBusLineItem.getDirectionsCoordinates(); if (coordin != null && coordin.size() > 0) { LatLngBounds bounds = getLatLngBounds(coordin); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 5)); } } catch (Throwable e) { e.printStackTrace(); } }
Example #20
Source File: TraceOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
public void setProperCamera(List<LatLng> lists) { Builder builder = LatLngBounds.builder(); if (lists == null || lists.size() == 0) { return; } for (LatLng latlng : lists) { builder.include(latlng); } try { LatLngBounds bounds = builder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20)); } catch (IllegalStateException e) { e.printStackTrace(); } }
Example #21
Source File: RouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
/** * 移动镜头到当前的视角。 * @since V2.1.0 */ public void zoomToSpan() { if (startPoint != null) { if (mAMap == null) return; try { LatLngBounds bounds = getLatLngBounds(); mAMap.animateCamera(CameraUpdateFactory .newLatLngBounds(bounds, 50)); } catch (Throwable e) { e.printStackTrace(); } } }
Example #22
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 #23
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 #24
Source File: TraceOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
public void setProperCamera(List<LatLng> lists) { Builder builder = LatLngBounds.builder(); if (lists == null || lists.size() == 0) { return; } for (LatLng latlng : lists) { builder.include(latlng); } try { LatLngBounds bounds = builder.build(); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20)); } catch (IllegalStateException e) { e.printStackTrace(); } }
Example #25
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 #26
Source File: TrackPresenterImpl.java From RunMap with Apache License 2.0 | 5 votes |
@Override public void scaleCurrentCamera() { CameraPosition position = mapObject.getController().getCameraPosition(); List<TrackPoint> trackPoints = mMoveModel.getHistoryCoordiates(); LatLng start = new LatLng(trackPoints.get(0).getLatitude(), trackPoints.get(0).getLongitude()); LatLng end = new LatLng(trackPoints.get(trackPoints.size() - 1).getLatitude(), trackPoints.get(trackPoints.size() - 1).getLongitude()); CameraUpdate update = CameraUpdateFactory.newLatLngBounds(new LatLngBounds(start, end), (int) (position.zoom - 6)); mapObject.moveToSpecficCamera(update); }
Example #27
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 #28
Source File: ClusterOverlay.java From android-cluster-marker with Apache License 2.0 | 5 votes |
private void calculateClusters() { mIsCanceled = false; mClusters.clear(); LatLngBounds visibleBounds = mAMap.getProjection().getVisibleRegion().latLngBounds; for (ClusterItem clusterItem : mClusterItems) { if (mIsCanceled) { return; } LatLng latlng = clusterItem.getPosition(); if (visibleBounds.contains(latlng)) { Cluster cluster = getCluster(latlng,mClusters); if (cluster != null) { cluster.addClusterItem(clusterItem); } else { cluster = new Cluster(latlng); mClusters.add(cluster); cluster.addClusterItem(clusterItem); } } } //复制一份数据,规避同步 List<Cluster> clusters = new ArrayList<Cluster>(); clusters.addAll(mClusters); Message message = Message.obtain(); message.what = MarkerHandler.ADD_CLUSTER_LIST; message.obj = clusters; if (mIsCanceled) { return; } mMarkerhandler.sendMessage(message); }
Example #29
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 #30
Source File: PlaceMapPathActivity.java From Fishing with GNU General Public License v3.0 | 5 votes |
private void zoomMarker() { JUtils.Log("zoomMarker"+mMyLocation.getPosition().toString()+":"+mPlaceLocation.getPosition().toString()); mMapView.postDelayed(() -> { LatLngBounds.Builder boundsBuild = new LatLngBounds.Builder(); boundsBuild.include(mMyLocation.getPosition()); boundsBuild.include(mPlaceLocation.getPosition()); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(boundsBuild.build(), 10)); mAMap.moveCamera(CameraUpdateFactory.zoomOut()); },100); }