view release on metacpan or search on metacpan
ast/src/axis.c view on Meta::CPAN
707708709710711712713714715716717718719720721722723724725726727
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
122512261227122812291230123112321233123412351236123712381239124012411242124312441245* 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
124812491250125112521253125412551256125712581259126012611262126312641265126612671268* 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
604605606607608609610611612613614615616617618619620621622623static
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
480448054806480748084809481048114812481348144815481648174818481948204821482248234824parent_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
620162026203620462056206620762086209621062116212621362146215621662176218621962206221* 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
62446245624662476248624962506251625262536254625562566257625862596260626162626263/* 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
62686269627062716272627362746275627662776278627962806281628262836284628562866287/* 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
629262936294629562966297629862996300630163026303630463056306630763086309631063116312/* 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
63926393639463956396639763986399640064016402640364046405640664076408640964106411
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
642864296430643164326433643464356436643764386439644064416442644364446445644664476448/* 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;
}
}
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
678767886789679067916792679367946795679667976798679968006801680268036804680568066807/* 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
919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250* 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
940594069407940894099410941194129413941494159416941794189419942094219422942394249425
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
946594669467946894699470947194729473947494759476947794789479948094819482948394849485/* 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
952895299530953195329533953495359536953795389539954095419542954395449545954695479548/* 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. */
/* ---------------------------------- */
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
196197198199200201202203204205206207208209210211212213214215216static
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
942943944945946947948949950951952953954955956957958959960961962parent_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
111711181119112011211122112311241125112611271128112911301131113211331134113511361137
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
116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198* 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
121812191220122112221223122412251226122712281229123012311232123312341235123612371238* 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
1490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541* 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
2093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126* - 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
727374757677787980818283848586878889909192* 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
150151152153154155156157158159160161162163164165166167168169170static 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
183818391840184118421843184418451846184718481849185018511852185318541855185618571858
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
243824392440244124422443244424452446244724482449245024512452245324542455245624572458
}
/* 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
248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514* 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
255425552556255725582559256025612562256325642565256625672568256925702571257225732574/* 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
260526062607260826092610261126122613261426152616261726182619262026212622262326242625
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
2908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959* 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
302230233024302530263027302830293030303130323033303430353036303730383039304030413042
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
310231033104310531063107310831093110311131123113311431153116311731183119312031213122
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
732073217322732373247325732673277328732973307331733273337334733573367337733873397340
( (
*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
850785088509851085118512851385148515851685178518851985208521852285238524852585268527* 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
857085718572857385748575857685778578857985808581858285838584858585868587858885898590
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
860086018602860386048605860686078608860986108611861286138614861586168617861886198620
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 ) ) {
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
108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906*
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
110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046/* 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
798379847985798679877988798979907991799279937994799579967997799879998000800180028003* 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
802980308031803280338034803580368037803880398040804180428043804480458046804780488049
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
1049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547* 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
746174627463746474657466746774687469747074717472747374747475747674777478747974807481* 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
750375047505750675077508750975107511751275137514751575167517751875197520752175227523* 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
1134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400* 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
163164165166167168169170171172173174175176177178179180181182183static
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
136713681369137013711372137313741375137613771378137913801381138213831384138513861387* 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
13971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443/* 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
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
33283329333033313332333333343335333633373338333933403341334233433344334533463347parent_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
232233234235236237238239240241242243244245246247248249250251252* - 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
856857858859860861862863864865866867868869870871872873874875876static
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
493249334934493549364937493849394940494149424943494449454946494749484949495049514952parent_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
684368446845684668476848684968506851685268536854685568566857685868596860686168626863
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
802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054* 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
808980908091809280938094809580968097809880998100810181028103810481058106810781088109
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
814881498150815181528153815481558156815781588159816081618162816381648165816681678168
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
87358736873787388739874087418742874387448745874687478748874987508751875287538754/* 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 );
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
988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937* 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
100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042
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
101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203
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
139513961397139813991400140114021403140414051406140714081409141014111412141314141415
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
144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500* 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
135136137138139140141142143144145146147148149150151152153154155* 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
252253254255256257258259260261262263264265266267268269270271272static 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
244824492450245124522453245424552456245724582459246024612462246324642465246624672468
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
315731583159316031613162316331643165316631673168316931703171317231733174317531763177
}
/* 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
339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425* 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
347134723473347434753476347734783479348034813482348334843485348634873488348934903491/* 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
35173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554
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
4725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776* 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
483948404841484248434844484548464847484848494850485148524853485448554856485748584859
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
493549364937493849394940494149424943494449454946494749484949495049514952495349544955
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
127128129130131132133134135136137138139140141142143144145146147* 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
302303304305306307308309310311312313314315316317318319320321322static 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
344634473448344934503451345234533454345534563457345834593460346134623463346434653466parent_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
422342244225422642274228422942304231423242334234423542364237423842394240424142424243
}
/* 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
444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475* 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
450545064507450845094510451145124513451445154516451745184519452045214522452345244525
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
4541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583
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
5229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280* 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
533853395340534153425343534453455346534753485349535053515352535353545355535653575358/* 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
541654175418541954205421542254235424542554265427542854295430543154325433543454355436
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. */