public static class STCS.Region
extends java.lang.Object
Object representation of an STC region.
This class contains a field for each possible parameter of a region. Depending of the region type some are not used. In such case, these unused fields are set to NULL.
An instance of this class can be easily serialized into STC-S using toSTCS()
, toFullSTCS()
or toString()
. toFullSTCS()
will display default value explicit
on the contrary to toSTCS()
which will replace them by empty strings.
Modifier and Type | Field and Description |
---|---|
double[][] |
coordinates
List of coordinates' pairs.
|
STCS.CoordSys |
coordSys
Coordinate system used by this region.
|
double |
height
Height of the BOX region.
|
double |
radius
Radius of the CIRCLE region.
|
STCS.Region[] |
regions
List of regions unified (UNION), intersected (INTERSECTION) or avoided (NOT).
|
STCS.RegionType |
type
Type of the region.
|
double |
width
Width of the BOX region.
|
Constructor and Description |
---|
Region(GeometryFunction geometry)
Build a Region from the given ADQL representation.
|
Region(STCS.CoordSys coordSys,
double[] coordinates)
Constructor for a POINT/POSITION region.
|
Region(STCS.CoordSys coordSys,
double[][] coordinates)
Constructor for a POINT/POSITION or a POLYGON region.
|
Region(STCS.CoordSys coordSys,
double[] coordinates,
double radius)
Constructor for a CIRCLE region.
|
Region(STCS.CoordSys coordSys,
double[] coordinates,
double width,
double height)
Constructor for a BOX region.
|
Region(STCS.Region region)
Constructor for a NOT region.
|
Region(STCS.RegionType unionOrIntersection,
STCS.CoordSys coordSys,
STCS.Region[] regions)
Constructor for a UNION or INTERSECTION region.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
toFullSTCS()
Get the STC-S representation of this region (in which default values
of the coordinate system are explicitly written).
|
GeometryFunction |
toGeometry()
Convert this region into its corresponding ADQL representation.
|
GeometryFunction |
toGeometry(ADQLQueryFactory factory)
Convert this region into its corresponding ADQL representation.
|
java.lang.String |
toSTCS()
Get the STC-S representation of this region (in which default values
of the coordinate system are not written ; they are replaced by empty strings).
|
java.lang.String |
toString() |
public final STCS.RegionType type
public final STCS.CoordSys coordSys
public final double[][] coordinates
public final double width
public final double height
public final double radius
public final STCS.Region[] regions
public Region(STCS.CoordSys coordSys, double[] coordinates)
Constructor for a POINT/POSITION region.
Important note: The array of coordinates is used like that. No copy is done.
coordSys
- Coordinate system. note: It MAY BE null ; if so, the default coordinate system will be chosencoordinates
- A pair of coordinates ; coordinates[0] and coordinates[1].public Region(STCS.CoordSys coordSys, double[][] coordinates)
Constructor for a POINT/POSITION or a POLYGON region.
Whether it is a polygon or a point depends on the number of given coordinates:
Important note: The array of coordinates is used like that. No copy is done.
coordSys
- Coordinate system. note: It MAY BE null ; if so, the default coordinate system will be chosencoordinates
- List of coordinates' pairs ; coordinates[n] = 1 pair = 2 items (coordinates[n][0] and coordinates[n][1]) ; if 1 pair, it is a POINT/POSITION, but if more, it is a POLYGON.public Region(STCS.CoordSys coordSys, double[] coordinates, double radius)
Constructor for a CIRCLE region.
Important note: The array of coordinates is used like that. No copy is done.
coordSys
- Coordinate system. note: It MAY BE null ; if so, the default coordinate system will be chosencoordinates
- A pair of coordinates ; coordinates[0] and coordinates[1].radius
- The circle radius.public Region(STCS.CoordSys coordSys, double[] coordinates, double width, double height)
Constructor for a BOX region.
Important note: The array of coordinates is used like that. No copy is done.
coordSys
- Coordinate system. note: It MAY BE null ; if so, the default coordinate system will be chosencoordinates
- A pair of coordinates ; coordinates[0] and coordinates[1].width
- Width of the box.height
- Height of the box.public Region(STCS.RegionType unionOrIntersection, STCS.CoordSys coordSys, STCS.Region[] regions)
Constructor for a UNION or INTERSECTION region.
Important note: The array of regions is used like that. No copy is done.
unionOrIntersection
- Type of the region to create. Note: It can be ONLY a UNION or INTERSECTION. Another value will throw an IllegalArgumentException).coordSys
- Coordinate system. note: It MAY BE null ; if so, the default coordinate system will be chosenregions
- Regions to unite or to intersect. Note: At least two regions must be provided.public Region(STCS.Region region)
region
- Any region to not select.public Region(GeometryFunction geometry) throws java.lang.IllegalArgumentException, ParseException
Build a Region from the given ADQL representation.
Note:
Only PointFunction
, CircleFunction
, BoxFunction
, PolygonFunction
and RegionFunction
are accepted here. Other extensions of GeometryFunction
will throw an IllegalArgumentException
.
geometry
- The ADQL representation of the region to create here.java.lang.IllegalArgumentException
- If the given geometry is neither of PointFunction
, BoxFunction
, PolygonFunction
and RegionFunction
.ParseException
- If the declared coordinate system, the coordinates or the STC-S definition has a wrong syntax.public java.lang.String toSTCS()
Get the STC-S representation of this region (in which default values of the coordinate system are not written ; they are replaced by empty strings).
Note: This function build the STC-S just once and store it in a class attribute. The value of this attribute is then returned at next calls of this function.
public java.lang.String toFullSTCS()
Get the STC-S representation of this region (in which default values of the coordinate system are explicitly written).
Note: This function build the STC-S just once and store it in a class attribute. The value of this attribute is then returned at next calls of this function.
public java.lang.String toString()
toString
in class java.lang.Object
public GeometryFunction toGeometry()
Convert this region into its corresponding ADQL representation.
PointFunction
CircleFunction
BoxFunction
PolygonFunction
RegionFunction
Note:
This function is using the default ADQL factory, built using ADQLQueryFactory.ADQLQueryFactory()
.
toGeometry(ADQLQueryFactory)
public GeometryFunction toGeometry(ADQLQueryFactory factory)
Convert this region into its corresponding ADQL representation.
PointFunction
CircleFunction
BoxFunction
PolygonFunction
RegionFunction
Note: This function build the ADQL representation just once and store it in a class attribute. The value of this attribute is then returned at next calls of this function.
factory
- The factory of ADQL objects to use.