1 | // ----------------------------------------------------------------------- |
---|
2 | // CutoutPlot.cc: Definition of the class producing a page of cutout plots |
---|
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 | #include <duchamp/Plotting/CutoutPlot.hh> |
---|
29 | #include <duchamp/Plotting/MultipleDuchampPlot.hh> |
---|
30 | #include <duchamp/Plotting/DuchampPlot.hh> |
---|
31 | #include <string> |
---|
32 | |
---|
33 | namespace duchamp { |
---|
34 | |
---|
35 | namespace Plot { |
---|
36 | |
---|
37 | CutoutPlot::CutoutPlot(): |
---|
38 | MultipleDuchampPlot() |
---|
39 | { |
---|
40 | this->numOnPage = 5; |
---|
41 | } |
---|
42 | |
---|
43 | CutoutPlot::CutoutPlot(const CutoutPlot& other) |
---|
44 | { |
---|
45 | this->operator=(other); |
---|
46 | } |
---|
47 | |
---|
48 | CutoutPlot& CutoutPlot::operator=(const CutoutPlot& other) |
---|
49 | { |
---|
50 | if(this==&other) return *this; |
---|
51 | ((MultipleDuchampPlot &) *this) = other; |
---|
52 | return *this; |
---|
53 | } |
---|
54 | |
---|
55 | void CutoutPlot::calcCoords() |
---|
56 | { |
---|
57 | int posOnPage = (this->numOnPage - (this->spectraCount%this->numOnPage)) % this->numOnPage; |
---|
58 | this->mainCoords[0] = Plot::cuMainX1/inchToCm; |
---|
59 | this->mainCoords[1] = Plot::cuMainX2/inchToCm; |
---|
60 | this->mainCoords[2] = this->mapCoords[2] = |
---|
61 | posOnPage*paperHeight/float(this->numOnPage) + Plot::cuMainY1/inchToCm; |
---|
62 | this->mainCoords[3] = this->mapCoords[3] = |
---|
63 | posOnPage*paperHeight/float(this->numOnPage) + Plot::cuMainY2/inchToCm; |
---|
64 | this->mapCoords[0] = Plot::cuMapX1/inchToCm; |
---|
65 | this->mapCoords[1] = this->mapCoords[0] + (this->mapCoords[3]-this->mapCoords[2]); |
---|
66 | } |
---|
67 | |
---|
68 | /// @brief Write first line of header information (position/velocity info) in correct place. |
---|
69 | void CutoutPlot::firstHeaderLine(std::string line) |
---|
70 | { |
---|
71 | cpgsch(Plot::plotTitleSize); |
---|
72 | cpgptxt(0.5,0.8,0.,0.5,line.c_str()); |
---|
73 | } |
---|
74 | |
---|
75 | void CutoutPlot::secondHeaderLine(std::string line) |
---|
76 | { |
---|
77 | cpgsch(Plot::plotLabelSize); |
---|
78 | cpgptxt(0.5,0.6,0.,0.5,line.c_str()); |
---|
79 | } |
---|
80 | void CutoutPlot::thirdHeaderLine(std::string line) |
---|
81 | { |
---|
82 | cpgsch(Plot::plotLabelSize); |
---|
83 | cpgptxt(0.5,0.4,0.,0.5,line.c_str()); |
---|
84 | } |
---|
85 | void CutoutPlot::fourthHeaderLine(std::string line) |
---|
86 | { |
---|
87 | cpgsch(Plot::plotLabelSize); |
---|
88 | cpgptxt(0.5,0.2,0.,0.5,line.c_str()); |
---|
89 | } |
---|
90 | |
---|
91 | void CutoutPlot::gotoMap(){ |
---|
92 | cpgvsiz(this->mapCoords[0],this->mapCoords[1], |
---|
93 | this->mapCoords[2],this->mapCoords[3]); |
---|
94 | cpgsch(Plot::plotIndexSize); |
---|
95 | } |
---|
96 | |
---|
97 | |
---|
98 | } |
---|
99 | |
---|
100 | } |
---|