Class Projection

java.lang.Object
com.trimblemaps.mapsdk.maps.Projection

public class Projection extends Object
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 Type
    Method
    Description
    double
    calculateZoom(float minScale)
    Calculates a zoom level based on minimum scale and current scale from MapView
    com.trimblemaps.mapsdk.geometry.LatLng
    fromScreenLocation(android.graphics.PointF point)
    Returns the geographic location that corresponds to a screen location.
    void
    fromScreenLocations(double[] input, double[] output)
    Returns the geographic locations that corresponds to screen locations.
    com.trimblemaps.mapsdk.geometry.LatLng
    getLatLngForProjectedMeters(com.trimblemaps.mapsdk.geometry.ProjectedMeters projectedMeters)
    Returns the LatLng for a spherical Mercator projected meters.
    double
    getMetersPerPixelAtLatitude(double latitude)
    Returns the distance spanned by one pixel at the specified latitude and current zoom level.
    com.trimblemaps.mapsdk.geometry.ProjectedMeters
    getProjectedMetersForLatLng(com.trimblemaps.mapsdk.geometry.LatLng latLng)
    Returns the spherical Mercator projected meters for a LatLng.
    void
    getVisibleCoordinateBounds(double[] bounds)
    Gets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinate bounds.
    com.trimblemaps.mapsdk.geometry.VisibleRegion
    Gets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinates.
    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.
    void
    Deprecated.
    unused
    android.graphics.PointF
    toScreenLocation(com.trimblemaps.mapsdk.geometry.LatLng location)
    Returns a screen location that corresponds to a geographical coordinate (LatLng).
    void
    toScreenLocations(double[] input, double[] output)
    Returns a screen locations that corresponds to a geographical coordinates.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • invalidateContentPadding

      @Deprecated public void 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 coordinates
      output - 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 locations
      output - 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.