mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Improve the appearance of coalesce-densest-as-needed tiles (#247)
* Start to distinguish fixed cluster density setting from as-needed density
* Make consistent {drop,coalesce}-densest decisions between zooms
* Actually track the previous index instead of just intending to
* Clean up collinearities in coalesced features
* To determine densest, look at actual physical distance, not just index
* Don't actually need the previous index in serial_feature now
* Center of mass of one feature to most distant point of the next
* Add apologetic comment
* Wait, how did the tests pass before?
* Revert "Wait, how did the tests pass before?"
This reverts commit f73c8ee543.
* Add --maximum-string-attribute-length option
* Update version and changelog
* A little more testing to make sure
This commit is contained in:
@@ -325,3 +325,19 @@ unsigned long long bit_reverse(unsigned long long v) {
|
||||
v = ((v & 0x5555555555555555) << 1) | ((v & 0xAAAAAAAAAAAAAAAA) >> 1);
|
||||
return v;
|
||||
}
|
||||
|
||||
std::string truncate_string(std::string const &s, size_t len) {
|
||||
if (s.length() <= len) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// find the initial byte of a UTF-8 character
|
||||
ssize_t i;
|
||||
for (i = len; i > 0; i--) {
|
||||
if ((s[i] & 0x80) == 0 || (s[i] & 0xC0) == 0xC0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return s.substr(0, i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user