-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoopExtents.h
101 lines (93 loc) · 3.37 KB
/
LoopExtents.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef __LOOPEXTENTS_H
#define __LOOPEXTENTS_H
#include "LoopProjectFileUtils.h"
#include <netcdf>
namespace LoopProjectFile {
/*! \brief A structure containing boundary extents in both geodesic and UTM coordinate systems */
struct LoopExtents {
/*!@{ The minimum and maximum extent boundaries in geodesic coordinates (degrees) */
double minLatitude;
double maxLatitude;
double minLongitude;
double maxLongitude;
/*!@}*/
/*!@{ The minimum and maximum extent boundaries in UTM coordinates (metres) */
double minNorthing;
double maxNorthing;
double minEasting;
double maxEasting;
/*!@}*/
/*!@{ The UTM zone of the UTM coordinates */
int utmZone;
int utmNorthSouth;
/*!@}*/
/*!@{ The top and bottom extent depths (metres) */
double topDepth;
double bottomDepth;
/*!@}*/
/*!@{ The spacing distances between points along each axis (metres) */
double spacingX;
double spacingY;
double spacingZ;
/*!@}*/
/*!@{*/
/*! The working format of these extents 0-UTM 1-Geodesic */
int workingFormat;
/*! A flag indicating an error occured during collection of these extents **0 = No Error**, **1 = Error** */
bool errored;
/*!@}*/
/*! \brief Constructor. Zeros all variables */
LoopExtents() {
minLatitude = 0;
maxLatitude = 0;
minLongitude = 0;
maxLongitude = 0;
minNorthing = 0;
maxNorthing = 0;
minEasting = 0;
maxEasting = 0;
utmZone = 0;
utmNorthSouth = 0;
topDepth = 0;
bottomDepth = 0;
spacingX = 0;
spacingY = 0;
spacingZ = 0;
workingFormat = 0;
errored = true;
}
/*!
* \brief Sets the extents within the Loop Project File referenced by the root node
*
* \param rootNode - the rootNode of the netCDF Loop project file
* \param extents - the extents structure to add to the file
* \param verbose - a flag to toggle verbose message printing
*
* \return Response with success/fail of data insert with error message if it failed
*/
static LoopProjectFileResponse SetExtents(netCDF::NcGroup* rootNode, LoopExtents extents, bool verbose=false);
/*!
* \brief Gets the extents within the Loop Project File referenced by the root node
*
* \param rootNode - the rootNode of the netCDF Loop project file
* \param extents - the extents structure to retrieve from the file
* \param verbose - a flag to toggle verbose message printing
*
* \return Response with success/fail of data insert with error message if it failed
*/
static LoopProjectFileResponse GetExtents(netCDF::NcGroup* rootNode, LoopExtents& extents, bool verbose=false);
/*!
* \brief Checks the extents within the Loop Project File referenced by the root node are valid
* and returns the grid size of the region of interest given the extents and spacing values
*
* \param rootNode - the rootNode of the netCDF Loop project file
* \param xyzGridSize - a reference to a vector of integers for returning the grid size of this project
* \param verbose - a flag to toggle verbose message printing
*
* \return A flag indicating whether the extents in the netCDF file are valid
*/
static bool CheckExtentsValid(netCDF::NcGroup* rootNode, std::vector<int>& xyzGridSize, bool verbose=false);
static void SwapExtents(double &minVal, double &maxVal);
}; // LoopExtents
} // namespace LoopProjectFile
#endif