casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ActiveCaching2dDD.h
Go to the documentation of this file.
1 //# ActiveCaching2dDD.h: active 2d implementation of a CachingDisplayData
2 //# Copyright (C) 1999,2000,2001,2002,2003,2004
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_ACTIVECACHING2DDD_H
29 #define TRIALDISPLAY_ACTIVECACHING2DDD_H
30 
31 #include <casa/aips.h>
34 
35 namespace casa { //# NAMESPACE CASA - BEGIN
36 
37 // <summary>
38 // Class providing active behaviour for 2d CachingDisplayDatas.
39 // </summary>
40 
41 // <synopsis>
42 // An "active" DisplayData is one which is able to negotiate
43 // coordinates on a WorldCanvas, and subsequently provide coordinate
44 // conversion facilities. This particular implementation is
45 // of a two-dimensional (2d) active DisplayData.
46 // </synopsis>
47 
49 
50  public:
51 
52  // Constructor. Caller must provide a DisplayCoordinateSystem, and the
53  // pixel range (via <src>pixelblc</src> and <src>pixeltrc</src>)
54  // over which the DisplayData is expected to function. The primary
55  // use of <src>pixelblc</src> and <src>pixeltrc</src> is to provide
56  // limits for the unzoomed WorldCanvas. <src>coordsys</src> must
57  // have only two world and pixel axes, otherwise an exception is
58  // thrown, and likewise, <src>pixblc</src> and <src>pixtrc</src>
59  // must both be of length two.
63 
64  // Destructor.
65  virtual ~ActiveCaching2dDD();
66 
67  // casacore::Coordinate transformation handlers, called by WorldCanvasHolder.
68  // <group>
71  // </group>
72 
73  // casacore::Format a string containing coordinate information at the given
74  // world coordinate.
76  const casacore::Bool &displayAxesOnly = false);
77 
78  // World axis information suppliers.
79  // <group>
82  // </group>
83 
84  // Return the number of display elements (ie. drawable images) in
85  // this DisplayData. Both return 1 because this is defined to be a
86  // two-dimensional DisplayData, and can only have one view. That
87  // is, there is no third axis to iterate over for multiple views.
88  // <group>
89  virtual casacore::uInt nelements(const WorldCanvasHolder &/*wcHolder*/) const {
90  return nelements();
91  }
92  virtual casacore::uInt nelements() const {
93  return 1;
94  }
95  // </group>
96 
97  // Install the default options for this DisplayData.
98  virtual void setDefaultOptions();
99 
100  // Apply options stored in <src>rec</src> to the DisplayData. A
101  // return value of <src>true</src> means a refresh is needed.
102  // <src>recOut</src> contains any fields which were implicitly
103  // changed as a result of the call to this function.
105 
106  // Retrieve the current and default options and parameter types.
107  virtual casacore::Record getOptions( bool scrub=false ) const;
108 
109  // Negotiatiate WorldCanvas linear coordinate system when asked to
110  // do so by the WorldCanvasHolder.
111  virtual casacore::Bool sizeControl(WorldCanvasHolder &wcHolder,
112  AttributeBuffer &holderBuf);
113 
114  // Determine whether DD can draw on the current coordinate system
115  // of the given WC[H].
116  virtual casacore::Bool conformsToCS(const WorldCanvas& wc);
117 
118  // Tidy up the elements of this DisplayData.
119  virtual void cleanup();
120 
121  protected:
122 
123  // Return the current options of this DisplayData as an
124  // AttributeBuffer. The caller must delete the returned buffer.
126 
127  // (Required) default constructor.
129 
130  // (Required) copy constructor.
131  ActiveCaching2dDD(const ActiveCaching2dDD &other);
132 
133  // (Required) copy assignment.
134  void operator=(const ActiveCaching2dDD &other);
135 
136  // Install a DisplayCoordinateSystem and limits.
137  void setCoordinateSystem(const DisplayCoordinateSystem &coordsys,
139  const casacore::Vector<casacore::Double> &pixtrc);
140 
141  // Identify a specified world axis by its casacore::Coordinate type, number,
142  // and axis in that coordinate.
144  casacore::Int &axisincoord, const casacore::uInt worldaxisnum);
145 
146  // Generate a casacore::String code for the specified world axis, describing
147  // the coordinate type, number and axis in that coordinate.
148  casacore::String codeWorldAxis(const casacore::uInt worldaxisnum);
149 
150  // Return the world axis increments.
152 
153  // Return whether tracking is currently world (T) or pixel (F) coordinates.
155  return itsShowWorldCoordinate;
156  }
157 
158  // Store the 2d DisplayCoordinateSystem here.
160 
161  // Store the 2d pixel corners here.
163 
164  private:
165 
166  // Option: aspect ratio for pixels.
168 
169  // Position tracking
175 
176  // Set Spectral formatting
178  const casacore::String& velTypeString,
179  const casacore::String& unitString);
180 
181 
182  };
183 
184 
185 } //# NAMESPACE CASA - END
186 
187 #endif
casacore::Vector< casacore::Double > worldAxisIncrements() const
Return the world axis increments.
int Int
Definition: aipstype.h:50
Class providing active behaviour for 2d CachingDisplayDatas.
void setSpectralFormatting(DisplayCoordinateSystem &cSys, const casacore::String &velTypeString, const casacore::String &unitString)
Set Spectral formatting.
virtual casacore::Bool conformsToCS(const WorldCanvas &wc)
Determine whether DD can draw on the current coordinate system of the given WC[H].
ActiveCaching2dDD()
(Required) default constructor.
Buffer for storing Attributes.
virtual Type type()
Return the type enum.
virtual casacore::Vector< casacore::String > worldAxisUnits() const
casacore::Bool itsShowWorldCoordinate
void identifyWorldAxis(casacore::Coordinate::Type &type, casacore::Int &coordinate, casacore::Int &axisincoord, const casacore::uInt worldaxisnum)
Identify a specified world axis by its casacore::Coordinate type, number, and axis in that coordinate...
casacore::Vector< casacore::Double > itsPixelBlc
Store the 2d pixel corners here.
virtual casacore::Bool linToWorld(casacore::Vector< casacore::Double > &world, const casacore::Vector< casacore::Double > &lin)
casacore::Coordinate transformation handlers, called by WorldCanvasHolder.
DisplayCoordinateSystem itsCoordinateSystem
Store the 2d DisplayCoordinateSystem here.
void setCoordinateSystem(const DisplayCoordinateSystem &coordsys, const casacore::Vector< casacore::Double > &pixblc, const casacore::Vector< casacore::Double > &pixtrc)
Install a DisplayCoordinateSystem and limits.
virtual casacore::Bool setOptions(casacore::Record &rec, casacore::Record &recOut)
Apply options stored in rec to the DisplayData.
virtual casacore::Bool worldToLin(casacore::Vector< casacore::Double > &lin, const casacore::Vector< casacore::Double > &world)
virtual casacore::String showPosition(const casacore::Vector< casacore::Double > &world, const casacore::Bool &displayAxesOnly=false)
casacore::Format a string containing coordinate information at the given world coordinate.
casacore::Vector< casacore::Double > itsPixelTrc
casacore::Bool itsFractionalPixels
Base class for auto-caching DisplayData objects.
casacore::String itsOptionsAspect
Option: aspect ratio for pixels.
virtual casacore::uInt nelements() const
and non-specific
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual casacore::Vector< casacore::String > worldAxisNames() const
World axis information suppliers.
Type
This enum lists the types of the derived classes.
Definition: Coordinate.h:144
casacore::String itsVelocityType
casacore::String codeWorldAxis(const casacore::uInt worldaxisnum)
Generate a casacore::String code for the specified world axis, describing the coordinate type...
virtual casacore::Bool sizeControl(WorldCanvasHolder &wcHolder, AttributeBuffer &holderBuf)
Negotiatiate WorldCanvas linear coordinate system when asked to do so by the WorldCanvasHolder.
void operator=(const ActiveCaching2dDD &other)
(Required) copy assignment.
A holder to interface between DisplayDatas and a WorldCanvas.
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
virtual void setDefaultOptions()
Install the default options for this DisplayData.
virtual casacore::uInt nelements(const WorldCanvasHolder &) const
Return the number of display elements (ie.
virtual casacore::Bool worldCoordTracking() const
Return whether tracking is currently world (T) or pixel (F) coordinates.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual ~ActiveCaching2dDD()
Destructor.
casacore::String itsSpectralUnit
Position tracking.
virtual void cleanup()
Tidy up the elements of this DisplayData.
virtual casacore::Record getOptions(bool scrub=false) const
Retrieve the current and default options and parameter types.
unsigned int uInt
Definition: aipstype.h:51
virtual AttributeBuffer optionsAsAttributes()
Return the current options of this DisplayData as an AttributeBuffer.