source: trunk/src/Plotting/ImagePlot.hh @ 1455

Last change on this file since 1455 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.6 KB
Line 
1// -----------------------------------------------------------------------
2// ImagePlot.hh: Definition of the class for plotting 2D images
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 IMAGEPLOT_H
29#define IMAGEPLOT_H
30
31#include <string>
32#include <duchamp/Plotting/DuchampPlot.hh>
33
34namespace duchamp
35{
36
37    /// @brief A namespace to control plotting of the spectral output and the
38    /// spatial image output.
39
40    namespace Plot
41    {
42        // These are the constants used for spacing out elements in ImagePlot.
43        const float imTitleOffset = 2.7;  ///< Offset for title of map.
44
45        ///  @brief A class for plotting 2-dimensional maps.
46        ///  @details A class to hold the dimensions and set up for the
47        ///  plotting of maps in Duchamp.
48        ///    The physical dimensions (in inches) of the plot and the elements
49        ///     within it are stored, including maximum widths and heights
50        ///     (so that the plot will fit on an A4 page).
51        ///    Simple accessor functions are provided to enable access to quantities
52        ///     needed for pgplot routines.
53        class ImagePlot : public DuchampPlot
54        {
55        public:
56            ImagePlot();  ///< Constructor
57            ImagePlot(long x, long y);
58            virtual ~ImagePlot(){}; ///< Destructor
59            ImagePlot(const ImagePlot& other);
60            ImagePlot& operator=(const ImagePlot& other);
61
62            int setUpPlot(std::string pgDestination);
63
64            /// @brief Defines and draws box.
65            void  drawMapBox(float x1, float x2, float y1, float y2,
66                             std::string xlabel, std::string ylabel);
67
68            /// @brief Write plot title.
69            void  makeTitle(std::string title);
70
71            float cmToCoord(float cm);///< Converts distance in cm to coordinate distance on the plot.
72            float getMargin(){return marginWidth;};        ///< Returns width of margin.
73            float imageWidth();       ///< Returns the calculated total width of the image part of the plot [inches]
74            float getImageHeight(){return imageWidth()*imageRatio;};   ///< Returns height of image [inches]
75
76        protected:
77            float maxPaperHeight; ///< Maximum allowed height of paper [inches]
78            float marginWidth;    ///< Width allowed for margins around main plot (ie. label & numbers) [inches]
79            float wedgeWidth;     ///< Width allowed for placement of wedge on right-hand side of plot. [inches]
80            float imageRatio;     ///< Aspect ratio of the image only (ie. y-value range / x-value range).
81            float xdim;           ///< Width of main plot, in display units.
82            float ydim;           ///< Height of main plot, in display units.
83        };
84
85
86    }
87
88}
89
90#endif
Note: See TracBrowser for help on using the repository browser.