source: branches/OptimisedGrowerTesting/src/Plotting/DuchampPlot.hh

Last change on this file was 1241, checked in by MatthewWhiting, 11 years ago

Ticket #195 - Large amount of code refactoring the plotting classes into separate ones with inheritance.

File size: 3.3 KB
Line 
1// -----------------------------------------------------------------------
2// DuchampPlot.hh: Definition of the base plotting class
3// -----------------------------------------------------------------------
4// Copyright (C) 2006, Matthew Whiting, ATNF
5//
6// This program is free software; you can redistribute it and/or modify it
7// under the terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 2 of the License, or (at your
9// option) any later version.
10//
11// Duchamp is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14// for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with Duchamp; if not, write to the Free Software Foundation,
18// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
19//
20// Correspondence concerning Duchamp may be directed to:
21//    Internet email: Matthew.Whiting [at] atnf.csiro.au
22//    Postal address: Dr. Matthew Whiting
23//                    Australia Telescope National Facility, CSIRO
24//                    PO Box 76
25//                    Epping NSW 1710
26//                    AUSTRALIA
27// -----------------------------------------------------------------------
28#ifndef DUCHAMPPLOT_H
29#define DUCHAMPPLOT_H
30
31#include <string>
32
33namespace duchamp
34{
35
36    /// @brief A namespace to control plotting of the spectral output and the
37    /// spatial image output.
38
39    namespace Plot
40    {
41        const float inchToCm=2.54;        ///< Conversion factor from inches to centimetres.
42        const float a4width=21.0;         ///< A4 width in cm
43        const float a4height=29.7;        ///< A4 height in cm
44        const float psHoffset=0.35;       ///< The default horizontal pgplot offset applied to ps files
45        const float psVoffset=0.25;       ///< The default vertical pgplot offset applied to ps files
46
47        class DuchampPlot
48        {
49        public:
50            DuchampPlot();
51            DuchampPlot(const DuchampPlot& other);
52            DuchampPlot& operator= (const DuchampPlot& other);
53            virtual ~DuchampPlot(){};
54
55            /// @brief Set up PGPLOT output.
56            virtual int setUpPlot(std::string pgDestination)=0;
57
58            /// @brief Open the PGPLOT device
59            int open(std::string pgDestination);
60
61            /// @brief Close the PGPLOT device
62            void close();
63
64            float getPaperWidth(){return paperWidth;};    ///< Return width of plottable region.
65            void  setPaperWidth(float f){paperWidth=f;};  ///< Set width of plottable region.
66            float getPaperHeight(){return paperHeight;};  ///< Return height of plottable region.
67            void  setPaperHeight(float f){paperHeight=f;};///< Set height of plottable region.
68            float getAspectRatio(){return aspectRatio;};  ///< Return aspect ratio
69            void  setAspectRatio(float f){aspectRatio=f;};///< Set aspect ratio
70
71            void  goToPlot();              ///< Goes to the plot when more than one are open.
72
73        protected:
74            float paperWidth;    ///< Width of plottable region of the paper [inches]
75            float paperHeight;   ///< Height of plottable region of the paper [inches]
76            float aspectRatio;   ///< Aspect ratio height/width (as used by PGPlot calls)
77            int   identifier;    ///< The identifier code used by cpgslct.
78
79
80
81        };
82
83    }
84}
85
86#endif
87
Note: See TracBrowser for help on using the repository browser.