Package com.trimblemaps.mapsdk.maps
Class Projection
java.lang.Object
com.trimblemaps.mapsdk.maps.Projection
A projection is used to translate between on screen location and geographic coordinates on
the surface of the Earth. Screen location is in screen pixels (not display pixels)
with respect to the top left corner of the map (and not necessarily of the whole screen).
-
Method Summary
Modifier and TypeMethodDescriptiondoublecalculateZoom(float minScale) Calculates a zoom level based on minimum scale and current scale from MapViewcom.trimblemaps.mapsdk.geometry.LatLngfromScreenLocation(android.graphics.PointF point) Returns the geographic location that corresponds to a screen location.voidfromScreenLocations(double[] input, double[] output) Returns the geographic locations that corresponds to screen locations.com.trimblemaps.mapsdk.geometry.LatLnggetLatLngForProjectedMeters(com.trimblemaps.mapsdk.geometry.ProjectedMeters projectedMeters) Returns the LatLng for a spherical Mercator projected meters.doublegetMetersPerPixelAtLatitude(double latitude) Returns the distance spanned by one pixel at the specified latitude and current zoom level.com.trimblemaps.mapsdk.geometry.ProjectedMetersgetProjectedMetersForLatLng(com.trimblemaps.mapsdk.geometry.LatLng latLng) Returns the spherical Mercator projected meters for a LatLng.voidgetVisibleCoordinateBounds(double[] bounds) Gets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinate bounds.com.trimblemaps.mapsdk.geometry.VisibleRegionGets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinates.com.trimblemaps.mapsdk.geometry.VisibleRegiongetVisibleRegion(boolean ignorePadding) Gets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinates.voidDeprecated.unusedandroid.graphics.PointFtoScreenLocation(com.trimblemaps.mapsdk.geometry.LatLng location) Returns a screen location that corresponds to a geographical coordinate (LatLng).voidtoScreenLocations(double[] input, double[] output) Returns a screen locations that corresponds to a geographical coordinates.
-
Method Details
-
invalidateContentPadding
Deprecated.unused -
getProjectedMetersForLatLng
@NonNull public com.trimblemaps.mapsdk.geometry.ProjectedMeters getProjectedMetersForLatLng(@NonNull com.trimblemaps.mapsdk.geometry.LatLng latLng) Returns the spherical Mercator projected meters for a LatLng. -
getLatLngForProjectedMeters
@NonNull public com.trimblemaps.mapsdk.geometry.LatLng getLatLngForProjectedMeters(@NonNull com.trimblemaps.mapsdk.geometry.ProjectedMeters projectedMeters) Returns the LatLng for a spherical Mercator projected meters. -
getMetersPerPixelAtLatitude
public double getMetersPerPixelAtLatitude(@FloatRange(from=-90.0,to=90.0) double latitude) Returns the distance spanned by one pixel at the specified latitude and current zoom level.
The distance between pixels decreases as the latitude approaches the poles. This relationship parallels the relationship between longitudinal coordinates at different latitudes.- Parameters:
latitude- The latitude for which to return the value.- Returns:
- The distance measured in meters.
-
fromScreenLocation
@NonNull public com.trimblemaps.mapsdk.geometry.LatLng fromScreenLocation(@NonNull android.graphics.PointF point) Returns the geographic location that corresponds to a screen location. The screen location is specified in screen pixels (not display pixels) relative to the top left of the map (not the top left of the whole screen).- Parameters:
point- A Point on the screen in screen pixels.- Returns:
- The LatLng corresponding to the point on the screen, or null if the ray through the given screen point does not intersect the ground plane.
-
fromScreenLocations
public void fromScreenLocations(@NonNull double[] input, @NonNull double[] output) Returns the geographic locations that corresponds to screen locations. The screen locations are specified in screen pixels (not display pixels) relative to the top left of the map (not the top left of the whole screen).- Parameters:
input- an array of input values representing screen coordinatesoutput- an array of output values representing geographic locations
-
getVisibleRegion
@NonNull public com.trimblemaps.mapsdk.geometry.VisibleRegion getVisibleRegion()Gets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinates.This method ignores the content padding.
- Returns:
- The projection of the viewing frustum in its current state.
-
getVisibleRegion
@NonNull public com.trimblemaps.mapsdk.geometry.VisibleRegion getVisibleRegion(boolean ignorePadding) Gets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinates.- Parameters:
ignorePadding- True if the padding should be ignored, false if the returned region should be reduced by the padding.- Returns:
- The projection of the viewing frustum in its current state.
-
getVisibleCoordinateBounds
public void getVisibleCoordinateBounds(@NonNull double[] bounds) Gets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinate bounds.This method ignores the content padding.
- Parameters:
bounds- an array of 4 output values representing bounds(in the order of latNorth, lonEast, latSouth, lonWest).
-
toScreenLocation
@NonNull public android.graphics.PointF toScreenLocation(@NonNull com.trimblemaps.mapsdk.geometry.LatLng location) Returns a screen location that corresponds to a geographical coordinate (LatLng). The screen location is in screen pixels (not display pixels) relative to the top left of the map (not of the whole screen).- Parameters:
location- A LatLng on the map to convert to a screen location.- Returns:
- A Point representing the screen location in screen pixels.
-
toScreenLocations
public void toScreenLocations(@NonNull double[] input, @NonNull double[] output) Returns a screen locations that corresponds to a geographical coordinates. The screen locations are in screen pixels (not display pixels) relative to the top left of the map (not of the whole screen).- Parameters:
input- an array of input values representing geographic locationsoutput- an array of output values representing screen coordinates
-
calculateZoom
public double calculateZoom(float minScale) Calculates a zoom level based on minimum scale and current scale from MapView- Parameters:
minScale- The minimum scale to calculate the zoom level.- Returns:
- zoom level that fits the MapView.
-