casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PrincipalAxesDM.h
Go to the documentation of this file.
1 //# PrincipalAxesDM.h: Base class for drawing axis-bound datasets
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef TRIALDISPLAY_PRINCIPALAXESDM_H
29 #define TRIALDISPLAY_PRINCIPALAXESDM_H
30 
31 #include <casa/aips.h>
35 
36 namespace casacore{
37 
38  class IPosition;
39  template <class T> class Vector;
40 }
41 
42 namespace casa { //# NAMESPACE CASA - BEGIN
43 
44  class WorldCanvasHolder;
45  class WorldCanvas;
46 
47 // <summary>
48 // Interface for DisplayMethods which have data arranged in "axes."
49 // </summary>
50 //
51 // <synopsis>
52 // This class adds to the interface defined by DisplayMethod to
53 // provide further infrastructure relevant to data which is
54 // arranged by axis (eg. lattice or column-based data).
55 // </synopsis>
56 
57  class PrincipalAxesDM : public DisplayMethod {
58 
59  public:
60 
61  // User constructor.
63  PrincipalAxesDD *padd);
64 
65  // Destructor.
66  virtual ~PrincipalAxesDM();
67 
68  // Draw on the provided WorldCanvasHolder. This method provides
69  // generic preparation that is common to all objects which are
70  // being sliced along principal axes. It calls the pure virtual
71  // functions (below) which must be defined in fully typed derived
72  // classes.
73  virtual void draw(Display::RefreshReason reason,
74  WorldCanvasHolder &wcHolder);
75 
76  // clear drawlist state.
77  virtual void cleanup();
78 
79  protected:
80 
81  // This method does setup stuff that is common to all elements
82  // of an axis-bound display data element.
83  virtual void setup(casacore::IPosition fixedPos);
84 
85  virtual void setup2d();
86 
87  // This method should be defined in derived classes to simply
88  // return the shape of the data object, eg. Array.shape() or
89  // Image.shape(), etc.
90  virtual casacore::IPosition dataShape() = 0;
91 
92  // This method should be defined in derived classes to actually
93  // draw the data contained in datMatrix, however it likes, starting
94  // at the point blc, on *wCanvas. It *must* return a casacore::uInt which
95  // indicates the drawListNumber it allocated for this drawing.
96  // If <src>usePixelEdges</src> is true, then the given blc and
97  // trc correspond to the world blc and trc of the first and last
98  // pixels in the given data, otherwise they correspond to the world
99  // centres of the blc and trc pixels.
100  virtual casacore::uInt dataDrawSelf(WorldCanvas *wCanvas,
103  const casacore::IPosition &start,
106  const casacore::Bool usePixelEdges = false) = 0;
107 
108  // Called by draw(): an optimization for ColormapChange in 24bit mode.
109  // Redraws the last image using only mapToColor on the WorldCanvas,
110  // if possible. If it returns true, the new method
111  // WC::redrawIndexedImage() was used successfully (otherwise, draw()
112  // continues in the normal way). Override to enable, if necessary
113  // (see LatticePADMRaster for an example).
115  return false;
116  };
117 
118  // Some data members which all display elements along principal
119  // axes will play around with:
123 
124  // Is a transpose necessary?
126  return sliceShape(itsYAxisNum) >1 &&
128  }
129  // The logic behind this cryptic code (see LatticePADM::dataGetSlice):
130  // If a either a 1xN or Nx1 slice (including 1x1) is requested,
131  // LatticePADM's latt.getSlice() casacore::Array will be 1-dimensional, which
132  // the casacore::Matrix = casacore::Array operator will turn into an Nx1 matrix.
133  // If, on the other hand, there is no degeneracy in the desired
134  // slice casacore::Matrix, it is returned in lattice (not X,Y) order. (dk)
135 
136  // (Required) default constructor.
137  PrincipalAxesDM();
138 
139  // (Required) copy constructor.
140  PrincipalAxesDM(const PrincipalAxesDM &other);
141 
142  // (Required) copy assignment.
143  void operator=(const PrincipalAxesDM &other);
144 
145  private:
146 
147  // Axis numbers for internal book-keeping.
149 
150  // Drawlist state. Moved here, where it's used, from DisplayMethod,
151  // and made private. 11/03 dk. The Caching side uses different
152  // state (and purgeCache(), rather than cleanup()).
153 
158 
159  };
160 
161 
162 } //# NAMESPACE CASA - END
163 
164 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
casacore::IPosition sliceShape
std::vector< double > Vector
Definition: ds9context.h:24
virtual ~PrincipalAxesDM()
Destructor.
casacore::IPosition start
Some data members which all display elements along principal axes will play around with: ...
virtual casacore::uInt dataDrawSelf(WorldCanvas *wCanvas, const casacore::Vector< casacore::Double > &blc, const casacore::Vector< casacore::Double > &trc, const casacore::IPosition &start, const casacore::IPosition &sliceShape, const casacore::IPosition &stride, const casacore::Bool usePixelEdges=false)=0
This method should be defined in derived classes to actually draw the data contained in datMatrix...
casacore::uInt itsZAxisNum
Buffer for storing Attributes.
virtual casacore::Bool dataRedrawSelf(WorldCanvas *, Display::RefreshReason)
Called by draw(): an optimization for ColormapChange in 24bit mode.
casacore::Bool notUsed
Drawlist state.
virtual void cleanup()
clear drawlist state.
casacore::IPosition stride
virtual void setup(casacore::IPosition fixedPos)
This method does setup stuff that is common to all elements of an axis-bound display data element...
casacore::uInt itsYAxisNum
virtual casacore::IPosition dataShape()=0
This method should be defined in derived classes to simply return the shape of the data object...
Interface for DisplayDatas which have data arranged in axes.
PrincipalAxesDM()
The logic behind this cryptic code (see LatticePADM::dataGetSlice): If a either a 1xN or Nx1 slice (i...
virtual void setup2d()
void operator=(const PrincipalAxesDM &other)
(Required) copy assignment.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void draw(Display::RefreshReason reason, WorldCanvasHolder &wcHolder)
Draw on the provided WorldCanvasHolder.
casacore::uInt drawListNumber
RefreshReason
Callback reasons for PCRefreshEvent and WCRefreshEvent.
Definition: DisplayEnums.h:267
Base class for drawing a particular element (view) of a DisplayData.
Definition: DisplayMethod.h:56
A holder to interface between DisplayDatas and a WorldCanvas.
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
AttributeBuffer drawState
virtual casacore::Bool needToTranspose()
Is a transpose necessary?
Interface for DisplayMethods which have data arranged in &quot;axes.&quot;.
casacore::uInt itsXAxisNum
Axis numbers for internal book-keeping.
WorldCanvasHolder * holder
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42