Skip to content

Commit 9aef365

Browse files
committed
Fix format
1 parent 14a5ff7 commit 9aef365

28 files changed

+582
-651
lines changed

spatial/include/spatial/gdal/functions/raster_agg.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ struct RasterAggBinaryOperation {
7676
}
7777

7878
template <class INPUT_TYPE, class OPTS_TYPE, class STATE, class OP>
79-
static void ConstantOperation(STATE &state, const INPUT_TYPE &input, const OPTS_TYPE &opts, AggregateBinaryInput &agg, idx_t) {
79+
static void ConstantOperation(STATE &state, const INPUT_TYPE &input, const OPTS_TYPE &opts,
80+
AggregateBinaryInput &agg, idx_t) {
8081
Operation<INPUT_TYPE, OPTS_TYPE, STATE, OP>(state, input, opts, agg);
8182
}
8283

@@ -92,7 +93,7 @@ struct RasterAggBindData : public FunctionData {
9293
std::vector<std::string> options;
9394

9495
explicit RasterAggBindData(ClientContext &context, std::vector<std::string> options)
95-
: context(context), options(options) {
96+
: context(context), options(options) {
9697
}
9798

9899
unique_ptr<FunctionData> Copy() const override {

spatial/include/spatial/gdal/raster/raster.hpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class Raster {
6060
bool GetValue(double &value, int32_t band_num, int32_t col, int32_t row) const;
6161

6262
public:
63-
6463
//! Returns the geometric X and Y (longitude and latitude) given a column and row
6564
static bool RasterToWorldCoord(PointXY &point, double matrix[], int32_t col, int32_t row);
6665

@@ -76,8 +75,7 @@ class Raster {
7675
const std::vector<std::string> &options = std::vector<std::string>());
7776

7877
//! Returns a raster that is clipped by the input geometry
79-
static GDALDataset *Clip(GDALDataset *dataset,
80-
const geometry_t &geometry,
78+
static GDALDataset *Clip(GDALDataset *dataset, const geometry_t &geometry,
8179
const std::vector<std::string> &options = std::vector<std::string>());
8280

8381
//! Get the last error message.

spatial/include/spatial/gdal/raster/raster_factory.hpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,21 @@ namespace gdal {
1111
//! Does not take ownership of the pointer.
1212
class RasterFactory {
1313
public:
14-
1514
//! Given a file path, returns a GDALDataset
1615
static GDALDataset *FromFile(const std::string &file_path,
1716
const std::vector<std::string> &allowed_drivers = std::vector<std::string>(),
1817
const std::vector<std::string> &open_options = std::vector<std::string>(),
1918
const std::vector<std::string> &sibling_files = std::vector<std::string>());
2019

2120
//! Writes a GDALDataset to a file path
22-
static bool WriteFile(GDALDataset *dataset,
23-
const std::string &file_path,
24-
const std::string &driver_name = "COG",
21+
static bool WriteFile(GDALDataset *dataset, const std::string &file_path, const std::string &driver_name = "COG",
2522
const std::vector<std::string> &write_options = std::vector<std::string>());
2623

2724
//! Transforms a vector of strings as a vector of const char pointers.
2825
static std::vector<char const *> FromVectorOfStrings(const std::vector<std::string> &input);
2926
//! Transforms a map of params as a vector of const char pointers.
30-
static std::vector<char const *> FromNamedParameters(const named_parameter_map_t &input, const std::string &keyname);
27+
static std::vector<char const *> FromNamedParameters(const named_parameter_map_t &input,
28+
const std::string &keyname);
3129
};
3230

3331
} // namespace gdal

spatial/include/spatial/gdal/types.hpp

+23-26
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,30 @@ namespace spatial {
66
namespace gdal {
77

88
//! Supported Pixel data types (GDALDataType).
9-
typedef enum
10-
{
11-
Unknown = 0, /**< Unknown or unspecified type */
12-
Byte = 1, /**< Eight bit unsigned integer */
13-
Int8 = 14, /**< 8-bit signed integer */
14-
UInt16 = 2, /**< Sixteen bit unsigned integer */
15-
Int16 = 3, /**< Sixteen bit signed integer */
16-
UInt32 = 4, /**< Thirty two bit unsigned integer */
17-
Int32 = 5, /**< Thirty two bit signed integer */
18-
UInt64 = 12, /**< 64 bit unsigned integer */
19-
Int64 = 13, /**< 64 bit signed integer */
20-
Float32 = 6, /**< Thirty two bit floating point */
21-
Float64 = 7, /**< Sixty four bit floating point */
22-
CInt16 = 8, /**< Complex Int16 */
23-
CInt32 = 9, /**< Complex Int32 */
24-
CFloat32 = 10, /**< Complex Float32 */
25-
CFloat64 = 11, /**< Complex Float64 */
26-
TypeCount = 15 /**< maximum type # + 1 */
9+
typedef enum {
10+
Unknown = 0, /**< Unknown or unspecified type */
11+
Byte = 1, /**< Eight bit unsigned integer */
12+
Int8 = 14, /**< 8-bit signed integer */
13+
UInt16 = 2, /**< Sixteen bit unsigned integer */
14+
Int16 = 3, /**< Sixteen bit signed integer */
15+
UInt32 = 4, /**< Thirty two bit unsigned integer */
16+
Int32 = 5, /**< Thirty two bit signed integer */
17+
UInt64 = 12, /**< 64 bit unsigned integer */
18+
Int64 = 13, /**< 64 bit signed integer */
19+
Float32 = 6, /**< Thirty two bit floating point */
20+
Float64 = 7, /**< Sixty four bit floating point */
21+
CInt16 = 8, /**< Complex Int16 */
22+
CInt32 = 9, /**< Complex Int32 */
23+
CFloat32 = 10, /**< Complex Float32 */
24+
CFloat64 = 11, /**< Complex Float64 */
25+
TypeCount = 15 /**< maximum type # + 1 */
2726
} PixelType;
2827

2928
//! Returns the name of given PixelType
30-
std::string GetPixelTypeName(const PixelType& pixel_type);
29+
std::string GetPixelTypeName(const PixelType &pixel_type);
3130

3231
//! Supported Types of color interpretation for raster bands (GDALColorInterp).
33-
typedef enum
34-
{
32+
typedef enum {
3533
Undefined = 0, /**< Undefined */
3634
GrayIndex = 1, /**< Greyscale */
3735
PaletteIndex = 2, /**< Paletted (see associated color table) */
@@ -52,11 +50,10 @@ typedef enum
5250
} ColorInterp;
5351

5452
//! Returns the name of given ColorInterp
55-
std::string GetColorInterpName(const ColorInterp& color_interp);
53+
std::string GetColorInterpName(const ColorInterp &color_interp);
5654

5755
//! Supported Warp Resampling Algorithm (GDALResampleAlg).
58-
typedef enum
59-
{
56+
typedef enum {
6057
NearestNeighbour = 0, /**< Nearest neighbour (select on one input pixel) */
6158
Bilinear = 1, /**< Bilinear (2x2 kernel) */
6259
Cubic = 2, /**< Cubic Convolution Approximation (4x4 kernel) */
@@ -65,7 +62,7 @@ typedef enum
6562
Average = 5, /**< Average (computes the weighted average of all non-NODATA contributing pixels) */
6663
Mode = 6, /**< Mode (selects the value which appears most often of all the sampled points) */
6764
Max = 8, /**< Max (selects maximum of all non-NODATA contributing pixels) */
68-
Min = 9, /**< Min (selects minimum of all non-NODATA contributing pixels) */
65+
Min = 9, /**< Min (selects minimum of all non-NODATA contributing pixels) */
6966
Med = 10, /**< Med (selects median of all non-NODATA contributing pixels) */
7067
Q1 = 11, /**< Q1 (selects first quartile of all non-NODATA contributing pixels) */
7168
Q3 = 12, /**< Q3 (selects third quartile of all non-NODATA contributing pixels) */
@@ -74,7 +71,7 @@ typedef enum
7471
} ResampleAlg;
7572

7673
//! Returns the name of given ResampleAlg
77-
std::string GetResampleAlgName(const ResampleAlg& resample_alg);
74+
std::string GetResampleAlgName(const ResampleAlg &resample_alg);
7875

7976
//! Position of a cell in a Raster (upper left corner as column and row)
8077
struct RasterCoord {

spatial/src/spatial/gdal/functions/aggregate/raster_agg.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ unique_ptr<FunctionData> BindRasterAggOperation(ClientContext &context, Aggregat
3232
options.push_back(option);
3333
}
3434
} else {
35-
throw BinderException(StringUtil::Format(
36-
"raster_agg: Unknown argument '%s'", arg->alias.c_str()));
35+
throw BinderException(StringUtil::Format("raster_agg: Unknown argument '%s'", arg->alias.c_str()));
3736
}
3837
}
3938

spatial/src/spatial/gdal/functions/aggregate/st_mosaic_agg.cpp

+5-10
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ struct MosaicAggUnaryOperation : RasterAggUnaryOperation {
5151
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
5252
RasterMosaicFunction(state, target, finalize_data);
5353
}
54-
5554
};
5655

5756
struct MosaicAggBinaryOperation : RasterAggBinaryOperation {
@@ -60,7 +59,6 @@ struct MosaicAggBinaryOperation : RasterAggBinaryOperation {
6059
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
6160
RasterMosaicFunction(state, target, finalize_data);
6261
}
63-
6462
};
6563

6664
//------------------------------------------------------------------------
@@ -92,9 +90,7 @@ static constexpr const char *DOC_EXAMPLE = R"(
9290
;
9391
)";
9492

95-
static constexpr DocTag DOC_TAGS[] = {
96-
{"ext", "spatial"}, {"category", "aggregation"}
97-
};
93+
static constexpr DocTag DOC_TAGS[] = {{"ext", "spatial"}, {"category", "aggregation"}};
9894

9995
//------------------------------------------------------------------------
10096
// Register
@@ -105,15 +101,14 @@ void GdalAggregateFunctions::RegisterStRasterMosaicAgg(DatabaseInstance &db) {
105101
AggregateFunctionSet st_mosaic_agg("ST_RasterMosaic_Agg");
106102

107103
auto fun01 = AggregateFunction::UnaryAggregate<RasterAggState, uintptr_t, uintptr_t, MosaicAggUnaryOperation>(
108-
GeoTypes::RASTER(), GeoTypes::RASTER()
109-
);
104+
GeoTypes::RASTER(), GeoTypes::RASTER());
110105
fun01.bind = BindRasterAggOperation;
111106

112107
st_mosaic_agg.AddFunction(fun01);
113108

114-
auto fun02 = AggregateFunction::BinaryAggregate<RasterAggState, uintptr_t, list_entry_t, uintptr_t, MosaicAggBinaryOperation>(
115-
GeoTypes::RASTER(), LogicalType::LIST(LogicalType::VARCHAR), GeoTypes::RASTER()
116-
);
109+
auto fun02 = AggregateFunction::BinaryAggregate<RasterAggState, uintptr_t, list_entry_t, uintptr_t,
110+
MosaicAggBinaryOperation>(
111+
GeoTypes::RASTER(), LogicalType::LIST(LogicalType::VARCHAR), GeoTypes::RASTER());
117112
fun02.bind = BindRasterAggOperation;
118113

119114
st_mosaic_agg.AddFunction(fun02);

spatial/src/spatial/gdal/functions/aggregate/st_union_agg.cpp

+5-10
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ struct UnionAggUnaryOperation : RasterAggUnaryOperation {
5555
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
5656
RasterUnionFunction(state, target, finalize_data);
5757
}
58-
5958
};
6059

6160
struct UnionAggBinaryOperation : RasterAggBinaryOperation {
@@ -64,7 +63,6 @@ struct UnionAggBinaryOperation : RasterAggBinaryOperation {
6463
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
6564
RasterUnionFunction(state, target, finalize_data);
6665
}
67-
6866
};
6967

7068
//------------------------------------------------------------------------
@@ -96,9 +94,7 @@ static constexpr const char *DOC_EXAMPLE = R"(
9694
;
9795
)";
9896

99-
static constexpr DocTag DOC_TAGS[] = {
100-
{"ext", "spatial"}, {"category", "aggregation"}
101-
};
97+
static constexpr DocTag DOC_TAGS[] = {{"ext", "spatial"}, {"category", "aggregation"}};
10298

10399
//------------------------------------------------------------------------
104100
// Register
@@ -109,15 +105,14 @@ void GdalAggregateFunctions::RegisterStRasterUnionAgg(DatabaseInstance &db) {
109105
AggregateFunctionSet st_union_agg("ST_RasterUnion_Agg");
110106

111107
auto fun01 = AggregateFunction::UnaryAggregate<RasterAggState, uintptr_t, uintptr_t, UnionAggUnaryOperation>(
112-
GeoTypes::RASTER(), GeoTypes::RASTER()
113-
);
108+
GeoTypes::RASTER(), GeoTypes::RASTER());
114109
fun01.bind = BindRasterAggOperation;
115110

116111
st_union_agg.AddFunction(fun01);
117112

118-
auto fun02 = AggregateFunction::BinaryAggregate<RasterAggState, uintptr_t, list_entry_t, uintptr_t, UnionAggBinaryOperation>(
119-
GeoTypes::RASTER(), LogicalType::LIST(LogicalType::VARCHAR), GeoTypes::RASTER()
120-
);
113+
auto fun02 =
114+
AggregateFunction::BinaryAggregate<RasterAggState, uintptr_t, list_entry_t, uintptr_t, UnionAggBinaryOperation>(
115+
GeoTypes::RASTER(), LogicalType::LIST(LogicalType::VARCHAR), GeoTypes::RASTER());
121116
fun02.bind = BindRasterAggOperation;
122117

123118
st_union_agg.AddFunction(fun02);

spatial/src/spatial/gdal/functions/cast.cpp

+10-15
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ namespace gdal {
1919
//------------------------------------------------------------------------------
2020

2121
static bool RasterToVarcharCast(Vector &source, Vector &result, idx_t count, CastParameters &parameters) {
22-
UnaryExecutor::Execute<uintptr_t, string_t>(source, result, count, [&](uintptr_t &input) {
23-
return string_t("RASTER");
24-
});
22+
UnaryExecutor::Execute<uintptr_t, string_t>(source, result, count,
23+
[&](uintptr_t &input) { return string_t("RASTER"); });
2524
return true;
2625
}
2726

@@ -62,24 +61,20 @@ static bool RasterCoordToVarcharCast(Vector &source, Vector &result, idx_t count
6261

6362
void GdalCastFunctions::Register(DatabaseInstance &db) {
6463

65-
ExtensionUtil::RegisterCastFunction(db, GeoTypes::RASTER(), LogicalType::VARCHAR,
66-
RasterToVarcharCast, 1);
64+
ExtensionUtil::RegisterCastFunction(db, GeoTypes::RASTER(), LogicalType::VARCHAR, RasterToVarcharCast, 1);
6765

68-
ExtensionUtil::RegisterCastFunction(db, GeoTypes::RASTER(), GeoTypes::GEOMETRY(),
69-
BoundCastInfo(RasterToGeometryCast, nullptr,
70-
GeometryFunctionLocalState::InitCast), 1);
66+
ExtensionUtil::RegisterCastFunction(
67+
db, GeoTypes::RASTER(), GeoTypes::GEOMETRY(),
68+
BoundCastInfo(RasterToGeometryCast, nullptr, GeometryFunctionLocalState::InitCast), 1);
7169

7270
// POINTER -> RASTER is implicitly castable
73-
ExtensionUtil::RegisterCastFunction(db, LogicalType::POINTER, GeoTypes::RASTER(),
74-
DefaultCasts::ReinterpretCast, 1);
71+
ExtensionUtil::RegisterCastFunction(db, LogicalType::POINTER, GeoTypes::RASTER(), DefaultCasts::ReinterpretCast, 1);
7572

7673
// RASTER -> POINTER is implicitly castable
77-
ExtensionUtil::RegisterCastFunction(db, GeoTypes::RASTER(), LogicalType::POINTER,
78-
DefaultCasts::ReinterpretCast, 1);
79-
80-
ExtensionUtil::RegisterCastFunction(db, GeoTypes::RASTER_COORD(), LogicalType::VARCHAR,
81-
RasterCoordToVarcharCast, 1);
74+
ExtensionUtil::RegisterCastFunction(db, GeoTypes::RASTER(), LogicalType::POINTER, DefaultCasts::ReinterpretCast, 1);
8275

76+
ExtensionUtil::RegisterCastFunction(db, GeoTypes::RASTER_COORD(), LogicalType::VARCHAR, RasterCoordToVarcharCast,
77+
1);
8378
};
8479

8580
} // namespace gdal

0 commit comments

Comments
 (0)