mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-06 18:35:41 +02:00
Oh right, remove this duplication too
This commit is contained in:
@@ -299,11 +299,10 @@ static mvt_value coerce_double(mvt_value v) {
|
||||
return v;
|
||||
}
|
||||
|
||||
struct ordercmp {
|
||||
bool operator()(const struct coalesce &a, const struct coalesce &b) {
|
||||
static bool order_partials(const serial_feature &a, const serial_feature &b) {
|
||||
for (size_t i = 0; i < order_by.size(); i++) {
|
||||
mvt_value v1 = coerce_double(find_attribute_value(&a.sf, order_by[i].name));
|
||||
mvt_value v2 = coerce_double(find_attribute_value(&b.sf, order_by[i].name));
|
||||
mvt_value v1 = coerce_double(find_attribute_value(&a, order_by[i].name));
|
||||
mvt_value v2 = coerce_double(find_attribute_value(&b, order_by[i].name));
|
||||
|
||||
if (order_by[i].descending) {
|
||||
if (v2 < v1) {
|
||||
@@ -321,19 +320,25 @@ struct ordercmp {
|
||||
}
|
||||
|
||||
if (prevent[P_INPUT_ORDER]) {
|
||||
if (a.sf.seq < b.sf.seq) {
|
||||
if (a.seq < b.seq) {
|
||||
return true;
|
||||
} else if (a.sf.seq > b.sf.seq) {
|
||||
} else if (a.seq > b.seq) {
|
||||
return false;
|
||||
} // else they are equal, so continue to the index
|
||||
}
|
||||
|
||||
if (a.sf.index < b.sf.index) {
|
||||
if (a.index < b.index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; // greater than or equal
|
||||
}
|
||||
|
||||
|
||||
struct ordercmp {
|
||||
bool operator()(const struct coalesce &a, const struct coalesce &b) {
|
||||
return order_partials(a.sf, b.sf);
|
||||
}
|
||||
} ordercmp;
|
||||
|
||||
void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, unsigned tx, unsigned ty, int buffer, int *within, std::atomic<long long> *geompos, FILE **geomfile, const char *fname, signed char t, int layer, long long metastart, signed char feature_minzoom, int child_shards, int max_zoom_increment, long long seq, int tippecanoe_minzoom, int tippecanoe_maxzoom, int segment, unsigned *initial_x, unsigned *initial_y, std::vector<long long> &metakeys, std::vector<long long> &metavals, bool has_id, unsigned long long id, unsigned long long index, unsigned long long label_point, long long extent) {
|
||||
@@ -494,41 +499,6 @@ struct partial_arg {
|
||||
drawvec *shared_nodes;
|
||||
};
|
||||
|
||||
static bool order_partials(const serial_feature &a, const partial &b) {
|
||||
for (size_t i = 0; i < order_by.size(); i++) {
|
||||
mvt_value v1 = coerce_double(find_attribute_value(&a, order_by[i].name));
|
||||
mvt_value v2 = coerce_double(find_attribute_value(&b.sf, order_by[i].name));
|
||||
|
||||
if (order_by[i].descending) {
|
||||
if (v2 < v1) {
|
||||
return true;
|
||||
} else if (v1 < v2) {
|
||||
return false;
|
||||
} // else they are equal, so continue to the next attribute
|
||||
} else {
|
||||
if (v1 < v2) {
|
||||
return true;
|
||||
} else if (v2 < v1) {
|
||||
return false;
|
||||
} // else they are equal, so continue to the next attribute
|
||||
}
|
||||
}
|
||||
|
||||
if (prevent[P_INPUT_ORDER]) {
|
||||
if (a.seq < b.sf.seq) {
|
||||
return true;
|
||||
} else if (a.seq > b.sf.seq) {
|
||||
return false;
|
||||
} // else they are equal, so continue to the index
|
||||
}
|
||||
|
||||
if (a.index < b.sf.index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; // greater than or equal
|
||||
}
|
||||
|
||||
drawvec revive_polygon(drawvec &geom, double area, int z, int detail) {
|
||||
// From area in world coordinates to area in tile coordinates
|
||||
long long divisor = 1LL << (32 - detail - z);
|
||||
@@ -2069,7 +2039,7 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
// would it have been better to drop this other feature instead?
|
||||
|
||||
if (order_by.size() > 0) {
|
||||
if (order_partials(sf, partials[which_partial])) {
|
||||
if (order_partials(sf, partials[which_partial].sf)) {
|
||||
partials[which_partial] = partial(sf, z, tx, ty, line_detail, maxzoom, simplification);
|
||||
// XXX preserve_attributes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user