mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
Linting
This commit is contained in:
parent
bcc28cff3d
commit
1084ee8c49
@ -32,56 +32,6 @@ namespace ErrorCodes
|
||||
extern const int ILLEGAL_COLUMN;
|
||||
}
|
||||
|
||||
class GeoPolygonContainer {
|
||||
private:
|
||||
// Store the polygon data
|
||||
std::vector<LatLng> mainLoopVerts;
|
||||
std::vector<std::vector<LatLng>> holeVerts;
|
||||
|
||||
// Temporary storage for C-style structs
|
||||
mutable GeoLoop mutableMainLoop;
|
||||
mutable GeoPolygon mutablePolygon;
|
||||
mutable std::vector<GeoLoop> mutableHoles;
|
||||
|
||||
public:
|
||||
// Constructor to create from C++ data
|
||||
GeoPolygonContainer(const std::vector<LatLng>& mainLoop,
|
||||
const std::vector<std::vector<LatLng>>& holes = {})
|
||||
: mainLoopVerts(mainLoop), holeVerts(holes) {}
|
||||
|
||||
// Method to get C-style GeoPolygon pointer
|
||||
const GeoPolygon* unwrap() const {
|
||||
// Prepare main loop
|
||||
mutableMainLoop = {
|
||||
static_cast<int>(mainLoopVerts.size()),
|
||||
const_cast<LatLng*>(mainLoopVerts.data())
|
||||
};
|
||||
|
||||
// Prepare holes
|
||||
mutableHoles.clear();
|
||||
mutableHoles.reserve(holeVerts.size());
|
||||
for (const auto& hole : holeVerts) {
|
||||
mutableHoles.push_back({
|
||||
static_cast<int>(hole.size()),
|
||||
const_cast<LatLng*>(hole.data())
|
||||
});
|
||||
}
|
||||
|
||||
// Prepare full polygon
|
||||
mutablePolygon = {
|
||||
mutableMainLoop,
|
||||
static_cast<int>(mutableHoles.size()),
|
||||
mutableHoles.data()
|
||||
};
|
||||
|
||||
return &mutablePolygon;
|
||||
}
|
||||
|
||||
// Additional utility methods
|
||||
size_t size() const { return mainLoopVerts.size(); }
|
||||
bool empty() const { return mainLoopVerts.empty(); }
|
||||
};
|
||||
|
||||
class FunctionH3PolygonToCells : public IFunction
|
||||
{
|
||||
public:
|
||||
@ -212,6 +162,61 @@ public:
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
class GeoPolygonContainer
|
||||
{
|
||||
private:
|
||||
// Store the polygon data
|
||||
std::vector<LatLng> mainLoopVerts;
|
||||
std::vector<std::vector<LatLng>> holeVerts;
|
||||
|
||||
// Temporary storage for C-style structs
|
||||
mutable GeoLoop mutableMainLoop;
|
||||
mutable GeoPolygon mutablePolygon;
|
||||
mutable std::vector<GeoLoop> mutableHoles;
|
||||
|
||||
public:
|
||||
// Constructor to create from C++ data
|
||||
GeoPolygonContainer(const std::vector<LatLng>& mainLoop,
|
||||
const std::vector<std::vector<LatLng>>& holes = {})
|
||||
: mainLoopVerts(mainLoop), holeVerts(holes) {}
|
||||
|
||||
// Method to get C-style GeoPolygon pointer
|
||||
const GeoPolygon* unwrap() const
|
||||
{
|
||||
// Prepare main loop
|
||||
mutableMainLoop = {
|
||||
static_cast<int>(mainLoopVerts.size()),
|
||||
const_cast<LatLng*>(mainLoopVerts.data())
|
||||
};
|
||||
|
||||
// Prepare holes
|
||||
mutableHoles.clear();
|
||||
mutableHoles.reserve(holeVerts.size());
|
||||
for (const auto& hole : holeVerts)
|
||||
{
|
||||
mutableHoles.push_back({
|
||||
static_cast<int>(hole.size()),
|
||||
const_cast<LatLng*>(hole.data())
|
||||
});
|
||||
}
|
||||
|
||||
// Prepare full polygon
|
||||
mutablePolygon = {
|
||||
mutableMainLoop,
|
||||
static_cast<int>(mutableHoles.size()),
|
||||
mutableHoles.data()
|
||||
};
|
||||
|
||||
return &mutablePolygon;
|
||||
}
|
||||
|
||||
// Additional utility methods
|
||||
size_t size() const { return mainLoopVerts.size(); }
|
||||
bool empty() const { return mainLoopVerts.empty(); }
|
||||
};
|
||||
};
|
||||
|
||||
REGISTER_FUNCTION(H3PolygonToCells)
|
||||
|
Loading…
Reference in New Issue
Block a user