Upgrade to Wagyu 0.3.0; downgrade C++ requirement to C++ 11

This commit is contained in:
Eric Fischer 2017-01-26 13:25:06 -08:00
parent 28b8f1c326
commit 31f254ac99
8 changed files with 31 additions and 24 deletions

View File

@ -1,3 +1,7 @@
## 1.16.6
* Upgrade Wagyu to 0.3.0; downgrade C++ requirement to C++ 11
## 1.16.5
* Add -z and -Z options to tippecanoe-decode

View File

@ -7,7 +7,7 @@ SHELL = /bin/bash
CC := $(CC)
CXX := $(CXX)
CFLAGS := $(CFLAGS)
CXXFLAGS := $(CXXFLAGS) -std=c++14
CXXFLAGS := $(CXXFLAGS) -std=c++11
LDFLAGS := $(LDFLAGS)
WARNING_FLAGS := -Wall -Wshadow -Wsign-compare
RELEASE_FLAGS := -O3 -DNDEBUG

View File

@ -279,7 +279,7 @@ and perhaps
make install
Tippecanoe now requires features from the 2014 C++ standard. If your compiler is older than
Tippecanoe now requires features from the 2011 C++ standard. If your compiler is older than
that, you will need to install a newer one. On MacOS, updating to the lastest XCode should
get you a new enough version of `clang++`. On Linux, you should be able to upgrade `g++` with

View File

@ -9,7 +9,8 @@
#include <cmath>
#include <limits.h>
#include <sqlite3.h>
#include <mapbox/geometry.hpp>
#include <mapbox/geometry/point.hpp>
#include <mapbox/geometry/multi_polygon.hpp>
#include <mapbox/geometry/wagyu/wagyu.hpp>
#include <mapbox/geometry/wagyu/quick_clip.hpp>
#include "geometry.hpp"
@ -445,19 +446,19 @@ drawvec simple_clip_poly(drawvec &geom, long long minx, long long miny, long lon
ring.push_back(mapbox::geometry::point<long long>(geom[k].x, geom[k].y));
}
optional_linear_ring<long long> lr = mapbox::geometry::wagyu::quick_clip::quick_lr_clip(ring, bbox);
mapbox::geometry::linear_ring<long long> lr = mapbox::geometry::wagyu::quick_clip::quick_lr_clip(ring, bbox);
if (lr) {
for (size_t k = 0; k < lr->size(); k++) {
if (lr.size() > 0) {
for (size_t k = 0; k < lr.size(); k++) {
if (k == 0) {
out.push_back(draw(VT_MOVETO, (*lr)[k].x, (*lr)[k].y));
out.push_back(draw(VT_MOVETO, lr[k].x, lr[k].y));
} else {
out.push_back(draw(VT_LINETO, (*lr)[k].x, (*lr)[k].y));
out.push_back(draw(VT_LINETO, lr[k].x, lr[k].y));
}
}
if (lr->size() > 0 && (*lr)[0] != (*lr)[lr->size() - 1]) {
out.push_back(draw(VT_LINETO, (*lr)[0].x, (*lr)[0].y));
if (lr.size() > 0 && lr[0] != lr[lr.size() - 1]) {
out.push_back(draw(VT_LINETO, lr[0].x, lr[0].y));
}
}

View File

@ -335,7 +335,7 @@ make install
.fi
.RE
.PP
Tippecanoe now requires features from the 2014 C++ standard. If your compiler is older than
Tippecanoe now requires features from the 2011 C++ standard. If your compiler is older than
that, you will need to install a newer one. On MacOS, updating to the lastest XCode should
get you a new enough version of \fB\fCclang++\fR\&. On Linux, you should be able to upgrade \fB\fCg++\fR with
.PP

View File

@ -5,11 +5,6 @@
#include <mapbox/geometry/polygon.hpp>
#include <mapbox/geometry/wagyu/wagyu.hpp>
#include <experimental/optional>
template <typename T>
using optional_linear_ring = std::experimental::optional<mapbox::geometry::linear_ring<T>>;
namespace mapbox {
namespace geometry {
namespace wagyu {
@ -61,7 +56,7 @@ bool inside(mapbox::geometry::point<T> p, size_t edge, mapbox::geometry::box<T>
}
template <typename T>
optional_linear_ring<T> quick_lr_clip(mapbox::geometry::linear_ring<T> const& ring,
mapbox::geometry::linear_ring<T> quick_lr_clip(mapbox::geometry::linear_ring<T> const& ring,
mapbox::geometry::box<T> const& b) {
mapbox::geometry::linear_ring<T> out = ring;
@ -89,13 +84,14 @@ optional_linear_ring<T> quick_lr_clip(mapbox::geometry::linear_ring<T> const& ri
}
if (out.size() < 3) {
return optional_linear_ring<T>();
out.clear();
return out;
}
// Close the ring if the first/last point was outside
if (out[0] != out[out.size() - 1]) {
out.push_back(out[0]);
}
return optional_linear_ring<T>(std::move(out));
return out;
}
}
@ -107,8 +103,8 @@ mapbox::geometry::multi_polygon<T> clip(mapbox::geometry::polygon<T> const& poly
wagyu<T> clipper;
for (auto const& lr : poly) {
auto new_lr = quick_clip::quick_lr_clip(lr, b);
if (new_lr) {
clipper.add_ring(*new_lr, polygon_type_subject);
if (!new_lr.empty()) {
clipper.add_ring(new_lr, polygon_type_subject);
}
}
clipper.execute(clip_type_union, result, subject_fill_type, fill_type_even_odd);
@ -124,8 +120,8 @@ mapbox::geometry::multi_polygon<T> clip(mapbox::geometry::multi_polygon<T> const
for (auto const& poly : mp) {
for (auto const& lr : poly) {
auto new_lr = quick_clip::quick_lr_clip(lr, b);
if (new_lr) {
clipper.add_ring(*new_lr, polygon_type_subject);
if (!new_lr.empty()) {
clipper.add_ring(new_lr, polygon_type_subject);
}
}
}

View File

@ -15,6 +15,12 @@
#include <mapbox/geometry/wagyu/topology_correction.hpp>
#include <mapbox/geometry/wagyu/vatti.hpp>
#define WAGYU_MAJOR_VERSION 0
#define WAGYU_MINOR_VERSION 3
#define WAGYU_PATCH_VERSION 0
#define WAGYU_VERSION (WAGYU_MAJOR_VERSION * 100000) + (WAGYU_MINOR_VERSION * 100) + (WAGYU_PATCH_VERSION)
namespace mapbox {
namespace geometry {
namespace wagyu {

View File

@ -1 +1 @@
#define VERSION "tippecanoe v1.16.5\n"
#define VERSION "tippecanoe v1.16.6\n"