SkyCatOverlayDD.h

Go to the documentation of this file.
00001 //# SkyCatOverlay.h: sky catalogue overlay displaydata
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_SKYCATOVERLAYDD_H
00029 #define TRIALDISPLAY_SKYCATOVERLAYDD_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/Arrays/Vector.h>
00033 #include <display/Display/DParameterRange.h>
00034 #include <display/Display/DParameterChoice.h>
00035 #include <display/Display/DParameterColorChoice.h>
00036 #include <display/Display/DParameterString.h>
00037 #include <display/Display/DParameterMapKeyChoice.h>
00038 #include <display/DisplayDatas/PassiveTableDD.h>
00039 
00040 namespace casa { //# NAMESPACE CASA - BEGIN
00041 
00042         class Table;
00043         class SkyCatOverlayDM;
00044 
00045 // <summary>
00046 // Simple implementation of a cached DisplayData for sky catalogue overlays.
00047 // </summary>
00048 
00049         class SkyCatOverlayDD : public PassiveTableDD {
00050 
00051         public:
00052 
00053                 // Constructor taking a pointer to an already constructed Table.
00054                 SkyCatOverlayDD(Table* table);
00055 
00056                 // Constructor taking a String which describes the full pathname
00057                 // of a Table on disk.
00058                 SkyCatOverlayDD(const String tablename);
00059 
00060                 // Destructor.
00061                 virtual ~SkyCatOverlayDD();
00062 
00063                 // Install the default options for this DisplayData.
00064                 virtual void setDefaultOptions();
00065 
00066                 // Apply options stored in <src>rec</src> to the DisplayData.  A
00067                 // return value of <src>True</src> means a refresh is needed.
00068                 // <src>recOut</src> contains any fields which were implicitly
00069                 // changed as a result of the call to this function.
00070                 virtual Bool setOptions(Record &rec, Record &recOut);
00071 
00072                 // Retrieve the current and default options and parameter types.
00073                 virtual Record getOptions( bool scrub=false ) const;
00074 
00075                 // Return the type of this DisplayData.
00076                 virtual Display::DisplayDataType classType() {
00077                         return Display::CanvasAnnotation;
00078                 }
00079                 // Pure virtual function from DisplayData...
00080                 String dataType() const {
00081                         return "sky cat";
00082                 }
00083 
00084 
00085                 // Create a new AxesDisplayMethod for drawing on the given
00086                 // WorldCanvas when the AttributeBuffers are suitably matched to the
00087                 // current state of this DisplayData and of the WorldCanvas/Holder.
00088                 // The tag is a unique number used to identify the age of the newly
00089                 // constructed CachingDisplayMethod.
00090                 virtual CachingDisplayMethod* newDisplayMethod(WorldCanvas* worldCanvas,
00091                         AttributeBuffer* wchAttributes,
00092                         AttributeBuffer* ddAttributes,
00093                         CachingDisplayData* dd);
00094 
00095                 // Return the current options of this DisplayData as an
00096                 // AttributeBuffer.
00097                 virtual AttributeBuffer optionsAsAttributes();
00098 
00099 
00100                 // Get the column name for text labelling.
00101                 virtual String nameColumn() const {
00102                         return itsParamNameColumn->value();
00103                 }
00104 
00105                 // Get the line width for labelling.
00106                 virtual Float lineWidth() const {
00107                         return itsParamLineWidth->value();
00108                 }
00109 
00110                 // Get the marker type, size and color.
00111                 // <group>
00112                 virtual Display::Marker markerType() const {
00113                         return static_cast<Display::Marker>(itsParamMarkerType->keyValue());
00114                 }
00115                 virtual Int markerSize() const {
00116                         return itsParamMarkerSize->value();
00117                 }
00118                 virtual String markerColor() const {
00119                         return itsParamMarkerColor->value();
00120                 }
00121                 // </group>
00122                 // Get the column name for value-size mapping.
00123                 virtual String mapColumn() const {
00124                         return itsParamMapColumn->value();
00125                 }
00126 
00127 
00128                 // Get the character font, size, color and angle for labelling.
00129                 // <group>
00130                 virtual String charFont() const {
00131                         return itsParamCharacterFont->value();
00132                 }
00133                 virtual Float charSize() const {
00134                         return itsParamCharacterSize->value();
00135                 }
00136                 virtual String charColor() const {
00137                         return itsParamCharacterColor->value();
00138                 }
00139                 virtual Int charAngle() const {
00140                         return itsParamCharacterAngle->value();
00141                 }
00142                 // </group>
00143 
00144                 // Get the label x and y offsets (in character height).
00145                 // <group>
00146                 virtual Float labelXOffset() const {
00147                         return itsParamLabelXOffset->value();
00148                 }
00149                 virtual Float labelYOffset() const {
00150                         return itsParamLabelYOffset->value();
00151                 }
00152                 // </group>
00153 
00154                 // Determine ability to draw, given current canvas coordinate state.
00155                 // This DD requires direction coordinates in both X and Y axis codes.
00156                 virtual Bool conformsToCS(const WorldCanvas& wch);
00157 
00158                 std::string errorMessage( ) const { return ""; }
00159 
00160         protected:
00161 
00162                 // (Required) default constructor.
00163                 SkyCatOverlayDD();
00164 
00165                 // (Required) copy constructor.
00166                 SkyCatOverlayDD(const SkyCatOverlayDD &other);
00167 
00168                 // (Required) copy assignment.
00169                 void operator=(const SkyCatOverlayDD &other);
00170 
00171                 // Attempt to determine which columns map to longitude, latitude,
00172                 // and type.
00173                 virtual Bool determineDirectionColumnMapping();
00174 
00175                 // Return the unit of a given column in the table.  This is
00176                 // extracted from the first column keyword matching the pattern
00177                 // <src>^[uU][nN][iI][tT]$</src>.  If no unit keyword is available,
00178                 // the returned unit is a null unit.
00179                 Unit columnUnit(const String columnName) const;
00180 
00181         private:
00182 
00183                 // Store the column names here.
00184                 Vector<String> itsColumnNames;
00185 
00186                 // Option: what type of coordinates are provided?
00187                 //String itsCoordinateType;
00188 
00189                 // Which column is mapped to the longitude coordinate, and what is
00190                 // its unit?
00191                 String itsLongitudeColumn;
00192                 Unit itsLongitudeUnit;
00193 
00194                 // Which column is mapped to the latitude coordinate, and what is
00195                 // its unit?
00196                 String itsLatitudeColumn;
00197                 Unit itsLatitudeUnit;
00198 
00199                 // Which column is mapped to epoch
00200                 String itsDirectionTypeColumn;
00201 
00202                 // Option: which column is mapped to the name?
00203                 DParameterChoice* itsParamNameColumn;
00204 
00205                 // plot line width
00206                 DParameterRange<Int>* itsParamLineWidth;
00207 
00208                 // Marker type, size and color.
00209                 DParameterMapKeyChoice* itsParamMarkerType;
00210                 DParameterRange<Int>* itsParamMarkerSize;
00211                 DParameterColorChoice* itsParamMarkerColor;
00212                 DParameterChoice* itsParamMapColumn;
00213 
00214 
00215                 // Labelling character font, size, color and angle.
00216                 DParameterChoice* itsParamCharacterFont;
00217                 DParameterRange<Float>* itsParamCharacterSize;
00218                 DParameterColorChoice* itsParamCharacterColor;
00219                 DParameterRange<Int>* itsParamCharacterAngle;
00220 
00221                 // Labelling character offsets in character height units.
00222                 DParameterRange<Float>* itsParamLabelXOffset;
00223                 DParameterRange<Float>* itsParamLabelYOffset;
00224 
00225                 // Allow the DisplayMethod to access the private data.
00226                 friend class SkyCatOverlayDM;
00227 
00228                 // Construct and destruct the parameter set.
00229                 // <group>
00230                 void constructParameters();
00231                 void destructParameters();
00232                 // </group>
00233 
00234         };
00235 
00236 
00237 } //# NAMESPACE CASA - END
00238 
00239 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1