00001 //# WCPGFilter.h: interface between WorldCanvas and its PGPLOT driver 00002 //# Copyright (C) 1993,1994,1995,1996,1998,1999,2000,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 //# 00026 //# $Id$ 00027 00028 #ifndef TRIALDISPLAY_WCPGFILTER_H 00029 #define TRIALDISPLAY_WCPGFILTER_H 00030 00031 #include <casa/aips.h> 00032 00033 namespace casa { //# NAMESPACE CASA - BEGIN 00034 00035 class WorldCanvas; 00036 template <class T> class Matrix; 00037 template <class T> class Vector; 00038 00039 // <summary> 00040 // Interface between the WorldCanvas and its PGPLOT driver. 00041 // </summary> 00042 00043 // <use visibility=export> 00044 00045 // <reviewed> 00046 // </reviewed> 00047 00048 // <prerequisite> 00049 // <li> none 00050 // </prerequisite> 00051 00052 // <etymology> 00053 // "WCPGFilter" is a contraction and concatenation of "WorldCanvas," 00054 // "PGPLOT" and "Filter", and is a simple filtering interface between 00055 // the WorldCanvas and its PGPLOT driver. 00056 // </etymology> 00057 00058 // <synopsis> 00059 // </synopsis> 00060 00061 // <motivation> 00062 // </motivation> 00063 00064 // <example> 00065 // </example> 00066 00067 // <todo> 00068 // </todo> 00069 00070 class WCPGFilter { 00071 00072 public: 00073 00074 // Constructor taking a pointer to a WorldCanvas. 00075 WCPGFilter(WorldCanvas *wc); 00076 00077 // Destructor. 00078 virtual ~WCPGFilter(); 00079 00080 // Reference counting: ref, unref and refCount. 00081 // <group> 00082 virtual void ref() { 00083 itsRefCount++; 00084 } 00085 virtual void unref() { 00086 itsRefCount--; 00087 } 00088 virtual Int refCount() const { 00089 return itsRefCount; 00090 } 00091 // </group> 00092 00093 // Return the PGPLOT device id. 00094 virtual Int pgid() const { 00095 return Int(itsPgPlotID); 00096 } 00097 00098 // Realign the PGPLOT domain to the WorldCanvas domain. If linear 00099 // is False, then the pgplot canvas is setup to match the world 00100 // coordinates, but of course is only valid where the world 00101 // coordinates are linear to first approximation. 00102 Bool realign(const Bool &linear = True); 00103 00104 // Contour using pgcont function. 00105 void cont(const Matrix<Float> &m, 00106 const Vector<Float> &levels, 00107 const Matrix<Float> &tr); 00108 00109 // Contour using pgconb function. (contour with blanks) 00110 void conb(const Matrix<Float> &m, 00111 const Vector<Float> &levels, 00112 const Matrix<Float> &tr, 00113 const Float blank); 00114 00115 private: 00116 00117 // Store for the WorldCanvas this filters for. 00118 WorldCanvas *itsWorldCanvas; 00119 00120 // Store the PGPLOT device id here. 00121 uInt itsPgPlotID; 00122 00123 // Reference counting. 00124 Int itsRefCount; 00125 00126 // Split contours into positive and negative 00127 void splitContours (Vector<Float>& neg, Vector<Float>& pos, 00128 const Vector<Float>& levels); 00129 00130 00131 }; 00132 00133 00134 } //# NAMESPACE CASA - END 00135 00136 #endif 00137