Class SurfacePolygon

    • Field Detail

      • boundaries

        protected java.util.List<java.lang.Iterable<? extends LatLon>> boundaries
      • explicitTexture

        protected WWTexture explicitTexture
        If an image source was specified, this is the WWTexture form.
      • explicitTextureCoords

        protected float[] explicitTextureCoords
        This shape's texture coordinates.
      • tess

        protected static com.jogamp.opengl.glu.GLUtessellator tess
    • Constructor Detail

      • SurfacePolygon

        public SurfacePolygon()
        Constructs a new surface polygon with the default attributes and no locations.
      • SurfacePolygon

        public SurfacePolygon​(SurfacePolygon source)
        Creates a shallow copy of the specified source shape.
        Parameters:
        source - the shape to copy.
      • SurfacePolygon

        public SurfacePolygon​(ShapeAttributes normalAttrs)
        Constructs a new surface polygon with the specified normal (as opposed to highlight) attributes and no locations. Modifying the attribute reference after calling this constructor causes this shape's appearance to change accordingly.
        Parameters:
        normalAttrs - the normal attributes. May be null, in which case default attributes are used.
      • SurfacePolygon

        public SurfacePolygon​(java.lang.Iterable<? extends LatLon> iterable)
        Constructs a new surface polygon with the default attributes and the specified iterable of locations.

        Note: If fewer than three locations is specified, no polygon is drawn.

        Parameters:
        iterable - the polygon locations.
        Throws:
        java.lang.IllegalArgumentException - if the locations iterable is null.
      • SurfacePolygon

        public SurfacePolygon​(ShapeAttributes normalAttrs,
                              java.lang.Iterable<? extends LatLon> iterable)
        Constructs a new surface polygon with the specified normal (as opposed to highlight) attributes and the specified iterable of locations. Modifying the attribute reference after calling this constructor causes this shape's appearance to change accordingly.

        Note: If fewer than three locations is specified, no polygon is drawn.

        Parameters:
        normalAttrs - the normal attributes. May be null, in which case default attributes are used.
        iterable - the polygon locations.
        Throws:
        java.lang.IllegalArgumentException - if the locations iterable is null.
    • Method Detail

      • getLocations

        public java.lang.Iterable<? extends LatLon> getLocations​(Globe globe)
        Description copied from interface: SurfaceShape
        Returns the shape's locations as they appear on the specified globe, or null if the shape has no locations.
        Specified by:
        getLocations in interface SurfaceShape
        Parameters:
        globe - the globe the shape is related to.
        Returns:
        the shapes locations on the globe, or null if the shape has no locations.
      • getLocations

        public java.lang.Iterable<? extends LatLon> getLocations()
      • getBoundaries

        public java.util.List<java.lang.Iterable<? extends LatLon>> getBoundaries()
      • setLocations

        public void setLocations​(java.lang.Iterable<? extends LatLon> iterable)
      • getOuterBoundary

        public java.lang.Iterable<? extends LatLon> getOuterBoundary()
      • setOuterBoundary

        public void setOuterBoundary​(java.lang.Iterable<? extends LatLon> iterable)
      • addInnerBoundary

        public void addInnerBoundary​(java.lang.Iterable<? extends LatLon> iterable)
      • getTextureImageSource

        public java.lang.Object getTextureImageSource()
        Returns this polygon's texture image source.
        Returns:
        the texture image source, or null if no source has been specified.
      • getTextureCoords

        public float[] getTextureCoords()
        Returns the texture coordinates for this polygon.
        Returns:
        the texture coordinates, or null if no texture coordinates have been specified.
      • setTextureImageSource

        public void setTextureImageSource​(java.lang.Object imageSource,
                                          float[] texCoords,
                                          int texCoordCount)
        Specifies the texture to apply to this polygon.
        Parameters:
        imageSource - the texture image source. May be a String identifying a file path or URL, a File, or a URL.
        texCoords - the (s, t) texture coordinates aligning the image to the polygon. There must be one texture coordinate pair, (s, t), for each polygon location in the polygon's outer boundary.
        texCoordCount - the number of texture coordinates, (s, v) pairs, specified.
        Throws:
        java.lang.IllegalArgumentException - if the image source is not null and either the texture coordinates are null or inconsistent with the specified texture-coordinate count, or there are fewer than three texture coordinate pairs.
      • getReferencePosition

        public Position getReferencePosition()
        Description copied from interface: Movable
        A position associated with the object that indicates its aggregate geographic position. The chosen position varies among implementers of this interface. For objects defined by a list of positions, the reference position is typically the first position in the list. For symmetric objects the reference position is often the center of the object. In many cases the object's reference position may be explicitly specified by the application.
        Specified by:
        getReferencePosition in interface Movable
        Specified by:
        getReferencePosition in interface Movable2
        Specified by:
        getReferencePosition in class AbstractSurfaceShape
        Returns:
        the object's reference position, or null if no reference position is available.
      • clearCaches

        protected void clearCaches()
        Description copied from class: AbstractSurfaceShape
        Clears this SurfaceObject's internal extent cache.

        Overridden to clear this SurfaceShape's internal sector and geometry caches.

        Overrides:
        clearCaches in class AbstractSurfaceShape
      • handleUnsuccessfulInteriorTessellation

        protected void handleUnsuccessfulInteriorTessellation​(DrawContext dc)
        Overridden to clear the polygon's locations iterable upon an unsuccessful tessellation attempt. This ensures the polygon won't attempt to re-tessellate itself each frame.
        Overrides:
        handleUnsuccessfulInteriorTessellation in class AbstractSurfaceShape
        Parameters:
        dc - the current DrawContext.
      • exportAsKML

        protected void exportAsKML​(java.lang.Object output)
                            throws java.io.IOException,
                                   javax.xml.stream.XMLStreamException
        Export the polygon to KML as a <Placemark> element. The output object will receive the data. This object must be one of: java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriter
        Overrides:
        exportAsKML in class AbstractSurfaceShape
        Parameters:
        output - Object to receive the generated KML.
        Throws:
        javax.xml.stream.XMLStreamException - If an exception occurs while writing the KML
        java.io.IOException - if an exception occurs while exporting the data.
        See Also:
        AbstractSurfaceShape.export(String, Object)