mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-06 02:15:41 +02:00
Make indent to bring flatgeobuf into line with tippecanoe style
This commit is contained in:
+15
-9
@@ -19,8 +19,7 @@ struct NodeItem {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// copied from https://github.com/flatgeobuf/flatgeobuf/blob/master/src/cpp/packedrtree.cpp#L365
|
// copied from https://github.com/flatgeobuf/flatgeobuf/blob/master/src/cpp/packedrtree.cpp#L365
|
||||||
uint64_t PackedRTreeSize(const uint64_t numItems, const uint16_t nodeSize)
|
uint64_t PackedRTreeSize(const uint64_t numItems, const uint16_t nodeSize) {
|
||||||
{
|
|
||||||
if (nodeSize < 2)
|
if (nodeSize < 2)
|
||||||
throw std::invalid_argument("Node size must be at least 2");
|
throw std::invalid_argument("Node size must be at least 2");
|
||||||
if (numItems == 0)
|
if (numItems == 0)
|
||||||
@@ -61,7 +60,8 @@ drawvec readLinePart(const FlatGeobuf::Geometry *geometry) {
|
|||||||
projection->project(xy->Get(i), xy->Get(i + 1), 32, &x, &y);
|
projection->project(xy->Get(i), xy->Get(i + 1), 32, &x, &y);
|
||||||
if (i == 0 || (ends != NULL && current_end < ends->size() && i == ends->Get(current_end) * 2)) {
|
if (i == 0 || (ends != NULL && current_end < ends->size() && i == ends->Get(current_end) * 2)) {
|
||||||
dv.push_back(draw(VT_MOVETO, x, y));
|
dv.push_back(draw(VT_MOVETO, x, y));
|
||||||
if (i > 0) current_end++;
|
if (i > 0)
|
||||||
|
current_end++;
|
||||||
} else {
|
} else {
|
||||||
dv.push_back(draw(VT_LINETO, x, y));
|
dv.push_back(draw(VT_LINETO, x, y));
|
||||||
}
|
}
|
||||||
@@ -71,17 +71,21 @@ drawvec readLinePart(const FlatGeobuf::Geometry *geometry) {
|
|||||||
|
|
||||||
drawvec readGeometry(const FlatGeobuf::Geometry *geometry, FlatGeobuf::GeometryType h_geometry_type) {
|
drawvec readGeometry(const FlatGeobuf::Geometry *geometry, FlatGeobuf::GeometryType h_geometry_type) {
|
||||||
FlatGeobuf::GeometryType geometry_type = h_geometry_type;
|
FlatGeobuf::GeometryType geometry_type = h_geometry_type;
|
||||||
if (h_geometry_type == FlatGeobuf::GeometryType_Unknown) geometry_type = geometry->type();
|
if (h_geometry_type == FlatGeobuf::GeometryType_Unknown)
|
||||||
|
geometry_type = geometry->type();
|
||||||
|
|
||||||
if (geometry_type == FlatGeobuf::GeometryType_Point) {
|
if (geometry_type == FlatGeobuf::GeometryType_Point) {
|
||||||
return readPoints(geometry);
|
return readPoints(geometry);
|
||||||
} if (geometry_type == FlatGeobuf::GeometryType_MultiPoint) {
|
}
|
||||||
|
if (geometry_type == FlatGeobuf::GeometryType_MultiPoint) {
|
||||||
return readPoints(geometry);
|
return readPoints(geometry);
|
||||||
} if (geometry_type == FlatGeobuf::GeometryType_LineString) {
|
}
|
||||||
|
if (geometry_type == FlatGeobuf::GeometryType_LineString) {
|
||||||
return readLinePart(geometry);
|
return readLinePart(geometry);
|
||||||
} else if (h_geometry_type == FlatGeobuf::GeometryType_MultiLineString) {
|
} else if (h_geometry_type == FlatGeobuf::GeometryType_MultiLineString) {
|
||||||
return readLinePart(geometry);
|
return readLinePart(geometry);
|
||||||
} if (geometry_type == FlatGeobuf::GeometryType_Polygon) {
|
}
|
||||||
|
if (geometry_type == FlatGeobuf::GeometryType_Polygon) {
|
||||||
return readLinePart(geometry);
|
return readLinePart(geometry);
|
||||||
} else if (geometry_type == FlatGeobuf::GeometryType_MultiPolygon) {
|
} else if (geometry_type == FlatGeobuf::GeometryType_MultiPolygon) {
|
||||||
// if it is a GeometryCollection, parse Parts, ignore XY
|
// if it is a GeometryCollection, parse Parts, ignore XY
|
||||||
@@ -106,7 +110,8 @@ void readFeature(const FlatGeobuf::Feature *feature, long long feature_sequence_
|
|||||||
int drawvec_type = -1;
|
int drawvec_type = -1;
|
||||||
|
|
||||||
FlatGeobuf::GeometryType geometry_type = h_geometry_type;
|
FlatGeobuf::GeometryType geometry_type = h_geometry_type;
|
||||||
if (h_geometry_type == FlatGeobuf::GeometryType_Unknown) geometry_type = feature->geometry()->type();
|
if (h_geometry_type == FlatGeobuf::GeometryType_Unknown)
|
||||||
|
geometry_type = feature->geometry()->type();
|
||||||
|
|
||||||
switch (geometry_type) {
|
switch (geometry_type) {
|
||||||
case FlatGeobuf::GeometryType_Point:
|
case FlatGeobuf::GeometryType_Point:
|
||||||
@@ -392,7 +397,8 @@ void parse_flatgeobuf(std::vector<struct serialization_state> *sst, const char *
|
|||||||
|
|
||||||
queueFeature(feature, feature_sequence_id, h_geometry_type, h_column_names, h_column_types, sst, layer, layername);
|
queueFeature(feature, feature_sequence_id, h_geometry_type, h_column_names, h_column_types, sst, layer, layername);
|
||||||
|
|
||||||
if (feature_sequence_id >= 0) feature_sequence_id ++;
|
if (feature_sequence_id >= 0)
|
||||||
|
feature_sequence_id++;
|
||||||
start += sizeof(uint32_t) + feature_size;
|
start += sizeof(uint32_t) + feature_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user