@Override public void getScreenLocation(LatLng latLng, OnLatLngScreenLocationCallback callback) { callback.onLatLngScreenLocationReady(googleMap.getProjection().toScreenLocation(latLng)); }
@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 final ProjectionWrapper getProjection() { return new ProjectionWrapper(map.getProjection()); }
@Override public Projection getProjection() { return AnyMapAdapter.adapt(map.getProjection()); }
public void refresh() { Projection projection = googleMap.getProjection(); for (int i = 0; i < markersList.size(); i++) { refresh(i, projection.toScreenLocation(markersList.get(i).latLng())); } }
@Override public void onCameraChange(CameraPosition position) { LatLngBounds bounds = mGoogleMap.getProjection().getVisibleRegion().latLngBounds; mAdapter.setBounds(bounds); } });
private void addToRequestQueue(CurveOptions options) { if (options.getLatLngList().isEmpty() || options.getLatLngList().size() <= 1) { throw new IllegalArgumentException("Requires atleast two latlong points"); } MessageQueueData messageQueueData = new MessageQueueData( options, googleMap.getProjection()); Message message = Message.obtain(null, Constants.TASK_START, messageQueueData); mHandlerThread.addMessage(message); }
private boolean showDefaultIcon(final Network network) { final boolean showLabel = prefs.getBoolean( ListFragment.PREF_MAP_LABEL, true ); if (showLabel) { final LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds; // if on screen, and room in labeled networks, we can show the label if (bounds.contains(network.getLatLng()) && MapRender.this.labeledNetworks.size() <= MAX_LABELS) { return false; } } return true; }
@Override public void onCameraChange(CameraPosition position) { LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds; mAdapter.setBounds(bounds); } });
@NonNull private PulseMarkerView createPulseMarkerView(final LatLng latLng) { return new PulseMarkerView(getContext(), latLng, googleMap.getProjection().toScreenLocation(latLng)); }
@Override public void onCameraChange(CameraPosition position) { new DynamicallyAddMarkerTask().execute(map.getProjection().getVisibleRegion().latLngBounds); } });
public void createAndShowMarker(final int position, final LatLng latLng) { PulseMarkerView marker = createPulseMarkerView(position, googleMap.getProjection().toScreenLocation(latLng), latLng); marker.showWithDelay(scaleAnimationDelay); scaleAnimationDelay += ANIMATION_DELAY_FACTOR; }
@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); }
public void addStartMarker(final LatLng latLng) { startMarker = createPulseMarkerView(latLng); startMarker.updatePulseViewLayoutParams(googleMap.getProjection().toScreenLocation(latLng)); addMarker(startMarker); startMarker.show(); }
public void addFinishMarker(final LatLng latLng) { finishMarker = createPulseMarkerView(latLng); finishMarker.updatePulseViewLayoutParams(googleMap.getProjection().toScreenLocation(latLng)); addMarker(finishMarker); finishMarker.show(); }
int limitSouthwestLeft = mMapPaddingLeft; int limitSouthwestBottom = windowHeight - mMapPaddingBottom; Point northeastInScreen = mMap.getProjection().toScreenLocation(routeBounds.northeast); Point southwestInScreen = mMap.getProjection().toScreenLocation(routeBounds.southwest); Point firstTransitMarkerInScreen = mMap.getProjection().toScreenLocation(firstTransitMarker.getPosition()); int maxDistanceToRouteEdge = 0; int distanceHorizontalNortheast = northeastInScreen.x - firstTransitMarkerInScreen.x; LatLng newLimitSouthWestLatLng = mMap.getProjection().fromScreenLocation(newLimitSouthWest); LatLng newLimitNorthEastLatLng = mMap.getProjection().fromScreenLocation(newLimitNorthEast);
Point screenCenterPoint = googleMap.getProjection().toScreenLocation(point); LatLng radiusLatLng = googleMap.getProjection().fromScreenLocation(new Point(screenCenterPoint.x + (int)radius, screenCenterPoint.y)); initRadiusMetersFinal = MarkerAreasUtils.toRadiusMeters(point, radiusLatLng); } else {