-
Notifications
You must be signed in to change notification settings - Fork 200
Expand file tree
/
Copy pathgeo.h
More file actions
79 lines (58 loc) · 2.01 KB
/
geo.h
File metadata and controls
79 lines (58 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include "array.h"
#include "column.h"
#include "numeric.h"
#include "tuple.h"
namespace clickhouse {
template <typename NestedColumnType, Type::Code type_code>
class ColumnGeo : public Column {
public:
using ValueType = typename NestedColumnType::ValueType;
ColumnGeo();
explicit ColumnGeo(ColumnRef data);
/// Appends one element to the end of column.
template <typename T = ValueType>
void Append(const T& value) {
data_->Append(value);
}
/// Returns element at given row number.
const ValueType At(size_t n) const;
/// Returns element at given row number.
inline const ValueType operator[](size_t n) const { return At(n); }
public:
/// Increase the capacity of the column for large block insertion.
void Reserve(size_t new_cap) override;
/// Appends content of given column to the end of current one.
void Append(ColumnRef column) override;
/// Loads column data from input stream.
bool LoadBody(InputStream* input, size_t rows) override;
/// Saves column data to output stream.
void SaveBody(OutputStream* output) override;
/// Clear column data .
void Clear() override;
/// Returns count of rows in the column.
size_t Size() const override;
/// Makes slice of the current column.
ColumnRef Slice(size_t begin, size_t len) const override;
ColumnRef CloneEmpty() const override;
void Swap(Column& other) override;
private:
std::shared_ptr<NestedColumnType> data_;
};
// /**
// * Represents a Point column.
// */
using ColumnPoint = ColumnGeo<ColumnTupleT<ColumnFloat64, ColumnFloat64>, Type::Code::Point>;
/**
* Represents a Ring column.
*/
using ColumnRing = ColumnGeo<ColumnArrayT<ColumnPoint>, Type::Code::Ring>;
/**
* Represents a Polygon column.
*/
using ColumnPolygon = ColumnGeo<ColumnArrayT<ColumnRing>, Type::Code::Polygon>;
/**
* Represents a MultiPolygon column.
*/
using ColumnMultiPolygon = ColumnGeo<ColumnArrayT<ColumnPolygon>, Type::Code::MultiPolygon>;
} // namespace clickhouse