Agroeye  1.0
Geometries.h
Go to the documentation of this file.
1 #ifndef GEOMETRIES_H
2 #define GEOMETRIES_H
3 
4 #include <array>
5 #include <memory>
6 #include <cstdlib>
7 
8 #include <sqlite3.h>
9 #include <spatialite/gaiageo.h>
10 #include <spatialite.h>
11 
12 #include "SpatialiteBlob.h"
13 #include "Raster.h"
14 #include "RasterData.h"
15 
16 namespace agroeye {
17 namespace general {
18 namespace geometry {
19 
22 
24 using RasterDataRange = std::array<std::pair<double, double>, 4>;
26 
35 public:
41 
50  SpatialitePolygon(Raster& raster, int srid);
51 
58  SpatialiteBlobWkb getSpatialiteBlob(const RasterDataGroup& rasterData) const;
59 
60 private:
61  RasterDataRange transformCorners(const RasterDataRange& corners) const;
62  void updateRing(const RasterDataRange& corners) const;
63  SpatialiteBlobWkb createBlob() const;
64 
65 
66  double x_position(double x) const;
67  double y_position(double y) const;
68 
69  double x_min;
70  double y_min;
71  double x_step;
72  double y_step;
73 
74  int srid;
75 
76  std::unique_ptr<gaiaGeomColl, void(*)(gaiaGeomColl*)> geomColl {nullptr, [] (gaiaGeomColl* p){gaiaFreeGeomColl(p);}};
77 };
78 
79 
80 } // namespace geometry
81 } // namespace general
82 } // namespace agroye
83 
84 #endif
Class encapsulating Raster file object.
Definition: Raster.h:32
Encapsulation of read data from a couple of bands from one RasterDataGroup Also provides convinient b...
Definition: RasterDataGroup.h:18
Definition: SpatialiteBlob.h:10
Class converting raster information into Spatialite Polygon.
Definition: Geometries.h:34
Definition: ContainerMath.h:11
SpatialitePolygon()
Simple constructor Exists only to allow creation classes with SpatialitePolygon as member...
Definition: Geometries.h:40
SpatialiteBlobWkb getSpatialiteBlob(const RasterDataGroup &rasterData) const
Converts given RasterData into Spatialite BLOB WKB object.
Definition: Geometries.cpp:34