OpenMining  0.01
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Cube.h
Go to the documentation of this file.
1 /*
2  Copyright 2014 Daniel McInnes
3 
4  This file is part of OpenMining.
5 
6  OpenMining is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OpenMining is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OpenMining. If not, see <http://www.gnu.org/licenses/>.
18 
19 */
20 
21 #ifndef cube_h
22 #define cube_h
23 
24 // standard library includes
25 #include <iostream>
26 #include <sstream>
27 #include <string>
28 
29 // boost #includes
30 #include <boost/archive/text_oarchive.hpp>
31 
32 // Qt includes
33 #include <QStringList>
34 
35 // my includes
36 #include "mytypes.h"
37 
38 class Cube
39 {
40 public:
41  //const member functions
42  void Print() const;
43  longitude_t longitudeRange() const { return m_maxx - m_minx; }
44  latitude_t latitudeRange() const { return m_maxy - m_miny; }
45  elevation_t elevationRange() const { return m_maxz - m_minz; }
46  std::string ranges() const;
47 
48  // non-const member functions
49  Cube();
50  bool init(const QStringList& args);
51  void UpdateMinMax(const longitude_t& longitude, const latitude_t& latitude, const elevation_t& elevation);
52 
53  // member variables
57  int32_t m_sidelength;
58 
59  // friends
60  friend std::ostream& operator<<(std::ostream& os, const Cube& cube);
62 
63 private:
64  // When the class Archive corresponds to an output archive, the
65  // & operator is defined similar to <<. Likewise, when the class Archive
66  // is a type of input archive the & operator is defined similar to >>.
67  template<class Archive>
68  void serialize(Archive& ar, const unsigned int version)
69  {
70  ar & m_miny;
71  ar & m_maxy;
72  ar & m_minx;
73  ar & m_maxx;
74  ar & m_minz;
75  ar & m_maxz;
76  Q_UNUSED(version);
77  }
78 };
79 
80 std::ostream& operator<<(std::ostream& os, const Cube& cube);
81 
82 #endif
bool init(const QStringList &args)
Definition: Cube.cpp:45
elevation_t m_minz
Definition: Cube.h:56
latitude_t m_maxy
Definition: Cube.h:54
void UpdateMinMax(const longitude_t &longitude, const latitude_t &latitude, const elevation_t &elevation)
Definition: Cube.cpp:74
int32_t latitude_t
Definition: mytypes.h:18
friend class boost::serialization::access
Definition: Cube.h:61
std::string ranges() const
Definition: Cube.cpp:84
latitude_t latitudeRange() const
Definition: Cube.h:44
Definition: Cube.h:38
int32_t elevation_t
Definition: mytypes.h:20
elevation_t m_maxz
Definition: Cube.h:56
friend std::ostream & operator<<(std::ostream &os, const Cube &cube)
Definition: Cube.cpp:93
elevation_t elevationRange() const
Definition: Cube.h:45
longitude_t longitudeRange() const
Definition: Cube.h:43
longitude_t m_maxx
Definition: Cube.h:55
int32_t longitude_t
Definition: mytypes.h:19
std::ostream & operator<<(std::ostream &os, const Cube &cube)
Definition: Cube.cpp:93
latitude_t m_miny
Definition: Cube.h:54
int32_t m_sidelength
Definition: Cube.h:57
Cube()
Definition: Cube.cpp:43
longitude_t m_minx
Definition: Cube.h:55
void Print() const
Definition: Cube.cpp:64
void serialize(Archive &ar, const unsigned int version)
Definition: Cube.h:68