Compare commits
296 commits
Author | SHA1 | Date | |
---|---|---|---|
|
7754b6f70b | ||
|
be0904fcd1 | ||
|
268fb53511 | ||
|
80bc8ef819 | ||
|
4d9669bf42 | ||
|
2d0582187a | ||
|
255e2977a7 | ||
|
6f0bab6246 | ||
|
473e6f51b0 | ||
|
23b8ecc997 | ||
|
a103f5e66a | ||
|
bc01c22c33 | ||
|
d8346dd963 | ||
|
bdb30f47a5 | ||
|
b94f00f7c5 | ||
|
489baf8423 | ||
|
efc65126db | ||
|
f1cf712d50 | ||
|
78756a9056 | ||
|
4b0bdd8630 | ||
|
745e393fd6 | ||
|
0d68464194 | ||
|
d5856a2e9d | ||
|
fc7e2e1e3a | ||
|
fe96110e1d | ||
|
19ad1f1156 | ||
|
d09fdd78a9 | ||
|
2ab8602f71 | ||
|
c338cacd71 | ||
|
a1543b359f | ||
|
4698d43234 | ||
|
24425f9ba5 | ||
|
a1e91dcf35 | ||
|
2c396a52ad | ||
|
bc64766d32 | ||
|
8b7427bf6b | ||
|
378b19b53d | ||
|
38fa2a9792 | ||
|
0213b0d8c7 | ||
|
e472ad965e | ||
|
73b8369178 | ||
|
0a7665a52d | ||
|
68cb0c2a03 | ||
|
e49abfc90e | ||
|
0709a251e0 | ||
|
33443575f4 | ||
|
1a043342f2 | ||
|
3f9970075d | ||
|
fd961048ea | ||
|
dbcd1b5fef | ||
|
1dbb1d2c1e | ||
|
6b15fa8e7d | ||
|
3e7146911b | ||
|
fd0ed46225 | ||
|
5531dad9ea | ||
|
cdfba12f07 | ||
|
a42ac13cd8 | ||
|
c3ec239699 | ||
|
cabcc079ff | ||
|
d832b3cf1e | ||
|
2e87bf3586 | ||
|
d4af8f177b | ||
|
b2f8c0816b | ||
|
6714207379 | ||
|
7cc52b12d5 | ||
|
d3e34297c2 | ||
|
69f38549c5 | ||
|
a20c1fc1c4 | ||
|
5ab034a35b | ||
|
142b0ad463 | ||
|
de14f92019 | ||
|
482cd02585 | ||
|
93c379820e | ||
|
fa0d4c923f | ||
|
bf1c55b627 | ||
|
f02c7bcdbf | ||
|
d1f041dad0 | ||
|
8e933607a7 | ||
|
4510c77d55 | ||
|
d4f95642ca | ||
|
ba950893af | ||
|
a93dd6b17d | ||
|
e128d75366 | ||
|
9bcd733def | ||
|
361f40f486 | ||
|
a08ba860da | ||
|
d50562d547 | ||
|
d635b9f436 | ||
|
96435b2a3a | ||
|
2cef98d7f7 | ||
|
98d39ff398 | ||
|
44f1ae3a6e | ||
|
baf5cdbd71 | ||
|
f91d37d93d | ||
|
2f2dcf1eea | ||
|
a602c65354 | ||
|
098fd27291 | ||
|
1bb070c842 | ||
|
75381d217f | ||
|
95a4bff127 | ||
|
110b7b8185 | ||
|
44ef46c810 | ||
|
a30f8ed20c | ||
|
0259ad8041 | ||
|
3c2d65779e | ||
|
cfd9668fdb | ||
|
f8c6ad1e29 | ||
|
2e478ddd37 | ||
|
72989d440b | ||
|
fe3c2762c0 | ||
|
64b874ecb1 | ||
|
7ce142a5aa | ||
|
11a164803d | ||
|
497b516feb | ||
|
5227f84e07 | ||
|
2f28d9897f | ||
|
ebdd96c618 | ||
|
237d3b0714 | ||
|
0b480e0dca | ||
|
6a6891252c | ||
|
6eafffaf57 | ||
|
5d44eab802 | ||
|
a559c01d4a | ||
|
da86e99577 | ||
|
498142f700 | ||
|
c3704c968b | ||
|
b0f3f1aed7 | ||
|
f5ea42b11f | ||
|
51b177802f | ||
|
8d7b75ed6b | ||
|
a408b0732e | ||
|
0a15a955a2 | ||
|
995ab49f23 | ||
|
5996fb07ec | ||
|
9466965725 | ||
|
bd3bbd7d59 | ||
|
f3c71785e4 | ||
|
fa057a8d06 | ||
|
5a97602aa1 | ||
|
8631ae0e74 | ||
|
58a864d133 | ||
|
f64c7573b1 | ||
|
3597c585be | ||
|
8cdd61e846 | ||
|
a6230559f1 | ||
|
7f4adc2d73 | ||
|
d3ec91b29b | ||
|
9447c185d4 | ||
|
f06147b454 | ||
|
2890add8e6 | ||
|
ed3e2454d5 | ||
|
3c0a387af7 | ||
|
249d6cc311 | ||
|
1f5583b433 | ||
|
d09f49b377 | ||
|
0ac9cc091a | ||
|
15d18070aa | ||
|
6e6cf8433b | ||
|
9b4df8ebc8 | ||
|
36a23851f3 | ||
|
2f8485ba89 | ||
|
af95ca85e9 | ||
|
061b29f108 | ||
|
08d8746b3a | ||
|
d2627dfad8 | ||
|
bc528e4c8f | ||
|
2b42e174fd | ||
|
0c1863aa7e | ||
|
a35a064ce4 | ||
|
735eeb4702 | ||
|
7660b9e74a | ||
|
5b88f687a1 | ||
|
c4fb727076 | ||
|
75e7a44c90 | ||
|
3fcd54123c | ||
|
d6bf258f3a | ||
|
20fd003618 | ||
|
9940193c0b | ||
|
9f19fa8943 | ||
|
98fa7699f3 | ||
|
c09f6a8434 | ||
|
d1327dea88 | ||
|
e4b5ddb1aa | ||
|
ce47610677 | ||
|
648f9698a0 | ||
|
a054ee0a31 | ||
|
4d6a1c5cfc | ||
|
3b6f3ff36f | ||
|
1c101c3243 | ||
|
e6173385ca | ||
|
09933916d6 | ||
|
185d788ea4 | ||
|
99a7fa5044 | ||
|
de533ab712 | ||
|
125cd694b8 | ||
|
5911fe6374 | ||
|
b29e56051c | ||
|
7222129e6c | ||
|
ab783cbec4 | ||
|
baf6c9f321 | ||
|
e945eb74fe | ||
|
bc9dcdc584 | ||
|
2fd1f098f5 | ||
|
318be793f9 | ||
|
adacb16a2c | ||
|
85d7f28610 | ||
|
170e20e864 | ||
|
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 |
897 changed files with 11730 additions and 7807 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -5,7 +5,7 @@
|
||||||
[submodule "test/data-visual"]
|
[submodule "test/data-visual"]
|
||||||
path = test/data-visual
|
path = test/data-visual
|
||||||
url = https://github.com/mapnik/test-data-visual.git
|
url = https://github.com/mapnik/test-data-visual.git
|
||||||
branch = master
|
branch = 3.0.x
|
||||||
[submodule "deps/mapbox/variant"]
|
[submodule "deps/mapbox/variant"]
|
||||||
path = deps/mapbox/variant
|
path = deps/mapbox/variant
|
||||||
url = https://github.com/mapbox/variant.git
|
url = https://github.com/mapbox/variant.git
|
||||||
|
|
107
.travis.yml
107
.travis.yml
|
@ -8,62 +8,60 @@ env:
|
||||||
global:
|
global:
|
||||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||||
- CCACHE_COMPRESS=1
|
- CCACHE_COMPRESS=1
|
||||||
- HEAVY_JOBS="2"
|
|
||||||
- PREFIX=/tmp/mapnik
|
- 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="
|
- secure: "F6ivqDNMBQQnrDGA9+7IX+GDswuIqQQd7YPJdQqa2Ked9jddAQDeJClb05ig3JlwfOlYLGZOd43ZX0pKuMtI2Gbkwz211agGP9S3YunwlRg8iWtJlO5kYFUdKCmJNhjg4icfkGELCgwXn+zuEWFSLpkPcjqAFKFlQrIJeAJJgKM="
|
||||||
addons:
|
|
||||||
postgresql: "9.4"
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.ccache
|
- $HOME/.ccache
|
||||||
|
|
||||||
|
dist: trusty
|
||||||
|
sudo: false
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
sudo: false
|
name: Linux clang-3.9
|
||||||
compiler: ": clang"
|
env: >-
|
||||||
env: JOBS=8 MASON_PUBLISH=true CXX="ccache clang++-3.8 -Qunused-arguments" CC="clang-3.8" TRIGGER=true
|
CXX="ccache clang++-3.9 -Qunused-arguments"
|
||||||
|
CC="clang-3.9"
|
||||||
|
ENABLE_GLIBC_WORKAROUND=true
|
||||||
|
before_install:
|
||||||
|
- export LINKFLAGS="-fuse-ld=gold-2.26"
|
||||||
addons:
|
addons:
|
||||||
|
postgresql: "9.4"
|
||||||
apt:
|
apt:
|
||||||
sources: [ 'ubuntu-toolchain-r-test']
|
sources: [ 'ubuntu-toolchain-r-test' ]
|
||||||
packages: [ 'libstdc++-5-dev', 'xutils-dev']
|
packages: [ 'clang-3.9', 'libstdc++-4.9-dev', 'xutils-dev', 'postgresql-9.4-postgis-2.3' ]
|
||||||
- os: linux
|
- os: linux
|
||||||
sudo: false
|
name: Linux clang-3.9 + coverage
|
||||||
compiler: ": clang-coverage"
|
env: >-
|
||||||
env: JOBS=8 COVERAGE=true CXX="ccache clang++-3.8 -Qunused-arguments" CC="clang-3.8"
|
CXX="ccache clang++-3.9 -Qunused-arguments"
|
||||||
|
CC="clang-3.9"
|
||||||
|
COVERAGE=true
|
||||||
|
before_install:
|
||||||
|
- export LINKFLAGS="-fuse-ld=gold-2.26"
|
||||||
|
- export LLVM_COV="llvm-cov-3.9"
|
||||||
addons:
|
addons:
|
||||||
|
postgresql: "9.4"
|
||||||
apt:
|
apt:
|
||||||
sources: [ 'ubuntu-toolchain-r-test']
|
sources: [ 'ubuntu-toolchain-r-test' ]
|
||||||
packages: ['libstdc++-5-dev', 'xutils-dev' ]
|
packages: [ 'clang-3.9', 'llvm-3.9', 'libstdc++-4.9-dev', 'xutils-dev', 'postgresql-9.4-postgis-2.3' ]
|
||||||
- os: osx
|
- os: osx
|
||||||
compiler: ": clang-osx"
|
name: OSX clang
|
||||||
# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
|
# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
|
||||||
osx_image: xcode7.3 # upgrades clang from 6 -> 7
|
osx_image: xcode7.3 # upgrades clang from 6 -> 7
|
||||||
env: JOBS=4 MASON_PUBLISH=true CXX="ccache clang++ -Qunused-arguments"
|
env: >-
|
||||||
|
CXX="ccache clang++ -Qunused-arguments"
|
||||||
before_install:
|
|
||||||
# workaround travis rvm bug
|
|
||||||
# http://superuser.com/questions/1044130/why-am-i-having-how-can-i-fix-this-error-shell-session-update-command-not-f
|
|
||||||
- |
|
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
|
||||||
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 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:
|
install:
|
||||||
- on 'linux' export PYTHONPATH=${PYTHONUSERBASE}/lib/python2.7/site-packages
|
- source scripts/travis-common.sh
|
||||||
- on 'osx' export PYTHONPATH=${PYTHONUSERBASE}/lib/python/site-packages
|
# workaround travis rvm bug
|
||||||
|
# http://superuser.com/questions/1044130/why-am-i-having-how-can-i-fix-this-error-shell-session-update-command-not-f
|
||||||
|
- on 'osx' rvm get head || true
|
||||||
|
- export PATH=${PREFIX}/bin:$(pwd)/mason_packages/.link/bin:${PATH}
|
||||||
|
- export COVERAGE=${COVERAGE:-false}
|
||||||
|
- export BENCH=${BENCH:-false}
|
||||||
- on 'osx' export DATA_PATH=$(brew --prefix)/var/postgres
|
- on 'osx' export DATA_PATH=$(brew --prefix)/var/postgres
|
||||||
- on 'osx' rm -rf ${DATA_PATH}
|
- on 'osx' rm -rf ${DATA_PATH}
|
||||||
- on 'osx' initdb ${DATA_PATH} -E utf8
|
- on 'osx' initdb ${DATA_PATH} -E utf8
|
||||||
|
@ -72,40 +70,31 @@ install:
|
||||||
- on 'osx' createuser -s postgres
|
- on 'osx' createuser -s postgres
|
||||||
- psql -c 'create database template_postgis;' -U postgres
|
- psql -c 'create database template_postgis;' -U postgres
|
||||||
- psql -c 'create extension postgis;' -d 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:
|
before_script:
|
||||||
|
- export JOBS=${JOBS:-4}
|
||||||
|
- export HEAVY_JOBS=${HEAVY_JOBS:-2}
|
||||||
|
- export SCONSFLAGS='--debug=time'
|
||||||
- source bootstrap.sh
|
- 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"
|
|
||||||
fi
|
|
||||||
- ccache --version
|
- ccache --version
|
||||||
- ccache -p || true
|
- ccache -p || true
|
||||||
- ccache --show-stats || true
|
- ccache --show-stats || true
|
||||||
- commit_message_parse
|
- commit_message_parse
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- export SCONSFLAGS='--debug=time'
|
- git_submodule_update --init deps/
|
||||||
- configure BENCHMARK=${BENCH}
|
- configure BENCHMARK=${BENCH} ENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-false}
|
||||||
- cat config.log
|
- cat config.log
|
||||||
# we limit the `make` to 40 min
|
# we limit the `make` to 40 min
|
||||||
# to ensure that slow builds still upload their
|
# to ensure that slow builds still upload their
|
||||||
# ccache results and therefore should be faster
|
# ccache results and therefore should be faster
|
||||||
# (and might work) for the next build
|
# (and might work) for the next build
|
||||||
- DURATION=2400
|
- DEADLINE=$(( $(date +%s) + 40 * 60 ))
|
||||||
- scripts/travis-command-wrapper.py -s "date" -i 120 --deadline=$(( $(date +%s) + ${DURATION} )) make
|
- scripts/travis-command-wrapper.py -s "date" -i 120 --deadline="$DEADLINE" make
|
||||||
- make test
|
- test_ok && git_submodule_update --init test/
|
||||||
- enabled ${COVERAGE} coverage
|
- test_ok && make test
|
||||||
- enabled ${BENCH} make bench
|
- test_ok && enabled ${COVERAGE} coverage
|
||||||
|
- test_ok && enabled ${BENCH} make bench
|
||||||
after_success:
|
- ./scripts/check_glibcxx.sh
|
||||||
- enabled ${TRIGGER} trigger_downstream
|
|
||||||
- if enabled ${MASON_PUBLISH}; then
|
|
||||||
source ./.mason/mason.sh &&
|
|
||||||
./mason_latest.sh build &&
|
|
||||||
./mason_latest.sh publish;
|
|
||||||
fi
|
|
||||||
|
|
166
CHANGELOG.md
166
CHANGELOG.md
|
@ -6,6 +6,172 @@ Developers: Please commit along with changes.
|
||||||
|
|
||||||
For a complete change history, see the git log.
|
For a complete change history, see the git log.
|
||||||
|
|
||||||
|
## 3.0.24
|
||||||
|
|
||||||
|
Released: January 5, 2021
|
||||||
|
|
||||||
|
(Packaged from be0904fcd)
|
||||||
|
|
||||||
|
- Backport support for `BOOST_VERSION >= 1_74`
|
||||||
|
|
||||||
|
## 3.0.23
|
||||||
|
|
||||||
|
Released: February 18, 2020
|
||||||
|
|
||||||
|
(Packaged from bdb30f47a)
|
||||||
|
|
||||||
|
- Complete build system migration to Py3 syntax (4b0bdd8630f6999e5db346fd767a06b8ceba8fb9)
|
||||||
|
- Add support for `BOOST_VERSION >= 1_72`
|
||||||
|
- gdal.input - add support for int32 pixel types (efc65126db5d51977d6374f9b983fc441f334eb6)
|
||||||
|
|
||||||
|
|
||||||
|
## 3.0.22
|
||||||
|
|
||||||
|
Released: January 22, 2019
|
||||||
|
|
||||||
|
(Packaged from c338cacd7)
|
||||||
|
|
||||||
|
- Improved padding calculation for clipping polygons and lines ([#4001](https://github.com/mapnik/mapnik/pull/4001))
|
||||||
|
- New option `line-pattern="repeat"` of LinePatternSymbolizer to repeat the pattern in the area given by `stroke-` options ([#4004](https://github.com/mapnik/mapnik/pull/4004))
|
||||||
|
- Fixed global and local pattern alignment ([#4005](https://github.com/mapnik/mapnik/pull/4005))
|
||||||
|
- SVG patterns are rendered as vectors into PDF or SVG with Cairo backend ([#4012](https://github.com/mapnik/mapnik/pull/4012))
|
||||||
|
|
||||||
|
## 3.0.21
|
||||||
|
|
||||||
|
Released: October 8, 2018
|
||||||
|
|
||||||
|
(Packaged from 1dbb1d2c1)
|
||||||
|
|
||||||
|
#### Core
|
||||||
|
|
||||||
|
- Fixed compilation with ICU >= 61 (#3963)
|
||||||
|
- Fixed bbox reprojection (#3940)
|
||||||
|
- SVG: enabled unsupported attributes handling
|
||||||
|
|
||||||
|
#### Plugins
|
||||||
|
|
||||||
|
- GDAL: Fixed several issues with overviews (#3939)
|
||||||
|
|
||||||
|
|
||||||
|
## 3.0.20
|
||||||
|
|
||||||
|
Released: April 12, 2018
|
||||||
|
|
||||||
|
(Packaged from f02c7bcdb)
|
||||||
|
|
||||||
|
- Make max_image_area a datasource parameter for GDAL.
|
||||||
|
- GDAL Driver Overview Fix and Memory Reduction (#3872)
|
||||||
|
- Raster colorizer: check image bounds (#3879)
|
||||||
|
- Removed usage of `typename` in template template declarations (available in c++17) (#3882)
|
||||||
|
|
||||||
|
## 3.0.19
|
||||||
|
|
||||||
|
Released: March 06, 2018
|
||||||
|
|
||||||
|
(Packaged from d50562d54)
|
||||||
|
|
||||||
|
- Backported scaling of precision by polygon size (#3844)
|
||||||
|
- Backported GRID placement (#3847, #3854, #3855)
|
||||||
|
- Added missing `MAPNIK_DECL` to all `text_placement_` types (7ce142a5aa8e9da5ddd11266a054c1e69052230d)
|
||||||
|
- Fixed invalid memory access if input_buffer size is zero (a602c65354a4b595821d2300f38ebc107d07e2a9)
|
||||||
|
- Fixed handling of an empty polygon in grid_vertex_converter (2f2dcf1eeae71aaa7878f4bc9a39741321f07e68)
|
||||||
|
- Fixed PROJ_LIB detection logic (44f1ae3a6e9e9979d1a93343f40db6cd7dbf51d5)
|
||||||
|
- Default to `icu-config` for obtaining `ICU_DATA` if `u_getDataDirectory fails (2cef98d7f76cdd302afcf15f1c585379537e8f1d)
|
||||||
|
|
||||||
|
## 3.0.18
|
||||||
|
|
||||||
|
Released: January 26, 2018
|
||||||
|
|
||||||
|
(Packaged from 44ef46c81)
|
||||||
|
|
||||||
|
- SVG parser - fixed logic for calculating dimensions when `width` and `height` expressed in
|
||||||
|
percentage units (#3812)
|
||||||
|
- New improved `interior` placement algorithm (#3839)
|
||||||
|
- Fixed handling of an empty interior rings in `polygon_vertex_processor` (#3833)
|
||||||
|
- Fixed handling of an empty interior rings in `vertex_adapter' (#3842)(#3838)
|
||||||
|
|
||||||
|
## 3.0.17
|
||||||
|
|
||||||
|
Released: November 29, 2017
|
||||||
|
|
||||||
|
(Packaged from ebdd96c61)
|
||||||
|
|
||||||
|
- Use `Scons 3` as an internal build sytsem + support both Python 2 and 3.
|
||||||
|
- Added glibcxx workaround to support libstdc++-4.8
|
||||||
|
|
||||||
|
## 3.0.16
|
||||||
|
|
||||||
|
Released: November 16, 2017
|
||||||
|
|
||||||
|
(Packaged from 8d7b75e)
|
||||||
|
|
||||||
|
- Added "strict" SVG parsing mode with consistent error handling and disabled processing of unsupported attributes.
|
||||||
|
- Added support for `<use>` element.
|
||||||
|
- Implemented compile time string literal to integer conversion, to be able to convert large `if/else if/else` statements to `switch`.
|
||||||
|
- WKB reader - pre-allocate optimisations in `multi_polygon` and `geometry_collection`.
|
||||||
|
- Set alpha values in RGBA TIFFs even when `NODATA` value is pesent.
|
||||||
|
- Support building with ICU >= 59.
|
||||||
|
- SCons - added ICU_DATA, PROJ_LIB and GDAL_DATA settings, available via `mapnik-config`
|
||||||
|
- Fixed centroid and interior text placement algorithms (#3771)
|
||||||
|
- Fixed memory leak (#3775)
|
||||||
|
- SVG parser - fixed default gradient vector in linear gradient.
|
||||||
|
- Fixed bounding box collection logic (#3709)
|
||||||
|
|
||||||
|
## 3.0.15
|
||||||
|
|
||||||
|
Released: June 16, 2017
|
||||||
|
|
||||||
|
#### Summary
|
||||||
|
|
||||||
|
(Packaged from 6e6cf84)
|
||||||
|
|
||||||
|
- Restored `filter_factor` logic in `gdal.input` and added to `raster.input` (#3699)
|
||||||
|
(updated tests https://github.com/mapnik/test-data-visual/commit/fd518f1f512b8aea4ac740c2ce12c249616a291c)
|
||||||
|
- Fixed bug related to rows swapping implementation in `tiff_reader` ref #3679
|
||||||
|
(updated visual tests to catch this regression in the future
|
||||||
|
https://github.com/mapnik/test-data-visual/commit/be0ba965cd2240576a8edfca84801cbb7a4832d6)
|
||||||
|
- TIFF I/O - port memory mapped based I/O from master
|
||||||
|
|
||||||
|
## 3.0.14
|
||||||
|
|
||||||
|
Released: June 5, 2017
|
||||||
|
|
||||||
|
(Packaged from 2b42e17)
|
||||||
|
|
||||||
|
#### Summary
|
||||||
|
|
||||||
|
- Fixed problems with high levels of overzooming in the GDAL and raster plugin where data would be slightly offset
|
||||||
|
- High levels of overzooming on raster data no longer results in the return of a transparent image.
|
||||||
|
- Fixed bug in `mapnik::util::file::data()` (a220bda05d2aa1)
|
||||||
|
- TIFF I/O - added support for grey scale multiband images + fixed and made generic `read_stripped` and `read_generic`.
|
||||||
|
- shapeindex - return error code when no features can read from shapefile (#3198)
|
||||||
|
- Upgrade Scons to `2.5.1`
|
||||||
|
- Fixed bug (typo) in `raster_featureset.cpp` (#3696)
|
||||||
|
- Made `freetype_engine` singleton again. This allows for better control of its life-time. Original interface is preserved via adding static methods (#3688)
|
||||||
|
|
||||||
|
## 3.0.13
|
||||||
|
|
||||||
|
Released: February 8, 2017
|
||||||
|
|
||||||
|
(Packaged from 2a153c0)
|
||||||
|
|
||||||
|
#### Summary
|
||||||
|
|
||||||
|
- Unbundle `unifont` font from distribution
|
||||||
|
- GeoJSON: improved 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
|
## 3.0.12
|
||||||
|
|
||||||
Released: September 8, 2016
|
Released: September 8, 2016
|
||||||
|
|
|
@ -9,7 +9,6 @@ _/ _/ _/_/_/ _/_/_/ _/ _/ _/ _/ _/
|
||||||
```
|
```
|
||||||
|
|
||||||
[![Build Status Linux](https://api.travis-ci.org/mapnik/mapnik.svg?branch=master)](http://travis-ci.org/mapnik/mapnik)
|
[![Build Status Linux](https://api.travis-ci.org/mapnik/mapnik.svg?branch=master)](http://travis-ci.org/mapnik/mapnik)
|
||||||
[![Build Status Windows](https://ci.appveyor.com/api/projects/status/hc9l7okdjtucfqqn?branch=master&svg=true)](https://ci.appveyor.com/project/Mapbox/mapnik)
|
|
||||||
[![Coverage Status](https://coveralls.io/repos/mapnik/mapnik/badge.svg?branch=master&service=github)](https://coveralls.io/github/mapnik/mapnik?branch=master)
|
[![Coverage Status](https://coveralls.io/repos/mapnik/mapnik/badge.svg?branch=master&service=github)](https://coveralls.io/github/mapnik/mapnik?branch=master)
|
||||||
|
|
||||||
Mapnik is an open source toolkit for developing mapping applications. At the core is a C++ shared library providing algorithms and patterns for spatial data access and visualization.
|
Mapnik is an open source toolkit for developing mapping applications. At the core is a C++ shared library providing algorithms and patterns for spatial data access and visualization.
|
||||||
|
@ -28,4 +27,4 @@ Please note that this project is released with a [Contributor Code of Conduct](h
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
Mapnik software is free and is released under the LGPL ([GNU Lesser General Public License](http://www.gnu.org/licenses/lgpl.html)). Please see [COPYING](https://github.com/mapnik/mapnik/blob/master/COPYING) for more information.
|
Mapnik software is free and is released under the LGPL v2.1 ([GNU Lesser General Public License, version 2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)). Please see [COPYING](https://github.com/mapnik/mapnik/blob/master/COPYING) for more information.
|
||||||
|
|
280
SConstruct
280
SConstruct
|
@ -1,6 +1,6 @@
|
||||||
# This file is part of Mapnik (c++ mapping toolkit)
|
# This file is part of Mapnik (c++ mapping toolkit)
|
||||||
#
|
#
|
||||||
# Copyright (C) 2015 Artem Pavlenko
|
# Copyright (C) 2017 Artem Pavlenko
|
||||||
#
|
#
|
||||||
# Mapnik is free software; you can redistribute it and/or
|
# Mapnik is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
# License along with this library; if not, write to the Free Software
|
# License along with this library; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
from __future__ import print_function # support python2
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -41,7 +42,7 @@ ICU_LIBS_DEFAULT='/usr/'
|
||||||
|
|
||||||
DEFAULT_CC = "cc"
|
DEFAULT_CC = "cc"
|
||||||
DEFAULT_CXX = "c++"
|
DEFAULT_CXX = "c++"
|
||||||
DEFAULT_CXX11_CXXFLAGS = " -std=c++11"
|
DEFAULT_CXX11_CXXFLAGS = " -std=c++11 -DU_USING_ICU_NAMESPACE=0"
|
||||||
DEFAULT_CXX11_LINKFLAGS = ""
|
DEFAULT_CXX11_LINKFLAGS = ""
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
# homebrew default
|
# homebrew default
|
||||||
|
@ -99,7 +100,10 @@ pretty_dep_names = {
|
||||||
'osm':'more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin',
|
'osm':'more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin',
|
||||||
'boost_regex_icu':'libboost_regex built with optional ICU unicode support is needed for unicode regex support in mapnik.',
|
'boost_regex_icu':'libboost_regex built with optional ICU unicode support is needed for unicode regex support in mapnik.',
|
||||||
'sqlite_rtree':'The SQLite plugin requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)',
|
'sqlite_rtree':'The SQLite plugin requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)',
|
||||||
'pgsql2sqlite_rtree':'The pgsql2sqlite program requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)'
|
'pgsql2sqlite_rtree':'The pgsql2sqlite program requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)',
|
||||||
|
'PROJ_LIB':'The directory where proj4 stores its data files. Must exist for proj4 to work correctly',
|
||||||
|
'GDAL_DATA':'The directory where GDAL stores its data files. Must exist for GDAL to work correctly',
|
||||||
|
'ICU_DATA':'The directory where icu stores its data files. If ICU reports a path, it must exist. ICU can also be built without .dat files and in that case this path is empty'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Core plugin build configuration
|
# Core plugin build configuration
|
||||||
|
@ -133,7 +137,7 @@ env = Environment(ENV=os.environ)
|
||||||
init_environment(env)
|
init_environment(env)
|
||||||
|
|
||||||
def fix_path(path):
|
def fix_path(path):
|
||||||
return os.path.abspath(path)
|
return str(os.path.abspath(path))
|
||||||
|
|
||||||
def color_print(color,text,newline=True):
|
def color_print(color,text,newline=True):
|
||||||
# 1 - red
|
# 1 - red
|
||||||
|
@ -142,15 +146,15 @@ def color_print(color,text,newline=True):
|
||||||
# 4 - blue
|
# 4 - blue
|
||||||
text = "\033[9%sm%s\033[0m" % (color,text)
|
text = "\033[9%sm%s\033[0m" % (color,text)
|
||||||
if not newline:
|
if not newline:
|
||||||
print text,
|
print (text, end='')
|
||||||
else:
|
else:
|
||||||
print text
|
print (text)
|
||||||
|
|
||||||
def regular_print(color,text,newline=True):
|
def regular_print(color,text,newline=True):
|
||||||
if not newline:
|
if not newline:
|
||||||
print text,
|
print (text, end='')
|
||||||
else:
|
else:
|
||||||
print text
|
print (text)
|
||||||
|
|
||||||
def call(cmd, silent=False):
|
def call(cmd, silent=False):
|
||||||
stdin, stderr = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE).communicate()
|
stdin, stderr = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE).communicate()
|
||||||
|
@ -241,7 +245,7 @@ def sort_paths(items,priority):
|
||||||
path_types['other'].append(i)
|
path_types['other'].append(i)
|
||||||
# build up new list based on priority list
|
# build up new list based on priority list
|
||||||
for path in priority:
|
for path in priority:
|
||||||
if path_types.has_key(path):
|
if path in path_types:
|
||||||
dirs = path_types[path]
|
dirs = path_types[path]
|
||||||
new.extend(dirs)
|
new.extend(dirs)
|
||||||
path_types.pop(path)
|
path_types.pop(path)
|
||||||
|
@ -270,6 +274,9 @@ def pretty_dep(dep):
|
||||||
return '%s (%s)' % (dep,'more info see: https://github.com/mapnik/mapnik/wiki/Mapnik-Installation & http://www.boost.org')
|
return '%s (%s)' % (dep,'more info see: https://github.com/mapnik/mapnik/wiki/Mapnik-Installation & http://www.boost.org')
|
||||||
return dep
|
return dep
|
||||||
|
|
||||||
|
def pretty_deps(indent, deps):
|
||||||
|
return indent + indent.join(pretty_dep(dep) for dep in deps)
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_PLUGINS = []
|
DEFAULT_PLUGINS = []
|
||||||
for k,v in PLUGINS.items():
|
for k,v in PLUGINS.items():
|
||||||
|
@ -305,6 +312,7 @@ opts.AddVariables(
|
||||||
BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'),
|
BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'),
|
||||||
BoolVariable('NO_ATEXIT', 'Will prevent Singletons from being deleted atexit of main thread', 'False'),
|
BoolVariable('NO_ATEXIT', 'Will prevent Singletons from being deleted atexit of main thread', 'False'),
|
||||||
BoolVariable('NO_DLCLOSE', 'Will prevent plugins from being unloaded', 'False'),
|
BoolVariable('NO_DLCLOSE', 'Will prevent plugins from being unloaded', 'False'),
|
||||||
|
BoolVariable('ENABLE_GLIBC_WORKAROUND', "Workaround known GLIBC symbol exports to allow building against libstdc++-4.8 without binaries needing throw_out_of_range_fmt", 'False'),
|
||||||
# http://www.scons.org/wiki/GoFastButton
|
# http://www.scons.org/wiki/GoFastButton
|
||||||
# http://stackoverflow.com/questions/1318863/how-to-optimize-an-scons-script
|
# http://stackoverflow.com/questions/1318863/how-to-optimize-an-scons-script
|
||||||
BoolVariable('FAST', "Make SCons faster at the cost of less precise dependency tracking", 'False'),
|
BoolVariable('FAST', "Make SCons faster at the cost of less precise dependency tracking", 'False'),
|
||||||
|
@ -472,7 +480,10 @@ pickle_store = [# Scons internal variables
|
||||||
'SQLITE_LINKFLAGS',
|
'SQLITE_LINKFLAGS',
|
||||||
'BOOST_LIB_VERSION_FROM_HEADER',
|
'BOOST_LIB_VERSION_FROM_HEADER',
|
||||||
'BIGINT',
|
'BIGINT',
|
||||||
'HOST'
|
'HOST',
|
||||||
|
'QUERIED_GDAL_DATA',
|
||||||
|
'QUERIED_ICU_DATA',
|
||||||
|
'QUERIED_PROJ_LIB'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add all other user configurable options to pickle pickle_store
|
# Add all other user configurable options to pickle pickle_store
|
||||||
|
@ -503,7 +514,7 @@ elif HELP_REQUESTED:
|
||||||
# https://github.com/mapnik/mapnik/issues/2112
|
# https://github.com/mapnik/mapnik/issues/2112
|
||||||
if not os.path.exists(SCONS_LOCAL_LOG) and not os.path.exists(SCONS_CONFIGURE_CACHE) \
|
if not os.path.exists(SCONS_LOCAL_LOG) and not os.path.exists(SCONS_CONFIGURE_CACHE) \
|
||||||
and ('-c' in command_line_args or '--clean' in command_line_args):
|
and ('-c' in command_line_args or '--clean' in command_line_args):
|
||||||
print 'all good: nothing to clean, but you might want to run "make distclean"'
|
print ('all good: nothing to clean, but you might want to run "make distclean"')
|
||||||
Exit(0)
|
Exit(0)
|
||||||
|
|
||||||
# initially populate environment with defaults and any possible custom arguments
|
# initially populate environment with defaults and any possible custom arguments
|
||||||
|
@ -513,7 +524,7 @@ opts.Update(env)
|
||||||
if not force_configure:
|
if not force_configure:
|
||||||
if os.path.exists(SCONS_CONFIGURE_CACHE):
|
if os.path.exists(SCONS_CONFIGURE_CACHE):
|
||||||
try:
|
try:
|
||||||
pickled_environment = open(SCONS_CONFIGURE_CACHE, 'r')
|
pickled_environment = open(SCONS_CONFIGURE_CACHE, 'rb')
|
||||||
pickled_values = pickle.load(pickled_environment)
|
pickled_values = pickle.load(pickled_environment)
|
||||||
for key, value in pickled_values.items():
|
for key, value in pickled_values.items():
|
||||||
env[key] = value
|
env[key] = value
|
||||||
|
@ -545,7 +556,7 @@ elif preconfigured:
|
||||||
color_print(4,'Using previous successful configuration...')
|
color_print(4,'Using previous successful configuration...')
|
||||||
color_print(4,'Re-configure by running "python scons/scons.py configure".')
|
color_print(4,'Re-configure by running "python scons/scons.py configure".')
|
||||||
|
|
||||||
if env.has_key('COLOR_PRINT') and env['COLOR_PRINT'] == False:
|
if 'COLOR_PRINT' in env and env['COLOR_PRINT'] == False:
|
||||||
color_print = regular_print
|
color_print = regular_print
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
|
@ -604,7 +615,7 @@ def parse_config(context, config, checks='--libs --cflags'):
|
||||||
# and thus breaks knowledge below that gdal worked
|
# and thus breaks knowledge below that gdal worked
|
||||||
# TODO - upgrade our scons logic to support Framework linking
|
# TODO - upgrade our scons logic to support Framework linking
|
||||||
if env['PLATFORM'] == 'Darwin':
|
if env['PLATFORM'] == 'Darwin':
|
||||||
value = call(cmd,silent=True)
|
value = call(cmd,silent=True).decode("utf-8")
|
||||||
if value and '-framework GDAL' in value:
|
if value and '-framework GDAL' in value:
|
||||||
env['LIBS'].append('gdal')
|
env['LIBS'].append('gdal')
|
||||||
if os.path.exists('/Library/Frameworks/GDAL.framework/unix/lib'):
|
if os.path.exists('/Library/Frameworks/GDAL.framework/unix/lib'):
|
||||||
|
@ -614,9 +625,9 @@ def parse_config(context, config, checks='--libs --cflags'):
|
||||||
else:
|
else:
|
||||||
env.ParseConfig(cmd)
|
env.ParseConfig(cmd)
|
||||||
parsed = True
|
parsed = True
|
||||||
except OSError, e:
|
except OSError as e:
|
||||||
ret = False
|
ret = False
|
||||||
print ' (xml2-config not found!)'
|
print (' (xml2-config not found!)')
|
||||||
if not parsed:
|
if not parsed:
|
||||||
if config in ('GDAL_CONFIG'):
|
if config in ('GDAL_CONFIG'):
|
||||||
# optional deps...
|
# optional deps...
|
||||||
|
@ -639,7 +650,7 @@ def get_pkg_lib(context, config, lib):
|
||||||
parsed = False
|
parsed = False
|
||||||
if ret:
|
if ret:
|
||||||
try:
|
try:
|
||||||
value = call(cmd,silent=True)
|
value = call(cmd,silent=True).decode("utf8")
|
||||||
if ' ' in value:
|
if ' ' in value:
|
||||||
parts = value.split(' ')
|
parts = value.split(' ')
|
||||||
if len(parts) > 1:
|
if len(parts) > 1:
|
||||||
|
@ -650,9 +661,9 @@ def get_pkg_lib(context, config, lib):
|
||||||
else:
|
else:
|
||||||
# osx 1.8 install gives '-framework GDAL'
|
# osx 1.8 install gives '-framework GDAL'
|
||||||
libname = 'gdal'
|
libname = 'gdal'
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
ret = False
|
ret = False
|
||||||
print ' unable to determine library name:'# %s' % str(e)
|
print (' unable to determine library name:# {0!s}'.format(e))
|
||||||
return None
|
return None
|
||||||
context.Result( libname )
|
context.Result( libname )
|
||||||
return libname
|
return libname
|
||||||
|
@ -664,8 +675,8 @@ def parse_pg_config(context, config):
|
||||||
context.Message( 'Checking for %s... ' % tool)
|
context.Message( 'Checking for %s... ' % tool)
|
||||||
ret = context.TryAction(env[config])[0]
|
ret = context.TryAction(env[config])[0]
|
||||||
if ret:
|
if ret:
|
||||||
lib_path = call('%s --libdir' % env[config])
|
lib_path = call('%s --libdir' % env[config]).decode("utf8")
|
||||||
inc_path = call('%s --includedir' % env[config])
|
inc_path = call('%s --includedir' % env[config]).decode("utf8")
|
||||||
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
||||||
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
||||||
lpq = env['PLUGINS']['postgis']['lib']
|
lpq = env['PLUGINS']['postgis']['lib']
|
||||||
|
@ -799,6 +810,125 @@ int main()
|
||||||
context.Result(ret)
|
context.Result(ret)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def CheckIcuData(context, silent=False):
|
||||||
|
|
||||||
|
if not silent:
|
||||||
|
context.Message('Checking for ICU data directory...')
|
||||||
|
ret = context.TryRun("""
|
||||||
|
|
||||||
|
#include <unicode/putil.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::string result = u_getDataDirectory();
|
||||||
|
std::cout << result;
|
||||||
|
if (result.empty()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
""", '.cpp')
|
||||||
|
if silent:
|
||||||
|
context.did_show_result=1
|
||||||
|
if ret[0]:
|
||||||
|
context.Result('u_getDataDirectory returned %s' % ret[1])
|
||||||
|
return ret[1].strip()
|
||||||
|
else:
|
||||||
|
ret = call("icu-config --icudatadir", silent=True)
|
||||||
|
if ret:
|
||||||
|
context.Result('icu-config returned %s' % ret)
|
||||||
|
return ret
|
||||||
|
else:
|
||||||
|
context.Result('Failed to detect (mapnik-config will have null value)')
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
def CheckGdalData(context, silent=False):
|
||||||
|
|
||||||
|
if not silent:
|
||||||
|
context.Message('Checking for GDAL data directory...')
|
||||||
|
ret = context.TryRun("""
|
||||||
|
|
||||||
|
#include "cpl_config.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::cout << GDAL_PREFIX << "/share/gdal" << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
""", '.cpp')
|
||||||
|
if silent:
|
||||||
|
context.did_show_result=1
|
||||||
|
if ret[0]:
|
||||||
|
context.Result('GDAL_PREFIX returned %s' % ret[1])
|
||||||
|
else:
|
||||||
|
context.Result('Failed to detect (mapnik-config will have null value)')
|
||||||
|
return ret[1].strip()
|
||||||
|
|
||||||
|
def CheckProjData(context, silent=False):
|
||||||
|
|
||||||
|
if not silent:
|
||||||
|
context.Message('Checking for PROJ_LIB directory...')
|
||||||
|
ret = context.TryRun("""
|
||||||
|
|
||||||
|
// This is narly, could eventually be replaced using https://github.com/OSGeo/proj.4/pull/551]
|
||||||
|
#include <proj_api.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
static void my_proj4_logger(void * user_data, int /*level*/, const char * msg)
|
||||||
|
{
|
||||||
|
std::string* posMsg = static_cast<std::string*>(user_data);
|
||||||
|
*posMsg += msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/OSGeo/gdal/blob/ddbf6d39aa4b005a77ca4f27c2d61a3214f336f8/gdal/alg/gdalapplyverticalshiftgrid.cpp#L616-L633
|
||||||
|
|
||||||
|
std::string find_proj_path(const char * pszFilename) {
|
||||||
|
std::string osMsg;
|
||||||
|
std::string osFilename;
|
||||||
|
projCtx ctx = pj_ctx_alloc();
|
||||||
|
pj_ctx_set_app_data(ctx, &osMsg);
|
||||||
|
pj_ctx_set_debug(ctx, PJ_LOG_DEBUG_MAJOR);
|
||||||
|
pj_ctx_set_logger(ctx, my_proj4_logger);
|
||||||
|
PAFile f = pj_open_lib(ctx, pszFilename, "rb");
|
||||||
|
if( f )
|
||||||
|
{
|
||||||
|
pj_ctx_fclose(ctx, f);
|
||||||
|
}
|
||||||
|
size_t nPos = osMsg.find("fopen(");
|
||||||
|
if( nPos != std::string::npos )
|
||||||
|
{
|
||||||
|
osFilename = osMsg.substr(nPos + strlen("fopen("));
|
||||||
|
nPos = osFilename.find(")");
|
||||||
|
if( nPos != std::string::npos )
|
||||||
|
osFilename = osFilename.substr(0, nPos);
|
||||||
|
}
|
||||||
|
pj_ctx_free(ctx);
|
||||||
|
return osFilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::string result = find_proj_path(" ");
|
||||||
|
std::cout << result;
|
||||||
|
if (result.empty()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
""", '.cpp')
|
||||||
|
if silent:
|
||||||
|
context.did_show_result=1
|
||||||
|
if ret[0]:
|
||||||
|
context.Result('pj_open_lib returned %s' % ret[1])
|
||||||
|
else:
|
||||||
|
context.Result('Failed to detect (mapnik-config will have null value)')
|
||||||
|
return ret[1].strip()
|
||||||
|
|
||||||
def CheckCairoHasFreetype(context, silent=False):
|
def CheckCairoHasFreetype(context, silent=False):
|
||||||
if not silent:
|
if not silent:
|
||||||
context.Message('Checking for cairo freetype font support ... ')
|
context.Message('Checking for cairo freetype font support ... ')
|
||||||
|
@ -957,6 +1087,7 @@ int main()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def boost_regex_has_icu(context):
|
def boost_regex_has_icu(context):
|
||||||
|
context.env.Append(LIBS='icui18n')
|
||||||
if env['RUNTIME_LINK'] == 'static':
|
if env['RUNTIME_LINK'] == 'static':
|
||||||
# re-order icu libs to ensure linux linker is happy
|
# re-order icu libs to ensure linux linker is happy
|
||||||
for lib_name in ['icui18n',env['ICU_LIB_NAME'],'icudata']:
|
for lib_name in ['icui18n',env['ICU_LIB_NAME'],'icudata']:
|
||||||
|
@ -1067,6 +1198,9 @@ conf_tests = { 'prioritize_paths' : prioritize_paths,
|
||||||
'CheckPKGVersion' : CheckPKGVersion,
|
'CheckPKGVersion' : CheckPKGVersion,
|
||||||
'FindBoost' : FindBoost,
|
'FindBoost' : FindBoost,
|
||||||
'CheckBoost' : CheckBoost,
|
'CheckBoost' : CheckBoost,
|
||||||
|
'CheckIcuData' : CheckIcuData,
|
||||||
|
'CheckProjData' : CheckProjData,
|
||||||
|
'CheckGdalData' : CheckGdalData,
|
||||||
'CheckCairoHasFreetype' : CheckCairoHasFreetype,
|
'CheckCairoHasFreetype' : CheckCairoHasFreetype,
|
||||||
'CheckHasDlfcn' : CheckHasDlfcn,
|
'CheckHasDlfcn' : CheckHasDlfcn,
|
||||||
'GetBoostLibVersion' : GetBoostLibVersion,
|
'GetBoostLibVersion' : GetBoostLibVersion,
|
||||||
|
@ -1114,7 +1248,7 @@ if not preconfigured:
|
||||||
if os.path.exists(conf):
|
if os.path.exists(conf):
|
||||||
opts.files.append(conf)
|
opts.files.append(conf)
|
||||||
color_print(4,"SCons CONFIG found: '%s', variables will be inherited..." % conf)
|
color_print(4,"SCons CONFIG found: '%s', variables will be inherited..." % conf)
|
||||||
optfile = file(conf)
|
optfile = open(conf, 'r')
|
||||||
#print optfile.read().replace("\n", " ").replace("'","").replace(" = ","=")
|
#print optfile.read().replace("\n", " ").replace("'","").replace(" = ","=")
|
||||||
optfile.close()
|
optfile.close()
|
||||||
|
|
||||||
|
@ -1159,6 +1293,10 @@ if not preconfigured:
|
||||||
env['PLUGINS'] = PLUGINS
|
env['PLUGINS'] = PLUGINS
|
||||||
env['EXTRA_FREETYPE_LIBS'] = []
|
env['EXTRA_FREETYPE_LIBS'] = []
|
||||||
env['SQLITE_LINKFLAGS'] = []
|
env['SQLITE_LINKFLAGS'] = []
|
||||||
|
env['QUERIED_PROJ_LIB'] = None
|
||||||
|
env['QUERIED_ICU_DATA'] = None
|
||||||
|
env['QUERIED_GDAL_DATA'] = None
|
||||||
|
|
||||||
# previously a leading / was expected for LIB_DIR_NAME
|
# previously a leading / was expected for LIB_DIR_NAME
|
||||||
# now strip it to ensure expected behavior
|
# now strip it to ensure expected behavior
|
||||||
if env['LIB_DIR_NAME'].startswith(os.path.sep):
|
if env['LIB_DIR_NAME'].startswith(os.path.sep):
|
||||||
|
@ -1258,7 +1396,9 @@ if not preconfigured:
|
||||||
[env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'],
|
[env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'],
|
||||||
['harfbuzz', 'harfbuzz/hb.h',True,'C++']
|
['harfbuzz', 'harfbuzz/hb.h',True,'C++']
|
||||||
]
|
]
|
||||||
|
OPTIONAL_LIBSHEADERS = []
|
||||||
|
|
||||||
|
CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0')
|
||||||
if env.get('FREETYPE_LIBS') or env.get('FREETYPE_INCLUDES'):
|
if env.get('FREETYPE_LIBS') or env.get('FREETYPE_INCLUDES'):
|
||||||
REQUIRED_LIBSHEADERS.insert(0,['freetype','ft2build.h',True,'C'])
|
REQUIRED_LIBSHEADERS.insert(0,['freetype','ft2build.h',True,'C'])
|
||||||
if env.get('FREETYPE_INCLUDES'):
|
if env.get('FREETYPE_INCLUDES'):
|
||||||
|
@ -1267,6 +1407,21 @@ if not preconfigured:
|
||||||
if env.get('FREETYPE_LIBS'):
|
if env.get('FREETYPE_LIBS'):
|
||||||
lib_path = env['FREETYPE_LIBS']
|
lib_path = env['FREETYPE_LIBS']
|
||||||
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
||||||
|
elif CHECK_PKG_CONFIG and conf.CheckPKG('freetype2'):
|
||||||
|
# Freetype 2.9+ doesn't use freetype-config and uses pkg-config instead
|
||||||
|
cmd = 'pkg-config freetype2 --libs --cflags'
|
||||||
|
if env['RUNTIME_LINK'] == 'static':
|
||||||
|
cmd += ' --static'
|
||||||
|
|
||||||
|
temp_env = Environment(ENV=os.environ)
|
||||||
|
try:
|
||||||
|
temp_env.ParseConfig(cmd)
|
||||||
|
for lib in temp_env['LIBS']:
|
||||||
|
env.AppendUnique(LIBPATH = fix_path(lib))
|
||||||
|
for inc in temp_env['CPPPATH']:
|
||||||
|
env.AppendUnique(CPPPATH = fix_path(inc))
|
||||||
|
except OSError as e:
|
||||||
|
pass
|
||||||
elif conf.parse_config('FREETYPE_CONFIG'):
|
elif conf.parse_config('FREETYPE_CONFIG'):
|
||||||
# check if freetype links to bz2
|
# check if freetype links to bz2
|
||||||
if env['RUNTIME_LINK'] == 'static':
|
if env['RUNTIME_LINK'] == 'static':
|
||||||
|
@ -1277,12 +1432,10 @@ if not preconfigured:
|
||||||
temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG'])
|
temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG'])
|
||||||
if 'bz2' in temp_env['LIBS']:
|
if 'bz2' in temp_env['LIBS']:
|
||||||
env['EXTRA_FREETYPE_LIBS'].append('bz2')
|
env['EXTRA_FREETYPE_LIBS'].append('bz2')
|
||||||
except OSError,e:
|
except OSError as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# libxml2 should be optional but is currently not
|
if env['XMLPARSER'] == 'libxml2':
|
||||||
# https://github.com/mapnik/mapnik/issues/913
|
|
||||||
if env.get('XMLPARSER') and env['XMLPARSER'] == 'libxml2':
|
|
||||||
if env.get('XML2_LIBS') or env.get('XML2_INCLUDES'):
|
if env.get('XML2_LIBS') or env.get('XML2_INCLUDES'):
|
||||||
OPTIONAL_LIBSHEADERS.insert(0,['libxml2','libxml/parser.h',True,'C'])
|
OPTIONAL_LIBSHEADERS.insert(0,['libxml2','libxml/parser.h',True,'C'])
|
||||||
if env.get('XML2_INCLUDES'):
|
if env.get('XML2_INCLUDES'):
|
||||||
|
@ -1300,9 +1453,7 @@ if not preconfigured:
|
||||||
if conf.CheckHasDlfcn():
|
if conf.CheckHasDlfcn():
|
||||||
env.Append(CPPDEFINES = '-DMAPNIK_HAS_DLCFN')
|
env.Append(CPPDEFINES = '-DMAPNIK_HAS_DLCFN')
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].extend(['dlfcn'])
|
env['SKIPPED_DEPS'].append('dlfcn')
|
||||||
|
|
||||||
OPTIONAL_LIBSHEADERS = []
|
|
||||||
|
|
||||||
if env['JPEG']:
|
if env['JPEG']:
|
||||||
OPTIONAL_LIBSHEADERS.append(['jpeg', ['stdio.h', 'jpeglib.h'], False,'C','-DHAVE_JPEG'])
|
OPTIONAL_LIBSHEADERS.append(['jpeg', ['stdio.h', 'jpeglib.h'], False,'C','-DHAVE_JPEG'])
|
||||||
|
@ -1311,7 +1462,7 @@ if not preconfigured:
|
||||||
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
||||||
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].extend(['jpeg'])
|
env['SKIPPED_DEPS'].append('jpeg')
|
||||||
|
|
||||||
if env['PROJ']:
|
if env['PROJ']:
|
||||||
OPTIONAL_LIBSHEADERS.append(['proj', 'proj_api.h', False,'C','-DMAPNIK_USE_PROJ4'])
|
OPTIONAL_LIBSHEADERS.append(['proj', 'proj_api.h', False,'C','-DMAPNIK_USE_PROJ4'])
|
||||||
|
@ -1320,7 +1471,7 @@ if not preconfigured:
|
||||||
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
||||||
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].extend(['proj'])
|
env['SKIPPED_DEPS'].append('proj')
|
||||||
|
|
||||||
if env['PNG']:
|
if env['PNG']:
|
||||||
OPTIONAL_LIBSHEADERS.append(['png', 'png.h', False,'C','-DHAVE_PNG'])
|
OPTIONAL_LIBSHEADERS.append(['png', 'png.h', False,'C','-DHAVE_PNG'])
|
||||||
|
@ -1329,7 +1480,7 @@ if not preconfigured:
|
||||||
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
||||||
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].extend(['png'])
|
env['SKIPPED_DEPS'].append('png')
|
||||||
|
|
||||||
if env['WEBP']:
|
if env['WEBP']:
|
||||||
OPTIONAL_LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C','-DHAVE_WEBP'])
|
OPTIONAL_LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C','-DHAVE_WEBP'])
|
||||||
|
@ -1338,7 +1489,7 @@ if not preconfigured:
|
||||||
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
||||||
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].extend(['webp'])
|
env['SKIPPED_DEPS'].append('webp')
|
||||||
|
|
||||||
if env['TIFF']:
|
if env['TIFF']:
|
||||||
OPTIONAL_LIBSHEADERS.append(['tiff', 'tiff.h', False,'C','-DHAVE_TIFF'])
|
OPTIONAL_LIBSHEADERS.append(['tiff', 'tiff.h', False,'C','-DHAVE_TIFF'])
|
||||||
|
@ -1347,7 +1498,7 @@ if not preconfigured:
|
||||||
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
||||||
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].extend(['tiff'])
|
env['SKIPPED_DEPS'].append('tiff')
|
||||||
|
|
||||||
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
|
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
|
||||||
if env['PRIORITIZE_LINKING']:
|
if env['PRIORITIZE_LINKING']:
|
||||||
|
@ -1476,7 +1627,29 @@ if not preconfigured:
|
||||||
if env['HOST']:
|
if env['HOST']:
|
||||||
SQLITE_HAS_RTREE = True
|
SQLITE_HAS_RTREE = True
|
||||||
|
|
||||||
CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0')
|
if not env['HOST']:
|
||||||
|
env['QUERIED_PROJ_LIB'] = conf.CheckProjData()
|
||||||
|
if os.environ.get('PROJ_LIB'):
|
||||||
|
env['QUERIED_PROJ_LIB'] = os.environ['PROJ_LIB']
|
||||||
|
color_print(4,'Detected PROJ_LIB in environ, using env value instead: %s' % os.environ['PROJ_LIB'] )
|
||||||
|
env['QUERIED_ICU_DATA'] = conf.CheckIcuData()
|
||||||
|
if os.environ.get('ICU_DATA'):
|
||||||
|
env['QUERIED_ICU_DATA'] = os.environ['ICU_DATA']
|
||||||
|
color_print(4,'Detected ICU_DATA in environ, using env value instead: %s' % os.environ['ICU_DATA'] )
|
||||||
|
env['QUERIED_GDAL_DATA'] = conf.CheckGdalData()
|
||||||
|
if os.environ.get('GDAL_DATA'):
|
||||||
|
env['QUERIED_GDAL_DATA'] = os.environ['GDAL_DATA']
|
||||||
|
color_print(4,'Detected GDAL_DATA in environ, using env value instead: %s' % os.environ['GDAL_DATA'] )
|
||||||
|
# now validate the paths actually exist
|
||||||
|
if env['QUERIED_PROJ_LIB'] and not os.path.exists(env['QUERIED_PROJ_LIB']):
|
||||||
|
color_print(1,'%s not detected on your system' % env['QUERIED_PROJ_LIB'] )
|
||||||
|
env['MISSING_DEPS'].append('PROJ_LIB')
|
||||||
|
if env['QUERIED_GDAL_DATA'] and not os.path.exists(env['QUERIED_GDAL_DATA']):
|
||||||
|
color_print(1,'%s not detected on your system' % env['QUERIED_GDAL_DATA'] )
|
||||||
|
env['MISSING_DEPS'].append('GDAL_DATA')
|
||||||
|
if env['QUERIED_ICU_DATA'] and not os.path.exists(env['QUERIED_ICU_DATA']):
|
||||||
|
color_print(1,'%s not detected on your system' % env['QUERIED_ICU_DATA'] )
|
||||||
|
env['MISSING_DEPS'].append('ICU_DATA')
|
||||||
|
|
||||||
if len(env['REQUESTED_PLUGINS']):
|
if len(env['REQUESTED_PLUGINS']):
|
||||||
if env['HOST']:
|
if env['HOST']:
|
||||||
|
@ -1553,7 +1726,7 @@ if not preconfigured:
|
||||||
if not lib in env['LIBS']:
|
if not lib in env['LIBS']:
|
||||||
env["SQLITE_LINKFLAGS"].append(lib)
|
env["SQLITE_LINKFLAGS"].append(lib)
|
||||||
env.Append(LIBS=lib)
|
env.Append(LIBS=lib)
|
||||||
except OSError,e:
|
except OSError as e:
|
||||||
for lib in ["sqlite3","dl","pthread"]:
|
for lib in ["sqlite3","dl","pthread"]:
|
||||||
if not lib in env['LIBS']:
|
if not lib in env['LIBS']:
|
||||||
env["SQLITE_LINKFLAGS"].append("lib")
|
env["SQLITE_LINKFLAGS"].append("lib")
|
||||||
|
@ -1622,9 +1795,7 @@ if not preconfigured:
|
||||||
)
|
)
|
||||||
env["CAIRO_ALL_LIBS"] = ['cairo']
|
env["CAIRO_ALL_LIBS"] = ['cairo']
|
||||||
if env['RUNTIME_LINK'] == 'static':
|
if env['RUNTIME_LINK'] == 'static':
|
||||||
env["CAIRO_ALL_LIBS"].extend(
|
env["CAIRO_ALL_LIBS"].append('pixman-1')
|
||||||
['pixman-1']
|
|
||||||
)
|
|
||||||
# todo - run actual checkLib?
|
# todo - run actual checkLib?
|
||||||
env['HAS_CAIRO'] = True
|
env['HAS_CAIRO'] = True
|
||||||
else:
|
else:
|
||||||
|
@ -1636,7 +1807,7 @@ if not preconfigured:
|
||||||
env['HAS_CAIRO'] = False
|
env['HAS_CAIRO'] = False
|
||||||
env['SKIPPED_DEPS'].append('cairo')
|
env['SKIPPED_DEPS'].append('cairo')
|
||||||
else:
|
else:
|
||||||
print 'Checking for cairo lib and include paths... ',
|
print ('Checking for cairo lib and include paths... ', end='')
|
||||||
cmd = 'pkg-config --libs --cflags cairo'
|
cmd = 'pkg-config --libs --cflags cairo'
|
||||||
if env['RUNTIME_LINK'] == 'static':
|
if env['RUNTIME_LINK'] == 'static':
|
||||||
cmd += ' --static'
|
cmd += ' --static'
|
||||||
|
@ -1653,8 +1824,8 @@ if not preconfigured:
|
||||||
if not inc in env['CPPPATH']:
|
if not inc in env['CPPPATH']:
|
||||||
env["CAIRO_CPPPATHS"].append(inc)
|
env["CAIRO_CPPPATHS"].append(inc)
|
||||||
env['HAS_CAIRO'] = True
|
env['HAS_CAIRO'] = True
|
||||||
print 'yes'
|
print ('yes')
|
||||||
except OSError,e:
|
except OSError as e:
|
||||||
color_print(1,'no')
|
color_print(1,'no')
|
||||||
env['SKIPPED_DEPS'].append('cairo')
|
env['SKIPPED_DEPS'].append('cairo')
|
||||||
color_print(1,'pkg-config reported: %s' % e)
|
color_print(1,'pkg-config reported: %s' % e)
|
||||||
|
@ -1671,10 +1842,10 @@ if not preconfigured:
|
||||||
|
|
||||||
if env['MISSING_DEPS']:
|
if env['MISSING_DEPS']:
|
||||||
# if required dependencies are missing, print warnings and then let SCons finish without building or saving local config
|
# if required dependencies are missing, print warnings and then let SCons finish without building or saving local config
|
||||||
color_print(1,'\nExiting... the following required dependencies were not found:\n - %s' % '\n - '.join([pretty_dep(dep) for dep in env['MISSING_DEPS']]))
|
color_print(1,'\nExiting... the following required dependencies were not found:' + pretty_deps('\n - ', env['MISSING_DEPS']))
|
||||||
color_print(1,"\nSee '%s' for details on possible problems." % (fix_path(SCONS_LOCAL_LOG)))
|
color_print(1,"\nSee '%s' for details on possible problems." % (fix_path(SCONS_LOCAL_LOG)))
|
||||||
if env['SKIPPED_DEPS']:
|
if env['SKIPPED_DEPS']:
|
||||||
color_print(4,'\nAlso, these OPTIONAL dependencies were not found:\n - %s' % '\n - '.join([pretty_dep(dep) for dep in env['SKIPPED_DEPS']]))
|
color_print(4,'\nAlso, these OPTIONAL dependencies were not found:' + pretty_deps('\n - ', env['SKIPPED_DEPS']))
|
||||||
color_print(4,"\nSet custom paths to these libraries and header files on the command-line or in a file called '%s'" % SCONS_LOCAL_CONFIG)
|
color_print(4,"\nSet custom paths to these libraries and header files on the command-line or in a file called '%s'" % SCONS_LOCAL_CONFIG)
|
||||||
color_print(4," ie. $ python scons/scons.py BOOST_INCLUDES=/usr/local/include BOOST_LIBS=/usr/local/lib")
|
color_print(4," ie. $ python scons/scons.py BOOST_INCLUDES=/usr/local/include BOOST_LIBS=/usr/local/lib")
|
||||||
color_print(4, "\nOnce all required dependencies are found a local '%s' will be saved and then install:" % SCONS_LOCAL_CONFIG)
|
color_print(4, "\nOnce all required dependencies are found a local '%s' will be saved and then install:" % SCONS_LOCAL_CONFIG)
|
||||||
|
@ -1701,7 +1872,7 @@ if not preconfigured:
|
||||||
color_print(4,"Did not use user config file, no custom path variables will be saved...")
|
color_print(4,"Did not use user config file, no custom path variables will be saved...")
|
||||||
|
|
||||||
if env['SKIPPED_DEPS']:
|
if env['SKIPPED_DEPS']:
|
||||||
color_print(4,'\nNote: will build without these OPTIONAL dependencies:\n - %s' % '\n - '.join([pretty_dep(dep) for dep in env['SKIPPED_DEPS']]))
|
color_print(4,'\nNote: will build without these OPTIONAL dependencies:' + pretty_deps('\n - ', env['SKIPPED_DEPS']))
|
||||||
print
|
print
|
||||||
|
|
||||||
# fetch the mapnik version header in order to set the
|
# fetch the mapnik version header in order to set the
|
||||||
|
@ -1723,6 +1894,9 @@ if not preconfigured:
|
||||||
if env['NO_DLCLOSE'] or env['COVERAGE']:
|
if env['NO_DLCLOSE'] or env['COVERAGE']:
|
||||||
env.Append(CPPDEFINES = '-DMAPNIK_NO_DLCLOSE')
|
env.Append(CPPDEFINES = '-DMAPNIK_NO_DLCLOSE')
|
||||||
|
|
||||||
|
if env['ENABLE_GLIBC_WORKAROUND']:
|
||||||
|
env.Append(CPPDEFINES = '-DMAPNIK_ENABLE_GLIBC_WORKAROUND')
|
||||||
|
|
||||||
# Mac OSX (Darwin) special settings
|
# Mac OSX (Darwin) special settings
|
||||||
if env['PLATFORM'] == 'Darwin':
|
if env['PLATFORM'] == 'Darwin':
|
||||||
pthread = ''
|
pthread = ''
|
||||||
|
@ -1746,13 +1920,13 @@ if not preconfigured:
|
||||||
# Enable logging in debug mode (always) and release mode (when specified)
|
# Enable logging in debug mode (always) and release mode (when specified)
|
||||||
if env['DEFAULT_LOG_SEVERITY']:
|
if env['DEFAULT_LOG_SEVERITY']:
|
||||||
if env['DEFAULT_LOG_SEVERITY'] not in severities:
|
if env['DEFAULT_LOG_SEVERITY'] not in severities:
|
||||||
severities_list = ', '.join(["'%s'" % s for s in severities])
|
severities_list = ', '.join("'%s'" % s for s in severities)
|
||||||
color_print(1,"Cannot set default logger severity to '%s', available options are %s." % (env['DEFAULT_LOG_SEVERITY'], severities_list))
|
color_print(1,"Cannot set default logger severity to '%s', available options are %s." % (env['DEFAULT_LOG_SEVERITY'], severities_list))
|
||||||
Exit(1)
|
Exit(1)
|
||||||
else:
|
else:
|
||||||
log_severity = severities.index(env['DEFAULT_LOG_SEVERITY'])
|
log_severity = severities.index(env['DEFAULT_LOG_SEVERITY'])
|
||||||
else:
|
else:
|
||||||
severities_list = ', '.join(["'%s'" % s for s in severities])
|
severities_list = ', '.join("'%s'" % s for s in severities)
|
||||||
color_print(1,"No logger severity specified, available options are %s." % severities_list)
|
color_print(1,"No logger severity specified, available options are %s." % severities_list)
|
||||||
Exit(1)
|
Exit(1)
|
||||||
|
|
||||||
|
@ -1806,7 +1980,7 @@ if not preconfigured:
|
||||||
|
|
||||||
# finish config stage and pickle results
|
# finish config stage and pickle results
|
||||||
env = conf.Finish()
|
env = conf.Finish()
|
||||||
env_cache = open(SCONS_CONFIGURE_CACHE, 'w')
|
env_cache = open(SCONS_CONFIGURE_CACHE, 'wb')
|
||||||
pickle_dict = {}
|
pickle_dict = {}
|
||||||
for i in pickle_store:
|
for i in pickle_store:
|
||||||
pickle_dict[i] = env.get(i)
|
pickle_dict[i] = env.get(i)
|
||||||
|
@ -1817,20 +1991,20 @@ if not preconfigured:
|
||||||
# with a non-root configure following a root install
|
# with a non-root configure following a root install
|
||||||
# that also triggered a re-configure
|
# that also triggered a re-configure
|
||||||
try:
|
try:
|
||||||
os.chmod(SCONS_CONFIGURE_CACHE,0666)
|
os.chmod(SCONS_CONFIGURE_CACHE,0o666)
|
||||||
except: pass
|
except: pass
|
||||||
try:
|
try:
|
||||||
os.chmod(SCONS_LOCAL_CONFIG,0666)
|
os.chmod(SCONS_LOCAL_CONFIG,0o666)
|
||||||
except: pass
|
except: pass
|
||||||
try:
|
try:
|
||||||
os.chmod('.sconsign.dblite',0666)
|
os.chmod('.sconsign.dblite',0o666)
|
||||||
except: pass
|
except: pass
|
||||||
try:
|
try:
|
||||||
os.chmod(SCONS_LOCAL_LOG,0666)
|
os.chmod(SCONS_LOCAL_LOG,0o666)
|
||||||
except: pass
|
except: pass
|
||||||
try:
|
try:
|
||||||
for item in glob('%s/*' % SCONF_TEMP_DIR):
|
for item in glob('%s/*' % SCONF_TEMP_DIR):
|
||||||
os.chmod(item,0666)
|
os.chmod(item, 0o666)
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
if 'configure' in command_line_args:
|
if 'configure' in command_line_args:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE Map[]>
|
<!DOCTYPE Map[]>
|
||||||
<Map
|
<Map
|
||||||
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"
|
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"
|
||||||
font-directory="../../fonts/dejavu-fonts-ttf-2.35/ttf/DejaVuSans.ttf"
|
font-directory="../../fonts/dejavu-fonts-ttf-2.37/ttf/DejaVuSans.ttf"
|
||||||
background-color="#dfd8c9">
|
background-color="#dfd8c9">
|
||||||
|
|
||||||
<Style name="marking" filter-mode="first">
|
<Style name="marking" filter-mode="first">
|
||||||
|
|
|
@ -3,8 +3,8 @@ import random
|
||||||
|
|
||||||
im = mapnik.Image(256,256)
|
im = mapnik.Image(256,256)
|
||||||
|
|
||||||
for x in xrange(0,im.width()):
|
for x in range(im.width()):
|
||||||
for y in xrange(0,im.height()):
|
for y in range(im.height()):
|
||||||
r = int(random.random() * 255)
|
r = int(random.random() * 255)
|
||||||
g = random.random() * 255
|
g = random.random() * 255
|
||||||
b = random.random() * 255
|
b = random.random() * 255
|
||||||
|
|
122
bootstrap.sh
122
bootstrap.sh
|
@ -1,8 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
: '
|
: '
|
||||||
|
|
||||||
todo
|
todo
|
||||||
|
@ -11,17 +8,19 @@ todo
|
||||||
- shrink icu data
|
- shrink icu data
|
||||||
'
|
'
|
||||||
|
|
||||||
MASON_VERSION="new-pkgs"
|
MASON_VERSION="fde1d9f5"
|
||||||
|
|
||||||
function setup_mason() {
|
function setup_mason() {
|
||||||
if [[ ! -d ./.mason ]]; then
|
if [[ ! -d ./.mason ]]; then
|
||||||
git clone https://github.com/mapbox/mason.git ./.mason
|
git clone https://github.com/mapbox/mason.git .mason || return
|
||||||
(cd ./.mason && git checkout ${MASON_VERSION})
|
elif ! git -C .mason rev-parse -q --verify "$MASON_VERSION" >/dev/null; then
|
||||||
else
|
git -C .mason fetch --all || true # non-fatal
|
||||||
echo "Updating to latest mason"
|
|
||||||
(cd ./.mason && git fetch && git checkout ${MASON_VERSION} && git pull)
|
|
||||||
fi
|
fi
|
||||||
export PATH=$(pwd)/.mason:$PATH
|
git -C .mason checkout --detach "$MASON_VERSION" -- || return
|
||||||
|
case ":$PATH:" in
|
||||||
|
*":$PWD/.mason:"*) : already there ;;
|
||||||
|
*) export PATH="$PWD/.mason:$PATH" ;;
|
||||||
|
esac
|
||||||
export CXX=${CXX:-clang++}
|
export CXX=${CXX:-clang++}
|
||||||
export CC=${CC:-clang}
|
export CC=${CC:-clang}
|
||||||
}
|
}
|
||||||
|
@ -44,45 +43,35 @@ function install() {
|
||||||
mason link $1 $2
|
mason link $1 $2
|
||||||
}
|
}
|
||||||
|
|
||||||
ICU_VERSION="55.1"
|
ICU_VERSION="57.1"
|
||||||
|
BOOST_VERSION="1.73.0"
|
||||||
|
|
||||||
function install_mason_deps() {
|
function install_mason_deps() {
|
||||||
FAIL=0
|
install ccache 3.3.1
|
||||||
install ccache 3.3.0 &
|
install zlib 1.2.8
|
||||||
install zlib system &
|
install jpeg_turbo 1.5.1 libjpeg
|
||||||
install jpeg_turbo 1.5.0 libjpeg &
|
install libpng 1.6.28 libpng
|
||||||
install libpng 1.6.24 libpng &
|
install libtiff 4.0.7 libtiff
|
||||||
install libtiff 4.0.6 libtiff &
|
install libpq 9.6.2
|
||||||
install libpq 9.5.2 &
|
install sqlite 3.17.0 libsqlite3
|
||||||
install sqlite 3.14.1 libsqlite3 &
|
install expat 2.2.0 libexpat
|
||||||
install expat 2.2.0 libexpat &
|
install icu ${ICU_VERSION}
|
||||||
install icu ${ICU_VERSION} &
|
install proj 4.9.3 libproj
|
||||||
install proj 4.9.2 libproj &
|
install pixman 0.34.0 libpixman-1
|
||||||
install pixman 0.34.0 libpixman-1 &
|
install cairo 1.14.8 libcairo
|
||||||
install cairo 1.14.6 libcairo &
|
install webp 0.6.0 libwebp
|
||||||
install protobuf 2.6.1 &
|
install libgdal 2.1.3 libgdal
|
||||||
# technically protobuf is not a mapnik core dep, but installing
|
install boost ${BOOST_VERSION}
|
||||||
# here by default helps make mapnik-vector-tile builds easier
|
install boost_libsystem ${BOOST_VERSION}
|
||||||
install webp 0.5.1 libwebp &
|
install boost_libfilesystem ${BOOST_VERSION}
|
||||||
install gdal 2.1.1 libgdal &
|
install boost_libprogram_options ${BOOST_VERSION}
|
||||||
install boost 1.61.0 &
|
install boost_libregex_icu57 ${BOOST_VERSION}
|
||||||
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 &
|
|
||||||
# technically boost thread and python are not a core dep, but installing
|
# technically boost thread and python are not a core dep, but installing
|
||||||
# here by default helps make python-mapnik builds easier
|
# here by default helps make python-mapnik builds easier
|
||||||
install boost_libthread 1.61.0 &
|
install boost_libthread ${BOOST_VERSION}
|
||||||
install boost_libpython 1.61.0 &
|
install boost_libpython ${BOOST_VERSION}
|
||||||
install freetype 2.6.5 libfreetype &
|
install freetype 2.7.1 libfreetype
|
||||||
install harfbuzz 1.3.0 libharfbuzz &
|
install harfbuzz 1.4.4-ft libharfbuzz
|
||||||
for job in $(jobs -p)
|
|
||||||
do
|
|
||||||
wait $job || let "FAIL+=1"
|
|
||||||
done
|
|
||||||
if [[ "$FAIL" != "0" ]]; then
|
|
||||||
exit ${FAIL}
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MASON_LINKED_ABS=$(pwd)/mason_packages/.link
|
MASON_LINKED_ABS=$(pwd)/mason_packages/.link
|
||||||
|
@ -95,6 +84,7 @@ function make_config() {
|
||||||
echo "
|
echo "
|
||||||
CXX = '$CXX'
|
CXX = '$CXX'
|
||||||
CC = '$CC'
|
CC = '$CC'
|
||||||
|
CUSTOM_CXXFLAGS = '-D_GLIBCXX_USE_CXX11_ABI=0'
|
||||||
RUNTIME_LINK = 'static'
|
RUNTIME_LINK = 'static'
|
||||||
INPUT_PLUGINS = 'all'
|
INPUT_PLUGINS = 'all'
|
||||||
PATH = '${MASON_LINKED_REL}/bin'
|
PATH = '${MASON_LINKED_REL}/bin'
|
||||||
|
@ -139,22 +129,46 @@ function setup_runtime_settings() {
|
||||||
echo "export PROJ_LIB=${MASON_LINKED_ABS}/share/proj" > mapnik-settings.env
|
echo "export PROJ_LIB=${MASON_LINKED_ABS}/share/proj" > mapnik-settings.env
|
||||||
echo "export ICU_DATA=${MASON_LINKED_ABS}/share/icu/${ICU_VERSION}" >> mapnik-settings.env
|
echo "export ICU_DATA=${MASON_LINKED_ABS}/share/icu/${ICU_VERSION}" >> mapnik-settings.env
|
||||||
echo "export GDAL_DATA=${MASON_LINKED_ABS}/share/gdal" >> mapnik-settings.env
|
echo "export GDAL_DATA=${MASON_LINKED_ABS}/share/gdal" >> mapnik-settings.env
|
||||||
source mapnik-settings.env
|
}
|
||||||
|
|
||||||
|
# turn arguments of the form NAME=VALUE into exported variables;
|
||||||
|
# any other arguments are reported and cause error return status
|
||||||
|
function export_variables() {
|
||||||
|
local arg= ret=0
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
if [[ "$arg" =~ ^[[:alpha:]][_[:alnum:]]*= ]]
|
||||||
|
then
|
||||||
|
export "$arg"
|
||||||
|
else
|
||||||
|
printf >&2 "bootstrap.sh: invalid argument: %s\n" "$arg"
|
||||||
|
ret=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
setup_mason
|
export_variables "$@" || return
|
||||||
|
# setup_mason must not run in subshell, because it sets default
|
||||||
|
# values of CC, CXX and adds mason to PATH, which we want to keep
|
||||||
|
# when sourced
|
||||||
|
setup_mason || return
|
||||||
|
(
|
||||||
|
# this is wrapped in subshell to allow sourcing this script
|
||||||
|
# without having the terminal closed on error
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
install_mason_deps
|
install_mason_deps
|
||||||
make_config > ./config.py
|
make_config > ./config.py
|
||||||
setup_runtime_settings
|
setup_runtime_settings
|
||||||
echo "Ready, now run:"
|
|
||||||
|
printf "\n\e[1;32m%s\e[m\n" "bootstrap successful, now run:"
|
||||||
echo ""
|
echo ""
|
||||||
echo " ./configure && make"
|
echo " ./configure && make"
|
||||||
|
echo ""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main "$@"
|
||||||
|
|
||||||
# allow sourcing of script without
|
|
||||||
# causing the terminal to bail on error
|
|
||||||
set +eu
|
|
||||||
set +o pipefail
|
|
||||||
|
|
13
circle.yml
13
circle.yml
|
@ -7,11 +7,7 @@ machine:
|
||||||
JOBS: 8
|
JOBS: 8
|
||||||
CCACHE_TEMPDIR: /tmp/.ccache-temp
|
CCACHE_TEMPDIR: /tmp/.ccache-temp
|
||||||
CCACHE_COMPRESS: 1
|
CCACHE_COMPRESS: 1
|
||||||
LLVM_VERSION: 3.8
|
LLVM_VERSION: 3.9.1
|
||||||
pre:
|
|
||||||
- echo "here"
|
|
||||||
post:
|
|
||||||
- echo "there"
|
|
||||||
|
|
||||||
checkout:
|
checkout:
|
||||||
post:
|
post:
|
||||||
|
@ -32,10 +28,11 @@ dependencies:
|
||||||
database:
|
database:
|
||||||
pre:
|
pre:
|
||||||
- ./bootstrap.sh
|
- ./bootstrap.sh
|
||||||
- ./.mason/mason install clang ${LLVM_VERSION}.0
|
- ./.mason/mason install clang++ ${LLVM_VERSION}
|
||||||
- ./.mason/mason link clang ${LLVM_VERSION}.0
|
- ./.mason/mason link clang++ ${LLVM_VERSION}
|
||||||
- ./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"
|
- ./configure CC="$(pwd)/mason_packages/.link/bin/clang" CXX="$(pwd)/mason_packages/.link/bin/ccache $(pwd)/mason_packages/.link/bin/clang++ -Qunused-arguments"
|
||||||
- make
|
- make
|
||||||
|
- nm src/libmapnik* | grep "GLIBCXX_3.4.2[0-9]" || true
|
||||||
override:
|
override:
|
||||||
- psql -c 'create database template_postgis;'
|
- psql -c 'create database template_postgis;'
|
||||||
- psql -c 'create extension postgis;' -d template_postgis
|
- psql -c 'create extension postgis;' -d 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"
|
15
configure
vendored
15
configure
vendored
|
@ -1,5 +1,18 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
PYTHON=${PYTHON:-python}
|
PYTHON=${PYTHON:-python}
|
||||||
|
|
||||||
|
# mapnik-settings.env is an optional file to store
|
||||||
|
# environment variables that should be used before
|
||||||
|
# running tests like PROJ_LIB, GDAL_DATA, and ICU_DATA
|
||||||
|
# These do not normally need to be set except when
|
||||||
|
# building against binary versions of dependencies like
|
||||||
|
# done via bootstrap.sh
|
||||||
|
if [[ -f mapnik-settings.env ]]; then
|
||||||
|
echo "Inheriting from mapnik-settings.env"
|
||||||
|
source mapnik-settings.env
|
||||||
|
fi
|
||||||
|
|
||||||
$PYTHON scons/scons.py --implicit-deps-changed configure "$@"
|
$PYTHON scons/scons.py --implicit-deps-changed configure "$@"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -43,5 +43,5 @@ ini = ini_template % locals()
|
||||||
open('viewer.ini','w').write(ini)
|
open('viewer.ini','w').write(ini)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.chmod('viewer.ini',0666)
|
os.chmod('viewer.ini',0o666)
|
||||||
except: pass
|
except: pass
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -48,7 +48,7 @@ int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
settings.setArrayIndex(index);
|
settings.setArrayIndex(index);
|
||||||
QString font_dir = settings.value("dir").toString();
|
QString font_dir = settings.value("dir").toString();
|
||||||
freetype_engine::register_fonts(font_dir.toStdString());
|
freetype_engine::instance().register_fonts(font_dir.toStdString());
|
||||||
}
|
}
|
||||||
settings.endArray();
|
settings.endArray();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* Mapnik is free software; you can redistribute it and/or
|
* Mapnik is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
######################################################################
|
######################################################################
|
||||||
# Mapnik viewer - Copyright (C) 2007 Artem Pavlenko
|
# Mapnik viewer - Copyright (C) 2007 Artem Pavlenko
|
||||||
######################################################################
|
######################################################################
|
||||||
QMAKE_MAC_SDK = macosx10.11
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
QT += core gui widgets
|
QT += core gui widgets
|
||||||
QMAKE_CXX = $$system(mapnik-config --cxx)
|
QMAKE_CXX = $$system(mapnik-config --cxx)
|
||||||
|
|
4
deps/agg/include/agg_rendering_buffer.h
vendored
4
deps/agg/include/agg_rendering_buffer.h
vendored
|
@ -176,6 +176,10 @@ namespace agg
|
||||||
{
|
{
|
||||||
m_rows.resize(height);
|
m_rows.resize(height);
|
||||||
}
|
}
|
||||||
|
else if(height == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
T* row_ptr = m_buf;
|
T* row_ptr = m_buf;
|
||||||
|
|
||||||
|
|
8
deps/agg/src/agg_pixfmt_rgba.cpp
vendored
8
deps/agg/src/agg_pixfmt_rgba.cpp
vendored
|
@ -1,11 +1,17 @@
|
||||||
|
|
||||||
#include "agg_pixfmt_rgba.h"
|
#include "agg_pixfmt_rgba.h"
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
|
#include <boost/version.hpp>
|
||||||
|
#if BOOST_VERSION >= 106900
|
||||||
|
#include <boost/gil.hpp>
|
||||||
|
#include <boost/gil/extension/toolbox/color_spaces/hsv.hpp>
|
||||||
|
#include <boost/gil/extension/toolbox/color_spaces/hsl.hpp>
|
||||||
|
#else
|
||||||
#include <boost/gil/gil_all.hpp>
|
#include <boost/gil/gil_all.hpp>
|
||||||
#include <boost/gil/extension/toolbox/hsv.hpp>
|
#include <boost/gil/extension/toolbox/hsv.hpp>
|
||||||
#include <boost/gil/extension/toolbox/hsl.hpp>
|
#include <boost/gil/extension/toolbox/hsl.hpp>
|
||||||
|
#endif
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
namespace agg
|
namespace agg
|
||||||
|
|
11
deps/boost/gil/extension/toolbox/hsl.hpp
vendored
11
deps/boost/gil/extension/toolbox/hsl.hpp
vendored
|
@ -16,7 +16,12 @@
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
|
#if BOOST_VERSION >= 106900
|
||||||
|
#include <boost/gil.hpp>
|
||||||
|
#else
|
||||||
#include <boost/gil/gil_all.hpp>
|
#include <boost/gil/gil_all.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
namespace boost { namespace gil {
|
namespace boost { namespace gil {
|
||||||
|
@ -43,8 +48,12 @@ typedef mpl::vector3< hsl_color_space::hue_t
|
||||||
/// \ingroup LayoutModel
|
/// \ingroup LayoutModel
|
||||||
typedef layout<hsl_t> hsl_layout_t;
|
typedef layout<hsl_t> hsl_layout_t;
|
||||||
|
|
||||||
|
#if BOOST_VERSION >= 106800
|
||||||
|
using bits32f = boost::gil::float32_t;
|
||||||
|
GIL_DEFINE_ALL_TYPEDEFS( 32f, float32_t, hsl );
|
||||||
|
#else
|
||||||
GIL_DEFINE_ALL_TYPEDEFS( 32f, hsl );
|
GIL_DEFINE_ALL_TYPEDEFS( 32f, hsl );
|
||||||
|
#endif
|
||||||
|
|
||||||
/// \ingroup ColorConvert
|
/// \ingroup ColorConvert
|
||||||
/// \brief RGB to HSL
|
/// \brief RGB to HSL
|
||||||
|
|
13
deps/boost/gil/extension/toolbox/hsv.hpp
vendored
13
deps/boost/gil/extension/toolbox/hsv.hpp
vendored
|
@ -16,7 +16,12 @@
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
|
#if BOOST_VERSION >= 106900
|
||||||
|
#include <boost/gil.hpp>
|
||||||
|
#else
|
||||||
#include <boost/gil/gil_all.hpp>
|
#include <boost/gil/gil_all.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
namespace boost { namespace gil {
|
namespace boost { namespace gil {
|
||||||
|
@ -44,7 +49,13 @@ typedef mpl::vector3< hsv_color_space::hue_t
|
||||||
typedef layout<hsv_t> hsv_layout_t;
|
typedef layout<hsv_t> hsv_layout_t;
|
||||||
|
|
||||||
|
|
||||||
GIL_DEFINE_ALL_TYPEDEFS( 32f, hsv )
|
#if BOOST_VERSION >= 106800
|
||||||
|
using bits32 = uint32_t;
|
||||||
|
using bits32f = float32_t;
|
||||||
|
GIL_DEFINE_ALL_TYPEDEFS( 32f, float32_t, hsv )
|
||||||
|
#else
|
||||||
|
GIL_DEFINE_ALL_TYPEDEFS( 32f, hsv );
|
||||||
|
#endif
|
||||||
|
|
||||||
/// \ingroup ColorConvert
|
/// \ingroup ColorConvert
|
||||||
/// \brief RGB to HSV
|
/// \brief RGB to HSV
|
||||||
|
|
2
deps/mapbox/variant
vendored
2
deps/mapbox/variant
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 9a115c5eb3c09509c70a57b25b283b6e1cbba919
|
Subproject commit d2588a8f1d6b5d480d228e6d8a906ce634bdea9a
|
142
include/mapnik/agg/render_polygon_pattern.hpp
Normal file
142
include/mapnik/agg/render_polygon_pattern.hpp
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 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_RENDER_POLYGON_PATTERN_HPP
|
||||||
|
#define MAPNIK_RENDER_POLYGON_PATTERN_HPP
|
||||||
|
|
||||||
|
#include <mapnik/symbolizer.hpp>
|
||||||
|
#include <mapnik/vertex_processor.hpp>
|
||||||
|
#include <mapnik/renderer_common/pattern_alignment.hpp>
|
||||||
|
#include <mapnik/renderer_common/apply_vertex_converter.hpp>
|
||||||
|
#include <mapnik/renderer_common/clipping_extent.hpp>
|
||||||
|
#include <mapnik/vertex_converters.hpp>
|
||||||
|
#include <mapnik/safe_cast.hpp>
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#include <mapnik/warning_ignore_agg.hpp>
|
||||||
|
#include "agg_basics.h"
|
||||||
|
#include "agg_rendering_buffer.h"
|
||||||
|
#include "agg_pixfmt_rgba.h"
|
||||||
|
#include "agg_color_rgba.h"
|
||||||
|
#include "agg_rasterizer_scanline_aa.h"
|
||||||
|
#include "agg_scanline_u.h"
|
||||||
|
#include "agg_renderer_scanline.h"
|
||||||
|
#include "agg_span_allocator.h"
|
||||||
|
#include "agg_span_pattern_rgba.h"
|
||||||
|
#include "agg_image_accessors.h"
|
||||||
|
#include "agg_conv_clip_polygon.h"
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
namespace mapnik {
|
||||||
|
|
||||||
|
struct agg_pattern_base
|
||||||
|
{
|
||||||
|
image_rgba8 const& pattern_img_;
|
||||||
|
renderer_common const& common_;
|
||||||
|
symbolizer_base const& sym_;
|
||||||
|
mapnik::feature_impl const& feature_;
|
||||||
|
proj_transform const& prj_trans_;
|
||||||
|
|
||||||
|
agg::trans_affine geom_transform() const
|
||||||
|
{
|
||||||
|
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_);
|
||||||
|
}
|
||||||
|
return tr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename VertexConverter>
|
||||||
|
struct agg_polygon_pattern : agg_pattern_base
|
||||||
|
{
|
||||||
|
using color_type = agg::rgba8;
|
||||||
|
using order_type = agg::order_rgba;
|
||||||
|
using blender_type = agg::comp_op_adaptor_rgba_pre<color_type, order_type>;
|
||||||
|
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 renderer_base = agg::renderer_base<pixfmt_type>;
|
||||||
|
using renderer_type = agg::renderer_scanline_aa_alpha<renderer_base,
|
||||||
|
agg::span_allocator<agg::rgba8>,
|
||||||
|
span_gen_type>;
|
||||||
|
|
||||||
|
agg_polygon_pattern(image_rgba8 const& pattern_img,
|
||||||
|
renderer_common const& common,
|
||||||
|
symbolizer_base const& sym,
|
||||||
|
mapnik::feature_impl const& feature,
|
||||||
|
proj_transform const& prj_trans)
|
||||||
|
: agg_pattern_base{pattern_img, common, sym, feature, prj_trans},
|
||||||
|
clip_(get<value_bool, keys::clip>(sym_, feature_, common_.vars_)),
|
||||||
|
clip_box_(clipping_extent(common)),
|
||||||
|
tr_(geom_transform()),
|
||||||
|
converter_(clip_box_, sym, common.t_, prj_trans, tr_,
|
||||||
|
feature, common.vars_, common.scale_factor_)
|
||||||
|
{
|
||||||
|
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_);
|
||||||
|
|
||||||
|
if (simplify_tolerance > 0.0) converter_.template set<simplify_tag>();
|
||||||
|
converter_.template set<affine_transform_tag>();
|
||||||
|
if (smooth > 0.0) converter_.template set<smooth_tag>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void render(renderer_base & ren_base, rasterizer & ras)
|
||||||
|
{
|
||||||
|
coord<double, 2> offset(pattern_offset(sym_, feature_, prj_trans_, common_,
|
||||||
|
pattern_img_.width(), pattern_img_.height()));
|
||||||
|
agg::rendering_buffer pattern_rbuf((agg::int8u*)pattern_img_.bytes(),
|
||||||
|
pattern_img_.width(), pattern_img_.height(),
|
||||||
|
pattern_img_.width() * 4);
|
||||||
|
agg::pixfmt_rgba32_pre pixf_pattern(pattern_rbuf);
|
||||||
|
img_source_type img_src(pixf_pattern);
|
||||||
|
span_gen_type sg(img_src, safe_cast<unsigned>(offset.x), safe_cast<unsigned>(offset.y));
|
||||||
|
|
||||||
|
agg::span_allocator<agg::rgba8> sa;
|
||||||
|
value_double opacity = get<double, keys::opacity>(sym_, feature_, common_.vars_);
|
||||||
|
renderer_type rp(ren_base, sa, sg, unsigned(opacity * 255));
|
||||||
|
|
||||||
|
using apply_vertex_converter_type = detail::apply_vertex_converter<
|
||||||
|
VertexConverter, rasterizer>;
|
||||||
|
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());
|
||||||
|
agg::scanline_u8 sl;
|
||||||
|
agg::render_scanlines(ras, sl, rp);
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool clip_;
|
||||||
|
const box2d<double> clip_box_;
|
||||||
|
const agg::trans_affine tr_;
|
||||||
|
VertexConverter converter_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mapnik
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MAPNIK_RENDER_POLYGON_PATTERN_HPP
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -116,6 +116,7 @@ public:
|
||||||
bool valid() const;
|
bool valid() const;
|
||||||
void move(T x, T y);
|
void move(T x, T y);
|
||||||
std::string to_string() const;
|
std::string to_string() const;
|
||||||
|
T area() const;
|
||||||
|
|
||||||
// define some operators
|
// define some operators
|
||||||
box2d_type& operator+=(box2d_type const& other);
|
box2d_type& operator+=(box2d_type const& other);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -393,6 +393,11 @@ std::string box2d<T>::to_string() const
|
||||||
return s.str();
|
return s.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T box2d<T>::area() const
|
||||||
|
{
|
||||||
|
return width() * height();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
box2d<T>& box2d<T>::operator+=(box2d<T> const& other)
|
box2d<T>& box2d<T>::operator+=(box2d<T> const& other)
|
||||||
|
@ -466,7 +471,7 @@ T box2d<T>::operator[] (int index) const
|
||||||
case -1:
|
case -1:
|
||||||
return maxy_;
|
return maxy_;
|
||||||
default:
|
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 "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -121,6 +121,30 @@ private:
|
||||||
cairo_face_cache cache_;
|
cairo_face_cache cache_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct cairo_closer
|
||||||
|
{
|
||||||
|
void operator() (cairo_t * obj)
|
||||||
|
{
|
||||||
|
if (obj) cairo_destroy(obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cairo_surface_closer
|
||||||
|
{
|
||||||
|
void operator() (cairo_surface_t * surface)
|
||||||
|
{
|
||||||
|
if (surface) cairo_surface_destroy(surface);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
using cairo_ptr = std::shared_ptr<cairo_t>;
|
||||||
|
using cairo_surface_ptr = std::shared_ptr<cairo_surface_t>;
|
||||||
|
|
||||||
|
inline cairo_ptr create_context(cairo_surface_ptr const& surface)
|
||||||
|
{
|
||||||
|
return cairo_ptr(cairo_create(&*surface),cairo_closer());
|
||||||
|
}
|
||||||
|
|
||||||
class cairo_pattern : private util::noncopyable
|
class cairo_pattern : private util::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -131,9 +155,15 @@ public:
|
||||||
const unsigned int *in_end = in_ptr + pixels;
|
const unsigned int *in_end = in_ptr + pixels;
|
||||||
unsigned int *out_ptr;
|
unsigned int *out_ptr;
|
||||||
|
|
||||||
surface_ = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, static_cast<int>(data.width()), static_cast<int>(data.height()));
|
surface_ = cairo_surface_ptr(
|
||||||
|
cairo_image_surface_create(
|
||||||
|
CAIRO_FORMAT_ARGB32,
|
||||||
|
static_cast<int>(data.width()),
|
||||||
|
static_cast<int>(data.height())),
|
||||||
|
cairo_surface_closer());
|
||||||
|
|
||||||
out_ptr = reinterpret_cast<unsigned int *>(cairo_image_surface_get_data(surface_));
|
out_ptr = reinterpret_cast<unsigned int *>(
|
||||||
|
cairo_image_surface_get_data(surface_.get()));
|
||||||
|
|
||||||
while (in_ptr < in_end)
|
while (in_ptr < in_end)
|
||||||
{
|
{
|
||||||
|
@ -150,13 +180,18 @@ public:
|
||||||
*out_ptr++ = (a << 24) | (r << 16) | (g << 8) | b;
|
*out_ptr++ = (a << 24) | (r << 16) | (g << 8) | b;
|
||||||
}
|
}
|
||||||
// mark the surface as dirty as we've modified it behind cairo's back
|
// mark the surface as dirty as we've modified it behind cairo's back
|
||||||
cairo_surface_mark_dirty(surface_);
|
cairo_surface_mark_dirty(surface_.get());
|
||||||
pattern_ = cairo_pattern_create_for_surface(surface_);
|
pattern_ = cairo_pattern_create_for_surface(surface_.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_pattern(cairo_surface_ptr const& surface) :
|
||||||
|
surface_(surface),
|
||||||
|
pattern_(cairo_pattern_create_for_surface(surface_.get()))
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~cairo_pattern()
|
~cairo_pattern()
|
||||||
{
|
{
|
||||||
if (surface_) cairo_surface_destroy(surface_);
|
|
||||||
if (pattern_) cairo_pattern_destroy(pattern_);
|
if (pattern_) cairo_pattern_destroy(pattern_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +225,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cairo_surface_t * surface_;
|
cairo_surface_ptr surface_;
|
||||||
cairo_pattern_t * pattern_;
|
cairo_pattern_t * pattern_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -255,30 +290,6 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cairo_closer
|
|
||||||
{
|
|
||||||
void operator() (cairo_t * obj)
|
|
||||||
{
|
|
||||||
if (obj) cairo_destroy(obj);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cairo_surface_closer
|
|
||||||
{
|
|
||||||
void operator() (cairo_surface_t * surface)
|
|
||||||
{
|
|
||||||
if (surface) cairo_surface_destroy(surface);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
using cairo_ptr = std::shared_ptr<cairo_t>;
|
|
||||||
using cairo_surface_ptr = std::shared_ptr<cairo_surface_t>;
|
|
||||||
|
|
||||||
inline cairo_ptr create_context(cairo_surface_ptr const& surface)
|
|
||||||
{
|
|
||||||
return cairo_ptr(cairo_create(&*surface),cairo_closer());
|
|
||||||
}
|
|
||||||
|
|
||||||
class cairo_context : private util::noncopyable
|
class cairo_context : private util::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
211
include/mapnik/cairo/render_polygon_pattern.hpp
Normal file
211
include/mapnik/cairo/render_polygon_pattern.hpp
Normal file
|
@ -0,0 +1,211 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 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_CAIRO_RENDER_POLYGON_PATTERN_HPP
|
||||||
|
#define MAPNIK_CAIRO_RENDER_POLYGON_PATTERN_HPP
|
||||||
|
|
||||||
|
#include <mapnik/symbolizer.hpp>
|
||||||
|
#include <mapnik/vertex_processor.hpp>
|
||||||
|
#include <mapnik/vertex_converters.hpp>
|
||||||
|
#include <mapnik/renderer_common/pattern_alignment.hpp>
|
||||||
|
#include <mapnik/renderer_common/apply_vertex_converter.hpp>
|
||||||
|
#include <mapnik/renderer_common/clipping_extent.hpp>
|
||||||
|
#include <mapnik/cairo/cairo_render_vector.hpp>
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
|
|
||||||
|
namespace mapnik {
|
||||||
|
|
||||||
|
struct cairo_renderer_process_visitor_p
|
||||||
|
{
|
||||||
|
cairo_renderer_process_visitor_p(agg::trans_affine const& image_tr,
|
||||||
|
double opacity)
|
||||||
|
: image_tr_(image_tr),
|
||||||
|
opacity_(opacity)
|
||||||
|
{}
|
||||||
|
|
||||||
|
cairo_surface_ptr operator()(marker_svg const & marker) const
|
||||||
|
{
|
||||||
|
box2d<double> bbox(marker.bounding_box());
|
||||||
|
agg::trans_affine tr(transform(bbox));
|
||||||
|
|
||||||
|
double width = std::max(1.0, std::round(bbox.width()));
|
||||||
|
double height = std::max(1.0, std::round(bbox.height()));
|
||||||
|
cairo_rectangle_t extent { 0, 0, width, height };
|
||||||
|
cairo_surface_ptr surface(
|
||||||
|
cairo_recording_surface_create(
|
||||||
|
CAIRO_CONTENT_COLOR_ALPHA, &extent),
|
||||||
|
cairo_surface_closer());
|
||||||
|
|
||||||
|
cairo_ptr cairo = create_context(surface);
|
||||||
|
cairo_context context(cairo);
|
||||||
|
|
||||||
|
svg_storage_type & svg = *marker.get_data();
|
||||||
|
svg_attribute_type const& svg_attributes = svg.attributes();
|
||||||
|
svg::vertex_stl_adapter<svg::svg_path_storage> stl_storage(
|
||||||
|
svg.source());
|
||||||
|
svg::svg_path_adapter svg_path(stl_storage);
|
||||||
|
|
||||||
|
render_vector_marker(context, svg_path, svg_attributes,
|
||||||
|
bbox, tr, opacity_);
|
||||||
|
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_surface_ptr operator()(marker_rgba8 const& marker) const
|
||||||
|
{
|
||||||
|
box2d<double> bbox(marker.bounding_box());
|
||||||
|
agg::trans_affine tr(transform(bbox));
|
||||||
|
|
||||||
|
cairo_rectangle_t extent { 0, 0, bbox.width(), bbox.height() };
|
||||||
|
cairo_surface_ptr surface(
|
||||||
|
cairo_recording_surface_create(
|
||||||
|
CAIRO_CONTENT_COLOR_ALPHA, &extent),
|
||||||
|
cairo_surface_closer());
|
||||||
|
|
||||||
|
cairo_ptr cairo = create_context(surface);
|
||||||
|
cairo_context context(cairo);
|
||||||
|
|
||||||
|
context.add_image(tr, marker.get_data(), opacity_);
|
||||||
|
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_surface_ptr operator() (marker_null const&) const
|
||||||
|
{
|
||||||
|
cairo_surface_ptr surface(
|
||||||
|
cairo_recording_surface_create(
|
||||||
|
CAIRO_CONTENT_COLOR_ALPHA, nullptr),
|
||||||
|
cairo_surface_closer());
|
||||||
|
cairo_ptr cairo = create_context(surface);
|
||||||
|
cairo_context context(cairo);
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
agg::trans_affine transform(box2d<double> & bbox) const
|
||||||
|
{
|
||||||
|
bbox *= image_tr_;
|
||||||
|
coord<double, 2> c = bbox.center();
|
||||||
|
agg::trans_affine mtx = agg::trans_affine_translation(
|
||||||
|
0.5 * bbox.width() - c.x,
|
||||||
|
0.5 * bbox.height() - c.y);
|
||||||
|
return image_tr_ * mtx;
|
||||||
|
}
|
||||||
|
|
||||||
|
agg::trans_affine const& image_tr_;
|
||||||
|
const double opacity_;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cairo_pattern_base
|
||||||
|
{
|
||||||
|
mapnik::marker const& marker_;
|
||||||
|
renderer_common const& common_;
|
||||||
|
symbolizer_base const& sym_;
|
||||||
|
mapnik::feature_impl const& feature_;
|
||||||
|
proj_transform const& prj_trans_;
|
||||||
|
|
||||||
|
agg::trans_affine geom_transform() const
|
||||||
|
{
|
||||||
|
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_);
|
||||||
|
}
|
||||||
|
return tr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename VertexConverter>
|
||||||
|
struct cairo_polygon_pattern : cairo_pattern_base
|
||||||
|
{
|
||||||
|
cairo_polygon_pattern(mapnik::marker const& marker,
|
||||||
|
renderer_common const& common,
|
||||||
|
symbolizer_base const& sym,
|
||||||
|
mapnik::feature_impl const& feature,
|
||||||
|
proj_transform const& prj_trans)
|
||||||
|
: cairo_pattern_base{marker, common, sym, feature, prj_trans},
|
||||||
|
clip_(get<value_bool, keys::clip>(sym_, feature_, common_.vars_)),
|
||||||
|
clip_box_(clipping_extent(common)),
|
||||||
|
tr_(geom_transform()),
|
||||||
|
converter_(clip_box_, sym, common.t_, prj_trans, tr_,
|
||||||
|
feature, common.vars_, common.scale_factor_)
|
||||||
|
{
|
||||||
|
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_);
|
||||||
|
|
||||||
|
converter_.template set<affine_transform_tag>();
|
||||||
|
if (simplify_tolerance > 0.0) converter_.template set<simplify_tag>();
|
||||||
|
if (smooth > 0.0) converter_.template set<smooth_tag>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void render(cairo_fill_rule_t fill_rule, cairo_context & context)
|
||||||
|
{
|
||||||
|
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_);
|
||||||
|
}
|
||||||
|
|
||||||
|
composite_mode_e comp_op = get<composite_mode_e, keys::comp_op>(sym_, feature_, common_.vars_);
|
||||||
|
|
||||||
|
cairo_save_restore guard(context);
|
||||||
|
context.set_operator(comp_op);
|
||||||
|
|
||||||
|
cairo_renderer_process_visitor_p visitor(image_tr, opacity);
|
||||||
|
cairo_surface_ptr surface(util::apply_visitor(visitor, this->marker_));
|
||||||
|
|
||||||
|
coord<double, 2> offset(0, 0);
|
||||||
|
|
||||||
|
cairo_rectangle_t pattern_surface_extent;
|
||||||
|
if (cairo_recording_surface_get_extents(surface.get(), &pattern_surface_extent))
|
||||||
|
{
|
||||||
|
offset = pattern_offset(sym_, feature_, prj_trans_, common_,
|
||||||
|
pattern_surface_extent.width, pattern_surface_extent.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_pattern pattern(surface);
|
||||||
|
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
||||||
|
pattern.set_origin(-offset.x, -offset.y);
|
||||||
|
context.set_pattern(pattern);
|
||||||
|
|
||||||
|
using apply_vertex_converter_type = detail::apply_vertex_converter<VertexConverter, cairo_context>;
|
||||||
|
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
|
||||||
|
apply_vertex_converter_type apply(converter_, context);
|
||||||
|
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
|
||||||
|
// fill polygon
|
||||||
|
context.set_fill_rule(fill_rule);
|
||||||
|
context.fill();
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool clip_;
|
||||||
|
const box2d<double> clip_box_;
|
||||||
|
const agg::trans_affine tr_;
|
||||||
|
VertexConverter converter_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mapnik
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MAPNIK_CAIRO_RENDER_POLYGON_PATTERN_HPP
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -41,10 +41,8 @@ public:
|
||||||
config_error(std::string const& what,
|
config_error(std::string const& what,
|
||||||
unsigned line_number,
|
unsigned line_number,
|
||||||
std::string const& filename);
|
std::string const& filename);
|
||||||
virtual ~config_error() throw() {}
|
virtual ~config_error() {}
|
||||||
|
virtual const char * what() const noexcept;
|
||||||
virtual const char * what() const throw();
|
|
||||||
|
|
||||||
void append_context(std::string const& ctx) const;
|
void append_context(std::string const& ctx) const;
|
||||||
void append_context(std::string const& ctx, xml_node const& node) const;
|
void append_context(std::string const& ctx, xml_node const& node) const;
|
||||||
void append_context(xml_node const& node) const;
|
void append_context(xml_node const& node) const;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
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) 2021 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
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -46,14 +46,11 @@ class MAPNIK_DECL datasource_exception : public std::exception
|
||||||
public:
|
public:
|
||||||
datasource_exception(std::string const& message)
|
datasource_exception(std::string const& message)
|
||||||
: message_(message)
|
: message_(message)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
~datasource_exception() throw()
|
~datasource_exception() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual const char* what() const throw()
|
virtual const char* what() const noexcept
|
||||||
{
|
{
|
||||||
return message_.c_str();
|
return message_.c_str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -28,7 +28,6 @@
|
||||||
#include <mapnik/debug.hpp>
|
#include <mapnik/debug.hpp>
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <bitset>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -45,9 +44,9 @@ public:
|
||||||
what_( _what )
|
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();
|
return what_.c_str();
|
||||||
}
|
}
|
||||||
|
@ -190,6 +189,8 @@ public:
|
||||||
for (unsigned i = 0; i < THE_MAX; ++i)
|
for (unsigned i = 0; i < THE_MAX; ++i)
|
||||||
{
|
{
|
||||||
#pragma GCC diagnostic push
|
#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"
|
#pragma GCC diagnostic ignored "-Wundefined-var-template"
|
||||||
if (str_copy == our_strings_[i])
|
if (str_copy == our_strings_[i])
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
@ -203,6 +204,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma GCC diagnostic push
|
#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"
|
#pragma GCC diagnostic ignored "-Wundefined-var-template"
|
||||||
throw illegal_enum_value(std::string("Illegal enumeration value '") +
|
throw illegal_enum_value(std::string("Illegal enumeration value '") +
|
||||||
str + "' for enum " + our_name_);
|
str + "' for enum " + our_name_);
|
||||||
|
@ -213,6 +216,8 @@ public:
|
||||||
std::string as_string() const
|
std::string as_string() const
|
||||||
{
|
{
|
||||||
#pragma GCC diagnostic push
|
#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"
|
#pragma GCC diagnostic ignored "-Wundefined-var-template"
|
||||||
return our_strings_[value_];
|
return our_strings_[value_];
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -233,10 +233,12 @@ expression_grammar<Iterator>::expression_grammar(std::string const& encoding)
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
unary_function_expr = unary_func_type >> '(' > logical_expr > ')'
|
unary_function_expr = unary_func_type
|
||||||
|
> '(' > logical_expr > ')'
|
||||||
;
|
;
|
||||||
|
|
||||||
binary_function_expr = binary_func_type >> '(' > logical_expr > ','
|
binary_function_expr = binary_func_type
|
||||||
|
> '(' > logical_expr > ','
|
||||||
> logical_expr > ')'
|
> logical_expr > ')'
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -208,6 +208,11 @@ public:
|
||||||
return geom_;
|
return geom_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline geometry::geometry<double> & get_geometry()
|
||||||
|
{
|
||||||
|
return geom_;
|
||||||
|
}
|
||||||
|
|
||||||
inline box2d<double> envelope() const
|
inline box2d<double> envelope() const
|
||||||
{
|
{
|
||||||
return mapnik::geometry::envelope(geom_);
|
return mapnik::geometry::envelope(geom_);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -25,9 +25,10 @@
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/config.hpp>
|
#include <mapnik/config.hpp>
|
||||||
|
#include <mapnik/util/singleton.hpp>
|
||||||
|
#include <mapnik/util/noncopyable.hpp>
|
||||||
#include <mapnik/font_set.hpp>
|
#include <mapnik/font_set.hpp>
|
||||||
#include <mapnik/text/font_library.hpp>
|
#include <mapnik/text/font_library.hpp>
|
||||||
#include <mapnik/util/noncopyable.hpp>
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -35,10 +36,6 @@
|
||||||
#include <utility> // pair
|
#include <utility> // pair
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef MAPNIK_THREADSAFE
|
|
||||||
#include <mutex>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost { template <class T> class optional; }
|
namespace boost { template <class T> class optional; }
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
@ -51,22 +48,17 @@ using face_set_ptr = std::unique_ptr<font_face_set>;
|
||||||
class font_face;
|
class font_face;
|
||||||
using face_ptr = std::shared_ptr<font_face>;
|
using face_ptr = std::shared_ptr<font_face>;
|
||||||
|
|
||||||
class MAPNIK_DECL freetype_engine
|
class MAPNIK_DECL freetype_engine : public singleton<freetype_engine, CreateUsingNew>,
|
||||||
|
private util::noncopyable
|
||||||
{
|
{
|
||||||
|
friend class CreateUsingNew<freetype_engine>;
|
||||||
|
friend class Map;
|
||||||
public:
|
public:
|
||||||
using font_file_mapping_type = std::map<std::string,std::pair<int,std::string>>;
|
using font_file_mapping_type = std::map<std::string,std::pair<int,std::string>>;
|
||||||
using font_memory_cache_type = std::map<std::string, std::pair<std::unique_ptr<char[]>, std::size_t>>;
|
using font_memory_cache_type = std::map<std::string, std::pair<std::unique_ptr<char[]>, std::size_t>>;
|
||||||
|
|
||||||
static bool is_font_file(std::string const& file_name);
|
static bool is_font_file(std::string const& file_name);
|
||||||
/*! \brief register a font file
|
|
||||||
* @param file_name path to a font file.
|
|
||||||
* @return bool - true if at least one face was successfully registered in the file.
|
|
||||||
*/
|
|
||||||
static bool register_font(std::string const& file_name);
|
static bool register_font(std::string const& file_name);
|
||||||
/*! \brief register a font files
|
|
||||||
* @param dir - path to a directory containing fonts or subdirectories.
|
|
||||||
* @param recurse - default false, whether to search for fonts in sub directories.
|
|
||||||
* @return bool - true if at least one face was successfully registered.
|
|
||||||
*/
|
|
||||||
static bool register_fonts(std::string const& dir, bool recurse = false);
|
static bool register_fonts(std::string const& dir, bool recurse = false);
|
||||||
static std::vector<std::string> face_names();
|
static std::vector<std::string> face_names();
|
||||||
static font_file_mapping_type const& get_mapping();
|
static font_file_mapping_type const& get_mapping();
|
||||||
|
@ -75,29 +67,42 @@ public:
|
||||||
font_library & library,
|
font_library & library,
|
||||||
font_file_mapping_type const& font_file_mapping,
|
font_file_mapping_type const& font_file_mapping,
|
||||||
font_file_mapping_type const& global_font_file_mapping);
|
font_file_mapping_type const& global_font_file_mapping);
|
||||||
|
|
||||||
static face_ptr create_face(std::string const& face_name,
|
static face_ptr create_face(std::string const& face_name,
|
||||||
font_library & library,
|
font_library & library,
|
||||||
font_file_mapping_type const& font_file_mapping,
|
font_file_mapping_type const& font_file_mapping,
|
||||||
freetype_engine::font_memory_cache_type const& font_cache,
|
freetype_engine::font_memory_cache_type const& font_cache,
|
||||||
font_file_mapping_type const& global_font_file_mapping,
|
font_file_mapping_type const& global_font_file_mapping,
|
||||||
freetype_engine::font_memory_cache_type & global_memory_fonts);
|
freetype_engine::font_memory_cache_type & global_memory_fonts);
|
||||||
static bool register_font_impl(std::string const& file_name,
|
private:
|
||||||
|
bool is_font_file_impl(std::string const& file_name);
|
||||||
|
std::vector<std::string> face_names_impl();
|
||||||
|
font_file_mapping_type const& get_mapping_impl();
|
||||||
|
font_memory_cache_type& get_cache_impl();
|
||||||
|
bool can_open_impl(std::string const& face_name,
|
||||||
|
font_library & library,
|
||||||
|
font_file_mapping_type const& font_file_mapping,
|
||||||
|
font_file_mapping_type const& global_font_file_mapping);
|
||||||
|
|
||||||
|
face_ptr create_face_impl(std::string const& face_name,
|
||||||
|
font_library & library,
|
||||||
|
font_file_mapping_type const& font_file_mapping,
|
||||||
|
freetype_engine::font_memory_cache_type const& font_cache,
|
||||||
|
font_file_mapping_type const& global_font_file_mapping,
|
||||||
|
freetype_engine::font_memory_cache_type & global_memory_fonts);
|
||||||
|
bool register_font_impl(std::string const& file_name);
|
||||||
|
bool register_fonts_impl(std::string const& dir, bool recurse);
|
||||||
|
bool register_font_impl(std::string const& file_name, FT_LibraryRec_ * library);
|
||||||
|
bool register_fonts_impl(std::string const& dir, FT_LibraryRec_ * library, bool recurse = false);
|
||||||
|
bool register_font_impl(std::string const& file_name,
|
||||||
font_library & libary,
|
font_library & libary,
|
||||||
font_file_mapping_type & font_file_mapping);
|
font_file_mapping_type & font_file_mapping);
|
||||||
static bool register_fonts_impl(std::string const& dir,
|
bool register_fonts_impl(std::string const& dir,
|
||||||
font_library & libary,
|
font_library & libary,
|
||||||
font_file_mapping_type & font_file_mapping,
|
font_file_mapping_type & font_file_mapping,
|
||||||
bool recurse = false);
|
bool recurse = false);
|
||||||
virtual ~freetype_engine();
|
font_file_mapping_type global_font_file_mapping_;
|
||||||
freetype_engine();
|
font_memory_cache_type global_memory_fonts_;
|
||||||
private:
|
|
||||||
static bool register_font_impl(std::string const& file_name, FT_LibraryRec_ * library);
|
|
||||||
static bool register_fonts_impl(std::string const& dir, FT_LibraryRec_ * library, bool recurse = false);
|
|
||||||
#ifdef MAPNIK_THREADSAFE
|
|
||||||
static std::mutex mutex_;
|
|
||||||
#endif
|
|
||||||
static font_file_mapping_type global_font_file_mapping_;
|
|
||||||
static font_memory_cache_type global_memory_fonts_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MAPNIK_DECL face_manager
|
class MAPNIK_DECL face_manager
|
||||||
|
@ -124,7 +129,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
using face_manager_freetype = face_manager;
|
using face_manager_freetype = face_manager;
|
||||||
|
extern template class MAPNIK_DECL singleton<freetype_engine, CreateUsingNew>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MAPNIK_FONT_ENGINE_FREETYPE_HPP
|
#endif // MAPNIK_FONT_ENGINE_FREETYPE_HPP
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
#include <mapnik/coord.hpp>
|
#include <mapnik/coord.hpp>
|
||||||
#include <mapnik/vertex.hpp>
|
#include <mapnik/vertex.hpp>
|
||||||
#include <mapnik/geometry_types.hpp>
|
#include <mapnik/geometry_types.hpp>
|
||||||
|
#include <mapnik/geometry.hpp>
|
||||||
// stl
|
// stl
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -321,56 +322,60 @@ bool middle_point(PathType & path, double & x, double & y)
|
||||||
template <typename PathType>
|
template <typename PathType>
|
||||||
bool centroid(PathType & path, double & x, double & y)
|
bool centroid(PathType & path, double & x, double & y)
|
||||||
{
|
{
|
||||||
double x0 = 0.0;
|
geometry::point<double> p0, p1, move_to, start;
|
||||||
double y0 = 0.0;
|
|
||||||
double x1 = 0.0;
|
|
||||||
double y1 = 0.0;
|
|
||||||
double start_x;
|
|
||||||
double start_y;
|
|
||||||
|
|
||||||
path.rewind(0);
|
path.rewind(0);
|
||||||
unsigned command = path.vertex(&x0, &y0);
|
unsigned command = path.vertex(&p0.x, &p0.y);
|
||||||
if (command == SEG_END) return false;
|
if (command == SEG_END) return false;
|
||||||
|
|
||||||
start_x = x0;
|
start = move_to = p0;
|
||||||
start_y = y0;
|
|
||||||
|
|
||||||
double atmp = 0.0;
|
double atmp = 0.0;
|
||||||
double xtmp = 0.0;
|
double xtmp = 0.0;
|
||||||
double ytmp = 0.0;
|
double ytmp = 0.0;
|
||||||
unsigned count = 1;
|
unsigned count = 1;
|
||||||
while (SEG_END != (command = path.vertex(&x1, &y1)))
|
while (SEG_END != (command = path.vertex(&p1.x, &p1.y)))
|
||||||
{
|
{
|
||||||
if (command == SEG_CLOSE) continue;
|
switch (command)
|
||||||
double dx0 = x0 - start_x;
|
{
|
||||||
double dy0 = y0 - start_y;
|
case SEG_MOVETO:
|
||||||
double dx1 = x1 - start_x;
|
move_to = p1;
|
||||||
double dy1 = y1 - start_y;
|
break;
|
||||||
|
case SEG_CLOSE:
|
||||||
|
p1 = move_to;
|
||||||
|
case SEG_LINETO:
|
||||||
|
double dx0 = p0.x - start.x;
|
||||||
|
double dy0 = p0.y - start.y;
|
||||||
|
double dx1 = p1.x - start.x;
|
||||||
|
double dy1 = p1.y - start.y;
|
||||||
|
|
||||||
double ai = dx0 * dy1 - dx1 * dy0;
|
double ai = dx0 * dy1 - dx1 * dy0;
|
||||||
atmp += ai;
|
atmp += ai;
|
||||||
xtmp += (dx1 + dx0) * ai;
|
xtmp += (dx1 + dx0) * ai;
|
||||||
ytmp += (dy1 + dy0) * ai;
|
ytmp += (dy1 + dy0) * ai;
|
||||||
x0 = x1;
|
break;
|
||||||
y0 = y1;
|
|
||||||
|
}
|
||||||
|
p0 = p1;
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count <= 2) {
|
if (count <= 2)
|
||||||
x = (start_x + x0) * 0.5;
|
{
|
||||||
y = (start_y + y0) * 0.5;
|
x = (start.x + p0.x) * 0.5;
|
||||||
|
y = (start.y + p0.y) * 0.5;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atmp != 0)
|
if (atmp != 0)
|
||||||
{
|
{
|
||||||
x = (xtmp/(3*atmp)) + start_x;
|
x = (xtmp / (3 * atmp)) + start.x;
|
||||||
y = (ytmp/(3*atmp)) + start_y;
|
y = (ytmp / (3 * atmp)) + start.y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = x0;
|
x = p0.x;
|
||||||
y = y0;
|
y = p0.y;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -513,77 +518,6 @@ bool hit_test(PathType & path, double x, double y, double tol)
|
||||||
return inside;
|
return inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename PathType>
|
|
||||||
bool interior_position(PathType & path, double & x, double & y)
|
|
||||||
{
|
|
||||||
// start with the centroid
|
|
||||||
if (!label::centroid(path, x,y))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// otherwise we find a horizontal line across the polygon and then return the
|
|
||||||
// center of the widest intersection between the polygon and the line.
|
|
||||||
|
|
||||||
std::vector<double> intersections; // only need to store the X as we know the y
|
|
||||||
|
|
||||||
double x0 = 0;
|
|
||||||
double y0 = 0;
|
|
||||||
path.rewind(0);
|
|
||||||
unsigned command = path.vertex(&x0, &y0);
|
|
||||||
double x1 = 0;
|
|
||||||
double y1 = 0;
|
|
||||||
while (SEG_END != (command = path.vertex(&x1, &y1)))
|
|
||||||
{
|
|
||||||
if (command == SEG_CLOSE)
|
|
||||||
continue;
|
|
||||||
if (command != SEG_MOVETO)
|
|
||||||
{
|
|
||||||
// if the segments overlap
|
|
||||||
if (y0==y1)
|
|
||||||
{
|
|
||||||
if (y0==y)
|
|
||||||
{
|
|
||||||
double xi = (x0+x1)/2.0;
|
|
||||||
intersections.push_back(xi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if the path segment crosses the bisector
|
|
||||||
else if ((y0 <= y && y1 >= y) ||
|
|
||||||
(y0 >= y && y1 <= y))
|
|
||||||
{
|
|
||||||
// then calculate the intersection
|
|
||||||
double xi = x0;
|
|
||||||
if (x0 != x1)
|
|
||||||
{
|
|
||||||
double m = (y1-y0)/(x1-x0);
|
|
||||||
double c = y0 - m*x0;
|
|
||||||
xi = (y-c)/m;
|
|
||||||
}
|
|
||||||
|
|
||||||
intersections.push_back(xi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x0 = x1;
|
|
||||||
y0 = y1;
|
|
||||||
}
|
|
||||||
// no intersections we just return the default
|
|
||||||
if (intersections.empty())
|
|
||||||
return true;
|
|
||||||
std::sort(intersections.begin(), intersections.end());
|
|
||||||
double max_width = 0;
|
|
||||||
for (unsigned ii = 1; ii < intersections.size(); ii += 2)
|
|
||||||
{
|
|
||||||
double xlow = intersections[ii-1];
|
|
||||||
double xhigh = intersections[ii];
|
|
||||||
double width = xhigh - xlow;
|
|
||||||
if (width > max_width)
|
|
||||||
{
|
|
||||||
x = (xlow + xhigh) / 2.0;
|
|
||||||
max_width = width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#endif // MAPNIK_GEOM_UTIL_HPP
|
#endif // MAPNIK_GEOM_UTIL_HPP
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Artem Pavlenko
|
* Copyright (C) 2021 Artem Pavlenko
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
121
include/mapnik/geometry/boost_spirit_karma_adapter.hpp
Normal file
121
include/mapnik/geometry/boost_spirit_karma_adapter.hpp
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 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_BOOST_SPIRIT_KARMA_ADAPTER_HPP
|
||||||
|
#define MAPNIK_BOOST_SPIRIT_KARMA_ADAPTER_HPP
|
||||||
|
|
||||||
|
#include <mapnik/geometry.hpp>
|
||||||
|
|
||||||
|
namespace boost { using mapbox::util::get; }
|
||||||
|
|
||||||
|
#include <boost/spirit/home/karma/domain.hpp>
|
||||||
|
#include <boost/spirit/home/support/attributes.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace spirit { namespace traits
|
||||||
|
{
|
||||||
|
template <>
|
||||||
|
struct not_is_variant<mapnik::geometry::geometry<double>, karma::domain>
|
||||||
|
: mpl::false_
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct not_is_variant<mapnik::geometry::geometry<std::int64_t>, karma::domain>
|
||||||
|
: mpl::false_
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct variant_which< mapnik::geometry::geometry<double> >
|
||||||
|
{
|
||||||
|
static int call(mapnik::geometry::geometry<double> const& v)
|
||||||
|
{
|
||||||
|
return v.which();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct variant_which< mapnik::geometry::geometry<std::int64_t> >
|
||||||
|
{
|
||||||
|
static int call(mapnik::geometry::geometry<std::int64_t> const& v)
|
||||||
|
{
|
||||||
|
return v.which();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
template <typename T, typename Tuple>
|
||||||
|
struct has_type;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct has_type<T, std::tuple<>> : std::false_type {};
|
||||||
|
|
||||||
|
template <typename T, typename U, typename... Types>
|
||||||
|
struct has_type<T, std::tuple<U, Types...>> : has_type<T, std::tuple<Types...>> {};
|
||||||
|
|
||||||
|
template <typename T, typename... Types>
|
||||||
|
struct has_type<T, std::tuple<T, Types...>> : std::true_type {};
|
||||||
|
|
||||||
|
template <typename T, typename Tuple>
|
||||||
|
struct index;
|
||||||
|
|
||||||
|
template <typename T, typename... Types>
|
||||||
|
struct index<T, std::tuple<T, Types...>>
|
||||||
|
{
|
||||||
|
static const std::size_t value = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename U, typename... Types>
|
||||||
|
struct index<T, std::tuple<U, Types...>>
|
||||||
|
{
|
||||||
|
static const std::size_t value = 1 + index<T, std::tuple<Types...>>::value;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Expected>
|
||||||
|
struct compute_compatible_component_variant<mapnik::geometry::geometry<double>, Expected>
|
||||||
|
: detail::has_type<Expected, mapnik::geometry::geometry<double>::types>
|
||||||
|
{
|
||||||
|
using compatible_type = Expected;
|
||||||
|
static bool is_compatible(int index)
|
||||||
|
{
|
||||||
|
return (index == detail::index<compatible_type, mapnik::geometry::geometry<double>::types>::value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Expected>
|
||||||
|
struct compute_compatible_component_variant<mapnik::geometry::geometry<std::int64_t>, Expected>
|
||||||
|
: detail::has_type<Expected, mapnik::geometry::geometry<std::int64_t>::types>
|
||||||
|
{
|
||||||
|
using compatible_type = Expected;
|
||||||
|
static bool is_compatible(int index)
|
||||||
|
{
|
||||||
|
return (index == detail::index<compatible_type, mapnik::geometry::geometry<std::int64_t>::types>::value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //MAPNIK_BOOST_SPIRIT_KARMA_ADAPTER_HPP
|
38
include/mapnik/geometry/interior.hpp
Normal file
38
include/mapnik/geometry/interior.hpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 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_GEOMETRY_INTERIOR_HPP
|
||||||
|
#define MAPNIK_GEOMETRY_INTERIOR_HPP
|
||||||
|
|
||||||
|
#include <mapnik/geometry.hpp>
|
||||||
|
#include <mapnik/config.hpp> // for MAPNIK_DECL
|
||||||
|
|
||||||
|
namespace mapnik { namespace geometry {
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
MAPNIK_DECL bool interior(polygon<T> const& polygon,
|
||||||
|
double scale_factor,
|
||||||
|
point<T> & pt);
|
||||||
|
|
||||||
|
} }
|
||||||
|
|
||||||
|
#endif // MAPNIK_GEOMETRY_INTERIOR_HPP
|
74
include/mapnik/geometry/polygon_vertex_processor.hpp
Normal file
74
include/mapnik/geometry/polygon_vertex_processor.hpp
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 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_GEOMETRY_POLYGON_VERTEX_PROCESSOR_HPP
|
||||||
|
#define MAPNIK_GEOMETRY_POLYGON_VERTEX_PROCESSOR_HPP
|
||||||
|
|
||||||
|
// geometry
|
||||||
|
#include <mapnik/geometry.hpp>
|
||||||
|
|
||||||
|
namespace mapnik { namespace geometry {
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct polygon_vertex_processor
|
||||||
|
{
|
||||||
|
template <typename Path>
|
||||||
|
void add_path(Path & path)
|
||||||
|
{
|
||||||
|
point<T> p;
|
||||||
|
unsigned cmd;
|
||||||
|
linear_ring<T> ring;
|
||||||
|
bool exterior = true;
|
||||||
|
while ((cmd = path.vertex(&p.x, &p.y)) != SEG_END)
|
||||||
|
{
|
||||||
|
switch (cmd)
|
||||||
|
{
|
||||||
|
case SEG_MOVETO:
|
||||||
|
case SEG_LINETO:
|
||||||
|
ring.emplace_back(p);
|
||||||
|
break;
|
||||||
|
case SEG_CLOSE:
|
||||||
|
if (!ring.empty())
|
||||||
|
{
|
||||||
|
ring.emplace_back(ring.front());
|
||||||
|
}
|
||||||
|
if (exterior)
|
||||||
|
{
|
||||||
|
polygon_.exterior_ring = std::move(ring);
|
||||||
|
exterior = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
polygon_.interior_rings.emplace_back(std::move(ring));
|
||||||
|
}
|
||||||
|
ring = linear_ring<T>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
polygon<T> polygon_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} }
|
||||||
|
|
||||||
|
#endif // MAPNIK_GEOMETRY_POLYGON_VERTEX_PROCESSOR_HPP
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue