Package globus.glmap
Class GLMapViewState
java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapViewState
- All Implemented Interfaces:
AutoCloseable
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 Summary
Modifier and TypeMethodDescriptionconvertDisplayToInternal(double x, double y, MapPoint result) Converts a screen-space point (pixels) to a map coordinate.android.graphics.PointFconvertInternalToDisplay(MapPoint point, float elevation, android.graphics.PointF result) Converts an internal map point at the given elevation in meters to screen pixels using this state.findNearestPoint(MapPoint point, GLMapTrackData trackData, double maxDistance) Returns the nearest track point in internal map coordinates, without changingpoint.findNearestPoint(MapPoint point, GLMapVectorObject object, double maxDistance) Finds the nearest point on vector geometry using the captured camera scale.findNearPoint(GLMapVectorObjectList objects, long startIndex, long endIndex, MapPoint point, double maxDistance) Finds the first matching object in an ordered range, using the captured scale.floatgetAngle()Returns the captured map rotation in degrees.Returns the captured center in internal map coordinates, rounded for rendering.getGeoCenter(MapGeoPoint result) Returns the captured center in geographic coordinates.android.graphics.PointFgetOrigin(android.graphics.PointF result) Returns the captured origin in relative view coordinates.floatgetPitch()Returns the captured map pitch in degrees.doublegetScale()Returns the captured map scale (2 raised to the zoom level).doublegetZoom()Returns the captured zoom level.booleanUpdatesGLMapVectorObject.drawAttributesusing this state's camera, style and locale.booleanUpdates draw attributes using this state's camera and locale and the supplied style.Methods inherited from class globus.glmap.GLNativeObject
close, dispose
-
Method Details
-
getCenter
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
resultobject
-
getGeoCenter
Returns the captured center in geographic coordinates.- Parameters:
result- receives the captured latitude and longitude in degrees- Returns:
- the same
resultobject
-
getScale
public double getScale()Returns the captured map scale (2 raised to the zoom level).- Returns:
- captured scale, or
Double.NaNif the state has been closed
-
getZoom
public double getZoom()Returns the captured zoom level.- Returns:
- captured zoom level, or
Double.NaNif the state has been closed
-
getAngle
public float getAngle()Returns the captured map rotation in degrees.- Returns:
- captured rotation in degrees, or
Float.NaNif 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.NaNif 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
resultobject
-
updateDrawAttributesOfVectorObject
UpdatesGLMapVectorObject.drawAttributesusing 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 updatestyle- 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 changingpoint. Uses this state's scale to interpretmaxDistancein screen points (dp).Double.MAX_VALUEmeans unlimited distance. Negative or non-finite distances return null.- Parameters:
point- reference point in internal map coordinatestrackData- track to searchmaxDistance- 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 changepoint.- Parameters:
point- reference point in internal map coordinatesobject- vector geometry to searchmaxDistance- 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 includesstartIndexand excludesendIndex; either direction is supported.- Parameters:
objects- vector objects to searchstartIndex- first index to testendIndex- exclusive end; use -1 to include index zero when searching backwardspoint- input reference point; updated to the nearest point only when an object is returnedmaxDistance- 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 leavesresultunchanged.- Parameters:
point- point in internal map coordinateselevation- elevation in metersresult- receives the screen position in pixels- Returns:
result
-
convertDisplayToInternal
Converts a screen-space point (pixels) to a map coordinate.- Parameters:
x- screen x-coordinate, in pixelsy- screen y-coordinate, in pixelsresult- destination for the converted point- Returns:
result
-