source: tags/release-1.1/src/PixelMap/Voxel.cc @ 1391

Last change on this file since 1391 was 301, checked in by Matthew Whiting, 17 years ago

Mostly adding the distribution text to the start of files, with a few additional comments added too.

File size: 3.3 KB
Line 
1// -----------------------------------------------------------------------
2// Voxel.cc: Member functions for the Voxel 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#include <iostream>
29#include <iomanip>
30#include <PixelMap/Voxel.hh>
31
32namespace PixelInfo
33{
34
35  Voxel::Voxel(long x, long y, long z, float f)
36  {
37    this->itsX=x;
38    this->itsY=y;
39    this->itsZ=z;
40    this->itsF=f;
41  }
42  //--------------------------------------------------------------------
43
44  Voxel::Voxel(const Voxel& v)
45  {
46    this->itsX=v.itsX;
47    this->itsY=v.itsY;
48    this->itsZ=v.itsZ;
49    this->itsF=v.itsF;
50  }
51  //--------------------------------------------------------------------
52
53  Voxel& Voxel::operator= (const Voxel& v)
54  {
55    if(this == &v) return *this;
56    this->itsX=v.itsX;
57    this->itsY=v.itsY;
58    this->itsZ=v.itsZ;
59    this->itsF=v.itsF;
60    return *this;
61  }
62  //--------------------------------------------------------------------
63
64  std::ostream& operator<< ( std::ostream& theStream, Voxel& vox)
65  {
66    /**
67     * A convenient way of printing the coordinate and flux values of
68     * a voxel.  They are all printed to a single line (with no
69     * carriage-return), with the flux to precision of 4.
70     */ 
71
72    theStream << std::setw(4) << vox.itsX ;
73    theStream << " " << std::setw(4) << vox.itsY;
74    theStream << " " << std::setw(4) << vox.itsZ;
75    theStream << std::setprecision(4);
76    theStream << "  " << vox.itsF;
77    return theStream;
78
79  }
80  //--------------------------------------------------------------------
81  //--------------------------------------------------------------------
82
83  Pixel::Pixel(long x, long y, float f)
84  {
85    this->itsX=x;
86    this->itsY=y;
87    this->itsF=f;
88  }
89  //--------------------------------------------------------------------
90
91  Pixel::Pixel(const Pixel& p)
92  {
93    this->itsX=p.itsX;
94    this->itsY=p.itsY;
95    this->itsF=p.itsF;
96  }
97  //--------------------------------------------------------------------
98
99  Pixel& Pixel::operator= (const Pixel& p)
100  {
101    if(this == &p) return *this;
102    this->itsX=p.itsX;
103    this->itsY=p.itsY;
104    this->itsF=p.itsF;
105    return *this;
106  }
107  //--------------------------------------------------------------------
108
109}
Note: See TracBrowser for help on using the repository browser.