casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WCAxisLabeller.h
Go to the documentation of this file.
1 //# WCAxisLabeller.h: base class for labelling axes on the WorldCanvas
2 //# Copyright (C) 1999,2000,2001,2002
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_WCAXISLABELLER_H
29 #define TRIALDISPLAY_WCAXISLABELLER_H
30 
31 //# aips includes:
32 #include <casa/aips.h>
33 #include <casa/Containers/Record.h>
34 
35 //# trial includes:
36 
37 //# display library includes:
40 
41 namespace casa { //# NAMESPACE CASA - BEGIN
42 
43 //# forwards:
44 
45 // <summary>
46 // Abstract class for drawing grids, axes, ticks and tick labels
47 // on a WorldCanvas
48 // </summary>
49 //
50 // <use visibility=local>
51 //
52 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
53 // </reviewed>
54 //
55 // <prerequisite>
56 // <li> WorldCanvas
57 // </prerequisite>
58 //
59 // <etymology>
60 // WCAxisLabeller stands for WorldCanvas Axis Labeller
61 // </etymology>
62 //
63 // <synopsis>
64 // This class forms the base for classes which draw axis grids,
65 // axes, ticks and tick labels on WorldCanvases. In its
66 // present form, it is really a heavily pruned form of the
67 // DisplayData.
68 // </synopsis>
69 //
70 // <example>
71 // </example>
72 //
73 // <motivation>
74 // Axis labels are a necessary annotation for meaningful displays
75 // of data. This class is motivated by the desire to provide
76 // (eventually) many different types of axis labelling.
77 // </motivation>
78 //
79 // <todo asof="1999/02/16">
80 // <li> add to interface: getOptions, setOptions
81 // <li> perhaps convert to a DisplayData?
82 // </todo>
83 
84  class WCAxisLabeller : public DisplayOptions {
85 
86  public:
87 
88  // Constructor
90 
91  // Destructor
92  virtual ~WCAxisLabeller();
93 
94  // Draw axis labels for the provided WorldCanvas refresh event
95  virtual casacore::Bool draw(const WCRefreshEvent &ev) = 0;
96 
97  // Invalidate any cached drawings
98  virtual void invalidate() { };
99 
100  // install the default options for this DisplayData
101  virtual void setDefaultOptions();
102 
103  // apply options stored in rec to the DisplayData; return value
104  // true means a refresh is needed. Any fields added to the
105  // updatedOptions argument are options which have changed in
106  // some way due to the setting of other options - ie. they
107  // are context sensitive.
108  virtual casacore::Bool setOptions(const casacore::Record &rec, casacore::Record &updatedOptions);
109 
110  // retrieve the current and default options and parameter types.
111  virtual casacore::Record getOptions() const;
112 
113  // set/return whether labelling is on or off. This is a global
114  // switch. If true is returned from the set function, then a
115  // refresh is required.
116  // <group>
117  virtual casacore::Bool setAxisLabelSwitch(const casacore::Bool labelswitch = false);
118  virtual casacore::Bool axisLabelSwitch() const {
120  }
121  // </group>
122 
123  // set/return the title text. If true is returned from the set
124  // function then a refresh is required.
125  // <group>
126  //virtual casacore::Bool setTitleText(const casacore::String text = casacore::String(""));
127  virtual void setSubstituteTitleText( const casacore::String substituteImageName);
128  virtual casacore::String titleText() const {
129  return itsOptionsTitleText;
130  }
133  if ( actualText.length() == 0 ){
134  actualText = itsOptionsTitleText;
135  }
136  return actualText;
137  }
138  // </group>
139 
140  // set/return the color of the title text. If true is returned from
141  // the set function, then a refresh should be called.
142  // <group>
146  }
147  // </group>
148 
149  // set/return the X and Y label text. If true is returned from
150  // the set functions, then a refresh is needed.
151  // <group>
154  virtual casacore::Bool unsetXAxisText();
155  virtual casacore::Bool unsetYAxisText();
156  virtual casacore::String xAxisText() const;
157  virtual casacore::String yAxisText() const;
160  }
163  }
164  // </group>
165 
166  // set/return the color of the label text. If true is returned
167  // from the set function, then a refresh is needed.
168  // <group>
173  }
176  }
177  // </group>
178 
179  // set/return what type of grid is marked in each direction.
180  // If true is returned from the set functions, a refresh is needed.
181  // <group>
184  virtual casacore::String xGridType() const {
185  return itsOptionsXGridType;
186  }
187  virtual casacore::String yGridType() const {
188  return itsOptionsYGridType;
189  }
190  // </group>
191 
192  // set/return the color of the grid lines per direction. If true
193  // is returned from the set functions, a refresh is needed.
194  // <group>
195  virtual casacore::Bool setXGridColor(const casacore::String color = casacore::String("foreground"));
196  virtual casacore::Bool setYGridColor(const casacore::String color = casacore::String("foreground"));
197  virtual casacore::String xGridColor() const {
198  return itsOptionsXGridColor;
199  }
200  virtual casacore::String yGridColor() const {
201  return itsOptionsYGridColor;
202  }
203  // </group>
204 
205  // set/return the tick length in millimetres. If true is returned
206  // from the set function, then a refresh is probably needed.
207  // <group>
208  virtual casacore::Bool setTickLength(const casacore::Float length = 4.0);
209  virtual casacore::Float tickLength() const {
210  return itsOptionsTickLength;
211  }
212  // </group>
213 
214  // set/return the position of World label strings
215  // <group>
216  virtual casacore::Bool setLabelPosition(const casacore::String position = casacore::String("Auto"));
217  virtual casacore::String labelPosition() const {
218  return itsOptionsLabelPos;
219  }
220  // </group>
221 
222 
223  // set/return whether there is a plot outline or not. If true is
224  // returned from the set function, then a refresh is probably needed.
225  // <group>
226  virtual casacore::Bool setPlotOutline(const casacore::Bool outline = true);
227  virtual casacore::Bool plotOutline() const {
228  return itsOptionsPlotOutline;
229  }
230  // </group>
231 
232  // set/return the color used for the plot outline. If true is
233  // returned from the set function, then a refresh should be
234  // enacted.
235  // <group>
239  }
240  // </group>
241 
242  // set/return the char size for the plot graphics
243  // <group>
244  virtual casacore::Bool setCharSize(const casacore::Float size = 1.2);
245  virtual casacore::Float charSize() const {
246  return itsOptionsCharSize;
247  }
248  // </group>
249 
250  // set/return the char font for the plot graphics
251  // <group>
252  virtual casacore::Bool setCharFont(const casacore::String font = "normal");
253  virtual casacore::String charFont() const {
254  return itsOptionsCharFont;
255  }
256  // </group>
257 
258  // set/return the line width for the plot graphics.
259  // <group>
260  /*
261  virtual casacore::Bool setLineWidth(const casacore::Int width = 0);
262  virtual casacore::Int lineWidth() const
263  { return itsOptionsLineWidth; }
264  */
265  virtual casacore::Bool setLineWidth(const casacore::Float width = 0.0);
266  virtual casacore::Float lineWidth() const {
267  return itsOptionsLineWidth;
268  }
269  // </group>
270 
273 
274  protected:
276 
277  private:
278 
279  // global switch on or off
281 
282  // display title text
284 
285  // title color
287 
288  // display axes label text
290 
291  // are the above unset
293 
294  // label text color
296 
297  // coordinate grid?
299 
300  // coordinate grid colors
302 
303  // tick mark length in mm
305 
306  // Label position
308 
309  // plot outline?
311 
312  // plot outline color
314 
315  // plot character size
317 
318  // plot character font
320 
321  // plot line width
322  //casacore::Int itsOptionsLineWidth;
324 
325  // defaults for on/off switch and character size
326  // (from .aipsrc, if they exist there).
330 
331  };
332 
333 
334 } //# NAMESPACE CASA - END
335 
336 #endif
virtual casacore::String xGridColor() const
casacore::Float itsOptionsLineWidth
plot line width casacore::Int itsOptionsLineWidth;
virtual casacore::String titleText() const
virtual void setDefaultOptions()
install the default options for this DisplayData
virtual casacore::Bool draw(const WCRefreshEvent &ev)=0
Draw axis labels for the provided WorldCanvas refresh event.
virtual casacore::Bool setYAxisTextColor(const casacore::String color=casacore::String("foreground"))
virtual casacore::Bool setTickLength(const casacore::Float length=4.0)
set/return the tick length in millimetres.
casacore::String itsOptionsCharFont
plot character font
Class to provide option parsing routines for display classes.
Class which stores WorldCanvas refresh event information.
casacore::Float itsDefaultCharSize
virtual casacore::String titleTextColor() const
virtual casacore::Bool setYGridColor(const casacore::String color=casacore::String("foreground"))
virtual casacore::Bool setXAxisTextColor(const casacore::String color=casacore::String("foreground"))
set/return the color of the label text.
virtual Type type()
Return the type enum.
casacore::String itsOptionsYAxisText
virtual casacore::String xGridType() const
virtual casacore::Bool plotOutline() const
virtual casacore::String plotOutlineColor() const
virtual casacore::Bool setYAxisText(const casacore::String text=casacore::String(""))
virtual casacore::String yAxisText() const
casacore::String itsOptionsXGridType
coordinate grid?
virtual void invalidate()
Invalidate any cached drawings.
Abstract class for drawing grids, axes, ticks and tick labels on a WorldCanvas.
casacore::Bool titleChanged
virtual ~WCAxisLabeller()
Destructor.
size_t size() const
virtual casacore::Bool setYGridType(const casacore::String type=casacore::String("None"))
casacore::String itsOptionsYGridType
virtual void setSubstituteTitleText(const casacore::String substituteImageName)
set/return the title text.
casacore::Bool itsOptionsXAxisTextUnset
are the above unset
casacore::Bool itsDefaultSwitch
defaults for on/off switch and character size (from.aipsrc, if they exist there). ...
virtual casacore::Bool setXGridType(const casacore::String type=casacore::String("None"))
set/return what type of grid is marked in each direction.
virtual casacore::Bool isXAxisTextUnset() const
virtual casacore::Bool setCharSize(const casacore::Float size=1.2)
set/return the char size for the plot graphics
virtual casacore::String xAxisText() const
casacore::String itsOptionsLabelPos
Label position.
virtual casacore::String xAxisTextColor() const
virtual casacore::Bool setPlotOutlineColor(const casacore::String color=casacore::String("foreground"))
set/return the color used for the plot outline.
casacore::String itsOptionsTitleText
display title text
casacore::Bool itsOptionsYAxisTextUnset
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
virtual casacore::Bool axisLabelSwitch() const
size_type length() const
Definition: String.h:343
virtual casacore::Bool setTitleTextColor(const casacore::String color=casacore::String("foreground"))
set/return the color of the title text.
virtual casacore::String labelPosition() const
static const casacore::String PLOT_TITLE
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::Bool setCharFont(const casacore::String font="normal")
set/return the char font for the plot graphics
casacore::String itsOptionsXGridColor
coordinate grid colors
float Float
Definition: aipstype.h:54
virtual casacore::Float charSize() const
casacore::String substituteTitleText
casacore::String itsOptionsXAxisText
display axes label text
virtual casacore::String displayedTitleText() const
virtual casacore::Bool setXAxisText(const casacore::String text=casacore::String(""))
set/return the X and Y label text.
virtual casacore::String charFont() const
virtual casacore::String yAxisTextColor() const
virtual casacore::String yGridType() const
virtual casacore::Bool setXGridColor(const casacore::String color=casacore::String("foreground"))
set/return the color of the grid lines per direction.
casacore::Float itsOptionsCharSize
plot character size
casacore::String itsOptionsTitleTextColor
title color
virtual casacore::String yGridColor() const
virtual casacore::Record getOptions() const
retrieve the current and default options and parameter types.
casacore::String itsOptionsPlotOutlineColor
plot outline color
virtual casacore::Bool setPlotOutline(const casacore::Bool outline=true)
set/return whether there is a plot outline or not.
casacore::Bool itsOptionsPlotOutline
plot outline?
virtual casacore::Bool setAxisLabelSwitch(const casacore::Bool labelswitch=false)
set/return whether labelling is on or off.
virtual casacore::Bool setOptions(const casacore::Record &rec, casacore::Record &updatedOptions)
apply options stored in rec to the DisplayData; return value true means a refresh is needed...
casacore::Bool itsOptionsAxisLabelSwitch
global switch on or off
casacore::String itsOptionsYGridColor
virtual casacore::Bool setLineWidth(const casacore::Float width=0.0)
set/return the line width for the plot graphics.
static const casacore::String LABEL_CHAR_SIZE
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual casacore::Bool unsetYAxisText()
casacore::String itsOptionsYAxisTextColor
virtual casacore::Bool unsetXAxisText()
casacore::String itsOptionsXAxisTextColor
label text color
WCAxisLabeller()
Constructor.
virtual casacore::Float tickLength() const
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
casacore::Float itsOptionsTickLength
tick mark length in mm
virtual casacore::Float lineWidth() const
virtual casacore::Bool isYAxisTextUnset() const
virtual casacore::Bool setLabelPosition(const casacore::String position=casacore::String("Auto"))
set/return the position of World label strings