-
Notifications
You must be signed in to change notification settings - Fork 5
/
GeospatialBoundingBox.h
141 lines (102 loc) · 3.87 KB
/
GeospatialBoundingBox.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
////////////////////////////////////////////////////////////////////////////////////
// Copyright © Charalambos "Charis" Poullis, [email protected] //
// This work can only be used under an exclusive license of the author. //
////////////////////////////////////////////////////////////////////////////////////
#ifndef __GEOSPATIAL_BOUNDING_BOX_H__
#define __GEOSPATIAL_BOUNDING_BOX_H__
#include <float.h>
#include <iostream>
#include <fstream>
#include "Vector.h"
#include "BoundingBox.h"
#include "ImageProcessing.h"
#include "GeometryProcessing.h"
#include "Image.h"
#include "Utilities.h"
#include "Sorter.h"
#include "Color.h"
#include <vector>
using namespace std;
#define MAX_SIZE_X 2048
#define MAX_SIZE_Y 2048
#define MAX_CAPACITY MAX_SIZE_X * MAX_SIZE_Y
#define GEO_EPSILON 0.5
/** Geospatial Bounding Box
* This class defines a geospatial bounding box and related functions
* Subclasses the BoundingBox class
*/
class GeospatialBoundingBox : public BoundingBox {
public:
///Constructors
GeospatialBoundingBox();
GeospatialBoundingBox(int index, std::string *base_file_name=0x00);
GeospatialBoundingBox(Vector3f const &_centroid, Vector3f const &_resolution, std::string *_file_name=0x00);
///Destructor
~GeospatialBoundingBox();
///Return the number of points contained in the bounding box
int getNumberOfPoints() const;
///Return the points
std::vector<Vector3f> getPoints(bool offset=false) const;
///Insert a new point in the bounding box
void insert(Vector3f const &point);
///Get the centroid
Vector3f getCentroid() const;
///Initializes the data required for further processing i.e. xyz map, triangulation, and closing the file
void initialize(Image *resampled=0x00);
///Returns true if the box has reached maximum capacity
bool maxedOut();
///Returns a 3D vector representing the resolution of the box
Vector3f getResolution();
///Returns the filename corresponding to this geospatial bounding box
std::string getFileName();
///Sets the filename
void setFileName(std::string const &_file_name);
///Returns true if the point lies inside the geospatial bounding box
bool liesInside(Vector3f const &point);
///Exports the XYZ map corresponding to the geobox
void exportXYZMap(std::string const &post_script);
///Returns the XYZ map corresponding to the geobox
Image *getXYZMap();
///Returns the normal map corresponding to the geobox
Image *getNormalMap();
///Returns the height and normal variation map corresponding to the geobox
Image *getHeightAndNormalVariationMap();
///Return the point corresponding to the index
Vector3f getPoint(Vector2i const &point_index);
///Returns the minimum height (actual value)
float getMinHeight();
///Clean up excess memory
void cleanUp();
///Resample into the right-sized XYZ in order to minimize information loss
bool resample(double sampling_tolerance= EPSILON, double step = 0.05);
///Loads the information from disk
void load(int index, std::string *base_file_name=0x00);
///Exports an information about the geobox
void exportInformationFile();
///Returns the geometric object
GeometricObject *getObject();
private:
///The number of points contained in this bounding box
int number_of_points;
///The file pointer containing the points
ofstream output_file;
///The filename of the bounding box's points
std::string file_name;
///Resolution on x,y,z
Vector3f resolution;
///The XYZ map corresponding to the bbox
Image *xyz_map;
///The normal map
Image *normal_map;
///The height and variation map
Image *height_and_normal_variation_map;
///The keypoint of the bounding box
Vector3f centroid;
///Minimum value for height
float min_height;
///Global static bounding box id
static int global_id;
///Computes the height and normal variation map
void computeHeightAndNormalVariation();
};
#endif