cds.astro
Class AbstractRegion

java.lang.Object
  extended by cds.astro.AbstractRegion
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Region

public abstract class AbstractRegion
extends java.lang.Object
implements java.io.Serializable

AbstractRegion is an abstract class which defines regions on the celestial sphere. Extensions are Circle (circular target), Convex, Zone, Ellipse 5 abstract methods are required:

  1. toString (edition),
  2. checkCoo (returne true when a point is inside the region), and
  3. checkCircle compare the region with a circle, and returns the statuses
  4. checkQbox, similar to checkCircle, but applied on a Qbox.
  5. area computes the area of the region (in square degrees)
The centroid is an attribute of the region; it is null for undefined region. The minrad and maxrad attributes specify the circular region completely inside and completely outside the region.

See Also:
Serialized Form

Field Summary
 Coo centroid
          The region center is called 'centroid'
static int DISJOINT
          DISJOINT is the status for non-overlapping regions.
static int INCLUDES
          INCLUDES indicates the region fully includes its argument.
static int INTERSECTS
          INTERSECTS is the status for overlapping regions.
static int IS_PARTOF
          IS_PARTOF indicates the region is fully included in its argument.
 double maxrad
          radius (degrees) of Circle centered in centroid which fully includes the region.
 double minrad
          radius (degrees) of Circle centered in centroid fully included in region.
 
Constructor Summary
AbstractRegion()
           
 
Method Summary
abstract  double area()
          Computation of the area of a region
 int check1(Coo centre, double radius)
          This method check1 is a broad approximation of intersections.
abstract  int checkCircle(Coo centre, double r)
          The method checkCircle verifies the intersection of Region with Circle.
abstract  boolean checkCoo(Coo point)
          The method checkCoo verifies a point lies within a region.
 int checkQbox(int qbox)
          The method checkQbox verifies the intersection of a Qbox with the region.
abstract  java.lang.String toString()
          Edition of a Region
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISJOINT

public static final int DISJOINT
DISJOINT is the status for non-overlapping regions. Identical to QBOX_NONE.

See Also:
Constant Field Values

INTERSECTS

public static final int INTERSECTS
INTERSECTS is the status for overlapping regions. There are 2 other statuses for more precision.

See Also:
Constant Field Values

INCLUDES

public static final int INCLUDES
INCLUDES indicates the region fully includes its argument.

See Also:
Constant Field Values

IS_PARTOF

public static final int IS_PARTOF
IS_PARTOF indicates the region is fully included in its argument.

See Also:
Constant Field Values

centroid

public Coo centroid
The region center is called 'centroid'


minrad

public double minrad
radius (degrees) of Circle centered in centroid fully included in region.


maxrad

public double maxrad
radius (degrees) of Circle centered in centroid which fully includes the region.

Constructor Detail

AbstractRegion

public AbstractRegion()
Method Detail

toString

public abstract java.lang.String toString()
Edition of a Region

Overrides:
toString in class java.lang.Object

area

public abstract double area()
Computation of the area of a region

Returns:
Surface of the region, in square degrees (3602/pi for the whole sphere)

checkCoo

public abstract boolean checkCoo(Coo point)
The method checkCoo verifies a point lies within a region.

Parameters:
point - a point we want to check
Returns:
true if point inside the region, false otherwise

checkCircle

public abstract int checkCircle(Coo centre,
                                double r)
The method checkCircle verifies the intersection of Region with Circle.

Parameters:
centre - center of circle
r - radius (degrees) of circle
Returns:
DISJOINT / INTERSECTS / INCLUDES / IS_PARTOF.
  • DISJOINT = no intersection
  • INTERSECTS = region and circle overlap
  • INCLUDES = circle fully included within region.
  • IS_PARTOF = region fully included in circle.

check1

public final int check1(Coo centre,
                        double radius)
This method check1 is a broad approximation of intersections. Uses circular approximations.

Parameters:
centre - center of circle
radius - radius (degrees) of circle
Returns:
DISJOINT / INTERSECTS / INCLUDES / IS_PARTOF.

checkQbox

public int checkQbox(int qbox)
The method checkQbox verifies the intersection of a Qbox with the region. This method should be superseded by the one in the dedicated classes: here it just assimilates the regions to circles.

Parameters:
qbox - an integer representing a Qbox number
Returns:
DISJOINT / INTERSECTS / INCLUDES / IS_PARTOF.