Class AbstractGraticuleLayer

    • Field Detail

      • LINE_STYLE_SOLID

        public static final java.lang.String LINE_STYLE_SOLID
        Solid line rendering style. This style specifies that a line will be drawn without any breaks.
        _________

        is an example of a solid line.
        See Also:
        Constant Field Values
      • LINE_STYLE_DASHED

        public static final java.lang.String LINE_STYLE_DASHED
        Dashed line rendering style. This style specifies that a line will be drawn as a series of long strokes, with space in between.
        - - - - -

        is an example of a dashed line.
        See Also:
        Constant Field Values
      • LINE_STYLE_DOTTED

        public static final java.lang.String LINE_STYLE_DOTTED
        Dotted line rendering style. This style specifies that a line will be drawn as a series of evenly spaced "square" dots.
        . . . . .
        is an example of a dotted line.
        See Also:
        Constant Field Values
      • terrainConformance

        protected double terrainConformance
      • globe

        protected Globe globe
      • lastEyePoint

        protected Vec4 lastEyePoint
      • lastViewHeading

        protected double lastViewHeading
      • lastViewPitch

        protected double lastViewPitch
      • lastViewFOV

        protected double lastViewFOV
      • lastVerticalExaggeration

        protected double lastVerticalExaggeration
      • frameTimeStamp

        protected long frameTimeStamp
    • Constructor Detail

      • AbstractGraticuleLayer

        public AbstractGraticuleLayer()
    • Method Detail

      • isDrawGraticule

        public boolean isDrawGraticule​(java.lang.String key)
        Returns whether or not graticule lines will be rendered.
        Parameters:
        key - the rendering parameters key.
        Returns:
        true if graticule lines will be rendered; false otherwise.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • setDrawGraticule

        public void setDrawGraticule​(boolean drawGraticule,
                                     java.lang.String key)
        Sets whether or not graticule lines will be rendered.
        Parameters:
        drawGraticule - true to render graticule lines; false to disable rendering.
        key - the rendering parameters key.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • getGraticuleLineColor

        public java.awt.Color getGraticuleLineColor​(java.lang.String key)
        Returns the graticule line Color.
        Parameters:
        key - the rendering parameters key.
        Returns:
        Color used to render graticule lines.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • setGraticuleLineColor

        public void setGraticuleLineColor​(java.awt.Color color,
                                          java.lang.String key)
        Sets the graticule line Color.
        Parameters:
        color - Color that will be used to render graticule lines.
        key - the rendering parameters key.
        Throws:
        java.lang.IllegalArgumentException - if color or key is null.
      • getGraticuleLineWidth

        public double getGraticuleLineWidth​(java.lang.String key)
        Returns the graticule line width.
        Parameters:
        key - the rendering parameters key.
        Returns:
        width of the graticule lines.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • setGraticuleLineWidth

        public void setGraticuleLineWidth​(double lineWidth,
                                          java.lang.String key)
        Sets the graticule line width.
        Parameters:
        lineWidth - width of the graticule lines.
        key - the rendering parameters key.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • getGraticuleLineStyle

        public java.lang.String getGraticuleLineStyle​(java.lang.String key)
        Returns the graticule line rendering style.
        Parameters:
        key - the rendering parameters key.
        Returns:
        rendering style of the graticule lines.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • setGraticuleLineStyle

        public void setGraticuleLineStyle​(java.lang.String lineStyle,
                                          java.lang.String key)
        Sets the graticule line rendering style.
        Parameters:
        lineStyle - rendering style of the graticule lines. One of LINE_STYLE_PLAIN, LINE_STYLE_DASHED, or LINE_STYLE_DOTTED.
        key - the rendering parameters key.
        Throws:
        java.lang.IllegalArgumentException - if lineStyle or key is null.
      • isDrawLabels

        public boolean isDrawLabels​(java.lang.String key)
        Returns whether or not graticule labels will be rendered.
        Parameters:
        key - the rendering parameters key.
        Returns:
        true if graticule labels will be rendered; false otherwise.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • setDrawLabels

        public void setDrawLabels​(boolean drawLabels,
                                  java.lang.String key)
        Sets whether or not graticule labels will be rendered.
        Parameters:
        drawLabels - true to render graticule labels; false to disable rendering.
        key - the rendering parameters key.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • getLabelColor

        public java.awt.Color getLabelColor​(java.lang.String key)
        Returns the graticule label Color.
        Parameters:
        key - the rendering parameters key.
        Returns:
        Color used to render graticule labels.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • setLabelColor

        public void setLabelColor​(java.awt.Color color,
                                  java.lang.String key)
        Sets the graticule label Color.
        Parameters:
        color - Color that will be used to render graticule labels.
        key - the rendering parameters key.
        Throws:
        java.lang.IllegalArgumentException - if color or key is null.
      • getLabelFont

        public java.awt.Font getLabelFont​(java.lang.String key)
        Returns the Font used for graticule labels.
        Parameters:
        key - the rendering parameters key.
        Returns:
        Font used to render graticule labels.
        Throws:
        java.lang.IllegalArgumentException - key is null.
      • setLabelFont

        public void setLabelFont​(java.awt.Font font,
                                 java.lang.String key)
        Sets the Font used for graticule labels.
        Parameters:
        font - Font that will be used to render graticule labels.
        key - the rendering parameters key.
        Throws:
        java.lang.IllegalArgumentException - if font or key is null.
      • getRestorableState

        public java.lang.String getRestorableState()
        Description copied from interface: Restorable
        Returns an XML document string describing the object's state. This state can be restored later by calling restoreState and passing the XML document.
        Specified by:
        getRestorableState in interface Restorable
        Overrides:
        getRestorableState in class AbstractLayer
        Returns:
        an XML document string describing the object's state.
      • restoreState

        public void restoreState​(java.lang.String stateInXml)
        Description copied from interface: Restorable
        Restores the object's state to what is described in the specified XML document string.
        Specified by:
        restoreState in interface Restorable
        Overrides:
        restoreState in class AbstractLayer
        Parameters:
        stateInXml - an XML document string describing an object's state.
      • setRenderingParams

        protected void setRenderingParams​(java.lang.String key,
                                          GraticuleRenderingParams renderingParams)
      • addRenderable

        protected void addRenderable​(java.lang.Object renderable,
                                     java.lang.String paramsKey)
      • removeAllRenderables

        protected void removeAllRenderables()
      • renderGraticule

        protected void renderGraticule​(DrawContext dc)
      • selectRenderables

        protected void selectRenderables​(DrawContext dc)
        Select the visible grid elements
        Parameters:
        dc - the current DrawContext.
      • needsToUpdate

        protected boolean needsToUpdate​(DrawContext dc)
        Determines whether the grid should be updated. It returns true if:
        • the eye has moved more than 1% of its altitude above ground
        • the view FOV, heading or pitch have changed more than 1 degree
        • vertical exaggeration has changed
        Parameters:
        dc - the current DrawContext.
        Returns:
        true if the graticule should be updated.
      • computeTerrainConformance

        protected double computeTerrainConformance​(DrawContext dc)
      • createLineRenderable

        protected java.lang.Object createLineRenderable​(java.lang.Iterable<? extends Position> positions,
                                                        java.lang.String pathType)
      • computeAltitudeAboveGround

        protected double computeAltitudeAboveGround​(DrawContext dc)
      • computeTruncatedSegment

        protected void computeTruncatedSegment​(Position p1,
                                               Position p2,
                                               Sector sector,
                                               java.util.ArrayList<Position> positions)
      • greatCircleIntersectionAtLongitude

        protected LatLon greatCircleIntersectionAtLongitude​(LatLon p1,
                                                            LatLon p2,
                                                            Angle longitude)
        Computes the intersection point position between a great circle segment and a meridian.
        Parameters:
        p1 - the great circle segment start position.
        p2 - the great circle segment end position.
        longitude - the meridian longitude Angle
        Returns:
        the intersection Position or null if there was no intersection found.
      • greatCircleIntersectionAtLatitude

        protected LatLon greatCircleIntersectionAtLatitude​(LatLon p1,
                                                           LatLon p2,
                                                           Angle latitude)
        Computes the intersection point position between a great circle segment and a parallel.
        Parameters:
        p1 - the great circle segment start position.
        p2 - the great circle segment end position.
        latitude - the parallel latitude Angle
        Returns:
        the intersection Position or null if there was no intersection found.
      • getDeltaLongitude

        protected Angle getDeltaLongitude​(LatLon p1,
                                          Angle longitude)