source: tags/release-1.2.2/src/Utils/mycpgplot.hh

Last change on this file was 528, checked in by MatthewWhiting, 15 years ago

Changing the documentation comments to match the askapsoft style. Also have split ChanMap? and Object3D into separate files.

File size: 5.1 KB
Line 
1// -----------------------------------------------------------------------
2// mycpgplot.hh: Enumerations, shortcuts and other useful functions
3//               for use with PGPLOT.
4// -----------------------------------------------------------------------
5// Copyright (C) 2006, Matthew Whiting, ATNF
6//
7// This program is free software; you can redistribute it and/or modify it
8// under the terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 2 of the License, or (at your
10// option) any later version.
11//
12// Duchamp is distributed in the hope that it will be useful, but WITHOUT
13// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15// for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Duchamp; if not, write to the Free Software Foundation,
19// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
20//
21// Correspondence concerning Duchamp may be directed to:
22//    Internet email: Matthew.Whiting [at] atnf.csiro.au
23//    Postal address: Dr. Matthew Whiting
24//                    Australia Telescope National Facility, CSIRO
25//                    PO Box 76
26//                    Epping NSW 1710
27//                    AUSTRALIA
28// -----------------------------------------------------------------------
29#ifndef MYCPGPLOT_H
30#define MYCPGPLOT_H
31#include <string>
32
33#undef PACKAGE_BUGREPORT
34#undef PACKAGE_NAME
35#undef PACKAGE_STRING
36#undef PACKAGE_TARNAME
37#undef PACKAGE_VERSION
38#undef HAVE_PGPLOT
39#include <duchamp/config.h>
40
41/// A namespace that holds definitions and basic functions to aid the
42/// use of PGPLOT.
43
44namespace mycpgplot
45{
46  /// @brief Enumerated PGPLOT colour names.
47  enum COLOUR {BACKGND=0, FOREGND, RED, GREEN, BLUE, CYAN,
48               MAGENTA, YELLOW, ORANGE, GREENYELLOW, GREENCYAN, BLUECYAN,
49               BLUEMAGENTA, REDMAGENTA, DARKGREY, LIGHTGREY, DARKGREEN,
50               WCSGREEN};
51
52  /// @brief Enumerated colour names for the inverse case, such as for /xs devices.
53  enum INVERSE {XS_BLACK, XS_WHITE};
54
55  /// @brief Enumerated PGPLOT line styles.
56  enum LINESTYLE {FULL=1, DASHED, DASHDOT, DOTTED, DASHDOT3};
57
58  /// @brief Enumerated PGPLOT area fill styles.
59  enum FILLSTYLE {SOLID=1, OUTLINE, HATCHED, CROSSHATCHED};
60
61  /// @brief Enumerated PGPLOT plotting symbols.
62  enum SYMBOLS {SOLIDPENT=-5, SOLIDDIAMOND, DOT=1, PLUS, ASTERISK,
63                CIRCLE, CROSS, SQUARE, TRIANGLE, OPLUS, ODOT, FOURSTAR,
64                DIAMOND, STAR, SOLIDTRIANGLE, OPENPLUS, DAVID,
65                SOLIDSQUARE, SOLIDCIRCLE, SOLIDSTAR, LARGESQUARE,
66                CIRCLE1, CIRCLE2, CIRCLE3, CIRCLE4, CIRCLE5, CIRCLE6,
67                CIRCLE7, CIRCLE8, LEFT, RIGHT, UP, DOWN};
68
69  enum FONTS {NORMAL=1, ROMAN, ITALIC, SCRIPT};
70
71  const std::string degrees="\\(0718)";   ///< The degrees symbol: \f$^\circ\f$
72  const std::string plusminus="\\(2233)"; ///< The plus-minus symbol: \f$\pm\f$
73  const std::string times="\\(2235)";     ///< Similar to \f$\times\f$
74  const std::string tick="\\(2267)";      ///< A tick, which is good for square roots: similar to \f$\surd\f$
75  const std::string odot="\\(2281)";      ///< \f$\odot\f$
76  const std::string integral="\\(2268)";  ///< The integral symbol \f$\int\f$
77
78}
79
80//////////////////////
81
82#ifdef HAVE_PGPLOT
83
84#include <cpgplot.h>
85
86// The following are in pgplot_related.c
87//
88/// @brief Is a PGPLOT device open?
89extern "C" int  cpgtest();
90
91/// @brief Do a logarithmic-scaled wedge, as in PGWEDG
92extern "C" void cpgwedglog(const char* side, float disp, float width,
93                           float fg, float bg, const char *label);
94
95/// @brief Do CPGHIST but with the y-axis logarithmic
96extern "C" void cpghistlog(int npts, float *data, float datamin,
97                           float datamax, int nbin, int pgflag);
98
99/// @brief Do a PGPLOT cumulative distribution
100extern "C" void cpgcumul(int npts, float *data, float datamin,
101                         float datamax, int pgflag);
102
103namespace mycpgplot {
104
105  /// @brief Is a PGPLOT device a postscript (hardcopy) device? 
106  int  cpgIsPS();
107
108  /// @brief A front-end to the cpgopen function, with other necessary definitions.
109  int mycpgopen(std::string device);
110
111  /// @brief Define the DARKGREEN colour, with RGB value of (0,0.7,0).
112  void setDarkGreen();
113
114  /// @brief Define the WCSGREEN colour, with RGB value of (0.3,0.5,0.3).
115  void setWCSGreen();
116
117  /// @brief A device-independent way to set the colour to white.
118  void setWhite();
119
120  /// @brief A device-independent way to set the colour to black.
121   void setBlack();
122
123}
124
125#else // from ifdef HAVE_PGPLOT
126// PGPLOT has not been defined.
127// extern "C" int  cpgtest(){return 0;};
128// extern "C" int  cpgIsPS(){return 0;};
129// extern "C" void cpgwedglog(const char* side, float disp, float width,
130//                         float fg, float bg, const char *label){ };
131// extern "C" void cpghistlog(int npts, float *data, float datamin,
132//                         float datamax, int nbin, int pgflag){ };
133// extern "C" void cpgcumul(int npts, float *data, float datamin,
134//                       float datamax, int pgflag){ };
135// namespace mycpgplot {
136//   int mycpgopen(std::string device){return 0;};
137//   inline void setDarkGreen(){ };
138//   inline void setWCSGreen(){ };
139//   inline void setWhite(){ };
140//   inline void setBlack(){ };
141// }
142
143#endif // from ifdef HAVE_PGPLOT
144
145#endif
Note: See TracBrowser for help on using the repository browser.