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