aboutsummaryrefslogtreecommitdiff
path: root/src/grids.hpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-12-06 18:03:14 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-12-06 21:35:15 +0100
commit22792cd55ba41ffadb248c246cc871612a5139c1 (patch)
tree1ff8fa7fd812fea2ae53792b5488a90f6418095c /src/grids.hpp
parent916a92062ffa2f2b59007047fae2176bbb463ca3 (diff)
downloadPROJ-22792cd55ba41ffadb248c246cc871612a5139c1.tar.gz
PROJ-22792cd55ba41ffadb248c246cc871612a5139c1.zip
Add a Grid base class for HorizontalShiftGrid and VerticalShiftGrid
Diffstat (limited to 'src/grids.hpp')
-rw-r--r--src/grids.hpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/grids.hpp b/src/grids.hpp
index 975f7716..65bf502b 100644
--- a/src/grids.hpp
+++ b/src/grids.hpp
@@ -49,26 +49,36 @@ struct ExtentAndRes {
// ---------------------------------------------------------------------------
-class VerticalShiftGrid {
+class Grid {
protected:
int m_width;
int m_height;
ExtentAndRes m_extent;
- std::vector<std::unique_ptr<VerticalShiftGrid>> m_children{};
+
+ Grid(int widthIn, int heightIn, const ExtentAndRes &extentIn);
public:
- VerticalShiftGrid(int widthIn, int heightIn, const ExtentAndRes &extentIn);
- virtual ~VerticalShiftGrid();
+ virtual ~Grid();
int width() const { return m_width; }
int height() const { return m_height; }
const ExtentAndRes &extentAndRes() const { return m_extent; }
+ virtual bool isNullGrid() const { return false; }
+};
+
+// ---------------------------------------------------------------------------
+
+class VerticalShiftGrid : public Grid {
+ protected:
+ std::vector<std::unique_ptr<VerticalShiftGrid>> m_children{};
+
+ public:
+ VerticalShiftGrid(int widthIn, int heightIn, const ExtentAndRes &extentIn);
+
const VerticalShiftGrid *gridAt(double lon, double lat) const;
- virtual bool isNodata(float /*val*/, double /* multiplier */) const {
- return false;
- }
+ virtual bool isNodata(float /*val*/, double /* multiplier */) const;
// x = 0 is western-most column, y = 0 is southern-most line
virtual bool valueAt(int x, int y, float &out) const = 0;
@@ -99,26 +109,17 @@ class VerticalShiftGridSet {
// ---------------------------------------------------------------------------
-class HorizontalShiftGrid {
+class HorizontalShiftGrid : public Grid {
protected:
- int m_width;
- int m_height;
- ExtentAndRes m_extent;
std::vector<std::unique_ptr<HorizontalShiftGrid>> m_children{};
public:
HorizontalShiftGrid(int widthIn, int heightIn,
const ExtentAndRes &extentIn);
- virtual ~HorizontalShiftGrid();
-
- int width() const { return m_width; }
- int height() const { return m_height; }
- const ExtentAndRes &extentAndRes() const { return m_extent; }
+ ~HorizontalShiftGrid() override;
const HorizontalShiftGrid *gridAt(double lon, double lat) const;
- virtual bool isNullGrid() const { return false; }
-
// x = 0 is western-most column, y = 0 is southern-most line
virtual bool valueAt(int x, int y, float &lonShift,
float &latShift) const = 0;