aboutsummaryrefslogtreecommitdiff
path: root/src/grids.cpp
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.cpp
parent916a92062ffa2f2b59007047fae2176bbb463ca3 (diff)
downloadPROJ-22792cd55ba41ffadb248c246cc871612a5139c1.tar.gz
PROJ-22792cd55ba41ffadb248c246cc871612a5139c1.zip
Add a Grid base class for HorizontalShiftGrid and VerticalShiftGrid
Diffstat (limited to 'src/grids.cpp')
-rw-r--r--src/grids.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/grids.cpp b/src/grids.cpp
index 54dae555..7d19b1f7 100644
--- a/src/grids.cpp
+++ b/src/grids.cpp
@@ -70,13 +70,24 @@ bool ExtentAndRes::fullWorldLongitude() const {
// ---------------------------------------------------------------------------
+Grid::Grid(int widthIn, int heightIn, const ExtentAndRes &extentIn)
+ : m_width(widthIn), m_height(heightIn), m_extent(extentIn) {}
+
+// ---------------------------------------------------------------------------
+
+Grid::~Grid() = default;
+
+// ---------------------------------------------------------------------------
+
VerticalShiftGrid::VerticalShiftGrid(int widthIn, int heightIn,
const ExtentAndRes &extentIn)
- : m_width(widthIn), m_height(heightIn), m_extent(extentIn) {}
+ : Grid(widthIn, heightIn, extentIn) {}
// ---------------------------------------------------------------------------
-VerticalShiftGrid::~VerticalShiftGrid() = default;
+bool VerticalShiftGrid::isNodata(float /*val*/, double /* multiplier */) const {
+ return false;
+}
// ---------------------------------------------------------------------------
@@ -98,6 +109,7 @@ class NullVerticalShiftGrid : public VerticalShiftGrid {
public:
NullVerticalShiftGrid() : VerticalShiftGrid(3, 3, globalExtent()) {}
+ bool isNullGrid() const override { return true; }
bool valueAt(int, int, float &out) const override;
bool isNodata(float, double) const override { return false; }
};
@@ -306,7 +318,7 @@ const VerticalShiftGrid *VerticalShiftGridSet::gridAt(double lon,
HorizontalShiftGrid::HorizontalShiftGrid(int widthIn, int heightIn,
const ExtentAndRes &extentIn)
- : m_width(widthIn), m_height(heightIn), m_extent(extentIn) {}
+ : Grid(widthIn, heightIn, extentIn) {}
// ---------------------------------------------------------------------------