region.c   region.c 
skipping to change at line 205 skipping to change at line 205
* 18-MAR-2011 (DSB): * 18-MAR-2011 (DSB):
* Added astGetRegionMesh public method. * Added astGetRegionMesh public method.
* 22-MAR-2011 (DSB): * 22-MAR-2011 (DSB):
* Improve uniformity of points produced by astRegBaseGrid method. * Improve uniformity of points produced by astRegBaseGrid method.
* 29-APR-2011 (DSB): * 29-APR-2011 (DSB):
* Prevent astFindFrame from matching a subclass template against a * Prevent astFindFrame from matching a subclass template against a
* superclass target. * superclass target.
* 17-MAY-2011 (DSB): * 17-MAY-2011 (DSB):
* In RegBaseGrid, accept the final try even if it is not within 5% * In RegBaseGrid, accept the final try even if it is not within 5%
* of the required meshsize. * of the required meshsize.
* 27-APR-2012 (DSB):
* Store a negated copy of itself with each Region. Changing the Nega
ted
* attribute of a Region causes the cached information to be reset, a
nd
* re-calculating it can be an expensive operation. So instead of cha
nging
* "Negatated" in "this", access the negated copy of "this" using the
* new protected method astGetNegation.
*class-- *class--
* Implementation Notes: * Implementation Notes:
* - All sub-classes must over-ride the following abstract methods decla red * - All sub-classes must over-ride the following abstract methods decla red
* in this class: astRegBaseBox, astRegBaseMesh, astRegPins, astRegCentr e. * in this class: astRegBaseBox, astRegBaseMesh, astRegPins, astRegCentr e.
* They must also extend the astTransform method. In addition they shoul d * They must also extend the astTransform method. In addition they shoul d
* usually extend astSimplify. * usually extend astSimplify.
*/ */
skipping to change at line 335 skipping to change at line 341
AstRegion *this; /* Pointer to the Region structure */ \ AstRegion *this; /* Pointer to the Region structure */ \
char buf[100]; /* Buffer for attribute name */ \ char buf[100]; /* Buffer for attribute name */ \
\ \
/* Check the global error status. */ \ /* Check the global error status. */ \
if ( !astOK ) return; \ if ( !astOK ) return; \
\ \
/* Obtain a pointer to the Region structure. */ \ /* Obtain a pointer to the Region structure. */ \
this = (AstRegion *) this_frame; \ this = (AstRegion *) this_frame; \
\ \
/* Validate the axis index supplied. */ \ /* Validate the axis index supplied. */ \
(void) astValidateAxis( this, axis, "astClear" #attribute ); \ (void) astValidateAxis( this, axis, 1, "astClear" #attribute ); \
\ \
/* We use the public astSetx method rather than the protected \ /* We use the public astSetx method rather than the protected \
astSet#attribute method so that the current Frame in the encapsulated \ astSet#attribute method so that the current Frame in the encapsulated \
FrameSet will be re-mapped if necessary. Construct the attribute name. * / \ FrameSet will be re-mapped if necessary. Construct the attribute name. * / \
sprintf( buf, "%s(%d)", #attribute, axis + 1 ); \ sprintf( buf, "%s(%d)", #attribute, axis + 1 ); \
\ \
/* Obtain a pointer to the Region's encapsulated FrameSet and invoke its \ /* Obtain a pointer to the Region's encapsulated FrameSet and invoke its \
astClear method. The protected astClear#attribute method is notused \ astClear method. The protected astClear#attribute method is notused \
since we want the current Frame of the encapsulated FrameSet to be \ since we want the current Frame of the encapsulated FrameSet to be \
remapped if required. */ \ remapped if required. */ \
skipping to change at line 458 skipping to change at line 464
AstRegion *this; /* Pointer to the Region structure */ \ AstRegion *this; /* Pointer to the Region structure */ \
type result; /* Value to return */ \ type result; /* Value to return */ \
\ \
/* Check the global error status. */ \ /* Check the global error status. */ \
if ( !astOK ) return (type) 0; \ if ( !astOK ) return (type) 0; \
\ \
/* Obtain a pointer to the Region structure. */ \ /* Obtain a pointer to the Region structure. */ \
this = (AstRegion *) this_frame; \ this = (AstRegion *) this_frame; \
\ \
/* Validate the axis index supplied. */ \ /* Validate the axis index supplied. */ \
(void) astValidateAxis( this, axis, "astGet" #attribute ); \ (void) astValidateAxis( this, axis, 1, "astGet" #attribute ); \
\ \
/* Obtain a pointer to the Region's encapsulated FrameSet and invoke its \ /* Obtain a pointer to the Region's encapsulated FrameSet and invoke its \
astGet<Attribute> method. */ \ astGet<Attribute> method. */ \
result = astGet##attribute( this->frameset, axis ); \ result = astGet##attribute( this->frameset, axis ); \
\ \
/* If an error occurred, clear the result value. */ \ /* If an error occurred, clear the result value. */ \
if ( !astOK ) result = (type) 0; \ if ( !astOK ) result = (type) 0; \
\ \
/* Return the result. */ \ /* Return the result. */ \
return result; \ return result; \
skipping to change at line 636 skipping to change at line 642
AstRegion *this; /* Pointer to the Region structure */ \ AstRegion *this; /* Pointer to the Region structure */ \
char buf[100]; /* Buffer for attribute name */ \ char buf[100]; /* Buffer for attribute name */ \
\ \
/* Check the global error status. */ \ /* Check the global error status. */ \
if ( !astOK ) return; \ if ( !astOK ) return; \
\ \
/* Obtain a pointer to the Region structure. */ \ /* Obtain a pointer to the Region structure. */ \
this = (AstRegion *) this_frame; \ this = (AstRegion *) this_frame; \
\ \
/* Validate the axis index supplied. */ \ /* Validate the axis index supplied. */ \
(void) astValidateAxis( this, axis, "astSet" #attribute ); \ (void) astValidateAxis( this, axis, 1, "astSet" #attribute ); \
\ \
/* We use the public astSetx method rather than the protected \ /* We use the public astSetx method rather than the protected \
astSet#attribute method so that the current Frame in the encapsulated \ astSet#attribute method so that the current Frame in the encapsulated \
FrameSet will be re-mapped if necessary. Construct the attribute name. * / \ FrameSet will be re-mapped if necessary. Construct the attribute name. * / \
sprintf( buf, "%s(%d)", #attribute, axis + 1 ); \ sprintf( buf, "%s(%d)", #attribute, axis + 1 ); \
\ \
/* Obtain a pointer to the Region's encapsulated FrameSet and invoke its \ /* Obtain a pointer to the Region's encapsulated FrameSet and invoke its \
astSet<x> method. */ \ astSet<x> method. */ \
astSet##x( this->frameset, buf, value ); \ astSet##x( this->frameset, buf, value ); \
} }
skipping to change at line 755 skipping to change at line 761
AstRegion *this; /* Pointer to the Region structure */ \ AstRegion *this; /* Pointer to the Region structure */ \
int result; /* Value to return */ \ int result; /* Value to return */ \
\ \
/* Check the global error status. */ \ /* Check the global error status. */ \
if ( !astOK ) return 0; \ if ( !astOK ) return 0; \
\ \
/* Obtain a pointer to the Region structure. */ \ /* Obtain a pointer to the Region structure. */ \
this = (AstRegion *) this_frame; \ this = (AstRegion *) this_frame; \
\ \
/* Validate the axis index supplied. */ \ /* Validate the axis index supplied. */ \
(void) astValidateAxis( this, axis, "astTest" #attribute ); \ (void) astValidateAxis( this, axis, 1, "astTest" #attribute ); \
\ \
/* Obtain a pointer to the Region's encapsulated FrameSet and invoke its \ /* Obtain a pointer to the Region's encapsulated FrameSet and invoke its \
astTest<Attribute> method. */ \ astTest<Attribute> method. */ \
result = astTest##attribute( this->frameset, axis ); \ result = astTest##attribute( this->frameset, axis ); \
\ \
/* If an error occurred, clear the result value. */ \ /* If an error occurred, clear the result value. */ \
if ( !astOK ) result = 0; \ if ( !astOK ) result = 0; \
\ \
/* Return the result. */ \ /* Return the result. */ \
return result; \ return result; \
skipping to change at line 921 skipping to change at line 927
static int LineContains( AstFrame *, AstLineDef *, int, double *, int * ); static int LineContains( AstFrame *, AstLineDef *, int, double *, int * );
static int LineCrossing( AstFrame *, AstLineDef *, AstLineDef *, double **, int * ); static int LineCrossing( AstFrame *, AstLineDef *, AstLineDef *, double **, int * );
static int Match( AstFrame *, AstFrame *, int, int **, int **, AstMapping * *, AstFrame **, int * ); static int Match( AstFrame *, AstFrame *, int, int **, int **, AstMapping * *, AstFrame **, int * );
static int Overlap( AstRegion *, AstRegion *, int * ); static int Overlap( AstRegion *, AstRegion *, int * );
static int OverlapX( AstRegion *, AstRegion *, int * ); static int OverlapX( AstRegion *, AstRegion *, int * );
static int RegDummyFS( AstRegion *, int * ); static int RegDummyFS( AstRegion *, int * );
static int RegPins( AstRegion *, AstPointSet *, AstRegion *, int **, int * ); static int RegPins( AstRegion *, AstPointSet *, AstRegion *, int **, int * );
static int SubFrame( AstFrame *, AstFrame *, int, const int *, const int *, AstMapping **, AstFrame **, int * ); static int SubFrame( AstFrame *, AstFrame *, int, const int *, const int *, AstMapping **, AstFrame **, int * );
static int RegTrace( AstRegion *, int, double *, double **, int * ); static int RegTrace( AstRegion *, int, double *, double **, int * );
static int Unformat( AstFrame *, int, const char *, double *, int * ); static int Unformat( AstFrame *, int, const char *, double *, int * );
static int ValidateAxis( AstFrame *, int, const char *, int * ); static int ValidateAxis( AstFrame *, int, int, const char *, int * );
static void CheckPerm( AstFrame *, const int *, const char *, int * ); static void CheckPerm( AstFrame *, const int *, const char *, int * );
static void Copy( const AstObject *, AstObject *, int * ); static void Copy( const AstObject *, AstObject *, int * );
static void Delete( AstObject *, int * ); static void Delete( AstObject *, int * );
static void Dump( AstObject *, AstChannel *, int * ); static void Dump( AstObject *, AstChannel *, int * );
static void GetRegionBounds( AstRegion *, double *, double *, int * ); static void GetRegionBounds( AstRegion *, double *, double *, int * );
static void GetRegionBounds2( AstRegion *, double *, double *, int * ); static void GetRegionBounds2( AstRegion *, double *, double *, int * );
static void GetRegionMesh( AstRegion *, int, int, int, int *, double *, int * ); static void GetRegionMesh( AstRegion *, int, int, int, int *, double *, int * );
static void GetRegionPoints( AstRegion *, int, int, int *, double *, int * ); static void GetRegionPoints( AstRegion *, int, int, int *, double *, int * );
static void Intersect( AstFrame *, const double[2], const double[2], const double[2], const double[2], double[2], int * ); static void Intersect( AstFrame *, const double[2], const double[2], const double[2], const double[2], double[2], int * );
static void LineOffset( AstFrame *, AstLineDef *, double, double, double[2] , int * ); static void LineOffset( AstFrame *, AstLineDef *, double, double, double[2] , int * );
skipping to change at line 952 skipping to change at line 958
static void RegClearAttrib( AstRegion *, const char *, char **, int * ); static void RegClearAttrib( AstRegion *, const char *, char **, int * );
static void RegOverlay( AstRegion *, AstRegion *, int, int * ); static void RegOverlay( AstRegion *, AstRegion *, int, int * );
static void RegSetAttrib( AstRegion *, const char *, char **, int * ); static void RegSetAttrib( AstRegion *, const char *, char **, int * );
static void ReportPoints( AstMapping *, int, AstPointSet *, AstPointSet *, int * ); static void ReportPoints( AstMapping *, int, AstPointSet *, AstPointSet *, int * );
static void ResetCache( AstRegion *, int * ); static void ResetCache( AstRegion *, int * );
static void Resolve( AstFrame *, const double [], const double [], const do uble [], double [], double *, double *, int * ); static void Resolve( AstFrame *, const double [], const double [], const do uble [], double [], double *, double *, int * );
static void SetAxis( AstFrame *, int, AstAxis *, int * ); static void SetAxis( AstFrame *, int, AstAxis *, int * );
static void SetRegFS( AstRegion *, AstFrame *, int * ); static void SetRegFS( AstRegion *, AstFrame *, int * );
static void ShowMesh( AstRegion *, int, const char *, int * ); static void ShowMesh( AstRegion *, int, const char *, int * );
static void ValidateAxisSelection( AstFrame *, int, const int *, const char *, int * ); static void ValidateAxisSelection( AstFrame *, int, const int *, const char *, int * );
static AstRegion *GetNegation( AstRegion *, int * );
static int GetBounded( AstRegion *, int * ); static int GetBounded( AstRegion *, int * );
static AstRegion *GetDefUnc( AstRegion *, int * ); static AstRegion *GetDefUnc( AstRegion *, int * );
static AstRegion *GetUncFrm( AstRegion *, int, int * ); static AstRegion *GetUncFrm( AstRegion *, int, int * );
static AstRegion *GetUnc( AstRegion *, int, int * ); static AstRegion *GetUnc( AstRegion *, int, int * );
static int TestUnc( AstRegion *, int * ); static int TestUnc( AstRegion *, int * );
static void ClearUnc( AstRegion *, int * ); static void ClearUnc( AstRegion *, int * );
static void SetUnc( AstRegion *, AstRegion *, int * ); static void SetUnc( AstRegion *, AstRegion *, int * );
skipping to change at line 1191 skipping to change at line 1198
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
const char *result; /* Pointer value to return */ const char *result; /* Pointer value to return */
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return str2; if ( !astOK ) return str2;
/* Obtain a pointer to the Region structure. */ /* Obtain a pointer to the Region structure. */
this = (AstRegion *) this_frame; this = (AstRegion *) this_frame;
/* Validate the axis index. */ /* Validate the axis index. */
(void) astValidateAxis( this, axis, "astAbbrev" ); (void) astValidateAxis( this, axis, 1, "astAbbrev" );
/* Obtain a pointer to the Region's current Frame and invoke this /* Obtain a pointer to the Region's current Frame and invoke this
Frame's astAbbrev method to perform the processing. Annul the Frame Frame's astAbbrev method to perform the processing. Annul the Frame
pointer afterwards. */ pointer afterwards. */
fr = astGetFrame( this->frameset, AST__CURRENT ); fr = astGetFrame( this->frameset, AST__CURRENT );
result = astAbbrev( fr, axis, fmt, str1, str2 ); result = astAbbrev( fr, axis, fmt, str1, str2 );
fr = astAnnul( fr ); fr = astAnnul( fr );
/* If an error occurred, clear the result. */ /* If an error occurred, clear the result. */
if ( !astOK ) result = str2; if ( !astOK ) result = str2;
skipping to change at line 1359 skipping to change at line 1366
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
double result; /* Value to return */ double result; /* Value to return */
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return AST__BAD; if ( !astOK ) return AST__BAD;
/* Obtain a pointer to the FrameSet structure. */ /* Obtain a pointer to the FrameSet structure. */
this = (AstRegion *) this_frame; this = (AstRegion *) this_frame;
/* Validate the axis index. */ /* Validate the axis index. */
(void) astValidateAxis( this, axis - 1, "astAxAngle" ); (void) astValidateAxis( this, axis - 1, 1, "astAxAngle" );
/* Obtain a pointer to the Region's encapsulated Frame and invoke the /* Obtain a pointer to the Region's encapsulated Frame and invoke the
astAxAngle method for this Frame. Annul the Frame pointer astAxAngle method for this Frame. Annul the Frame pointer
afterwards. */ afterwards. */
fr = astGetFrame( this->frameset, AST__CURRENT ); fr = astGetFrame( this->frameset, AST__CURRENT );
result = astAxAngle( fr, a, b, axis ); result = astAxAngle( fr, a, b, axis );
fr = astAnnul( fr ); fr = astAnnul( fr );
/* If an error occurred, clear the result value. */ /* If an error occurred, clear the result value. */
if ( !astOK ) result = AST__BAD; if ( !astOK ) result = AST__BAD;
skipping to change at line 1438 skipping to change at line 1445
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
double result; /* Value to return */ double result; /* Value to return */
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return AST__BAD; if ( !astOK ) return AST__BAD;
/* Obtain a pointer to the FrameSet structure. */ /* Obtain a pointer to the FrameSet structure. */
this = (AstRegion *) this_frame; this = (AstRegion *) this_frame;
/* Validate the axis index. */ /* Validate the axis index. */
(void) astValidateAxis( this, axis - 1, "astAxDistance" ); (void) astValidateAxis( this, axis - 1, 1, "astAxDistance" );
/* Obtain a pointer to the Region's encapsulated Frame and invoke the /* Obtain a pointer to the Region's encapsulated Frame and invoke the
astAxDistance method for this Frame. Annul the Frame pointer astAxDistance method for this Frame. Annul the Frame pointer
afterwards. */ afterwards. */
fr = astGetFrame( this->frameset, AST__CURRENT ); fr = astGetFrame( this->frameset, AST__CURRENT );
result = astAxDistance( fr, axis, v1, v2 ); result = astAxDistance( fr, axis, v1, v2 );
fr = astAnnul( fr ); fr = astAnnul( fr );
/* If an error occurred, clear the result value. */ /* If an error occurred, clear the result value. */
if ( !astOK ) result = AST__BAD; if ( !astOK ) result = AST__BAD;
skipping to change at line 1517 skipping to change at line 1524
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
double result; /* Value to return */ double result; /* Value to return */
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return AST__BAD; if ( !astOK ) return AST__BAD;
/* Obtain a pointer to the FrameSet structure. */ /* Obtain a pointer to the FrameSet structure. */
this = (AstRegion *) this_frame; this = (AstRegion *) this_frame;
/* Validate the axis index. */ /* Validate the axis index. */
(void) astValidateAxis( this, axis - 1, "astAxOffset" ); (void) astValidateAxis( this, axis - 1, 1, "astAxOffset" );
/* Obtain a pointer to the Region's encapsulated Frame and invoke the /* Obtain a pointer to the Region's encapsulated Frame and invoke the
astAxOffset method for this Frame. Annul the Frame pointer astAxOffset method for this Frame. Annul the Frame pointer
afterwards. */ afterwards. */
fr = astGetFrame( this->frameset, AST__CURRENT ); fr = astGetFrame( this->frameset, AST__CURRENT );
result = astAxOffset( fr, axis, v1, dist ); result = astAxOffset( fr, axis, v1, dist );
fr = astAnnul( fr ); fr = astAnnul( fr );
/* If an error occurred, clear the result value. */ /* If an error occurred, clear the result value. */
if ( !astOK ) result = AST__BAD; if ( !astOK ) result = AST__BAD;
skipping to change at line 1990 skipping to change at line 1997
* attrib * attrib
* Pointer to a null terminated string specifying the attribute * Pointer to a null terminated string specifying the attribute
* name. This should be in lower case with no surrounding white * name. This should be in lower case with no surrounding white
* space. * space.
* status * status
* Pointer to the inherited status variable. * Pointer to the inherited status variable.
*/ */
/* Local Variables: */ /* Local Variables: */
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
int len; /* Length of attrib string */
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return; if ( !astOK ) return;
/* Obtain a pointer to the Region structure. */ /* Obtain a pointer to the Region structure. */
this = (AstRegion *) this_object; this = (AstRegion *) this_object;
/* Obtain the length of the "attrib" string. */
len = strlen( attrib );
/* Check the attribute name and clear the appropriate attribute. */ /* Check the attribute name and clear the appropriate attribute. */
/* We first handle attributes that apply to the Region as a whole /* We first handle attributes that apply to the Region as a whole
(rather than to the encapsulated FrameSet). */ (rather than to the encapsulated FrameSet). */
/* Negated */ /* Negated */
/* ------- */ /* ------- */
if ( !strcmp( attrib, "negated" ) ) { if ( !strcmp( attrib, "negated" ) ) {
astClearNegated( this ); astClearNegated( this );
skipping to change at line 2728 skipping to change at line 2731
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
const char *result; /* Pointer value to return */ const char *result; /* Pointer value to return */
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return NULL; if ( !astOK ) return NULL;
/* Obtain a pointer to the Region structure. */ /* Obtain a pointer to the Region structure. */
this = (AstRegion *) this_frame; this = (AstRegion *) this_frame;
/* Validate the axis index. */ /* Validate the axis index. */
(void) astValidateAxis( this, axis, "astFormat" ); (void) astValidateAxis( this, axis, 1, "astFormat" );
/* Obtain a pointer to the Region's current Frame and invoke the /* Obtain a pointer to the Region's current Frame and invoke the
astFormat method for this Frame. Annul the Frame pointer astFormat method for this Frame. Annul the Frame pointer
afterwards. */ afterwards. */
fr = astGetFrame( this->frameset, AST__CURRENT ); fr = astGetFrame( this->frameset, AST__CURRENT );
result = astFormat( fr, axis, value ); result = astFormat( fr, axis, value );
fr = astAnnul( fr ); fr = astAnnul( fr );
/* If an error occurred, clear the result value. */ /* If an error occurred, clear the result value. */
if ( !astOK ) result = NULL; if ( !astOK ) result = NULL;
skipping to change at line 2806 skipping to change at line 2809
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
double result; /* Gap value to return */ double result; /* Gap value to return */
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return 0.0; if ( !astOK ) return 0.0;
/* Obtain a pointer to the Region structure. */ /* Obtain a pointer to the Region structure. */
this = (AstRegion *) this_frame; this = (AstRegion *) this_frame;
/* Validate the axis index. */ /* Validate the axis index. */
(void) astValidateAxis( this, axis, "astGap" ); (void) astValidateAxis( this, axis, 1, "astGap" );
/* Obtain a pointer to the Region's current Frame and invoke this /* Obtain a pointer to the Region's current Frame and invoke this
Frame's astGap method to obtain the required gap value. Annul the Frame's astGap method to obtain the required gap value. Annul the
Frame pointer afterwards. */ Frame pointer afterwards. */
fr = astGetFrame( this->frameset, AST__CURRENT ); fr = astGetFrame( this->frameset, AST__CURRENT );
result = astGap( fr, axis, gap, ntick ); result = astGap( fr, axis, gap, ntick );
fr = astAnnul( fr ); fr = astAnnul( fr );
/* If an error occurred, clear the result. */ /* If an error occurred, clear the result. */
if ( !astOK ) result = 0.0; if ( !astOK ) result = 0.0;
skipping to change at line 2882 skipping to change at line 2885
/* Invoke the GetObjSize method inherited from the parent class, and then /* Invoke the GetObjSize method inherited from the parent class, and then
add on any components of the class structure defined by thsi class add on any components of the class structure defined by thsi class
which are stored in dynamically allocated memory. */ which are stored in dynamically allocated memory. */
result = (*parent_getobjsize)( this_object, status ); result = (*parent_getobjsize)( this_object, status );
result += astGetObjSize( this->frameset ); result += astGetObjSize( this->frameset );
result += astGetObjSize( this->points ); result += astGetObjSize( this->points );
result += astGetObjSize( this->basemesh ); result += astGetObjSize( this->basemesh );
result += astGetObjSize( this->basegrid ); result += astGetObjSize( this->basegrid );
result += astGetObjSize( this->unc ); result += astGetObjSize( this->unc );
result += astGetObjSize( this->negation );
result += astGetObjSize( this->defunc ); result += astGetObjSize( this->defunc );
/* If an error occurred, clear the result value. */ /* If an error occurred, clear the result value. */
if ( !astOK ) result = 0; if ( !astOK ) result = 0;
/* Return the result, */ /* Return the result, */
return result; return result;
} }
static const char *GetAttrib( AstObject *this_object, const char *attrib, i nt *status ) { static const char *GetAttrib( AstObject *this_object, const char *attrib, i nt *status ) {
skipping to change at line 2946 skipping to change at line 2950
* with the global error status set, or if it should fail for any * with the global error status set, or if it should fail for any
* reason. * reason.
*/ */
/* Local Variables: */ /* Local Variables: */
astDECLARE_GLOBALS /* Pointer to thread-specific global data * / astDECLARE_GLOBALS /* Pointer to thread-specific global data * /
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
const char *result; /* Pointer value to return */ const char *result; /* Pointer value to return */
double dval; /* Floating point attribute value */ double dval; /* Floating point attribute value */
int ival; /* Integer attribute value */ int ival; /* Integer attribute value */
int len; /* Length of attrib string */
/* Initialise. */ /* Initialise. */
result = NULL; result = NULL;
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return result; if ( !astOK ) return result;
/* Get a pointer to the thread specific global data structure. */ /* Get a pointer to the thread specific global data structure. */
astGET_GLOBALS(this_object); astGET_GLOBALS(this_object);
/* Obtain a pointer to the Region structure. */ /* Obtain a pointer to the Region structure. */
this = (AstRegion *) this_object; this = (AstRegion *) this_object;
/* Obtain the length of the attrib string. */
len = strlen( attrib );
/* Compare "attrib" with each recognised attribute name in turn, /* Compare "attrib" with each recognised attribute name in turn,
obtaining the value of the required attribute. If necessary, write obtaining the value of the required attribute. If necessary, write
the value into "getattrib_buff" as a null-terminated string in an approp riate the value into "getattrib_buff" as a null-terminated string in an approp riate
format. Set "result" to point at the result string. */ format. Set "result" to point at the result string. */
/* We first handle attributes that apply to the Region as a whole /* We first handle attributes that apply to the Region as a whole
(rather than to the encapsulated FrameSet). */ (rather than to the encapsulated FrameSet). */
/* Negated */ /* Negated */
/* ------- */ /* ------- */
skipping to change at line 3232 skipping to change at line 3232
AstAxis *result; /* Pointer to Axis */ AstAxis *result; /* Pointer to Axis */
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return NULL; if ( !astOK ) return NULL;
/* Obtain a pointer to the Region structure. */ /* Obtain a pointer to the Region structure. */
this = (AstRegion *) this_frame; this = (AstRegion *) this_frame;
/* Validate the axis index. */ /* Validate the axis index. */
(void) astValidateAxis( this, axis, "astGetAxis" ); (void) astValidateAxis( this, axis, 1, "astGetAxis" );
/* Obtain a pointer to the Region's encapsulated FrameSet and invoke /* Obtain a pointer to the Region's encapsulated FrameSet and invoke
this FrameSet's astGetAxis method to obtain the required Axis this FrameSet's astGetAxis method to obtain the required Axis
pointer. */ pointer. */
result = astGetAxis( this->frameset, axis ); result = astGetAxis( this->frameset, axis );
/* If an error occurred, annul the result. */ /* If an error occurred, annul the result. */
if ( !astOK ) result = astAnnul( result ); if ( !astOK ) result = astAnnul( result );
/* Return the result. */ /* Return the result. */
skipping to change at line 3348 skipping to change at line 3348
ubnd = astFree( ubnd ); ubnd = astFree( ubnd );
bfrm = astAnnul( bfrm ); bfrm = astAnnul( bfrm );
/* Return NULL if an error occurred. */ /* Return NULL if an error occurred. */
if( !astOK ) result = astAnnul( result ); if( !astOK ) result = astAnnul( result );
/* Return the required pointer. */ /* Return the required pointer. */
return result; return result;
} }
static AstRegion *GetNegation( AstRegion *this, int *status ) {
/*
*+
* Name:
* astGetNegation
* Purpose:
* Obtain a pointer to a negated copy of the supplied Region.
* Type:
* Protected function.
* Synopsis:
* #include "region.h"
* AstRegion *GetNegation( AstRegion *this, int *status )
* Class Membership:
* Region virtual function.
* Description:
* This function returns a pointer to a Region which is a negated
* copy of "this". The copy is cached in the Region structure for
* future use.
* Parameters:
* this
* Pointer to the Region.
* Returned Value:
* A pointer to the Region. This should be annulled (using astAnnul)
* when no longer needed.
* Notes:
* - A NULL pointer will be returned if this function is invoked
* with the global error status set, or if it should fail for any
* reason.
*-
*/
/* Check the global error status. */
if ( !astOK ) return NULL;
/* If the Region struture does not contain a pointer to a negated copy of
itself, create one now. */
if( ! this->negation ) {
this->negation = astCopy( this );
astNegate( this->negation );
}
/* Return a clone of the negation pointer. */
return astClone( this->negation );
}
static AstFrameSet *GetRegFS( AstRegion *this, int *status ) { static AstFrameSet *GetRegFS( AstRegion *this, int *status ) {
/* /*
*+ *+
* Name: * Name:
* astGetRegFS * astGetRegFS
* Purpose: * Purpose:
* Obtain a pointer to the FrameSet encapsulated within a Region. * Obtain a pointer to the FrameSet encapsulated within a Region.
* Type: * Type:
skipping to change at line 4283 skipping to change at line 4336
vtab->RegBaseMesh = RegBaseMesh; vtab->RegBaseMesh = RegBaseMesh;
vtab->RegBaseBox = RegBaseBox; vtab->RegBaseBox = RegBaseBox;
vtab->RegBaseBox2 = RegBaseBox2; vtab->RegBaseBox2 = RegBaseBox2;
vtab->RegBasePick = RegBasePick; vtab->RegBasePick = RegBasePick;
vtab->RegCentre = RegCentre; vtab->RegCentre = RegCentre;
vtab->RegGrid = RegGrid; vtab->RegGrid = RegGrid;
vtab->RegMesh = RegMesh; vtab->RegMesh = RegMesh;
vtab->RegClearAttrib = RegClearAttrib; vtab->RegClearAttrib = RegClearAttrib;
vtab->RegSetAttrib = RegSetAttrib; vtab->RegSetAttrib = RegSetAttrib;
vtab->GetDefUnc = GetDefUnc; vtab->GetDefUnc = GetDefUnc;
vtab->GetNegation = GetNegation;
vtab->GetUncFrm = GetUncFrm; vtab->GetUncFrm = GetUncFrm;
vtab->SetUnc = SetUnc; vtab->SetUnc = SetUnc;
vtab->GetUnc = GetUnc; vtab->GetUnc = GetUnc;
vtab->ShowMesh = ShowMesh; vtab->ShowMesh = ShowMesh;
vtab->GetRegionBounds = GetRegionBounds; vtab->GetRegionBounds = GetRegionBounds;
vtab->GetRegionBounds2 = GetRegionBounds2; vtab->GetRegionBounds2 = GetRegionBounds2;
vtab->GetRegionMesh = GetRegionMesh; vtab->GetRegionMesh = GetRegionMesh;
vtab->GetRegionPoints = GetRegionPoints; vtab->GetRegionPoints = GetRegionPoints;
vtab->RegOverlay = RegOverlay; vtab->RegOverlay = RegOverlay;
vtab->RegFrame = RegFrame; vtab->RegFrame = RegFrame;
skipping to change at line 5000 skipping to change at line 5054
/* Invoke the ManageLock method inherited from the parent class. */ /* Invoke the ManageLock method inherited from the parent class. */
if( !result ) result = (*parent_managelock)( this_object, mode, extra, if( !result ) result = (*parent_managelock)( this_object, mode, extra,
fail, status ); fail, status );
/* Invoke the astManageLock method on any Objects contained within /* Invoke the astManageLock method on any Objects contained within
the supplied Object. */ the supplied Object. */
if( !result ) result = astManageLock( this->frameset, mode, extra, fail ); if( !result ) result = astManageLock( this->frameset, mode, extra, fail );
if( !result ) result = astManageLock( this->points, mode, extra, fail ); if( !result ) result = astManageLock( this->points, mode, extra, fail );
if( !result ) result = astManageLock( this->unc, mode, extra, fail ); if( !result ) result = astManageLock( this->unc, mode, extra, fail );
if( !result ) result = astManageLock( this->negation, mode, extra, fail );
if( !result ) result = astManageLock( this->defunc, mode, extra, fail ); if( !result ) result = astManageLock( this->defunc, mode, extra, fail );
if( !result ) result = astManageLock( this->basemesh, mode, extra, fail ); if( !result ) result = astManageLock( this->basemesh, mode, extra, fail );
if( !result ) result = astManageLock( this->basegrid, mode, extra, fail ); if( !result ) result = astManageLock( this->basegrid, mode, extra, fail );
return result; return result;
} }
#endif #endif
static AstRegion *MapRegion( AstRegion *this, AstMapping *map0, static AstRegion *MapRegion( AstRegion *this, AstMapping *map0,
skipping to change at line 9183 skipping to change at line 9238
* structure. * structure.
* Parameters: * Parameters:
* this * this
* Pointer to the Region. * Pointer to the Region.
*- *-
*/ */
if( this ) { if( this ) {
if( this->basemesh ) this->basemesh = astAnnul( this->basemesh ); if( this->basemesh ) this->basemesh = astAnnul( this->basemesh );
if( this->basegrid ) this->basegrid = astAnnul( this->basegrid ); if( this->basegrid ) this->basegrid = astAnnul( this->basegrid );
if( this->negation ) this->negation = astAnnul( this->negation );
} }
} }
static void Resolve( AstFrame *this_frame, const double point1[], static void Resolve( AstFrame *this_frame, const double point1[],
const double point2[], const double point3[], const double point2[], const double point3[],
double point4[], double *d1, double *d2, int *status ) { double point4[], double *d1, double *d2, int *status ) {
/* /*
* Name: * Name:
* Resolve * Resolve
skipping to change at line 9606 skipping to change at line 9662
AstFrame *fr; /* Pointer to current Frame */ AstFrame *fr; /* Pointer to current Frame */
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return; if ( !astOK ) return;
/* Obtain a pointer to the Region structure. */ /* Obtain a pointer to the Region structure. */
this = (AstRegion *) this_frame; this = (AstRegion *) this_frame;
/* Validate the axis index supplied. */ /* Validate the axis index supplied. */
(void) astValidateAxis( this, axis, "astSetAxis" ); (void) astValidateAxis( this, axis, 1, "astSetAxis" );
/* Obtain a pointer to the Region's current Frame and invoke this /* Obtain a pointer to the Region's current Frame and invoke this
Frame's astSetAxis method to assign the new Axis object. Annul the Frame's astSetAxis method to assign the new Axis object. Annul the
Frame pointer afterwards. */ Frame pointer afterwards. */
fr = astGetFrame( this->frameset, AST__CURRENT ); fr = astGetFrame( this->frameset, AST__CURRENT );
astSetAxis( fr, axis, newaxis ); astSetAxis( fr, axis, newaxis );
fr = astAnnul( fr ); fr = astAnnul( fr );
} }
static void SetRegFS( AstRegion *this, AstFrame *frm, int *status ) { static void SetRegFS( AstRegion *this, AstFrame *frm, int *status ) {
skipping to change at line 11071 skipping to change at line 11127
/* Initialise. */ /* Initialise. */
nc = 0; nc = 0;
/* Check the global error status. */ /* Check the global error status. */
if ( !astOK ) return nc; if ( !astOK ) return nc;
/* Obtain a pointer to the Region structure. */ /* Obtain a pointer to the Region structure. */
this = (AstRegion *) this_frame; this = (AstRegion *) this_frame;
/* Validate the axis index. */ /* Validate the axis index. */
(void) astValidateAxis( this, axis, "astUnformat" ); (void) astValidateAxis( this, axis, 1, "astUnformat" );
/* Obtain a pointer to the Region's current Frame and invoke the /* Obtain a pointer to the Region's current Frame and invoke the
astUnformat method for this Frame. Annul the Frame pointer astUnformat method for this Frame. Annul the Frame pointer
afterwards. */ afterwards. */
fr = astGetFrame( this->frameset, AST__CURRENT ); fr = astGetFrame( this->frameset, AST__CURRENT );
nc = astUnformat( fr, axis, string, &coord ); nc = astUnformat( fr, axis, string, &coord );
fr = astAnnul( fr ); fr = astAnnul( fr );
/* If an error occurred, clear the number of characters read. */ /* If an error occurred, clear the number of characters read. */
if ( !astOK ) { if ( !astOK ) {
skipping to change at line 11093 skipping to change at line 11149
/* Otherwise, if characters were read, return the coordinate value. */ /* Otherwise, if characters were read, return the coordinate value. */
} else if ( nc ) { } else if ( nc ) {
*value = coord; *value = coord;
} }
/* Return the number of characters read. */ /* Return the number of characters read. */
return nc; return nc;
} }
static int ValidateAxis( AstFrame *this_frame, int axis, const char *method static int ValidateAxis( AstFrame *this_frame, int axis, int fwd,
, int *status ) { const char *method, int *status ) {
/* /*
* Name: * Name:
* ValidateAxis * ValidateAxis
* Purpose: * Purpose:
* Validate and permute a Region's axis index. * Validate and permute a Region's axis index.
* Type: * Type:
* Private function. * Private function.
* Synopsis: * Synopsis:
* #include "region.h" * #include "region.h"
* int ValidateAxis( AstFrame *this, int axis, const char *method, int * * int ValidateAxis( AstFrame *this, int axis, int fwd, const char *meth
status ) od,
* int *status )
* Class Membership: * Class Membership:
* Region member function (over-rides the protected * Region member function (over-rides the protected
* astValidateAxis method inherited from the Frame class). * astValidateAxis method inherited from the Frame class).
* Description: * Description:
* This function checks the validity of an index (zero-based) which * This function checks the validity of an index (zero-based) which
* is to be used to address one of the coordinate axes of the * is to be used to address one of the coordinate axes of the
* current Frame in a Region. If the index is valid, it is * current Frame in a Region. If the index is valid, it is
* permuted using the axis permutation array associated with the * permuted using the axis permutation array associated with the
skipping to change at line 11130 skipping to change at line 11188
* valid, an error is reported and the global error status is set. * valid, an error is reported and the global error status is set.
* Parameters: * Parameters:
* this * this
* Pointer to the Region. * Pointer to the Region.
* axis * axis
* The axis index (zero-based) to be checked. To be valid, it * The axis index (zero-based) to be checked. To be valid, it
* must lie between zero and (naxes-1) inclusive, where "naxes" * must lie between zero and (naxes-1) inclusive, where "naxes"
* is the number of coordinate axes associated with the * is the number of coordinate axes associated with the
* Region's current Frame. * Region's current Frame.
* fwd
* If non-zero, the suppplied axis index is assumed to be an
* "external" axis index, and the corresponding "internal" axis index
* is returned as the function value. Otherwise, the suppplied axis
* index is assumed to be an "internal" axis index, and the
* corresponding "external" axis index is returned as the function
* value.
* method * method
* Pointer to a constant null-terminated character string * Pointer to a constant null-terminated character string
* containing the name of the method that invoked this function * containing the name of the method that invoked this function
* to validate an axis index. This method name is used solely * to validate an axis index. This method name is used solely
* for constructing error messages. * for constructing error messages.
* status * status
* Pointer to the inherited status variable. * Pointer to the inherited status variable.
* Returned Value: * Returned Value:
* The permuted axis index. * The permuted axis index - either "internal" or "external" as
* specified by "fwd".
* Notes: * Notes:
* - A value of zero will be returned if this function is invoked * - A value of zero will be returned if this function is invoked
* with the global error status set, or if it should fail for any * with the global error status set, or if it should fail for any
* reason. * reason.
*/ */
/* Local Variables: */ /* Local Variables: */
AstFrame *fr; /* Pointer to current Frame */ AstFrame *fr; /* Pointer to current Frame */
AstRegion *this; /* Pointer to the Region structure */ AstRegion *this; /* Pointer to the Region structure */
skipping to change at line 11186 skipping to change at line 11252
astError( AST__AXIIN, "%s(%s): Axis index (%d) invalid - it should " astError( AST__AXIIN, "%s(%s): Axis index (%d) invalid - it should "
"be in the range 1 to %d.", status, method, astGetClass( this ), "be in the range 1 to %d.", status, method, astGetClass( this ),
axis + 1, naxes ); axis + 1, naxes );
/* If the axis index was valid, obtain a pointer to the Region's /* If the axis index was valid, obtain a pointer to the Region's
current Frame and invoke this Frame's astValidateAxis method to current Frame and invoke this Frame's astValidateAxis method to
obtain the permuted axis index. Annul the Frame pointer obtain the permuted axis index. Annul the Frame pointer
afterwards. */ afterwards. */
} else { } else {
fr = astGetFrame( this->frameset, AST__CURRENT ); fr = astGetFrame( this->frameset, AST__CURRENT );
result = astValidateAxis( fr, axis, "astValidateAxis" ); result = astValidateAxis( fr, axis, fwd, "astValidateAxis" );
fr = astAnnul( fr ); fr = astAnnul( fr );
} }
} }
/* If an error occurred, clear the result value. */ /* If an error occurred, clear the result value. */
if ( !astOK ) result = 0; if ( !astOK ) result = 0;
/* Return the result. */ /* Return the result. */
return result; return result;
} }
skipping to change at line 11846 skipping to change at line 11912
in = (AstRegion *) objin; in = (AstRegion *) objin;
out = (AstRegion *) objout; out = (AstRegion *) objout;
/* For safety, first clear any references to the input memory from /* For safety, first clear any references to the input memory from
the output Region. */ the output Region. */
out->basemesh = NULL; out->basemesh = NULL;
out->basegrid = NULL; out->basegrid = NULL;
out->frameset = NULL; out->frameset = NULL;
out->points = NULL; out->points = NULL;
out->unc = NULL; out->unc = NULL;
out->negation = NULL;
out->defunc = NULL; out->defunc = NULL;
/* Now copy each of the above structures. */ /* Now copy each of the above structures. */
out->frameset = astCopy( in->frameset ); out->frameset = astCopy( in->frameset );
if( in->points ) out->points = astCopy( in->points ); if( in->points ) out->points = astCopy( in->points );
if( in->basemesh ) out->basemesh = astCopy( in->basemesh ); if( in->basemesh ) out->basemesh = astCopy( in->basemesh );
if( in->basegrid ) out->basegrid = astCopy( in->basegrid ); if( in->basegrid ) out->basegrid = astCopy( in->basegrid );
if( in->unc ) out->unc = astCopy( in->unc ); if( in->unc ) out->unc = astCopy( in->unc );
if( in->negation ) out->negation = astCopy( in->negation );
if( in->defunc ) out->defunc = astCopy( in->defunc ); if( in->defunc ) out->defunc = astCopy( in->defunc );
} }
/* Destructor. */ /* Destructor. */
/* ----------- */ /* ----------- */
static void Delete( AstObject *obj, int *status ) { static void Delete( AstObject *obj, int *status ) {
/* /*
* Name: * Name:
* Delete * Delete
skipping to change at line 11899 skipping to change at line 11967
/* Obtain a pointer to the Region structure. */ /* Obtain a pointer to the Region structure. */
this = (AstRegion *) obj; this = (AstRegion *) obj;
/* Annul all resources. */ /* Annul all resources. */
this->frameset = astAnnul( this->frameset ); this->frameset = astAnnul( this->frameset );
if( this->points ) this->points = astAnnul( this->points ); if( this->points ) this->points = astAnnul( this->points );
if( this->basemesh ) this->basemesh = astAnnul( this->basemesh ); if( this->basemesh ) this->basemesh = astAnnul( this->basemesh );
if( this->basegrid ) this->basegrid = astAnnul( this->basegrid ); if( this->basegrid ) this->basegrid = astAnnul( this->basegrid );
if( this->unc ) this->unc = astAnnul( this->unc ); if( this->unc ) this->unc = astAnnul( this->unc );
if( this->negation ) this->negation = astAnnul( this->negation );
if( this->defunc ) this->defunc = astAnnul( this->defunc ); if( this->defunc ) this->defunc = astAnnul( this->defunc );
} }
/* Dump function. */ /* Dump function. */
/* -------------- */ /* -------------- */
static void Dump( AstObject *this_object, AstChannel *channel, int *status ) { static void Dump( AstObject *this_object, AstChannel *channel, int *status ) {
/* /*
* Name: * Name:
* Dump * Dump
skipping to change at line 12220 skipping to change at line 12289
new->meshsize = -INT_MAX; new->meshsize = -INT_MAX;
new->adaptive = -INT_MAX; new->adaptive = -INT_MAX;
new->basemesh = NULL; new->basemesh = NULL;
new->basegrid = NULL; new->basegrid = NULL;
new->negated = -INT_MAX; new->negated = -INT_MAX;
new->closed = -INT_MAX; new->closed = -INT_MAX;
new->regionfs = -INT_MAX; new->regionfs = -INT_MAX;
new->fillfactor = AST__BAD; new->fillfactor = AST__BAD;
new->defunc = NULL; new->defunc = NULL;
new->nomap = 0; new->nomap = 0;
new->negation = NULL;
/* If the supplied Frame is a Region, gets its encapsulated Frame. If a /* If the supplied Frame is a Region, gets its encapsulated Frame. If a
FrameSet was supplied, use its current Frame, otherwise use the FrameSet was supplied, use its current Frame, otherwise use the
supplied Frame. */ supplied Frame. */
if( astIsARegion( frame ) ) { if( astIsARegion( frame ) ) {
f0 = astGetFrame( ((AstRegion *) frame)->frameset, AST__CURRENT ); f0 = astGetFrame( ((AstRegion *) frame)->frameset, AST__CURRENT );
} else if( astIsAFrameSet( frame ) ) { } else if( astIsAFrameSet( frame ) ) {
f0 = astGetFrame( (AstFrameSet *) frame, AST__CURRENT ); f0 = astGetFrame( (AstFrameSet *) frame, AST__CURRENT );
skipping to change at line 12682 skipping to change at line 12752
} }
AstPointSet *astRegMesh_( AstRegion *this, int *status ){ AstPointSet *astRegMesh_( AstRegion *this, int *status ){
if ( !astOK ) return NULL; if ( !astOK ) return NULL;
return (**astMEMBER(this,Region,RegMesh))( this, status ); return (**astMEMBER(this,Region,RegMesh))( this, status );
} }
double *astRegCentre_( AstRegion *this, double *cen, double **ptr, int inde x, double *astRegCentre_( AstRegion *this, double *cen, double **ptr, int inde x,
int ifrm, int *status ){ int ifrm, int *status ){
if ( !astOK ) return NULL; if ( !astOK ) return NULL;
return (**astMEMBER(this,Region,RegCentre))( this, cen, ptr, index, ifrm , status ); return (**astMEMBER(this,Region,RegCentre))( this, cen, ptr, index, ifrm , status );
} }
AstRegion *astGetNegation_( AstRegion *this, int *status ){
if ( !astOK ) return NULL;
return (**astMEMBER(this,Region,GetNegation))( this, status );
}
AstRegion *astGetUncFrm_( AstRegion *this, int ifrm, int *status ){ AstRegion *astGetUncFrm_( AstRegion *this, int ifrm, int *status ){
if ( !astOK ) return NULL; if ( !astOK ) return NULL;
return (**astMEMBER(this,Region,GetUncFrm))( this, ifrm, status ); return (**astMEMBER(this,Region,GetUncFrm))( this, ifrm, status );
} }
AstRegion *astGetDefUnc_( AstRegion *this, int *status ){ AstRegion *astGetDefUnc_( AstRegion *this, int *status ){
if ( !astOK ) return NULL; if ( !astOK ) return NULL;
return (**astMEMBER(this,Region,GetDefUnc))( this, status ); return (**astMEMBER(this,Region,GetDefUnc))( this, status );
} }
AstRegion *astGetUnc_( AstRegion *this, int def, int *status ){ AstRegion *astGetUnc_( AstRegion *this, int def, int *status ){
if ( !astOK ) return NULL; if ( !astOK ) return NULL;
 End of changes. 35 change blocks. 
28 lines changed or deleted 104 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/