casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
AxesDisplayData.h
Go to the documentation of this file.
00001 //# AxesDisplayData.h: axis labelling for registering on WorldCanvasHolders
00002 //# Copyright (C) 1999,2000,2001,2002,2004
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_AXESDISPLAYDATA_H
00029 #define TRIALDISPLAY_AXESDISPLAYDATA_H
00030 
00031 #include <casa/aips.h>
00032 #include <display/Display/DParameterRange.h>
00033 #include <display/Display/DParameterString.h>
00034 #include <display/Display/DParameterChoice.h>
00035 #include <display/Display/DParameterColorChoice.h>
00036 #include <display/DisplayDatas/PassiveCachingDD.h>
00037 
00038 #include <iostream>
00039 using namespace std;
00040 
00041 namespace casa { //# NAMESPACE CASA - BEGIN
00042 
00043 class WorldCanvas;
00044 class WorldCanvasHolder;
00045 template <class T> class Vector;
00046 class String;
00047 class AttributeBuffer;
00048 
00049 // <summary>
00050 // Interface and simple implementation of axis labelling.
00051 // </summary>
00052 //
00053 // <synopsis> 
00054 // This class adds to the interface defined by CachingDisplayData to
00055 // provide the necessary infrastructure for drawing axis labels on
00056 // WorldCanvases.  This class serves as a basic implementation which
00057 // can (and probably should) be over-written in derived classes.
00058 // </synopsis>
00059 
00060 class AxesDisplayData : public PassiveCachingDD {
00061 
00062  public:
00063 
00064   // Constructor.
00065   AxesDisplayData();
00066 
00067   // Destructor.
00068   virtual ~AxesDisplayData();
00069 
00070   // Install the default options for this DisplayData.
00071   virtual void setDefaultOptions();
00072 
00073   // Apply options stored in <src>rec</src> to the DisplayData.  A
00074   // return value of <src>True</src> means a refresh is needed.
00075   // <src>recOut</src> contains any fields which were implicitly 
00076   // changed as a result of the call to this function.
00077   virtual Bool setOptions(Record &rec, Record &recOut);
00078 
00079   // Retrieve the current and default options and parameter types.
00080   virtual Record getOptions();
00081 
00082   // Return the type of this DisplayData.
00083   virtual Display::DisplayDataType classType()
00084     { return Display::CanvasAnnotation; }
00085 
00086   // Create a new AxesDisplayMethod for drawing on the given
00087   // WorldCanvas when the AttributeBuffers are suitably matched to the
00088   // current state of this DisplayData and of the WorldCanvas/Holder.
00089   // The tag is a unique number used to identify the age of the newly
00090   // constructed CachingDisplayMethod.
00091   virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas,
00092                                  AttributeBuffer *wchAttributes,
00093                                  AttributeBuffer *ddAttributes,
00094                                                  CachingDisplayData *dd);
00095  
00096   // Return the current options of this DisplayData as an
00097   // AttributeBuffer.
00098   virtual AttributeBuffer optionsAsAttributes();
00099   
00100   // Get the title text for labelling.
00101   virtual String titleText() const 
00102     { return itsParamTitleText->value(); }
00103 
00104   // Get the X and Y axis text Strings for labelling.
00105   // a WC can be supplied in order to retrieve default titles
00106   // from the WC CS.
00107   // <group>
00108   virtual String xAxisText(const WorldCanvas* wc=0) const;
00109   virtual String yAxisText(const WorldCanvas* wc=0) const;
00110   // </group>
00111 
00112   // Get what type of grid should be marked in each direction.
00113   // <group>
00114   virtual String xGridType() const
00115     { return itsParamXGridType->value(); }
00116   virtual String yGridType() const
00117     { return itsParamYGridType->value(); }
00118   // </group>
00119 
00120   // Get the color to use for the title text, the X axis text, and the
00121   // Y axis text labels.
00122   // <group>
00123   virtual String titleTextColor() const
00124     { return itsParamTitleColor->value(); }
00125   virtual String xAxisColor() const
00126     { return itsParamXAxisColor->value(); }
00127   virtual String yAxisColor() const
00128     { return itsParamYAxisColor->value(); }
00129   // </group>
00130 
00131   // Get the line width for labelling.
00132   virtual Float lineWidth() const
00133     { return itsParamLineWidth->value(); }
00134 
00135   // Get the character font for labelling.
00136   virtual String charFont() const
00137     { return itsParamCharacterFont->value(); }
00138 
00139   // Get the character size for labelling.
00140   virtual Float charSize() const
00141     { return itsParamCharacterSize->value(); }
00142 
00143   // Get the color of the plot outline.
00144   virtual String outlineColor() const
00145     { return itsParamOutlineColor->value(); }
00146   static const float AXIS_LABEL_DEFAULT_CHAR_SIZE;
00147  protected:
00148 
00149   // (Required) copy constructor.
00150   AxesDisplayData(const AxesDisplayData &other);
00151 
00152   // (Required) copy assignment.
00153   void operator=(const AxesDisplayData &other);
00154 
00155  private:
00156 
00157   // display title text
00158   DParameterString *itsParamTitleText;
00159 
00160   // Store for X axis label text String.
00161   DParameterString *itsParamXAxisText;
00162 
00163   // Store for Y axis label text String.
00164   DParameterString *itsParamYAxisText;
00165 
00166   // coordinate grid?
00167   DParameterChoice *itsParamXGridType, *itsParamYGridType;
00168 
00169   // title color
00170   DParameterColorChoice *itsParamTitleColor;
00171   //String itsOptionsTitleTextColor;
00172 
00173   // label text color
00174   DParameterColorChoice *itsParamXAxisColor, *itsParamYAxisColor;
00175   //String itsOptionsXAxisColor, itsOptionsYAxisColor;
00176 
00177   // plot line width
00178   DParameterRange<Float> *itsParamLineWidth;
00179 
00180   // plot character font
00181   DParameterChoice *itsParamCharacterFont;
00182 
00183   // plot character size
00184   DParameterRange<Float> *itsParamCharacterSize;
00185 
00186   // plot outline color
00187   DParameterColorChoice *itsParamOutlineColor;
00188 
00189 
00190 };
00191 
00192 
00193 } //# NAMESPACE CASA - END
00194 
00195 #endif
00196