com.google.android.gms.maps.model.VisibleRegion Java Examples
The following examples show how to use
com.google.android.gms.maps.model.VisibleRegion.
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: GglMapLocationManager.java From FimiX8-RE with MIT License | 7 votes |
public void moveCameraByDevice() { LatLng latLng = getDevLocation(); if (latLng != null) { float zoom = this.mGoogleMap.getCameraPosition().zoom; VisibleRegion visibleRegion = this.mGoogleMap.getProjection().getVisibleRegion(); LatLng farLeft = visibleRegion.farLeft; LatLng nearRight = visibleRegion.nearRight; Point point = this.mGoogleMap.getProjection().toScreenLocation(latLng); Point topLeft = this.mGoogleMap.getProjection().toScreenLocation(farLeft); Point bottomRight = this.mGoogleMap.getProjection().toScreenLocation(nearRight); boolean b = topLeft.x <= point.x && point.x <= bottomRight.x && topLeft.y <= point.y && point.y <= bottomRight.y; if (!b) { this.mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom)); } } }
Example #2
Source File: MyView.java From mil-sym-android with Apache License 2.0 | 6 votes |
protected void setExtents() { if (map != null) { VisibleRegion region = map.getProjection().getVisibleRegion(); double ullon = region.farLeft.longitude; double ullat = region.farLeft.latitude; double lrlon = region.nearRight.longitude; double lrlat = region.nearRight.latitude; //set the geo extents utility.SetExtents(ullon, lrlon, ullat, lrlat); //set the pixels extents android.graphics.Point ul = map.getProjection().toScreenLocation(region.farLeft); android.graphics.Point lr = map.getProjection().toScreenLocation(region.nearRight); double width = lr.x - ul.x; double height = lr.y - ul.y; utility.set_displayPixelsWidth(width); utility.set_displayPixelsHeight(height); } return; }
Example #3
Source File: GglMapAiSurroundManager.java From FimiX8-RE with MIT License | 5 votes |
public void addPolylinescircle(boolean cw, double lat, double lng, double lat1, double lng2, int radius, int maxRadius) { if (this.line != null) { this.line.remove(); this.line = null; } FLatLng centerpoint = GpsCorrect.Earth_To_Mars(lat, lng); FLatLng point = GpsCorrect.Earth_To_Mars(lat1, lng2); float angle = this.mapCalcAngle.getAngle2(new LatLng(centerpoint.latitude, centerpoint.longitude), new LatLng(point.latitude, point.longitude)); PolylineOptions options = new PolylineOptions(); int time = (int) Math.round((((double) (radius * 2)) * 3.141592653589793d) / 10.0d); if (time < 50) { time = 50; } else if (time > 180) { time = 180; } double temp = (double) ((((float) ((maxRadius + 10) - radius)) * 1.0f) / ((float) time)); VisibleRegion visibleRegion = this.googleMap.getProjection().getVisibleRegion(); LatLng farLeft = visibleRegion.farLeft; LatLng nearRight = visibleRegion.nearRight; float scale = GeoTools.getScale(farLeft, nearRight, this.googleMap.getProjection().toScreenLocation(nearRight).x - this.googleMap.getProjection().toScreenLocation(farLeft).x); for (int i = 0; i < 360; i++) { float startAngle; float t = (float) (((double) scale) * (((double) radius) + (((double) (((float) i) / (360.0f / ((float) time)))) * temp))); if (cw) { startAngle = ((float) i) + angle; } else { float cc = angle - ((float) i); if (cc < 0.0f) { startAngle = 360.0f + cc; } else { startAngle = cc; } } Point p1 = this.googleMap.getProjection().toScreenLocation(new LatLng(centerpoint.latitude, centerpoint.longitude)); options.add(this.googleMap.getProjection().fromScreenLocation(new Point((int) (((double) p1.x) + (((double) t) * Math.cos((((double) startAngle) * 3.141592653589793d) / 180.0d))), (int) (((double) p1.y) + (((double) t) * Math.sin((((double) startAngle) * 3.141592653589793d) / 180.0d)))))); } this.line = this.googleMap.addPolyline(options.width(3.0f)); this.line.setColor(this.context.getResources().getColor(R.color.x8_drone_inface_line)); }
Example #4
Source File: ClustersBuilder.java From clusterkraf with Apache License 2.0 | 5 votes |
ClustersBuilder(Projection projection, Options options, ArrayList<ClusterPoint> initialClusteredPoints) { this.options = options; this.projectionRef = new WeakReference<Projection>(projection); this.visibleRegionRef = new WeakReference<VisibleRegion>(projection.getVisibleRegion()); if (initialClusteredPoints != null) { addRelevantInitialInputPoints(initialClusteredPoints); } }
Example #5
Source File: ClustersBuilder.java From clusterkraf with Apache License 2.0 | 5 votes |
void addAll(ArrayList<InputPoint> points) { if (points != null) { Projection projection = getProjection(); VisibleRegion visibleRegion = getVisibleRegion(); if (projection != null && visibleRegion != null) { LatLngBounds bounds = getExpandedBounds(visibleRegion.latLngBounds); for (InputPoint point : points) { addIfNecessary(point, projection, bounds); } } } }
Example #6
Source File: ProjectionImpl.java From android_packages_apps_GmsCore with Apache License 2.0 | 4 votes |
@Override public VisibleRegion getVisibleRegion() throws RemoteException { viewport.getMapExtents(extents, 0); // TODO: Support non-flat map extents return new VisibleRegion(GmsMapsTypeHelper.toLatLngBounds(viewport.getBBox(null, 0))); }
Example #7
Source File: ClustersBuilder.java From clusterkraf with Apache License 2.0 | 4 votes |
private VisibleRegion getVisibleRegion() { return visibleRegionRef.get(); }