QtWCBox.h

Go to the documentation of this file.
00001 //# QtWCBox.h: Class to define a box shaped WC region
00002 //# Copyright (C) 1998,1999,2001
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 //# $Id: QtWCBox.h 20567 2009-04-09 23:12:39Z gervandiepen $
00026 
00027 
00028 
00029 #ifndef QT_WCBOX_H
00030 #define QT_WCBOX_H
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <display/Display/DisplayCoordinateSystem.h>
00035 #include <images/Regions/WCRegion.h>
00036 #include <lattices/LRegions/RegionType.h>
00037 #include <casa/Arrays/Vector.h>
00038 #include <casa/Quanta/Quantum.h>
00039 
00040 namespace casa { //# NAMESPACE CASA - BEGIN
00041 
00042 //# Forward Declarations
00043         class LCRegion;
00044         class TableRecord;
00045         class IPosition;
00046 
00047 
00048         class QtWCBox : public WCRegion {
00049         public:
00050                 QtWCBox();
00051 
00052                 // Construct from vectors of world coordinates
00053                 // defining the box corners.  It is assumed that the
00054                 // order of the values is in the order of the pixel axes
00055                 // in the given coordinate system.
00056                 // <group>
00057                 QtWCBox(const Vector<Quantum<Double> >& blc,
00058                         const Vector<Quantum<Double> >& trc,
00059                         const DisplayCoordinateSystem& cSys,
00060                         const Vector<Int>& absRel);
00061                 // </group>
00062 
00063                 // Construct from vectors of world coordinates
00064                 // defining the box corners.   You specify the pixel
00065                 // axis order of the world values.
00066                 // <group>
00067                 QtWCBox(const Vector<Quantum<Double> >& blc,
00068                         const Vector<Quantum<Double> >& trc,
00069                         const IPosition& pixelAxes,
00070                         const DisplayCoordinateSystem& cSys,
00071                         const Vector<Int>& absRel);
00072                 // </group>
00073 
00074                 // Construct from the bounding box of an  <src>LCRegion</src>.
00075                 QtWCBox(const LCRegion& region,
00076                         const DisplayCoordinateSystem& cSys);
00077 
00078                 // Copy constructor (reference semantics [except for <src>DisplayCoordinateSystem</src>])
00079                 QtWCBox (const QtWCBox& other);
00080 
00081                 // Destructor
00082                 virtual ~QtWCBox();
00083 
00084                 // Assignment (copy semantics)
00085                 QtWCBox& operator= (const QtWCBox& other);
00086 
00087                 // Comparison
00088                 virtual Bool operator==(const WCRegion& other) const;
00089 
00090                 // Clone a QtWCBox object.
00091                 virtual WCRegion* cloneRegion() const;
00092 
00093                 // QtWCBox can extend a region.
00094                 virtual Bool canExtend() const;
00095 
00096                 // Make a new box from the given axesin this box.
00097                 QtWCBox splitBox (const IPosition& axes) const;
00098 
00099                 // Convert to an LCRegion using the supplied <src>DisplayCoordinateSystem</src>
00100                 // and shape.
00101                 virtual LCRegion* doToLCRegion (const CoordinateSystem& cSys,
00102                                                 const IPosition& latticeShape,
00103                                                 const IPosition& pixelAxesMap,
00104                                                 const IPosition& outOrder) const;
00105 
00106                 // Convert the QtWCBox object to a record.
00107                 // The record can be used to make the object persistent.
00108                 // The <src>tableName</src> argument can be used by derived
00109                 // classes (e.g. LCPagedMask) to put very large objects.
00110                 virtual TableRecord toRecord(const String& tableName) const;
00111 
00112                 // Convert to a QtWCBox from a record.
00113                 static QtWCBox* fromRecord (const TableRecord& rec,
00114                                             const String& tableName);
00115 
00116                 // Returns QtWCBox
00117                 static String className();
00118 
00119                 // Return region type.  Returns the class name
00120                 virtual String type() const;
00121 
00122                 // Convert from/to boxit format string
00123                 String toBoxString() const;
00124                 static QtWCBox* fromBoxString(const String&,
00125                                               const DisplayCoordinateSystem& cSys, String& err);
00126 
00127                 // FIXME: refactor to someplace more appropriate
00128                 // get/set chan extension
00129                 void setChanExt(const Double, const Double);
00130                 Bool getChanExt(Double&, Double&);
00131 
00132                 // FIXME: refactor to someplace more appropriate
00133                 // get/set pol extension
00134                 void setPolExt(const Double, const Double);
00135                 Bool getPolExt(Double&, Double&);
00136 
00137                 static void unitInit();
00138 
00139         private:
00140                 Vector<Quantum<Double> > itsBlc;
00141                 Vector<Quantum<Double> > itsTrc;
00142                 IPosition itsPixelAxes;
00143                 DisplayCoordinateSystem itsCSys;
00144                 Vector<Int> itsAbsRel;
00145                 Bool itsNull;
00146 
00147 
00148 // Check units of quanta are consistent with DisplayCoordinateSystem
00149                 void checkUnits (const IPosition& pixelAxes,
00150                                  const Vector<Quantum<Double> >& values,
00151                                  const DisplayCoordinateSystem& cSys);
00152 
00153 // Convert relative pixels to absolute or fill in defaults
00154                 void convertPixel(Double& pixel,
00155                                   const Quantum<Double>& value,
00156                                   const Int absRel,
00157                                   const Double refPix,
00158                                   const Int shape,
00159                                   const Bool isBlc) const;
00160 
00161         };
00162 
00163 
00164 
00165 } //# NAMESPACE CASA - END
00166 
00167 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1