1 | // ----------------------------------------------------------------------- |
---|
2 | // MultipleDuchampPlot.cc: Definition of the base class for plots with |
---|
3 | // multiple instances per page |
---|
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 | #include <duchamp/Plotting/MultipleDuchampPlot.hh> |
---|
30 | #include <duchamp/Plotting/DuchampPlot.hh> |
---|
31 | |
---|
32 | namespace duchamp { |
---|
33 | |
---|
34 | namespace Plot { |
---|
35 | |
---|
36 | MultipleDuchampPlot::MultipleDuchampPlot(): |
---|
37 | DuchampPlot() |
---|
38 | { |
---|
39 | this->spectraCount=0; |
---|
40 | } |
---|
41 | |
---|
42 | MultipleDuchampPlot::MultipleDuchampPlot(const MultipleDuchampPlot& other) |
---|
43 | { |
---|
44 | this->operator=(other); |
---|
45 | } |
---|
46 | |
---|
47 | MultipleDuchampPlot& MultipleDuchampPlot::operator= (const MultipleDuchampPlot& other) |
---|
48 | { |
---|
49 | if(this==&other) return *this; |
---|
50 | ((DuchampPlot &) *this) = other; |
---|
51 | this->numOnPage = other.numOnPage; |
---|
52 | this->spectraCount = other.spectraCount; |
---|
53 | for(int i=0;i<4;i++) this->mainCoords[i] = other.mainCoords[i]; |
---|
54 | for(int i=0;i<4;i++) this->mapCoords[i] = other.mapCoords[i]; |
---|
55 | return *this; |
---|
56 | } |
---|
57 | |
---|
58 | int MultipleDuchampPlot::setUpPlot(std::string pgDestination) |
---|
59 | { |
---|
60 | this->paperHeight = this->paperWidth*this->aspectRatio; |
---|
61 | if(this->paperHeight+2*Plot::psVoffset > Plot::a4height){ |
---|
62 | this->paperHeight = Plot::a4height - 2*Plot::psVoffset; |
---|
63 | this->paperWidth = this->paperHeight / this->aspectRatio; |
---|
64 | } |
---|
65 | return this->open(pgDestination); |
---|
66 | } |
---|
67 | |
---|
68 | void MultipleDuchampPlot::gotoHeader() |
---|
69 | { |
---|
70 | if(spectraCount%numOnPage==0) cpgpage(); |
---|
71 | spectraCount++; |
---|
72 | this->calcCoords(); |
---|
73 | cpgvsiz(0., this->paperWidth, this->mainCoords[2], this->mainCoords[3]); |
---|
74 | } |
---|
75 | |
---|
76 | |
---|
77 | } |
---|
78 | |
---|
79 | } |
---|