mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-04 17:35:42 +02:00
Round instead of truncating when clipping lines
This commit is contained in:
+2
-2
@@ -813,8 +813,8 @@ drawvec clip_lines(drawvec &geom, long long minx, long long miny, long long maxx
|
|||||||
int c = clip(&x1, &y1, &x2, &y2, minx, miny, maxx, maxy);
|
int c = clip(&x1, &y1, &x2, &y2, minx, miny, maxx, maxy);
|
||||||
|
|
||||||
if (c > 1) { // clipped
|
if (c > 1) { // clipped
|
||||||
out.push_back(draw(VT_MOVETO, x1, y1));
|
out.push_back(draw(VT_MOVETO, std::round(x1), std::round(y1)));
|
||||||
out.push_back(draw(VT_LINETO, x2, y2));
|
out.push_back(draw(VT_LINETO, std::round(x2), std::round(y2)));
|
||||||
out.push_back(draw(VT_MOVETO, geom[i].x, geom[i].y));
|
out.push_back(draw(VT_MOVETO, geom[i].x, geom[i].y));
|
||||||
} else if (c == 1) { // unchanged
|
} else if (c == 1) { // unchanged
|
||||||
out.push_back(geom[i]);
|
out.push_back(geom[i]);
|
||||||
|
|||||||
+2
-2
@@ -14,8 +14,6 @@
|
|||||||
}, "features": [
|
}, "features": [
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -110.039062, 41.046217 ], [ -109.072266, 40.979898 ] ] } }
|
|
||||||
,
|
|
||||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -110.039062, 45.026950 ], [ -104.062500, 45.026950 ] ] } }
|
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -110.039062, 45.026950 ], [ -104.062500, 45.026950 ] ] } }
|
||||||
,
|
,
|
||||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.062500, 45.951150 ], [ -104.062500, 48.980217 ] ] } }
|
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.062500, 45.951150 ], [ -104.062500, 48.980217 ] ] } }
|
||||||
@@ -42,6 +40,8 @@
|
|||||||
,
|
,
|
||||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -92.021484, 43.516689 ], [ -96.416016, 43.516689 ] ] } }
|
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -92.021484, 43.516689 ], [ -96.416016, 43.516689 ] ] } }
|
||||||
,
|
,
|
||||||
|
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -110.039062, 40.979898 ], [ -109.072266, 40.979898 ] ] } }
|
||||||
|
,
|
||||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.062500, 40.979898 ], [ -109.072266, 40.979898 ] ] } }
|
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.062500, 40.979898 ], [ -109.072266, 40.979898 ] ] } }
|
||||||
,
|
,
|
||||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -110.039062, 37.020098 ], [ -109.072266, 37.020098 ] ] } }
|
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -110.039062, 37.020098 ], [ -109.072266, 37.020098 ] ] } }
|
||||||
|
|||||||
Reference in New Issue
Block a user