2#include <gdal/ogr_feature.h>
14 static OGRFieldType
fromTypeIndex(
const std::type_index & type)
noexcept {
15 if (
typeid(
double) == type ||
typeid(
float) == type)
17 if(
typeid(
int) == type)
19 if (
typeid(
long) == type ||
typeid(
size_t) == type)
25 static void setFieldValue(OGRFeature * feature,
const std::string & fieldName,
const T & value)
noexcept {
26 const char * name = fieldName.c_str();
27 if constexpr(std::same_as<T,int>)
28 feature->SetField(name, value);
29 else if constexpr(std::integral<T>)
30 feature->SetField(name, GIntBig((
static_cast<int64_t
>(value))));
31 else if constexpr (std::floating_point<T>)
32 feature->SetField(name,
static_cast<double>(value));
33 else if constexpr (std::same_as<T,std::string>)
34 feature->SetField(name, value.c_str());
36 feature->SetField(name, value);
41 const uint64_t SHP_MAX_VALUE = 1000000000000000000ULL;
Static Adaptor class for OGRFields.
Definition OGRFieldAdapter.hpp:12
static void setFieldValue(OGRFeature *feature, const std::string &fieldName, const T &value) noexcept
Definition OGRFieldAdapter.hpp:25
static OGRFieldType fromTypeIndex(const std::type_index &type) noexcept
Definition OGRFieldAdapter.hpp:14
static auto normalize(const ValueType value, BoundType upperBound)
Normalizes any value into the range: [0,upperBound)
Definition Normalize.hpp:19
Definition BFSClustering.hpp:5
uint64_t normalizeToShpFileIntField(std::integral auto number) noexcept
Definition OGRFieldAdapter.hpp:40