casa
$Rev:20696$
|
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(); 00074 00075 // Return the type of this DisplayData. 00076 virtual Display::DisplayDataType classType() 00077 { return Display::CanvasAnnotation; } 00078 // Pure virtual function from DisplayData... 00079 String dataType() const { return "sky cat"; } 00080 00081 00082 // Create a new AxesDisplayMethod for drawing on the given 00083 // WorldCanvas when the AttributeBuffers are suitably matched to the 00084 // current state of this DisplayData and of the WorldCanvas/Holder. 00085 // The tag is a unique number used to identify the age of the newly 00086 // constructed CachingDisplayMethod. 00087 virtual CachingDisplayMethod* newDisplayMethod(WorldCanvas* worldCanvas, 00088 AttributeBuffer* wchAttributes, 00089 AttributeBuffer* ddAttributes, 00090 CachingDisplayData* dd); 00091 00092 // Return the current options of this DisplayData as an 00093 // AttributeBuffer. 00094 virtual AttributeBuffer optionsAsAttributes(); 00095 00096 00097 // Get the column name for text labelling. 00098 virtual String nameColumn() const 00099 { return itsParamNameColumn->value(); } 00100 00101 // Get the line width for labelling. 00102 virtual Float lineWidth() const 00103 { return itsParamLineWidth->value(); } 00104 00105 // Get the marker type, size and color. 00106 // <group> 00107 virtual Display::Marker markerType() const 00108 { return static_cast<Display::Marker>(itsParamMarkerType->keyValue()); } 00109 virtual Int markerSize() const 00110 { return itsParamMarkerSize->value(); } 00111 virtual String markerColor() const 00112 { return itsParamMarkerColor->value(); } 00113 // </group> 00114 // Get the column name for value-size mapping. 00115 virtual String mapColumn() const 00116 { return itsParamMapColumn->value(); } 00117 00118 00119 // Get the character font, size, color and angle for labelling. 00120 // <group> 00121 virtual String charFont() const 00122 { return itsParamCharacterFont->value(); } 00123 virtual Float charSize() const 00124 { return itsParamCharacterSize->value(); } 00125 virtual String charColor() const 00126 { return itsParamCharacterColor->value(); } 00127 virtual Int charAngle() const 00128 { return itsParamCharacterAngle->value(); } 00129 // </group> 00130 00131 // Get the label x and y offsets (in character height). 00132 // <group> 00133 virtual Float labelXOffset() const 00134 { return itsParamLabelXOffset->value(); } 00135 virtual Float labelYOffset() const 00136 { return itsParamLabelYOffset->value(); } 00137 // </group> 00138 00139 // Determine ability to draw, given current canvas coordinate state. 00140 // This DD requires direction coordinates in both X and Y axis codes. 00141 virtual Bool conformsToCS(const WorldCanvas& wch); 00142 00143 protected: 00144 00145 // (Required) default constructor. 00146 SkyCatOverlayDD(); 00147 00148 // (Required) copy constructor. 00149 SkyCatOverlayDD(const SkyCatOverlayDD &other); 00150 00151 // (Required) copy assignment. 00152 void operator=(const SkyCatOverlayDD &other); 00153 00154 // Attempt to determine which columns map to longitude, latitude, 00155 // and type. 00156 virtual Bool determineDirectionColumnMapping(); 00157 00158 // Return the unit of a given column in the table. This is 00159 // extracted from the first column keyword matching the pattern 00160 // <src>^[uU][nN][iI][tT]$</src>. If no unit keyword is available, 00161 // the returned unit is a null unit. 00162 Unit columnUnit(const String columnName) const; 00163 00164 private: 00165 00166 // Store the column names here. 00167 Vector<String> itsColumnNames; 00168 00169 // Option: what type of coordinates are provided? 00170 //String itsCoordinateType; 00171 00172 // Which column is mapped to the longitude coordinate, and what is 00173 // its unit? 00174 String itsLongitudeColumn; 00175 Unit itsLongitudeUnit; 00176 00177 // Which column is mapped to the latitude coordinate, and what is 00178 // its unit? 00179 String itsLatitudeColumn; 00180 Unit itsLatitudeUnit; 00181 00182 // Which column is mapped to epoch 00183 String itsDirectionTypeColumn; 00184 00185 // Option: which column is mapped to the name? 00186 DParameterChoice* itsParamNameColumn; 00187 00188 // plot line width 00189 DParameterRange<Int>* itsParamLineWidth; 00190 00191 // Marker type, size and color. 00192 DParameterMapKeyChoice* itsParamMarkerType; 00193 DParameterRange<Int>* itsParamMarkerSize; 00194 DParameterColorChoice* itsParamMarkerColor; 00195 DParameterChoice* itsParamMapColumn; 00196 00197 00198 // Labelling character font, size, color and angle. 00199 DParameterChoice* itsParamCharacterFont; 00200 DParameterRange<Float>* itsParamCharacterSize; 00201 DParameterColorChoice* itsParamCharacterColor; 00202 DParameterRange<Int>* itsParamCharacterAngle; 00203 00204 // Labelling character offsets in character height units. 00205 DParameterRange<Float>* itsParamLabelXOffset; 00206 DParameterRange<Float>* itsParamLabelYOffset; 00207 00208 // Allow the DisplayMethod to access the private data. 00209 friend class SkyCatOverlayDM; 00210 00211 // Construct and destruct the parameter set. 00212 // <group> 00213 void constructParameters(); 00214 void destructParameters(); 00215 // </group> 00216 00217 }; 00218 00219 00220 } //# NAMESPACE CASA - END 00221 00222 #endif