mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-06 02:15:41 +02:00
Merge pull request #52 from mapbox/indentstyle
Consistent indent style with clang-format
This commit is contained in:
@@ -17,6 +17,7 @@ vector_tile.pb.cc vector_tile.pb.h: vector_tile.proto
|
|||||||
PG=
|
PG=
|
||||||
|
|
||||||
H = $(shell find . '(' -name '*.h' -o -name '*.hh' ')')
|
H = $(shell find . '(' -name '*.h' -o -name '*.hh' ')')
|
||||||
|
C = $(shell find . '(' -name '*.c' -o -name '*.cc' ')')
|
||||||
|
|
||||||
INCLUDES = -I/usr/local/include
|
INCLUDES = -I/usr/local/include
|
||||||
LIBS = -L/usr/local/lib
|
LIBS = -L/usr/local/lib
|
||||||
@@ -42,3 +43,6 @@ libjsonpull.a: jsonpull.o
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm tippecanoe *.o
|
rm tippecanoe *.o
|
||||||
|
|
||||||
|
indent:
|
||||||
|
for i in $(C) $(H); do clang-format -i -style="{BasedOnStyle: Google, IndentWidth: 8, UseTab: Always, AllowShortIfStatementsOnASingleLine: false, ColumnLimit: 0, ContinuationIndentWidth: 8, SpaceAfterCStyleCast: true, IndentCaseLabels: false, AllowShortBlocksOnASingleLine: false, AllowShortFunctionsOnASingleLine: false}" $$i; done
|
||||||
|
|||||||
@@ -8,18 +8,16 @@
|
|||||||
#include "vector_tile.pb.h"
|
#include "vector_tile.pb.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "projection.h"
|
#include "projection.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
|
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
|
||||||
inline bool is_compressed(std::string const& data) {
|
inline bool is_compressed(std::string const &data) {
|
||||||
return data.size() > 2 &&
|
return data.size() > 2 && (((uint8_t) data[0] == 0x78 && (uint8_t) data[1] == 0x9C) || ((uint8_t) data[0] == 0x1F && (uint8_t) data[1] == 0x8B));
|
||||||
(((uint8_t)data[0] == 0x78 && (uint8_t)data[1] == 0x9C) ||
|
|
||||||
((uint8_t)data[0] == 0x1F && (uint8_t)data[1] == 0x8B));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
|
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
|
||||||
inline int decompress(std::string const& input, std::string & output) {
|
inline int decompress(std::string const &input, std::string &output) {
|
||||||
z_stream inflate_s;
|
z_stream inflate_s;
|
||||||
inflate_s.zalloc = Z_NULL;
|
inflate_s.zalloc = Z_NULL;
|
||||||
inflate_s.zfree = Z_NULL;
|
inflate_s.zfree = Z_NULL;
|
||||||
@@ -29,13 +27,13 @@ inline int decompress(std::string const& input, std::string & output) {
|
|||||||
if (inflateInit2(&inflate_s, 32 + 15) != Z_OK) {
|
if (inflateInit2(&inflate_s, 32 + 15) != Z_OK) {
|
||||||
fprintf(stderr, "error: %s\n", inflate_s.msg);
|
fprintf(stderr, "error: %s\n", inflate_s.msg);
|
||||||
}
|
}
|
||||||
inflate_s.next_in = (Bytef *)input.data();
|
inflate_s.next_in = (Bytef *) input.data();
|
||||||
inflate_s.avail_in = input.size();
|
inflate_s.avail_in = input.size();
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
do {
|
do {
|
||||||
output.resize(length + 2 * input.size());
|
output.resize(length + 2 * input.size());
|
||||||
inflate_s.avail_out = 2 * input.size();
|
inflate_s.avail_out = 2 * input.size();
|
||||||
inflate_s.next_out = (Bytef *)(output.data() + length);
|
inflate_s.next_out = (Bytef *) (output.data() + length);
|
||||||
int ret = inflate(&inflate_s, Z_FINISH);
|
int ret = inflate(&inflate_s, Z_FINISH);
|
||||||
if (ret != Z_STREAM_END && ret != Z_OK && ret != Z_BUF_ERROR) {
|
if (ret != Z_STREAM_END && ret != Z_OK && ret != Z_BUF_ERROR) {
|
||||||
fprintf(stderr, "error: %s\n", inflate_s.msg);
|
fprintf(stderr, "error: %s\n", inflate_s.msg);
|
||||||
@@ -61,7 +59,7 @@ void handle(std::string message, int z, unsigned x, unsigned y) {
|
|||||||
|
|
||||||
if (is_compressed(message)) {
|
if (is_compressed(message)) {
|
||||||
std::string uncompressed;
|
std::string uncompressed;
|
||||||
decompress(message,uncompressed);
|
decompress(message, uncompressed);
|
||||||
if (!tile.ParseFromString(uncompressed)) {
|
if (!tile.ParseFromString(uncompressed)) {
|
||||||
fprintf(stderr, "Couldn't decompress tile %d/%u/%u\n", z, x, y);
|
fprintf(stderr, "Couldn't decompress tile %d/%u/%u\n", z, x, y);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ void usage(char **argv) {
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
extern int optind;
|
extern int optind;
|
||||||
//extern char *optarg;
|
// extern char *optarg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while ((i = getopt(argc, argv, "")) != -1) {
|
while ((i = getopt(argc, argv, "")) != -1) {
|
||||||
|
|||||||
@@ -34,12 +34,7 @@ int min_detail = 7;
|
|||||||
#define GEOM_TYPES 6
|
#define GEOM_TYPES 6
|
||||||
|
|
||||||
const char *geometry_names[GEOM_TYPES] = {
|
const char *geometry_names[GEOM_TYPES] = {
|
||||||
"Point",
|
"Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon",
|
||||||
"MultiPoint",
|
|
||||||
"LineString",
|
|
||||||
"MultiLineString",
|
|
||||||
"Polygon",
|
|
||||||
"MultiPolygon",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int geometry_within[GEOM_TYPES] = {
|
int geometry_within[GEOM_TYPES] = {
|
||||||
@@ -52,12 +47,7 @@ int geometry_within[GEOM_TYPES] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int mb_geometry[GEOM_TYPES] = {
|
int mb_geometry[GEOM_TYPES] = {
|
||||||
VT_POINT,
|
VT_POINT, VT_POINT, VT_LINE, VT_LINE, VT_POLYGON, VT_POLYGON,
|
||||||
VT_POINT,
|
|
||||||
VT_LINE,
|
|
||||||
VT_LINE,
|
|
||||||
VT_POLYGON,
|
|
||||||
VT_POLYGON,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, const char *fname) {
|
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, const char *fname) {
|
||||||
@@ -208,7 +198,7 @@ int traverse_zooms(int geomfd[4], off_t geom_size[4], char *metabase, unsigned *
|
|||||||
char geomname[strlen(tmpdir) + strlen("/geom2.XXXXXXXX") + 1];
|
char geomname[strlen(tmpdir) + strlen("/geom2.XXXXXXXX") + 1];
|
||||||
sprintf(geomname, "%s/geom%d.XXXXXXXX", tmpdir, j);
|
sprintf(geomname, "%s/geom%d.XXXXXXXX", tmpdir, j);
|
||||||
subfd[j] = mkstemp(geomname);
|
subfd[j] = mkstemp(geomname);
|
||||||
//printf("%s\n", geomname);
|
// printf("%s\n", geomname);
|
||||||
if (subfd[j] < 0) {
|
if (subfd[j] < 0) {
|
||||||
perror(geomname);
|
perror(geomname);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@@ -413,7 +403,7 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
unlink(geomname);
|
unlink(geomname);
|
||||||
unlink(indexname);
|
unlink(indexname);
|
||||||
|
|
||||||
unsigned file_bbox[] = { UINT_MAX, UINT_MAX, 0, 0 };
|
unsigned file_bbox[] = {UINT_MAX, UINT_MAX, 0, 0};
|
||||||
unsigned midx = 0, midy = 0;
|
unsigned midx = 0, midy = 0;
|
||||||
long long seq = 0;
|
long long seq = 0;
|
||||||
|
|
||||||
@@ -523,7 +513,7 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned bbox[] = { UINT_MAX, UINT_MAX, 0, 0 };
|
unsigned bbox[] = {UINT_MAX, UINT_MAX, 0, 0};
|
||||||
|
|
||||||
int nprop = 0;
|
int nprop = 0;
|
||||||
if (properties->type == JSON_HASH) {
|
if (properties->type == JSON_HASH) {
|
||||||
@@ -601,8 +591,7 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
for (minzoom = 0; minzoom < 31; minzoom++) {
|
for (minzoom = 0; minzoom < 31; minzoom++) {
|
||||||
unsigned mask = 1 << (32 - (minzoom + 1));
|
unsigned mask = 1 << (32 - (minzoom + 1));
|
||||||
|
|
||||||
if (((bbox[0] & mask) != (bbox[2] & mask)) ||
|
if (((bbox[0] & mask) != (bbox[2] & mask)) || ((bbox[1] & mask) != (bbox[3] & mask))) {
|
||||||
((bbox[1] & mask) != (bbox[3] & mask))) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -611,7 +600,7 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
r = .00000001;
|
r = .00000001;
|
||||||
}
|
}
|
||||||
minzoom = maxzoom - floor(log(r) / - log(droprate));
|
minzoom = maxzoom - floor(log(r) / -log(droprate));
|
||||||
}
|
}
|
||||||
|
|
||||||
serialize_byte(geomfile, minzoom, &geompos, fname);
|
serialize_byte(geomfile, minzoom, &geompos, fname);
|
||||||
@@ -1042,14 +1031,12 @@ int main(int argc, char **argv) {
|
|||||||
gamma = atof(optarg);
|
gamma = atof(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p': {
|
||||||
{
|
|
||||||
char *cp;
|
char *cp;
|
||||||
for (cp = optarg; *cp != '\0'; cp++) {
|
for (cp = optarg; *cp != '\0'; cp++) {
|
||||||
prevent[*cp & 0xFF] = 1;
|
prevent[*cp & 0xFF] = 1;
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
fprintf(stderr, VERSION);
|
fprintf(stderr, VERSION);
|
||||||
|
|||||||
+8
-10
@@ -12,9 +12,9 @@
|
|||||||
#include "geometry.hh"
|
#include "geometry.hh"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "tile.h"
|
#include "tile.h"
|
||||||
#include "clip.h"
|
#include "clip.h"
|
||||||
#include "projection.h"
|
#include "projection.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
drawvec decode_geometry(char **meta, int z, unsigned tx, unsigned ty, int detail, long long *bbox) {
|
drawvec decode_geometry(char **meta, int z, unsigned tx, unsigned ty, int detail, long long *bbox) {
|
||||||
@@ -227,8 +227,8 @@ static draw get_line_intersection(draw p0, draw p1, draw p2, draw p3) {
|
|||||||
double s2_y = p3.y - p2.y;
|
double s2_y = p3.y - p2.y;
|
||||||
|
|
||||||
double t;
|
double t;
|
||||||
//s = (-s1_y * (p0.x - p2.x) + s1_x * (p0.y - p2.y)) / (-s2_x * s1_y + s1_x * s2_y);
|
// s = (-s1_y * (p0.x - p2.x) + s1_x * (p0.y - p2.y)) / (-s2_x * s1_y + s1_x * s2_y);
|
||||||
t = ( s2_x * (p0.y - p2.y) - s2_y * (p0.x - p2.x)) / (-s2_x * s1_y + s1_x * s2_y);
|
t = (s2_x * (p0.y - p2.y) - s2_y * (p0.x - p2.x)) / (-s2_x * s1_y + s1_x * s2_y);
|
||||||
|
|
||||||
return draw(VT_LINETO, p0.x + (t * s1_x), p0.y + (t * s1_y));
|
return draw(VT_LINETO, p0.x + (t * s1_x), p0.y + (t * s1_y));
|
||||||
}
|
}
|
||||||
@@ -369,7 +369,7 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
|||||||
area = fabs(area / 2);
|
area = fabs(area / 2);
|
||||||
|
|
||||||
if (area <= pixel * pixel) {
|
if (area <= pixel * pixel) {
|
||||||
//printf("area is only %f vs %lld so using square\n", area, pixel * pixel);
|
// printf("area is only %f vs %lld so using square\n", area, pixel * pixel);
|
||||||
|
|
||||||
*accum_area += area;
|
*accum_area += area;
|
||||||
if (*accum_area > pixel * pixel) {
|
if (*accum_area > pixel * pixel) {
|
||||||
@@ -384,7 +384,7 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
|||||||
*accum_area -= pixel * pixel;
|
*accum_area -= pixel * pixel;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//printf("area is %f so keeping instead of %lld\n", area, pixel * pixel);
|
// printf("area is %f so keeping instead of %lld\n", area, pixel * pixel);
|
||||||
|
|
||||||
for (unsigned k = i; k <= j && k < geom.size(); k++) {
|
for (unsigned k = i; k <= j && k < geom.size(); k++) {
|
||||||
out.push_back(geom[k]);
|
out.push_back(geom[k]);
|
||||||
@@ -551,9 +551,7 @@ static void douglas_peucker(drawvec &geom, int start, int n, double e) {
|
|||||||
// find index idx of element with max_distance
|
// find index idx of element with max_distance
|
||||||
int i;
|
int i;
|
||||||
for (i = first + 1; i < second; i++) {
|
for (i = first + 1; i < second; i++) {
|
||||||
double temp_dist = square_distance_from_line(geom[start + i].x, geom[start + i].y,
|
double temp_dist = square_distance_from_line(geom[start + i].x, geom[start + i].y, geom[start + first].x, geom[start + first].y, geom[start + second].x, geom[start + second].y);
|
||||||
geom[start + first].x, geom[start + first].y,
|
|
||||||
geom[start + second].x, geom[start + second].y);
|
|
||||||
|
|
||||||
double distance = fabs(temp_dist);
|
double distance = fabs(temp_dist);
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -10,7 +10,8 @@ struct draw {
|
|||||||
this->y = y;
|
this->y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw() { }
|
draw() {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<draw> drawvec;
|
typedef std::vector<draw> drawvec;
|
||||||
|
|||||||
+2
-2
@@ -254,7 +254,7 @@ again:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (j->container->expect != JSON_COMMA) {
|
if (j->container->expect != JSON_COMMA) {
|
||||||
if (! (j->container->expect == JSON_ITEM && j->container->length == 0)) {
|
if (!(j->container->expect == JSON_ITEM && j->container->length == 0)) {
|
||||||
j->error = "Found ] without final element";
|
j->error = "Found ] without final element";
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -292,7 +292,7 @@ again:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (j->container->expect != JSON_COMMA) {
|
if (j->container->expect != JSON_COMMA) {
|
||||||
if (! (j->container->expect == JSON_KEY && j->container->length == 0)) {
|
if (!(j->container->expect == JSON_KEY && j->container->length == 0)) {
|
||||||
j->error = "Found } without final element";
|
j->error = "Found } without final element";
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-3
@@ -1,12 +1,21 @@
|
|||||||
typedef enum json_type {
|
typedef enum json_type {
|
||||||
// These types can be returned by json_read()
|
// These types can be returned by json_read()
|
||||||
JSON_HASH, JSON_ARRAY, JSON_NUMBER, JSON_STRING, JSON_TRUE, JSON_FALSE, JSON_NULL,
|
JSON_HASH,
|
||||||
|
JSON_ARRAY,
|
||||||
|
JSON_NUMBER,
|
||||||
|
JSON_STRING,
|
||||||
|
JSON_TRUE,
|
||||||
|
JSON_FALSE,
|
||||||
|
JSON_NULL,
|
||||||
|
|
||||||
// These and JSON_HASH and JSON_ARRAY can be called back by json_read_with_separators()
|
// These and JSON_HASH and JSON_ARRAY can be called back by json_read_with_separators()
|
||||||
JSON_COMMA, JSON_COLON,
|
JSON_COMMA,
|
||||||
|
JSON_COLON,
|
||||||
|
|
||||||
// These are only used internally as expectations of what comes next
|
// These are only used internally as expectations of what comes next
|
||||||
JSON_ITEM, JSON_KEY, JSON_VALUE,
|
JSON_ITEM,
|
||||||
|
JSON_KEY,
|
||||||
|
JSON_VALUE,
|
||||||
} json_type;
|
} json_type;
|
||||||
|
|
||||||
typedef struct json_object {
|
typedef struct json_object {
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ int is_pooled(struct pool *p, char *s, int type) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct pool_val *pool(struct pool *p, char *s, int type) {
|
struct pool_val *pool(struct pool *p, char *s, int type) {
|
||||||
return pool1(p, s, type, strcmp);
|
return pool1(p, s, type, strcmp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ struct pool {
|
|||||||
int n;
|
int n;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct pool_val *pool(struct pool *p, char *s, int type);
|
struct pool_val *pool(struct pool *p, char *s, int type);
|
||||||
void pool_free(struct pool *p);
|
void pool_free(struct pool *p);
|
||||||
void pool_free_strings(struct pool *p);
|
void pool_free_strings(struct pool *p);
|
||||||
|
|||||||
+1
-2
@@ -7,7 +7,7 @@ void latlon2tile(double lat, double lon, int zoom, unsigned int *x, unsigned int
|
|||||||
unsigned long long n = 1LL << zoom;
|
unsigned long long n = 1LL << zoom;
|
||||||
|
|
||||||
long long llx = n * ((lon + 180) / 360);
|
long long llx = n * ((lon + 180) / 360);
|
||||||
long long lly = n * (1 - (log(tan(lat_rad) + 1/cos(lat_rad)) / M_PI)) / 2;
|
long long lly = n * (1 - (log(tan(lat_rad) + 1 / cos(lat_rad)) / M_PI)) / 2;
|
||||||
|
|
||||||
if (lat >= 85.0511) {
|
if (lat >= 85.0511) {
|
||||||
lly = 0;
|
lly = 0;
|
||||||
@@ -53,7 +53,6 @@ unsigned long long encode(unsigned int wx, unsigned int wy) {
|
|||||||
out |= v;
|
out |= v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,17 +17,17 @@
|
|||||||
#include "geometry.hh"
|
#include "geometry.hh"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "tile.h"
|
#include "tile.h"
|
||||||
#include "pool.h"
|
#include "pool.h"
|
||||||
#include "clip.h"
|
#include "clip.h"
|
||||||
#include "mbtiles.h"
|
#include "mbtiles.h"
|
||||||
#include "projection.h"
|
#include "projection.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CMD_BITS 3
|
#define CMD_BITS 3
|
||||||
|
|
||||||
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
|
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
|
||||||
static inline int compress(std::string const& input, std::string& output) {
|
static inline int compress(std::string const &input, std::string &output) {
|
||||||
z_stream deflate_s;
|
z_stream deflate_s;
|
||||||
deflate_s.zalloc = Z_NULL;
|
deflate_s.zalloc = Z_NULL;
|
||||||
deflate_s.zfree = Z_NULL;
|
deflate_s.zfree = Z_NULL;
|
||||||
@@ -35,14 +35,14 @@ static inline int compress(std::string const& input, std::string& output) {
|
|||||||
deflate_s.avail_in = 0;
|
deflate_s.avail_in = 0;
|
||||||
deflate_s.next_in = Z_NULL;
|
deflate_s.next_in = Z_NULL;
|
||||||
deflateInit2(&deflate_s, Z_BEST_COMPRESSION, Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY);
|
deflateInit2(&deflate_s, Z_BEST_COMPRESSION, Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY);
|
||||||
deflate_s.next_in = (Bytef *)input.data();
|
deflate_s.next_in = (Bytef *) input.data();
|
||||||
deflate_s.avail_in = input.size();
|
deflate_s.avail_in = input.size();
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
do {
|
do {
|
||||||
size_t increase = input.size() / 2 + 1024;
|
size_t increase = input.size() / 2 + 1024;
|
||||||
output.resize(length + increase);
|
output.resize(length + increase);
|
||||||
deflate_s.avail_out = increase;
|
deflate_s.avail_out = increase;
|
||||||
deflate_s.next_out = (Bytef *)(output.data() + length);
|
deflate_s.next_out = (Bytef *) (output.data() + length);
|
||||||
int ret = deflate(&deflate_s, Z_FINISH);
|
int ret = deflate(&deflate_s, Z_FINISH);
|
||||||
if (ret != Z_STREAM_END && ret != Z_OK && ret != Z_BUF_ERROR) {
|
if (ret != Z_STREAM_END && ret != Z_OK && ret != Z_BUF_ERROR) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -129,7 +129,7 @@ struct coalesce {
|
|||||||
char *metasrc;
|
char *metasrc;
|
||||||
bool coalesced;
|
bool coalesced;
|
||||||
|
|
||||||
bool operator< (const coalesce &o) const {
|
bool operator<(const coalesce &o) const {
|
||||||
int cmp = coalindexcmp(this, &o);
|
int cmp = coalindexcmp(this, &o);
|
||||||
if (cmp < 0) {
|
if (cmp < 0) {
|
||||||
return true;
|
return true;
|
||||||
@@ -275,7 +275,7 @@ struct sll {
|
|||||||
char *name;
|
char *name;
|
||||||
long long val;
|
long long val;
|
||||||
|
|
||||||
bool operator< (const sll &o) const {
|
bool operator<(const sll &o) const {
|
||||||
if (this->val < o.val) {
|
if (this->val < o.val) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -372,7 +372,7 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
long long count = 0;
|
long long count = 0;
|
||||||
//long long along = 0;
|
// long long along = 0;
|
||||||
double accum_area = 0;
|
double accum_area = 0;
|
||||||
|
|
||||||
double interval = 0;
|
double interval = 0;
|
||||||
@@ -392,8 +392,8 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
|||||||
features.push_back(std::vector<coalesce>());
|
features.push_back(std::vector<coalesce>());
|
||||||
}
|
}
|
||||||
|
|
||||||
int within[4] = { 0 };
|
int within[4] = {0};
|
||||||
long long geompos[4] = { 0 };
|
long long geompos[4] = {0};
|
||||||
|
|
||||||
*geoms = og;
|
*geoms = og;
|
||||||
|
|
||||||
@@ -483,7 +483,7 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
|||||||
sy = ty << (32 - z);
|
sy = ty << (32 - z);
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("type %d, meta %lld\n", t, metastart);
|
// printf("type %d, meta %lld\n", t, metastart);
|
||||||
serialize_byte(geomfile[j], t, &geompos[j], fname);
|
serialize_byte(geomfile[j], t, &geompos[j], fname);
|
||||||
serialize_byte(geomfile[j], layer, &geompos[j], fname);
|
serialize_byte(geomfile[j], layer, &geompos[j], fname);
|
||||||
serialize_long_long(geomfile[j], metastart, &geompos[j], fname);
|
serialize_long_long(geomfile[j], metastart, &geompos[j], fname);
|
||||||
@@ -710,4 +710,3 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
|||||||
fprintf(stderr, "could not make tile %d/%u/%u small enough\n", z, tx, ty);
|
fprintf(stderr, "could not make tile %d/%u/%u small enough\n", z, tx, ty);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user