Package globus.glmap

Class GLMapViewState

java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapViewState
All Implemented Interfaces:
AutoCloseable

public class GLMapViewState extends GLNativeObject
A captured map state. All camera values describe the same moment and remain unchanged as the map moves. Values describe the rendering camera, not an animation target or a guarantee of frame presentation. Can contain a depth buffer for terrain hit testing. Close the state when no longer needed.
  • Method Details

    • getCenter

      @NonNull public MapPoint getCenter(@NonNull MapPoint result)
      Returns the captured center in internal map coordinates, rounded for rendering.
      Parameters:
      result - receives the captured center; left unchanged if the state has been closed
      Returns:
      the same result object
    • getGeoCenter

      @NonNull public MapGeoPoint getGeoCenter(@NonNull MapGeoPoint result)
      Returns the captured center in geographic coordinates.
      Parameters:
      result - receives the captured latitude and longitude in degrees
      Returns:
      the same result object
    • getScale

      public double getScale()
      Returns the captured map scale (2 raised to the zoom level).
      Returns:
      captured scale, or Double.NaN if the state has been closed
    • getZoom

      public double getZoom()
      Returns the captured zoom level.
      Returns:
      captured zoom level, or Double.NaN if the state has been closed
    • getAngle

      public float getAngle()
      Returns the captured map rotation in degrees.
      Returns:
      captured rotation in degrees, or Float.NaN if the state has been closed
    • getPitch

      public float getPitch()
      Returns the captured map pitch in degrees. The rendering camera treats values below 0.1 degrees as zero.
      Returns:
      captured pitch in degrees, or Float.NaN if the state has been closed
    • getOrigin

      @NonNull public android.graphics.PointF getOrigin(@NonNull android.graphics.PointF result)
      Returns the captured origin in relative view coordinates.
      Parameters:
      result - receives the origin coordinates relative to the view; left unchanged if the state has been closed
      Returns:
      the same result object
    • updateDrawAttributesOfVectorObject

      public boolean updateDrawAttributesOfVectorObject(@NonNull GLMapVectorObject object)
      Updates GLMapVectorObject.drawAttributes using this state's camera, style and locale. Clears the attributes when false.
      Parameters:
      object - vector object whose attributes to update
      Returns:
      whether the object has visible detail attributes
    • updateDrawAttributesOfVectorObject

      public boolean updateDrawAttributesOfVectorObject(@NonNull GLMapVectorObject object, @Nullable GLMapVectorCascadeStyle style)
      Updates draw attributes using this state's camera and locale and the supplied style. A null style selects the captured map style. The current renderer is never consulted. Clears the attributes when false.
      Parameters:
      object - vector object whose attributes to update
      style - explicit style, or null for the captured map style
      Returns:
      whether the object has visible detail attributes
    • findNearestPoint

      @Nullable public MapPoint findNearestPoint(@NonNull MapPoint point, @NonNull GLMapTrackData trackData, double maxDistance)
      Returns the nearest track point in internal map coordinates, without changing point. Uses this state's scale to interpret maxDistance in screen points (dp). Double.MAX_VALUE means unlimited distance. Negative or non-finite distances return null.
      Parameters:
      point - reference point in internal map coordinates
      trackData - track to search
      maxDistance - maximum distance in screen points (dp)
      Returns:
      the nearest point, or null when no point is close enough or the state or track has been closed
    • findNearestPoint

      @Nullable public MapPoint findNearestPoint(@NonNull MapPoint point, @NonNull GLMapVectorObject object, double maxDistance)
      Finds the nearest point on vector geometry using the captured camera scale. Does not change point.
      Parameters:
      point - reference point in internal map coordinates
      object - vector geometry to search
      maxDistance - maximum distance in screen points (dp)
      Returns:
      nearest point, or null for no hit, closed handles or an invalid distance
    • findNearPoint

      @Nullable public GLMapVectorObject findNearPoint(@NonNull GLMapVectorObjectList objects, long startIndex, long endIndex, @NonNull MapPoint point, double maxDistance)
      Finds the first matching object in an ordered range, using the captured scale. The range includes startIndex and excludes endIndex; either direction is supported.
      Parameters:
      objects - vector objects to search
      startIndex - first index to test
      endIndex - exclusive end; use -1 to include index zero when searching backwards
      point - input reference point; updated to the nearest point only when an object is returned
      maxDistance - maximum distance in screen points (dp)
      Returns:
      an independently owned object to close, or null for no hit, a closed handle or an invalid range/distance
    • convertInternalToDisplay

      @NonNull public android.graphics.PointF convertInternalToDisplay(@NonNull MapPoint point, float elevation, @NonNull android.graphics.PointF result)
      Converts an internal map point at the given elevation in meters to screen pixels using this state. A closed state leaves result unchanged.
      Parameters:
      point - point in internal map coordinates
      elevation - elevation in meters
      result - receives the screen position in pixels
      Returns:
      result
    • convertDisplayToInternal

      @NonNull public MapPoint convertDisplayToInternal(double x, double y, @NonNull MapPoint result)
      Converts a screen-space point (pixels) to a map coordinate.
      Parameters:
      x - screen x-coordinate, in pixels
      y - screen y-coordinate, in pixels
      result - destination for the converted point
      Returns:
      result