mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 16:35:40 +02:00
Make indent
This commit is contained in:
+37
-11
@@ -97,8 +97,12 @@ struct json_object {
|
||||
|
||||
json_type type;
|
||||
|
||||
json_object(json_type t) : type(t) {}
|
||||
json_object(json_type t, json_object *p, json_pull *pl) : parent(p), parser(pl), type(t) {}
|
||||
json_object(json_type t)
|
||||
: type(t) {
|
||||
}
|
||||
json_object(json_type t, json_object *p, json_pull *pl)
|
||||
: parent(p), parser(pl), type(t) {
|
||||
}
|
||||
|
||||
// Type-tagged accessors. Each one asserts that the receiver is of
|
||||
// the right kind, then downcasts to the storage in the appropriate
|
||||
@@ -135,18 +139,28 @@ struct json_number : json_object {
|
||||
double d;
|
||||
unsigned long long u;
|
||||
long long s;
|
||||
value_t() : d(0) {}
|
||||
value_t()
|
||||
: d(0) {
|
||||
}
|
||||
} value;
|
||||
|
||||
json_number() : json_object(JSON_NUMBER) {}
|
||||
json_number(json_object *p, json_pull *pl) : json_object(JSON_NUMBER, p, pl) {}
|
||||
json_number()
|
||||
: json_object(JSON_NUMBER) {
|
||||
}
|
||||
json_number(json_object *p, json_pull *pl)
|
||||
: json_object(JSON_NUMBER, p, pl) {
|
||||
}
|
||||
};
|
||||
|
||||
struct json_string : json_object {
|
||||
std::string string_value;
|
||||
|
||||
json_string() : json_object(JSON_STRING) {}
|
||||
json_string(json_object *p, json_pull *pl) : json_object(JSON_STRING, p, pl) {}
|
||||
json_string()
|
||||
: json_object(JSON_STRING) {
|
||||
}
|
||||
json_string(json_object *p, json_pull *pl)
|
||||
: json_object(JSON_STRING, p, pl) {
|
||||
}
|
||||
};
|
||||
|
||||
struct json_array : json_object {
|
||||
@@ -158,8 +172,14 @@ struct json_array : json_object {
|
||||
// shared_ptr copies. Reserving 2 slots up front eliminates those
|
||||
// reallocations for the common case and adds only a single small
|
||||
// allocation for larger rings (which still grow geometrically).
|
||||
json_array() : json_object(JSON_ARRAY) { array_value.reserve(2); }
|
||||
json_array(json_object *p, json_pull *pl) : json_object(JSON_ARRAY, p, pl) { array_value.reserve(2); }
|
||||
json_array()
|
||||
: json_object(JSON_ARRAY) {
|
||||
array_value.reserve(2);
|
||||
}
|
||||
json_array(json_object *p, json_pull *pl)
|
||||
: json_object(JSON_ARRAY, p, pl) {
|
||||
array_value.reserve(2);
|
||||
}
|
||||
};
|
||||
|
||||
struct json_hash : json_object {
|
||||
@@ -169,8 +189,14 @@ struct json_hash : json_object {
|
||||
// properties, geometry, plus a few attribute fields). Reserving 4
|
||||
// slots avoids the 0 -> 1 -> 2 -> 4 growth chain for the typical
|
||||
// case while only modestly over-allocating for one-key hashes.
|
||||
json_hash() : json_object(JSON_HASH) { entries_value.reserve(4); }
|
||||
json_hash(json_object *p, json_pull *pl) : json_object(JSON_HASH, p, pl) { entries_value.reserve(4); }
|
||||
json_hash()
|
||||
: json_object(JSON_HASH) {
|
||||
entries_value.reserve(4);
|
||||
}
|
||||
json_hash(json_object *p, json_pull *pl)
|
||||
: json_object(JSON_HASH, p, pl) {
|
||||
entries_value.reserve(4);
|
||||
}
|
||||
};
|
||||
|
||||
inline std::string &json_object::string() {
|
||||
|
||||
@@ -407,7 +407,7 @@ std::string mvt_tile::encode() {
|
||||
std::string feature_string;
|
||||
protozero::pbf_writer feature_writer(feature_string);
|
||||
|
||||
if (layers[i].features[f].type >= 0)
|
||||
if (layers[i].features[f].type >= 0)
|
||||
feature_writer.add_enum(3, layers[i].features[f].type);
|
||||
|
||||
std::vector<unsigned> sorted_tags = layers[i].features[f].tags;
|
||||
|
||||
+1
-1
@@ -335,7 +335,7 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
outfeature.geometry[i].x = outfeature.geometry[i].x * outlayer.extent / layer.extent;
|
||||
outfeature.geometry[i].y = outfeature.geometry[i].y * outlayer.extent / layer.extent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto const &g : outfeature.geometry) {
|
||||
if (g.op == mvt_moveto || g.op == mvt_lineto) {
|
||||
|
||||
@@ -831,7 +831,7 @@ static double choose_minattribute(std::vector<double> &attribute_values, double
|
||||
if (descending) {
|
||||
// For descending: drop features > threshold, keep features <= threshold
|
||||
// ix points at the last value to keep
|
||||
size_t ix = (size_t)((attribute_values.size() - 1) * f);
|
||||
size_t ix = (size_t) ((attribute_values.size() - 1) * f);
|
||||
while (ix > 0 && attribute_values[ix] >= existing_attribute) {
|
||||
ix--;
|
||||
}
|
||||
@@ -844,7 +844,7 @@ static double choose_minattribute(std::vector<double> &attribute_values, double
|
||||
} else {
|
||||
// For ascending: drop features < threshold, keep features >= threshold
|
||||
// ix points at the first value to keep
|
||||
size_t ix = (size_t)ceil((double)(attribute_values.size() - 1) * (1 - f));
|
||||
size_t ix = (size_t) ceil((double) (attribute_values.size() - 1) * (1 - f));
|
||||
if (ix >= attribute_values.size()) {
|
||||
ix = attribute_values.size() - 1;
|
||||
}
|
||||
@@ -2106,8 +2106,8 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
if (attr_valid) {
|
||||
add_sample_to(attribute_values, attr_numeric, attribute_values_increment, seq);
|
||||
bool should_drop = arg->drop_by_attribute_descending
|
||||
? (minattribute != HUGE_VAL && attr_numeric > minattribute)
|
||||
: (minattribute != -HUGE_VAL && attr_numeric < minattribute);
|
||||
? (minattribute != HUGE_VAL && attr_numeric > minattribute)
|
||||
: (minattribute != -HUGE_VAL && attr_numeric < minattribute);
|
||||
if (should_drop) {
|
||||
can_stop_early = false;
|
||||
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, strategy, drop_rest, arg->attribute_accum, key_pool)) {
|
||||
@@ -2770,7 +2770,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
}
|
||||
} else if (additional[A_DROP_BY_ATTRIBUTE_AS_NEEDED]) {
|
||||
minattribute_fraction = minattribute_fraction *
|
||||
adjusted_max_tile_features / adjusted_feature_count * 0.75;
|
||||
adjusted_max_tile_features / adjusted_feature_count * 0.75;
|
||||
if (minattribute_fraction > 0.80) {
|
||||
if (!quiet) {
|
||||
fprintf(stderr,
|
||||
@@ -3452,8 +3452,8 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
||||
again = true;
|
||||
}
|
||||
bool attr_propagate = drop_by_attribute_descending
|
||||
? args[thread].minattribute_out < zoom_minattribute
|
||||
: args[thread].minattribute_out > zoom_minattribute;
|
||||
? args[thread].minattribute_out < zoom_minattribute
|
||||
: args[thread].minattribute_out > zoom_minattribute;
|
||||
if (attr_propagate) {
|
||||
zoom_minattribute = args[thread].minattribute_out;
|
||||
again = true;
|
||||
|
||||
Reference in New Issue
Block a user