OpenMining  0.01
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
elevation.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 elevation_h
22 #define elevation_h
23 
24 // standard library includes
25 #include <string>
26 #include <iostream>
27 
28 // boost #includes
29 #include <boost/archive/text_oarchive.hpp>
30 #include <boost/archive/text_iarchive.hpp>
31 #include <boost/serialization/map.hpp>
32 
33 // Qt includes
34 
35 // my includes
36 #include "mytypes.h" // typedefs
37 #include "Cube.h" // 'Cube' member variable m_extremities
38 #include "simpleplot.h" // m_plot
39 
40 class Locations;
41 class Longitudes;
42 class Latitudes;
43 
49 class Latitudes
50 {
51 public:
53  Latitudes();
54  elevation_t& operator[](const latitude_t& latitude);
56 
57 private:
58 
59  // When the class Archive corresponds to an output archive, the
60  // & operator is defined similar to <<. Likewise, when the class Archive
61  // is a type of input archive the & operator is defined similar to >>.
62  template<class Archive>
63  void serialize(Archive& ar, const unsigned int version)
64  {
65  ar & m_latitudes;
66  Q_UNUSED(version);
67  }
68 };
69 
71 {
72 public:
74  Longitudes();
75  Longitudes(QStringList& args);
76  Longitudes& operator=(const Locations& locations);
77  bool load();
78  bool saveIfUpdated();
79  void print(void);
81  double getElevation(double& longitude, double& latitude, const uint32_t coarseness);
82 
83 private:
84  latitudes_t& operator[](const longitude_t& longitude);
85  longitudes_t m_longitudes; // m_longitudes[long][lat] = elevation
86  longitudes_t m_plottedLongitudes; // m_longitudes[long][lat] = elevation
87  const char* m_key = "--longitudes-filename";
88  std::string m_filename;
89  QStringList& m_args;
91  // When the class Archive corresponds to an output archive, the
92  // & operator is defined similar to <<. Likewise, when the class Archive
93  // is a type of input archive the & operator is defined similar to >>.
94  template<class Archive>
95  void serialize(Archive& ar, const unsigned int version)
96  {
97  ar & m_extremities;
98  //ar & m_longitudes;
100  Q_UNUSED(version);
101  }
102 };
103 
104 #endif
void serialize(Archive &ar, const unsigned int version)
Definition: elevation.h:95
latitudes_t & operator[](const longitude_t &longitude)
Definition: elevation.cpp:125
double getElevation(double &longitude, double &latitude, const uint32_t coarseness)
Definition: elevation.cpp:137
Cube m_extremities
Definition: elevation.h:80
friend class boost::serialization::access
Definition: elevation.h:73
std::map< latitude_t, elevation_t > latitudes_t
Definition: mytypes.h:21
longitudes_t m_plottedLongitudes
Definition: elevation.h:86
int32_t latitude_t
Definition: mytypes.h:18
void print(void)
Definition: elevation.cpp:98
bool load()
Definition: elevation.cpp:75
std::map< longitude_t, latitudes_t > longitudes_t
Definition: mytypes.h:22
Definition: elevation.h:49
Latitudes()
Definition: elevation.cpp:172
elevation_t & operator[](const latitude_t &latitude)
Definition: elevation.cpp:131
Definition: Cube.h:38
int32_t elevation_t
Definition: mytypes.h:20
Definition: location.h:76
Definition: elevation.h:70
int32_t longitude_t
Definition: mytypes.h:19
QStringList & m_args
Definition: elevation.h:89
latitudes_t m_latitudes
Definition: elevation.h:55
bool saveIfUpdated()
Definition: elevation.cpp:61
void serialize(Archive &ar, const unsigned int version)
Definition: elevation.h:63
bool changesNotSaved
Definition: elevation.h:90
const char * m_key
Definition: elevation.h:87
std::string m_filename
Definition: elevation.h:88
longitudes_t m_longitudes
Definition: elevation.h:85
friend class boost::serialization::access
Definition: elevation.h:52
Longitudes & operator=(const Locations &locations)
Definition: elevation.cpp:112