[QUANTITY] Data Model for Quantity v0.5
Brian Thomas
brian.thomas at gsfc.nasa.gov
Tue May 11 14:02:29 PDT 2004
On Tuesday 11 May 2004 03:03 pm, David Berry wrote:
> Brian,
>
> > > So how would you modify the code example I gave, which was:
> > >
> > > public void GridPlotter( StandardQuantity stdQ ){
> > > Mapping map = stdQ.getCurrentCoordsQuantity().getMapping();
> > >
> > > <then proceed to use the Mapping to transform arbitrary positions
> > > backwards and forwards between pixel coords and current WCS
> > > coords>
> > >
> > > }
> >
> > Make the "getMapping()" method require an AxisFrame as an input. e.g.
> >
> > Mapping map = stdQ.getMapping(frameIWantToUse);
> >
> > We can also have the empty accessor call ("getMapping()") which returns
> > the default/first mapping if you like.
>
> So this is nothing really to do with locators?
It does in the sense that the "get{Coords|Value}Quantity" belongs on the Locator
interface rather than the Quantity interface.
Having thought about it a bit more, I guess I'm wondering which "frame"
is being specified.. wouldn't you have to specify an input AND and output
frame? In that case, the method is:
Mapping map = q.getMappint(inputFrame, outputFrame);
The internals may look over the frameset and create a compoundMapping
to return if needed, or an atomic mapping, if that fits the bill.
>
> Also, would your proposed empty accessor call "getMapping()" not just be
> a convenience method equivalent to the current
>
> getCurrentCoordsQuantity().getMapping()
Not exactly, as the _locator_ has getCurrentCoordsQuantity, not the Q to
which the locator belongs. Presumeably the quantity ("parentQ") has the
full access/insight to the frameset and can determine (or create on the fly
via compound map) the mapping that is being specified.
The whole point of moving getCurrent[Coords|Value]Quantity to the locator
is that you may have more than one locator open for a Q at a time. If you place it on
the parent Q, then you are restricted to traversal only in one frame at a time
which is a needless restriction. After all, there should be no "favored frames",
it is the job of the locator (I think) to pick which frame it wants to use for
traversal (and to instruct the parentQ which values to return).
>
> In your "getMapping(frameIWantToUse)" what is the data type of
> frameIWantToUse ?
It is of type "Frame". Therefore I can use an coreQ (which "isa" frame)
and are used to specify the axis frames as the input. A code snippet:
List axisFrames = standardQ.getCoordsQuanittyList();
// choose the first frame
CoreQuantity axisFrame = axisFrames.get(0);
// choose the 3rd frame
CoreQuantity axisFrame3 = axisFrames.get(2);
// get the mapping which has the first axisFrame as input, and the 3rd as output
Mapping map1to3 = standardQ.getMapping(axisFrame, axisFrame3);
// do something with the mapping..
As you can see, no locator needed.
=b.t.
>
> David
>
>
>
>
> ----------------------------------------------------------------------
> Dr David S. Berry (dsb at ast.man.ac.uk)
>
> STARLINK project | Centre for Astrophysics
> (http://www.starlink.ac.uk/) | University of Central Lancashire
> Rutherford Appleton Laboratory | PRESTON
> DIDCOT | United Kingdom
> United Kingdom | PR1 2HE
> OX11 0QX Tel. 01772 893733
> 01257 273192
--
* Dr. Brian Thomas
* Dept of Astronomy/University of Maryland-College Park
* Code 630.1/Goddard Space Flight Center-NASA
* fax: (301) 286-1775
* phone: (301) 286-6128 [GSFC]
(301) 405-2312 [UMD]
More information about the dm
mailing list