Starlink-AST

 view release on metacpan or  search on metacpan

ast/src/axis.c  view on Meta::CPAN

707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
      result = "<bad>";
 
/* Otherwise, obtain a pointer to the Format string. Note a private member
   function is used here in preference to an object method. This is because the
   syntax of the Format string may be extended by derived classes and we do not
   want to obtain a string that we cannot interpret here (where we are
   restricted to C format specifiers capable of formatting double values).
   Classes that extend the syntax should provide their own astAxisFormat method
   and may need to store the string in a separate location. The original
   location should not be re-used as the string it contains may be needed by
   the Axis astOverlay method when overlaying attributes on to another Axis
   object. */
   } else {
      fmt0 = GetAxisFormat( this, status );
 
/* Parse the Format string. This returns a collection of flags indicating
   if any AST specific formatting features are specified in the Format
   string. It also returns a pointer to a new Format string which is a
   standard C printf format specifier. Currently the only flags are "log"
   which indicates if the value should be formatted as "10**x" using
   the graphical escape sequences defined within the Plot class to produce

ast/src/axis.c  view on Meta::CPAN

1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
*     Protected virtual function.
 
*  Synopsis:
*     #include "axis.h"
*     void astAxisOverlay( AstAxis *template, AstAxis *result )
 
*  Class Membership:
*     Axis method.
 
*  Description:
*     This function overlays attributes of one Axis (the "template") on to
*     another Axis, so as to over-ride selected attributes of that second
*     Axis. Normally only those attributes which have been specifically set
*     in the template will be transferred. This implements a form of
*     defaulting, in which an Axis acquires attributes from the template, but
*     retains its original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
 
*  Parameters:
*     template
*        Pointer to the template Axis, for which values should have been

ast/src/axis.c  view on Meta::CPAN

1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
*        Pointer to the Axis which is to receive the new attribute values.
 
*  Returned Value:
*     void
*-
*/
 
/* Check the global error status. */
   if ( !astOK ) return;
 
/* Define a macro to overlay a single attribute. This tests if the attribute
   is set in the template Axis. If it is, its value is obtained and set in the
   result Axis also. */
#define OVERLAY(par) \
   if ( astTestAxis##par( template ) ) { \
      astSetAxis##par( result, astGetAxis##par( template ) ); \
   }
/* Overlay each Axis attribute in turn. */
   OVERLAY(Digits);
   OVERLAY(Direction);
   OVERLAY(Label);

ast/src/cmpframe.c  view on Meta::CPAN

604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
static int (* parent_getusedefs)( AstObject *, int * );
static int (* parent_testattrib)( AstObject *, const char *, int * );
static void (* parent_clearalignsystem)( AstFrame *, int * );
static void (* parent_clearattrib)( AstObject *, const char *, int * );
static void (* parent_cleardtai)( AstFrame *, int * );
static void (* parent_cleardut1)( AstFrame *, int * );
static void (* parent_clearepoch)( AstFrame *, int * );
static void (* parent_clearobsalt)( AstFrame *, int * );
static void (* parent_clearobslat)( AstFrame *, int * );
static void (* parent_clearobslon)( AstFrame *, int * );
static void (* parent_overlay)( AstFrame *, const int *, AstFrame *, int * );
static void (* parent_setactiveunit)( AstFrame *, int, int * );
static void (* parent_setattrib)( AstObject *, const char *, int * );
static void (* parent_setdtai)( AstFrame *, double, int * );
static void (* parent_setdut1)( AstFrame *, double, int * );
static void (* parent_setepoch)( AstFrame *, double, int * );
static void (* parent_setframeflags)( AstFrame *, int, int * );
static void (* parent_setobsalt)( AstFrame *, double, int * );
static void (* parent_setobslat)( AstFrame *, double, int * );
static void (* parent_setobslon)( AstFrame *, double, int * );

ast/src/cmpframe.c  view on Meta::CPAN

4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
parent_getsystem = frame->GetSystem;
frame->GetSystem = GetSystem;
 
parent_getalignsystem = frame->GetAlignSystem;
frame->GetAlignSystem = GetAlignSystem;
 
parent_clearalignsystem = frame->ClearAlignSystem;
frame->ClearAlignSystem = ClearAlignSystem;
 
parent_overlay = frame->Overlay;
frame->Overlay = Overlay;
 
parent_setactiveunit = frame->SetActiveUnit;
frame->SetActiveUnit = SetActiveUnit;
 
parent_getactiveunit = frame->GetActiveUnit;
frame->GetActiveUnit = GetActiveUnit;
 
parent_setframeflags = frame->SetFrameFlags;
frame->SetFrameFlags = SetFrameFlags;

ast/src/cmpframe.c  view on Meta::CPAN

6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
*  Synopsis:
*     #include "cmpframe.h"
*     void Overlay( AstFrame *template, const int *template_axes,
*                   AstFrame *result, int *status )
 
*  Class Membership:
*     CmpFrame member function (over-rides the protected astOverlay
*     method inherited from the Frame class).
 
*  Description:
*     This function overlays attributes from a CmpFrame on to another Frame,
*     so as to over-ride selected attributes of that second Frame. Normally
*     only those attributes which have been specifically set in the template
*     will be transferred. This implements a form of defaulting, in which
*     a Frame acquires attributes from the template, but retains its
*     original attributes (as the default) if new values have not previously
*     been explicitly set in the template.
 
*  Parameters:
*     template
*        Pointer to the template CmpFrame, for whose current Frame

ast/src/cmpframe.c  view on Meta::CPAN

6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
/* Local Variables: */
   AstCmpFrame *res;             /* Pointer to the result CmpFrame structure */
   AstCmpFrame *template;        /* Pointer to the template CmpFrame structure */
   AstFrame *sub1;               /* Template subframe for 1st result subframe */
   AstFrame *sub2;               /* Template subframe for 2nd result subframe */
   const int *perm;              /* Template axis permutation array */
   const int *rperm;             /* Result axis permutation array */
   int *axes1;                   /* Axis associations with template frame1 */
   int *axes2;                   /* Axis associations with template frame2 */
   int done;                     /* Have attributes been overlayed yet? */
   int i;                        /* Index of result axis */
   int icmp;                     /* Internal template axis number */
   int isfirst;                  /* Res. subframe -> 1st template subframe? */
   int issecond;                 /* Res. subframe -> 2nd template subframe? */
   int j;                        /* Index of template axis */
   int nc1;                      /* Number of axes in template frame1 */
   int nres1;                    /* Number of axes in first result subframe */
   int nres2;                    /* Number of axes in second result subframe */
   int nres;                     /* Number of axes in result Frame */

ast/src/cmpframe.c  view on Meta::CPAN

6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
/* Obtain a pointer to the CmpFrame structure. */
   template = (AstCmpFrame *) template_frame;
 
/* Get the axis permutation array for the template CmpFrame. */
   perm = astGetPerm( template );
 
/* Get the number of axes in the first component Frame in the template
   CmpFrame. */
   nc1 = astGetNaxes( template->frame1 );
 
/* Indicate we have not yet overlayed any attributes. */
   done = 0;
 
/* If the result Frame is a CmpFrame... */
   if( astIsACmpFrame( result ) ) {
 
/* Get the number of axes in the two component Frames of the result CmpFrame. */
      res = (AstCmpFrame *) result;
      nres1 = astGetNaxes( res->frame1 );
      nres2 = astGetNaxes( res->frame2 );

ast/src/cmpframe.c  view on Meta::CPAN

6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
/* Get the axis permutation array for the result CmpFrame. */
      rperm = astGetPerm( result );
 
/* Allocate memory for two new axes arrays, one for each result sub-frame. */
      axes1 = astMalloc( sizeof(int)*(size_t)nres1 );
      axes2 = astMalloc( sizeof(int)*(size_t)nres2 );
      if( astOK ) {
 
/* Assume that there is a 1-to-1 correspondence between axes in the
   subframes of the result and template CmpFrame. That is, all the axes
   in each result sub-frame are overlayed from the same template sub-frame. */
         done = 1;
 
/* Loop round each axis in the first result sub-frame. */
         isfirst = 0;
         issecond = 0;
         for( i = 0; i < nres1; i++ ) {
 
/* Find the external result CmpFrame axis index (j) for internal axis i. */
            for( j = 0; j < nres; j++ ) {
               if( rperm[ j ] == i ) break;

ast/src/cmpframe.c  view on Meta::CPAN

6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
            astOverlay( sub1, axes1, res->frame1 );
            astOverlay( sub2, axes2, res->frame2 );
         }
      }
 
/* Free the axes arrays. */
      axes1 = astFree( axes1 );
      axes2 = astFree( axes2 );
   }
 
/* If we have not yet overlayed any attributes... */
   if( !done ) {
 
/* Get the number of axes in the result Frame. */
      nres = astGetNaxes( result );
 
/* Allocate memory for two new template_axes arrays. */
      axes1 = astMalloc( sizeof(int)*(size_t)nres );
      axes2 = astMalloc( sizeof(int)*(size_t)nres );
      if( astOK ) {

ast/src/cmpframe.c  view on Meta::CPAN

6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
/* If this template axis is in the second component Frame, store the
   corresponding internal frame axis index in "axes2" and set "axis1" to
   -1. */
            } else {
               axes1[ i ] = -1;
               axes2[ i ] = icmp - nc1;
            }
         }
 
/* Now use the astOverlay methods of the two component Frames to overlay
   attributes onto the appropriate axes of the results Frame. */
         astOverlay( template->frame1, axes1, result );
         astOverlay( template->frame2, axes2, result );
      }
 
/* Free the axes arrays. */
      axes1 = astFree( axes1 );
      axes2 = astFree( axes2 );
   }
}

ast/src/cmpframe.c  view on Meta::CPAN

6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
/* Check the global error status. */
   if ( !astOK ) return match;
 
/* Initialise other variables to avoid compiler errors. */
   ref_naxes = 0;
 
/* Select the required sub-Frames from the target. */
/* ----------------------------------------------- */
/* We first create two sub-Frames (that can be matched against the two
   template component Frames) by selecting the two specified sets of
   axes from the target. This is done without overlaying any template
   attributes. Annul the Mappings produced by this process, as these
   are not needed. */
 
   frame1 = NULL;
   junk_map = NULL;
   (void) astSubFrame( target, NULL, naxes1, axes1, NULL, &junk_map, &frame1 );
   if( junk_map ) junk_map = astAnnul( junk_map );
 
   frame2 = NULL;
   junk_map = NULL;

ast/src/cmpframe.c  view on Meta::CPAN

9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
*                   AstFrame **result, int *status )
 
*  Class Membership:
*     CmpFrame member function (over-rides the protected astSubFrame
*     method inherited from the Frame class).
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the
*     axes from a "target" CmpFrame and creates a new Frame with
*     copies of the selected axes assembled in the requested order. It
*     then optionally overlays the attributes of a "template" Frame on
*     to the result. It returns both the resulting Frame and a Mapping
*     that describes how to convert between the coordinate systems
*     described by the target and result Frames. If necessary, this
*     Mapping takes account of any differences in the Frames'
*     attributes due to the influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target CmpFrame, from which axes are to be selected.
*     template
*        Pointer to the template Frame, from which new attributes for
*        the result Frame are to be obtained. Optionally, this may be
*        NULL, in which case no overlaying of template attributes will
*        be performed.
*     result_naxes
*        Number of axes to be selected from the target Frame. This
*        number may be greater than or less than the number of axes in
*        this Frame (or equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving
*        a list of the (zero-based) axis indices of the axes to be
*        selected from the target CmpFrame. The order in which these
*        are given determines the order in which the axes appear in
*        the result Frame. If any of the values in this array is set
*        to -1, the corresponding result axis will not be derived from
*        the target Frame, but will be assigned default attributes
*        instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This
*        should contain a list of the template axes (given as
*        zero-based axis indices) with which the axes of the result
*        Frame are to be associated. This array determines which axes
*        are used when overlaying axis-dependent attributes of the
*        template on to the result. If any element of this array is
*        set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not
*        used and a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned
*        Mapping.  The forward transformation of this Mapping will
*        describe how to convert coordinates from the coordinate

ast/src/cmpframe.c  view on Meta::CPAN

9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
               template_axes2[ n2 ] = template_axes[ result_axis ];
            }
            n2++;
         }
      }
   }
 
/* Select from first component Frame only. */
/* --------------------------------------- */
/* If all the selected axes come from the first component Frame, use
   that Frame's astSubFrame method to select them (and overlay the
   template attributes if required). */
   if ( astOK ) {
      if ( n1 && !n2 ) {
         sub_map1 = NULL;
         match = astSubFrame( target->frame1, template, n1, target_axes1,
                              template_axes1, &sub_map1, result );
 
/* If this is successful, the "result" Frame will be ready to return
   and "sub_map1" will point at a Mapping that converts from the first
   component Frame to the "result" Frame. We must now modify this

ast/src/cmpframe.c  view on Meta::CPAN

9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
/* Free the permutation arrays and annul the original Mapping pointer. */
            inperm_pref = astFree( inperm_pref );
            outperm_pref = astFree( outperm_pref );
            sub_map1 = astAnnul( sub_map1 );
         }
 
/* Select from second component Frame only. */
/* ---------------------------------------- */
/* If all the selected axes come from the second component Frame, use
   that Frame's astSubFrame method to select them (and overlay the
   template attributes if required). */
      } else if ( n2 && !n1 ) {
         sub_map2 = NULL;
         match = astSubFrame( target->frame2, template, n2, target_axes2,
                              template_axes2, &sub_map2, result );
 
/* If this is successful, the "result" Frame will be ready to return
   and "sub_map2" will point at a Mapping that converts from the second
   component Frame to the "result" Frame. We must now modify this
   mapping to account for the CmpFrame's axis permutation array

ast/src/cmpframe.c  view on Meta::CPAN

9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
/* Free the permutation arrays and annul the original Mapping pointer. */
            inperm_pref = astFree( inperm_pref );
            outperm_pref = astFree( outperm_pref );
            sub_map2 = astAnnul( sub_map2 );
         }
 
/* Select from both component Frames. */
/* ---------------------------------- */
/* If the selected axes come from both component Frames, then use both
   Frames' astSubFrame methods to select the required axes from each
   of them (and overlay the template attributes if required). */
      } else {
         sub_map1 = NULL;
         sub_map2 = NULL;
         sub_result1 = NULL;
         sub_result2 = NULL;
         match = astSubFrame( target->frame1, template, n1, target_axes1,
                              template_axes1, &sub_map1, &sub_result1 );
         if ( match ) {
            match = astSubFrame( target->frame2, template, n2, target_axes2,
                                 template_axes2, &sub_map2, &sub_result2 );

ast/src/dsbspecframe.c  view on Meta::CPAN

196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
static int class_check;
 
/* Pointers to parent class methods which are extended by this class. */
static const char *(* parent_getattrib)( AstObject *, const char *, int * );
static const char *(* parent_getlabel)( AstFrame *, int, int * );
static int (* parent_match)( AstFrame *, AstFrame *, int, int **, int **, AstMapping **, AstFrame **, int * );
static int (* parent_subframe)( AstFrame *, AstFrame *, int, const int *, const int *, AstMapping **, AstFrame **, int * );
static int (* parent_testattrib)( AstObject *, const char *, int * );
static void (* parent_clearattrib)( AstObject *, const char *, int * );
static void (* parent_setattrib)( AstObject *, const char *, int * );
static void (* parent_overlay)( AstFrame *, const int *, AstFrame *, int * );
static const char *(* parent_getdomain)( AstFrame *, int * );
 
/* Define macros for accessing each item of thread specific global data. */
#ifdef THREAD_SAFE
 
/* Define how to initialise thread-specific globals. */
#define GLOBAL_inits \
   globals->Class_Init = 0; \
   globals->GetAttrib_Buff[ 0 ] = 0; \
   globals->GetLabel_Buff[ 0 ] = 0; \

ast/src/dsbspecframe.c  view on Meta::CPAN

942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
parent_setattrib = object->SetAttrib;
object->SetAttrib = SetAttrib;
 
parent_testattrib = object->TestAttrib;
object->TestAttrib = TestAttrib;
 
parent_getdomain = frame->GetDomain;
frame->GetDomain = GetDomain;
 
parent_overlay = frame->Overlay;
frame->Overlay = Overlay;
 
parent_match = frame->Match;
frame->Match = Match;
 
parent_subframe = frame->SubFrame;
frame->SubFrame = SubFrame;
 
parent_getlabel = frame->GetLabel;
frame->GetLabel = GetLabel;

ast/src/dsbspecframe.c  view on Meta::CPAN

1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
   parent Match method above, if the target axis is not a DSBSpecFrame. */
      if( astIsADSBSpecFrame( frame0 ) ) {
 
/* Annul the returned objects, which are not needed, but keep the axis
   association arrays which already hold the correct values. */
         *map = astAnnul( *map );
         *result = astAnnul( *result );
 
/* Use the target's "astSubFrame" method to create a new Frame (the
   result Frame) with a copy of of the target axis. This process also
   overlays the template attributes on to the target Frame and returns a
   Mapping between the target and result Frames which effects the required
   coordinate conversion. */
         match = astSubFrame( target, template, 1, *target_axes, *template_axes,
                              map, result );
      }
 
/* Free resources. */
      frame0 = astAnnul( frame0 );
 
   }

ast/src/dsbspecframe.c  view on Meta::CPAN

1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
*  Synopsis:
*     #include "specframe.h"
*     void Overlay( AstFrame *template, const int *template_axes,
*                   AstFrame *result, int *status )
 
*  Class Membership:
*     DSBSpecFrame member function (over-rides the protected astOverlay method
*     inherited from the SpecFrame class).
 
*  Description:
*     This function overlays attributes of a DSBSpecFrame (the "template") on to
*     another Frame, so as to over-ride selected attributes of that second
*     Frame. Normally only those attributes which have been specifically set
*     in the template will be transferred. This implements a form of
*     defaulting, in which a Frame acquires attributes from the template, but
*     retains its original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
*
*     Note that if the result Frame is a DSBSpecFrame and a change of spectral
*     coordinate system occurs as a result of overlaying its System
*     attribute, then some of its original attribute values may no
*     longer be appropriate (e.g. the Title, or attributes describing
*     its axes). In this case, these will be cleared before overlaying
*     any new values.
 
*  Parameters:
*     template
*        Pointer to the template DSBSpecFrame, for which values should have been
*        explicitly set for any attribute which is to be transferred.
*     template_axes
*        Pointer to an array of int, with one element for each axis of the
*        "result" Frame (see below). For each axis in the result frame, the
*        corresponding element of this array should contain the (zero-based)

ast/src/dsbspecframe.c  view on Meta::CPAN

1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
*     template DSBSpecFrame, or from a class derived from it, then attributes may
*     exist in the template DSBSpecFrame which do not exist in the result Frame.
*     In this case, these attributes will not be transferred.
*/
 
/* Check the global error status. */
   if ( !astOK ) return;
 
/* Invoke the parent class astOverlay method to transfer attributes inherited
   from the parent class. */
   (*parent_overlay)( template, template_axes, result, status );
 
/* Check if the result Frame is a DSBSpecFrame or from a class derived from
   DSBSpecFrame. If not, we cannot transfer DSBSpecFrame attributes to it as it is
   insufficiently specialised. In this case simply omit these attributes. */
   if( astIsADSBSpecFrame( result ) && astOK ) {
 
/* Define macros that test whether an attribute is set in the template and,
   if so, transfers its value to the result. */
#define OVERLAY(attribute) \
   if ( astTest##attribute( template ) ) { \

ast/src/dsbspecframe.c  view on Meta::CPAN

1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
*                   AstFrame **result, int *status )
 
*  Class Membership:
*     DSBSpecFrame member function (over-rides the protected astSubFrame
*     method inherited from the SpecFrame class).
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the axes
*     from a "target" DSBSpecFrame and creates a new Frame with copies of
*     the selected axes assembled in the requested order. It then
*     optionally overlays the attributes of a "template" Frame on to the
*     result. It returns both the resulting Frame and a Mapping that
*     describes how to convert between the coordinate systems described by
*     the target and result Frames. If necessary, this Mapping takes
*     account of any differences in the Frames' attributes due to the
*     influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target DSBSpecFrame, from which axes are to be
*        selected.
*     template
*        Pointer to the template Frame, from which new attributes for the
*        result Frame are to be obtained. Optionally, this may be NULL, in
*        which case no overlaying of template attributes will be performed.
*     result_naxes
*        Number of axes to be selected from the target Frame. This number may
*        be greater than or less than the number of axes in this Frame (or
*        equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving a list
*        of the (zero-based) axis indices of the axes to be selected from the
*        target DSBSpecFrame. The order in which these are given determines
*        the order in which the axes appear in the result Frame. If any of the
*        values in this array is set to -1, the corresponding result axis will
*        not be derived from the target Frame, but will be assigned default
*        attributes instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This should
*        contain a list of the template axes (given as zero-based axis indices)
*        with which the axes of the result Frame are to be associated. This
*        array determines which axes are used when overlaying axis-dependent
*        attributes of the template on to the result. If any element of this
*        array is set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not used and
*        a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned Mapping.
*        The forward transformation of this Mapping will describe how to
*        convert coordinates from the coordinate system described by the target

ast/src/dsbspecframe.c  view on Meta::CPAN

2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
*     - 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.
*/
 
/* Local Variables: */
   AstMapping *result;       /* The returned Mapping */
   AstFrameSet *fs;          /* FrameSet connecting tf1 and tf2 */
   AstSpecFrame *tf1;        /* SpecFrame corresponding to this DSBSpecFrame */
   AstSpecFrame *tf2;        /* Topocentric frequency SpecFrame */
   int template_axis;        /* The axis to overlay */
 
/* Initialise. */
   result = NULL;
 
/* Check the global error status. */
   if ( !astOK ) return result;
 
/* Make a SpecFrame and then overlay the SpecFrame attributes of this
   DSBSpecFrame onto the new SpecFrame. This means it inherits the current
   values of things like ObsLon and ObsLat. */
   tf1 = astSpecFrame( "", status );
   template_axis = 0;
   (*parent_overlay)( (AstFrame *) this, &template_axis, (AstFrame *) tf1, status );
 
/* Copy this new SpecFrame and set its attributes to describe topocentric
   frequency in Hz. Ensure that alignment occurs in the topocentric Frame. */
   astSetAlignStdOfRest( tf1, AST__TPSOR);
   tf2 = astCopy( tf1 );
   astSetSystem( tf2, AST__FREQ );
   astSetStdOfRest( tf2, AST__TPSOR );
   astSetUnit( tf2, 0, "Hz" );
 
/* Find the Mapping from the spectral system described by this SpecFrame to

ast/src/fluxframe.c  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
*        Modified so that a FluxFrame can be used as a template to find a
*        FluxFrame contained within a CmpFrame. This involves changes in
*        Match and the removal of the local versions of SetMaxAxes and
*        SetMinAxes.
*     3-SEP-2007 (DSB):
*        In SubFrame, since AlignSystem is extended by the FluxFrame class
*        it needs to be cleared before invoking the parent SubFrame
*        method in cases where the result Frame is not a FluxFrame.
*     2-OCT-2007 (DSB):
*        In Overlay, clear AlignSystem as well as System before calling
*        the parent overlay method.
*     29-APR-2011 (DSB):
*        Prevent astFindFrame from matching a subclass template against a
*        superclass target.
*class--
*/
 
/* Module Macros. */
/* ============== */
/* Set the name of the class we are implementing. This indicates to
   the header files that define class interfaces that they should make

ast/src/fluxframe.c  view on Meta::CPAN

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
static const char *(* parent_getdomain)( AstFrame *, int * );
static const char *(* parent_getlabel)( AstFrame *, int, int * );
static const char *(* parent_getsymbol)( AstFrame *, int, int * );
static const char *(* parent_gettitle)( AstFrame *, int * );
static const char *(* parent_getunit)( AstFrame *, int, int * );
static int (* parent_match)( AstFrame *, AstFrame *, int, int **, int **, AstMapping **, AstFrame **, int * );
static int (* parent_subframe)( AstFrame *, AstFrame *, int, const int *, const int *, AstMapping **, AstFrame **, int * );
static int (* parent_testattrib)( AstObject *, const char *, int * );
static void (* parent_setunit)( AstFrame *, int, const char *, int * );
static void (* parent_clearattrib)( AstObject *, const char *, int * );
static void (* parent_overlay)( AstFrame *, const int *, AstFrame *, int * );
static void (* parent_setattrib)( AstObject *, const char *, int * );
static void (* parent_setsystem)( AstFrame *, AstSystemType, int * );
static void (* parent_clearsystem)( AstFrame *, int * );
static void (* parent_clearunit)( AstFrame *, int, int * );
 
#if defined(THREAD_SAFE)
static int (* parent_managelock)( AstObject *, int, int, AstObject **, int * );
#endif
 
/* Define macros for accessing each item of thread specific global data. */

ast/src/fluxframe.c  view on Meta::CPAN

1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
   parent_getunit = frame->GetUnit;
   frame->GetUnit = GetUnit;
 
   parent_setunit = frame->SetUnit;
   frame->SetUnit = SetUnit;
 
   parent_match = frame->Match;
   frame->Match = Match;
 
   parent_overlay = frame->Overlay;
   frame->Overlay = Overlay;
 
   parent_subframe = frame->SubFrame;
   frame->SubFrame = SubFrame;
 
/* Store replacement pointers for methods which will be over-ridden by new
   member functions implemented here. */
   frame->GetActiveUnit = GetActiveUnit;
   frame->TestActiveUnit = TestActiveUnit;
   frame->ValidateSystem = ValidateSystem;

ast/src/fluxframe.c  view on Meta::CPAN

2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
   }
 
/* Check at least one FluxFrame axis was found it the target. Store the
   axis associataions. */
   if( match && astOK ) {
      (*template_axes)[ 0 ] = 0;
      (*target_axes)[ 0 ] = target_axis0;
 
/* Use the target's "astSubFrame" method to create a new Frame (the
   result Frame) with copies of the target axes in the required
   order. This process also overlays the template attributes on to the
   target Frame and returns a Mapping between the target and result
   Frames which effects the required coordinate conversion. */
      match = astSubFrame( target, template, 1, *target_axes, *template_axes,
                           map, result );
   }
 
/* If an error occurred, or conversion to the result Frame's
   coordinate system was not possible, then free all memory, annul the
   returned objects, and reset the returned value. */
   if ( !astOK || !match ) {

ast/src/fluxframe.c  view on Meta::CPAN

2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
*  Synopsis:
*     #include "fluxframe.h"
*     void Overlay( AstFrame *template, const int *template_axes,
*                   AstFrame *result, int *status )
 
*  Class Membership:
*     FluxFrame member function (over-rides the protected astOverlay method
*     inherited from the Frame class).
 
*  Description:
*     This function overlays attributes of a FluxFrame (the "template") on to
*     another Frame, so as to over-ride selected attributes of that second
*     Frame. Normally only those attributes which have been specifically set
*     in the template will be transferred. This implements a form of
*     defaulting, in which a Frame acquires attributes from the template, but
*     retains its original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
*
*     Note that if the result Frame is a FluxFrame and a change of flux
*     coordinate system occurs as a result of overlaying its System
*     attribute, then some of its original attribute values may no
*     longer be appropriate (e.g. the Title, or attributes describing
*     its axes). In this case, these will be cleared before overlaying
*     any new values.
 
*  Parameters:
*     template
*        Pointer to the template FluxFrame, for which values should have been
*        explicitly set for any attribute which is to be transferred.
*     template_axes
*        Pointer to an array of int, with one element for each axis of the
*        "result" Frame (see below). For each axis in the result frame, the
*        corresponding element of this array should contain the (zero-based)

ast/src/fluxframe.c  view on Meta::CPAN

2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
/* Initialise strings used in error messages. */
   new_class = astGetClass( template );
   old_class = astGetClass( result );
   method = "astOverlay";
 
/* Get the old and new systems. */
   old_system = astGetSystem( result );
   new_system = astGetSystem( template );
 
/* If the result Frame is a FluxFrame, we must test to see if overlaying its
   System attribute will change the type of coordinate system it describes.
   Determine the value of this attribute for the result and template
   FluxFrames. */
   resetSystem = 0;
   fluxframe = astIsAFluxFrame( result );
   if( fluxframe ) {
 
/* If the coordinate system will change, any value already set for the result
   FluxFrame's Title will no longer be appropriate, so clear it. */
      if ( ( new_system != old_system ) && astTestSystem( template ) ) {

ast/src/fluxframe.c  view on Meta::CPAN

2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
         new_alignsystem = astGetAlignSystem( template );
         astClearAlignSystem( template );
 
         resetSystem = 1;
      }
   }
 
/* Invoke the parent class astOverlay method to transfer attributes inherited
   from the parent class. */
   (*parent_overlay)( template, template_axes, result, status );
 
/* Reset the System and AlignSystem values if necessary */
   if( resetSystem ) {
      astSetSystem( template, new_system );
      astSetAlignSystem( template, new_alignsystem );
   }
 
/* Check if the result Frame is a FluxFrame or from a class derived from
   FluxFrame. If not, we cannot transfer FluxFrame attributes to it as it is
   insufficiently specialised. In this case simply omit these attributes. */

ast/src/fluxframe.c  view on Meta::CPAN

2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
*                   AstFrame **result, int *status )
 
*  Class Membership:
*     FluxFrame member function (over-rides the protected astSubFrame
*     method inherited from the Frame class).
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the axes
*     from a "target" FluxFrame and creates a new Frame with copies of
*     the selected axes assembled in the requested order. It then
*     optionally overlays the attributes of a "template" Frame on to the
*     result. It returns both the resulting Frame and a Mapping that
*     describes how to convert between the coordinate systems described by
*     the target and result Frames. If necessary, this Mapping takes
*     account of any differences in the Frames' attributes due to the
*     influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target FluxFrame, from which axes are to be
*        selected.
*     template
*        Pointer to the template Frame, from which new attributes for the
*        result Frame are to be obtained. Optionally, this may be NULL, in
*        which case no overlaying of template attributes will be performed.
*     result_naxes
*        Number of axes to be selected from the target Frame. This number may
*        be greater than or less than the number of axes in this Frame (or
*        equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving a list
*        of the (zero-based) axis indices of the axes to be selected from the
*        target FluxFrame. The order in which these are given determines
*        the order in which the axes appear in the result Frame. If any of the
*        values in this array is set to -1, the corresponding result axis will
*        not be derived from the target Frame, but will be assigned default
*        attributes instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This should
*        contain a list of the template axes (given as zero-based axis indices)
*        with which the axes of the result Frame are to be associated. This
*        array determines which axes are used when overlaying axis-dependent
*        attributes of the template on to the result. If any element of this
*        array is set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not used and
*        a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned Mapping.
*        The forward transformation of this Mapping will describe how to
*        convert coordinates from the coordinate system described by the target

ast/src/fluxframe.c  view on Meta::CPAN

3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
   a FluxFrame. */
   if ( ( result_naxes == 1 ) && ( target_axes[ 0 ] == 0 ) ) {
 
/* Form the result from a copy of the target. */
      *result = astCopy( target );
 
/* Initialise a flag to indicate that MakeFluxMapping should not report
   errors if no Mapping can be created. */
      report = 0;
 
/* If required, overlay the template attributes on to the result FluxFrame.
   Also get the system in which to align the two FluxFrames. These are the
   values from the template (if there is a template). */
      if ( template ) {
         astOverlay( template, template_axes, *result );
         if( astIsAFluxFrame( template ) ) {
            align_sys = astGetAlignSystem( template );
 
/* Since we now know that both the template and target are FluxFrames, it
   should usually be possible to convert betwen them. If conversion is
   *not* possible then the user will probably be interested in knowing the

ast/src/fluxframe.c  view on Meta::CPAN

3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
      SET_AXIS(Symbol)
      SET_AXIS(Unit)
 
/* Clear attributes which have an extended range of values allowed by
   this class. */
      astClearSystem( temp );
      astClearAlignSystem( temp );
 
/* Invoke the astSubFrame method inherited from the Frame class to
   produce the result Frame by selecting the required set of axes and
   overlaying the template Frame's attributes. */
      match = (*parent_subframe)( (AstFrame *) temp, template,
                                  result_naxes, target_axes, template_axes,
                                  map, result, status );
 
/* Delete the temporary copy of the target FluxFrame. */
      temp = astDelete( temp );
   }
 
/* If an error occurred or no match was found, annul the returned
   objects and reset the returned result. */

ast/src/frame.c  view on Meta::CPAN

7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
                 ( (*template_axes)[ result_axis ] >= template_naxes ) ) {
               (*template_axes)[ result_axis ] = -1;
            }
            if ( ( (*target_axes)[ result_axis ] < 0 ) ||
                 ( (*target_axes)[ result_axis ] >= target_naxes ) ) {
               (*target_axes)[ result_axis ] = -1;
            }
         }
 
/* Use the target's astSubFrame method to select the required axes from it,
   overlaying the template's attributes on to the resulting Frame. This process
   also generates the required Mapping between the target and result Frames. */
         match = astSubFrame( target, template,
                              result_naxes, *target_axes, *template_axes,
                              map, result );
      }
   }
 
/* If an error occurred, free any allocated memory and reset the result. */
   if ( !astOK || !match ) {
      *template_axes = astFree( *template_axes );

ast/src/frame.c  view on Meta::CPAN

8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
*  Synopsis:
*     #include "frame.h"
*     void astOverlay( AstFrame *template, const int *template_axes,
*                      AstFrame *result )
 
*  Class Membership:
*     Frame method.
 
*  Description:
*     This function overlays attributes of one Frame (the "template") on to
*     another Frame, so as to over-ride selected attributes of that second
*     Frame. Normally only those attributes which have been specifically set
*     in the template will be transferred. This implements a form of
*     defaulting, in which a Frame acquires attributes from the template, but
*     retains its original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
 
*  Parameters:
*     template
*        Pointer to the template Frame, for which values should have been

ast/src/frame.c  view on Meta::CPAN

8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
   OVERLAY(Domain);
   OVERLAY(Epoch);
   OVERLAY(Title);
   OVERLAY(ObsLat)
   OVERLAY(ObsLon)
   OVERLAY(ObsAlt)
 
/* Transfer the ActiveUnit flag. */
   astSetActiveUnit( result, astGetActiveUnit( template ) );
 
/* Only overlay the System and AlignSystem attribute if the values are
   valid for the result class. */
   if( astTestSystem( template ) ) {
      sys = astGetSystem( template );
      if( astValidateSystem( result, sys, "astOverlay" ) ) {
         astSetSystem( result, sys );
      }
   }
 
   if( astTestAlignSystem( template ) ) {
      sys = astGetAlignSystem( template );

ast/src/frame.c  view on Meta::CPAN

8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
   if ( astOK ) {
 
/* Loop through all the axes in the result Frame and determine to which
   template axis each one corresponds. Check that the resulting axis index is
   valid. If not, then the axis will not receive new attributes. */
      for ( result_axis = 0; result_axis < result_naxes; result_axis++ ) {
         template_axis = template_axes ? template_axes[ result_axis ] : result_axis;
         if ( ( template_axis >= 0 ) && ( template_axis < template_naxes ) ) {
 
/* Obtain pointers to the relevant Axis objects of each Frame and use the
   astAxisOverlay method of the template Axis to overlay attributes on to
   the result Axis. Annul the Axis pointers afterwards. */
            template_ax = astGetAxis( template, template_axis );
            result_ax = astGetAxis( result, result_axis );
            astAxisOverlay( template_ax, result_ax );
            template_ax = astAnnul( template_ax );
            result_ax = astAnnul( result_ax );
 
/* Quit looping if an error occurs. */
            if ( !astOK ) break;
         }

ast/src/frame.c  view on Meta::CPAN

10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
*                      int result_naxes, const int *target_axes,
*                      const int *template_axes, AstMapping **map,
*                      AstFrame **result )
 
*  Class Membership:
*     Frame method.
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the axes from
*     a "target" Frame and creates a new Frame with copies of the selected
*     axes assembled in the requested order. It then optionally overlays the
*     attributes of a "template" Frame on to the result. It returns both the
*     resulting Frame and a Mapping that describes how to convert between the
*     coordinate systems described by the target and result Frames. If
*     necessary, this Mapping takes account of any differences in the Frames'
*     attributes due to the influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target Frame, from which axes are to be selected.
*     template
*        Pointer to the template Frame, from which new attributes for the
*        result Frame are to be obtained. Optionally, this may be NULL, in
*        which case no overlaying of template attributes will be performed.
*     result_naxes
*        Number of axes to be selected from the target Frame. This number may
*        be greater than or less than the number of axes in this Frame (or
*        equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving a list
*        of the (zero-based) axis indices of the axes to be selected from the
*        target Frame. The order in which these are given determines the order
*        in which the axes appear in the result Frame. If any of the values in
*        this array is set to -1, the corresponding result axis will not be
*        derived from the target Frame, but will be assigned default attributes
*        instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This should
*        contain a list of the template axes (given as zero-based axis indices)
*        with which the axes of the result Frame are to be associated. This
*        array determines which axes are used when overlaying axis-dependent
*        attributes of the template on to the result. If any element of this
*        array is set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not used and
*        a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned Mapping.
*        The forward transformation of this Mapping will describe how to
*        convert coordinates from the coordinate system described by the target

ast/src/frame.c  view on Meta::CPAN

11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
/* So far, we have only modified pointers in the temporary Frame to refer to
   the target Frame's Axis objects. Since we will next modify these objects'
   attributes, we must make a deep copy of the entire temporary Frame so that
   we do not modify the target's axes. This copy now becomes our result Frame.
   Annul the temporary one. */
      if ( astOK ) {
         *result = astCopy( tempframe );
         tempframe = astAnnul( tempframe );
 
/* Invoke the target "astOverlay" method to overlay any remaining
   attributes from the target Frame which are not associated with
   individual axes (e.g.  the Frame's Title and Domain). */
         astOverlay( target, target_axes, *result );
 
/* If a template Frame was supplied, also invoke its astOverlay method to
   overlay its attributes on the result Frame. (Note that in this particular
   case this has no effect other than transferring attributes. In general,
   however, i.e. in derived classes, this process is vital to determining the
   mapping below, whose main purpose is to convert between the target and
   result Frames. These will have different attributes as a result of the
   influence that the template has here.) */
         if ( template ) astOverlay( template, template_axes, *result );
 
/* We will next generate the Mapping that relates the target and result
   Frames. If appropriate this should be a unit Mapping (UnitMap), so test if
   the number of axes in both Frames is equal. */

ast/src/frameset.c  view on Meta::CPAN

7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
*  Synopsis:
*     #include "frameset.h"
*     void Overlay( AstFrame *template, const int *template_axes,
*                   AstFrame *result, int *status )
 
*  Class Membership:
*     FrameSet member function (over-rides the protected astOverlay
*     method inherited from the Frame class).
 
*  Description:
*     This function overlays attributes from the current Frame of a
*     FrameSet on to another Frame, so as to over-ride selected
*     attributes of that second Frame. Normally only those attributes
*     which have been specifically set in the template will be
*     transferred. This implements a form of defaulting, in which a
*     Frame acquires attributes from the template, but retains its
*     original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
 
*  Parameters:
*     template

ast/src/frameset.c  view on Meta::CPAN

8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
   AstFrame *fr;                 /* Pointer to current Frame */
   AstFrameSet *template;        /* Pointer to the FrameSet structure */
 
/* Check the global error status. */
   if ( !astOK ) return;
 
/* Obtain a pointer to the FrameSet structure. */
   template = (AstFrameSet *) template_frame;
 
/* Obtain a pointer to the current Frame and invoke its astOverlay
   method to overlay its attributes. Annul the Frame pointer
   afterwards. */
   fr = astGetFrame( template, AST__CURRENT );
   astOverlay( fr, template_axes, result );
   fr = astAnnul( fr );
}
 
static void PermAxes( AstFrame *this_frame, const int perm[], int *status ) {
/*
*  Name:
*     PermAxes

ast/src/frameset.c  view on Meta::CPAN

10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
*                   AstMapping **map, AstFrame **result, int *status )
 
*  Class Membership:
*     FrameSet member function (over-rides the protected astSubFrame
*     method inherited from the Frame class).
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the
*     axes from the current Frame of a "target" FrameSet and creates a
*     new Frame with copies of the selected axes assembled in the
*     requested order. It then optionally overlays the attributes of a
*     "template" Frame on to the result. It returns both the resulting
*     Frame and a Mapping that describes how to convert between the
*     coordinate systems described by the current Frame of the target
*     FrameSet and the result Frame. If necessary, this Mapping takes
*     account of any differences in the Frames' attributes due to the
*     influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target FrameSet, from whose current Frame the
*        axes are to be selected.
*     template
*        Pointer to the template Frame, from which new attributes for
*        the result Frame are to be obtained. Optionally, this may be
*        NULL, in which case no overlaying of template attributes will
*        be performed.
*     result_naxes
*        Number of axes to be selected from the target FrameSet. This
*        number may be greater than or less than the number of axes in
*        the FrameSet's current Frame (or equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving
*        a list of the (zero-based) axis indices of the axes to be
*        selected from the current Frame of the target FrameSet. The
*        order in which these are given determines the order in which
*        the axes appear in the result Frame. If any of the values in
*        this array is set to -1, the corresponding result axis will
*        not be derived from the target FrameSet, but will be assigned
*        default attributes instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This
*        should contain a list of the template axes (given as
*        zero-based axis indices) with which the axes of the result
*        Frame are to be associated. This array determines which axes
*        are used when overlaying axis-dependent attributes of the
*        template on to the result. If any element of this array is
*        set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not
*        used and a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned
*        Mapping.  The forward transformation of this Mapping will
*        describe how to convert coordinates from the coordinate

ast/src/region.c  view on Meta::CPAN

7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
*  Synopsis:
*     #include "region.h"
*     void Overlay( AstFrame *template, const int *template_axes,
*                   AstFrame *result, int *status )
 
*  Class Membership:
*     Region member function (over-rides the protected astOverlay
*     method inherited from the Frame class).
 
*  Description:
*     This function overlays attributes from the current Frame of a
*     Region on to another Frame, so as to over-ride selected
*     attributes of that second Frame. Normally only those attributes
*     which have been specifically set in the template will be
*     transferred. This implements a form of defaulting, in which a
*     Frame acquires attributes from the template, but retains its
*     original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
 
*  Parameters:
*     template

ast/src/region.c  view on Meta::CPAN

7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
*        Pointer to the inherited status variable.
*/
 
/* Local Variables: */
   AstFrame *fr;                 /* Pointer to current Frame */
 
/* Check the global error status. */
   if ( !astOK ) return;
 
/* Obtain a pointer to the current Frame in the Region and invoke its
   astOverlay method to overlay its attributes. Annul the Frame pointer
   afterwards. */
   fr = astGetFrame( ((AstRegion *) template_frame)->frameset, AST__CURRENT );
   astOverlay( fr, template_axes, result );
   fr = astAnnul( fr );
}
 
static void PermAxes( AstFrame *this_frame, const int perm[], int *status ) {
/*
*  Name:
*     PermAxes

ast/src/region.c  view on Meta::CPAN

11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
*                   AstMapping **map, AstFrame **result, int *status )
 
*  Class Membership:
*     Region member function (over-rides the protected astSubFrame
*     method inherited from the Frame class).
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the
*     axes from the current Frame of a "target" Region and creates a
*     new Frame with copies of the selected axes assembled in the
*     requested order. It then optionally overlays the attributes of a
*     "template" Frame on to the result. It returns both the resulting
*     Frame and a Mapping that describes how to convert between the
*     coordinate systems described by the current Frame of the target
*     Region and the result Frame. If necessary, this Mapping takes
*     account of any differences in the Frames' attributes due to the
*     influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target Region, from whose current Frame the
*        axes are to be selected.
*     template
*        Pointer to the template Frame, from which new attributes for
*        the result Frame are to be obtained. Optionally, this may be
*        NULL, in which case no overlaying of template attributes will
*        be performed.
*     result_naxes
*        Number of axes to be selected from the target Region. This
*        number may be greater than or less than the number of axes in
*        the Region's current Frame (or equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving
*        a list of the (zero-based) axis indices of the axes to be
*        selected from the current Frame of the target Region. The
*        order in which these are given determines the order in which
*        the axes appear in the result Frame. If any of the values in
*        this array is set to -1, the corresponding result axis will
*        not be derived from the target Region, but will be assigned
*        default attributes instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This
*        should contain a list of the template axes (given as
*        zero-based axis indices) with which the axes of the result
*        Frame are to be associated. This array determines which axes
*        are used when overlaying axis-dependent attributes of the
*        template on to the result. If any element of this array is
*        set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not
*        used and a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned
*        Mapping.  The forward transformation of this Mapping will
*        describe how to convert coordinates from the coordinate

ast/src/skyaxis.c  view on Meta::CPAN

163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
static int class_check;
 
/* Pointers to parent class methods which are extended by this class. */
static size_t (* parent_getobjsize)( AstObject *, int * );
static const char *(* parent_getattrib)( AstObject *, const char *, int * );
static const char *(* parent_getaxislabel)( AstAxis *, int * );
static const char *(* parent_getaxissymbol)( AstAxis *, int * );
static const char *(* parent_getaxisunit)( AstAxis *, int * );
static int (* parent_testattrib)( AstObject *, const char *, int * );
static int (*parent_getaxisdirection)( AstAxis *this, int * );
static void (* parent_axisoverlay)( AstAxis *, AstAxis *, int * );
static void (* parent_clearattrib)( AstObject *, const char *, int * );
static void (* parent_setattrib)( AstObject *, const char *, int * );
static double (*parent_getaxisbottom)( AstAxis *this, int * );
static double (*parent_getaxistop)( AstAxis *this, int * );
static const char *(* parent_axisformat)( AstAxis *, double, int * );
static double (*parent_axisgap)( AstAxis *, double, int *, int * );
static int (*parent_axisunformat)( AstAxis *, const char *, double *, int * );
static int (*parent_axisfields)( AstAxis *, const char *, const char *, int, char **, int *, double *, int * );
 
/* Factors for converting between hours, degrees and radians. */

ast/src/skyaxis.c  view on Meta::CPAN

1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
*  Synopsis:
*     #include "skyaxis.h"
*     void AxisOverlay( AstAxis *template, AstAxis *result, int *status )
 
*  Class Membership:
*     SkyAxis member function (over-rides the astAxisOverlay method inherited
*     from the Axis class).
 
*  Description:
*     This function overlays attributes of a SkyAxis (the "template") on to
*     another Axis, so as to over-ride selected attributes of that second
*     Axis. Normally only those attributes which have been specifically set
*     in the template will be transferred. This implements a form of
*     defaulting, in which an Axis acquires attributes from the template, but
*     retains its original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
 
*  Parameters:
*     template
*        Pointer to the template SkyAxis, for which values should have been

ast/src/skyaxis.c  view on Meta::CPAN

1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
/* Local Variables: */
   AstSkyAxis *template;         /* Pointer to the SkyAxis structure */
 
/* Check the global error status. */
   if ( !astOK ) return;
 
/* Obtain a pointer to the template SkyAxis structure. */
   template = (AstSkyAxis *) template_axis;
 
/* Invoke the parent astAstOverlay method to overlay inherited attributes. */
   (*parent_axisoverlay)( template_axis, result, status );
 
/* Test if the "result" Axis is a SkyAxis (if not, it cannot acquire any
   further attributes, so there is nothing more to do). */
   if ( astIsASkyAxis( result ) && astOK ) {
 
/* Overlay the Format attribute if it is set in the template. Note that we
   use private member functions (not methods) to access the Format value, since
   derived classes may extend the syntax of this string and we should not
   overlay a string whose syntax cannot be interpreted by the result Axis. */
      if ( TestAxisFormat( template_axis, status ) ) {
         SetAxisFormat( result, GetAxisFormat( template_axis, status ), status );
      }
 
/* Overlay the AsTime attribute in the same way, but this time using methods
   to access it. */
      if ( astTestAxisAsTime( template ) ) {
         astSetAxisAsTime( result, astGetAxisAsTime( template ) );
      }
 
/* Also overlay the IsLatitude attribute. */
      if ( astTestAxisIsLatitude( template ) ) {
         astSetAxisIsLatitude( result, astGetAxisIsLatitude( template ) );
      }
 
/* Also overlay the CentreZero attribute. */
      if ( astTestAxisCentreZero( template ) ) {
         astSetAxisCentreZero( result, astGetAxisCentreZero( template ) );
      }
   }
}
 
static void ClearAttrib( AstObject *this_object, const char *attrib, int *status ) {
/*
*  Name:
*     ClearAttrib

ast/src/skyaxis.c  view on Meta::CPAN

3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
parent_clearattrib = object->ClearAttrib;
object->ClearAttrib = ClearAttrib;
parent_getattrib = object->GetAttrib;
object->GetAttrib = GetAttrib;
parent_setattrib = object->SetAttrib;
object->SetAttrib = SetAttrib;
parent_testattrib = object->TestAttrib;
object->TestAttrib = TestAttrib;
 
parent_axisoverlay = axis->AxisOverlay;
axis->AxisOverlay = AxisOverlay;
parent_getaxisdirection = axis->GetAxisDirection;
axis->GetAxisDirection = GetAxisDirection;
parent_getaxislabel = axis->GetAxisLabel;
axis->GetAxisLabel = GetAxisLabel;
parent_getaxissymbol = axis->GetAxisSymbol;
axis->GetAxisSymbol = GetAxisSymbol;
parent_getaxisunit = axis->GetAxisUnit;
axis->GetAxisUnit = GetAxisUnit;

ast/src/skyframe.c  view on Meta::CPAN

232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
*        - Modify the azel conversions to include correction for diurnal
*        aberration.
*        - Override astClearObsLat and astSetObsLat by implementations which
*        reset the magnitude of the diurnal aberration vector.
*     3-SEP-2007 (DSB):
*        In SubFrame, since AlignSystem is extended by the SkyFrame class
*        it needs to be cleared before invoking the parent SubFrame
*        method in cases where the result Frame is not a SkyFrame.
*     2-OCT-2007 (DSB):
*        In Overlay, clear AlignSystem as well as System before calling
*        the parent overlay method.
*     10-OCT-2007 (DSB):
*        In MakeSkyMapping, correct the usage of variables "system" and
*        "align_sys" when aligning in AZEL.
*     18-OCT-2007 (DSB):
*        Compare target and template AlignSystem values in Match, rather
*        than comparing target and result AlignSystem values in MakeSkyMapping
*        (since result is basically a copy of target).
*     27-NOV-2007 (DSB):
*        - Modify SetSystem to ensure that SkyRef and SkyRefP position are
*        always transformed as absolute values, rather than as offset

ast/src/skyframe.c  view on Meta::CPAN

856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
static int (* parent_testformat)( AstFrame *, int, int * );
static int (* parent_unformat)( AstFrame *, int, const char *, double *, int * );
static void (* parent_clearattrib)( AstObject *, const char *, int * );
static void (* parent_cleardtai)( AstFrame *, int * );
static void (* parent_cleardut1)( AstFrame *, int * );
static void (* parent_clearformat)( AstFrame *, int, int * );
static void (* parent_clearobsalt)( AstFrame *, int * );
static void (* parent_clearobslat)( AstFrame *, int * );
static void (* parent_clearobslon)( AstFrame *, int * );
static void (* parent_clearsystem)( AstFrame *, int * );
static void (* parent_overlay)( AstFrame *, const int *, AstFrame *, int * );
static void (* parent_setattrib)( AstObject *, const char *, int * );
static void (* parent_setdtai)( AstFrame *, double, int * );
static void (* parent_setdut1)( AstFrame *, double, int * );
static void (* parent_setformat)( AstFrame *, int, const char *, int * );
static void (* parent_setobsalt)( AstFrame *, double, int * );
static void (* parent_setobslat)( AstFrame *, double, int * );
static void (* parent_setobslon)( AstFrame *, double, int * );
static void (* parent_setsystem)( AstFrame *, AstSystemType, int * );
 
/* Factors for converting between hours, degrees and radians. */

ast/src/skyframe.c  view on Meta::CPAN

4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
parent_getlabel = frame->GetLabel;
frame->GetLabel = GetLabel;
parent_getsymbol = frame->GetSymbol;
frame->GetSymbol = GetSymbol;
parent_gettitle = frame->GetTitle;
frame->GetTitle = GetTitle;
parent_getunit = frame->GetUnit;
frame->GetUnit = GetUnit;
parent_match = frame->Match;
frame->Match = Match;
parent_overlay = frame->Overlay;
frame->Overlay = Overlay;
parent_subframe = frame->SubFrame;
frame->SubFrame = SubFrame;
parent_unformat = frame->Unformat;
frame->Unformat = Unformat;
 
parent_setdtai = frame->SetDtai;
frame->SetDtai = SetDtai;
parent_setdut1 = frame->SetDut1;
frame->SetDut1 = SetDut1;

ast/src/skyframe.c  view on Meta::CPAN

6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
   instead. */
      } else {
         (*template_axes)[ 0 ] = 0;
         (*template_axes)[ 1 ] = 1;
         (*target_axes)[ 0 ] = swap ? target_axis1 : target_axis0;
         (*target_axes)[ 1 ] = swap ? target_axis0 : target_axis1;
      }
 
/* Use the target's "astSubFrame" method to create a new Frame (the
   result Frame) with copies of the target axes in the required
   order. This process also overlays the template attributes on to the
   target Frame and returns a Mapping between the target and result
   Frames which effects the required coordinate conversion. */
      match = astSubFrame( target, template, 2, *target_axes, *template_axes,
                           map, result );
   }
 
/* If an error occurred, or conversion to the result Frame's
   coordinate system was not possible, then free all memory, annul the
   returned objects, and reset the returned value. */
   if ( !astOK || !match ) {

ast/src/skyframe.c  view on Meta::CPAN

8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
*  Synopsis:
*     #include "skyframe.h"
*     void Overlay( AstFrame *template, const int *template_axes,
*                   AstFrame *result, int *status )
 
*  Class Membership:
*     SkyFrame member function (over-rides the protected astOverlay method
*     inherited from the Frame class).
 
*  Description:
*     This function overlays attributes of a SkyFrame (the "template") on to
*     another Frame, so as to over-ride selected attributes of that second
*     Frame. Normally only those attributes which have been specifically set
*     in the template will be transferred. This implements a form of
*     defaulting, in which a Frame acquires attributes from the template, but
*     retains its original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
*
*     Note that if the result Frame is a SkyFrame and a change of sky
*     coordinate system occurs as a result of overlaying its System
*     attribute, then some of its original attribute values may no
*     longer be appropriate (e.g. the Title, or attributes describing
*     its axes). In this case, these will be cleared before overlaying
*     any new values.
 
*  Parameters:
*     template
*        Pointer to the template SkyFrame, for which values should have been
*        explicitly set for any attribute which is to be transferred.
*     template_axes
*        Pointer to an array of int, with one element for each axis of the
*        "result" Frame (see below). For each axis in the result frame, the
*        corresponding element of this array should contain the (zero-based)

ast/src/skyframe.c  view on Meta::CPAN

8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
   int tax1;                     /* Template axis for result axis 1 */
 
/* Check the global error status. */
   if ( !astOK ) return;
 
/* Indicate that we do not need to reset the System attribute of the
   template. */
   reset_system = 0;
   new_system = AST__UNKNOWN;
 
/* If the result Frame is a SkyFrame, we must test to see if overlaying its
   System attribute will change the type of sky coordinate system it
   describes. Determine the value of this attribute for the result and template
   SkyFrames. We also need to do this if either SkyRef attribute would
   change. */
   skyframe = astIsASkyFrame( result );
   if ( skyframe ) {
      old_system = astGetSystem( result );
      new_system = astGetSystem( template );
      skyref_changed = ( astGetSkyRef( result, 0 ) !=
                         astGetSkyRef( template, 0 ) ) ||

ast/src/skyframe.c  view on Meta::CPAN

8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
         new_system = astGetSystem( template );
         astClearSystem( template );
         new_alignsystem = astGetAlignSystem( template );
         astClearAlignSystem( template );
         reset_system = 1;
      }
   }
 
/* Invoke the parent class astOverlay method to transfer attributes inherited
   from the parent class. */
   (*parent_overlay)( template, template_axes, result, status );
 
/* Reset the System and AlignSystem values if necessary */
   if( reset_system ) {
      astSetSystem( template, new_system );
      astSetAlignSystem( template, new_alignsystem );
   }
 
/* Check if the result Frame is a SkyFrame or from a class derived from
   SkyFrame. If not, we cannot transfer SkyFrame attributes to it as it is
   insufficiently specialised. In this case simply omit these attributes. */

ast/src/skyframe.c  view on Meta::CPAN

8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
/* Validate the axis index. */
   (void) astValidateAxis( this, axis, 1, "astSetAsTime" );
 
/* Obtain a pointer to the Axis object. */
   ax = astGetAxis( this, axis );
 
/* Check if the Axis object is a SkyAxis. If not, we will replace it with
   one. */
   if ( !astIsASkyAxis( ax ) ) {
 
/* Create a new SkyAxis and overlay the attributes of the original Axis. */
      new_ax = astSkyAxis( "", status );
      astAxisOverlay( ax, new_ax );
 
/* Modify the SkyFrame to use the new Skyaxis and annul the original Axis
   pointer. Retain a pointer to the new SkyAxis. */
      astSetAxis( this, axis, new_ax );
      ax = astAnnul( ax );
      ax = (AstAxis *) new_ax;
   }

ast/src/skyframe.c  view on Meta::CPAN

9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
*                   const int *template_axes, AstMapping **map,
*                   AstFrame **result, int *status )
 
*  Class Membership:
*     SkyFrame member function (over-rides the protected astSubFrame method
*     inherited from the Frame class).
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the axes from
*     a "target" SkyFrame and creates a new Frame with copies of the selected
*     axes assembled in the requested order. It then optionally overlays the
*     attributes of a "template" Frame on to the result. It returns both the
*     resulting Frame and a Mapping that describes how to convert between the
*     coordinate systems described by the target and result Frames. If
*     necessary, this Mapping takes account of any differences in the Frames'
*     attributes due to the influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target SkyFrame, from which axes are to be selected.
*     template
*        Pointer to the template Frame, from which new attributes for the
*        result Frame are to be obtained. Optionally, this may be NULL, in
*        which case no overlaying of template attributes will be performed.
*     result_naxes
*        Number of axes to be selected from the target Frame. This number may
*        be greater than or less than the number of axes in this Frame (or
*        equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving a list
*        of the (zero-based) axis indices of the axes to be selected from the
*        target SkyFrame. The order in which these are given determines the
*        order in which the axes appear in the result Frame. If any of the
*        values in this array is set to -1, the corresponding result axis will
*        not be derived from the target Frame, but will be assigned default
*        attributes instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This should
*        contain a list of the template axes (given as zero-based axis indices)
*        with which the axes of the result Frame are to be associated. This
*        array determines which axes are used when overlaying axis-dependent
*        attributes of the template on to the result. If any element of this
*        array is set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not used and
*        a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned Mapping.
*        The forward transformation of this Mapping will describe how to
*        convert coordinates from the coordinate system described by the target

ast/src/skyframe.c  view on Meta::CPAN

10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
            astClearUseDefs( target );
            set_usedefs = 1;
         }
      }
 
/* Form the result from a copy of the target and then permute its axes
   into the order required. */
      *result = astCopy( target );
      astPermAxes( *result, target_axes );
 
/* If required, overlay the template attributes on to the result SkyFrame.
   Also get the system in which to align the two SkyFrames. This is the
   value of the AlignSystem attribute from the template (if there is a
   template). */
      if ( template ) {
         astOverlay( template, template_axes, *result );
         align_sys = astGetAlignSystem( template );
 
      } else {
         align_sys = astGetAlignSystem( target );
      }

ast/src/skyframe.c  view on Meta::CPAN

10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
         ax = astAnnul( ax );
      }
 
/* Clear attributes which have an extended range of values allowed by
   this class. */
      astClearSystem( temp );
      astClearAlignSystem( temp );
 
/* Invoke the astSubFrame method inherited from the Frame class to
   produce the result Frame by selecting the required set of axes and
   overlaying the template Frame's attributes. */
      match = (*parent_subframe)( (AstFrame *) temp, template,
                                  result_naxes, target_axes, template_axes,
                                  map, result, status );
 
/* Delete the temporary copy of the target SkyFrame. */
      temp = astDelete( temp );
   }
 
/* Ensure the returned Frame does not have active units. */
   astSetActiveUnit( *result, 0 );

ast/src/specfluxframe.c  view on Meta::CPAN

1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
   instead. */
         } else {
            (*template_axes)[ 0 ] = 0;
            (*template_axes)[ 1 ] = 1;
            (*target_axes)[ 0 ] = swap;
            (*target_axes)[ 1 ] = !swap;
         }
 
/* Use the target's "astSubFrame" method to create a new Frame (the
   result Frame) with copies of the target axes in the required
   order. This process also overlays the template attributes on to the
   target Frame and returns a Mapping between the target and result
   Frames which effects the required coordinate conversion. */
         match = astSubFrame( target, template, 2, *target_axes, *template_axes,
                              map, result );
 
/* If an error occurred, or conversion to the result Frame's
   coordinate system was not possible, then free all memory, annul the
   returned objects, and reset the returned value. */
         if ( !astOK || !match ) {
            *template_axes = astFree( *template_axes );

ast/src/specfluxframe.c  view on Meta::CPAN

1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
*                   AstFrame **result, int *status )
 
*  Class Membership:
*     SpecFluxFrame member function (over-rides the protected astSubFrame
*     method inherited from the Frame class).
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the
*     axes from a "target" SpecFluxFrame and creates a new Frame with
*     copies of the selected axes assembled in the requested order. It
*     then optionally overlays the attributes of a "template" Frame on
*     to the result. It returns both the resulting Frame and a Mapping
*     that describes how to convert between the coordinate systems
*     described by the target and result Frames. If necessary, this
*     Mapping takes account of any differences in the Frames'
*     attributes due to the influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target SpecFluxFrame, from which axes are to be selected.
*     template
*        Pointer to the template Frame, from which new attributes for
*        the result Frame are to be obtained. Optionally, this may be
*        NULL, in which case no overlaying of template attributes will
*        be performed.
*     result_naxes
*        Number of axes to be selected from the target Frame. This
*        number may be greater than or less than the number of axes in
*        this Frame (or equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving
*        a list of the (zero-based) axis indices of the axes to be
*        selected from the target SpecFluxFrame. The order in which these
*        are given determines the order in which the axes appear in
*        the result Frame. If any of the values in this array is set
*        to -1, the corresponding result axis will not be derived from
*        the target Frame, but will be assigned default attributes
*        instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This
*        should contain a list of the template axes (given as
*        zero-based axis indices) with which the axes of the result
*        Frame are to be associated. This array determines which axes
*        are used when overlaying axis-dependent attributes of the
*        template on to the result. If any element of this array is
*        set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not
*        used and a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned
*        Mapping.  The forward transformation of this Mapping will
*        describe how to convert coordinates from the coordinate

ast/src/specframe.c  view on Meta::CPAN

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
*        SetMinAxes.
*     8-AUG-2007 (DSB):
*        Changed Overlay to avoid the possibility of making permanent
*        changes to the supplied template Frame.
*     3-SEP-2007 (DSB):
*        In SubFrame, since AlignSystem is extended by the SpecFrame class
*        it needs to be cleared before invoking the parent SubFrame
*        method in cases where the result Frame is not a SkyFrame.
*     2-OCT-2007 (DSB):
*        In Overlay, clear AlignSystem as well as System before calling
*        the parent overlay method.
*     4-SEP-2009 (DSB):
*        In MakeSpecMapping, in order to produce alignment that is not
*        affected by the epoch or reference position, make the alignment
*        frame adapt to the epoch and reference position of the target
*        and result Frames.
*     14-SEP-2009 (DSB):
*        In MakeSpecMapping, extend the 4-SEP-2009 fix to cover other
*        attributes that define the available rest frames (e.g.
*        SourceVRF, SourceVel, ObsLat, ObsLon, ObsAlt).
*     16-SEP-2009 (DSB):

ast/src/specframe.c  view on Meta::CPAN

252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
static const char *(* parent_getdomain)( AstFrame *, int * );
static const char *(* parent_getlabel)( AstFrame *, int, int * );
static const char *(* parent_getsymbol)( AstFrame *, int, int * );
static const char *(* parent_gettitle)( AstFrame *, int * );
static const char *(* parent_getunit)( AstFrame *, int, int * );
static int (* parent_match)( AstFrame *, AstFrame *, int, int **, int **, AstMapping **, AstFrame **, int * );
static int (* parent_subframe)( AstFrame *, AstFrame *, int, const int *, const int *, AstMapping **, AstFrame **, int * );
static int (* parent_testattrib)( AstObject *, const char *, int * );
static void (* parent_setunit)( AstFrame *, int, const char *, int * );
static void (* parent_clearattrib)( AstObject *, const char *, int * );
static void (* parent_overlay)( AstFrame *, const int *, AstFrame *, int * );
static void (* parent_setattrib)( AstObject *, const char *, int * );
static void (* parent_setsystem)( AstFrame *, AstSystemType, int * );
static void (* parent_clearsystem)( AstFrame *, int * );
static void (* parent_clearunit)( AstFrame *, int, int * );
 
/* Define a variable to hold a SkyFrame which will be used for formatting
   and unformatting sky positions, etc. */
static AstSkyFrame *skyframe;
 
/* Define macros for accessing each item of thread specific global data. */

ast/src/specframe.c  view on Meta::CPAN

2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
   parent_getunit = frame->GetUnit;
   frame->GetUnit = GetUnit;
 
   parent_setunit = frame->SetUnit;
   frame->SetUnit = SetUnit;
 
   parent_match = frame->Match;
   frame->Match = Match;
 
   parent_overlay = frame->Overlay;
   frame->Overlay = Overlay;
 
   parent_subframe = frame->SubFrame;
   frame->SubFrame = SubFrame;
 
/* Store replacement pointers for methods which will be over-ridden by new
   member functions implemented here. */
   frame->GetActiveUnit = GetActiveUnit;
   frame->TestActiveUnit = TestActiveUnit;
   frame->ValidateSystem = ValidateSystem;

ast/src/specframe.c  view on Meta::CPAN

3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
   }
 
/* Check at least one SpecFrame axis was found it the target. Store the
   axis associataions. */
   if( match && astOK ) {
      (*template_axes)[ 0 ] = 0;
      (*target_axes)[ 0 ] = target_axis0;
 
/* Use the target's "astSubFrame" method to create a new Frame (the
   result Frame) with copies of the target axes in the required
   order. This process also overlays the template attributes on to the
   target Frame and returns a Mapping between the target and result
   Frames which effects the required coordinate conversion. */
      match = astSubFrame( target, template, 1, *target_axes, *template_axes,
                           map, result );
 
   }
 
/* If an error occurred, or conversion to the result Frame's
   coordinate system was not possible, then free all memory, annul the
   returned objects, and reset the returned value. */

ast/src/specframe.c  view on Meta::CPAN

3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
*  Synopsis:
*     #include "specframe.h"
*     void Overlay( AstFrame *template, const int *template_axes,
*                   AstFrame *result, int *status )
 
*  Class Membership:
*     SpecFrame member function (over-rides the protected astOverlay method
*     inherited from the Frame class).
 
*  Description:
*     This function overlays attributes of a SpecFrame (the "template") on to
*     another Frame, so as to over-ride selected attributes of that second
*     Frame. Normally only those attributes which have been specifically set
*     in the template will be transferred. This implements a form of
*     defaulting, in which a Frame acquires attributes from the template, but
*     retains its original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
*
*     Note that if the result Frame is a SpecFrame and a change of spectral
*     coordinate system occurs as a result of overlaying its System
*     attribute, then some of its original attribute values may no
*     longer be appropriate (e.g. the Title, or attributes describing
*     its axes). In this case, these will be cleared before overlaying
*     any new values.
 
*  Parameters:
*     template
*        Pointer to the template SpecFrame, for which values should have been
*        explicitly set for any attribute which is to be transferred.
*     template_axes
*        Pointer to an array of int, with one element for each axis of the
*        "result" Frame (see below). For each axis in the result frame, the
*        corresponding element of this array should contain the (zero-based)

ast/src/specframe.c  view on Meta::CPAN

3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
/* It may be necessary to make temporary changes to the template Frame
   below. In order to ensure that we make no permanent changes to the
   supplied frame, we will, if necessary, take a deep copy of the
   supplied Frame, storing a pointer to the copy in "templt". If it is
   not necessary to make any changes to the template, we still want
   "templt" to hold a usable pointer, so we initialise it now to hold a
   clone of the supplied pointer. This pointer will be replaced by a
   pointer to a deep copy (if required) below. */
   templt = astClone( template );
 
/* If the result Frame is a SpecFrame, we must test to see if overlaying its
   System attribute will change the type of coordinate system it describes.
   Determine the value of this attribute for the result and template
   SpecFrames. */
   specframe = astIsASpecFrame( result );
   if( specframe ) {
 
/* If the coordinate system will change, any value already set for the result
   SpecFrame's Title will no longer be appropriate, so clear it. But note
   the coordinate system will change only if the system values are
   different AND the system has been set explicitly in the template. If

ast/src/specframe.c  view on Meta::CPAN

3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
      if( astTestSystem( template ) ) {
         templt = astAnnul( templt );
         templt = astCopy( template );
         astClearSystem( templt );
         astClearAlignSystem( templt );
      }
   }
 
/* Invoke the parent class astOverlay method to transfer attributes inherited
   from the parent class. */
   (*parent_overlay)( templt, template_axes, result, status );
 
/* Check if the result Frame is a SpecFrame or from a class derived from
   SpecFrame. If not, we cannot transfer SpecFrame attributes to it as it is
   insufficiently specialised. In this case simply omit these attributes. */
   if ( specframe && astOK ) {
 
/* Define macros that test whether an attribute is set in the template and,
   if so, transfers its value to the result. */
#define OVERLAY(attribute) \
   if ( astTest##attribute( template ) ) { \
      astSet##attribute( result, astGet##attribute( template ) ); \
   }
 
/* Use the macro to transfer each SpecFrame attribute in turn. Note,
   SourceVRF must be overlayed before SourceVel. Otherwise the stored value
   for SourceVel would be changed from the default SourceVRF to the specified
   SourceVRF when SourceVRF was overlayed. */
      OVERLAY(AlignStdOfRest)
      OVERLAY(AlignSpecOffset);
      OVERLAY(RefDec)
      OVERLAY(RefRA)
      OVERLAY(RestFreq)
      OVERLAY(SourceSys)
      OVERLAY(SourceVRF)
      OVERLAY(SourceVel)
      OVERLAY(StdOfRest)
      OVERLAY(SpecOrigin)

ast/src/specframe.c  view on Meta::CPAN

4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
*                   AstFrame **result, int *status )
 
*  Class Membership:
*     SpecFrame member function (over-rides the protected astSubFrame
*     method inherited from the Frame class).
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the axes
*     from a "target" SpecFrame and creates a new Frame with copies of
*     the selected axes assembled in the requested order. It then
*     optionally overlays the attributes of a "template" Frame on to the
*     result. It returns both the resulting Frame and a Mapping that
*     describes how to convert between the coordinate systems described by
*     the target and result Frames. If necessary, this Mapping takes
*     account of any differences in the Frames' attributes due to the
*     influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target SpecFrame, from which axes are to be
*        selected.
*     template
*        Pointer to the template Frame, from which new attributes for the
*        result Frame are to be obtained. Optionally, this may be NULL, in
*        which case no overlaying of template attributes will be performed.
*     result_naxes
*        Number of axes to be selected from the target Frame. This number may
*        be greater than or less than the number of axes in this Frame (or
*        equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving a list
*        of the (zero-based) axis indices of the axes to be selected from the
*        target SpecFrame. The order in which these are given determines
*        the order in which the axes appear in the result Frame. If any of the
*        values in this array is set to -1, the corresponding result axis will
*        not be derived from the target Frame, but will be assigned default
*        attributes instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This should
*        contain a list of the template axes (given as zero-based axis indices)
*        with which the axes of the result Frame are to be associated. This
*        array determines which axes are used when overlaying axis-dependent
*        attributes of the template on to the result. If any element of this
*        array is set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not used and
*        a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned Mapping.
*        The forward transformation of this Mapping will describe how to
*        convert coordinates from the coordinate system described by the target

ast/src/specframe.c  view on Meta::CPAN

4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
   a SpecFrame. */
   if ( ( result_naxes == 1 ) && ( target_axes[ 0 ] == 0 ) ) {
 
/* Form the result from a copy of the target. */
      *result = astCopy( target );
 
/* Initialise a flag to indicate that MakeSpecMapping should not report
   errors if no Mapping can be created. */
      report = 0;
 
/* If required, overlay the template attributes on to the result SpecFrame.
   Also get the system and standard of rest in which to align the two
   SpecFrames. These are the values from the template (if there is a
   template). */
      if ( template ) {
         astOverlay( template, template_axes, *result );
         if( astIsASpecFrame( template ) ) {
            align_frm = astCopy( template );
 
/* Since we now know that both the template and target are SpecFrames, it
   should usually be possible to convert betwen them. If conversion is

ast/src/specframe.c  view on Meta::CPAN

4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
      SET_AXIS(Symbol)
      SET_AXIS(Unit)
 
/* Clear attributes which have an extended range of values allowed by
   this class. */
      astClearSystem( temp );
      astClearAlignSystem( temp );
 
/* Invoke the astSubFrame method inherited from the Frame class to
   produce the result Frame by selecting the required set of axes and
   overlaying the template Frame's attributes. */
      match = (*parent_subframe)( (AstFrame *) temp, template,
                                  result_naxes, target_axes, template_axes,
                                  map, result, status );
 
/* Delete the temporary copy of the target SpecFrame. */
      temp = astDelete( temp );
   }
 
/* If an error occurred or no match was found, annul the returned
   objects and reset the returned result. */

ast/src/timeframe.c  view on Meta::CPAN

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
*        Modified so that a TimeFrame can be used as a template to find a
*        TimeFrame contained within a CmpFrame. This involves changes in
*        Match and the removal of the local versions of SetMaxAxes and
*        SetMinAxes.
*     3-SEP-2007 (DSB):
*        In SubFrame, since AlignSystem is extended by the TimeFrame class
*        it needs to be cleared before invoking the parent SubFrame
*        method in cases where the result Frame is not a TimeFrame.
*     2-OCT-2007 (DSB):
*        In Overlay, clear AlignSystem as well as System before calling
*        the parent overlay method.
*     2-OCT-2007 (DSB):
*        Added "LT" (Local Time) time scale.
*     9-DEC-2008 (DSB):
*        Ensure Format string pointer is used correctly.
*     19-JAN-2009 (DSB):
*        Ensure "<bad>" is returned by astFormat if the axis value is bad.
*     31-MAR-2009 (DSB):
*        Extend TimeFrame "iso" Format to allow it to specify the character to
*        place between the time and date strings.
*     15-APR-2009 (DSB):

ast/src/timeframe.c  view on Meta::CPAN

302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
static const char *(* parent_gettitle)( AstFrame *, int * );
static const char *(* parent_getunit)( AstFrame *, int, int * );
static double (* parent_getepoch)( AstFrame *, int * );
static int (* parent_fields)( AstFrame *, int, const char *, const char *, int, char **, int *, double *, int * );
static int (* parent_match)( AstFrame *, AstFrame *, int, int **, int **, AstMapping **, AstFrame **, int * );
static int (* parent_subframe)( AstFrame *, AstFrame *, int, const int *, const int *, AstMapping **, AstFrame **, int * );
static int (* parent_testattrib)( AstObject *, const char *, int * );
static int (* parent_unformat)( AstFrame *, int, const char *, double *, int * );
static void (* parent_clearattrib)( AstObject *, const char *, int * );
static void (* parent_clearsystem)( AstFrame *, int * );
static void (* parent_overlay)( AstFrame *, const int *, AstFrame *, int * );
static void (* parent_setattrib)( AstObject *, const char *, int * );
static void (* parent_setsystem)( AstFrame *, AstSystemType, int * );
static void (* parent_setunit)( AstFrame *, int, const char *, int * );
 
/* Define macros for accessing each item of thread specific global data. */
#ifdef THREAD_SAFE
 
/* Define how to initialise thread-specific globals. */
#define GLOBAL_inits \
   globals->Class_Init = 0; \

ast/src/timeframe.c  view on Meta::CPAN

3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
parent_getunit = frame->GetUnit;
frame->GetUnit = GetUnit;
 
parent_setunit = frame->SetUnit;
frame->SetUnit = SetUnit;
 
parent_match = frame->Match;
frame->Match = Match;
 
parent_overlay = frame->Overlay;
frame->Overlay = Overlay;
 
parent_subframe = frame->SubFrame;
frame->SubFrame = SubFrame;
 
parent_format = frame->Format;
frame->Format = Format;
 
parent_unformat = frame->Unformat;
frame->Unformat = Unformat;

ast/src/timeframe.c  view on Meta::CPAN

4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
   }
 
/* Check at least one TimeFrame axis was found it the target. Store the
   axis associataions. */
   if( match && astOK ) {
      (*template_axes)[ 0 ] = 0;
      (*target_axes)[ 0 ] = target_axis0;
 
/* Use the target's "astSubFrame" method to create a new Frame (the
   result Frame) with copies of the target axes in the required
   order. This process also overlays the template attributes on to the
   target Frame and returns a Mapping between the target and result
   Frames which effects the required coordinate conversion. */
      match = astSubFrame( target, template, 1, *target_axes, *template_axes,
                           map, result );
   }
 
/* If an error occurred, or conversion to the result Frame's coordinate
   system was not possible, then free all memory, annul the returned
   objects, and reset the returned value. */
   if ( !astOK || !match ) {

ast/src/timeframe.c  view on Meta::CPAN

4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
*  Synopsis:
*     #include "timeframe.h"
*     void Overlay( AstFrame *template, const int *template_axes,
*                   AstFrame *result, int *status )
 
*  Class Membership:
*     TimeFrame member function (over-rides the protected astOverlay method
*     inherited from the Frame class).
 
*  Description:
*     This function overlays attributes of a TimeFrame (the "template") on to
*     another Frame, so as to over-ride selected attributes of that second
*     Frame. Normally only those attributes which have been specifically set
*     in the template will be transferred. This implements a form of
*     defaulting, in which a Frame acquires attributes from the template, but
*     retains its original attributes (as the default) if new values have not
*     previously been explicitly set in the template.
*
*     Note that if the result Frame is a TimeFrame and a change of time
*     coordinate system occurs as a result of overlaying its System
*     attribute, then some of its original attribute values may no
*     longer be appropriate (e.g. the Title, or attributes describing
*     its axes). In this case, these will be cleared before overlaying
*     any new values.
 
*  Parameters:
*     template
*        Pointer to the template TimeFrame, for which values should have been
*        explicitly set for any attribute which is to be transferred.
*     template_axes
*        Pointer to an array of int, with one element for each axis of the
*        "result" Frame (see below). For each axis in the result frame, the
*        corresponding element of this array should contain the (zero-based)

ast/src/timeframe.c  view on Meta::CPAN

4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
   int resetSystem;              /* Was the template System value cleared? */
   int timeframe;                /* Result Frame is a TimeFrame? */
 
/* Check the global error status. */
   if ( !astOK ) return;
 
/* Get the old and new systems. */
   old_system = astGetSystem( result );
   new_system = astGetSystem( template );
 
/* If the result Frame is a TimeFrame, we must test to see if overlaying its
   System attribute will change the type of coordinate system it describes.
   Determine the value of this attribute for the result and template
   TimeFrames. */
   resetSystem = 0;
   timeframe = astIsATimeFrame( result );
   if( timeframe ) {
 
/* If the coordinate system will change, any value already set for the result
   TimeFrame's Title, etc,  will no longer be appropriate, so clear it. But
   note, the coordinate system will change only if the system values are

ast/src/timeframe.c  view on Meta::CPAN

4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
         new_alignsystem = astGetAlignSystem( template );
         astClearAlignSystem( template );
 
         resetSystem = 1;
      }
   }
 
/* Invoke the parent class astOverlay method to transfer attributes inherited
   from the parent class. */
   (*parent_overlay)( template, template_axes, result, status );
 
/* Reset the System and AlignSystem values if necessary */
   if( resetSystem ) {
      astSetSystem( template, new_system );
      astSetAlignSystem( template, new_alignsystem );
   }
 
/* Check if the result Frame is a TimeFrame or from a class derived from
   TimeFrame. If not, we cannot transfer TimeFrame attributes to it as it is
   insufficiently specialised. In this case simply omit these attributes. */
   if ( timeframe && astOK ) {
 
/* Define macros that test whether an attribute is set in the template and,
   if so, transfers its value to the result. */
#define OVERLAY(attribute) \
   if ( astTest##attribute( template ) ) { \
      astSet##attribute( result, astGet##attribute( template ) ); \
   }
 
/* Use the macro to transfer each TimeFrame attribute in turn. Note,
   SourceVRF must be overlayed before SourceVel. Otherwise the stored value
   for SourceVel would be changed from the default SourceVRF to the specified
   SourceVRF when SourceVRF was overlayed. */
      OVERLAY(AlignTimeScale)
      OVERLAY(LTOffset)
      OVERLAY(TimeOrigin)
      OVERLAY(TimeScale)
   }
 
/* Undefine macros local to this function. */
#undef OVERLAY
}

ast/src/timeframe.c  view on Meta::CPAN

5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
*                   AstFrame **result, int *status )
 
*  Class Membership:
*     TimeFrame member function (over-rides the protected astSubFrame
*     method inherited from the Frame class).
 
*  Description:
*     This function selects a requested sub-set (or super-set) of the axes
*     from a "target" TimeFrame and creates a new Frame with copies of
*     the selected axes assembled in the requested order. It then
*     optionally overlays the attributes of a "template" Frame on to the
*     result. It returns both the resulting Frame and a Mapping that
*     describes how to convert between the coordinate systems described by
*     the target and result Frames. If necessary, this Mapping takes
*     account of any differences in the Frames' attributes due to the
*     influence of the template.
 
*  Parameters:
*     target
*        Pointer to the target TimeFrame, from which axes are to be
*        selected.
*     template
*        Pointer to the template Frame, from which new attributes for the
*        result Frame are to be obtained. Optionally, this may be NULL, in
*        which case no overlaying of template attributes will be performed.
*     result_naxes
*        Number of axes to be selected from the target Frame. This number may
*        be greater than or less than the number of axes in this Frame (or
*        equal).
*     target_axes
*        Pointer to an array of int with result_naxes elements, giving a list
*        of the (zero-based) axis indices of the axes to be selected from the
*        target TimeFrame. The order in which these are given determines
*        the order in which the axes appear in the result Frame. If any of the
*        values in this array is set to -1, the corresponding result axis will
*        not be derived from the target Frame, but will be assigned default
*        attributes instead.
*     template_axes
*        Pointer to an array of int with result_naxes elements. This should
*        contain a list of the template axes (given as zero-based axis indices)
*        with which the axes of the result Frame are to be associated. This
*        array determines which axes are used when overlaying axis-dependent
*        attributes of the template on to the result. If any element of this
*        array is set to -1, the corresponding result axis will not receive any
*        template attributes.
*
*        If the template argument is given as NULL, this array is not used and
*        a NULL pointer may also be supplied here.
*     map
*        Address of a location to receive a pointer to the returned Mapping.
*        The forward transformation of this Mapping will describe how to
*        convert coordinates from the coordinate system described by the target

ast/src/timeframe.c  view on Meta::CPAN

5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
/* Result is a TimeFrame. */
/* -------------------------- */
/* Check if the result Frame is to have one axis obtained by selecting
   the single target TimeFrame axis. If so, the result will also be
   a TimeFrame. */
   if ( ( result_naxes == 1 ) && ( target_axes[ 0 ] == 0 ) ) {
 
/* Form the result from a copy of the target. */
      *result = astCopy( target );
 
/* If required, overlay the template attributes on to the result TimeFrame.
   Also choose the Frame which defined the alignment system and time scale
   (via its AlignSystem and AlignTimeScale attributes) in which to align the
   two TimeFrames. This is the template (if there is a template). */
      if ( template ) {
         astOverlay( template, template_axes, *result );
         if( astIsATimeFrame( template ) ) {
            align_frm = astClone( template );
         } else {
            align_frm = astClone( target );
         }

ast/src/timeframe.c  view on Meta::CPAN

5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
      SET_AXIS(Symbol)
      SET_AXIS(Unit)
 
/* Clear attributes which have an extended range of values allowed by
   this class. */
      astClearSystem( temp );
      astClearAlignSystem( temp );
 
/* Invoke the astSubFrame method inherited from the Frame class to
   produce the result Frame by selecting the required set of axes and
   overlaying the template Frame's attributes. */
      match = (*parent_subframe)( (AstFrame *) temp, template,
                                  result_naxes, target_axes, template_axes,
                                  map, result, status );
 
/* Delete the temporary copy of the target TimeFrame. */
      temp = astDelete( temp );
   }
 
/* If an error occurred or no match was found, annul the returned
   objects and reset the returned result. */



( run in 1.217 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )