casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QtMWCTools.qo.h
Go to the documentation of this file.
00001 //# Copyright (C) 2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 
00026 
00027 #ifndef QTMWCTOOLS_H
00028 #define QTMWCTOOLS_H
00029 
00030 #include <casa/aips.h>
00031 
00032 #include <display/Display/PanelDisplay.h>
00033 #include <display/QtViewer/QtMouseTools.qo.h>
00034 #include <display/region/RegionSourceFactory.h>
00035 
00036 #include <graphics/X11/X_enter.h>
00037 #include <QObject>
00038 #include <QtGui>
00039 #include <graphics/X11/X_exit.h>
00040 
00041 namespace casa {
00042 
00043 enum ProfileType
00044 {
00045         UNKNPROF,
00046         SINGPROF,
00047         RECTPROF,
00048         ELLPROF,
00049         POLYPROF,
00050         POLYLINEPROF,
00051         PVPROF
00052 };
00053 
00054 class QtMWCTool
00055 {
00056 
00057 public:
00058   QtMWCTool(): coordType("world") {}
00059   virtual ~QtMWCTool() {}
00060 protected:
00061   String coordType;
00062 
00063 public:
00064   virtual void setCoordType(const String& t) {
00065              if (t == "world") coordType = t;
00066              else coordType = "pixel";
00067       // cout << "Object=" << objectName().toStdString()
00068       //      << " setCoordType: coordType=" << coordType 
00069       //      << " t=" << t << endl;
00070   }
00071   //String getCoordType() {return coordType;} 
00072 
00073 };
00074 
00075 class QtPolyTool: public QtPTRegion,  public QtMWCTool
00076 {
00077   Q_OBJECT
00078 
00079 public: 
00080   QtPolyTool(viewer::RegionSourceFactory *rf, PanelDisplay* pd);
00081   virtual ~QtPolyTool() {}
00082  
00083 public slots:
00084   void setCoordType(const String& t);
00085 
00086 signals:
00087   void wcNotify( const String c, 
00088                  const Vector<Double> px, const Vector<Double> py,
00089                  const Vector<Double> wx, const Vector<Double> wy,
00090                  const ProfileType ptype);
00091 
00092 protected:
00093   virtual void updateRegion();
00094 
00095 };
00096 
00097 class QtPolylineTool: public QtPolylineToolRegion,  public QtMWCTool
00098 {
00099   Q_OBJECT
00100 
00101 public:
00102   QtPolylineTool(viewer::RegionSourceFactory *rf, PanelDisplay* pd);
00103   virtual ~QtPolylineTool() {}
00104 
00105 public slots:
00106   void setCoordType(const String& t);
00107 
00108 signals:
00109   void wcNotify( const String c,
00110                  const Vector<Double> px, const Vector<Double> py,
00111                  const Vector<Double> wx, const Vector<Double> wy,
00112                  const ProfileType ptype);
00113 
00114 protected:
00115   virtual void updateRegion();
00116 
00117 };
00118 
00119 class QtEllipseTool: public QtELRegion,  public QtMWCTool
00120 {
00121   Q_OBJECT
00122 
00123 public:
00124   QtEllipseTool(viewer::RegionSourceFactory *rf, PanelDisplay *pd);
00125   virtual ~QtEllipseTool() {}
00126 
00127 public slots:
00128   void setCoordType(const String& t);
00129 
00130 signals:
00131   void wcNotify( const String c,
00132                  const Vector<Double> px, const Vector<Double> py,
00133                  const Vector<Double> wx, const Vector<Double> wy,
00134                  const ProfileType ptype);
00135 
00136 protected:
00137   virtual void updateRegion();
00138 };
00139 
00140 
00141 class QtRectTool: public QtRTRegion,  public QtMWCTool
00142 {
00143   Q_OBJECT
00144 
00145 public: 
00146   QtRectTool(viewer::RegionSourceFactory *rf, PanelDisplay* pd);
00147   virtual ~QtRectTool() {}
00148 
00149 public slots:
00150   void setCoordType(const String& t);
00151 
00152 signals:
00153   void wcNotify( const String c, 
00154                  const Vector<Double> px, const Vector<Double> py,
00155                  const Vector<Double> wx, const Vector<Double> wy,
00156                  const ProfileType ptype);
00157 
00158 protected:
00159   virtual void updateRegion();
00160 };
00161 
00162 class QtCrossTool: public QtPointRegion, public QtMWCTool
00163 {
00164   Q_OBJECT
00165 
00166 public: 
00167   QtCrossTool(viewer::RegionSourceFactory *rf, PanelDisplay* pd);
00168   virtual ~QtCrossTool() {}
00169   /* virtual void crosshairReady(const String& evtype); */
00170 
00171 public slots:
00172   void setCoordType(const String& t);
00173 
00174 signals:
00175   void wcNotify( const String c, 
00176                  const Vector<Double> px, const Vector<Double> py,
00177                  const Vector<Double> wx, const Vector<Double> wy,
00178                  const ProfileType ptype);
00179 
00180 protected:
00181   virtual void updateRegion();
00182 };
00183 
00184 class QtPVTool: public QtPVToolRegion,  public QtMWCTool
00185 {
00186   Q_OBJECT
00187 
00188 public: 
00189   QtPVTool(viewer::RegionSourceFactory *rf, PanelDisplay* pd);
00190   virtual ~QtPVTool() {}
00191  
00192 public slots:
00193   void setCoordType(const String& t);
00194 
00195 signals:
00196   void wcNotify( const String c, 
00197                  const Vector<Double> px, const Vector<Double> py,
00198                  const Vector<Double> wx, const Vector<Double> wy,
00199                  const ProfileType ptype);
00200 
00201 protected:
00202   virtual void updateRegion();
00203 
00204 };
00205 
00206 }
00207 
00208 #endif
00209