casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AxesDisplayData.h
Go to the documentation of this file.
1 //# AxesDisplayData.h: axis labelling for registering on WorldCanvasHolders
2 //# Copyright (C) 1999,2000,2001,2002,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_AXESDISPLAYDATA_H
29 #define TRIALDISPLAY_AXESDISPLAYDATA_H
30 
31 #include <casa/aips.h>
37 
38 #include <iostream>
39 using namespace std;
40 
41 namespace casacore{
42 
43  template <class T> class Vector;
44  class String;
45 }
46 
47 namespace casa { //# NAMESPACE CASA - BEGIN
48 
49  class WorldCanvas;
50  class WorldCanvasHolder;
51  class AttributeBuffer;
52 
53 // <summary>
54 // Interface and simple implementation of axis labelling.
55 // </summary>
56 //
57 // <synopsis>
58 // This class adds to the interface defined by CachingDisplayData to
59 // provide the necessary infrastructure for drawing axis labels on
60 // WorldCanvases. This class serves as a basic implementation which
61 // can (and probably should) be over-written in derived classes.
62 // </synopsis>
63 
65 
66  public:
67 
68  // Constructor.
70 
71  // Destructor.
72  virtual ~AxesDisplayData();
73 
74  // Install the default options for this DisplayData.
75  virtual void setDefaultOptions();
76 
77  // Apply options stored in <src>rec</src> to the DisplayData. A
78  // return value of <src>true</src> means a refresh is needed.
79  // <src>recOut</src> contains any fields which were implicitly
80  // changed as a result of the call to this function.
82 
83  // Retrieve the current and default options and parameter types.
84  virtual casacore::Record getOptions( bool scrub=false ) const;
85 
86  // Return the type of this DisplayData.
88  return Display::CanvasAnnotation;
89  }
90 
91  // Create a new AxesDisplayMethod for drawing on the given
92  // WorldCanvas when the AttributeBuffers are suitably matched to the
93  // current state of this DisplayData and of the WorldCanvas/Holder.
94  // The tag is a unique number used to identify the age of the newly
95  // constructed CachingDisplayMethod.
96  virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas,
97  AttributeBuffer *wchAttributes,
98  AttributeBuffer *ddAttributes,
99  CachingDisplayData *dd);
100 
101  // Return the current options of this DisplayData as an
102  // AttributeBuffer.
103  virtual AttributeBuffer optionsAsAttributes();
104 
105  // Get the title text for labelling.
106  virtual casacore::String titleText() const {
107  return itsParamTitleText->value();
108  }
109 
110  // Get the X and Y axis text Strings for labelling.
111  // a WC can be supplied in order to retrieve default titles
112  // from the WC CS.
113  // <group>
114  virtual casacore::String xAxisText(const WorldCanvas* wc=0) const;
115  virtual casacore::String yAxisText(const WorldCanvas* wc=0) const;
116  // </group>
117 
118  // Get what type of grid should be marked in each direction.
119  // <group>
120  virtual casacore::String xGridType() const {
121  return itsParamXGridType->value();
122  }
123  virtual casacore::String yGridType() const {
124  return itsParamYGridType->value();
125  }
126  // </group>
127 
128  // Get the color to use for the title text, the X axis text, and the
129  // Y axis text labels.
130  // <group>
132  return itsParamTitleColor->value();
133  }
134  virtual casacore::String xAxisColor() const {
135  return itsParamXAxisColor->value();
136  }
137  virtual casacore::String yAxisColor() const {
138  return itsParamYAxisColor->value();
139  }
140  // </group>
141 
142  // Get the line width for labelling.
143  virtual casacore::Float lineWidth() const {
144  return itsParamLineWidth->value();
145  }
146 
147  // Get the character font for labelling.
148  virtual casacore::String charFont() const {
149  return itsParamCharacterFont->value();
150  }
151 
152  // Get the character size for labelling.
153  virtual casacore::Float charSize() const {
154  return itsParamCharacterSize->value();
155  }
156 
157  // Get the color of the plot outline.
158  virtual casacore::String outlineColor() const {
159  return itsParamOutlineColor->value();
160  }
161  static const float AXIS_LABEL_DEFAULT_CHAR_SIZE;
162  protected:
163 
164  // (Required) copy constructor.
165  AxesDisplayData(const AxesDisplayData &other);
166 
167  // (Required) copy assignment.
168  void operator=(const AxesDisplayData &other);
169 
170  private:
171 
172  // display title text
174 
175  // Store for X axis label text String.
177 
178  // Store for Y axis label text String.
180 
181  // coordinate grid?
182  DParameterChoice *itsParamXGridType, *itsParamYGridType;
183 
184  // title color
186  //casacore::String itsOptionsTitleTextColor;
187 
188  // label text color
190  //casacore::String itsOptionsXAxisColor, itsOptionsYAxisColor;
191 
192  // plot line width
194 
195  // plot character font
197 
198  // plot character size
200 
201  // plot outline color
203 
204 
205  };
206 
207 
208 } //# NAMESPACE CASA - END
209 
210 #endif
211 
Implementation of DParameterChoice to store color selection parameters.
Assistance class for auto-caching of DisplayData objects.
std::vector< double > Vector
Definition: ds9context.h:24
virtual casacore::String titleText() const
Get the title text for labelling.
virtual casacore::String xAxisColor() const
DParameterColorChoice * itsParamOutlineColor
plot outline color
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Definition: DisplayEnums.h:355
Buffer for storing Attributes.
PtrHolder< T > & operator=(const PtrHolder< T > &other)
DParameterChoice * itsParamYGridType
DParameterString * itsParamTitleText
display title text
virtual Display::DisplayDataType classType()
Return the type of this DisplayData.
virtual casacore::String outlineColor() const
Get the color of the plot outline.
DParameterRange< casacore::Float > * itsParamCharacterSize
plot character size
DParameterColorChoice * itsParamYAxisColor
DParameterString * itsParamXAxisText
Store for X axis label text String.
DParameterString * itsParamYAxisText
Store for Y axis label text String.
virtual casacore::Float lineWidth() const
Get the line width for labelling.
DParameterRange< casacore::Float > * itsParamLineWidth
casacore::String itsOptionsXAxisColor, itsOptionsYAxisColor;
Interface and simple implementation of axis labelling.
virtual casacore::String xGridType() const
Get what type of grid should be marked in each direction.
DParameterChoice * itsParamCharacterFont
plot character font
Base class for auto-caching DisplayData objects.
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
Implementation of DisplayParameter to store casacore::String parameters.
static const float AXIS_LABEL_DEFAULT_CHAR_SIZE
float Float
Definition: aipstype.h:54
Class providing passive behaviour for CachingDisplayDatas.
Implementation of DisplayParameter to store choice parameters.
DParameterColorChoice * itsParamTitleColor
title color
virtual casacore::String yGridType() const
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
void setOptions(const QWidget *widget)
Implements RegionFileWriter::setOptions.
virtual casacore::String charFont() const
Get the character font for labelling.
virtual casacore::Float charSize() const
Get the character size for labelling.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual casacore::String yAxisColor() const
virtual casacore::String titleTextColor() const
Get the color to use for the title text, the X axis text, and the Y axis text labels.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42