Compare commits
90 commits
master
...
libstdc++-
Author | SHA1 | Date | |
---|---|---|---|
|
a9c2cc215e | ||
|
b53db334af | ||
|
1632018a14 | ||
|
9f4a138b8b | ||
|
149d2ca0a1 | ||
|
635af3f4a3 | ||
|
9c4613f934 | ||
|
520f3fd0a0 | ||
|
15fb2debb0 | ||
|
fa549b380a | ||
|
60d891f094 | ||
|
7caa0cffd4 | ||
|
dbbf18c752 | ||
|
a1084e0c09 | ||
|
c2fd522d0f | ||
|
dfccc5f6bb | ||
|
284842a9d3 | ||
|
40753edadc | ||
|
e0db6b9a47 | ||
|
91515cad69 | ||
|
0c232313d6 | ||
|
8665fc7313 | ||
|
08822729cc | ||
|
f8e5f146ec | ||
|
07de7155f1 | ||
|
3fbe7f61a6 | ||
|
3706fcf587 | ||
|
947ac81ee4 | ||
|
163af7a40f | ||
|
55e3e14f4d | ||
|
7483f6328c | ||
|
941a7eaf69 | ||
|
489b7f2aca | ||
|
4c22e631a7 | ||
|
2845cdc121 | ||
|
0cd3bd8737 | ||
|
85da8ef128 | ||
|
7affd674fd | ||
|
1f2de83531 | ||
|
887964ae97 | ||
|
c1267ebcd5 | ||
|
2a153c0d1f | ||
|
4f3e6f4846 | ||
|
391a9f835b | ||
|
74e66bac58 | ||
|
d2d62bc95c | ||
|
8cc7060ef1 | ||
|
e35bca7381 | ||
|
6cb3bce2d7 | ||
|
17dcffaf78 | ||
|
1a268343a9 | ||
|
7578534dc8 | ||
|
adcf611fab | ||
|
8f06db6ac0 | ||
|
401aade813 | ||
|
ab206321b5 | ||
|
5db03aeb03 | ||
|
2db538c470 | ||
|
8a3a380b3b | ||
|
ff4a1c1e9b | ||
|
7ce68e2c08 | ||
|
5b1c5f83cb | ||
|
5d28a25ad3 | ||
|
c71c1bc0a8 | ||
|
63128fdba1 | ||
|
0a5495e442 | ||
|
b5c04cc132 | ||
|
cdefee3524 | ||
|
47443526a0 | ||
|
a3b4e1f575 | ||
|
283481b347 | ||
|
fdd542a3c4 | ||
|
06201e3842 | ||
|
96ce2d8b3b | ||
|
f00470dc02 | ||
|
dd5c134f01 | ||
|
7c41b835ca | ||
|
641cd6555e | ||
|
fa2d63c601 | ||
|
204d30e58d | ||
|
8dee1a9088 | ||
|
2b3fdf1bc9 | ||
|
701a459427 | ||
|
335c3e4265 | ||
|
4cd55330dd | ||
|
b2f7bea7b5 | ||
|
d5a9322a11 | ||
|
d378ddbf66 | ||
|
27a0f3562d | ||
|
4d4ea3a576 |
69 changed files with 526 additions and 646 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -5,7 +5,7 @@
|
|||
[submodule "test/data-visual"]
|
||||
path = test/data-visual
|
||||
url = https://github.com/mapnik/test-data-visual.git
|
||||
branch = master
|
||||
branch = 3.0.x
|
||||
[submodule "deps/mapbox/variant"]
|
||||
path = deps/mapbox/variant
|
||||
url = https://github.com/mapbox/variant.git
|
||||
|
|
55
.travis.yml
55
.travis.yml
|
@ -10,8 +10,6 @@ env:
|
|||
- CCACHE_COMPRESS=1
|
||||
- HEAVY_JOBS="2"
|
||||
- PREFIX=/tmp/mapnik
|
||||
- secure: "D5CLP5lbyFru788iZO8RqDenY/YsHPREvr34zCEi93xMqOTxPmME/zyuEZSyjP5ZLyf8g/fxOuPYSDbOQ1QLwNDBWxB0JomWOahyimHKrMCrMcGHCjl//2W2mE+p9VwF5VLGgfy7CskGkS49Mye37FDK0ejwuq6MDI45DsH4Fkk="
|
||||
- secure: "ZPHyAVL3ID5g3KEmwcnzG9z2tAQwSx526Qd3Y6tsZ3Yj+aSagVBiZQjZGKWgNX74lymtmYKnb2Md46apWLeImt6tjB3MWTu7WwWoZRnqUligz/8Nmg4Lgo7EOCkQcjN/gpA1i+cM5b+ZKDTZYOaHO6/+DAaunQzA7/p99hw/XYg="
|
||||
- secure: "F6ivqDNMBQQnrDGA9+7IX+GDswuIqQQd7YPJdQqa2Ked9jddAQDeJClb05ig3JlwfOlYLGZOd43ZX0pKuMtI2Gbkwz211agGP9S3YunwlRg8iWtJlO5kYFUdKCmJNhjg4icfkGELCgwXn+zuEWFSLpkPcjqAFKFlQrIJeAJJgKM="
|
||||
addons:
|
||||
postgresql: "9.4"
|
||||
|
@ -25,24 +23,32 @@ matrix:
|
|||
- os: linux
|
||||
sudo: false
|
||||
compiler: ": clang"
|
||||
env: JOBS=8 MASON_PUBLISH=true CXX="ccache clang++-3.8 -Qunused-arguments" CC="clang-3.8" TRIGGER=true
|
||||
env: JOBS=4 CXX="ccache g++-6" CC="gcc-6"
|
||||
addons:
|
||||
apt:
|
||||
sources: [ 'ubuntu-toolchain-r-test']
|
||||
packages: [ 'libstdc++-5-dev', 'xutils-dev']
|
||||
packages: [ 'libstdc++-6-dev', 'g++-6', 'xutils-dev']
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: ": clang"
|
||||
env: JOBS=8 CXX="ccache clang++-3.9 -Qunused-arguments" CC="clang-3.9" TRIGGER=true
|
||||
addons:
|
||||
apt:
|
||||
sources: [ 'ubuntu-toolchain-r-test']
|
||||
packages: [ 'libstdc++-4.8-dev', 'xutils-dev']
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: ": clang-coverage"
|
||||
env: JOBS=8 COVERAGE=true CXX="ccache clang++-3.8 -Qunused-arguments" CC="clang-3.8"
|
||||
env: JOBS=8 COVERAGE=true CXX="ccache clang++-3.9 -Qunused-arguments" CC="clang-3.9"
|
||||
addons:
|
||||
apt:
|
||||
sources: [ 'ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-5-dev', 'xutils-dev' ]
|
||||
packages: ['libstdc++-4.8-dev', 'xutils-dev' ]
|
||||
- os: osx
|
||||
compiler: ": clang-osx"
|
||||
# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
|
||||
osx_image: xcode7.3 # upgrades clang from 6 -> 7
|
||||
env: JOBS=4 MASON_PUBLISH=true CXX="ccache clang++ -Qunused-arguments"
|
||||
env: JOBS=4 CXX="ccache clang++ -Qunused-arguments"
|
||||
|
||||
before_install:
|
||||
# workaround travis rvm bug
|
||||
|
@ -52,18 +58,12 @@ before_install:
|
|||
rvm get head || true
|
||||
fi
|
||||
- source scripts/travis-common.sh
|
||||
- export PYTHONUSERBASE=$(pwd)/mason_packages/.link
|
||||
- export PATH=${PREFIX}/bin:$(pwd)/mason_packages/.link/bin:${PYTHONUSERBASE}/bin:${PATH}
|
||||
- export PATH=${PREFIX}/bin:$(pwd)/mason_packages/.link/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
|
||||
|
||||
install:
|
||||
- on 'linux' export PYTHONPATH=${PYTHONUSERBASE}/lib/python2.7/site-packages
|
||||
- on 'osx' export PYTHONPATH=${PYTHONUSERBASE}/lib/python/site-packages
|
||||
- on 'osx' export DATA_PATH=$(brew --prefix)/var/postgres
|
||||
- on 'osx' rm -rf ${DATA_PATH}
|
||||
- on 'osx' initdb ${DATA_PATH} -E utf8
|
||||
|
@ -72,16 +72,19 @@ install:
|
|||
- on 'osx' createuser -s postgres
|
||||
- psql -c 'create database template_postgis;' -U postgres
|
||||
- psql -c 'create extension postgis;' -d template_postgis -U postgres
|
||||
- enabled ${COVERAGE} pip install --user cpp-coveralls
|
||||
- enabled ${COVERAGE} curl -S -f https://codecov.io/bash -o codecov
|
||||
- enabled ${COVERAGE} chmod +x codecov
|
||||
|
||||
before_script:
|
||||
- source bootstrap.sh
|
||||
- |
|
||||
if [[ $(uname -s) == 'Linux' ]]; then
|
||||
mason install clang 3.8.0
|
||||
export PATH=$(mason prefix clang 3.8.0)/bin:${PATH}
|
||||
which clang++
|
||||
export LLVM_COV="$(mason prefix clang 3.8.0)/bin/llvm-cov"
|
||||
mason install clang++ 3.9.1
|
||||
export PATH=$(mason prefix clang++ 3.9.1)/bin:${PATH}
|
||||
mason install llvm-cov 3.9.1
|
||||
export PATH=$(mason prefix llvm-cov 3.9.1)/bin:${PATH}
|
||||
which llvm-cov
|
||||
export LLVM_COV="$(mason prefix llvm-cov 3.9.1)/bin/llvm-cov"
|
||||
fi
|
||||
- ccache --version
|
||||
- ccache -p || true
|
||||
|
@ -98,14 +101,10 @@ script:
|
|||
# (and might work) for the next build
|
||||
- DURATION=2400
|
||||
- scripts/travis-command-wrapper.py -s "date" -i 120 --deadline=$(( $(date +%s) + ${DURATION} )) make
|
||||
- make test
|
||||
- RESULT=0
|
||||
- nm src/libmapnik.* | grep throw_out_of_range
|
||||
- make test || RESULT=$?
|
||||
# we allow visual failures with g++ for now: https://github.com/mapnik/mapnik/issues/3567
|
||||
- if [[ ${RESULT} != 0 ]] && [[ ${CXX} =~ 'clang++' ]]; then false; fi;
|
||||
- enabled ${COVERAGE} coverage
|
||||
- enabled ${BENCH} make bench
|
||||
|
||||
after_success:
|
||||
- enabled ${TRIGGER} trigger_downstream
|
||||
- if enabled ${MASON_PUBLISH}; then
|
||||
source ./.mason/mason.sh &&
|
||||
./mason_latest.sh build &&
|
||||
./mason_latest.sh publish;
|
||||
fi
|
||||
|
|
23
CHANGELOG.md
23
CHANGELOG.md
|
@ -6,6 +6,29 @@ Developers: Please commit along with changes.
|
|||
|
||||
For a complete change history, see the git log.
|
||||
|
||||
## 3.0.13
|
||||
|
||||
Released: February 8, 2017
|
||||
|
||||
(Packaged from 2a153c0)
|
||||
|
||||
#### Summary
|
||||
|
||||
- Unbundle `unifont` font from distribution
|
||||
- GeoJSON: imporoved parsing grammar avoiding temp synthesised attribute (#3507)
|
||||
- GeoJSON: expose `num_features_to_query` datasource parameter + unit test (#3515)
|
||||
- Fixed intersecting extents in different projections (PR #3525 )
|
||||
- Fixed `blur` implementation by taking into account `scale_factor`
|
||||
- postgis.input - use 2D box for pgraster bounding box (PR #3551)
|
||||
- Fixed GroupSymbolizer PairLayout with 3+ items (#3526)
|
||||
- Simplified `hash` implementation (204d30e58d3553278ab6bcda2d4122b0f13f6392)
|
||||
- Simplified `mapnik::value` conversion rules (#3570)
|
||||
- Changed `render_thunk_list` to `std::list<render_thunk>` (PR #3585)
|
||||
- Upgraded to variant `v1.1.5`
|
||||
- CSV.input - fixed `blank` line test (8a3a380b3b5c64681f2478b4f0d06f6a907f5eed)
|
||||
- GeoJSON - handle empty elements in position grammar (ref #3609)
|
||||
- mapnik-index - return failure on invalid bounding box (ref #3611)
|
||||
|
||||
## 3.0.12
|
||||
|
||||
Released: September 8, 2016
|
||||
|
|
63
bootstrap.sh
63
bootstrap.sh
|
@ -11,7 +11,7 @@ todo
|
|||
- shrink icu data
|
||||
'
|
||||
|
||||
MASON_VERSION="new-pkgs"
|
||||
MASON_VERSION="3c6df04"
|
||||
|
||||
function setup_mason() {
|
||||
if [[ ! -d ./.mason ]]; then
|
||||
|
@ -19,7 +19,7 @@ function setup_mason() {
|
|||
(cd ./.mason && git checkout ${MASON_VERSION})
|
||||
else
|
||||
echo "Updating to latest mason"
|
||||
(cd ./.mason && git fetch && git checkout ${MASON_VERSION} && git pull)
|
||||
(cd ./.mason && git fetch && git checkout ${MASON_VERSION} && git pull origin ${MASON_VERSION})
|
||||
fi
|
||||
export PATH=$(pwd)/.mason:$PATH
|
||||
export CXX=${CXX:-clang++}
|
||||
|
@ -44,45 +44,37 @@ function install() {
|
|||
mason link $1 $2
|
||||
}
|
||||
|
||||
ICU_VERSION="55.1"
|
||||
ICU_VERSION="57.1"
|
||||
|
||||
function install_mason_deps() {
|
||||
FAIL=0
|
||||
install ccache 3.3.0 &
|
||||
install zlib system &
|
||||
install jpeg_turbo 1.5.0 libjpeg &
|
||||
install libpng 1.6.24 libpng &
|
||||
install libtiff 4.0.6 libtiff &
|
||||
install libpq 9.5.2 &
|
||||
install sqlite 3.14.1 libsqlite3 &
|
||||
install expat 2.2.0 libexpat &
|
||||
install icu ${ICU_VERSION} &
|
||||
install proj 4.9.2 libproj &
|
||||
install pixman 0.34.0 libpixman-1 &
|
||||
install cairo 1.14.6 libcairo &
|
||||
install protobuf 2.6.1 &
|
||||
install ccache 3.3.1
|
||||
install zlib 1.2.8
|
||||
install jpeg_turbo 1.5.1 libjpeg
|
||||
install libpng 1.6.28 libpng
|
||||
install libtiff 4.0.7 libtiff
|
||||
install libpq 9.6.2
|
||||
install sqlite 3.17.0 libsqlite3
|
||||
install expat 2.2.0 libexpat
|
||||
install icu ${ICU_VERSION}
|
||||
install proj 4.9.3 libproj
|
||||
install pixman 0.34.0 libpixman-1
|
||||
install cairo 1.14.8 libcairo
|
||||
install protobuf 3.2.0
|
||||
# technically protobuf is not a mapnik core dep, but installing
|
||||
# here by default helps make mapnik-vector-tile builds easier
|
||||
install webp 0.5.1 libwebp &
|
||||
install gdal 2.1.1 libgdal &
|
||||
install boost 1.61.0 &
|
||||
install boost_libsystem 1.61.0 &
|
||||
install boost_libfilesystem 1.61.0 &
|
||||
install boost_libprogram_options 1.61.0 &
|
||||
install boost_libregex_icu 1.61.0 &
|
||||
install webp 0.6.0 libwebp
|
||||
install libgdal 2.1.3 libgdal
|
||||
install boost 1.63.0
|
||||
install boost_libsystem 1.63.0
|
||||
install boost_libfilesystem 1.63.0
|
||||
install boost_libprogram_options 1.63.0
|
||||
install boost_libregex_icu57 1.63.0
|
||||
# technically boost thread and python are not a core dep, but installing
|
||||
# here by default helps make python-mapnik builds easier
|
||||
install boost_libthread 1.61.0 &
|
||||
install boost_libpython 1.61.0 &
|
||||
install freetype 2.6.5 libfreetype &
|
||||
install harfbuzz 1.3.0 libharfbuzz &
|
||||
for job in $(jobs -p)
|
||||
do
|
||||
wait $job || let "FAIL+=1"
|
||||
done
|
||||
if [[ "$FAIL" != "0" ]]; then
|
||||
exit ${FAIL}
|
||||
fi
|
||||
install boost_libthread 1.63.0
|
||||
install boost_libpython 1.63.0
|
||||
install freetype 2.7.1 libfreetype
|
||||
install harfbuzz 1.4.4-ft libharfbuzz
|
||||
}
|
||||
|
||||
MASON_LINKED_ABS=$(pwd)/mason_packages/.link
|
||||
|
@ -95,6 +87,7 @@ function make_config() {
|
|||
echo "
|
||||
CXX = '$CXX'
|
||||
CC = '$CC'
|
||||
CUSTOM_CXXFLAGS = '-D_GLIBCXX_USE_CXX11_ABI=0'
|
||||
RUNTIME_LINK = 'static'
|
||||
INPUT_PLUGINS = 'all'
|
||||
PATH = '${MASON_LINKED_REL}/bin'
|
||||
|
|
12
circle.yml
12
circle.yml
|
@ -7,11 +7,7 @@ machine:
|
|||
JOBS: 8
|
||||
CCACHE_TEMPDIR: /tmp/.ccache-temp
|
||||
CCACHE_COMPRESS: 1
|
||||
LLVM_VERSION: 3.8
|
||||
pre:
|
||||
- echo "here"
|
||||
post:
|
||||
- echo "there"
|
||||
LLVM_VERSION: 3.9.1
|
||||
|
||||
checkout:
|
||||
post:
|
||||
|
@ -32,9 +28,9 @@ dependencies:
|
|||
database:
|
||||
pre:
|
||||
- ./bootstrap.sh
|
||||
- ./.mason/mason install clang ${LLVM_VERSION}.0
|
||||
- ./.mason/mason link clang ${LLVM_VERSION}.0
|
||||
- ./configure CC="$(pwd)/mason_packages/.link/bin/clang-${LLVM_VERSION}" CXX="$(pwd)/mason_packages/.link/bin/ccache $(pwd)/mason_packages/.link/bin/clang++-${LLVM_VERSION} -Qunused-arguments"
|
||||
- ./.mason/mason install clang++ ${LLVM_VERSION}
|
||||
- ./.mason/mason link clang++ ${LLVM_VERSION}
|
||||
- ./configure CC="$(pwd)/mason_packages/.link/bin/clang" CXX="$(pwd)/mason_packages/.link/bin/ccache $(pwd)/mason_packages/.link/bin/clang++ -Qunused-arguments"
|
||||
- make
|
||||
override:
|
||||
- psql -c 'create database template_postgis;'
|
||||
|
|
10
codecov.yml
Normal file
10
codecov.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
ignore:
|
||||
- "mason_packages"
|
||||
- "benchmark"
|
||||
- "deps"
|
||||
- ".sconf_temp"
|
||||
- "scons"
|
||||
- "test"
|
||||
- "demo"
|
||||
- "docs"
|
||||
- "fonts"
|
2
deps/mapbox/variant
vendored
2
deps/mapbox/variant
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 9a115c5eb3c09509c70a57b25b283b6e1cbba919
|
||||
Subproject commit d2588a8f1d6b5d480d228e6d8a906ce634bdea9a
|
|
@ -116,6 +116,7 @@ public:
|
|||
bool valid() const;
|
||||
void move(T x, T y);
|
||||
std::string to_string() const;
|
||||
T area() const;
|
||||
|
||||
// define some operators
|
||||
box2d_type& operator+=(box2d_type const& other);
|
||||
|
|
|
@ -393,6 +393,11 @@ std::string box2d<T>::to_string() const
|
|||
return s.str();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T box2d<T>::area() const
|
||||
{
|
||||
return width() * height();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
box2d<T>& box2d<T>::operator+=(box2d<T> const& other)
|
||||
|
@ -466,7 +471,7 @@ T box2d<T>::operator[] (int index) const
|
|||
case -1:
|
||||
return maxy_;
|
||||
default:
|
||||
throw std::out_of_range("index out of range, max value is 3, min value is -4 ");
|
||||
throw std::out_of_range(std::string("index out of range, max value is 3, min value is -4 "));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,10 +41,8 @@ public:
|
|||
config_error(std::string const& what,
|
||||
unsigned line_number,
|
||||
std::string const& filename);
|
||||
virtual ~config_error() throw() {}
|
||||
|
||||
virtual const char * what() const throw();
|
||||
|
||||
virtual ~config_error() {}
|
||||
virtual const char * what() const noexcept;
|
||||
void append_context(std::string const& ctx) const;
|
||||
void append_context(std::string const& ctx, xml_node const& node) const;
|
||||
void append_context(xml_node const& node) const;
|
||||
|
|
43
include/mapnik/cxx11_support.hpp
Normal file
43
include/mapnik/cxx11_support.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2016 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAPNIK_CXX11_SUPPORT_HPP
|
||||
#define MAPNIK_CXX11_SUPPORT_HPP
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace mapnik {
|
||||
namespace detail {
|
||||
|
||||
template <bool B, typename T, typename F>
|
||||
using conditional_t = typename std::conditional<B, T, F>::type;
|
||||
|
||||
template <typename T>
|
||||
using decay_t = typename std::decay<T>::type;
|
||||
|
||||
template <bool B, typename T = void>
|
||||
using enable_if_t = typename std::enable_if<B, T>::type;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace mapnik
|
||||
|
||||
#endif // MAPNIK_CXX11_SUPPORT_HPP
|
|
@ -46,14 +46,11 @@ class MAPNIK_DECL datasource_exception : public std::exception
|
|||
public:
|
||||
datasource_exception(std::string const& message)
|
||||
: message_(message)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
~datasource_exception() throw()
|
||||
{
|
||||
}
|
||||
~datasource_exception() {}
|
||||
|
||||
virtual const char* what() const throw()
|
||||
virtual const char* what() const noexcept
|
||||
{
|
||||
return message_.c_str();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <mapnik/debug.hpp>
|
||||
|
||||
// stl
|
||||
#include <bitset>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
|
@ -45,9 +44,9 @@ public:
|
|||
what_( _what )
|
||||
{
|
||||
}
|
||||
virtual ~illegal_enum_value() throw() {}
|
||||
virtual ~illegal_enum_value() {}
|
||||
|
||||
virtual const char * what() const throw()
|
||||
virtual const char * what() const noexcept
|
||||
{
|
||||
return what_.c_str();
|
||||
}
|
||||
|
@ -190,6 +189,8 @@ public:
|
|||
for (unsigned i = 0; i < THE_MAX; ++i)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunknown-pragmas" // clang+gcc
|
||||
#pragma GCC diagnostic ignored "-Wpragmas" // gcc
|
||||
#pragma GCC diagnostic ignored "-Wundefined-var-template"
|
||||
if (str_copy == our_strings_[i])
|
||||
#pragma GCC diagnostic pop
|
||||
|
@ -203,6 +204,8 @@ public:
|
|||
}
|
||||
}
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunknown-pragmas" // clang+gcc
|
||||
#pragma GCC diagnostic ignored "-Wpragmas" // gcc
|
||||
#pragma GCC diagnostic ignored "-Wundefined-var-template"
|
||||
throw illegal_enum_value(std::string("Illegal enumeration value '") +
|
||||
str + "' for enum " + our_name_);
|
||||
|
@ -213,6 +216,8 @@ public:
|
|||
std::string as_string() const
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunknown-pragmas" // clang+gcc
|
||||
#pragma GCC diagnostic ignored "-Wpragmas" // gcc
|
||||
#pragma GCC diagnostic ignored "-Wundefined-var-template"
|
||||
return our_strings_[value_];
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
void get_control_points(double &x1, double &y1, double &x2, double &y2) const;
|
||||
|
||||
private:
|
||||
void swap(gradient& other) throw();
|
||||
void swap(gradient& other) noexcept;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -68,16 +68,6 @@ public:
|
|||
box_elements_.push_back(box_element(box, repeat_key));
|
||||
}
|
||||
|
||||
inline void clear_box_elements()
|
||||
{
|
||||
box_elements_.clear();
|
||||
}
|
||||
|
||||
inline text_symbolizer_properties const& get_properties() const
|
||||
{
|
||||
return info_ptr_->properties;
|
||||
}
|
||||
|
||||
pixel_position_list const& get();
|
||||
|
||||
// Iterate over the given path, placing line-following labels or point labels with respect to label_spacing.
|
||||
|
|
|
@ -50,9 +50,9 @@ public:
|
|||
image_reader_exception(std::string const& message)
|
||||
: message_(message) {}
|
||||
|
||||
~image_reader_exception() throw() {}
|
||||
~image_reader_exception() {}
|
||||
|
||||
virtual const char* what() const throw()
|
||||
virtual const char* what() const noexcept
|
||||
{
|
||||
return message_.c_str();
|
||||
}
|
||||
|
|
|
@ -56,9 +56,9 @@ public:
|
|||
image_writer_exception(std::string const& message)
|
||||
: message_(message) {}
|
||||
|
||||
~image_writer_exception() throw() {}
|
||||
~image_writer_exception(){}
|
||||
|
||||
virtual const char* what() const throw()
|
||||
virtual const char* what() const noexcept
|
||||
{
|
||||
return message_.c_str();
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ struct extract_bounding_box_grammar :
|
|||
qi::rule<Iterator, qi::locals<Iterator>, void(boxes_type&), space_type> features;
|
||||
qi::rule<Iterator, qi::locals<int, box_type>, void(boxes_type&, Iterator const&), space_type> feature;
|
||||
qi::rule<Iterator, qi::locals<box_type>, box_type(), space_type> coords;
|
||||
qi::rule<Iterator, boost::optional<position_type>(), space_type> pos;
|
||||
qi::rule<Iterator, position_type(), space_type> pos;
|
||||
qi::rule<Iterator, void(box_type&), space_type> ring;
|
||||
qi::rule<Iterator, void(box_type&), space_type> rings;
|
||||
qi::rule<Iterator, void(box_type&), space_type> rings_array;
|
||||
|
|
|
@ -42,18 +42,15 @@ struct calculate_bounding_box_impl
|
|||
template <typename T0, typename T1>
|
||||
result_type operator() (T0 & bbox, T1 const& pos) const
|
||||
{
|
||||
if (pos)
|
||||
typename T0::value_type x = pos.x;
|
||||
typename T0::value_type y = pos.y;
|
||||
if (!bbox.valid())
|
||||
{
|
||||
typename T0::value_type x = pos->x;
|
||||
typename T0::value_type y = pos->y;
|
||||
if (!bbox.valid())
|
||||
{
|
||||
bbox.init(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
bbox.expand_to_include(x, y);
|
||||
}
|
||||
bbox.init(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
bbox.expand_to_include(x, y);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -64,10 +61,10 @@ struct push_box_impl
|
|||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
void operator() (T0 & boxes, T1 const& begin, T2 const& box, T3 const& range) const
|
||||
{
|
||||
if (box.valid()) boxes.emplace_back(box,
|
||||
std::make_pair(std::distance(begin,
|
||||
range.begin()),
|
||||
std::distance(range.begin(), range.end())));
|
||||
boxes.emplace_back(box,
|
||||
std::make_pair(std::distance(begin,
|
||||
range.begin()),
|
||||
std::distance(range.begin(), range.end())));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -132,16 +129,16 @@ extract_bounding_box_grammar<Iterator, Boxes, ErrorHandler>::extract_bounding_bo
|
|||
>> lit(':') >> (rings_array(_a) | rings (_a) | ring(_a) | pos[calculate_bounding_box(_a,_1)])[_val = _a]
|
||||
;
|
||||
|
||||
pos = lit('[') > -(double_ > lit(',') > double_) > omit[*(lit(',') > double_)] > lit(']')
|
||||
pos = lit('[') > double_ > lit(',') > double_ > omit[*(lit(',') > double_)] > lit(']')
|
||||
;
|
||||
|
||||
ring = lit('[') >> pos[calculate_bounding_box(_r1,_1)] % lit(',') > lit(']')
|
||||
ring = lit('[') >> -(pos[calculate_bounding_box(_r1,_1)] % lit(',')) >> lit(']')
|
||||
;
|
||||
|
||||
rings = lit('[') >> ring(_r1) % lit(',') > lit(']')
|
||||
rings = lit('[') >> (ring(_r1) % lit(',') > lit(']'))
|
||||
;
|
||||
|
||||
rings_array = lit('[') >> rings(_r1) % lit(',') > lit(']')
|
||||
rings_array = lit('[') >> (rings(_r1) % lit(',') > lit(']'))
|
||||
;
|
||||
|
||||
coords.name("Coordinates");
|
||||
|
|
|
@ -56,26 +56,24 @@ geometry_generator_grammar<OutputIterator, Geometry>::geometry_generator_grammar
|
|||
;
|
||||
|
||||
geometry_dispatch = eps[_a = geometry_type(_val)] <<
|
||||
(&uint_(geometry::geometry_types::Point)[_1 = _a]
|
||||
<< (point | lit("null")))
|
||||
(&uint_(geometry::geometry_types::Point)[_1 = _a] << point)
|
||||
|
|
||||
(&uint_(geometry::geometry_types::LineString)[_1 = _a]
|
||||
<< (linestring | lit("null")))
|
||||
<< (linestring | "{\"type\":\"LineString\",\"coordinates\":[]}"))
|
||||
|
|
||||
(&uint_(geometry::geometry_types::Polygon)[_1 = _a]
|
||||
<< (polygon | lit("null")))
|
||||
<< (polygon | "{\"type\":\"Polygon\",\"coordinates\":[[]]}"))
|
||||
|
|
||||
(&uint_(geometry::geometry_types::MultiPoint)[_1 = _a]
|
||||
<< (multi_point | lit("null")))
|
||||
<< (multi_point | "{\"type\":\"MultiPoint\",\"coordinates\":[]}"))
|
||||
|
|
||||
(&uint_(geometry::geometry_types::MultiLineString)[_1 = _a]
|
||||
<< (multi_linestring | lit("null")))
|
||||
<< (multi_linestring | "{\"type\":\"MultiLineString\",\"coordinates\":[[]]}"))
|
||||
|
|
||||
(&uint_(geometry::geometry_types::MultiPolygon)[_1 = _a]
|
||||
<< (multi_polygon | lit("null")))
|
||||
<< (multi_polygon | "{\"type\":\"MultiPolygon\",\"coordinates\":[[[]]]}"))
|
||||
|
|
||||
(&uint_(geometry::geometry_types::GeometryCollection)[_1 = _a]
|
||||
<< (geometry_collection | lit("null")))
|
||||
(&uint_(geometry::geometry_types::GeometryCollection)[_1 = _a] << geometry_collection)
|
||||
|
|
||||
lit("null")
|
||||
;
|
||||
|
@ -96,7 +94,7 @@ geometry_generator_grammar<OutputIterator, Geometry>::geometry_generator_grammar
|
|||
;
|
||||
point_coord = lit('[') << coordinate << lit(',') << coordinate << lit(']')
|
||||
;
|
||||
linestring_coord = point_coord % lit(',')
|
||||
linestring_coord = (point_coord % lit(','))
|
||||
;
|
||||
polygon_coord = lit('[') << exterior_ring_coord << lit(']') << interior_ring_coord
|
||||
;
|
||||
|
|
|
@ -43,7 +43,10 @@ struct create_point
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator()(T const&) const {} // no-op - shouldn't get here
|
||||
void operator()(T const&) const
|
||||
{
|
||||
throw std::runtime_error("Failed to parse geojson geometry");
|
||||
}
|
||||
Geometry & geom_;
|
||||
};
|
||||
|
||||
|
@ -55,21 +58,21 @@ struct create_linestring
|
|||
|
||||
void operator() (positions const& ring) const
|
||||
{
|
||||
mapnik::geometry::line_string<double> line;
|
||||
std::size_t size = ring.size();
|
||||
if (size > 1)
|
||||
line.reserve(size);
|
||||
for (auto && pt : ring)
|
||||
{
|
||||
mapnik::geometry::line_string<double> line;
|
||||
line.reserve(size);
|
||||
for (auto && pt : ring)
|
||||
{
|
||||
line.emplace_back(std::move(pt));
|
||||
}
|
||||
geom_ = std::move(line);
|
||||
line.emplace_back(std::move(pt));
|
||||
}
|
||||
geom_ = std::move(line);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void operator()(T const&) const {} // no-op - shouldn't get here
|
||||
void operator()(T const&) const
|
||||
{
|
||||
throw std::runtime_error("Failed to parse geojson geometry");
|
||||
}
|
||||
|
||||
Geometry & geom_;
|
||||
};
|
||||
|
@ -106,7 +109,10 @@ struct create_polygon
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator()(T const&) const {} // no-op - shouldn't get here
|
||||
void operator()(T const&) const
|
||||
{
|
||||
throw std::runtime_error("Failed to parse geojson geometry");
|
||||
}
|
||||
|
||||
Geometry & geom_;
|
||||
};
|
||||
|
@ -130,7 +136,10 @@ struct create_multipoint
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator()(T const&) const {} // no-op - shouldn't get here
|
||||
void operator()(T const&) const
|
||||
{
|
||||
throw std::runtime_error("Failed to parse geojson geometry");
|
||||
}
|
||||
|
||||
Geometry & geom_;
|
||||
};
|
||||
|
@ -160,7 +169,10 @@ struct create_multilinestring
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator()(T const&) const {} // no-op - shouldn't get here
|
||||
void operator()(T const&) const
|
||||
{
|
||||
throw std::runtime_error("Failed to parse geojson geometry");
|
||||
}
|
||||
|
||||
Geometry & geom_;
|
||||
};
|
||||
|
@ -201,7 +213,10 @@ struct create_multipolygon
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator()(T const&) const {} // no-op - shouldn't get here
|
||||
void operator()(T const&) const
|
||||
{
|
||||
throw std::runtime_error("Failed to parse geojson geometry");
|
||||
}
|
||||
|
||||
Geometry & geom_;
|
||||
};
|
||||
|
|
|
@ -44,7 +44,7 @@ struct positions_grammar :
|
|||
{
|
||||
positions_grammar(ErrorHandler & error_handler);
|
||||
qi::rule<Iterator, coordinates(),space_type> coords;
|
||||
qi::rule<Iterator, boost::optional<position>(), space_type> pos;
|
||||
qi::rule<Iterator, position(), space_type> pos;
|
||||
qi::rule<Iterator, positions(), space_type> ring;
|
||||
qi::rule<Iterator, std::vector<positions>(), space_type> rings;
|
||||
qi::rule<Iterator, std::vector<std::vector<positions> >(), space_type> rings_array;
|
||||
|
|
|
@ -41,7 +41,7 @@ struct set_position_impl
|
|||
template <typename T0,typename T1>
|
||||
result_type operator() (T0 & coords, T1 const& pos) const
|
||||
{
|
||||
if (pos) coords = *pos;
|
||||
coords = pos;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ struct push_position_impl
|
|||
template <typename T0, typename T1>
|
||||
result_type operator() (T0 & coords, T1 const& pos) const
|
||||
{
|
||||
if (pos) coords.emplace_back(*pos);
|
||||
coords.emplace_back(pos);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -75,13 +75,13 @@ positions_grammar<Iterator, ErrorHandler>::positions_grammar(ErrorHandler & erro
|
|||
|
||||
coords = rings_array[_val = _1] | rings [_val = _1] | ring[_val = _1] | pos[set_position(_val,_1)]
|
||||
;
|
||||
pos = lit('[') > -(double_ > lit(',') > double_) > omit[*(lit(',') > double_)] > lit(']')
|
||||
pos = lit('[') > double_ > lit(',') > double_ > omit[*(lit(',') > double_)] > lit(']')
|
||||
;
|
||||
ring = lit('[') >> pos[push_position(_val,_1)] % lit(',') > lit(']')
|
||||
ring = lit('[') >> -(pos[push_position(_val,_1)] % lit(',')) >> lit(']')
|
||||
;
|
||||
rings = lit('[') >> ring % lit(',') > lit(']')
|
||||
rings = lit('[') >> (ring % lit(',') > lit(']'))
|
||||
;
|
||||
rings_array = lit('[') >> rings % lit(',') > lit(']')
|
||||
rings_array = lit('[') >> (rings % lit(',') > lit(']'))
|
||||
;
|
||||
coords.name("Coordinates");
|
||||
pos.name("Position");
|
||||
|
|
|
@ -77,18 +77,18 @@ struct offset_converter
|
|||
return threshold_;
|
||||
}
|
||||
|
||||
void set_offset(double value)
|
||||
void set_offset(double val)
|
||||
{
|
||||
if (offset_ != value)
|
||||
if (offset_ != val)
|
||||
{
|
||||
offset_ = value;
|
||||
offset_ = val;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
void set_threshold(double value)
|
||||
void set_threshold(double val)
|
||||
{
|
||||
threshold_ = value;
|
||||
threshold_ = val;
|
||||
// no need to reset(), since threshold doesn't affect
|
||||
// offset vertices' computation, it only controls how
|
||||
// far will we be looking for self-intersections
|
||||
|
|
|
@ -42,9 +42,9 @@ struct render_thunk_list_dispatch
|
|||
{
|
||||
offset_ = offset;
|
||||
|
||||
for (render_thunk_ptr const& thunk : thunks)
|
||||
for (render_thunk const& thunk : thunks)
|
||||
{
|
||||
util::apply_visitor(std::ref(*this), *thunk);
|
||||
util::apply_visitor(std::ref(*this), thunk);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,8 +107,7 @@ struct text_render_thunk : util::movable
|
|||
using render_thunk = util::variant<vector_marker_render_thunk,
|
||||
raster_marker_render_thunk,
|
||||
text_render_thunk>;
|
||||
using render_thunk_ptr = std::unique_ptr<render_thunk>;
|
||||
using render_thunk_list = std::list<render_thunk_ptr>;
|
||||
using render_thunk_list = std::list<render_thunk>;
|
||||
|
||||
} // namespace mapnik
|
||||
|
||||
|
|
|
@ -120,11 +120,11 @@ public:
|
|||
return algorithm_;
|
||||
}
|
||||
|
||||
void set_simplify_algorithm(simplify_algorithm_e value)
|
||||
void set_simplify_algorithm(simplify_algorithm_e val)
|
||||
{
|
||||
if (algorithm_ != value)
|
||||
if (algorithm_ != val)
|
||||
{
|
||||
algorithm_ = value;
|
||||
algorithm_ = val;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
@ -134,11 +134,11 @@ public:
|
|||
return tolerance_;
|
||||
}
|
||||
|
||||
void set_simplify_tolerance(double value)
|
||||
void set_simplify_tolerance(double val)
|
||||
{
|
||||
if (tolerance_ != value)
|
||||
if (tolerance_ != val)
|
||||
{
|
||||
tolerance_ = value;
|
||||
tolerance_ = val;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ public:
|
|||
svg_parser_exception(std::string const& message)
|
||||
: message_(message) {}
|
||||
|
||||
~svg_parser_exception() throw() {}
|
||||
~svg_parser_exception() {}
|
||||
|
||||
virtual const char* what() const throw()
|
||||
virtual const char* what() const noexcept
|
||||
{
|
||||
return message_.c_str();
|
||||
}
|
||||
|
|
|
@ -100,18 +100,13 @@ struct strict_value : value_base_type
|
|||
{
|
||||
strict_value() = default;
|
||||
|
||||
strict_value(const char* val)
|
||||
strict_value(const char* val) noexcept(false)
|
||||
: value_base_type(std::string(val)) {}
|
||||
|
||||
template <typename T>
|
||||
strict_value(T const& obj)
|
||||
: value_base_type(typename detail::mapnik_value_type<T>::type(obj))
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, typename U = detail::mapnik_value_type_t<T>>
|
||||
strict_value(T && obj)
|
||||
noexcept(std::is_nothrow_constructible<value_base_type, T && >::value)
|
||||
: value_base_type(std::forward<T>(obj))
|
||||
noexcept(std::is_nothrow_constructible<value_base_type, U>::value)
|
||||
: value_base_type(U(std::forward<T>(obj)))
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
@ -83,7 +83,8 @@ public:
|
|||
if (!size_) return nullptr;
|
||||
std::fseek(file_.get(), 0, SEEK_SET);
|
||||
data_type buffer(new char[size_]);
|
||||
std::fread(buffer.get(), size_, 1, file_.get());
|
||||
auto count = std::fread(buffer.get(), size_, 1, file_.get());
|
||||
if (count != 1) return nullptr;
|
||||
return buffer;
|
||||
}
|
||||
private:
|
||||
|
|
|
@ -32,15 +32,7 @@ template <typename T>
|
|||
using recursive_wrapper = typename mapbox::util::recursive_wrapper<T>;
|
||||
|
||||
template<typename... Types>
|
||||
class variant : public mapbox::util::variant<Types...>
|
||||
{
|
||||
public:
|
||||
// tell spirit that this is an adapted variant
|
||||
struct adapted_variant_tag;
|
||||
using types = std::tuple<Types...>;
|
||||
// inherit ctor's
|
||||
using mapbox::util::variant<Types...>::variant;
|
||||
};
|
||||
using variant = typename mapbox::util::variant<Types...>;
|
||||
|
||||
// unary visitor interface
|
||||
// const
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define MAPNIK_UTIL_VARIANT_IO_HPP
|
||||
|
||||
|
||||
namespace mapnik { namespace util {
|
||||
namespace mapbox { namespace util {
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
|
|
@ -47,30 +47,20 @@ class MAPNIK_DECL value : public value_base
|
|||
public:
|
||||
value() = 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>
|
||||
// Conversion from type T is done via a temporary value or reference
|
||||
// of type U, which is determined by mapnik_value_type_t.
|
||||
//
|
||||
// CAVEAT: We don't check `noexcept(conversion from T to U)`.
|
||||
// But since the type U is either value_bool, value_integer,
|
||||
// value_double or T &&, this conversion SHOULD NEVER throw.
|
||||
template <typename T, typename U = detail::mapnik_value_type_t<T>>
|
||||
value(T && val)
|
||||
noexcept(noexcept(U(std::forward<T>(val))) &&
|
||||
std::is_nothrow_constructible<value_base, U && >::value)
|
||||
noexcept(std::is_nothrow_constructible<value_base, U>::value)
|
||||
: value_base(U(std::forward<T>(val))) {}
|
||||
|
||||
template <typename T,
|
||||
typename U = typename std::enable_if<
|
||||
!detail::is_same_decay<T, value>::value,
|
||||
detail::mapnik_value_type_decay<T>
|
||||
>::type::type>
|
||||
template <typename T, typename U = detail::mapnik_value_type_t<T>>
|
||||
value& operator=(T && val)
|
||||
noexcept(noexcept(U(std::forward<T>(val))) &&
|
||||
std::is_nothrow_assignable<value_base, U && >::value)
|
||||
noexcept(std::is_nothrow_assignable<value_base, U>::value)
|
||||
{
|
||||
value_base::operator=(U(std::forward<T>(val)));
|
||||
return *this;
|
||||
|
|
|
@ -41,9 +41,9 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual ~value_error() throw() {}
|
||||
virtual ~value_error() {}
|
||||
|
||||
virtual const char * what() const throw()
|
||||
virtual const char * what() const noexcept
|
||||
{
|
||||
return what_.c_str();
|
||||
}
|
||||
|
|
|
@ -37,11 +37,6 @@
|
|||
|
||||
namespace mapnik { namespace detail {
|
||||
|
||||
inline void hash_combine(std::size_t & seed, std::size_t val)
|
||||
{
|
||||
seed ^= val + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
|
||||
struct value_hasher
|
||||
{
|
||||
std::size_t operator() (value_null val) const
|
||||
|
@ -54,11 +49,6 @@ struct value_hasher
|
|||
return static_cast<std::size_t>(val.hashCode());
|
||||
}
|
||||
|
||||
std::size_t operator()(value_integer val) const
|
||||
{
|
||||
return static_cast<std::size_t>(val);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
|
@ -72,10 +62,7 @@ struct value_hasher
|
|||
template <typename T>
|
||||
std::size_t mapnik_hash_value(T const& val)
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
detail::hash_combine(seed, util::apply_visitor(detail::value_hasher(), val));
|
||||
detail::hash_combine(seed, val.which());
|
||||
return seed;
|
||||
return util::apply_visitor(detail::value_hasher(), val);
|
||||
}
|
||||
|
||||
} // namespace mapnik
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/cxx11_support.hpp>
|
||||
#include <mapnik/pixel_types.hpp>
|
||||
|
||||
|
||||
|
@ -34,7 +35,6 @@
|
|||
#pragma GCC diagnostic pop
|
||||
|
||||
// stl
|
||||
#include <type_traits>
|
||||
#include <iosfwd>
|
||||
#include <cstddef>
|
||||
|
||||
|
@ -152,90 +152,23 @@ inline std::istream& operator>> ( std::istream & s, value_null & )
|
|||
|
||||
|
||||
namespace detail {
|
||||
// to mapnik::value_type conversions traits
|
||||
template <typename T>
|
||||
struct is_value_bool
|
||||
{
|
||||
constexpr static bool value = std::is_same<T, bool>::value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_value_integer
|
||||
{
|
||||
constexpr static bool value = std::is_integral<T>::value && !std::is_same<T, bool>::value;
|
||||
};
|
||||
// Helper metafunction for mapnik::value construction and assignment.
|
||||
// Returns:
|
||||
// value_bool if T is bool
|
||||
// value_integer if T is an integral type (except bool)
|
||||
// value_double if T is a floating-point type
|
||||
// T && otherwise
|
||||
|
||||
template <typename T>
|
||||
struct is_value_double
|
||||
{
|
||||
constexpr static bool value = std::is_floating_point<T>::value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_value_unicode_string
|
||||
{
|
||||
constexpr static bool value = std::is_same<T, typename mapnik::value_unicode_string>::value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_value_string
|
||||
{
|
||||
constexpr static bool value = std::is_same<T, typename std::string>::value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_value_null
|
||||
{
|
||||
constexpr static bool value = std::is_same<T, typename mapnik::value_null>::value;
|
||||
};
|
||||
|
||||
template <typename T, class Enable = void>
|
||||
struct mapnik_value_type
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
// value_null
|
||||
template <typename T>
|
||||
struct mapnik_value_type<T, typename std::enable_if<detail::is_value_null<T>::value>::type>
|
||||
{
|
||||
using type = mapnik::value_null;
|
||||
};
|
||||
|
||||
// value_bool
|
||||
template <typename T>
|
||||
struct mapnik_value_type<T, typename std::enable_if<detail::is_value_bool<T>::value>::type>
|
||||
{
|
||||
using type = mapnik::value_bool;
|
||||
};
|
||||
|
||||
// value_integer
|
||||
template <typename T>
|
||||
struct mapnik_value_type<T, typename std::enable_if<detail::is_value_integer<T>::value>::type>
|
||||
{
|
||||
using type = mapnik::value_integer;
|
||||
};
|
||||
|
||||
// value_double
|
||||
template <typename T>
|
||||
struct mapnik_value_type<T, typename std::enable_if<detail::is_value_double<T>::value>::type>
|
||||
{
|
||||
using type = mapnik::value_double;
|
||||
};
|
||||
|
||||
// value_unicode_string
|
||||
template <typename T>
|
||||
struct mapnik_value_type<T, typename std::enable_if<detail::is_value_unicode_string<T>::value>::type>
|
||||
{
|
||||
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>;
|
||||
template <typename T, typename dT = decay_t<T>>
|
||||
using mapnik_value_type_t =
|
||||
conditional_t<
|
||||
std::is_same<dT, bool>::value, value_bool,
|
||||
conditional_t<
|
||||
std::is_integral<dT>::value, value_integer,
|
||||
conditional_t<
|
||||
std::is_floating_point<dT>::value, value_double,
|
||||
T && >>>;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#define MAPNIK_MAJOR_VERSION 3
|
||||
#define MAPNIK_MINOR_VERSION 0
|
||||
#define MAPNIK_PATCH_VERSION 12
|
||||
#define MAPNIK_PATCH_VERSION 13
|
||||
|
||||
#define MAPNIK_VERSION (MAPNIK_MAJOR_VERSION*100000) + (MAPNIK_MINOR_VERSION*100) + (MAPNIK_PATCH_VERSION)
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ class MAPNIK_DECL node_not_found: public std::exception
|
|||
{
|
||||
public:
|
||||
node_not_found(std::string const& node_name);
|
||||
virtual const char* what() const throw();
|
||||
~node_not_found() throw ();
|
||||
virtual const char* what() const noexcept;
|
||||
~node_not_found();
|
||||
private:
|
||||
std::string node_name_;
|
||||
protected:
|
||||
|
@ -65,8 +65,8 @@ class MAPNIK_DECL attribute_not_found: public std::exception
|
|||
{
|
||||
public:
|
||||
attribute_not_found(std::string const& node_name, std::string const& attribute_name);
|
||||
virtual const char* what() const throw();
|
||||
~attribute_not_found() throw ();
|
||||
virtual const char* what() const noexcept;
|
||||
~attribute_not_found();
|
||||
private:
|
||||
std::string node_name_;
|
||||
std::string attribute_name_;
|
||||
|
@ -78,8 +78,8 @@ class MAPNIK_DECL more_than_one_child: public std::exception
|
|||
{
|
||||
public:
|
||||
more_than_one_child(std::string const& node_name);
|
||||
virtual const char* what() const throw();
|
||||
~more_than_one_child() throw ();
|
||||
virtual const char* what() const noexcept;
|
||||
~more_than_one_child();
|
||||
private:
|
||||
std::string node_name_;
|
||||
protected:
|
||||
|
|
|
@ -285,7 +285,10 @@ void csv_file_parser::parse_csv_and_boxes(std::istream & csv_file, T & boxes)
|
|||
{
|
||||
auto headers = csv_utils::parse_line(csv_line, separator_, quote_);
|
||||
// skip blank lines
|
||||
if (headers.size() > 0 && headers[0].empty()) ++line_number;
|
||||
if (headers.size() == 1 && headers[0].empty())
|
||||
{
|
||||
++line_number;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::size_t index = 0;
|
||||
|
@ -300,7 +303,7 @@ void csv_file_parser::parse_csv_and_boxes(std::istream & csv_file, T & boxes)
|
|||
std::ostringstream s;
|
||||
s << "CSV Plugin: expected a column header at line ";
|
||||
s << line_number << ", column " << index;
|
||||
s << " - ensure this row contains valid header fields: '";
|
||||
s << " - expected fields: '";
|
||||
s << csv_line;
|
||||
throw mapnik::datasource_exception(s.str());
|
||||
}
|
||||
|
@ -338,7 +341,6 @@ void csv_file_parser::parse_csv_and_boxes(std::istream & csv_file, T & boxes)
|
|||
std::string str("CSV Plugin: could not detect column(s) with the name(s) of wkt, geojson, x/y, or ");
|
||||
str += "latitude/longitude in:\n";
|
||||
str += csv_line;
|
||||
str += "\n - this is required for reading geometry data";
|
||||
throw mapnik::datasource_exception(str);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ plugin_env['LIBS'] = []
|
|||
plugin_env.Append(LIBS=env['PLUGINS']['gdal']['lib'])
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
cmd = 'gdal-config --dep-libs'
|
||||
cmd = '%s --dep-libs' % plugin_env['GDAL_CONFIG']
|
||||
plugin_env.ParseConfig(cmd)
|
||||
|
||||
# Link Library to Dependencies
|
||||
|
|
|
@ -42,7 +42,7 @@ plugin_env['LIBS'] = []
|
|||
plugin_env.Append(LIBS=env['PLUGINS']['ogr']['lib'])
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
cmd = 'gdal-config --dep-libs'
|
||||
cmd = '%s --dep-libs' % plugin_env['GDAL_CONFIG']
|
||||
plugin_env.ParseConfig(cmd)
|
||||
|
||||
# Link Library to Dependencies
|
||||
|
|
|
@ -54,7 +54,9 @@ if env['PLUGIN_LINKING'] == 'shared':
|
|||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_regex%s' % env['BOOST_APPEND'])
|
||||
libraries.insert(0,env['MAPNIK_NAME'])
|
||||
libraries.append('icui18n')
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('icudata')
|
||||
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
|
|
|
@ -44,7 +44,7 @@ raster_info::raster_info(const raster_info& rhs)
|
|||
{
|
||||
}
|
||||
|
||||
void raster_info::swap(raster_info& other) //throw()
|
||||
void raster_info::swap(raster_info& other)
|
||||
{
|
||||
std::swap(file_,other.file_);
|
||||
std::swap(format_,other.format_);
|
||||
|
|
|
@ -137,7 +137,7 @@ const field_descriptor& dbf_file::descriptor(int col) const
|
|||
}
|
||||
|
||||
|
||||
void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, mapnik::feature_impl & f) const throw()
|
||||
void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, mapnik::feature_impl & f) const
|
||||
{
|
||||
using namespace boost::spirit;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
field_descriptor const& descriptor(int col) const;
|
||||
void move_to(int index);
|
||||
std::string string_value(int col) const;
|
||||
void add_attribute(int col, mapnik::transcoder const& tr, mapnik::feature_impl & f) const throw();
|
||||
void add_attribute(int col, mapnik::transcoder const& tr, mapnik::feature_impl & f) const;
|
||||
private:
|
||||
void read_header();
|
||||
int read_short();
|
||||
|
|
|
@ -26,7 +26,7 @@ function add() {
|
|||
CXX=${CXX:-clang++}
|
||||
|
||||
function compile() {
|
||||
${CXX} -o ${app} ${cpp} -Wpadded -I./ -isystem ./mason_packages/.link/include `mapnik-config --all-flags` -Ideps -Lsrc -Ideps/agg/include -Iinclude
|
||||
${CXX} -o ${app} ${cpp} -Wpadded -I./ -I./deps/mapbox/variant/include -isystem ./mason_packages/.link/include -std=c++11 -Ideps -Lsrc -Ideps/agg/include -Iinclude
|
||||
}
|
||||
|
||||
if [[ ${1:-unset} == "unset" ]] || [[ ${2:-unset} == "unset" ]] || [[ $@ == '-h' ]] || [[ $@ == '--help' ]]; then
|
||||
|
|
|
@ -46,15 +46,6 @@ git_submodule_update () {
|
|||
git submodule update "$@"
|
||||
}
|
||||
|
||||
# install and call pip
|
||||
pip () {
|
||||
if ! which pip >/dev/null; then
|
||||
easy_install --user pip && \
|
||||
export PATH="$HOME/Library/Python/2.7/bin:$PATH"
|
||||
fi
|
||||
command pip "$@"
|
||||
}
|
||||
|
||||
# commit_message_contains TEXT
|
||||
# - returns 0 (true) if TEXT is found in commit message
|
||||
# - case-insensitive, plain-text search, not regex
|
||||
|
@ -83,22 +74,16 @@ config_override () {
|
|||
configure () {
|
||||
if enabled ${COVERAGE}; then
|
||||
./configure "$@" PREFIX=${PREFIX} PGSQL2SQLITE=False SVG2PNG=False SVG_RENDERER=False \
|
||||
COVERAGE=True DEBUG=True WARNING_CXXFLAGS="-Wno-unknown-warning-option"
|
||||
COVERAGE=True DEBUG=True
|
||||
else
|
||||
./configure "$@" PREFIX=${PREFIX} WARNING_CXXFLAGS="-Wno-unknown-warning-option"
|
||||
./configure "$@" PREFIX=${PREFIX}
|
||||
fi
|
||||
# print final config values, sorted and indented
|
||||
sort -sk1,1 ./config.py | sed -e 's/^/ /'
|
||||
}
|
||||
|
||||
coverage () {
|
||||
./mason_packages/.link/bin/cpp-coveralls \
|
||||
--gcov ${LLVM_COV} \
|
||||
--exclude mason_packages \
|
||||
--exclude .sconf_temp --exclude benchmark --exclude deps \
|
||||
--exclude scons --exclude test --exclude demo --exclude docs \
|
||||
--exclude fonts \
|
||||
> /dev/null
|
||||
./codecov -x "llvm-cov gcov" -Z
|
||||
}
|
||||
|
||||
trigger_downstream() {
|
||||
|
|
|
@ -79,79 +79,22 @@ struct agg_renderer_process_visitor_l
|
|||
|
||||
void operator() (marker_svg const& marker) const
|
||||
{
|
||||
using color = agg::rgba8;
|
||||
using order = agg::order_rgba;
|
||||
using blender_type = agg::comp_op_adaptor_rgba_pre<color, order>;
|
||||
using pattern_filter_type = agg::pattern_filter_bilinear_rgba8;
|
||||
using pattern_type = agg::line_image_pattern<pattern_filter_type>;
|
||||
using pixfmt_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;
|
||||
using renderer_base = agg::renderer_base<pixfmt_type>;
|
||||
using renderer_type = agg::renderer_outline_image<renderer_base, pattern_type>;
|
||||
using rasterizer_type = agg::rasterizer_outline_aa<renderer_type>;
|
||||
|
||||
value_double opacity = get<value_double, keys::opacity>(sym_, feature_, common_.vars_);
|
||||
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
|
||||
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
|
||||
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_);
|
||||
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
|
||||
image_rgba8 image(bbox_image.width(), bbox_image.height());
|
||||
render_pattern<buffer_type>(*ras_ptr_, marker, image_tr, 1.0, image);
|
||||
|
||||
value_bool clip = get<value_bool, keys::clip>(sym_, feature_, common_.vars_);
|
||||
value_double offset = get<value_double, keys::offset>(sym_, feature_, common_.vars_);
|
||||
value_double simplify_tolerance = get<value_double, keys::simplify_tolerance>(sym_, feature_, common_.vars_);
|
||||
value_double smooth = get<value_double, keys::smooth>(sym_, feature_, common_.vars_);
|
||||
|
||||
agg::rendering_buffer buf(current_buffer_->bytes(),current_buffer_->width(),current_buffer_->height(), current_buffer_->row_size());
|
||||
pixfmt_type pixf(buf);
|
||||
pixf.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym_, feature_, common_.vars_)));
|
||||
renderer_base ren_base(pixf);
|
||||
agg::pattern_filter_bilinear_rgba8 filter;
|
||||
|
||||
pattern_source source(image, opacity);
|
||||
pattern_type pattern (filter,source);
|
||||
renderer_type ren(ren_base, pattern);
|
||||
double half_stroke = std::max(marker.width()/2.0,marker.height()/2.0);
|
||||
int rast_clip_padding = static_cast<int>(std::round(half_stroke));
|
||||
ren.clip_box(-rast_clip_padding,-rast_clip_padding,common_.width_+rast_clip_padding,common_.height_+rast_clip_padding);
|
||||
rasterizer_type ras(ren);
|
||||
|
||||
agg::trans_affine tr;
|
||||
auto transform = get_optional<transform_type>(sym_, keys::geometry_transform);
|
||||
if (transform) evaluate_transform(tr, feature_, common_.vars_, *transform, common_.scale_factor_);
|
||||
|
||||
box2d<double> clip_box = clipping_extent(common_);
|
||||
if (clip)
|
||||
{
|
||||
double padding = (double)(common_.query_extent_.width()/pixmap_.width());
|
||||
if (half_stroke > 1)
|
||||
padding *= half_stroke;
|
||||
if (std::fabs(offset) > 0)
|
||||
padding *= std::fabs(offset) * 1.2;
|
||||
padding *= common_.scale_factor_;
|
||||
clip_box.pad(padding);
|
||||
}
|
||||
using vertex_converter_type = vertex_converter<clip_line_tag, transform_tag,
|
||||
affine_transform_tag,
|
||||
simplify_tag,smooth_tag,
|
||||
offset_transform_tag>;
|
||||
|
||||
vertex_converter_type converter(clip_box,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_);
|
||||
|
||||
if (clip) converter.set<clip_line_tag>();
|
||||
converter.set<transform_tag>(); //always transform
|
||||
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
|
||||
if (std::fabs(offset) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
converter.set<affine_transform_tag>(); // optional affine transform
|
||||
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
|
||||
|
||||
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer_type>;
|
||||
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
|
||||
apply_vertex_converter_type apply(converter, ras);
|
||||
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
|
||||
render(image, marker.width(), marker.height());
|
||||
}
|
||||
|
||||
void operator() (marker_rgba8 const& marker) const
|
||||
{
|
||||
render(marker.get_data(), marker.width(), marker.height());
|
||||
}
|
||||
|
||||
private:
|
||||
void render(mapnik::image_rgba8 const& marker, double width, double height) const
|
||||
{
|
||||
using color = agg::rgba8;
|
||||
using order = agg::order_rgba;
|
||||
|
@ -164,8 +107,6 @@ struct agg_renderer_process_visitor_l
|
|||
using rasterizer_type = agg::rasterizer_outline_aa<renderer_type>;
|
||||
|
||||
value_double opacity = get<value_double, keys::opacity>(sym_, feature_, common_.vars_);
|
||||
mapnik::image_rgba8 const& image = marker.get_data();
|
||||
|
||||
value_bool clip = get<value_bool, keys::clip>(sym_, feature_, common_.vars_);
|
||||
value_double offset = get<value_double, keys::offset>(sym_, feature_, common_.vars_);
|
||||
value_double simplify_tolerance = get<value_double, keys::simplify_tolerance>(sym_, feature_, common_.vars_);
|
||||
|
@ -178,10 +119,10 @@ struct agg_renderer_process_visitor_l
|
|||
renderer_base ren_base(pixf);
|
||||
agg::pattern_filter_bilinear_rgba8 filter;
|
||||
|
||||
pattern_source source(image, opacity);
|
||||
pattern_source source(marker, opacity);
|
||||
pattern_type pattern (filter,source);
|
||||
renderer_type ren(ren_base, pattern);
|
||||
double half_stroke = std::max(marker.width()/2.0,marker.height()/2.0);
|
||||
double half_stroke = std::max(width / 2.0, height / 2.0);
|
||||
int rast_clip_padding = static_cast<int>(std::round(half_stroke));
|
||||
ren.clip_box(-rast_clip_padding,-rast_clip_padding,common_.width_+rast_clip_padding,common_.height_+rast_clip_padding);
|
||||
rasterizer_type ras(ren);
|
||||
|
@ -221,7 +162,6 @@ struct agg_renderer_process_visitor_l
|
|||
mapnik::util::apply_visitor(vertex_processor_type(apply), feature_.get_geometry());
|
||||
}
|
||||
|
||||
private:
|
||||
renderer_common & common_;
|
||||
buffer_type & pixmap_;
|
||||
buffer_type * current_buffer_;
|
||||
|
|
|
@ -88,123 +88,17 @@ struct agg_renderer_process_visitor_p
|
|||
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
|
||||
mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height());
|
||||
render_pattern<buffer_type>(*ras_ptr_, marker, image_tr, 1.0, image);
|
||||
|
||||
agg::rendering_buffer buf(current_buffer_->bytes(), current_buffer_->width(),
|
||||
current_buffer_->height(), current_buffer_->row_size());
|
||||
ras_ptr_->reset();
|
||||
value_double gamma = get<value_double, keys::gamma>(sym_, feature_, common_.vars_);
|
||||
gamma_method_enum gamma_method = get<gamma_method_enum, keys::gamma_method>(sym_, feature_, common_.vars_);
|
||||
if (gamma != gamma_ || gamma_method != gamma_method_)
|
||||
{
|
||||
set_gamma_method(ras_ptr_, gamma, gamma_method);
|
||||
gamma_method_ = gamma_method;
|
||||
gamma_ = gamma;
|
||||
}
|
||||
|
||||
value_bool clip = get<value_bool, keys::clip>(sym_, feature_, common_.vars_);
|
||||
value_double opacity = get<double, keys::opacity>(sym_, feature_, common_.vars_);
|
||||
value_double simplify_tolerance = get<value_double, keys::simplify_tolerance>(sym_, feature_, common_.vars_);
|
||||
value_double smooth = get<value_double, keys::smooth>(sym_, feature_, common_.vars_);
|
||||
|
||||
box2d<double> clip_box = clipping_extent(common_);
|
||||
|
||||
using color = agg::rgba8;
|
||||
using order = agg::order_rgba;
|
||||
using blender_type = agg::comp_op_adaptor_rgba_pre<color, order>;
|
||||
using pixfmt_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;
|
||||
|
||||
using wrap_x_type = agg::wrap_mode_repeat;
|
||||
using wrap_y_type = agg::wrap_mode_repeat;
|
||||
using img_source_type = agg::image_accessor_wrap<agg::pixfmt_rgba32_pre,
|
||||
wrap_x_type,
|
||||
wrap_y_type>;
|
||||
|
||||
using span_gen_type = agg::span_pattern_rgba<img_source_type>;
|
||||
using ren_base = agg::renderer_base<pixfmt_type>;
|
||||
|
||||
using renderer_type = agg::renderer_scanline_aa_alpha<ren_base,
|
||||
agg::span_allocator<agg::rgba8>,
|
||||
span_gen_type>;
|
||||
|
||||
pixfmt_type pixf(buf);
|
||||
pixf.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym_, feature_, common_.vars_)));
|
||||
ren_base renb(pixf);
|
||||
|
||||
unsigned w = image.width();
|
||||
unsigned h = image.height();
|
||||
agg::rendering_buffer pattern_rbuf((agg::int8u*)image.bytes(),w,h,w*4);
|
||||
agg::pixfmt_rgba32_pre pixf_pattern(pattern_rbuf);
|
||||
img_source_type img_src(pixf_pattern);
|
||||
|
||||
pattern_alignment_enum alignment = get<pattern_alignment_enum, keys::alignment>(sym_, feature_, common_.vars_);
|
||||
unsigned offset_x=0;
|
||||
unsigned offset_y=0;
|
||||
|
||||
if (alignment == LOCAL_ALIGNMENT)
|
||||
{
|
||||
double x0 = 0;
|
||||
double y0 = 0;
|
||||
using apply_local_alignment = detail::apply_local_alignment;
|
||||
apply_local_alignment apply(common_.t_,prj_trans_, clip_box, x0, y0);
|
||||
util::apply_visitor(geometry::vertex_processor<apply_local_alignment>(apply), feature_.get_geometry());
|
||||
offset_x = unsigned(current_buffer_->width() - x0);
|
||||
offset_y = unsigned(current_buffer_->height() - y0);
|
||||
}
|
||||
|
||||
span_gen_type sg(img_src, offset_x, offset_y);
|
||||
|
||||
agg::span_allocator<agg::rgba8> sa;
|
||||
renderer_type rp(renb,sa, sg, unsigned(opacity * 255));
|
||||
|
||||
agg::trans_affine tr;
|
||||
auto transform = get_optional<transform_type>(sym_, keys::geometry_transform);
|
||||
if (transform) evaluate_transform(tr, feature_, common_.vars_, *transform, common_.scale_factor_);
|
||||
using vertex_converter_type = vertex_converter<clip_poly_tag,
|
||||
transform_tag,
|
||||
affine_transform_tag,
|
||||
simplify_tag,
|
||||
smooth_tag>;
|
||||
|
||||
vertex_converter_type converter(clip_box,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_);
|
||||
|
||||
|
||||
if (prj_trans_.equal() && clip) converter.set<clip_poly_tag>();
|
||||
converter.set<transform_tag>(); //always transform
|
||||
converter.set<affine_transform_tag>(); // optional affine transform
|
||||
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
|
||||
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
|
||||
|
||||
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer>;
|
||||
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
|
||||
apply_vertex_converter_type apply(converter, *ras_ptr_);
|
||||
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
|
||||
agg::scanline_u8 sl;
|
||||
ras_ptr_->filling_rule(agg::fill_even_odd);
|
||||
agg::render_scanlines(*ras_ptr_, sl, rp);
|
||||
render(image);
|
||||
}
|
||||
|
||||
void operator() (marker_rgba8 const& marker) const
|
||||
{
|
||||
using color = agg::rgba8;
|
||||
using order = agg::order_rgba;
|
||||
using blender_type = agg::comp_op_adaptor_rgba_pre<color, order>;
|
||||
using pixfmt_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;
|
||||
|
||||
using wrap_x_type = agg::wrap_mode_repeat;
|
||||
using wrap_y_type = agg::wrap_mode_repeat;
|
||||
using img_source_type = agg::image_accessor_wrap<agg::pixfmt_rgba32_pre,
|
||||
wrap_x_type,
|
||||
wrap_y_type>;
|
||||
|
||||
using span_gen_type = agg::span_pattern_rgba<img_source_type>;
|
||||
using ren_base = agg::renderer_base<pixfmt_type>;
|
||||
|
||||
using renderer_type = agg::renderer_scanline_aa_alpha<ren_base,
|
||||
agg::span_allocator<agg::rgba8>,
|
||||
span_gen_type>;
|
||||
mapnik::image_rgba8 const& image = marker.get_data();
|
||||
|
||||
render(marker.get_data());
|
||||
}
|
||||
|
||||
private:
|
||||
void render(mapnik::image_rgba8 const& image) const
|
||||
{
|
||||
agg::rendering_buffer buf(current_buffer_->bytes(), current_buffer_->width(),
|
||||
current_buffer_->height(), current_buffer_->row_size());
|
||||
ras_ptr_->reset();
|
||||
|
@ -224,6 +118,23 @@ struct agg_renderer_process_visitor_p
|
|||
|
||||
box2d<double> clip_box = clipping_extent(common_);
|
||||
|
||||
using color = agg::rgba8;
|
||||
using order = agg::order_rgba;
|
||||
using blender_type = agg::comp_op_adaptor_rgba_pre<color, order>;
|
||||
using pixfmt_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;
|
||||
|
||||
using wrap_x_type = agg::wrap_mode_repeat;
|
||||
using wrap_y_type = agg::wrap_mode_repeat;
|
||||
using img_source_type = agg::image_accessor_wrap<agg::pixfmt_rgba32_pre,
|
||||
wrap_x_type,
|
||||
wrap_y_type>;
|
||||
|
||||
using span_gen_type = agg::span_pattern_rgba<img_source_type>;
|
||||
using ren_base = agg::renderer_base<pixfmt_type>;
|
||||
|
||||
using renderer_type = agg::renderer_scanline_aa_alpha<ren_base,
|
||||
agg::span_allocator<agg::rgba8>,
|
||||
span_gen_type>;
|
||||
|
||||
pixfmt_type pixf(buf);
|
||||
pixf.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym_, feature_, common_.vars_)));
|
||||
|
@ -282,7 +193,6 @@ struct agg_renderer_process_visitor_p
|
|||
agg::render_scanlines(*ras_ptr_, sl, rp);
|
||||
}
|
||||
|
||||
private:
|
||||
renderer_common & common_;
|
||||
buffer_type * current_buffer_;
|
||||
std::unique_ptr<rasterizer> const& ras_ptr_;
|
||||
|
|
|
@ -37,7 +37,7 @@ config_error::config_error(std::string const& what,
|
|||
{
|
||||
}
|
||||
|
||||
char const* config_error::what() const throw()
|
||||
char const* config_error::what() const noexcept
|
||||
{
|
||||
msg_ = what_;
|
||||
if (!node_name_.empty())
|
||||
|
|
|
@ -121,7 +121,7 @@ stop_array const& gradient::get_stop_array() const
|
|||
return stops_;
|
||||
}
|
||||
|
||||
void gradient::swap(gradient& other) throw()
|
||||
void gradient::swap(gradient& other) noexcept
|
||||
{
|
||||
std::swap(gradient_type_, other.gradient_type_);
|
||||
std::swap(stops_, other.stops_);
|
||||
|
|
|
@ -90,30 +90,26 @@ struct process_layout
|
|||
return;
|
||||
}
|
||||
|
||||
bound_box layout_box;
|
||||
int middle_ifirst = safe_cast<int>((member_boxes_.size() - 1) >> 1);
|
||||
int top_i = 0;
|
||||
int bottom_i = 0;
|
||||
if (middle_ifirst % 2 == 0)
|
||||
auto max_diff = layout.get_max_difference();
|
||||
auto layout_box = make_horiz_pair(0, 0.0, 0, x_margin, max_diff);
|
||||
auto y_shift = 0.5 * layout_box.height();
|
||||
|
||||
for (size_t i = 2; i < member_boxes_.size(); i += 2)
|
||||
{
|
||||
layout_box = make_horiz_pair(0, 0.0, 0, x_margin, layout.get_max_difference());
|
||||
top_i = middle_ifirst - 2;
|
||||
bottom_i = middle_ifirst + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
top_i = middle_ifirst - 1;
|
||||
bottom_i = middle_ifirst + 1;
|
||||
auto y = layout_box.maxy() + y_margin;
|
||||
auto pair_box = make_horiz_pair(i, y, 1, x_margin, max_diff);
|
||||
layout_box.expand_to_include(pair_box);
|
||||
}
|
||||
|
||||
while (bottom_i >= 0 && top_i >= 0 && top_i < static_cast<int>(member_offsets_.size()))
|
||||
{
|
||||
layout_box.expand_to_include(make_horiz_pair(static_cast<std::size_t>(top_i), layout_box.miny() - y_margin, -1, x_margin, layout.get_max_difference()));
|
||||
layout_box.expand_to_include(make_horiz_pair(static_cast<std::size_t>(bottom_i), layout_box.maxy() + y_margin, 1, x_margin, layout.get_max_difference()));
|
||||
top_i -= 2;
|
||||
bottom_i += 2;
|
||||
}
|
||||
// layout_box.center corresponds to the center of the first row;
|
||||
// shift offsets so that the whole group is centered vertically
|
||||
|
||||
y_shift -= 0.5 * layout_box.height();
|
||||
|
||||
for (auto & offset : member_offsets_)
|
||||
{
|
||||
offset.y += y_shift;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -146,12 +142,12 @@ private:
|
|||
// stores corresponding offset, and returns modified bounding box
|
||||
bound_box box_offset_align(size_t i, double x, double y, int x_dir, int y_dir) const
|
||||
{
|
||||
bound_box const& box = member_boxes_[i];
|
||||
pixel_position offset((x_dir == 0 ? x - input_origin_.x : x - (x_dir < 0 ? box.maxx() : box.minx())),
|
||||
(y_dir == 0 ? y - input_origin_.y : y - (y_dir < 0 ? box.maxy() : box.miny())));
|
||||
|
||||
member_offsets_[i] = offset;
|
||||
return bound_box(box.minx() + offset.x, box.miny() + offset.y, box.maxx() + offset.x, box.maxy() + offset.y);
|
||||
auto box = member_boxes_[i];
|
||||
auto & offset = member_offsets_[i];
|
||||
offset.x = x - (x_dir == 0 ? input_origin_.x : (x_dir < 0 ? box.maxx() : box.minx()));
|
||||
offset.y = y - (y_dir == 0 ? input_origin_.y : (y_dir < 0 ? box.maxy() : box.miny()));
|
||||
box.move(offset.x, offset.y);
|
||||
return box;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ template struct MAPNIK_DECL image_dimensions<65535>;
|
|||
|
||||
} // end ns detail
|
||||
|
||||
template class MAPNIK_DECL image<null_t>;
|
||||
template class MAPNIK_DECL image<rgba8_t>;
|
||||
template class MAPNIK_DECL image<gray8_t>;
|
||||
template class MAPNIK_DECL image<gray8s_t>;
|
||||
|
|
|
@ -119,7 +119,6 @@ void jpeg_saver::operator() (T const& image) const
|
|||
throw image_writer_exception("Mapnik does not support jpeg grayscale images");
|
||||
}
|
||||
|
||||
template void jpeg_saver::operator()<image_rgba8> (image_rgba8 const& image) const;
|
||||
template void jpeg_saver::operator()<image_gray8> (image_gray8 const& image) const;
|
||||
template void jpeg_saver::operator()<image_gray8s> (image_gray8s const& image) const;
|
||||
template void jpeg_saver::operator()<image_gray16> (image_gray16 const& image) const;
|
||||
|
@ -130,7 +129,6 @@ template void jpeg_saver::operator()<image_gray32f> (image_gray32f const& image)
|
|||
template void jpeg_saver::operator()<image_gray64> (image_gray64 const& image) const;
|
||||
template void jpeg_saver::operator()<image_gray64s> (image_gray64s const& image) const;
|
||||
template void jpeg_saver::operator()<image_gray64f> (image_gray64f const& image) const;
|
||||
template void jpeg_saver::operator()<image_view_rgba8> (image_view_rgba8 const& image) const;
|
||||
template void jpeg_saver::operator()<image_view_gray8> (image_view_gray8 const& image) const;
|
||||
template void jpeg_saver::operator()<image_view_gray8s> (image_view_gray8s const& image) const;
|
||||
template void jpeg_saver::operator()<image_view_gray16> (image_view_gray16 const& image) const;
|
||||
|
|
|
@ -316,7 +316,6 @@ void png_saver_pal::operator() (T const& image) const
|
|||
#endif
|
||||
}
|
||||
|
||||
template void png_saver::operator()<image_rgba8> (image_rgba8 const& image) const;
|
||||
template void png_saver::operator()<image_gray8> (image_gray8 const& image) const;
|
||||
template void png_saver::operator()<image_gray8s> (image_gray8s const& image) const;
|
||||
template void png_saver::operator()<image_gray16> (image_gray16 const& image) const;
|
||||
|
@ -327,7 +326,6 @@ template void png_saver::operator()<image_gray32f> (image_gray32f const& image)
|
|||
template void png_saver::operator()<image_gray64> (image_gray64 const& image) const;
|
||||
template void png_saver::operator()<image_gray64s> (image_gray64s const& image) const;
|
||||
template void png_saver::operator()<image_gray64f> (image_gray64f const& image) const;
|
||||
template void png_saver::operator()<image_view_rgba8> (image_view_rgba8 const& image) const;
|
||||
template void png_saver::operator()<image_view_gray8> (image_view_gray8 const& image) const;
|
||||
template void png_saver::operator()<image_view_gray8s> (image_view_gray8s const& image) const;
|
||||
template void png_saver::operator()<image_view_gray16> (image_view_gray16 const& image) const;
|
||||
|
@ -338,7 +336,6 @@ template void png_saver::operator()<image_view_gray32f> (image_view_gray32f cons
|
|||
template void png_saver::operator()<image_view_gray64> (image_view_gray64 const& image) const;
|
||||
template void png_saver::operator()<image_view_gray64s> (image_view_gray64s const& image) const;
|
||||
template void png_saver::operator()<image_view_gray64f> (image_view_gray64f const& image) const;
|
||||
template void png_saver_pal::operator()<image_rgba8> (image_rgba8 const& image) const;
|
||||
template void png_saver_pal::operator()<image_gray8> (image_gray8 const& image) const;
|
||||
template void png_saver_pal::operator()<image_gray8s> (image_gray8s const& image) const;
|
||||
template void png_saver_pal::operator()<image_gray16> (image_gray16 const& image) const;
|
||||
|
@ -349,7 +346,6 @@ template void png_saver_pal::operator()<image_gray32f> (image_gray32f const& ima
|
|||
template void png_saver_pal::operator()<image_gray64> (image_gray64 const& image) const;
|
||||
template void png_saver_pal::operator()<image_gray64s> (image_gray64s const& image) const;
|
||||
template void png_saver_pal::operator()<image_gray64f> (image_gray64f const& image) const;
|
||||
template void png_saver_pal::operator()<image_view_rgba8> (image_view_rgba8 const& image) const;
|
||||
template void png_saver_pal::operator()<image_view_gray8> (image_view_gray8 const& image) const;
|
||||
template void png_saver_pal::operator()<image_view_gray8s> (image_view_gray8s const& image) const;
|
||||
template void png_saver_pal::operator()<image_view_gray16> (image_view_gray16 const& image) const;
|
||||
|
|
|
@ -360,7 +360,6 @@ void webp_saver::operator() (T const& image) const
|
|||
throw image_writer_exception("Mapnik does not support webp grayscale images");
|
||||
}
|
||||
|
||||
template void webp_saver::operator()<image_rgba8> (image_rgba8 const& image) const;
|
||||
template void webp_saver::operator()<image_gray8> (image_gray8 const& image) const;
|
||||
template void webp_saver::operator()<image_gray8s> (image_gray8s const& image) const;
|
||||
template void webp_saver::operator()<image_gray16> (image_gray16 const& image) const;
|
||||
|
@ -371,7 +370,6 @@ template void webp_saver::operator()<image_gray32f> (image_gray32f const& image)
|
|||
template void webp_saver::operator()<image_gray64> (image_gray64 const& image) const;
|
||||
template void webp_saver::operator()<image_gray64s> (image_gray64s const& image) const;
|
||||
template void webp_saver::operator()<image_gray64f> (image_gray64f const& image) const;
|
||||
template void webp_saver::operator()<image_view_rgba8> (image_view_rgba8 const& image) const;
|
||||
template void webp_saver::operator()<image_view_gray8> (image_view_gray8 const& image) const;
|
||||
template void webp_saver::operator()<image_view_gray8s> (image_view_gray8s const& image) const;
|
||||
template void webp_saver::operator()<image_view_gray16> (image_view_gray16 const& image) const;
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
template class MAPNIK_DECL image_view<image_null>;
|
||||
template class MAPNIK_DECL image_view<image_rgba8>;
|
||||
template class MAPNIK_DECL image_view<image_gray8>;
|
||||
template class MAPNIK_DECL image_view<image_gray8s>;
|
||||
|
|
|
@ -37,7 +37,15 @@ bool from_geojson(std::string const& json, mapnik::geometry::geometry<double> &
|
|||
standard::space_type space;
|
||||
char const* start = json.c_str();
|
||||
char const* end = start + json.length();
|
||||
return qi::phrase_parse(start, end, g, space, geom);
|
||||
try
|
||||
{
|
||||
if (!qi::phrase_parse(start, end, g, space, geom))
|
||||
{
|
||||
throw std::runtime_error("Can't parser GeoJSON Geometry");
|
||||
}
|
||||
}
|
||||
catch (...) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
@ -133,7 +133,7 @@ private:
|
|||
void find_unused_nodes_recursive(xml_node const& node, std::string & error_text);
|
||||
std::string ensure_relative_to_xml(boost::optional<std::string> const& opt_path);
|
||||
void ensure_exists(std::string const& file_path);
|
||||
void check_styles(Map const & map) const throw (config_error);
|
||||
void check_styles(Map const & map);
|
||||
boost::optional<color> get_opt_color_attr(boost::property_tree::ptree const& node,
|
||||
std::string const& name);
|
||||
|
||||
|
@ -1155,10 +1155,14 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& node)
|
|||
if (placement_type)
|
||||
{
|
||||
placements = placements::registry::instance().from_xml(*placement_type, node, fontsets_, true);
|
||||
} else {
|
||||
placements = std::make_shared<text_placements_dummy>();
|
||||
if (!placements)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
placements = std::make_shared<text_placements_dummy>();
|
||||
placements->defaults.from_xml(node, fontsets_, true);
|
||||
}
|
||||
placements->defaults.from_xml(node, fontsets_, true);
|
||||
if (strict_ &&
|
||||
!placements->defaults.format_defaults.fontset)
|
||||
{
|
||||
|
@ -1691,7 +1695,7 @@ void map_parser::find_unused_nodes_recursive(xml_node const& node, std::string &
|
|||
}
|
||||
}
|
||||
|
||||
void map_parser::check_styles(Map const & map) const throw (config_error)
|
||||
void map_parser::check_styles(Map const & map)
|
||||
{
|
||||
for (auto const & layer : map.layers())
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ void render_group_symbolizer(group_symbolizer const& sym,
|
|||
|
||||
// keep track of which lists of render thunks correspond to
|
||||
// entries in the group_layout_manager.
|
||||
std::vector<render_thunk_list> layout_thunks;
|
||||
std::list<render_thunk_list> layout_thunks;
|
||||
|
||||
// layout manager to store and arrange bboxes of matched features
|
||||
group_layout_manager layout_manager(props->get_layout());
|
||||
|
@ -182,11 +182,13 @@ void render_group_symbolizer(group_symbolizer const& sym,
|
|||
pixel_position_list const& positions = helper.get();
|
||||
for (pixel_position const& pos : positions)
|
||||
{
|
||||
for (size_t layout_i = 0; layout_i < layout_thunks.size(); ++layout_i)
|
||||
size_t layout_i = 0;
|
||||
for (auto const& thunks : layout_thunks)
|
||||
{
|
||||
pixel_position const& offset = layout_manager.offset_at(layout_i);
|
||||
pixel_position render_offset = pos + offset;
|
||||
render_thunks.render_list(layout_thunks[layout_i], render_offset);
|
||||
render_thunks.render_list(thunks, render_offset);
|
||||
++layout_i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ struct thunk_markers_renderer_context : markers_renderer_context
|
|||
{
|
||||
vector_marker_render_thunk thunk(src, attrs, marker_tr, params.opacity,
|
||||
comp_op_, params.snap_to_pixels);
|
||||
thunks_.push_back(std::make_unique<render_thunk>(std::move(thunk)));
|
||||
thunks_.emplace_back(std::move(thunk));
|
||||
}
|
||||
|
||||
virtual void render_marker(image_rgba8 const& src,
|
||||
|
@ -64,7 +64,7 @@ struct thunk_markers_renderer_context : markers_renderer_context
|
|||
{
|
||||
raster_marker_render_thunk thunk(src, marker_tr, params.opacity,
|
||||
comp_op_, params.snap_to_pixels);
|
||||
thunks_.push_back(std::make_unique<render_thunk>(std::move(thunk)));
|
||||
thunks_.emplace_back(std::move(thunk));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -128,7 +128,7 @@ void render_thunk_extractor::extract_text_thunk(text_render_thunk::helper_ptr &&
|
|||
halo_rasterizer_enum halo_rasterizer = get<halo_rasterizer_enum>(sym, keys::halo_rasterizer, feature_, common_.vars_, HALO_RASTERIZER_FULL);
|
||||
|
||||
text_render_thunk thunk(std::move(helper), opacity, comp_op, halo_rasterizer);
|
||||
thunks_.push_back(std::make_unique<render_thunk>(std::move(thunk)));
|
||||
thunks_.emplace_back(std::move(thunk));
|
||||
|
||||
update_box();
|
||||
}
|
||||
|
|
|
@ -187,23 +187,26 @@ base_symbolizer_helper::base_symbolizer_helper(
|
|||
initialize_points();
|
||||
}
|
||||
|
||||
struct largest_bbox_first
|
||||
template <typename It>
|
||||
static It largest_bbox(It begin, It end)
|
||||
{
|
||||
bool operator() (geometry::geometry<double> const* g0, geometry::geometry<double> const* g1) const
|
||||
if (begin == end)
|
||||
{
|
||||
box2d<double> b0 = geometry::envelope(*g0);
|
||||
box2d<double> b1 = geometry::envelope(*g1);
|
||||
return b0.width() * b0.height() > b1.width() * b1.height();
|
||||
return end;
|
||||
}
|
||||
bool operator() (base_symbolizer_helper::geometry_cref const& g0,
|
||||
base_symbolizer_helper::geometry_cref const& g1) const
|
||||
It largest_geom = begin;
|
||||
double largest_bbox = geometry::envelope(*largest_geom).area();
|
||||
for (++begin; begin != end; ++begin)
|
||||
{
|
||||
// TODO - this has got to be expensive! Can we cache bbox's if there are repeated calls to same geom?
|
||||
box2d<double> b0 = geometry::envelope(g0);
|
||||
box2d<double> b1 = geometry::envelope(g1);
|
||||
return b0.width() * b0.height() > b1.width() * b1.height();
|
||||
double bbox = geometry::envelope(*begin).area();
|
||||
if (bbox > largest_bbox)
|
||||
{
|
||||
largest_bbox = bbox;
|
||||
largest_geom = begin;
|
||||
}
|
||||
}
|
||||
};
|
||||
return largest_geom;
|
||||
}
|
||||
|
||||
void base_symbolizer_helper::initialize_geometries() const
|
||||
{
|
||||
|
@ -216,10 +219,16 @@ void base_symbolizer_helper::initialize_geometries() const
|
|||
type == geometry::geometry_types::MultiPolygon)
|
||||
{
|
||||
bool largest_box_only = text_props_->largest_bbox_only;
|
||||
if (largest_box_only)
|
||||
if (largest_box_only && geometries_to_process_.size() > 1)
|
||||
{
|
||||
geometries_to_process_.sort(largest_bbox_first());
|
||||
auto largest_geom = largest_bbox(
|
||||
geometries_to_process_.begin(),
|
||||
geometries_to_process_.end());
|
||||
geo_itr_ = geometries_to_process_.begin();
|
||||
if (geo_itr_ != largest_geom)
|
||||
{
|
||||
std::swap(*geo_itr_, *largest_geom);
|
||||
}
|
||||
geometries_to_process_.erase(++geo_itr_, geometries_to_process_.end());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,13 +133,13 @@ node_not_found::node_not_found(std::string const& node_name)
|
|||
: node_name_(node_name),
|
||||
msg_() {}
|
||||
|
||||
const char* node_not_found::what() const throw()
|
||||
const char* node_not_found::what() const noexcept
|
||||
{
|
||||
msg_ = std::string("Node "+node_name_+ "not found");
|
||||
return msg_.c_str();
|
||||
}
|
||||
|
||||
node_not_found::~node_not_found() throw() {}
|
||||
node_not_found::~node_not_found() {}
|
||||
|
||||
|
||||
attribute_not_found::attribute_not_found(std::string const& node_name,
|
||||
|
@ -148,25 +148,25 @@ attribute_not_found::attribute_not_found(std::string const& node_name,
|
|||
attribute_name_(attribute_name),
|
||||
msg_() {}
|
||||
|
||||
const char* attribute_not_found::what() const throw()
|
||||
const char* attribute_not_found::what() const noexcept
|
||||
{
|
||||
msg_ = std::string("Attribute '" + attribute_name_ +"' not found in node '"+node_name_+ "'");
|
||||
return msg_.c_str();
|
||||
}
|
||||
|
||||
attribute_not_found::~attribute_not_found() throw() {}
|
||||
attribute_not_found::~attribute_not_found() {}
|
||||
|
||||
more_than_one_child::more_than_one_child(std::string const& node_name)
|
||||
: node_name_(node_name),
|
||||
msg_() {}
|
||||
|
||||
const char* more_than_one_child::what() const throw()
|
||||
const char* more_than_one_child::what() const noexcept
|
||||
{
|
||||
msg_ = std::string("More than one child node in node '" + node_name_ +"'");
|
||||
return msg_.c_str();
|
||||
}
|
||||
|
||||
more_than_one_child::~more_than_one_child() throw() {}
|
||||
more_than_one_child::~more_than_one_child() {}
|
||||
|
||||
xml_node::xml_node(xml_tree &tree, std::string && name, unsigned line, bool is_text)
|
||||
: tree_(tree),
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6ce59adfc4f11b16a5dc0e2020c36dc614850989
|
||||
Subproject commit 4035e34534d6f0ad7060fc4a2f5f6018c61d7a1b
|
|
@ -1 +1 @@
|
|||
Subproject commit 941db3d00920dc7aceaa6797096a7228bc7bac14
|
||||
Subproject commit 17a3e712266a6fac4d89c8473fc0429f6c54fae3
|
|
@ -284,16 +284,19 @@ SECTION("to string") {
|
|||
REQUIRE( string2bool("true",val) );
|
||||
REQUIRE( val == true );
|
||||
|
||||
// mapnik::value hashability
|
||||
using values_container = std::unordered_map<mapnik::value, unsigned>;
|
||||
// mapnik::value hash() and operator== works for all T in value<Types...>
|
||||
mapnik::transcoder tr("utf8");
|
||||
using values_container = std::unordered_map<mapnik::value, mapnik::value>;
|
||||
values_container vc;
|
||||
mapnik::value val2(1);
|
||||
vc[val2] = 1;
|
||||
REQUIRE( vc[1] == static_cast<int>(1) );
|
||||
mapnik::value keys[5] = {true, 123456789, 3.14159f, tr.transcode("Мапник"), mapnik::value_null()} ;
|
||||
for (auto const& k : keys)
|
||||
{
|
||||
vc.insert({k, k});
|
||||
REQUIRE( vc[k] == k );
|
||||
}
|
||||
|
||||
// mapnik::value << to ostream
|
||||
std::stringstream s;
|
||||
mapnik::transcoder tr("utf-8");
|
||||
mapnik::value_unicode_string ustr = tr.transcode("hello world!");
|
||||
mapnik::value streamable(ustr);
|
||||
s << streamable;
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/geometry_type.hpp>
|
||||
#include <mapnik/json/geometry_parser.hpp> // from_geojson
|
||||
#include <mapnik/util/geometry_to_geojson.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/optional/optional_io.hpp>
|
||||
|
||||
/*
|
||||
|
@ -115,6 +117,50 @@ TEST_CASE("geojson") {
|
|||
}
|
||||
}
|
||||
|
||||
SECTION("GeoJSON empty Geometries handling")
|
||||
{
|
||||
auto valid_empty_geometries =
|
||||
{
|
||||
"null", // Point can't be empty
|
||||
"{ \"type\": \"LineString\", \"coordinates\": [] }",
|
||||
"{ \"type\": \"Polygon\", \"coordinates\": [ [ ] ] } ",
|
||||
"{ \"type\": \"MultiPoint\", \"coordinates\": [ ] }",
|
||||
"{ \"type\": \"MultiLineString\", \"coordinates\": [ [] ] }",
|
||||
"{ \"type\": \"MultiPolygon\", \"coordinates\": [[ []] ] }"
|
||||
};
|
||||
|
||||
for (auto const& in : valid_empty_geometries)
|
||||
{
|
||||
std::string json(in);
|
||||
mapnik::geometry::geometry<double> geom;
|
||||
CHECK(mapnik::json::from_geojson(json, geom));
|
||||
// round trip
|
||||
std::string json_out;
|
||||
CHECK(mapnik::util::to_geojson(json_out, geom));
|
||||
json.erase(std::remove_if(
|
||||
std::begin(json), std::end(json),
|
||||
[](char ch) { return std::isspace(ch, std::locale{}); }
|
||||
), std::end(json));
|
||||
REQUIRE(json == json_out);
|
||||
}
|
||||
|
||||
auto invalid_empty_geometries =
|
||||
{
|
||||
"{ \"type\": \"Point\", \"coordinates\": [] }",
|
||||
"{ \"type\": \"LineString\", \"coordinates\": [[]] }"
|
||||
"{ \"type\": \"Polygon\", \"coordinates\": [[[]]] }",
|
||||
"{ \"type\": \"MultiPoint\", \"coordinates\": [[]] }",
|
||||
"{ \"type\": \"MultiLineString\", \"coordinates\": [[[]]] }",
|
||||
"{ \"type\": \"MultiPolygon\", \"coordinates\": [[[[]]]] }"
|
||||
};
|
||||
|
||||
for (auto const& json : invalid_empty_geometries)
|
||||
{
|
||||
mapnik::geometry::geometry<double> geom;
|
||||
CHECK(!mapnik::json::from_geojson(json, geom));
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("GeoJSON num_features_to_query")
|
||||
{
|
||||
std::string filename = "./test/data/json/featurecollection-multipleprops.geojson";
|
||||
|
@ -514,7 +560,8 @@ TEST_CASE("geojson") {
|
|||
|
||||
for (auto const& c_str : {"./test/data/json/feature-malformed-1.geojson",
|
||||
"./test/data/json/feature-malformed-2.geojson",
|
||||
"./test/data/json/feature-malformed-3.geojson"})
|
||||
"./test/data/json/feature-malformed-3.geojson",
|
||||
"./test/data/json/feature-malformed-4.geojson"})
|
||||
{
|
||||
std::string filename(c_str);
|
||||
params["file"] = filename;
|
||||
|
@ -554,43 +601,45 @@ TEST_CASE("geojson") {
|
|||
|
||||
SECTION("GeoJSON ensure mapnik::featureset::next() throws on malformed input")
|
||||
{
|
||||
std::string filename{"./test/data/json/featurecollection-malformed.json"};
|
||||
mapnik::parameters params;
|
||||
params["type"] = "geojson";
|
||||
params["file"] = filename;
|
||||
|
||||
// cleanup in the case of a failed previous run
|
||||
if (mapnik::util::exists(filename + ".index"))
|
||||
for (auto const& c_str : {"./test/data/json/featurecollection-malformed.json"})
|
||||
{
|
||||
mapnik::util::remove(filename + ".index");
|
||||
}
|
||||
std::string filename(c_str);
|
||||
params["file"] = filename;
|
||||
// cleanup in the case of a failed previous run
|
||||
if (mapnik::util::exists(filename + ".index"))
|
||||
{
|
||||
mapnik::util::remove(filename + ".index");
|
||||
}
|
||||
|
||||
CHECK(!mapnik::util::exists(filename + ".index"));
|
||||
int ret = create_disk_index(filename);
|
||||
int ret_posix = (ret >> 8) & 0x000000ff;
|
||||
INFO(ret);
|
||||
INFO(ret_posix);
|
||||
CHECK(mapnik::util::exists(filename + ".index"));
|
||||
CHECK(!mapnik::util::exists(filename + ".index"));
|
||||
int ret = create_disk_index(filename);
|
||||
int ret_posix = (ret >> 8) & 0x000000ff;
|
||||
INFO(ret);
|
||||
INFO(ret_posix);
|
||||
CHECK(mapnik::util::exists(filename + ".index"));
|
||||
|
||||
for (auto cache_features : {true,false})
|
||||
{
|
||||
params["cache_features"] = cache_features;
|
||||
auto ds = mapnik::datasource_cache::instance().create(params);
|
||||
auto fields = ds->get_descriptor().get_descriptors();
|
||||
mapnik::query query(ds->envelope());
|
||||
auto features = ds->features(query);
|
||||
REQUIRE_THROWS(
|
||||
auto feature = features->next();
|
||||
while (feature != nullptr)
|
||||
{
|
||||
feature = features->next();
|
||||
});
|
||||
}
|
||||
for (auto cache_features : {true,false})
|
||||
{
|
||||
params["cache_features"] = cache_features;
|
||||
auto ds = mapnik::datasource_cache::instance().create(params);
|
||||
auto fields = ds->get_descriptor().get_descriptors();
|
||||
mapnik::query query(ds->envelope());
|
||||
auto features = ds->features(query);
|
||||
REQUIRE_THROWS(
|
||||
auto feature = features->next();
|
||||
while (feature != nullptr)
|
||||
{
|
||||
feature = features->next();
|
||||
});
|
||||
}
|
||||
|
||||
// cleanup
|
||||
if (mapnik::util::exists(filename + ".index"))
|
||||
{
|
||||
mapnik::util::remove(filename + ".index");
|
||||
// cleanup
|
||||
if (mapnik::util::exists(filename + ".index"))
|
||||
{
|
||||
mapnik::util::remove(filename + ".index");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -137,6 +137,11 @@ std::pair<bool,typename T::value_type::first_type> process_geojson_file(T & boxe
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (validate_features)
|
||||
{
|
||||
if (verbose) std::clog << "Invalid bbox encountered " << item.first << std::endl;
|
||||
return std::make_pair(false, extent);
|
||||
}
|
||||
}
|
||||
return std::make_pair(true, extent);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,20 @@ source = Split(
|
|||
program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
|
||||
program_env['LINKFLAGS'] = copy(env['LIBMAPNIK_LINKFLAGS'])
|
||||
program_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
|
||||
program_env['LIBS'] = []
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
# pkg-config is more reliable than pg_config across platforms
|
||||
cmd = 'pkg-config libpq --libs --static'
|
||||
try:
|
||||
program_env.ParseConfig(cmd)
|
||||
except OSError, e:
|
||||
program_env.Append(LIBS='pq')
|
||||
else:
|
||||
program_env.Append(LIBS='pq')
|
||||
|
||||
# Link Library to Dependencies
|
||||
libraries = copy(program_env['LIBS'])
|
||||
|
||||
if env['HAS_CAIRO']:
|
||||
program_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS'])
|
||||
|
@ -46,9 +60,8 @@ if env['HAS_CAIRO']:
|
|||
|
||||
program_env.PrependUnique(CPPPATH=['#plugins/input/postgis'])
|
||||
|
||||
libraries = []
|
||||
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
|
||||
libraries.extend([boost_program_options,'sqlite3','pq',env['MAPNIK_NAME'],'icuuc'])
|
||||
libraries.extend([boost_program_options,'sqlite3',env['MAPNIK_NAME'],'icuuc'])
|
||||
|
||||
if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
|
||||
boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1])
|
||||
|
@ -59,13 +72,8 @@ if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
|
|||
if env['SQLITE_LINKFLAGS']:
|
||||
program_env.Append(LINKFLAGS=env['SQLITE_LINKFLAGS'])
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
if env['PLATFORM'] == 'Darwin':
|
||||
libraries.extend(['ldap', 'pam', 'ssl', 'crypto', 'krb5'])
|
||||
else:
|
||||
# TODO - parse back into libraries variable
|
||||
program_env.ParseConfig('pg_config --libs')
|
||||
libraries.append('dl')
|
||||
if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux':
|
||||
libraries.append('dl')
|
||||
|
||||
pgsql2sqlite = program_env.Program('pgsql2sqlite', source, LIBS=libraries)
|
||||
Depends(pgsql2sqlite, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
|
Loading…
Reference in a new issue