Compare commits

...

309 commits

Author SHA1 Message Date
Artem Pavlenko
5f1be6bba5
Merge pull request #4448 from cho-m/boost-1.85.0
Fix build with Boost 1.85.0
2024-05-07 08:55:04 +01:00
Michael Cho
8088aa4319
Fix build with Boost 1.85.0
Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-04-25 13:03:15 -04:00
Artem Pavlenko
08886e3b90
Merge pull request #4414 from hummeltech/v3.1.x_Patches
v3.1.x: Backporting more patches to fix builds with modern Boost & GCC
2023-11-01 14:20:26 +00:00
Artem Pavlenko
a3b6d4a50b [PATCH] Fix building with boost_1_80 (81103491b4) 2023-10-30 12:05:25 -07:00
Tom Hughes
eaa9444201 [PATCH] Include cstdint for uint16_t (c62e03344f) 2023-10-30 12:05:10 -07:00
Artem Pavlenko
26eb76cc07
Merge pull request #4413 from hummeltech/v3.1.x_Boostv1.83
v3.1.x: Add support for building with Boost 1.83
2023-10-30 14:39:58 +00:00
arojas
3300b67b0c Add support for building with Boost 1.83 2023-10-29 10:42:04 -07:00
Artem Pavlenko
7da9009e7f
Merge pull request #4294 from jbicha/py310
mapnik 3.1 Scons needs updating for Python 3.10
2022-02-08 14:24:42 +00:00
Mats Wichmann
ed912a0eae Stop using custom OrderedDict
OrdredDict is in the standard library for all supported Python versions
(2.7 and 3.5+) and has improvements over the ActiveState recipe version
of OrderedDict we have been using. Switch to importing from collections
instead of getting it from SCons.Util (tests already did this).

At the same time, reorganize the Util.py imports - import Iterable
from collections.abc if possible (it is deprecated to import
it from collections, will stop working in 3.8); try getting the
User{Dict,List,String} from collections if possible - that is, try the
3.x way first.

Signed-off-by: Mats Wichmann <mats@linux.com>

https://github.com/SCons/scons/commit/3fa7141ec7b39
2022-02-07 12:32:15 -05:00
Artem Pavlenko
8b70a205c8 update CHANGELOG for mapnik v3.1.0 release [skip ci] 2021-01-08 11:20:06 +00:00
Artem Pavlenko
445438e34c setting up for mapnik v3.1.0 release [skip ci] 2021-01-08 11:12:07 +00:00
Artem Pavlenko
cd7272c4ef Update min BOOST_VERSION requirement to 1.61 2021-01-07 14:51:47 +00:00
Artem Pavlenko
49e0ef182f Require c++14 support in order to support building agaings Boost.Geometry >= 1.75
(https://github.com/boostorg/geometry/issues/590)
2021-01-07 14:39:10 +00:00
Artem Pavlenko
7754b6f70b update CHANGELOG for mapnik v3.0.24 release [skip ci] 2021-01-05 12:32:19 +00:00
Artem Pavlenko
be0904fcd1 setting up for mapnik v3.0.24 release [skip ci] 2021-01-05 12:31:01 +00:00
Artem Pavlenko
268fb53511 Update version to v3.0.24 (rc1) 2021-01-05 12:24:44 +00:00
Artem Pavlenko
80bc8ef819 Update CHANGELOG 2021-01-05 12:23:05 +00:00
Artem Pavlenko
4d9669bf42 update copyright (C) 2021 2021-01-05 11:59:41 +00:00
Artem Pavlenko
2d0582187a Fix most compiler warnings 2021-01-05 11:54:55 +00:00
Artem Pavlenko
255e2977a7 travis-ci - remove gcc build 2020-12-16 10:51:32 +00:00
Artem Pavlenko
6f0bab6246 Backport support for boost 1.74 via patch from @redneb 2020-12-15 16:23:59 +00:00
Artem Pavlenko
473e6f51b0 Update bootstrap.sh 2020-12-15 16:23:31 +00:00
Artem Pavlenko
23b8ecc997
Merge pull request #4171 from msitu/decode_darwin_value
fix pg_config error for darwin os
2020-09-04 14:16:05 +01:00
msitu@ceresimaging.net
a103f5e66a fix pg_config error for darwin os 2020-08-27 12:50:45 -07:00
Raul Marin
bc01c22c33 Use pkg-config to find FreeType2 if available (ref #4164) 2020-08-06 09:53:37 +01:00
Artem Pavlenko
d8346dd963 update CHANGELOG for mapnik v3.0.23 release [skip ci] 2020-02-18 09:18:42 +00:00
Artem Pavlenko
bdb30f47a5 setting up for mapnik v3.0.23 release [skip ci] 2020-02-18 09:16:39 +00:00
Artem Pavlenko
b94f00f7c5
Remove appveyor ci badge 2020-02-13 15:17:19 +00:00
Artem Pavlenko
489baf8423
Merge pull request #4126 from cpaulik/v3.0.x-gdal-int32-support
v3.0.x - Add Int32 support for gdal driver
2020-02-13 15:12:55 +00:00
Christoph Paulik
efc65126db Add Int32 support for gdal driver 2020-02-12 12:28:06 +01:00
Artem Pavlenko
f1cf712d50 Add support for BOOST >= 1_72 (backport relevant changes from master) 2020-01-23 14:48:43 +00:00
Mickey Rose
78756a9056 better tests for logical expressions
Two of the original checks were not testing what they were supposed to
test, because the result of eval didn't depend on correct parsing:

    eval("not true or not true")
    correct parse:      ((not true) or (not true)) == false
    incorrect parse:    (not (true or (not true))) == false

    eval("not false and not false")
    correct parse:      ((not false) and (not false)) == true
    incorrect parse:    (not (false and (not false))) == true

(cherry picked from commit d38d16ade9)
2020-01-02 19:32:12 +01:00
Mickey Rose
4b0bdd8630 2to3 last remnants of Python 2 syntax 2019-12-31 12:25:21 +01:00
Mickey Rose
745e393fd6 scons: minor cleanup 2019-09-01 11:54:23 +02:00
Mickey Rose
0d68464194 scons: define OPTIONAL_LIBSHEADERS before use
Fixes #4075
2019-09-01 10:25:46 +02:00
Mickey Rose
d5856a2e9d travis: move variables not relevant to cache contents out of env
(so that changing these later doesn't invalidate the cache)

(cherry picked from commit 2929c4ae6d)
2019-08-14 15:53:51 +02:00
Mickey Rose
fc7e2e1e3a travis: remove downstream trigger (refs #3366)
(cherry picked from commit a6057af11f)
2019-08-14 15:53:10 +02:00
Mickey Rose
fe96110e1d travis: install clang from apt
(cherry picked from commit f432f5f1cc)
2019-08-14 15:50:43 +02:00
Mickey Rose
19ad1f1156 travis: shortcut
(cherry picked from commit 5d51bdde7a)
2019-08-14 15:33:31 +02:00
Mickey Rose
d09fdd78a9 travis: silence gcov output and errors flooding build log
Also added ignore paths from `codecov.yml` to the command, because
codecov-bash doesn't pull those from there. Currently its `parse_yaml`
function simply ignores arrays, so they don't even check for "ignore".
4678d212cc/codecov (L834)
2019-08-14 13:36:44 +02:00
Artem Pavlenko
2ab8602f71 update CHANGELOG for mapnik v3.0.22 release [skip ci] 2019-01-22 10:58:22 +00:00
Artem Pavlenko
c338cacd71 setting up for mapnik v3.0.22 release [skip ci] 2019-01-22 10:56:47 +00:00
Tomek Dubrownik
a1543b359f Compatibility patch for Boost GIL v1.68
A number of basic typedef were removed in the Boost GIL 1.68 release,
notably `bits32` and `bits32f`. Additionally the
`GIL_DEFINE_ALL_TYPEDEFS` macro signature changed.

This commit introduces compatibility type aliases and conditionally
calls the new macro if `BOOST_VERSION` is high enough.
2019-01-22 10:50:23 +00:00
Artem Pavlenko
4698d43234 fix Boost.GIL includes for BOOST_VERSION >= 1.69 (ref #4000) 2019-01-22 10:36:12 +00:00
Artem Pavlenko
24425f9ba5 explicit cast to native enum type in switch statements to address error: case value is not a constant expression
(clang version 8.0.0 (trunk 347189))
2019-01-22 10:33:41 +00:00
Artem Pavlenko
a1e91dcf35
Merge pull request #4017 from mapycz/changelog-3.0.22
Changelog for 3.0.22
2019-01-22 09:15:45 +00:00
Jiri Drbalek
2c396a52ad Changelog for 3.0.22 2019-01-05 16:03:42 +00:00
Artem Pavlenko
bc64766d32
Merge pull request #4012 from mapycz/v3.0.x-cairo-polygon-pattern-vectorial
v3.0.x: Vector patterns with Cairo
2018-11-29 20:02:10 +00:00
Jiri Drbalek
8b7427bf6b Update visual tests 2018-11-29 17:57:35 +00:00
Jiri Drbalek
378b19b53d Vector patterns with Cairo 2018-11-29 17:45:51 +00:00
talaj
38fa2a9792
Merge pull request #4005 from mapycz/v3.0.x-fix-pattern-alignment
v3.0.x: True global pattern alignment, fixed local alignment
2018-11-06 18:05:30 +01:00
Jiri Drbalek
0213b0d8c7 Update visual tests 2018-10-27 20:32:26 +00:00
Jiri Drbalek
e472ad965e True global pattern alignment, fixed local alignment 2018-10-27 20:27:42 +00:00
Jiri Drbalek
73b8369178 render_pattern() needs its own rasterizer 2018-10-27 20:27:42 +00:00
talaj
0a7665a52d
Merge pull request #4004 from mapycz/v3.0.x-line-pattern-repeat
v3.0.x: Line pattern "repeat"
2018-10-27 21:46:55 +02:00
Jiri Drbalek
68cb0c2a03 Update tests 2018-10-23 19:54:26 +00:00
Jiri Drbalek
e49abfc90e Polygon pattern on line geometries for Grid backend 2018-10-23 19:48:34 +00:00
Jiri Drbalek
0709a251e0 Polygon pattern on line geometries for Cairo backend 2018-10-23 19:48:34 +00:00
Jiri Drbalek
33443575f4 Polygon pattern on line geometries for AGG backend 2018-10-23 19:48:34 +00:00
talaj
1a043342f2
Merge pull request #4001 from mapycz/v3.0.x-offset_clip
v3.0.x: Improve padding calculation
2018-10-23 21:47:03 +02:00
Jiri Drbalek
3f9970075d Update visual tests 2018-10-21 19:54:36 +00:00
Raul Marin
fd961048ea Improve padding calculation 2018-10-21 19:42:56 +00:00
Artem Pavlenko
dbcd1b5fef update CHANGELOG for mapnik v3.0.21 release [skip ci] 2018-10-08 10:12:20 +01:00
Artem Pavlenko
1dbb1d2c1e setting up for mapnik v3.0.21 release [skip ci] 2018-10-08 10:08:44 +01:00
Artem Pavlenko
6b15fa8e7d enable unsupported attributes handling + skip any elements inside <symbol> + add clipPath to unsupported elments. 2018-10-02 10:13:15 +01:00
Artem Pavlenko
3e7146911b remove unused variable 2018-10-02 09:43:07 +01:00
Mickey Rose
fd0ed46225 travis: switch to trusty, tweaks from master 2018-08-25 11:57:24 +02:00
Mickey Rose
5531dad9ea update changelog [skip ci] 2018-08-07 23:54:25 +02:00
lightmare
cdfba12f07
Merge pull request #3963 from mapycz/icu-namespace
v3.0.x: Qualify ICU types explicitly
2018-08-02 17:54:30 +02:00
Jiri Drbalek
a42ac13cd8 Force full qualification of ICU types
https://github.com/mapnik/mapnik/issues/3961
2018-08-02 08:49:37 +00:00
Raul Marin
c3ec239699 Qualify ICU types explicitly
ICU 61 has dropped the global `using namespace icu;`
http://site.icu-project.org/download/61#TOC-Migration-Issues
2018-08-02 08:48:58 +00:00
talaj
cabcc079ff
Merge pull request #3939 from mapycz/v3.0.x-fix-overviews
v3.0.x: GDAL: Fixes of overviews
2018-08-01 15:44:53 +02:00
lightmare
d832b3cf1e
Merge pull request #3940 from lightmare/fix-bbox-reprojection-v3.0.x
Backport Fix bbox reprojection to v3.0.x
2018-07-20 19:23:05 +02:00
Jiri Drbalek
2e87bf3586 Update test data 2018-07-17 10:34:18 +00:00
Mickey Rose
d4af8f177b Revert "allow visual test failures with g++"
This reverts commit 05936826b3.
2018-07-17 11:47:48 +02:00
Mickey Rose
b2f8c0816b proj_transform: fix bbox reprojection
- remove buggy calculate_bbox, use boost::geometry::envelope instead
- move helper envelope_points to anonymous namespace and make it always
  produce exactly the requested number of points, even if it's not
  evenly divisible by 4
2018-07-17 11:41:41 +02:00
Mickey Rose
6714207379 proj_transform test: use reference values from cs2cs tool 2018-07-17 11:38:44 +02:00
Jiri Drbalek
7cc52b12d5 Backport Python test of bbox reprojection
Originaly in Python from https://github.com/mapnik/mapnik/pull/2657
2018-07-17 11:38:44 +02:00
Jiri Drbalek
d3e34297c2 gdal: Refactoring 2018-07-17 08:37:33 +00:00
Jiri Drbalek
69f38549c5 gdal: Do not shrink query extent 2018-07-17 08:37:27 +00:00
Jiri Drbalek
a20c1fc1c4 gdal: Count in filter_factor 2018-07-17 08:37:19 +00:00
Jiri Drbalek
5ab034a35b gdal: Fix finding closest overview 2018-07-17 08:37:10 +00:00
lightmare
142b0ad463
Merge pull request #3927 from lightmare/test-ds-attr-types-3.0
Also check types of values in datasource tests
2018-07-02 14:06:31 +02:00
Mickey Rose
de14f92019 datasource tests: typos 2018-07-02 11:48:35 +02:00
Mickey Rose
482cd02585 datasource tests: fix failing csv test
- it was indeed the test that was wrong; the coordinates in nypd.csv are
  specified with a decimal point, thus should be `value_double`
2018-07-02 11:48:35 +02:00
Mickey Rose
93c379820e datasource tests: use macro REQUIRE_ATTRIBUTES instead of function
- failing checks report location inside the function, not where it's
  called from; using macro reports proper location
2018-07-02 11:48:35 +02:00
Mickey Rose
fa0d4c923f datasource tests: also check value types in REQUIRE_ATTRIBUTES 2018-07-02 11:48:33 +02:00
Artem Pavlenko
bf1c55b627 update CHANGELOG for mapnik v3.0.20 release [skip ci] 2018-04-12 11:25:09 +02:00
Artem Pavlenko
f02c7bcdbf git commit -a -m "setting up for mapnik v3.0.20 release [skip ci]" 2018-04-12 11:19:12 +02:00
Artem Pavlenko
d1f041dad0
Merge pull request #3882 from mapycz/fix-grid-placement-nested-template
v3.0.x: fix compiler warning
2018-04-11 10:29:18 +02:00
Artem Pavlenko
8e933607a7 follow up on 5b8b75e680 2018-04-11 08:36:43 +00:00
Artem Pavlenko
4510c77d55 fix compiler warning
```include/mapnik/text/symbolizer_helpers.hpp:164:45: warning: template template parameter using 'typename' is a C++17 extension
      [-Wc++17-extensions]
    template <template <typename, typename> typename GridAdapter>
                                            ^~~~~~~~
                                            class
```
2018-04-11 08:32:22 +00:00
Blake Thompson
d4f95642ca
Merge pull request #3872 from mapnik/gdal_overview_fix_v3.0.x
GDAL Driver Overview Fix and Memory Reduction
2018-03-30 15:44:07 -05:00
Blake Thompson
ba950893af
Merge pull request #3879 from mapnik/raster-colorizer-image-size-v3.0.x
Raster colorizer: check image bounds
2018-03-30 14:54:37 -05:00
Jiri Drbalek
a93dd6b17d Raster colorizer: check image bounds 2018-03-30 14:48:21 -05:00
Blake Thompson
e128d75366 Make max_image_area a datasource parameter for GDAL. 2018-03-30 14:47:34 -05:00
Blake Thompson
9bcd733def Update test data and data-visual to main line 2018-03-20 15:04:30 -04:00
Blake Thompson
361f40f486 A fix for two distinct issues associated with gdal featuresets, the first is overviews were not properly being utilized based on the resolution of the final image requested. The second is that allocation of far too much memory could be possible in GDAL to attempt to do resampling internally in mapnik. This now has a hard cap so that we allocate less memory in these situations but are still able to resample internally in mapnik. 2018-03-20 13:18:46 -04:00
Artem Pavlenko
a08ba860da update CHANGELOG for mapnik v3.0.19 release [skip ci] 2018-03-06 09:48:28 +01:00
Artem Pavlenko
d50562d547 setting up for mapnik v3.0.19 release [skip ci] 2018-03-06 09:47:25 +01:00
Artem Pavlenko
d635b9f436 update CHANGELOG 2018-03-05 11:46:26 +01:00
Artem Pavlenko
96435b2a3a update version to 3.0.19 2018-03-05 11:46:07 +01:00
Raul Marin
2cef98d7f7 ICU DATA: Default to icu-config if u_getDataDirectory fails 2018-02-26 16:25:20 +01:00
Artem Pavlenko
98d39ff398
Merge pull request #3824 from albertov/v3.0.x
Backport "Export all text_placements_ classes from mapnik.dll"
2018-02-26 12:17:11 +01:00
Raul Marin
44f1ae3a6e PROJ_LIB: Fix detection code
.sconf_temp/conftest_24.cpp:30:42: error: use of undeclared identifier 'strlen'
2018-02-20 09:22:44 -08:00
Artem Pavlenko
baf5cdbd71
Merge pull request #3858 from mapycz/port-grid-placement-v3.0.x
Grid placement for v3.0.x
2018-02-15 10:08:22 +01:00
Jiri Drbalek
f91d37d93d Update visual tests 2018-02-14 12:13:17 +00:00
Jiri Drbalek
2f2dcf1eea grid_vertex_converter: Fix handling of empty polygon 2018-02-14 11:58:21 +00:00
Jiri Drbalek
a602c65354 AGG: Fix invalid memory access if input buffer size is zero 2018-02-14 11:58:21 +00:00
Jiri Drbalek
098fd27291 Add grid placement for text and shield symbolizer 2018-02-12 17:07:35 +00:00
Artem Pavlenko
1bb070c842
Merge pull request #3846 from mapycz/interior-scale-invariant-v3.0.x
v3.0.x: Interior, polylabel: Scale precision by polygon size
2018-02-06 13:20:51 +01:00
Jiri Drbalek
75381d217f Update visual tests 2018-02-06 11:52:53 +00:00
Jiri Drbalek
95a4bff127 interior, polylabel: Scale precision by polygon size 2018-02-06 09:54:47 +00:00
Artem Pavlenko
110b7b8185 update CHANGELOG for mapnik v3.0.18 release [skip ci] 2018-01-26 14:59:46 +01:00
Artem Pavlenko
44ef46c810 update CHANGELOG for mapnik v3.0.18 release [skip ci] 2018-01-26 09:55:33 +01:00
Artem Pavlenko
a30f8ed20c Backport #3838 to v3.0.x branch (fixes #3842) 2018-01-25 16:01:39 +01:00
Artem Pavlenko
0259ad8041 Merge remote-tracking branch 'origin/v3.0.x' into v3.0.x 2018-01-24 17:24:19 +01:00
Artem Pavlenko
3c2d65779e
Merge pull request #3840 from mapycz/port-new-interior
New interior for v3.0.x
2018-01-24 17:21:00 +01:00
talaj
cfd9668fdb visual tests: report failed tests (#3765) 2018-01-24 15:39:13 +00:00
talaj
f8c6ad1e29 visual tests: allow to ignore particular renderer (#3768)
* visual tests: refactor parsing parameters from the style

* visual tests: allow to ignore particular renderer

* update visual tests
2018-01-24 15:19:39 +00:00
Jiri Drbalek
2e478ddd37 Update visual tests 2018-01-24 13:54:46 +00:00
Jiri Drbalek
72989d440b Interior: cover the case of empty polygon or exterior ring 2018-01-24 13:54:46 +00:00
Jiri Drbalek
fe3c2762c0 Fix crash in case of empty ring 2018-01-24 13:54:46 +00:00
Jiri Drbalek
64b874ecb1 New interior algorithm 2018-01-24 13:54:46 +00:00
Ben Harper
7ce142a5aa Export all text_placements_ classes from mapnik.dll
Previously, only text_placements_dummy had a MAPNIK_DECL annotation.
This commit adds that annotation to text_placements_simple and
text_placements_list, so that they are also exposed from the Windows DLL
build.
2018-01-06 22:48:16 +01:00
Artem Pavlenko
11a164803d update CHANGELOG 2017-12-13 15:12:21 +01:00
Artem Pavlenko
497b516feb bump up version 2017-12-13 11:57:15 +01:00
Artem Pavlenko
5227f84e07 Don't apply preserveAscpectRatio logic logic if width and height expressed as % values (#3812) 2017-12-06 11:00:06 +01:00
Artem Pavlenko
2f28d9897f update CHANGELOG for mapnik v3.0.17 release [skip ci] 2017-11-29 14:34:40 +01:00
Artem Pavlenko
ebdd96c618 Update CHANGELOG 2017-11-29 10:14:49 +01:00
Artem Pavlenko
237d3b0714
Merge pull request #3806 from mapnik/3.0.x-fix-glibcxx
3.0.x fix glibcxx symbols
2017-11-28 16:18:41 +01:00
Artem Pavlenko
0b480e0dca add missing header + update visual tests 2017-11-28 14:56:18 +01:00
Artem Pavlenko
6a6891252c Revert "check if FT_PIXEL_MODE_BGRA is defined (freetype < 2.5.0) (#3797)"
This reverts commit 6eafffaf57.
Revert "fix memory leak (#3775)"
This reverts commit 995ab49f23.

(6eafffaf57 (commitcomment-25894906))
2017-11-28 14:18:23 +01:00
Artem Pavlenko
6eafffaf57 check if FT_PIXEL_MODE_BGRA is defined (freetype < 2.5.0) (#3797) 2017-11-28 11:23:13 +01:00
Dane Springmeyer
5d44eab802 update mason version to make available latest boost 1.65.1 packages 2017-11-27 10:14:37 -08:00
Dane Springmeyer
a559c01d4a use latest mason package for boost (which is built against libstdc++-4.8-dev) to avoid GLIBCXX 3.4.21 symbols 2017-11-27 09:37:55 -08:00
Dane Springmeyer
da86e99577 use lowercase boolean to match check in scripts/check_glibcxx.sh 2017-11-27 09:37:15 -08:00
Artem Pavlenko
498142f700 bump up version to 3.0.17 2017-11-27 09:55:20 +01:00
Artem Pavlenko
c3704c968b Fix licence link (#3804) 2017-11-27 09:54:46 +01:00
Artem Pavlenko
b0f3f1aed7 port Scons3 support from master 2017-11-24 11:29:14 +01:00
Dane Springmeyer
f5ea42b11f at workaround for throw_out_of_range_fmt
remove inadvertent change

also dump glibcxx symbols on circle

add glibc_workaround.cpp if option is chosen

This reverts commit 751d9bff1672f6b8cbd2b5ebe2eb460223746806.

add script that asserts on expected symbols

check symbols for all modes, only error if symbols exist + ENABLE_GLIBC_WORKAROUND
2017-11-21 16:07:41 +01:00
Artem Pavlenko
51b177802f update CHANGELOG for mapnik v3.0.16 release [skip ci] 2017-11-16 15:41:24 +01:00
Artem Pavlenko
8d7b75ed6b update CHANGELOG in preparation to v3.0.16 release. 2017-11-14 14:49:01 +01:00
Artem Pavlenko
a408b0732e Don't collect invalid bounding boxes (ref #3709) 2017-11-07 14:32:33 +01:00
Artem Pavlenko
0a15a955a2 SVG parser - fix default gradient vector in linear gradient [0,0,1,0] + support units in offset attribute. 2017-11-06 12:38:33 +01:00
talaj
995ab49f23 fix memory leak (#3775) 2017-11-03 10:48:55 +01:00
talaj
5996fb07ec Fix centroid and interior algorithms (#3771)
* fix interior algorithm - closing segment handling

* fix centroid algorithm - closing segment handling

* update visual tests
2017-11-03 10:17:54 +01:00
Dane Springmeyer
9466965725 bump to v3.0.16 2017-09-10 11:24:21 -07:00
Dane Springmeyer
bd3bbd7d59 Merge pull request #3759 from mapnik/collect-dep-data-paths
Fix mapnik-config reporting of --proj-lib, --gdal-data, and --icu-data
2017-09-10 11:07:39 -07:00
Dane Springmeyer
f3c71785e4 adapt to spelling fix in svg tests 2017-09-10 10:21:39 -07:00
Dane Springmeyer
fa057a8d06 fix spelling in svg parser error 2017-09-10 08:59:27 -07:00
Dane Springmeyer
5a97602aa1 make the configure script actually bash 2017-09-10 08:40:46 -07:00
Dane Springmeyer
8631ae0e74 keep using dist:precise for now after travis default switched 2017-09-09 15:06:03 -07:00
Dane Springmeyer
58a864d133 Query ICU_DATA, PROJ_LIB, and GDAL_DATA
- ensure the paths are correct and on the system
 - make the results available in mapnik-config
2017-09-09 11:52:10 -07:00
artemp
f64c7573b1 Ensure svg number + units parser fails on cur != end condition (got missed via cherry-pick) 2017-08-08 13:12:11 +01:00
artemp
3597c585be svg-parser - unify error messages text + update unit test 2017-08-08 12:42:17 +01:00
artemp
8cdd61e846 add missing ' in error message. 2017-08-02 10:30:37 +01:00
artemp
a6230559f1 Enforce consistent error handling policy - always throw on fatal errors (both strict and non-strict). In strict mode throw on first parsing error. Remove return values from parse,parse_from_string and traverse_tree methods. Update unit tests. 2017-07-31 10:58:57 +01:00
artemp
7f4adc2d73 only include <unicode/unistr.h> if ICU >= 59 (attempting to fix current coverage build on travis). 2017-07-21 10:11:29 +02:00
artemp
d3ec91b29b Add support for U_ICU_VERSION_MAJOR_NUM >= 59 (#3729) 2017-07-19 16:09:22 +02:00
artemp
9447c185d4 Update CHANGELOG with missing #3688 [skip-ci] 2017-07-18 10:10:15 +02:00
Artem Pavlenko
f06147b454 Merge pull request #3721 from mapnik/tiff_alpha_rgba_fix
Use alpha in rgba of tiffs even if there is a no data value set.
2017-07-17 09:25:35 +02:00
Jiri Drbalek
2890add8e6 remove superfluous line 2017-07-17 09:06:58 +02:00
artemp
ed3e2454d5 disable handling unsupported attributes (leaving only well-known unsupported elements) to reduce verbosity. 2017-07-07 10:12:00 +02:00
Blake Thompson
3c0a387af7 Use alpha in rgba of tiffs even if there is a no data value set. Fixes #3714 2017-07-06 09:03:08 -05:00
artemp
249d6cc311 wkb_reader : pre-allocate number of polygons in multi_polygon and number of geometries in geometry_collection via vector.reserce(...) 2017-07-03 15:27:28 +02:00
artemp
1f5583b433 don't set depth on git submodule update 2017-06-27 11:58:31 +02:00
artemp
d09f49b377 port "strict" SVG parsing, support for <use> element and use of switch statements from https://github.com/mapnik/mapnik/tree/svg-strict-parsing 2017-06-27 11:41:26 +02:00
artemp
0ac9cc091a remove depth setting from git subodule update 2017-06-19 10:37:59 +02:00
artemp
15d18070aa update CHANGELOG for mapnik v3.0.15 release [skip ci] 2017-06-16 10:36:55 +02:00
artemp
6e6cf8433b update CHANGELOG.md 2017-06-15 12:08:43 +02:00
artemp
9b4df8ebc8 tiff_reader - use memory mapped files if MAPNIK_MEMORY_MAPPED_FILE is defined (ported from master) 2017-06-15 11:59:47 +02:00
artemp
36a23851f3 bump up version to 3.0.15 2017-06-15 11:06:41 +02:00
Blake Thompson
2f8485ba89 Merge pull request #3699 from mapnik/fix_filter_factor
Restore Filter Factor in Image Scaling
2017-06-13 08:21:33 -05:00
Blake Thompson
af95ca85e9 Updated tests 2017-06-13 07:47:23 -05:00
Blake Thompson
061b29f108 Restoring the way filter factors operate so that select algorithms still are passed variables in the form of filter factor to change their operation. Added this operation to raster plugin where it never existed prior. Additionally added a test that was created for #3698 proving that it is not currently an issue 2017-06-13 07:31:17 -05:00
artemp
08d8746b3a update visual-data 2017-06-13 13:24:11 +02:00
artemp
d2627dfad8 tiff_reader - fix num_rows logic in read_stripped method ref #3679 2017-06-12 17:56:33 +02:00
artemp
bc528e4c8f Update SHA 2017-06-06 17:44:26 +02:00
artemp
2b42e174fd Update after #3696 2017-06-06 17:42:15 +02:00
Artem Pavlenko
0c1863aa7e Merge pull request #3696 from mapnik/raster_limit
Fixes bug in raster plugin
2017-06-06 17:25:05 +02:00
Blake Thompson
a35a064ce4 Fixes bug in raster plugin 2017-06-06 10:11:53 -05:00
artemp
735eeb4702 CHANGELOG - update release date + SHA [skip ci] 2017-06-05 16:26:51 +02:00
artemp
7660b9e74a update CHANGELOG for mapnik v3.0.14 release [skip ci] 2017-06-05 10:34:54 +02:00
artemp
5b88f687a1 Scons - update to 2.5.1 2017-06-05 10:29:21 +02:00
artemp
c4fb727076 bump version to 3.0.14 2017-06-02 20:25:13 +02:00
artemp
75e7a44c90 Merge branch 'webp_tests' into v3.0.x 2017-06-02 20:15:51 +02:00
Blake Thompson
3fcd54123c Updated data-visual with tiff changes 2017-06-02 12:38:39 -05:00
artemp
d6bf258f3a Merge branch 'webp_tests' into v3.0.x 2017-06-02 18:32:08 +02:00
Blake Thompson
20fd003618 Added new tests for webp data 2017-06-01 15:38:00 -05:00
artemp
9940193c0b return error code when no feature can be read from shapefile + update unit test (ref #3198) 2017-06-01 15:45:14 +02:00
artemp
9f19fa8943 freetype_engine : revert back to original APIs usage.
This reverts commit 1c101c3243.
2017-06-01 12:35:14 +02:00
Artem Pavlenko
98fa7699f3 Merge pull request #3688 from mapnik/font-engine-singleton
make font-engine-singleton to have better control over objects life-t…
2017-06-01 11:31:18 +02:00
artemp
c09f6a8434 freetype_engine - re-use base class mutex. 2017-06-01 10:51:59 +02:00
artemp
d1327dea88 freetype_engine - preserve original intetface via static methods + make impl methods private. 2017-06-01 10:45:09 +02:00
Dane Springmeyer
e4b5ddb1aa add missing include / fix windows compile 2017-05-31 12:50:27 -07:00
Dane Springmeyer
ce47610677 update font path in test file 2017-05-31 10:41:34 -07:00
artemp
648f9698a0 use sigleton interface when calling freetype_engine methods. 2017-05-30 12:53:20 +02:00
artemp
a054ee0a31 c++ minor formatting. 2017-05-29 12:33:32 +02:00
artemp
4d6a1c5cfc font_engine_freetype - remove default constructor and virtual destructor (??). 2017-05-29 10:46:40 +02:00
artemp
3b6f3ff36f c++ formatting 2017-05-29 10:46:21 +02:00
artemp
1c101c3243 make font-engine-singleton to have better control over objects life-time. 2017-05-26 16:52:50 +02:00
Dane Springmeyer
e6173385ca use latest version of mason 2017-05-25 11:31:16 -07:00
artemp
09933916d6 fix spelling 2017-05-19 14:40:47 +02:00
artemp
185d788ea4 Backport TIFF I/O fixes from master (ref #3669 #3670) 2017-05-19 13:47:11 +02:00
artemp
99a7fa5044 Revert "update visual data one more time." : wrong branch
This reverts commit de533ab712.
2017-05-17 21:21:02 +02:00
artemp
de533ab712 update visual data one more time. 2017-05-17 21:17:11 +02:00
Blake Thompson
125cd694b8 Updated changelog 2017-05-12 12:16:25 -05:00
Blake Thompson
5911fe6374 Merge pull request #3668 from mapnik/raster_overzoom_quest
Raster Overzoom Quest
2017-05-12 11:48:34 -05:00
Blake Thompson
b29e56051c Merge branch 'v3.0.x' into raster_overzoom_quest 2017-05-12 10:59:32 -05:00
Blake Thompson
7222129e6c Update visual test data to 3.0.x branch 2017-05-12 10:55:48 -05:00
artemp
ab783cbec4 Merge branch 'raster_overzoom_quest' of https://github.com/mapnik/mapnik into raster_overzoom_quest 2017-05-12 15:25:44 +02:00
Blake Thompson
baf6c9f321 Updated tests, changed boostrap to use latest released mason 2017-05-11 09:57:18 -05:00
Blake Thompson
e945eb74fe Merge pull request #3672 from mapnik/filter_factor_removal
Removed filter factor
2017-05-10 16:02:17 -05:00
Blake Thompson
bc9dcdc584 Updated visual test data 2017-05-10 13:31:11 -05:00
Dane Springmeyer
2fd1f098f5 update to latest 3.0.x test-data-visual branch 2017-05-10 10:06:31 -07:00
Blake Thompson
318be793f9 Removed filter factor 2017-05-10 09:04:29 -05:00
Blake Thompson
adacb16a2c Removed 0.5 limit on width and height in gdal plugin, added new visual tests 2017-05-09 12:15:03 -05:00
artemp
85d7f28610 remove QMAKE_MAC_SDK requirement - just use what is available 2017-05-09 09:54:51 +02:00
Blake Thompson
170e20e864 First attempt at making raster overzooming and scaling work correctly and handle offsets properly. 2017-05-08 22:37:35 -05:00
Dane Springmeyer
b53db334af link -ldl last 2017-04-19 18:30:34 -07:00
Dane Springmeyer
1632018a14 pgsql2sqlite:also link -ldl on linux 2017-04-19 18:10:03 -07:00
artemp
9f4a138b8b fix formatting 2017-04-06 10:43:12 +01:00
artemp
149d2ca0a1 Avoid using c++14 extensions as v3.0.x should only require c++11 compliant compiler (fixes #3645). 2017-03-29 10:09:48 +01:00
Dane Springmeyer
635af3f4a3 point at 3.0.x branch of visual test data - refs mapnik/test-data-visual#46 2017-03-28 15:47:12 -07:00
Dane Springmeyer
9c4613f934 remove explicit instantiation of 'image_view<mapnik::image<mapnik::null_t> >' that occurs after an explicit specialization has no effect [-Winstantiation-after-specialization] (clang 4.x) 2017-03-28 15:25:17 -07:00
Dane Springmeyer
520f3fd0a0 improve check padding script to see deps via submodules 2017-03-28 15:18:48 -07:00
artemp
15fb2debb0 fix compilation - auto args in lambda is c++14 oops 2017-03-23 16:21:38 +00:00
artemp
fa549b380a GeoJSON IO test - ensure geometries round-trip. 2017-03-23 15:01:50 +00:00
artemp
60d891f094 add "invalid" empty geometry tests 2017-03-22 15:07:07 +00:00
artemp
7caa0cffd4 from_geojson - catch all exceptions. 2017-03-22 15:06:34 +00:00
artemp
dbbf18c752 GeoJSON test - add empty geometries tests. 2017-03-22 14:41:08 +00:00
artemp
a1084e0c09 port GeoJSON parser/generator logic from master 2017-03-22 14:40:07 +00:00
Dane Springmeyer
c2fd522d0f remove mason latest publishing and triggered builds - refs #3639 2017-03-19 17:57:10 -07:00
Dane Springmeyer
dfccc5f6bb Merge pull request #3640 from mapnik/build-fixes
v3.0.x build fixes
2017-03-19 13:07:42 -07:00
Dane Springmeyer
284842a9d3 Merge pull request #3641 from mapnik/v3.0.x-more-dep-updates
Update mason deps
2017-03-19 12:39:30 -07:00
Dane Springmeyer
40753edadc Merge branch 'v3.0.x-more-dep-updates' into build-fixes 2017-03-19 12:38:57 -07:00
Dane Springmeyer
e0db6b9a47 consistently use pkg-config in both postgis plugin and pgsql2sqlite + use GDAL_CONFIG var in plugins 2017-03-18 19:40:18 -07:00
Dane Springmeyer
91515cad69 update sqlite, icu, ccache, and libpq 2017-03-18 19:39:09 -07:00
Dane Springmeyer
0c232313d6 update visual test down now that mapnik/test-data-visual#44 is merged 2017-03-10 16:51:46 -08:00
Dane Springmeyer
8665fc7313 Merge pull request #3614 from mapnik/3.0.x-mason-upgrades
3.0.x mason upgrades
2017-03-10 14:58:14 -08:00
Dane Springmeyer
08822729cc use zlib 1.2.8 package 2017-03-09 17:26:17 -08:00
Dane Springmeyer
f8e5f146ec update mason version 2017-03-09 17:20:31 -08:00
Dane Springmeyer
07de7155f1 upgrade to latest harfbuzz 2017-03-09 17:10:34 -08:00
Mickey Rose
3fbe7f61a6 load_map: avoid segfault when ShieldSymbolizer has invalid placements 2017-02-22 03:21:48 +01:00
Dane Springmeyer
3706fcf587 use mason v0.7.0 2017-02-09 18:00:01 -08:00
Dane Springmeyer
947ac81ee4 point at mason master until mason is tagged 2017-02-08 19:24:33 -08:00
Dane Springmeyer
163af7a40f update test-data - refs mapnik/test-data-visual#44 2017-02-08 17:31:46 -08:00
Dane Springmeyer
55e3e14f4d more code coverage adjustments 2017-02-08 15:05:48 -08:00
Dane Springmeyer
7483f6328c Add codecov.yml ignores 2017-02-08 15:02:47 -08:00
Dane Springmeyer
941a7eaf69 try codecov 2017-02-08 15:02:16 -08:00
artemp
489b7f2aca fix typo 2017-02-08 14:04:59 -08:00
artemp
4c22e631a7 remove remaining usage of deprecated dymamic exceptions: dtors are implicitely noexcept + qualify what methods with noexcept 2017-02-08 13:47:02 -08:00
artemp
2845cdc121 remove bogus throw() specifier from 'add_attribute' 2017-02-08 13:46:51 -08:00
artemp
0cd3bd8737 dynamic exceptions deprecated in c++11 and removed in c++17 (http://en.cppreference.com/w/cpp/language/except_spec) 2017-02-08 13:46:40 -08:00
Dane Springmeyer
85da8ef128 port fix for std::fread from master - a220bda05d 2017-02-08 13:33:41 -08:00
Dane Springmeyer
7affd674fd remove unused var [skip ci] 2017-02-08 13:31:13 -08:00
Dane Springmeyer
1f2de83531 also upgrade libpq 2017-02-08 13:04:35 -08:00
Dane Springmeyer
887964ae97 upgrade mason deps 2017-02-08 10:57:27 -08:00
artemp
c1267ebcd5 update CHANGELOG for mapnik v3.0.13 release [skip ci] 2017-02-08 14:06:42 +01:00
Dane Springmeyer
2a153c0d1f fix linking of postgis to boost_regex (when boost regex is statically linked to icu libs) 2017-02-07 12:54:12 -08:00
artemp
4f3e6f4846 update CHANGELOG 2017-02-06 16:00:00 +01:00
Artem Pavlenko
391a9f835b Merge pull request #3612 from mapnik/v3.0.x-3611
V3.0.x ref #3611
2017-02-06 14:26:01 +01:00
artemp
74e66bac58 test - update malformed featurecollection test (ref #3611) 2017-02-03 17:36:28 +01:00
artemp
d2d62bc95c Return failure on invalid bounding box when --validate-features option is used. (ref #3611) 2017-02-03 17:23:48 +01:00
artemp
8cc7060ef1 remove bounding box validity check (ref #3611) 2017-02-03 17:20:25 +01:00
Artem Pavlenko
e35bca7381 Merge pull request #3610 from mapnik/v3.0.x-3609
GeoJSON - backport positions grammar changes from master, fixes #3609
2017-02-03 11:28:22 +01:00
artemp
6cb3bce2d7 GeoJSON - backport positions grammar changes from master, fixes #3609 2017-02-03 11:22:24 +01:00
lightmare
17dcffaf78 Merge pull request #3583 from mapnik/v3.0.x-cherry-pr3566
v3.0.x cherry-pick #3566
2017-02-02 15:32:29 +01:00
Dane Springmeyer
1a268343a9 fix clang++ package name 2017-02-01 21:57:34 -08:00
Dane Springmeyer
7578534dc8 pass std::string to std::out_of_range 2017-02-01 21:54:27 -08:00
Dane Springmeyer
adcf611fab upgrad clang++ on circle too 2017-01-31 16:34:50 -08:00
Dane Springmeyer
8f06db6ac0 ensure mason check works via tag 2017-01-31 16:32:50 -08:00
Dane Springmeyer
401aade813 use clang++ 3.9.1 / pin mason to v0.5.0 2017-01-31 16:18:55 -08:00
artemp
ab206321b5 update version to 3.0.13 2017-01-20 14:40:35 +01:00
artemp
5db03aeb03 update test-data 2017-01-19 11:14:20 +01:00
artemp
2db538c470 update in prep for v3.0.13 release 2017-01-18 14:27:49 +01:00
artemp
8a3a380b3b fix blank line test for require headers.size() == 1 + reduce stderr verbosity. 2017-01-18 10:16:44 +01:00
artemp
ff4a1c1e9b use variant v1.1.5 2017-01-18 10:09:52 +01:00
Dane Springmeyer
7ce68e2c08 fix variant_io include 2017-01-04 15:22:36 -08:00
Dane Springmeyer
5b1c5f83cb Avoid -Winstantiation-after-specialization warnings 2017-01-04 15:08:08 -08:00
Dane Springmeyer
5d28a25ad3 Point as latest mason rather than branch 2017-01-04 11:45:55 -08:00
Artem Pavlenko
c71c1bc0a8 Merge pull request #3586 from lightmare/v3.0.x-groupsym-thunk-list
backport render_thunk_list change #3585 to v3.0.x branch
2017-01-04 10:30:05 +01:00
Mickey Rose
63128fdba1 can't store noncopyable list in std::vector
std::list can have a throwing move constructor.
std::vector of such lists makes copies when growing its storage array,
it doesn't move them.
render_thunk_list is noncopyable (because render_thunk is noncopyable),
and so can't be stored in std::vector in some STL implementations.
2017-01-03 22:53:39 +01:00
Mickey Rose
0a5495e442 change render_thunk_list to std::list<render_thunk>
Wrapping render_thunk in std::unique_ptr is one extra allocation per
element, with no purpose. The somewhat costly xyz_render_thunk move
constructor is only called once upon insertion, regardless of whether
we're emplacing render_thunk or unique_ptr.
2017-01-03 22:53:39 +01:00
Jiri Drbalek
b5c04cc132 find max element instead of std::sort 2017-01-02 03:53:53 +01:00
Jiri Drbalek
cdefee3524 remove redundant code 2017-01-02 03:53:53 +01:00
Dane Springmeyer
47443526a0 Merge pull request #3580 from mapnik/v3.0.x-cherry
Cherry pick stable commits from master into v3.0.x branch
2016-12-21 11:44:34 -08:00
Dane Springmeyer
a3b4e1f575 remove duplicate sudo:false from travis 2016-12-15 13:33:29 -08:00
Dane Springmeyer
283481b347 backport warnings fix from master for enumeration 2016-12-15 11:33:23 -08:00
Mickey Rose
fdd542a3c4 make mapnik_value_type_t C++11-friendly 2016-12-15 12:13:42 +01:00
Mickey Rose
06201e3842 bring C++14 type traits aliases for C++11 support 2016-12-15 12:12:12 +01:00
Dane Springmeyer
96ce2d8b3b update to latest variant 2016-12-14 18:25:41 -08:00
Mickey Rose
f00470dc02 simplify mapnik::value conversion rules
- fixes #3570

- avoids recursive exception-specification on value constructor
  by only constructing a temporary for arithmetic types (everything
  else passes a reference to the base variant constructor)

- also removes `is_same<decay_t<T>, value>` SFINAE check -- because
  we're only passing a reference down, explicitly forcing the compiler
  to use the implicitly-defined copy/move instead is pointless
2016-12-14 18:24:32 -08:00
artemp
dd5c134f01 update test to use std::unordered_map<mapnik::value, mapnik::value> 2016-12-14 18:24:29 -08:00
artemp
7c41b835ca use latest mapbox::variant 2016-12-14 18:24:26 -08:00
artemp
641cd6555e expand std::hash<mapnik::value> and operator== test for all types in mapnik::value 2016-12-14 18:24:22 -08:00
artemp
fa2d63c601 remove hash_combine (unused) 2016-12-14 18:24:19 -08:00
artemp
204d30e58d simplify hash calculation (we don't need combine with which(), using hash<T> is sufficient) 2016-12-14 18:24:15 -08:00
artemp
8dee1a9088 use mapbox namespace to fix name resolution 2016-12-14 18:23:02 -08:00
Mickey Rose
2b3fdf1bc9 fix #3526 GroupSymbolizer PairLayout with 3+ items 2016-12-14 18:21:52 -08:00
Jiri Drbalek
701a459427 duplicate code elimination 2016-12-14 18:21:30 -08:00
Dane Springmeyer
335c3e4265 allow visual test failures with g++ https://github.com/mapnik/mapnik/issues/3567 2016-12-14 18:21:18 -08:00
Dane Springmeyer
4cd55330dd avoid -Wshadow and 'unrecognized command line option' with gcc 2016-12-14 18:21:03 -08:00
Dane Springmeyer
b2f7bea7b5 try g++6 on precise 2016-12-14 18:20:52 -08:00
Dane Springmeyer
d5a9322a11 use clang 3.9, g++-6 2016-12-14 18:20:43 -08:00
Dane Springmeyer
d378ddbf66 mason packages are currently built with -D_GLIBCXX_USE_CXX11_ABI=0 2016-12-14 18:20:10 -08:00
Jiri Drbalek
27a0f3562d remove methods that are not referenced anywhere 2016-12-14 18:19:54 -08:00
artemp
4d4ea3a576 Fix clang >= 3.9.0 compilation by using mapbox::util::variant as alias (via deps/mapbox/variant => "types" branch) 2016-12-14 18:18:50 -08:00
898 changed files with 11779 additions and 7874 deletions

2
.gitmodules vendored
View file

@ -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

View file

@ -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

View file

@ -6,6 +6,180 @@ 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.1.0
Released: January 8, 2021
(Packaged from 445438e34)
* Require c++14 compliant complier (Boost.Geometry `BOOST_VERSION >= 1_75`)
## 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

View file

@ -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.

View file

@ -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++14 -DU_USING_ICU_NAMESPACE=0"
DEFAULT_CXX11_LINKFLAGS = "" DEFAULT_CXX11_LINKFLAGS = ""
if sys.platform == 'darwin': if sys.platform == 'darwin':
# homebrew default # homebrew default
@ -61,7 +62,7 @@ SCONS_CONFIGURE_CACHE = 'config.cache'
SCONF_TEMP_DIR = '.sconf_temp' SCONF_TEMP_DIR = '.sconf_temp'
# auto-search directories for boost libs/headers # auto-search directories for boost libs/headers
BOOST_SEARCH_PREFIXES = ['/usr/local','/opt/local','/sw','/usr',] BOOST_SEARCH_PREFIXES = ['/usr/local','/opt/local','/sw','/usr',]
BOOST_MIN_VERSION = '1.47' BOOST_MIN_VERSION = '1.61'
#CAIRO_MIN_VERSION = '1.8.0' #CAIRO_MIN_VERSION = '1.8.0'
HARFBUZZ_MIN_VERSION = (0, 9, 34) HARFBUZZ_MIN_VERSION = (0, 9, 34)
@ -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']:
@ -1037,12 +1168,12 @@ int main()
return True return True
return False return False
def supports_cxx11(context,silent=False): def supports_cxx14(context,silent=False):
ret = context.TryRun(""" ret = context.TryRun("""
int main() int main()
{ {
#if __cplusplus >= 201103 #if __cplusplus >= 201402L
return 0; return 0;
#else #else
return -1; return -1;
@ -1051,7 +1182,7 @@ int main()
""", '.cpp') """, '.cpp')
if not silent: if not silent:
context.Message('Checking if compiler (%s) supports -std=c++11 flag... ' % context.env.get('CXX','CXX')) context.Message('Checking if compiler (%s) supports -std=c++14 flag... ' % context.env.get('CXX','CXX'))
if silent: if silent:
context.did_show_result=1 context.did_show_result=1
context.Result(ret[0]) context.Result(ret[0])
@ -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,
@ -1080,7 +1214,7 @@ conf_tests = { 'prioritize_paths' : prioritize_paths,
'harfbuzz_with_freetype_support': harfbuzz_with_freetype_support, 'harfbuzz_with_freetype_support': harfbuzz_with_freetype_support,
'boost_regex_has_icu' : boost_regex_has_icu, 'boost_regex_has_icu' : boost_regex_has_icu,
'sqlite_has_rtree' : sqlite_has_rtree, 'sqlite_has_rtree' : sqlite_has_rtree,
'supports_cxx11' : supports_cxx11, 'supports_cxx14' : supports_cxx14,
'CheckBoostScopedEnum' : CheckBoostScopedEnum, 'CheckBoostScopedEnum' : CheckBoostScopedEnum,
} }
@ -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,15 +1498,15 @@ 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']:
conf.prioritize_paths(silent=True) conf.prioritize_paths(silent=True)
# test for C++11 support, which is required # test for C++14 support, which is required
if not env['HOST'] and not conf.supports_cxx11(): if not env['HOST'] and not conf.supports_cxx14():
color_print(1,"C++ compiler does not support C++11 standard (-std=c++11), which is required. Please upgrade your compiler") color_print(1,"C++ compiler does not support C++14 standard (-std=c++14), which is required. Please upgrade your compiler")
Exit(1) Exit(1)
if not env['HOST']: if not env['HOST']:
@ -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:

View file

@ -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">

View file

@ -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

View file

@ -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

View file

@ -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
View file

@ -0,0 +1,10 @@
ignore:
- "mason_packages"
- "benchmark"
- "deps"
- ".sconf_temp"
- "scons"
- "test"
- "demo"
- "docs"
- "fonts"

15
configure vendored
View file

@ -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 "$@"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

@ -1 +1 @@
Subproject commit 9a115c5eb3c09509c70a57b25b283b6e1cbba919 Subproject commit d2588a8f1d6b5d480d228e6d8a906ce634bdea9a

View 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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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 "));
} }
} }

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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

View 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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View 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

View file

@ -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();
} }

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 > ')'
; ;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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_);

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,122 @@
/*****************************************************************************
*
* 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>
#include <cstdint>
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

View 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

View 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