WCAxisLabeller.h

Go to the documentation of this file.
00001 //# WCAxisLabeller.h: base class for labelling axes on the WorldCanvas
00002 //# Copyright (C) 1999,2000,2001,2002
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TRIALDISPLAY_WCAXISLABELLER_H
00029 #define TRIALDISPLAY_WCAXISLABELLER_H
00030 
00031 //# aips includes:
00032 #include <casa/aips.h>
00033 #include <casa/Containers/Record.h>
00034 
00035 //# trial includes:
00036 
00037 //# display library includes:
00038 #include <display/Utilities/DisplayOptions.h>
00039 #include <display/DisplayEvents/WCRefreshEvent.h>
00040 
00041 namespace casa { //# NAMESPACE CASA - BEGIN
00042 
00043 //# forwards:
00044 
00045 // <summary>
00046 // Abstract class for drawing grids, axes, ticks and tick labels
00047 // on a WorldCanvas
00048 // </summary>
00049 //
00050 // <use visibility=local>
00051 //
00052 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00053 // </reviewed>
00054 //
00055 // <prerequisite>
00056 //   <li> WorldCanvas
00057 // </prerequisite>
00058 //
00059 // <etymology>
00060 // WCAxisLabeller stands for WorldCanvas Axis Labeller
00061 // </etymology>
00062 //
00063 // <synopsis>
00064 // This class forms the base for classes which draw axis grids,
00065 // axes, ticks and tick labels on WorldCanvases.  In its
00066 // present form, it is really a heavily pruned form of the
00067 // DisplayData.
00068 // </synopsis>
00069 //
00070 // <example>
00071 // </example>
00072 //
00073 // <motivation>
00074 // Axis labels are a necessary annotation for meaningful displays
00075 // of data.  This class is motivated by the desire to provide
00076 // (eventually) many different types of axis labelling.
00077 // </motivation>
00078 //
00079 // <todo asof="1999/02/16">
00080 //   <li> add to interface: getOptions, setOptions
00081 //   <li> perhaps convert to a DisplayData?
00082 // </todo>
00083 
00084         class WCAxisLabeller : public DisplayOptions {
00085 
00086         public:
00087 
00088                 // Constructor
00089                 WCAxisLabeller();
00090 
00091                 // Destructor
00092                 virtual ~WCAxisLabeller();
00093 
00094                 // Draw axis labels for the provided WorldCanvas refresh event
00095                 virtual Bool draw(const WCRefreshEvent &ev) = 0;
00096 
00097                 // Invalidate any cached drawings
00098                 virtual void invalidate() { };
00099 
00100                 // install the default options for this DisplayData
00101                 virtual void setDefaultOptions();
00102 
00103                 // apply options stored in rec to the DisplayData; return value
00104                 // True means a refresh is needed.  Any fields added to the
00105                 // updatedOptions argument are options which have changed in
00106                 // some way due to the setting of other options - ie. they
00107                 // are context sensitive.
00108                 virtual Bool setOptions(const Record &rec, Record &updatedOptions);
00109 
00110                 // retrieve the current and default options and parameter types.
00111                 virtual Record getOptions() const;
00112 
00113                 // set/return whether labelling is on or off.  This is a global
00114                 // switch.  If True is returned from the set function, then a
00115                 // refresh is required.
00116                 // <group>
00117                 virtual Bool setAxisLabelSwitch(const Bool labelswitch = False);
00118                 virtual Bool axisLabelSwitch() const {
00119                         return itsOptionsAxisLabelSwitch;
00120                 }
00121                 // </group>
00122 
00123                 // set/return the title text.  If True is returned from the set
00124                 // function then a refresh is required.
00125                 // <group>
00126                 //virtual Bool setTitleText(const String text = String(""));
00127                 virtual void setSubstituteTitleText( const String substituteImageName);
00128                 virtual String titleText() const {
00129                         return itsOptionsTitleText;
00130                 }
00131                 virtual String displayedTitleText() const {
00132                         String actualText = substituteTitleText;
00133                         if ( actualText.length() == 0 ){
00134                                 actualText = itsOptionsTitleText;
00135                         }
00136                         return actualText;
00137                 }
00138                 // </group>
00139 
00140                 // set/return the color of the title text.  If True is returned from
00141                 // the set function, then a refresh should be called.
00142                 // <group>
00143                 virtual Bool setTitleTextColor(const String color = String("foreground"));
00144                 virtual String titleTextColor() const {
00145                         return itsOptionsTitleTextColor;
00146                 }
00147                 // </group>
00148 
00149                 // set/return the X and Y label text.  If True is returned from
00150                 // the set functions, then a refresh is needed.
00151                 // <group>
00152                 virtual Bool setXAxisText(const String text = String(""));
00153                 virtual Bool setYAxisText(const String text = String(""));
00154                 virtual Bool unsetXAxisText();
00155                 virtual Bool unsetYAxisText();
00156                 virtual String xAxisText() const;
00157                 virtual String yAxisText() const;
00158                 virtual Bool isXAxisTextUnset() const {
00159                         return itsOptionsXAxisTextUnset;
00160                 }
00161                 virtual Bool isYAxisTextUnset() const {
00162                         return itsOptionsYAxisTextUnset;
00163                 }
00164                 // </group>
00165 
00166                 // set/return the color of the label text.  If True is returned
00167                 // from the set function, then a refresh is needed.
00168                 // <group>
00169                 virtual Bool setXAxisTextColor(const String color = String("foreground"));
00170                 virtual Bool setYAxisTextColor(const String color = String("foreground"));
00171                 virtual String xAxisTextColor() const {
00172                         return itsOptionsXAxisTextColor;
00173                 }
00174                 virtual String yAxisTextColor() const {
00175                         return itsOptionsYAxisTextColor;
00176                 }
00177                 // </group>
00178 
00179                 // set/return what type of grid is marked in each direction.
00180                 // If True is returned from the set functions, a refresh is needed.
00181                 // <group>
00182                 virtual Bool setXGridType(const String type = String("None"));
00183                 virtual Bool setYGridType(const String type = String("None"));
00184                 virtual String xGridType() const {
00185                         return itsOptionsXGridType;
00186                 }
00187                 virtual String yGridType() const {
00188                         return itsOptionsYGridType;
00189                 }
00190                 // </group>
00191 
00192                 // set/return the color of the grid lines per direction.  If True
00193                 // is returned from the set functions, a refresh is needed.
00194                 // <group>
00195                 virtual Bool setXGridColor(const String color = String("foreground"));
00196                 virtual Bool setYGridColor(const String color = String("foreground"));
00197                 virtual String xGridColor() const {
00198                         return itsOptionsXGridColor;
00199                 }
00200                 virtual String yGridColor() const {
00201                         return itsOptionsYGridColor;
00202                 }
00203                 // </group>
00204 
00205                 // set/return the tick length in millimetres.  If True is returned
00206                 // from the set function, then a refresh is probably needed.
00207                 // <group>
00208                 virtual Bool setTickLength(const Float length = 4.0);
00209                 virtual Float tickLength() const {
00210                         return itsOptionsTickLength;
00211                 }
00212                 // </group>
00213 
00214                 // set/return the position of World label strings
00215                 // <group>
00216                 virtual Bool setLabelPosition(const String position = String("Auto"));
00217                 virtual String labelPosition() const {
00218                         return itsOptionsLabelPos;
00219                 }
00220                 // </group>
00221 
00222 
00223                 // set/return whether there is a plot outline or not.  If True is
00224                 // returned from the set function, then a refresh is probably needed.
00225                 // <group>
00226                 virtual Bool setPlotOutline(const Bool outline = True);
00227                 virtual Bool plotOutline() const {
00228                         return itsOptionsPlotOutline;
00229                 }
00230                 // </group>
00231 
00232                 // set/return the color used for the plot outline.  If True is
00233                 // returned from the set function, then a refresh should be
00234                 // enacted.
00235                 // <group>
00236                 virtual Bool setPlotOutlineColor(const String color = String("foreground"));
00237                 virtual String plotOutlineColor() const {
00238                         return itsOptionsPlotOutlineColor;
00239                 }
00240                 // </group>
00241 
00242                 // set/return the char size for the plot graphics
00243                 // <group>
00244                 virtual Bool setCharSize(const Float size = 1.2);
00245                 virtual Float charSize() const {
00246                         return itsOptionsCharSize;
00247                 }
00248                 // </group>
00249 
00250                 // set/return the char font for the plot graphics
00251                 // <group>
00252                 virtual Bool setCharFont(const String font = "normal");
00253                 virtual String charFont() const {
00254                         return itsOptionsCharFont;
00255                 }
00256                 // </group>
00257 
00258                 // set/return the line width for the plot graphics.
00259                 // <group>
00260                 /*
00261                 virtual Bool setLineWidth(const Int width = 0);
00262                 virtual Int lineWidth() const
00263                   { return itsOptionsLineWidth; }
00264                 */
00265                 virtual Bool setLineWidth(const Float width = 0.0);
00266                 virtual Float lineWidth() const {
00267                         return itsOptionsLineWidth;
00268                 }
00269                 // </group>
00270 
00271                 static const String LABEL_CHAR_SIZE;
00272                 static const String PLOT_TITLE;
00273 
00274         protected:
00275                 Bool titleChanged;
00276 
00277         private:
00278 
00279                 // global switch on or off
00280                 Bool itsOptionsAxisLabelSwitch;
00281 
00282                 // display title text
00283                 String itsOptionsTitleText;
00284 
00285                 // title color
00286                 String itsOptionsTitleTextColor;
00287 
00288                 // display axes label text
00289                 String itsOptionsXAxisText, itsOptionsYAxisText;
00290 
00291                 // are the above unset
00292                 Bool itsOptionsXAxisTextUnset, itsOptionsYAxisTextUnset;
00293 
00294                 // label text color
00295                 String itsOptionsXAxisTextColor, itsOptionsYAxisTextColor;
00296 
00297                 // coordinate grid?
00298                 String itsOptionsXGridType, itsOptionsYGridType;
00299 
00300                 // coordinate grid colors
00301                 String itsOptionsXGridColor, itsOptionsYGridColor;
00302 
00303                 // tick mark length in mm
00304                 Float itsOptionsTickLength;
00305 
00306                 // Label position
00307                 String itsOptionsLabelPos;
00308 
00309                 // plot outline?
00310                 Bool itsOptionsPlotOutline;
00311 
00312                 // plot outline color
00313                 String itsOptionsPlotOutlineColor;
00314 
00315                 // plot character size
00316                 Float itsOptionsCharSize;
00317 
00318                 // plot character font
00319                 String itsOptionsCharFont;
00320 
00321                 // plot line width
00322                 //Int itsOptionsLineWidth;
00323                 Float itsOptionsLineWidth;
00324 
00325                 // defaults for on/off switch and character size
00326                 // (from .aipsrc, if they exist there).
00327                 Bool itsDefaultSwitch;
00328                 Float itsDefaultCharSize;
00329                 String substituteTitleText;
00330 
00331         };
00332 
00333 
00334 } //# NAMESPACE CASA - END
00335 
00336 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1