Class 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 any supported string serialization:
-
STC-S using
toSTCS()
,toFullSTCS()
.toFullSTCS()
will display default value explicit on the contrary totoSTCS()
which will replace them by empty strings. -
DALI using
toDALI()
.
The default serialization is returned by toString()
. The default
syntax is the one defined by DALI. However, if the type of the represented
region is not supported by DALI or if a specific Coordinate System (which is
not the default one) is used, then the STC/s syntax is used.
- Since:
- 1.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
List all possible region types allowed in an STC-S expression. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal double[][]
List of coordinates' pairs.final CoordSys
Coordinate system used by this region.final double
Height of the BOX region.final double
Radius of the CIRCLE region.final Region[]
List of regions unified (UNION), intersected (INTERSECTION) or avoided (NOT).final Region.RegionType
Type of the region.final double
Width of the BOX region. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a POINT/POSITION region.Constructor for a POINT/POSITION or a POLYGON region.Constructor for a CIRCLE region.Constructor for a BOX region.Constructor for a NOT region.Region
(Region.RegionType unionOrIntersection, CoordSys coordSys, Region[] regions) Constructor for a UNION or INTERSECTION region.Region
(GeometryFunction geometry) Build a Region from the given ADQL representation. -
Method Summary
Modifier and TypeMethodDescriptionstatic Region
Parse the given string serialization of a region.toDALI()
Get the DALI representation of this region.Get the STC-S representation of this region (in which default values of the coordinate system are explicitly written).Convert this region into its corresponding ADQL representation.toGeometry
(ADQLQueryFactory factory) Convert this region into its corresponding ADQL representation.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).toString()
-
Field Details
-
type
Type of the region. -
coordSys
Coordinate system used by this region.Note: Only the NOT region does not declare a coordinate system ; so only for this region this field is NULL.
-
coordinates
public final double[][] coordinatesList of coordinates' pairs. The second dimension of this array represents a pair of coordinates ; it is then an array of two elements.Note: This field is used by POINT, BOX, CIRCLE and POLYGON.
-
width
public final double widthWidth of the BOX region. -
height
public final double heightHeight of the BOX region. -
radius
public final double radiusRadius of the CIRCLE region. -
regions
List of regions unified (UNION), intersected (INTERSECTION) or avoided (NOT).
-
-
Constructor Details
-
Region
Constructor for a POINT/POSITION region.Important note: The array of coordinates is used like that. No copy is done.
- Parameters:
coordSys
- Coordinate system. note: It MAY BE null ; if so, the default coordinate system will be chosen
coordinates
- A pair of coordinates ; coordinates[0] and coordinates[1].
-
-
Region
Constructor for a POINT/POSITION or a POLYGON region.Whether it is a polygon or a point depends on the number of given coordinates:
- 1 item => POINT/POSITION
- more items => POLYGON
Important note: The array of coordinates is used like that. No copy is done.
- Parameters:
coordSys
- Coordinate system. note: It MAY BE null ; if so, the default coordinate system will be chosen
coordinates
- 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.
Region
Important note: The array of coordinates is used like that. No copy is done.
- Parameters:
coordSys
- Coordinate system. note: It MAY BE null ; if so, the default coordinate system will be chosen
coordinates
- A pair of coordinates ; coordinates[0] and
coordinates[1].radius
- The circle radius.Region
Important note: The array of coordinates is used like that. No copy is done.
- Parameters:
coordSys
- Coordinate system. note: It MAY BE null ; if so, the default coordinate system will be chosen
coordinates
- A pair of coordinates ; coordinates[0] and
coordinates[1].width
- Width of the box.height
- Height of the box.Region
Important note: The array of regions is used like that. No copy is done.
- Parameters:
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 chosen
regions
- Regions to unite or to intersect.
Note: At least two regions must be
provided.Region
- Parameters:
region
- Any region to not select.
Region
Note:
Only PointFunction
, CircleFunction
, BoxFunction
,
PolygonFunction
and RegionFunction
are accepted here.
Other extensions of GeometryFunction
will throw an
IllegalArgumentException
.
- Parameters:
geometry
- The ADQL representation of the region to create here.- Throws:
IllegalArgumentException
- If the given geometry is neither ofPointFunction
,BoxFunction
,PolygonFunction
andRegionFunction
.ParseException
- If the declared coordinate system, the coordinates or the STC-S definition has a wrong syntax.
Method Details
-
parse
Parse the given string serialization of a region.Note: Only two serializations are supported and tested (in this order): DALI and STC/s.
- Parameters:
strRegion
- The string serialization to parse.- Returns:
- The corresponding region.
- Throws:
ParseException
- If the used serialization is not supported.- Since:
- 2.0
-
toDALI
Get the DALI representation of this region.Warning: The DALI serialization can not include the coordinate system information. Only the coordinates, radius, width and height are then used for this representation. No conversion is done. These values are returned as provided in the given coordinate system.
- Returns:
- Its DALI representation.
-
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.
- Returns:
- Its STC-S representation.
- See Also:
-
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.
- Returns:
- Its STC-S representation.
- See Also:
-
toString
-
toGeometry
Convert this region into its corresponding ADQL representation.- POSITION:
PointFunction
- CIRCLE:
CircleFunction
- BOX:
BoxFunction
- POLYGON:
PolygonFunction
- UNION, INTERSECTION, NOT:
RegionFunction
Note: This function is using the default ADQL factory, built using
ADQLQueryFactory()
.- Returns:
- The corresponding ADQL representation.
- See Also:
- POSITION:
-
toGeometry
Convert this region into its corresponding ADQL representation.- POSITION:
PointFunction
- CIRCLE:
CircleFunction
- BOX:
BoxFunction
- POLYGON:
PolygonFunction
- UNION, INTERSECTION, NOT:
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.
- Parameters:
factory
- The factory of ADQL objects to use.- Returns:
- The corresponding ADQL representation.
- POSITION: