Package ucar.nc2.ft2.simpgeometry
Class CFPolygon
- java.lang.Object
-
- ucar.nc2.ft2.simpgeometry.CFPolygon
-
- All Implemented Interfaces:
Polygon
,SimpleGeometry
public class CFPolygon extends Object implements Polygon
A CF 1.8 compliant Polygon for use with Simple Geometries. Can also represent multipolygons.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPoint(double x, double y)
Add a point to this polygon's points listdouble[]
getBBLower()
Gets the lower bounding box coordinate on the polygon.double[]
getBBUpper()
Gets the upper bounding box coordinate on the polygon.Array
getData()
Get the data associated with this PolygonGeometryType
getGeometryType()
Get the geometry the data is associated with.boolean
getInteriorRing()
Get whether or not this polygon is an interior ringPolygon
getNext()
Get the next polygon in the sequence of multi-polygonsList<Point>
getPoints()
Get the list of points which constitute the polygon.Polygon
getPrev()
Get the previous polygon in the sequence of multi-polygonsvoid
setData(Array data)
Set the data associated with this Polygonvoid
setInteriorRing(boolean interior)
Sets whether or not this polygon is an interior ring.protected void
setNext(CFPolygon next)
Sets the next polygon which make up the multipolygon which this polygon is a part of.void
setNext(Polygon next)
Sets the next polygon which make up the multipolygon which this polygon is a part of.void
setPrev(CFPolygon prev)
Sets the previous polygon which makes up the multipolygon which this polygon is a part of.void
setPrev(Polygon prev)
Sets the previous polygon which makes up the multipolygon which this polygon is a part of.Polygon
setupPolygon(NetcdfDataset dataset, Variable polyvar, int index)
Given a dataset, variable and index, automatically sets up a previously constructed polygon.
-
-
-
Method Detail
-
getGeometryType
public GeometryType getGeometryType()
Get the geometry the data is associated with.
-
getData
public Array getData()
Get the data associated with this Polygon- Specified by:
getData
in interfacePolygon
- Specified by:
getData
in interfaceSimpleGeometry
- Returns:
- data
-
getNext
public Polygon getNext()
Get the next polygon in the sequence of multi-polygons
-
getPrev
public Polygon getPrev()
Get the previous polygon in the sequence of multi-polygons
-
getInteriorRing
public boolean getInteriorRing()
Get whether or not this polygon is an interior ring- Specified by:
getInteriorRing
in interfacePolygon
- Returns:
- true if an interior ring, false if not
-
addPoint
public void addPoint(double x, double y)
Add a point to this polygon's points list
-
setData
public void setData(Array data)
Set the data associated with this Polygon- Specified by:
setData
in interfacePolygon
- Specified by:
setData
in interfaceSimpleGeometry
- Parameters:
data
- - array of data to set to
-
setNext
public void setNext(Polygon next)
Sets the next polygon which make up the multipolygon which this polygon is a part of. If next is a CFPolygon, automatically connects the other polygon to this polygon as well.
-
setNext
protected void setNext(CFPolygon next)
Sets the next polygon which make up the multipolygon which this polygon is a part of. Automatically connects the other polygon to this polygon as well.
-
setPrev
public void setPrev(Polygon prev)
Sets the previous polygon which makes up the multipolygon which this polygon is a part of. If prev is a CFPolygon, automatically connect the other polygon to this polygon as well.
-
setPrev
public void setPrev(CFPolygon prev)
Sets the previous polygon which makes up the multipolygon which this polygon is a part of. Automatically connect the other polygon to this polygon as well.
-
setInteriorRing
public void setInteriorRing(boolean interior)
Sets whether or not this polygon is an interior ring.- Specified by:
setInteriorRing
in interfacePolygon
- Parameters:
interior
- ring or not
-
setupPolygon
public Polygon setupPolygon(NetcdfDataset dataset, Variable polyvar, int index)
Given a dataset, variable and index, automatically sets up a previously constructed polygon. If the specified polygon is not found in the dataset, returns null- Specified by:
setupPolygon
in interfacePolygon
- Parameters:
dataset
- which the variable is a part ofpolyvar
- the variable which has a geometry attributeindex
- of the polygon within the variable- Returns:
- the constructed Polygon with associated data
-
getBBUpper
public double[] getBBUpper()
Gets the upper bounding box coordinate on the polygon.- Specified by:
getBBUpper
in interfaceSimpleGeometry
- Returns:
- double array = (x, y)
-
getBBLower
public double[] getBBLower()
Gets the lower bounding box coordinate on the polygon.- Specified by:
getBBLower
in interfaceSimpleGeometry
- Returns:
- double array = (x, y)
-
-