103 CPLErr Init(
const char *pszText, std::optional<double> noDataValue,
111 void AddMapping(
const Interval &interval, std::optional<double> dfDstVal);
119 double Reclassify(
double srcVal,
bool &bFoundInterval)
const;
127 m_defaultPassThrough = value;
134 m_defaultValue = value;
150 std::vector<std::pair<Interval, std::optional<double>>>
151 m_aoIntervalMappings{};
154 std::optional<double> m_NaNValue{};
157 std::optional<double> m_defaultValue{};
160 bool m_defaultPassThrough{
false};
Class to manage reclassification of pixel values.
Definition vrtreclassifier.h:30
void SetNaNValue(double value)
Sets a value for an input NaN value.
Definition vrtreclassifier.h:139
static constexpr char MAPPING_INTERVAL_SEP_CHAR
Character separating elements in a list of mapping.
Definition vrtreclassifier.h:33
void SetDefaultValue(double value)
Sets a default value for any value not matched by any interval.
Definition vrtreclassifier.h:132
void AddMapping(const Interval &interval, std::optional< double > dfDstVal)
Set a mapping between an interval and (optionally) a destination value.
Definition vrtreclassifier.cpp:196
double Reclassify(double srcVal, bool &bFoundInterval) const
Reclassify a value.
Definition vrtreclassifier.cpp:398
CPLErr Finalize()
Prepare reclassifier for use.
Definition vrtreclassifier.cpp:166
void SetDefaultPassThrough(bool value)
If true, values not matched by any interval will be returned unmodified.
Definition vrtreclassifier.h:125
static constexpr char MAPPING_FROMTO_SEP_CHAR
Character separating source interval from target value.
Definition vrtreclassifier.h:36
CPLErr Init(const char *pszText, std::optional< double > noDataValue, GDALDataType eBufType)
Initialize a Reclassifier from text.
Definition vrtreclassifier.cpp:202
CPL error handling services.
CPLErr
Error category.
Definition cpl_error.h:37
Public (C callable) GDAL entry points.
GDALDataType
Definition gdal.h:48
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition ogrsf_frmts.h:478
Internal struct to hold an interval of values to be reclassified.
Definition vrtreclassifier.h:42
bool Contains(double x) const
Returns true if the interval contains a value.
Definition vrtreclassifier.h:69
bool IsConstant() const
Returns true of the interval represents a single value [x,x].
Definition vrtreclassifier.h:63
void SetToConstant(double dfVal)
Set the interval to represent a single value [x,x].
Definition vrtreclassifier.cpp:160
CPLErr Parse(const char *pszText, char **end)
Parse an interval.
Definition vrtreclassifier.cpp:33
bool Overlaps(const Interval &other) const
Returns true if the intervals overlap.
Definition vrtreclassifier.cpp:23
double dfMax
maximum value of range
Definition vrtreclassifier.h:47
double dfMin
minimum value of range
Definition vrtreclassifier.h:44