@Override public void getMapScreenBounds(OnMapBoundsCallback callback) { final Projection projection = googleMap.getProjection(); int hOffset = getResources().getDimensionPixelOffset(R.dimen.map_horizontal_padding); int vOffset = getResources().getDimensionPixelOffset(R.dimen.map_vertical_padding); LatLngBounds.Builder builder = LatLngBounds.builder(); builder.include(projection.fromScreenLocation(new Point(hOffset, vOffset))); // top-left builder.include(projection.fromScreenLocation( new Point(getView().getWidth() - hOffset, vOffset))); // top-right builder.include(projection.fromScreenLocation( new Point(hOffset, getView().getHeight() - vOffset))); // bottom-left builder.include(projection.fromScreenLocation(new Point(getView().getWidth() - hOffset, getView().getHeight() - vOffset))); // bottom-right callback.onMapBoundsReady(builder.build()); }
@Override public void onMapLongClick(LatLng point) { // We know the center, let's place the outline at a point 3/4 along the view. View view = getSupportFragmentManager().findFragmentById(R.id.map).getView(); LatLng radiusLatLng = mMap.getProjection().fromScreenLocation(new Point( view.getHeight() * 3 / 4, view.getWidth() * 3 / 4)); // Create the circle. DraggableCircle circle = new DraggableCircle(point, toRadiusMeters(point, radiusLatLng)); mCircles.add(circle); }
@Override public LatLng fromScreenLocation(Point point) { return projection.fromScreenLocation(point); }
private double calculateDistanceBetweenMarkers() { Projection projection = map.getProjection(); Point point = projection.toScreenLocation(new LatLng(0.0, 0.0)); point.x += getResources().getDimensionPixelSize(R.dimen.distance_between_markers); LatLng nextPosition = projection.fromScreenLocation(point); return nextPosition.longitude; }
@Override public void onPageSelected(int position) { MyLocation location = latLngsArrayList.get(position); Point mappoint = map.getProjection().toScreenLocation( new LatLng(location.getLatitude(), location.getLongitude())); mappoint.set(mappoint.x, mappoint.y - 30); map.animateCamera(CameraUpdateFactory.newLatLng(map.getProjection().fromScreenLocation(mappoint))); customMap.addSelectedCustomPin(position); }
PixelControlPoints.getFirstPixelControlPoint(), PixelControlPoints.getSecondPixelControlPoint(), endPoint, step); LatLng curveLatLng = mapProjection.fromScreenLocation(curveXYPoint); curveOptions.getReal().add(curveLatLng);
LatLng newLimitSouthWestLatLng = mMap.getProjection().fromScreenLocation(newLimitSouthWest); LatLng newLimitNorthEastLatLng = mMap.getProjection().fromScreenLocation(newLimitNorthEast);
LatLng radiusLatLng = googleMap.getProjection().fromScreenLocation(new Point(screenCenterPoint.x + (int)radius, screenCenterPoint.y)); initRadiusMetersFinal = MarkerAreasUtils.toRadiusMeters(point, radiusLatLng); } else {