Merge branch 'master' into spirit-x3

This commit is contained in:
artemp 2016-02-01 10:04:07 +01:00
commit 4b5a73e21b
23 changed files with 123 additions and 170 deletions

View file

@ -12,6 +12,12 @@ env:
- secure: "iQYPNpMtejcgYeUkWZGIWz1msIco5qydJrhZTSCQOYahAQerdT7q5WZEpEo3G6IWOGgO1eo7GFuY8DvqQjw1+jC9b9mhkRNdo3LhGTKS9Gsbl5Q27k0rjlaFZmmQHrfPlQJwhfAIp+KLugHtQw5bCoLh+95E3j0F0DayF1tuJ3s="
addons:
postgresql: "9.4"
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
packages:
- clang-3.6
cache:
directories:
@ -21,32 +27,36 @@ matrix:
include:
- os: linux
compiler: clang
env: JOBS=8 CXX="ccache clang++-3.6 -Qunused-arguments" CC="clang-3.6" MASON_PUBLISH=true
env: JOBS=8 CXX="ccache clang++-3.6 -Qunused-arguments" CC="clang-3.6" MASON_PUBLISH=true BENCH=True
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6' ]
packages: [ 'clang-3.6', 'libstdc++-4.9-dev', 'libstdc++6' ]
- os: linux
compiler: gcc
env: JOBS=6 CXX="ccache g++-4.9" CC="ccache gcc-4.9"
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'gcc-4.9', 'g++-4.9', 'libstdc++-4.9-dev', 'libstdc++6' ]
# OOM killer knocking out build on render_markers_symbolizer.cpp
#
#- os: linux
# compiler: gcc
# env: JOBS=6 CXX="ccache g++-4.9" CC="gcc-4.9"
# addons:
# apt:
# sources: [ 'ubuntu-toolchain-r-test' ]
# packages: [ 'gcc-4.9', 'g++-4.9', 'libstdc++-4.9-dev', 'libstdc++6' ]
- os: osx
compiler: clang
osx_image: xcode7 # for c++14 support (upgrades clang from 6 -> 7)
env: JOBS=8 MASON_PUBLISH=true
# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
osx_image: xcode7.2 # upgrades clang from 6 -> 7
env: JOBS=6 MASON_PUBLISH=true HEAVY_JOBS=3
- os: osx
compiler: clang
osx_image: xcode7 # for c++14 support (upgrades clang from 6 -> 7)
env: JOBS=8 COVERAGE=true
osx_image: xcode7.2 # upgrades clang from 6 -> 7
env: JOBS=6 COVERAGE=true HEAVY_JOBS=3
before_install:
- export PYTHONUSERBASE=${PYTHONUSERBASE}
- export PATH=${PYTHONUSERBASE}/bin:${PATH}
- export COVERAGE=${COVERAGE:-false}
- export MASON_PUBLISH=${MASON_PUBLISH:-false}
- export BENCH=${BENCH:-false}
- if [[ ${TRAVIS_BRANCH} != 'master' ]]; then export MASON_PUBLISH=false; fi
- if [[ ${TRAVIS_PULL_REQUEST} != 'false' ]]; then export MASON_PUBLISH=false; fi
- git submodule update --init --depth=10 ||
@ -79,24 +89,24 @@ install:
script:
- source bootstrap.sh
- if [[ ${COVERAGE} == true ]]; then
./configure CUSTOM_LDFLAGS='--coverage' CUSTOM_CXXFLAGS='--coverage' CUSTOM_CFLAGS='--coverage' DEBUG=True;
./configure PGSQL2SQLITE=False SVG2PNG=False SAMPLE_INPUT_PLUGINS=False SVG_RENDERER=False BENCHMARK=${BENCH} CUSTOM_LDFLAGS='--coverage' CUSTOM_CXXFLAGS='--coverage' CUSTOM_CFLAGS='--coverage' DEBUG=True;
elif [[ ${MASON_PUBLISH} == true ]]; then
export MASON_NAME=mapnik;
export MASON_VERSION=latest;
export MASON_LIB_FILE=lib/libmapnik-wkt.a;
source ./.mason/mason.sh;
./configure CPP_TESTS=False PREFIX=${MASON_PREFIX} PATH_REPLACE='' MAPNIK_BUNDLED_SHARE_DIRECTORY=True RUNTIME_LINK='static';
./configure BENCHMARK=${BENCH} PREFIX=${MASON_PREFIX} PATH_REPLACE='' MAPNIK_BUNDLED_SHARE_DIRECTORY=True RUNTIME_LINK='static';
else
./configure || cat config.log;
./configure BENCHMARK=${BENCH};
fi
- make
- SCONSFLAGS='--debug=time' make
- make test || TEST_RESULT=$?
- if [[ ${COVERAGE} == true ]]; then
./mason_packages/.link/bin/cpp-coveralls --build-root . --gcov-options '\-lp' --exclude mason_packages --exclude .sconf_temp --exclude benchmark --exclude deps --exclude scons --exclude test --exclude demo --exclude docs --exclude fonts --exclude utils > /dev/null;
fi
#- if [[ ${COVERAGE} != true ]]; then
# make bench;
# fi
- if [[ ${BENCH} == True ]]; then
make bench;
fi
- if [[ ${TEST_RESULT:-0} != 0 ]]; then exit $TEST_RESULT ; fi;
- if [[ ${MASON_PUBLISH} == true ]]; then
./mason_latest.sh build;

View file

@ -6,6 +6,10 @@ ifeq ($(JOBS),)
JOBS:=1
endif
ifeq ($(HEAVY_JOBS),)
HEAVY_JOBS:=1
endif
all: mapnik
install:
@ -36,8 +40,8 @@ python:
python bindings/python/test/visual.py -q
src/json/libmapnik-json.a:
# we first build memory intensive files with -j1
$(PYTHON) scons/scons.py -j1 \
# we first build memory intensive files with -j$(HEAVY_JOBS)
$(PYTHON) scons/scons.py -j$(HEAVY_JOBS) \
--config=cache --implicit-cache --max-drift=1 \
src/renderer_common/render_group_symbolizer.os \
src/renderer_common/render_markers_symbolizer.os \

2
deps/mapbox/variant vendored

@ -1 +1 @@
Subproject commit 7f7c667f870541c208c07d99a9f2c22dfa1f32de
Subproject commit 64596e3aa2c0f47ab3e74a50c5c49acd5c57f5d5

View file

@ -90,7 +90,7 @@ private:
using context_type = context<std::map<std::string,std::size_t> >;
using context_ptr = std::shared_ptr<context_type>;
static const value default_feature_value;
static const value default_feature_value{};
class MAPNIK_DECL feature_impl : private util::noncopyable
{

View file

@ -45,9 +45,6 @@ struct point
point(mapnik::coord<double, 2> const& c)
: x(c.x), y(c.y) {}
point(point const& other) = default;
point(point && other) noexcept = default;
point & operator=(point const& other) = default;
friend inline bool operator== (point<T> const& a, point<T> const& b)
{
return a.x == b.x && a.y == b.y;
@ -65,12 +62,8 @@ template <typename T>
struct line_string : std::vector<point<T> >
{
line_string() = default;
line_string (std::size_t size)
explicit line_string(std::size_t size)
: std::vector<point<T> >(size) {}
line_string (line_string && other) = default ;
line_string& operator=(line_string &&) = default;
line_string (line_string const& ) = default;
line_string& operator=(line_string const&) = default;
inline std::size_t num_points() const { return std::vector<point<T>>::size(); }
inline void add_coord(T x, T y) { std::vector<point<T>>::template emplace_back(x,y);}
};
@ -79,17 +72,12 @@ template <typename T>
struct linear_ring : line_string<T>
{
linear_ring() = default;
linear_ring(std::size_t size)
explicit linear_ring(std::size_t size)
: line_string<T>(size) {}
linear_ring (linear_ring && other) = default ;
linear_ring& operator=(linear_ring &&) = default;
linear_ring(line_string<T> && other)
: line_string<T>(other) {}
linear_ring (linear_ring const& ) = default;
: line_string<T>(std::move(other)) {}
linear_ring(line_string<T> const& other)
: line_string<T>(other) {}
linear_ring& operator=(linear_ring const&) = default;
};
template <typename T>
@ -102,7 +90,6 @@ struct polygon
using rings_container = InteriorRings<T>;
rings_container interior_rings;
polygon() = default;
inline void set_exterior_ring(linear_ring<T> && ring)
{
exterior_ring = std::move(ring);

View file

@ -54,9 +54,6 @@ template <std::size_t max_size>
struct image_dimensions
{
image_dimensions(int width, int height);
image_dimensions(image_dimensions const& other) = default;
image_dimensions(image_dimensions && other) = default;
image_dimensions& operator= (image_dimensions rhs);
std::size_t width() const;
std::size_t height() const;
private:

View file

@ -55,8 +55,9 @@ struct MAPNIK_DECL image_any : image_base
bool painted = false);
template <typename T>
image_any(T && _data) noexcept
: image_base(std::move(_data)) {}
image_any(T && _data)
noexcept(std::is_nothrow_constructible<image_base, T && >::value)
: image_base(std::forward<T>(_data)) {}
unsigned char const* bytes() const;
unsigned char* bytes();

View file

@ -43,14 +43,6 @@ image_dimensions<max_size>::image_dimensions(int width, int height)
if (height < 0 || static_cast<std::size_t>(height) > max_size) throw std::runtime_error("Invalid height for image dimensions requested");
}
template <std::size_t max_size>
image_dimensions<max_size>& image_dimensions<max_size>::operator= (image_dimensions rhs)
{
std::swap(width_, rhs.width_);
std::swap(height_, rhs.height_);
return *this;
}
template <std::size_t max_size>
std::size_t image_dimensions<max_size>::width() const
{

View file

@ -48,9 +48,6 @@ public:
bool /*initialize*/ = true,
bool /*premultiplied*/ = false,
bool /*painted*/ = false) {}
image(image<null_t> const&) {}
image(image<null_t> &&) noexcept {}
image<null_t>& operator=(image<null_t>) { return *this; }
bool operator==(image<null_t> const&) const { return true; }
bool operator<(image<null_t> const&) const { return false; }

View file

@ -37,11 +37,7 @@ public:
static constexpr std::size_t pixel_size = sizeof(pixel_type);
image_view(std::size_t x, std::size_t y, std::size_t width, std::size_t height, T const& data);
~image_view();
image_view(image_view<T> const& rhs);
image_view(image_view<T> && other) noexcept;
image_view<T>& operator=(image_view<T> rhs) = delete;
bool operator==(image_view<T> const& rhs) const;
bool operator<(image_view<T> const& rhs) const;

View file

@ -47,8 +47,9 @@ struct MAPNIK_DECL image_view_any : image_view_base
image_view_any() = default;
template <typename T>
image_view_any(T && _data) noexcept
: image_view_base(std::move(_data)) {}
image_view_any(T && data)
noexcept(std::is_nothrow_constructible<image_view_base, T && >::value)
: image_view_base(std::forward<T>(data)) {}
std::size_t width() const;
std::size_t height() const;

View file

@ -42,25 +42,6 @@ image_view<T>::image_view(std::size_t x, std::size_t y, std::size_t width, std::
if (y_ + height_ > data_.height()) height_ = data_.height() - y_;
}
template <typename T>
image_view<T>::~image_view() {}
template <typename T>
image_view<T>::image_view(image_view<T> const& rhs)
: x_(rhs.x_),
y_(rhs.y_),
width_(rhs.width_),
height_(rhs.height_),
data_(rhs.data_) {}
template <typename T>
image_view<T>::image_view(image_view<T> && other) noexcept
: x_(std::move(other.x_)),
y_(std::move(other.y_)),
width_(std::move(other.width_)),
height_(std::move(other.height_)),
data_(std::move(other.data_)) {}
template <typename T>
bool image_view<T>::operator==(image_view<T> const& rhs) const
{

View file

@ -58,18 +58,12 @@ public:
bitmap_data_.set(0xff000000);
}
marker_rgba8(image_rgba8 const & data)
explicit marker_rgba8(image_rgba8 const& data)
: bitmap_data_(data) {}
marker_rgba8(image_rgba8 && data)
explicit marker_rgba8(image_rgba8 && data) noexcept
: bitmap_data_(std::move(data)) {}
marker_rgba8(marker_rgba8 const& rhs)
: bitmap_data_(rhs.bitmap_data_) {}
marker_rgba8(marker_rgba8 && rhs) noexcept
: bitmap_data_(std::move(rhs.bitmap_data_)) {}
box2d<double> bounding_box() const
{
std::size_t _width = bitmap_data_.width();
@ -99,17 +93,11 @@ private:
struct marker_svg
{
public:
marker_svg() { }
marker_svg() = default;
marker_svg(mapnik::svg_path_ptr data)
explicit marker_svg(mapnik::svg_path_ptr data) noexcept
: vector_data_(data) {}
marker_svg(marker_svg const& rhs)
: vector_data_(rhs.vector_data_) {}
marker_svg(marker_svg && rhs) noexcept
: vector_data_(rhs.vector_data_) {}
inline box2d<double> bounding_box() const
{
return vector_data_->bounding_box();
@ -140,7 +128,6 @@ private:
struct marker_null
{
marker_null() = default;
public:
inline box2d<double> bounding_box() const
{
@ -195,8 +182,9 @@ struct marker : marker_base
marker() = default;
template <typename T>
marker(T && _data) noexcept
: marker_base(std::move(_data)) {}
marker(T && _data)
noexcept(std::is_nothrow_constructible<marker_base, T && >::value)
: marker_base(std::forward<T>(_data)) {}
double width() const
{

View file

@ -331,14 +331,6 @@ private:
}
}
// Avoid spurious warning from g++ (seen with 4.9)
// around continue_loop not being used.
// This is important to suppress: because of the template
// metaprogramming involved this warning otherwise may be
// repeated so many times as to fill up travis logs to the
// point of failure
#pragma GCC diagnostic push
#include <mapnik/warning_ignore.hpp>
status init_vertices()
{
if (status_ != initial) // already initialized
@ -489,7 +481,7 @@ private:
}
start_v2.x = v2.x;
start_v2.y = v2.y;
bool continue_loop = true;
vertex2d tmp_prev(vertex2d::no_init);
while (i < points.size())
@ -522,7 +514,6 @@ private:
else if (v2.cmd == SEG_END)
{
if (!is_polygon) break;
continue_loop = false;
v2.x = start_v2.x;
v2.y = start_v2.y;
}
@ -635,7 +626,6 @@ private:
// initialization finished
return status_ = process;
}
#pragma GCC diagnostic pop
unsigned output_vertex(double* px, double* py)
{

View file

@ -50,7 +50,8 @@ struct value_holder : value_holder_base
// perfect forwarding
template <typename T>
value_holder(T && obj) noexcept
value_holder(T && obj)
noexcept(std::is_nothrow_constructible<value_holder_base, T && >::value)
: value_holder_base(std::forward<T>(obj))
{}
};

View file

@ -98,10 +98,8 @@ using value_base_type = util::variant<value_bool,
struct strict_value : value_base_type
{
// default ctor
strict_value()
: value_base_type() {}
// copy ctor
strict_value() = default;
strict_value(const char* val)
: value_base_type(val) {}
@ -109,13 +107,15 @@ struct strict_value : value_base_type
strict_value(T const& obj)
: value_base_type(typename detail::mapnik_value_type<T>::type(obj))
{}
// move ctor
template <typename T>
strict_value(T && obj) noexcept
: value_base_type(std::move(obj)) {}
template <typename T>
strict_value(T && obj)
noexcept(std::is_nothrow_constructible<value_base_type, T && >::value)
: value_base_type(std::forward<T>(obj))
{}
};
}
} // namespace detail
struct MAPNIK_DECL symbolizer_base
{

View file

@ -754,22 +754,36 @@ class value : public value_base
friend const value operator%(value const&,value const&);
public:
value () noexcept //-- comment out for VC++11
: value_base(value_null()) {}
value() = default;
value (value const& other) = default;
// conversion from type T is done via a temporary of type U, which
// is determined by mapnik_value_type;
// enable_if< decay<T> != value > is necessary to avoid ill-formed
// recursion in noexcept specifier; and it also prevents using this
// constructor where implicitly-declared copy/move should be used
// (e.g. value(value&))
template <typename T,
typename U = typename std::enable_if<
!detail::is_same_decay<T, value>::value,
detail::mapnik_value_type_decay<T>
>::type::type>
value(T && val)
noexcept(noexcept(U(std::forward<T>(val))) &&
std::is_nothrow_constructible<value_base, U && >::value)
: value_base(U(std::forward<T>(val))) {}
value( value && other) noexcept = default;
template <typename T>
value ( T const& val)
: value_base(typename detail::mapnik_value_type<T>::type(val)) {}
template <typename T>
value ( T && val)
: value_base(typename detail::mapnik_value_type<T>::type(val)) {}
value & operator=( value const& other) = default;
template <typename T,
typename U = typename std::enable_if<
!detail::is_same_decay<T, value>::value,
detail::mapnik_value_type_decay<T>
>::type::type>
value& operator=(T && val)
noexcept(noexcept(U(std::forward<T>(val))) &&
std::is_nothrow_assignable<value_base, U && >::value)
{
value_base::operator=(U(std::forward<T>(val)));
return *this;
}
bool operator==(value const& other) const
{

View file

@ -68,7 +68,7 @@ template <typename T>
std::size_t mapnik_hash_value(T const& val)
{
std::size_t seed = util::apply_visitor(detail::value_hasher(), val);
detail::hash_combine(seed, val.get_type_index());
detail::hash_combine(seed, val.which());
return seed;
}

View file

@ -227,6 +227,13 @@ struct mapnik_value_type<T, typename std::enable_if<detail::is_value_unicode_str
using type = mapnik::value_unicode_string const&;
};
template <typename T>
using mapnik_value_type_decay = mapnik_value_type<typename std::decay<T>::type>;
template <typename T, typename U>
using is_same_decay = std::is_same<typename std::decay<T>::type,
typename std::decay<U>::type>;
} // namespace detail
} // namespace mapnik

View file

@ -61,29 +61,12 @@ struct vertex<T,2>
vertex(coord_type x_,coord_type y_,unsigned cmd_)
: x(x_),y(y_),cmd(cmd_) {}
vertex(vertex<T,2> && rhs) noexcept
: x(std::move(rhs.x)),
y(std::move(rhs.y)),
cmd(std::move(rhs.cmd)) {}
vertex(vertex<T,2> const& rhs)
: x(rhs.x),
y(rhs.y),
cmd(rhs.cmd) {}
template <typename T2>
vertex(vertex<T2,2> const& rhs)
: x(coord_type(rhs.x)),
y(coord_type(rhs.y)),
cmd(rhs.cmd) {}
vertex<T,2>& operator=(vertex<T,2> rhs)
{
swap(rhs);
return *this;
}
template <typename T2>
vertex<T,2>& operator=(vertex<T2,2> const& rhs)
{

View file

@ -52,6 +52,9 @@ shape_index_featureset<filterT>::shape_index_featureset(filterT const& filter,
ctx_(std::make_shared<mapnik::context_type>()),
shape_ptr_(std::move(shape_ptr)),
tr_(new mapnik::transcoder(encoding)),
offsets_(),
itr_(),
attr_ids_(),
row_limit_(row_limit),
count_(0),
feature_bbox_()
@ -87,12 +90,11 @@ feature_ptr shape_index_featureset<filterT>::next()
int offset = itr_->offset;
shape_ptr_->move_to(offset);
std::vector<std::pair<int,int>> parts;
while (itr_->offset == offset && itr_ != offsets_.end())
while (itr_ != offsets_.end() && itr_->offset == offset)
{
if (itr_->start!= -1) parts.emplace_back(itr_->start, itr_->end);
++itr_;
}
//std::cerr << "PARTS SIZE=" << parts.size() <<" offset=" << offset << std::endl;
mapnik::value_integer feature_id = shape_ptr_->id();
shape_file::record_type record(shape_ptr_->reclength_ * 2);
shape_ptr_->shp().read_record(record);

View file

@ -256,13 +256,13 @@ markers_dispatch_params::markers_dispatch_params(box2d<double> const& size,
double scale,
bool snap)
: placement_params{
.size = size,
.tr = tr,
.spacing = get<value_double, keys::spacing>(sym, feature, vars),
.max_error = get<value_double, keys::max_error>(sym, feature, vars),
.allow_overlap = get<value_bool, keys::allow_overlap>(sym, feature, vars),
.avoid_edges = get<value_bool, keys::avoid_edges>(sym, feature, vars),
.direction = get<direction_enum, keys::direction>(sym, feature, vars)}
size,
tr,
get<value_double, keys::spacing>(sym, feature, vars),
get<value_double, keys::max_error>(sym, feature, vars),
get<value_bool, keys::allow_overlap>(sym, feature, vars),
get<value_bool, keys::avoid_edges>(sym, feature, vars),
get<direction_enum, keys::direction>(sym, feature, vars)}
, placement_method(get<marker_placement_enum, keys::markers_placement_type>(sym, feature, vars))
, ignore_placement(get<value_bool, keys::ignore_placement>(sym, feature, vars))
, snap_to_pixels(snap)

View file

@ -39,6 +39,7 @@ std::size_t count_shapefile_features(std::string const& filename)
params["type"] = "shape";
params["file"] = filename;
auto ds = mapnik::datasource_cache::instance().create(params);
REQUIRE(ds != nullptr);
CHECK(ds->type() == mapnik::datasource::datasource_t::Vector);
auto fields = ds->get_descriptor().get_descriptors();
mapnik::query query(ds->envelope());
@ -47,6 +48,7 @@ std::size_t count_shapefile_features(std::string const& filename)
query.add_property_name(field.get_name());
}
auto features = ds->features(query);
REQUIRE(features != nullptr);
std::size_t feature_count = 0;
auto feature = features->next();