Compare commits

...

344 commits

Author SHA1 Message Date
Hermann Kraus
5d291dae7d Proper bounds checking for line break positions.
Closes #2037.
2013-10-12 02:34:07 +02:00
Hermann Kraus
a2ca02c751 Add documentation and remove naming inconsistencies. 2013-10-12 02:17:07 +02:00
Hermann Kraus
061397dce3 Add test case for bug #2037. 2013-10-11 22:24:08 +02:00
Hermann Kraus
6a7e0ec072 Full document interface of text_layout and text_line. 2013-10-11 22:22:37 +02:00
Hermann Kraus
2973e7a664 Fix filter rules. 2013-10-09 23:22:55 +02:00
Hermann Kraus
2347f5986c Change parameters to match values from old dataset. 2013-10-09 23:19:50 +02:00
Hermann Kraus
f5aa14c523 Replace outdated reference images. 2013-10-09 22:51:49 +02:00
Hermann Kraus
22aeeaae8b Fix a few test failures. 2013-10-09 22:01:15 +02:00
Dane Springmeyer
425863cc82 fix compile error 2013-10-05 18:02:40 -07:00
Dane Springmeyer
fb8080e97d also link harfbuzz-icu library - closes #1953 2013-07-18 21:23:44 +00:00
Dane Springmeyer
065ca19412 whitespace 2013-07-13 18:34:15 -04:00
Dane Springmeyer
83dc29f1a5 osm -> csv 2013-07-13 18:34:04 -04:00
Dane Springmeyer
b47d874269 more osm->csv conversion 2013-07-12 20:21:06 -04:00
Dane Springmeyer
af8d47f7ae update new (in harfbuzz branch) visual tests to csv plugin where possible 2013-07-12 20:18:25 -04:00
Dane Springmeyer
0322fd07c4 merge visual test data changes in from master 2013-07-12 20:09:28 -04:00
Dane Springmeyer
c4649f86d3 merge visual test style changes in from master 2013-07-12 20:09:10 -04:00
Dane Springmeyer
a75f392bca Add missing files from merge with master 2013-07-12 19:53:14 -04:00
Dane Springmeyer
db76e9ed39 update remainder of code based (except visual tests) from master 2013-07-12 19:47:27 -04:00
Dane Springmeyer
2e134f6617 update src and include dirs from master 2013-07-12 19:47:09 -04:00
Dane Springmeyer
11387082a3 update python tests from master 2013-07-12 19:45:51 -04:00
Dane Springmeyer
b45d3f984d update cpp_tests from master 2013-07-12 19:44:36 -04:00
Dane Springmeyer
b7a9d29dbc fix compile 2013-07-11 17:10:22 -04:00
Hermann Kraus
fa7f6351fa Merge branch 'harfbuzz' into hb-halign 2013-06-24 23:12:26 +02:00
Hermann Kraus
c236adcbe5 Enable horizontal-alignment for line placements. 2013-06-24 23:05:58 +02:00
Hermann Kraus
21cbc68f68 Clean up initialization. 2013-06-24 23:05:17 +02:00
Hermann Kraus
82dfcdcda6 Add tests for bengali text.
Closes #1714.
2013-06-17 14:00:37 +02:00
Hermann Kraus
2320632f87 Implement horizontal-alignment for line placements. 2013-04-29 01:43:14 +02:00
Hermann Kraus
54c7e64bc9 label-position-tolerance should be a floating point number. 2013-04-29 01:12:18 +02:00
Hermann Kraus
e3db6a49ff Add tests for malayalam and for bug #1820.
Refs #1820.
2013-04-24 01:21:06 +02:00
Hermann Kraus
fcb747658b Remove old file. 2013-04-17 10:51:45 +02:00
Hermann Kraus
abad0da7ae Add tests for 6a075c6.
Refs #1807.
2013-04-14 15:58:39 +02:00
Hermann Kraus
6a075c6cb2 Enable color processing in ExpressionFormat.
Refs #1807.
2013-04-14 15:43:05 +02:00
Hermann Kraus
b42cf19354 Add more tests for upright="XXX_only".
Refs #1533.
2013-04-14 15:11:28 +02:00
Hermann Kraus
55ce673a8c Restructure shaping code in preparation for optimizations. 2013-04-02 07:02:01 +02:00
Hermann Kraus
57a6111e39 Update grid reference images. 2013-04-02 05:09:55 +02:00
Hermann Kraus
47e02ada84 Fix text rendering in grid renderer. 2013-04-02 05:01:07 +02:00
Hermann Kraus
1196a08e97 Update reference images for scale_factor 2.0.
Remove broken images for test "simple.xml" rendered with cairo.
2013-04-02 02:35:28 +02:00
Hermann Kraus
bf90c0badc Add missing reference images. 2013-04-02 02:17:10 +02:00
Hermann Kraus
654f0d18a1 Font directory. 2013-04-02 02:11:14 +02:00
Hermann Kraus
7cb89076b3 Force strict mode for loading test maps. 2013-04-02 02:10:23 +02:00
Hermann Kraus
2ee899100a Show missing glyphs by rendering boxes instead of dropping the whole text. 2013-04-02 02:06:53 +02:00
Hermann Kraus
7754f37772 Implement upright=right_only/left_only.
Closes #1533.
2013-04-01 22:30:19 +02:00
Hermann Kraus
e4ad657991 Fix critial bug in text itemizer.
Itemizations is invalid after changing text, therefore lists have to be cleared.
2013-04-01 21:47:48 +02:00
Hermann Kraus
74d72b9191 Fix glyph widths after line breaking.
Fixes #1532.
2013-04-01 02:21:05 +02:00
Hermann Kraus
8ba49accf0 Add benchmark mode. 2013-04-01 00:44:14 +02:00
Hermann Kraus
cf45f16d1c Select tests by group. 2013-03-30 18:40:11 +01:00
Hermann Kraus
cc122d3768 Include missing header. 2013-03-30 16:10:52 +01:00
Hermann Kraus
779adfdf4b Add copyright notices. 2013-03-30 16:03:54 +01:00
Hermann Kraus
089ca7d91d Cache offseted lines. Reduces render times by 50% in certain tests. 2013-03-30 16:03:48 +01:00
Hermann Kraus
4ae81b568c Simplify logic in vertex_cache. 2013-03-30 13:02:37 +01:00
Hermann Kraus
c5a7a5f999 Add benchmark target to tests. 2013-03-30 12:46:35 +01:00
Hermann Kraus
d7553fb93c Move vertex_cache functions from .hpp to .cpp. 2013-03-30 12:45:46 +01:00
Hermann Kraus
e544dca6c1 Disable renderers and select scale factor from command line 2013-03-30 03:15:26 +01:00
Hermann Kraus
27c593ac84 Implement proper argument parsing. 2013-03-30 03:01:24 +01:00
Hermann Kraus
e6d976194f Continue modularizing test script. 2013-03-29 18:32:56 +01:00
Hermann Kraus
fbec285fc1 Split error reporting into new file. 2013-03-29 16:47:23 +01:00
Hermann Kraus
5e83526a98 Add fonts required to render tests. 2013-03-29 16:44:34 +01:00
Hermann Kraus
cfb0e167ad Updated cairo reference images. 2013-03-29 12:48:40 +01:00
Hermann Kraus
7205d04026 Fix wrong position calculation after c84d83a685 changed the reference point. 2013-03-29 02:54:35 +01:00
Hermann Kraus
00834a7eaa Merge branch 'master' into harfbuzz 2013-03-29 02:32:55 +01:00
Hermann Kraus
4cac842b80 Replace reference images after fix in e53d1d4. 2013-03-29 01:54:55 +01:00
Hermann Kraus
e53d1d4717 Fix copying of text_symbolizer_properties in one place.
Needs a more general solution.
Refs #1780.
2013-03-29 01:52:16 +01:00
Hermann Kraus
e2b5dc5247 Load style files only once. 2013-03-28 12:41:15 +01:00
Hermann Kraus
b4e10cfb77 Merge branch 'master' into harfbuzz 2013-03-28 12:22:31 +01:00
Hermann Kraus
50e420f4e3 Show render times for each test. 2013-03-27 23:24:48 +01:00
Hermann Kraus
1fff0d53da Improved error messages. 2013-03-27 23:13:37 +01:00
Hermann Kraus
b65000ee40 Add option to disable generating new reference images. 2013-03-26 01:08:45 +01:00
Hermann Kraus
d185e17f71 Handle glyph offsets in cairo renderer. 2013-03-26 01:01:44 +01:00
Hermann Kraus
176483256f Pylint. 2013-03-25 23:21:40 +01:00
Hermann Kraus
fbc025ea70 Update text related reference images. 2013-03-25 16:40:41 +01:00
Hermann Kraus
bd940bdc2e Always return a positive number of different pixels. 2013-03-25 12:36:35 +01:00
Hermann Kraus
cb7b9e6a66 Merge branch 'master' into harfbuzz
Conflicts:
	tests/visual_tests/test.py
2013-03-25 04:20:45 +01:00
Hermann Kraus
ab6156a087 Add new test and change handling of scale_factor in tests. 2013-03-25 02:25:05 +01:00
Hermann Kraus
2a6b243ae6 Show bounding boxes for collision test. 2013-03-25 02:24:29 +01:00
Hermann Kraus
29009b14bb Fix shield displacement for scale_factor != 1.
All visual AGG test pass.
2013-03-25 02:11:24 +01:00
Hermann Kraus
f3cf17728b Fix PointSymbolizer collision bounding boxes. 2013-03-24 15:57:54 +01:00
Hermann Kraus
e6b7525d34 Merge branch 'master' into harfbuzz 2013-03-24 15:51:03 +01:00
Hermann Kraus
722b84e53a Yet another character_spacing/scale_factor fix. 2013-03-24 15:37:06 +01:00
Hermann Kraus
c464db99db Merge branch 'master' into harfbuzz 2013-03-24 15:22:17 +01:00
Hermann Kraus
5f46e45fc9 boost::noncopyable -> mapnik::noncopyable 2013-03-24 15:10:09 +01:00
Hermann Kraus
1d5ebcb64e More scale_factor fixes. 2013-03-24 15:07:42 +01:00
Hermann Kraus
23b794c67c Implement char_spacing for line placements. 2013-03-24 12:36:57 +01:00
Hermann Kraus
0c4d123602 Fix char spacing for scale_factor != 1. 2013-03-24 12:01:51 +01:00
Hermann Kraus
51832de841 Apply scale factor to halo_radius. 2013-03-24 01:41:33 +01:00
Hermann Kraus
de837ba45d Fix text rendering for scale_factor!=1. 2013-03-24 01:26:42 +01:00
Hermann Kraus
3be7b55459 Fix position calculation for text in cairo renderer. 2013-03-24 01:01:37 +01:00
Hermann Kraus
e5e9b9ea23 Add const qualifier to pixel_position operator~. 2013-03-24 01:01:13 +01:00
Hermann Kraus
fafd229341 Fix test output when creating or overwriting files. 2013-03-24 00:35:44 +01:00
Hermann Kraus
895041897e Split tests into sections. 2013-03-24 00:19:34 +01:00
Hermann Kraus
f18f55991f Remove old reference images. 2013-03-23 23:48:41 +01:00
Hermann Kraus
d1a0fcb7a7 Fix build failures introduced by merges. 2013-03-23 23:48:10 +01:00
Hermann Kraus
5ce472cb4a Merge branch 'master' into harfbuzz 2013-03-23 15:37:36 +01:00
Hermann Kraus
7fae143b58 Merge commit 'c84d83a685ba0e201b055db5a7cee68afde05d64' into harfbuzz
Conflicts:
	src/cairo_renderer.cpp
2013-03-23 15:37:05 +01:00
Hermann Kraus
4beed29cf2 Merge commit 'aa122ea907fa1f31ed76f6e0f12ea9549c86a964' into harfbuzz 2013-03-23 15:32:15 +01:00
Hermann Kraus
95c0259a16 Merge commit '542805e4d6eb6672753bae45ac72887be279f9c7' into harfbuzz
Conflicts:
	tests/visual_tests/test.py
2013-03-23 15:30:35 +01:00
Hermann Kraus
1df49735f8 Manual merge.
Merge commit 'e91908206baf0535934a985f8e0d54db2d67ea88' into harfbuzz

Conflicts:
	src/cairo_context.cpp
2013-03-23 15:29:02 +01:00
Hermann Kraus
4aa2758f12 Merge commit 'f759964dbffd03457c0f13c467f1d890f759aff2' into harfbuzz 2013-03-23 14:42:55 +01:00
Hermann Kraus
9834fb73ed Merge branch 'master' into harfbuzz 2013-03-23 14:39:04 +01:00
Hermann Kraus
62c381dfee Merge commit '06803de192edc3a518f03e8c547b222e24993013' into harfbuzz
Conflicts:
	include/mapnik/cairo_context.hpp
	src/cairo_context.cpp
	src/placement_finder.cpp
2013-03-23 14:38:56 +01:00
Hermann Kraus
cc4473cac9 Merge commit '5e224bd705b33a4574e379490a94d5063fdeaf00' into harfbuzz 2013-03-23 14:37:38 +01:00
Hermann Kraus
30c536bab1 Merge branch 'hb-test' into harfbuzz. 2013-03-23 13:55:56 +01:00
Hermann Kraus
7392523d22 Fixed tests.
Results:
AGG with scale factor 1.0: pass
Others: fail
2013-03-23 13:55:07 +01:00
Hermann Kraus
290c2b4a26 Large manual merge. A lot of the changes could not be applied directly
as a different solution was used in the new branch.

Merge commit '6cbceafc45eda71ae379a3dfd7c52712ebe8422b' into harfbuzz

Conflicts:
	include/mapnik/font_engine_freetype.hpp
	src/font_engine_freetype.cpp
	src/grid/process_text_symbolizer.cpp
2013-03-23 03:00:39 +01:00
Hermann Kraus
ef2a1da052 Merge commit '20fcdc80348f4f44944a1eeeabacd021aa051288' into harfbuzz
Conflicts:
	include/mapnik/font_engine_freetype.hpp
	src/agg/process_shield_symbolizer.cpp
	src/font_engine_freetype.cpp
	src/grid/process_shield_symbolizer.cpp
	src/symbolizer_helpers.cpp
2013-03-20 17:32:50 +01:00
Hermann Kraus
0f7101b9b5 Merge commit '71a04cd09da21680b6ad498fe4985eb157f34f35' into harfbuzz 2013-03-20 17:31:25 +01:00
Hermann Kraus
7ce1433675 Merge commit '3bc45ca7ced658537fc288948f3a7976674c50d5' into harfbuzz
Conflicts:
	src/font_engine_freetype.cpp
2013-03-20 17:29:54 +01:00
Hermann Kraus
0398e300af Merge commit 'db437be302e803c70a13038697c86d19d1eddb98' into harfbuzz
Conflicts:
	src/font_engine_freetype.cpp
2013-03-20 17:26:51 +01:00
Hermann Kraus
6082f3dbb2 Merge commit 'f905632b920b130bfe19dd72d81882c10e1db179' into harfbuzz 2013-03-20 17:21:04 +01:00
Hermann Kraus
03b8ee4178 Merge commit '1ed656831dc9a19cfdb67529d84d2762697a6f19' into harfbuzz
Conflicts:
	tests/visual_tests/images/expressionformat-500-reference.png
	tests/visual_tests/images/formatting-1-500-reference.png
	tests/visual_tests/images/formatting-2-500-reference.png
	tests/visual_tests/images/formatting-3-500-reference.png
	tests/visual_tests/images/jalign-auto-200-reference.png
	tests/visual_tests/images/line-offset-900-reference.png
	tests/visual_tests/images/lines-1-200-reference.png
	tests/visual_tests/images/lines-1-400-reference.png
	tests/visual_tests/images/lines-1-600-reference.png
	tests/visual_tests/images/lines-1-800-reference.png
	tests/visual_tests/images/lines-2-200-reference.png
	tests/visual_tests/images/lines-2-400-reference.png
	tests/visual_tests/images/lines-2-600-reference.png
	tests/visual_tests/images/lines-2-800-reference.png
	tests/visual_tests/images/lines-3-200-reference.png
	tests/visual_tests/images/lines-3-400-reference.png
	tests/visual_tests/images/lines-3-600-reference.png
	tests/visual_tests/images/lines-3-800-reference.png
	tests/visual_tests/images/lines-shield-200-reference.png
	tests/visual_tests/images/lines-shield-400-reference.png
	tests/visual_tests/images/lines-shield-600-reference.png
	tests/visual_tests/images/lines-shield-800-reference.png
	tests/visual_tests/images/list-100-reference.png
	tests/visual_tests/images/list-150-reference.png
	tests/visual_tests/images/list-250-reference.png
	tests/visual_tests/images/list-300-reference.png
	tests/visual_tests/images/list-400-reference.png
	tests/visual_tests/images/list-600-reference.png
	tests/visual_tests/images/list-800-reference.png
	tests/visual_tests/images/rtl-point-200-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-490-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-495-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-497-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-498-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-499-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-500-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-501-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-502-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-505-reference.png
	tests/visual_tests/images/shieldsymbolizer-1-510-reference.png
	tests/visual_tests/images/simple-100-reference.png
	tests/visual_tests/images/simple-150-reference.png
	tests/visual_tests/images/simple-250-reference.png
	tests/visual_tests/images/simple-300-reference.png
	tests/visual_tests/images/simple-400-reference.png
	tests/visual_tests/images/simple-600-reference.png
	tests/visual_tests/images/simple-800-reference.png
	tests/visual_tests/images/simple-E-500-reference.png
	tests/visual_tests/images/simple-N-500-reference.png
	tests/visual_tests/images/simple-NE-500-reference.png
	tests/visual_tests/images/simple-NW-500-reference.png
	tests/visual_tests/images/simple-S-500-reference.png
	tests/visual_tests/images/simple-SE-500-reference.png
	tests/visual_tests/images/simple-SW-500-reference.png
	tests/visual_tests/images/simple-W-500-reference.png
	tests/visual_tests/test.py
2013-03-20 17:19:57 +01:00
Hermann Kraus
e673051de5 Reenable grid tests. 2013-03-20 17:15:36 +01:00
Hermann Kraus
f992927cd3 Merge commit '631923e675b486583dbded735b7df4dca6b7cd0b' into hb-test2
Conflicts:
	src/font_engine_freetype.cpp
2013-03-20 17:15:02 +01:00
Hermann Kraus
98f6d3a5e3 Merge commit '464a1f176b71214b0cb5b224eaf944b4cc3cd0f4' into hb-test2 2013-03-20 14:15:54 +01:00
Hermann Kraus
9489cd5538 Add missing test cases. 2013-03-20 03:50:57 +01:00
Hermann Kraus
7d34fb489a Large merge with a lot of manual edits.
Test for grid renderer are failing atm.

Merge commit 'e66d00762754d1204204ccf122955116e5e9d017' into harfbuzz

Conflicts:
	include/mapnik/font_engine_freetype.hpp
	src/agg/process_shield_symbolizer.cpp
	src/agg/process_text_symbolizer.cpp
	src/font_engine_freetype.cpp
	src/grid/process_shield_symbolizer.cpp
	src/grid/process_text_symbolizer.cpp
	src/text_symbolizer.cpp
	src/xml_tree.cpp
2013-03-20 03:47:20 +01:00
Hermann Kraus
a0ecc3d5bc Small fix for 59f2d77. 2013-03-17 12:34:45 +01:00
Hermann Kraus
aaaedcde70 Remove last usage of cairomm. Fixes a85ce71. 2013-03-17 12:34:45 +01:00
Hermann Kraus
3acbda57b9 Fix headers for 04c0fa0. 2013-03-17 12:34:45 +01:00
Hermann Kraus
74cd52a10d Add missing includes. (Missing since at least 55d8492b7754ef135cbce1f47b26a8184423fa70.) 2013-03-17 12:34:44 +01:00
Hermann Kraus
16750433e2 Merge commit 'e5fd3675fab544fd34fe404425ed5287d39d9f24' into harfbuzz 2013-03-16 18:28:25 +01:00
Hermann Kraus
53320282f6 Merge commit '5e1a19cfda06382b34c8f6f6729b16a36543fc82' into harfbuzz
Conflicts:
	tests/visual_tests/test.py
2013-03-16 18:26:08 +01:00
Hermann Kraus
f11616c644 Merge commit '6ffe78c30063ed30f82b48b32c8069a7e69a6edf' into harfbuzz
Conflicts:
	tests/visual_tests/test.py
2013-03-16 18:23:17 +01:00
Hermann Kraus
346ce07117 Merge commit '88360c365f2ea288740db51e65588f839fc67bba' into harfbuzz
Conflicts:
	include/mapnik/cairo_renderer.hpp
2013-03-16 18:21:59 +01:00
Hermann Kraus
e1ca065be4 Merge commit 'cdee64709b8d344412b2de8015621dad45e8255c' into harfbuzz
Conflicts:
	src/font_engine_freetype.cpp
2013-03-16 18:19:58 +01:00
Hermann Kraus
3f989cffb0 Merge commit '054cb132314accb7d3e81d0ccc22fd1cd5900687' into harfbuzz 2013-03-16 18:18:42 +01:00
Hermann Kraus
5930da6be5 Merge commit '218aca2159af9b14fb5e263df674ca652bc18ef2' into harfbuzz
Conflicts:
	include/mapnik/font_engine_freetype.hpp
2013-03-16 18:15:37 +01:00
Hermann Kraus
1b6982e773 Merge commit 'be61bf6fef4d593c3d94701c66efc7404d442eee' into harfbuzz
Conflicts:
	include/mapnik/text_path.hpp
	src/cairo_context.cpp
	src/font_engine_freetype.cpp
	src/placement_finder.cpp
2013-03-16 18:14:57 +01:00
Hermann Kraus
3ca1f00487 Merge commit '3b5707848e8f1d06add0cf4e75ad1169368c68dd' into harfbuzz
Conflicts:
	include/mapnik/text_path.hpp
2013-03-16 18:14:04 +01:00
Hermann Kraus
59f2d776b4 Merge commit '1ea60c472c21db87f07cd81c4df440046a907cfd' into harfbuzz
Conflicts:
	include/mapnik/font_engine_freetype.hpp
	src/font_engine_freetype.cpp
2013-03-16 18:13:37 +01:00
Hermann Kraus
d7ebac77a3 Merge commit 'c3fab9e66502c135e4566005b63a63e04842ddf0' into harfbuzz
Conflicts:
	include/mapnik/char_info.hpp
2013-03-16 17:55:20 +01:00
Hermann Kraus
680b7f0ba2 Merge commit 'a1ea1701dd535e9d4e9b02167d4c9a13a30d4452' into harfbuzz
Conflicts:
	include/mapnik/pixel_position.hpp
2013-03-16 17:54:26 +01:00
Hermann Kraus
af6f87b195 Merge commit 'ea4b6d0802052425108efe836d70cf2b8c7dc70f' into harfbuzz
Conflicts:
	src/font_engine_freetype.cpp
2013-03-16 17:51:05 +01:00
Hermann Kraus
87395157c6 Merge commit 'bda0375f9728f3b8b2cc74d9338f9a84f527ba2f' into harfbuzz
Conflicts:
	include/mapnik/font_engine_freetype.hpp
2013-03-16 17:47:17 +01:00
Hermann Kraus
20ff37eb2d Merge commit '1454105b124daccc4d64654e11c442a2a1aa5008' into harfbuzz
Conflicts:
	src/build.py
2013-03-16 17:44:03 +01:00
Hermann Kraus
f9f01a4c5c Merge commit 'e5d1418417ee9c7549865e2018f12f4138f48414' into harfbuzz
Conflicts:
	include/mapnik/processed_text.hpp
2013-03-16 17:41:56 +01:00
Hermann Kraus
dda1f51c51 Merge commit '1b3b598b80fa5632e16b379d92d21d5e24548975' into harfbuzz 2013-03-16 17:40:23 +01:00
Hermann Kraus
c5bf8de5cb Merge commit '1ccd250980decbd547403265d29ad37e68e44ce5' into harfbuzz
Conflicts:
	src/placement_finder.cpp
2013-03-16 17:38:26 +01:00
Hermann Kraus
ff3c3ad97d Merge commit '1356775299bfd5806b76a4a8067b93fba03c7dca' into harfbuzz 2013-03-16 16:32:35 +01:00
Hermann Kraus
4957694bc7 Merge commit 'afa0c8ad27f3927c25c55ab134dcc30cc2d8b279' into harfbuzz
Conflicts:
	SConstruct
2013-03-16 16:30:19 +01:00
Hermann Kraus
ab54c30e89 Merge commit 'cf11a27a227423c8419e279666d7463adc8b1736' into harfbuzz 2013-03-16 16:29:01 +01:00
Hermann Kraus
2ea4f748a2 Merge commit 'b1c1c86346d23042377deca1644e19959b93f68d' into harfbuzz
Conflicts:
	SConstruct
2013-03-16 16:25:52 +01:00
Hermann Kraus
b61500494b Merge commit 'f8b1520d1a0626f3e16e88ecf641be7222a9ceb6' into harfbuzz
Conflicts:
	include/mapnik/map.hpp
2013-03-16 16:20:58 +01:00
Hermann Kraus
793ec114e9 Merge commit '95b29f82b192f3aba6ef7efa57e4ac3ccb021910' into harfbuzz 2013-03-16 16:18:46 +01:00
Hermann Kraus
495bad25b6 Merge commit '3149c8db3d4fa0e536d18b8c189d7d6d96e1f1f7' into harfbuzz
Conflicts:
	include/mapnik/text/formatting/base.hpp
	src/text/formatting/expression.cpp
2013-03-16 16:15:42 +01:00
Hermann Kraus
c3de3398ca Merge commit 'ba6f3cf2caf46d967b49ac4a301b985d2a5761e9' into harfbuzz
Conflicts:
	include/mapnik/symbolizer_helpers.hpp
	src/symbolizer_helpers.cpp
2013-03-16 16:12:19 +01:00
Hermann Kraus
4699d2d0d6 Merge commit '70008ca78188a086174b003ef965a67a6e93e79e' into harfbuzz 2013-03-16 16:07:50 +01:00
Hermann Kraus
ea0daad8fc Merge commit 'e16567fecb3fd11960697663a955e5cf82225110' into harfbuzz
Conflicts:
	src/cairo_context.cpp
	src/font_engine_freetype.cpp
	src/placement_finder.cpp
2013-03-16 16:05:39 +01:00
Hermann Kraus
c70f4c2c2d Merge commit 'f483e590d846513c0ddc4e464139006a3f7cd917' into harfbuzz 2013-03-16 15:49:06 +01:00
Hermann Kraus
3709747329 Merge commit '7aab2bca4f6b6d9293181c5d3224284b802617c6' into harfbuzz
Conflicts:
	include/mapnik/processed_text.hpp
	include/mapnik/symbolizer_helpers.hpp
2013-03-16 15:44:42 +01:00
Hermann Kraus
a85ce712c6 Merge commit 'a0c758df9e635f8665625cc92c1e3581f2ec25d4' into harfbuzz 2013-03-16 15:42:21 +01:00
Hermann Kraus
9f0a92069e Merge commit '7d62c3e8ba0593289dae57a2d8531a1c05ce4229' into harfbuzz 2013-03-16 15:41:40 +01:00
Hermann Kraus
04c0fa0767 Merge commit 'f25d4d9279fc99650b88d980a8c579a6b541d4b5' into harfbuzz
Conflicts:
	src/cairo_renderer.cpp
2013-03-16 15:40:54 +01:00
Hermann Kraus
0227e67d5f Merge commit '35134b6b06f0e2f6ee10ed7c4a3d3d304975988e' into harfbuzz 2013-03-16 15:18:24 +01:00
Hermann Kraus
63acf3c248 Merge commit '0121f53f56327fda1aebb9d2e6c12aee07ef3b49' into harfbuzz
Conflicts:
	include/mapnik/font_engine_freetype.hpp
2013-03-16 15:15:38 +01:00
Hermann Kraus
20272a7396 Merge commit 'a01a998aff27036ceee231ecc71156dcacc3e298' into harfbuzz
Conflicts:
	include/mapnik/agg_renderer.hpp
	include/mapnik/text/text_properties.hpp
2013-03-16 15:14:24 +01:00
Hermann Kraus
363ab5b47a Merge commit '900b6172bfc4be5b706600b49a587de40e6cf673' into harfbuzz
Conflicts:
	include/mapnik/placement_finder.hpp
2013-03-16 15:12:33 +01:00
Hermann Kraus
2735b47bd3 Merge commit 'eb15d0bd8a9a748b2381c9e09575a98f3c5861f5' into harfbuzz 2013-03-16 15:11:12 +01:00
Hermann Kraus
a5c3d100dd Merge commit '9c3dba905bb3d489c0b7a20bc8232d5133225ab9' into harfbuzz
Conflicts:
	include/mapnik/text/formatting/base.hpp
	include/mapnik/text/formatting/expression_format.hpp
	include/mapnik/text/formatting/format.hpp
	include/mapnik/text/formatting/list.hpp
	include/mapnik/text/formatting/text.hpp
2013-03-16 15:09:11 +01:00
Hermann Kraus
475502af00 Merge commit '09c8b876fda07c9268d2fe718a230a753296242f' into harfbuzz 2013-03-16 13:36:06 +01:00
Hermann Kraus
4484447774 Merge commit '70ef017f8ccbd2120b02fc7556808e541bc479a5' into harfbuzz 2013-03-16 13:35:21 +01:00
Hermann Kraus
6b573bdf47 Merge commit '17b0b1eeb1ea2b15f1ff0d202b862d3a6844fea0' into harfbuzz
Conflicts:
	src/symbolizer_helpers.cpp
2013-03-16 13:33:25 +01:00
Hermann Kraus
1e67ba63cd Merge commit 'e9343ca32ca73f19213da5ae41e9b25908c716b0' into harfbuzz
Conflicts:
	src/placement_finder.cpp
	src/text/text_properties.cpp
2013-03-16 13:30:03 +01:00
Hermann Kraus
701a407087 Merge commit 'a75cfa111bb1bf943acf92df0a4d2490a5e8ef72' into harfbuzz
Conflicts:
	src/text/formatting/expression.cpp
	src/text/formatting/format.cpp
	src/text/formatting/list.cpp
	src/text/formatting/text.cpp
2013-03-16 13:25:44 +01:00
Hermann Kraus
25d00ad26f Merge commit '32760318a4905efa45bb459d891e5e7ec1a7bf2a' into harfbuzz
Conflicts:
	include/mapnik/font_engine_freetype.hpp
	include/mapnik/text/formatting/base.hpp
	include/mapnik/text/formatting/list.hpp
	include/mapnik/text/text_properties.hpp
	src/font_engine_freetype.cpp
	src/grid/process_shield_symbolizer.cpp
	src/symbolizer_helpers.cpp
	src/text/formatting/expression.cpp
	src/text/formatting/format.cpp
	src/text/formatting/list.cpp
	src/text/text_properties.cpp
2013-03-16 13:19:06 +01:00
Hermann Kraus
fe54e4a6a1 Merge commit '6b7c16297032aa24bab0950b2a837e58c7d52c86' into harfbuzz
Conflicts:
	src/grid/process_shield_symbolizer.cpp
2013-03-16 13:13:14 +01:00
Hermann Kraus
438e2c4de7 Merge commit 'bb27156df0a111fdecfe87b48d27b2866b7a2816' into harfbuzz
Conflicts:
	include/mapnik/font_engine_freetype.hpp
	include/mapnik/grid/grid_renderer.hpp
	include/mapnik/placement_finder.hpp
	include/mapnik/processed_text.hpp
	include/mapnik/text/formatting/registry.hpp
	include/mapnik/text/placements/registry.hpp
	include/mapnik/text_path.hpp
2013-03-16 13:11:29 +01:00
Hermann Kraus
723b89f151 Merge commit '6b84269343cbd7a8aa165e3b4788d6a64b6c1e55' into harfbuzz
Conflicts:
	src/placement_finder.cpp
2013-03-16 13:06:39 +01:00
Hermann Kraus
77fadc8209 Merge commit '562fada9d0f680f59b2d9f396c95320a0d753479' into harfbuzz 2013-03-16 13:03:11 +01:00
Hermann Kraus
4a6eab2d85 Merge commit 'c0021d0760ec85ace3b0a9a480d351cfd0f0ce91' into harfbuzz
Conflicts:
	include/mapnik/font_engine_freetype.hpp
2013-03-16 13:01:15 +01:00
Hermann Kraus
90f0287a21 Merge commit '95ceee84fac2cd9dffad0931889522a87c723537' into harfbuzz
Conflicts:
	src/cairo_renderer.cpp
2013-03-16 12:59:07 +01:00
Hermann Kraus
a2aaea1cd0 Merge commit '1d114b5e2fd4b5f9cd64013d3eec89fd00d580a5' into harfbuzz 2013-03-16 12:47:52 +01:00
Hermann Kraus
df7c2b5c0e Merge commit '57aa6dd05230876bf7c022d3554436e4d35de77f' into harfbuzz
Conflicts:
	tests/visual_tests/test.py
2013-03-16 12:46:01 +01:00
Hermann Kraus
4d54696265 Merge commit '8dca9dbb2b9012caf9d37ae60906756aa6c0e037' into harfbuzz
Conflicts:
	src/agg/process_shield_symbolizer.cpp
	src/grid/process_shield_symbolizer.cpp
2013-03-16 12:44:46 +01:00
Hermann Kraus
0c62b481f6 Merge commit 'cd064305fc8cf7fee1806e495d9016a5ce1e5d7f' into harfbuzz
Conflicts:
	src/cairo_renderer.cpp
2013-03-16 12:44:01 +01:00
Hermann Kraus
a9973837ef Merge commit '0b9ebe21dd593b9b87c6388291b79a5c5a4af4e4' into harfbuzz
Conflicts:
	tests/visual_tests/test.py
2013-03-16 12:39:47 +01:00
Hermann Kraus
55d8492b77 Merge commit 'e2a76e09b3e3614174d24aa43165151f599c9d8e' into harfbuzz
Conflicts:
	src/agg/process_text_symbolizer.cpp
	src/cairo_renderer.cpp
2013-03-16 12:38:22 +01:00
Hermann Kraus
ad905f1ff8 Merge commit '00517a507f68237874630dae1821c8a2c844bc3d' into harfbuzz
Conflicts:
	tests/visual_tests/test.py
2013-03-16 12:34:59 +01:00
Hermann Kraus
c4cdd89076 Merge commit 'b9b97ba6526aebbe920e0bd29b8dc8dc35267cfc' into harfbuzz
Conflicts:
	src/load_map.cpp
2013-03-16 12:31:56 +01:00
Hermann Kraus
d522d997e8 Merge commit '4432b75f53b30d02ecf5add1e84f6b78cd572f98' into harfbuzz
Conflicts:
	tests/visual_tests/test.py
2013-03-16 12:28:15 +01:00
Hermann Kraus
784ef8f76a Merge commit 'a537c58afa450e1ffe6bbd8978d2e122b55c9942' into harfbuzz
Conflicts:
	include/mapnik/symbolizer.hpp
2013-03-16 12:24:02 +01:00
Hermann Kraus
606361b75c Merge commit '940bb9827585885c6eaef9b1d4c62a38f4e81ea9' into harfbuzz
Conflicts:
	tests/visual_tests/test.py
2013-03-16 12:21:31 +01:00
Hermann Kraus
3ea335af66 Merge commit '7cf4a00af9530ba2aa46ba1a4a5cb2cb41fe166a' into harfbuzz 2013-03-16 12:13:11 +01:00
Hermann Kraus
15076eb743 Remove unused include. 2012-10-13 19:04:50 +02:00
Hermann Kraus
1e6e2bdaa7 Merge branch 'master' into harfbuzz
Conflicts:
	bindings/python/mapnik/__init__.py
2012-09-23 13:28:08 +02:00
Hermann Kraus
4e6268014a Add dummy shaping engine. 2012-09-23 04:03:29 +02:00
Hermann Kraus
748cf62de3 Prepare for making HarfBuzz an optional dependency. 2012-09-23 03:19:47 +02:00
Hermann Kraus
7439eaed67 Merge branch 'harfbuzz' of github.com:mapnik/mapnik into harfbuzz 2012-09-23 02:55:07 +02:00
Hermann Kraus
60c3c590ed Reenable "name" tests.
Refs #1482.
2012-09-23 02:52:49 +02:00
Hermann Kraus
bbedec3437 Clean up directory structure. 2012-09-23 02:52:40 +02:00
Hermann Kraus
86ed99d8fe Clean up directory structure. 2012-09-16 02:11:14 +02:00
Hermann Kraus
fa62234179 Merge branch 'master' into harfbuzz 2012-09-15 02:06:35 +02:00
Hermann Kraus
406904a1f6 Merge branch 'master' into harfbuzz
Conflicts:
	bindings/python/mapnik/__init__.py
	include/mapnik/font_engine_freetype.hpp
	src/load_map.cpp
2012-09-15 01:39:33 +02:00
Hermann Kraus
dc6ecc4be7 Reenable wrap-before and add tests for it. 2012-09-14 18:53:52 +02:00
Hermann Kraus
e5351ced6f Add missing reference images. 2012-09-14 18:05:52 +02:00
Dane Springmeyer
4d5ab83fb3 add harfbuzz custom paths to environment 2012-09-14 08:55:01 -07:00
Hermann Kraus
6d9c808b6d Fix all reference to points.shp.
Add new character spacing test.
2012-09-13 23:35:42 +02:00
Hermann Kraus
0615609e67 Fix python bindings. 2012-09-13 23:11:27 +02:00
Hermann Kraus
297bfeb454 Merge branch 'master' into harfbuzz
Conflicts:
	src/symbolizer_helpers.cpp
2012-09-08 01:26:47 +02:00
Hermann Kraus
c862d3f672 Solve naming conflict. 2012-09-08 00:29:49 +02:00
Hermann Kraus
85e075b8ea Merge branch 'master' into harfbuzz
Conflicts:
	bindings/python/mapnik_text_placement.cpp
	include/mapnik/font_engine_freetype.hpp
	include/mapnik/map.hpp
	include/mapnik/metawriter.hpp
	include/mapnik/metawriter_inmem.hpp
	include/mapnik/metawriter_json.hpp
	include/mapnik/placement_finder.hpp
	include/mapnik/symbolizer.hpp
	include/mapnik/symbolizer_helpers.hpp
	include/mapnik/text_properties.hpp
	src/agg/process_shield_symbolizer.cpp
	src/build.py
	src/cairo_renderer.cpp
	src/feature_style_processor.cpp
	src/grid/process_shield_symbolizer.cpp
	src/metawriter.cpp
	src/metawriter_inmem.cpp
	src/placement_finder.cpp
	src/processed_text.cpp
	src/symbolizer_helpers.cpp
	tests/visual_tests/images/lines-shield-200-reference.png
	tests/visual_tests/images/lines-shield-400-reference.png
	tests/visual_tests/images/lines-shield-600-reference.png
	tests/visual_tests/images/lines-shield-800-reference.png
	tests/visual_tests/styles/formatting.xml
	tests/visual_tests/test.py
2012-09-07 19:07:31 +02:00
Hermann Kraus
1acac72b7a Remove fastmath.hpp as it is no longer needed.
Closes #1301.
2012-08-26 02:28:30 +02:00
Hermann Kraus
f40464a815 Remove old placement_finder code and rename placement_finder_ng => placement_finder. 2012-08-25 00:27:58 +02:00
Hermann Kraus
5fbda3e579 Merge line placement code paths for Text- and ShieldSymbolizer.
Enables label-position-tolerance for ShieldSymbolizer.
2012-08-25 00:16:57 +02:00
Hermann Kraus
610a0906d1 Update tests. 2012-08-21 22:36:05 +02:00
Hermann Kraus
3a09a60035 Always restore state. 2012-08-21 22:36:05 +02:00
Hermann Kraus
8bc9561dd4 Try negative offsets first to mimic old behavior. 2012-08-21 22:36:04 +02:00
Hermann Kraus
020e79f53b Add new test mode. 2012-08-21 22:36:04 +02:00
Hermann Kraus
abc59d2202 Make sure marker is placed even for empty texts. 2012-08-21 22:36:04 +02:00
Hermann Kraus
d4ef591a99 Move tolerance calculation to its own class. 2012-08-21 22:35:56 +02:00
Hermann Kraus
accbc139a5 Preallocate memory for glyphs. 2012-08-20 00:08:13 +02:00
Hermann Kraus
90c2ddcbf1 Enable ShieldSymbolizer for Cairo. 2012-08-17 18:40:49 +02:00
Hermann Kraus
a1f0af112e Support ShieldSymbolizer. 2012-08-17 18:31:55 +02:00
Hermann Kraus
d8fad34aa3 Remove lots of old code in symbolizer_helpers and restructure code to
avoid the need for different helpers for text and shield symbolizers.
2012-08-17 02:54:08 +02:00
Hermann Kraus
f72527da8b Add tests. 2012-08-17 01:56:43 +02:00
Hermann Kraus
f9edcb71e0 Reenable support for metawriters.
Implementations in individual metawriters are still missing.
2012-08-15 02:11:11 +02:00
Hermann Kraus
79ad6b395e Implement label-position-tolerance. 2012-08-13 02:31:08 +02:00
Hermann Kraus
75f250934f Reorder code. 2012-08-12 23:22:44 +02:00
Hermann Kraus
76c3868028 Fix jalign. 2012-08-12 22:55:56 +02:00
Hermann Kraus
61ebd8ae78 Cache iterators. 2012-08-12 22:54:13 +02:00
Hermann Kraus
2a0a52fba2 Update tests. 2012-08-12 15:30:54 +02:00
Hermann Kraus
1dba0581c2 Merge branch 'master' into harfbuzz
Conflicts:
	src/cairo_renderer.cpp
2012-08-12 12:32:35 +02:00
Hermann Kraus
ec58dd9f18 Implement jalign for line placements. 2012-08-12 03:34:48 +02:00
Hermann Kraus
e7f0ae01bd Fix line ordering for upright="left/auto". 2012-08-12 02:50:36 +02:00
Hermann Kraus
37a5552bbd Implement offsets and multiline rendering. 2012-08-12 02:46:26 +02:00
Hermann Kraus
14891379d0 Add compatibility layer with normal path interface. 2012-08-11 23:26:45 +02:00
Hermann Kraus
46fa3cab43 Reenable grid renderer. 2012-08-11 21:47:45 +02:00
Hermann Kraus
9927ae6f60 Change text_renderer class. 2012-08-11 21:22:26 +02:00
Hermann Kraus
47025661f6 Implement collision detection. 2012-08-11 20:46:58 +02:00
Hermann Kraus
ffc3a5d52a Add bounding box calculation. 2012-08-11 20:34:57 +02:00
Hermann Kraus
2e22d740cf Store the value of sin(angle) and cos(angle) instead of recomputing them every time. 2012-08-11 19:14:28 +02:00
Hermann Kraus
503c1862ba Simplify code. 2012-08-11 04:19:11 +02:00
Hermann Kraus
48290546d9 Remove duplicate code. 2012-08-11 02:48:56 +02:00
Hermann Kraus
f10d5b107f Render each glyph in a cluster with the same rotation.
Refs #1208.
2012-08-10 20:31:03 +02:00
Hermann Kraus
75f4cbba18 Rotate offsets. 2012-08-10 18:50:38 +02:00
Hermann Kraus
6eebda886d Implement scoped_state. 2012-08-10 02:39:03 +02:00
Hermann Kraus
2a1925c3ff Respect dx value. 2012-08-10 02:21:46 +02:00
Hermann Kraus
2252e128bd Add rewind function. 2012-08-10 02:14:05 +02:00
Hermann Kraus
3db18cfa50 Correctly handle glyph clusters. 2012-08-06 01:26:24 +02:00
Hermann Kraus
b7ac16d460 Bug fix: Stored state was incomplete. 2012-08-06 00:32:28 +02:00
Hermann Kraus
1965845771 Implement max-angle-char-delta. 2012-08-05 16:29:43 +02:00
Hermann Kraus
e380a20b6c Merge branch 'master' into harfbuzz
Conflicts:
	src/symbolizer_helpers.cpp
2012-08-05 16:29:09 +02:00
Hermann Kraus
d866b7ef9d Check if more than 50% of all characters are upside down. => Flip! 2012-08-05 15:09:33 +02:00
Hermann Kraus
6a27a2ae76 Implement auto-upright. 2012-08-05 14:57:14 +02:00
Hermann Kraus
5115658ecc Function to print pixel_position to stream. 2012-08-05 01:52:13 +02:00
Hermann Kraus
0b1c983d40 Add option for selecting which text should be upright. 2012-08-05 01:51:42 +02:00
Hermann Kraus
6a7387f95e Move enum names to the file they belong to. 2012-08-05 01:41:39 +02:00
Hermann Kraus
08dd7d21b7 Fix label spacing calculation. 2012-08-05 01:18:54 +02:00
Hermann Kraus
30ee700b7c Store full state. 2012-08-05 01:17:32 +02:00
Hermann Kraus
3d336f4306 Remove invalid optimization in renderer. 2012-08-05 01:15:31 +02:00
Hermann Kraus
f20e90a524 Improve angle calculation. 2012-08-05 00:14:29 +02:00
Hermann Kraus
53fa3ff1e1 Implement line placements. 2012-08-04 23:14:32 +02:00
Hermann Kraus
5cb7cb8c59 Remove old code. 2012-08-04 22:11:44 +02:00
Hermann Kraus
593b401c16 Fix some bugs in vertex_cache. 2012-08-04 20:50:32 +02:00
Hermann Kraus
3529ecf336 Update python bindings to work with 5e259bf064. 2012-08-04 19:51:39 +02:00
Hermann Kraus
b299ca2533 Rename path_processor => vertex_cache because a different class with the same name already exists. 2012-08-04 19:14:48 +02:00
Hermann Kraus
f67c6e4fd4 Only advance if glyph is not part of a multiple glyph sequence. 2012-08-04 18:36:55 +02:00
Hermann Kraus
f8739c7504 Add angle() and set_offset(). 2012-08-04 18:22:19 +02:00
Hermann Kraus
cbcafe89e3 Add functions to save/restore path processor's state. 2012-08-04 17:47:29 +02:00
Hermann Kraus
29274294b3 Only the constructor needs to be a template. 2012-08-04 16:58:07 +02:00
Hermann Kraus
d0f3acb581 Implement minimum-padding and avoid-edges. 2012-08-04 02:22:05 +02:00
Hermann Kraus
30672d91cb Add function to enlarge bbox2d. 2012-08-04 02:12:15 +02:00
Hermann Kraus
5e259bf064 Remove unused code. 2012-08-04 02:09:49 +02:00
Hermann Kraus
f5af6d3d26 Update path_processor to handle non-continuous paths. 2012-08-04 02:01:36 +02:00
Hermann Kraus
ef0aae3733 Merge branch 'master' into harfbuzz
Conflicts:
	src/build.py
2012-08-03 19:27:09 +02:00
Hermann Kraus
2b6cc00806 Simplify code by always returning the same data type no matter what placement type is used. 2012-08-03 01:42:18 +02:00
Hermann Kraus
b062af211a Implement find_points_on_line(). 2012-08-02 17:53:02 +02:00
Hermann Kraus
0c90f0f22b Update all tests which return obviously correct results. 2012-08-02 01:28:19 +02:00
Hermann Kraus
d29ef80560 Reindent code. 2012-08-02 01:14:12 +02:00
Hermann Kraus
c529bf7b06 Implement font sets. 2012-08-02 01:12:52 +02:00
Hermann Kraus
984f136351 Add dummy functions for line placements and reenable line placement code in symbolizer helpers. 2012-08-02 00:37:43 +02:00
Hermann Kraus
f2e2483109 Better text positions. 2012-08-01 23:09:47 +02:00
Hermann Kraus
0af19a226c Remove debug output. 2012-08-01 03:10:00 +02:00
Hermann Kraus
adb4bc9c01 Fix variable name. 2012-08-01 03:07:31 +02:00
Hermann Kraus
21c9a6fcde Initialize all members in clear(). 2012-08-01 01:42:50 +02:00
Hermann Kraus
b97840660c Merge branch 'debugsymbolizer' into harfbuzz 2012-08-01 01:17:26 +02:00
Hermann Kraus
5929c3c9db Add "rotate-displacement". 2012-07-31 23:05:31 +02:00
Hermann Kraus
a41eafd8ee Add rotation tests. 2012-07-30 18:06:06 +02:00
Hermann Kraus
6b616ebecd Add rotation. 2012-07-30 18:03:42 +02:00
Hermann Kraus
435f716821 Reenable TextSymbolizer in Cairo renderer. 2012-07-30 02:59:06 +02:00
Hermann Kraus
a57123f8be Add collision detector support. 2012-07-30 02:17:43 +02:00
Hermann Kraus
00ae551564 Merge branch 'master' into harfbuzz 2012-07-30 01:26:31 +02:00
Hermann Kraus
dbead9bc00 Partially revert b3c5969c3e.
The meaning of wrap-char is different from what I originally thought.
2012-07-30 01:24:31 +02:00
Hermann Kraus
d6c8fe37a9 Handle \n chars. 2012-07-30 01:23:04 +02:00
Hermann Kraus
66cbf45cd7 Rename symbols to match coding standards. 2012-07-29 18:10:41 +02:00
Hermann Kraus
b3c5969c3e Implement wrap_char. 2012-07-29 17:58:46 +02:00
Hermann Kraus
0f7f527af9 Fix typo. 2012-07-29 13:12:53 +02:00
Hermann Kraus
d3c473bbdc Calculate text position the same way as it was done in Mapnik 2.0. 2012-07-29 03:50:22 +02:00
Hermann Kraus
22aeba9bbd Temporary fix for deep copy problem introduced by aecd6820c2. 2012-07-29 02:41:09 +02:00
Hermann Kraus
2e3e76ebaa Merge branch 'master' into harfbuzz 2012-07-29 01:48:48 +02:00
Hermann Kraus
9cdb9a7bf3 Fix build errors introduced by 4e3e5cb0b0. 2012-07-29 01:31:10 +02:00
Hermann Kraus
3a16d2749a Correctly initialize placement_ member. 2012-07-29 01:28:19 +02:00
Hermann Kraus
4e3e5cb0b0 Merge branch 'master' into harfbuzz
Conflicts:
	bindings/python/mapnik_shield_symbolizer.cpp
	include/mapnik/agg_renderer.hpp
	include/mapnik/cairo_renderer.hpp
	src/build.py
2012-07-28 20:59:42 +02:00
Hermann Kraus
71247085d2 Correct size calculation. 2012-07-28 20:45:17 +02:00
Hermann Kraus
212760b507 Rename symbols to match coding standards. 2012-07-28 20:32:11 +02:00
Hermann Kraus
981c11c563 Implement find_point_placement(). 2012-07-28 20:31:02 +02:00
Hermann Kraus
a953d535ad Use pixel_position consistently everywhere. 2012-07-28 16:34:44 +02:00
Hermann Kraus
6b3810c9b0 Add init_alignment() function. 2012-07-28 02:04:01 +02:00
Hermann Kraus
716dd1c79e Move next_position() to placement finder. 2012-07-28 01:43:11 +02:00
Hermann Kraus
f6ad3243ef Improve line breaking.
Change placement finder API.
2012-07-26 23:44:04 +02:00
Hermann Kraus
c0180d59ed Change glyph_positions interface to be easier to use. 2012-07-22 21:47:07 +02:00
Hermann Kraus
9408f2e169 Add comments. 2012-07-22 21:42:32 +02:00
Hermann Kraus
045948beb7 Handle line spacing. 2012-07-22 21:41:40 +02:00
Hermann Kraus
0b16174ddb Remove unused code. 2012-07-22 02:11:15 +02:00
Hermann Kraus
b53849d441 Merge branch 'master' into harfbuzz
Conflicts:
	include/mapnik/font_engine_freetype.hpp
	include/mapnik/symbolizer_helpers.hpp
	src/agg/process_shield_symbolizer.cpp
	src/agg/process_text_symbolizer.cpp
	src/cairo_renderer.cpp
	src/font_engine_freetype.cpp
	src/formatting/list.cpp
	src/grid/process_shield_symbolizer.cpp
	src/grid/process_text_symbolizer.cpp
	src/symbolizer_helpers.cpp
	tests/visual_tests/styles/harfbuzz.xml
2012-07-21 20:19:22 +02:00
Hermann Kraus
b8a54e6a4f Add line breaking.
Note: Text rendering is currently disabled.
2012-07-21 04:17:58 +02:00
Hermann Kraus
d2918590b5 Remove unused files. 2012-07-21 02:55:34 +02:00
Hermann Kraus
fdc4df3fc5 Fix RTL handling in itemizer. 2012-07-20 18:44:20 +02:00
Hermann Kraus
a8cf13113a Update itemizer to allow operation on text ranges (for line breaking).
Fix handling of reordered text runs (refs #519).
2012-07-20 18:40:47 +02:00
Hermann Kraus
76369a77fb Remove debug output. 2012-07-20 18:39:52 +02:00
Hermann Kraus
b65b21ce1d Correct calculation of line width. 2012-07-20 02:07:25 +02:00
Hermann Kraus
e48b2f6598 Use assertations to make code cleaner. 2012-07-20 01:51:05 +02:00
Hermann Kraus
525dad7623 Add line breaking algorithm. 2012-07-19 02:30:27 +02:00
Hermann Kraus
27c5e50dcb Use offsets for correct positioning of glyphs.
Refs #1208.
2012-07-17 23:29:05 +02:00
Hermann Kraus
e9354f5802 Correctly initialize buffer unicode functions. They are cleared by a buffer reset. 2012-07-17 23:26:00 +02:00
Hermann Kraus
019a44da80 Add new tests for Khmer text.
Reference renderings: http://licadho-cambodia.org/mapnik/khmer.html
Thanks to github user "nirvn" for providing these images.
Refs #1208.
2012-07-17 22:03:25 +02:00
Hermann Kraus
beed2d08f2 Implement missing functions.
This is the first version that actually renders text. And it's working correctly!
2012-07-11 02:21:30 +02:00
Hermann Kraus
9f2ec07cd8 Store format with each glyph to make code less complex. 2012-07-11 00:22:25 +02:00
Hermann Kraus
8bbceb1a41 Update renderer. 2012-07-10 09:30:59 +02:00
Hermann Kraus
a97a9d17cc Adjust function calls. 2012-07-09 22:35:46 +02:00
Hermann Kraus
a8ba813423 Implement new prepare glyphs function. 2012-07-09 22:35:02 +02:00
Hermann Kraus
514a0da09e Define new interface for glyph_positions. 2012-07-09 22:23:54 +02:00
Hermann Kraus
09a0483028 Make linker happy. 2012-07-08 17:45:19 +02:00
Hermann Kraus
17efe0601b Make sure everything compiles again after font engine changes. 2012-07-08 17:19:55 +02:00
Hermann Kraus
eeeb058104 Clean up font_engine_freetype.[ch]pp. 2012-07-08 13:18:12 +02:00
Hermann Kraus
f0937451a2 Update symbolizer_helpers to support new placement finder. 2012-07-07 17:41:49 +02:00
Hermann Kraus
dc9106d444 Update docs. 2012-07-07 17:41:31 +02:00
Hermann Kraus
3d2417ddef Add graph showing text_layout dependencies. 2012-07-06 21:41:20 +02:00
Hermann Kraus
ddb1fa995f Start work on new placement finder. 2012-07-06 02:09:48 +02:00
Hermann Kraus
959ff260dd Fix RTL bug. 2012-07-02 02:06:07 +02:00
Hermann Kraus
228263727f Fix offsets. 2012-07-02 01:59:29 +02:00
Hermann Kraus
6e4915ef83 Use shared pointers for text_layout. 2012-07-02 01:06:30 +02:00
Hermann Kraus
aecd6820c2 Use char_properties_ptr everywhere. 2012-07-02 00:10:55 +02:00
Hermann Kraus
47dea8ed52 Use char_properties_ptr in more files. 2012-07-01 23:14:35 +02:00
Hermann Kraus
993395c510 Add test case with mixed text. 2012-07-01 23:13:54 +02:00
Hermann Kraus
7d241c5353 Use shared pointer to track char_properties.
Store positions instead of strings in text_item.
2012-07-01 22:35:20 +02:00
Hermann Kraus
e537b0e8dd Remove old code. 2012-07-01 02:47:39 +02:00
Hermann Kraus
ead99b1411 Calculate glyph dimensions. 2012-06-30 21:40:41 +02:00
Hermann Kraus
bf66b71f3e Add copyright message. 2012-06-30 19:50:05 +02:00
Hermann Kraus
91d80dc7c1 Use UTF16 directly to avoid reencoding and allow easy mapping of chars to glyphs. 2012-06-30 18:32:59 +02:00
Hermann Kraus
89b727d2fc Correctly set script and direction. 2012-06-30 18:03:31 +02:00
Hermann Kraus
2e50936b13 Use mapnik's face_manager instead of loading the font on our own. 2012-06-30 17:09:46 +02:00
Hermann Kraus
63e8b6d6db Some changes to make testing easier. 2012-06-30 10:04:18 +02:00
Hermann Kraus
62ccc7d313 Send processed text directly to text_layout. 2012-06-29 00:48:04 +02:00
Hermann Kraus
1c9babf9e2 Merge branch 'master' into harfbuzz 2012-06-28 23:01:34 +02:00
Hermann Kraus
7c7dd0fa80 Add files from https://github.com/herm/harfbuzz-test. 2012-06-28 23:01:23 +02:00
1186 changed files with 19858 additions and 10597 deletions

View file

@ -8,10 +8,112 @@ For a complete change history, see the git log.
## Future
- Added new mapnik-config options: `git-describe`, `defines`, `includes`, `dep-includes`, and `cxxflags` (#1443)
- Added `premultiplied` property on mapnik::image_32 / mapnik.Image to enable knowledge of premultiplied status of image buffer.
## 2.2.0
Released June 3rd, 2013
(Packaged from 9231205)
Summary: The 2.2.0 release is primarily a performance and stability release. The code line represents development in the master branch since the release of 2.1.0 in Aug 2012 and therefore includes nearly a year of bug-fixes and optimizations. Nearly 500 new tests have been added bring the total coverage to 925. Shapefile and PostGIS datasources have benefited from numerous stability fixes, 64 bit integer support has been added to support OSM data in the grid renderer and in attribute filtering, and many fixes have landed for higher quality output when using a custom `scale_factor` during rendering. Critical code paths have been optimized include raster rendering, xml map loading, string to number conversion, vector reprojection when using `epsg:4326` and `epsg:3857`, `hextree` encoding, halo rendering, and rendering when using a custom `gamma`. Mapnik 2.2 also compiles faster than previous releases in the 2.x series and drops several unneeded and hard to install dependencies making builds on OS X and Windows easier than any previous release.
- Removed 3 depedencies without loosing any functionality: `ltdl`, `cairomm` and `libsigc++` (#1804,#806,#1681)
- Added 64 bit integer support in expressions, feature ids, and the grid_renderer (#1661,#1662,#1662)
- Added the ability to disable the need for various dependencies: `proj4`, `libpng`, `libtiff`, `libjpeg`
- Added faster reprojection support between `epsg:3857` and `epsg:4326` (#1705,#1703,#1579)
- Fixed concurrency problem when using cursors in postgis plugin (#1823,#1588)
- Fixed postgres connection pool leaks when using `persist_connection=false` (#1764)
- Fixed postgres connection key to respect highest value of `max_size` and `initial_size` for any layer in map (#1599)
- Fixed potential crash in wkb parsing when postgis returns null geometry (#1843)
- Fixed blurry rendering of image and SVG icons (#1316)
- Added detection of invalid srs values when loading xml (#646)
- Added support for specifying a base_path as a third, optional argument to load_xml
- Removed muffling of projection errors while rendering (#646)
- Improved logging system (https://github.com/mapnik/mapnik/wiki/Logging)
- Added support for reading images from in memory streams (#1805)
- Optimized halo rendering. When halo radius is < 1 new method will be used automatically (#1781)
- Added `text-halo-rasterizer` property. Set to `fast` for lower quality but faster
halo rendering (#1298)
halo rendering (#1298) which matched new default method when radius is < 1.
- Added support in `shape`, `sqlite`, `geojson`, and `csv` plugin for handling non-latin characters in the paths to file-based resources (#1177)
- Fixed rendering of markers when their size is greater than the specified `spacing` value (#1487)
- Fixed handling of alpha premultiplication in image scaling (#1489)
- Optimized rendering when a style with no symbolizers is encountered (#1517)
- Optimized string handling and type conversion by removing `boost::to_lower`, `boost::trim`, and `boost::lexical_cast` usage (#1687,#1687,#1633)
- Optimized alpha preserving `hextree` method for quantization of png images (#1629)
- Faster rendering of rasters by reducing memory allocation of temporary buffers (#1516)
- Fixed some raster reprojection artifacts (#1501)
- Fixed raster alignment when width != height and raster is being scaled (#1748,#1622)
- Added support for caching rasters for re-use during rendering when styling more than once per layer (#1543)
- Improved compile speeds of the code - in some cases by up to 2x and removed need for freetype dependency when building code against mapnik (#1688, #1756)
- Removed internal rule cache on `mapnik::Map` c++ object (#1723)
- Improved the scaled rendering of various map features when using `scale_factor` > 1 (#1280,#1100,#1273,#1792,#1291,#1344,#1279,#1624,#1767,#1766)
- Added C++ api for overriding scale_denominator to enable rendering at fixed scale (#1582)
- Added Layer `buffer-size` that can be used to override Map `buffer-size` to avoid
over-fetching of data that does not need to be buffered as much as other layers.
Map level `buffer-size` will be default if layers do not set the option. Renamed a
previously undocumented parameter by the same name that impacted clipping extent and
was not needed (clipping padding should likely be a symbolizer level option) (#1566)
- Fixed potential file descriptor leaks in image readers when invalid images were encountered (#1783)
- Fixed alpha handling in the `blur` and `invert` image filters (#1541)
- Fixed error reporting in the python plugin (#1422)
- Added the ability to run tests without installing with `make test-local`
- Reduced library binary size by adding support for `-fvisibility-inlines-hidden` and `-fvisibility=hidden` (#1826,#1832)
- Added `mapnik::map_request` class, a special object to allow passing mutable map objects to renderer (#1737)
- Added the ability to use `boost::hash` on `mapnik::value` types (#1729)
- Removed obsolete `geos` plugin (functionality replaced by `csv` plugin) and unmaintained `kismet` plugin (#1809,#1833)
- Added new `mapnik-config` flags: `--all-flags`, `--defines`, `--git-describe`, `--includes`, `--dep-includes`, `--cxxflags`, `--cxx` (#1443)
- Added support for unicode strings as arguments in python bindings (#163)
- Added DebugSymbolizer which is able to render the otherwise invisible collision boxes (#1366)
- Optimized rendering by reducing overhead of using `gamma` property (#1174)
- Fixed rendering artifacts when using `polygon-gamma` or `line-gamma` equal to 0 (#761,#1763)
- Fixed and optimized the display of excessive precision of some float data in labels (#430,#1697)
- Removed the `bind` option for datasources (#1654)
- Added ability to access style list from map by (name,obj) in python (#1725)
@ -21,19 +123,11 @@ For a complete change history, see the git log.
- Added support for `background-image` in cairo_renderer (#1724)
- Added Layer `buffer-size` that can be used to override Map `buffer-size` to avoid
over-fetching of data that does not need to be buffered as much as other layers.
Map level `buffer-size` will be default if layers do not set the option. Renamed a
previously undocumented parameter by the same name that impacted clipping extent and
was not needed (clipping padding should likely be a symbolizer level option) (#1566)
- Fixed building symbolizer rendering to be fully sensitive to alpha (8b66128c892 / bc8ea1c5a7a)
- Added 64 bit integer support in the grid_renderer (#1662)
- `<Filter>[attr]</Filter>` now returns false if attr is an empty string (#1665)
- Added 64 bit integer support in expressions and feature ids (#1661,#1662)
- `<Filter>[attr]!=null</Filter>` now returns true if attr is not null (#1642)
- Added support for DBF `Logical` type: #1614
@ -50,9 +144,7 @@ For a complete change history, see the git log.
- Added support for setting zlib `Z_FIXED` strategy with format string: `png:z=fixed`
- Fixed handling of transparency level option in Octree-based PNG encoding (#1556)
- Faster rendering of rasters by reducing memory allocation of temporary buffers (#1516)
- Fixed handling of transparency level option in `octree` png encoding (#1556)
- Added ability to pass a pre-created collision detector to the cairo renderer (#1444)
@ -68,6 +160,24 @@ For a complete change history, see the git log.
now the combined layer extents will be again respected: they will be clipped to the maximum-extent if possible
and only when back-projecting fails for all layers will the maximum-extent be used as a fallback (#1473)
- Compile time flag called `PLUGIN_LINKING` to allow input datasource plugins to be statically linked with the mapnik library (#249)
- Fixed `dasharray` rendering in cairo backend (#1740)
- Fixed handling of `opacity` in svg rendering (#1744)
- Fixed uneven rendering of markers along lines (#1693)
- Fixed handling of extra bytes in some shapefile fields (#1605)
- Fixed handling (finally) of null shapes and partially corrupt shapefiles (#1630,#1621)
- Added ability to re-use `mapnik::image_32` and `mapnik::grid` by exposing a `clear` method (#1571)
- Added support for writing RGB (no A) png images by using the format string of `png:t=0` (#1559)
- Added experimental support for geometry simplification at symbolizer level (#1385)
## Mapnik 2.1.0
Released Aug 23, 2012
@ -215,7 +325,7 @@ Released April 10, 2012
- Workaround for boost interprocess compile error with recent gcc versions (#950,#1001,#1082)
- Fix possible memory corruption when using hextree mode for png color reduction (#1087)
- Fix possible memory corruption when using `hextree` mode for png color reduction (#1087)
- Fixed bug in shield line placement when dx/dy are used to shift the label relative to the placement point (Matt Amos) (#908)
@ -395,14 +505,14 @@ Released March 23, 2010
- PNG: fixed png256 for large images and some improvements to reduce color corruptions ([#522](https://github.com/mapnik/mapnik/issues/522))
- PNG: Added new quantization method for indexed png format using hextree with full support for alpha
- PNG: Added new quantization method for indexed png format using `hextree` with full support for alpha
channel. Also new method has some optimizations for color gradients common when using elevation based
rasters. By default old method using octree is used. (r1680, r1683, [#477](https://github.com/mapnik/mapnik/issues/477))
rasters. By default old method using `octree` is used. (r1680, r1683, [#477](https://github.com/mapnik/mapnik/issues/477))
- PNG: Added initial support for passing options to png writter like number of colors, transparency
support, quantization method and possibly other in future using type parameter. For example
"png8:c=128:t=1:m=h" limits palette to 128 colors, uses only binary transparency (0 - none,
1 - binary, 2 - full), and new method of quantization using hextree (h - hextree, o - octree).
1 - binary, 2 - full), and new method of quantization using `hextree` (h - `hextree`, o - `octree`).
Existing type "png256" can be also written using "png8:c=256:m=o:t=2" (r1680, r1683, [#477](https://github.com/mapnik/mapnik/issues/477))

View file

@ -65,10 +65,12 @@ Note: Python3k is supported, see: https://github.com/mapnik/mapnik/wiki/Python3k
Optional dependencies:
* Cairo - Graphics library for output formats like PDF, PS, and SVG
* Cairo >= 1.6.0 - Graphics library for output formats like PDF, PS, and SVG
- pkg-config - Required for building with cairo support
- pycairo - Python bindings for cairo
* libpq - PostgreSQL libraries (For PostGIS plugin support)
* PostgreSQL (for PostGIS plugin support)
- libpq - PostreSQL libraries
- pg_config - PostgreSQL installation capabilities
* libgdal - GDAL/OGR input (For gdal and ogr plugin support)
* libsqlite3 - SQLite input (needs RTree support builtin) (sqlite plugin support)
* libocci - Oracle input plugin support

View file

@ -68,7 +68,7 @@ check: test-local
demo:
@echo "*** Running rundemo.cpp…"
cd demo/c++; ./rundemo `mapnik-config --prefix`/lib/mapnik
cd demo/c++; ./rundemo `mapnik-config --prefix`
pep8:
# https://gist.github.com/1903033

View file

@ -27,4 +27,4 @@ See [INSTALL.md](https://github.com/mapnik/mapnik/blob/master/INSTALL.md) for in
# License
Mapnik software is free and is released under 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 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.

View file

@ -22,6 +22,7 @@ import sys
import re
import platform
from glob import glob
from copy import copy
from subprocess import Popen, PIPE
from SCons.SConf import SetCacheMode
import pickle
@ -35,6 +36,12 @@ except:
LIBDIR_SCHEMA_DEFAULT='lib'
severities = ['debug', 'warn', 'error', 'none']
DEFAULT_CC = "gcc"
DEFAULT_CXX = "g++"
if sys.platform == 'darwin':
DEFAULT_CC = "clang"
DEFAULT_CXX = "clang++"
py3 = None
# local file to hold custom user configuration variables
@ -55,30 +62,29 @@ DEFAULT_LINK_PRIORITY = ['internal','other','frameworks','user','system']
pretty_dep_names = {
'ociei':'Oracle database library | configure with OCCI_LIBS & OCCI_INCLUDES | more info: https://github.com/mapnik/mapnik/wiki//OCCI',
'ociei':'Oracle database library | configure with OCCI_LIBS & OCCI_INCLUDES | more info: https://github.com/mapnik/mapnik/wiki/OCCI',
'gdal':'GDAL C++ library | configured using gdal-config program | try setting GDAL_CONFIG SCons option | more info: https://github.com/mapnik/mapnik/wiki/GDAL',
'ogr':'OGR-enabled GDAL C++ Library | configured using gdal-config program | try setting GDAL_CONFIG SCons option | more info: https://github.com/mapnik/mapnik/wiki//OGR',
'geos_c':'GEOS Simple Geometry Specification C Library | configured with GEOS_LIB & GEOS_INCLUDE | more info: https://github.com/mapnik/mapnik/wiki//GEOS',
'ogr':'OGR-enabled GDAL C++ Library | configured using gdal-config program | try setting GDAL_CONFIG SCons option | more info: https://github.com/mapnik/mapnik/wiki/OGR',
'cairo':'Cairo C library | configured using pkg-config | try setting PKG_CONFIG_PATH SCons option',
'pycairo':'Python bindings to Cairo library | configured using pkg-config | try setting PKG_CONFIG_PATH SCons option',
'proj':'Proj.4 C Projections library | configure with PROJ_LIBS & PROJ_INCLUDES | more info: http://trac.osgeo.org/proj/',
'pg':'Postgres C Library required for PostGIS plugin | configure with pg_config program | more info: https://github.com/mapnik/mapnik/wiki//PostGIS',
'sqlite3':'SQLite3 C Library | configure with SQLITE_LIBS & SQLITE_INCLUDES | more info: https://github.com/mapnik/mapnik/wiki//SQLite',
'pg':'Postgres C Library required for PostGIS plugin | configure with pg_config program | more info: https://github.com/mapnik/mapnik/wiki/PostGIS',
'sqlite3':'SQLite3 C Library | configure with SQLITE_LIBS & SQLITE_INCLUDES | more info: https://github.com/mapnik/mapnik/wiki/SQLite',
'jpeg':'JPEG C library | configure with JPEG_LIBS & JPEG_INCLUDES',
'tiff':'TIFF C library | configure with TIFF_LIBS & TIFF_INCLUDES',
'png':'PNG C library | configure with PNG_LIBS & PNG_INCLUDES',
'icuuc':'ICU C++ library | configure with ICU_LIBS & ICU_INCLUDES or use ICU_LIB_NAME to specify custom lib name | more info: http://site.icu-project.org/',
'ltdl':'GNU Libtool | more info: http://www.gnu.org/software/libtool',
'harfbuzz':'HarfBuzz text shaping library | configure with HB_LIBS & HB_INCLUDES',
'z':'Z compression library | more info: http://www.zlib.net/',
'm':'Basic math library, part of C++ stlib',
'pkg-config':'pkg-config tool | more info: http://pkg-config.freedesktop.org',
'pg_config':'pg_config program | try setting PG_CONFIG SCons option',
'xml2-config':'xml2-config program | try setting XML2_CONFIG SCons option',
'libxml2':'libxml2 library | try setting XML2_CONFIG SCons option to point to location of xml2-config program',
'gdal-config':'gdal-config program | try setting GDAL_CONFIG SCons option',
'geos-config':'geos-config program | try setting GEOS_CONFIG SCons option',
'freetype-config':'freetype-config program | try setting FREETYPE_CONFIG SCons option',
'osm':'more info: https://github.com/mapnik/mapnik/wiki//OsmPlugin',
'curl':'libcurl is required for the "osm" plugin - more info: https://github.com/mapnik/mapnik/wiki//OsmPlugin',
'osm':'more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin',
'curl':'libcurl is required for the "osm" plugin - 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.',
'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)'
@ -91,22 +97,20 @@ PLUGINS = { # plugins with external dependencies
'postgis': {'default':True,'path':None,'inc':'libpq-fe.h','lib':'pq','lang':'C'},
'gdal': {'default':True,'path':None,'inc':'gdal_priv.h','lib':'gdal','lang':'C++'},
'ogr': {'default':True,'path':None,'inc':'ogrsf_frmts.h','lib':'gdal','lang':'C++'},
'geos': {'default':False,'path':None,'inc':'geos_c.h','lib':'geos_c','lang':'C'},
# configured with custom paths, hence 'path': PREFIX/INCLUDES/LIBS
'occi': {'default':False,'path':'OCCI','inc':'occi.h','lib':'ociei','lang':'C++'},
'sqlite': {'default':True,'path':'SQLITE','inc':'sqlite3.h','lib':'sqlite3','lang':'C'},
'rasterlite': {'default':False,'path':'RASTERLITE','inc':['sqlite3.h','rasterlite.h'],'lib':'rasterlite','lang':'C'},
# todo: osm plugin does also depend on libxml2 (but there is a separate check for that)
'osm': {'default':True,'path':None,'inc':'curl/curl.h','lib':'curl','lang':'C'},
'osm': {'default':False,'path':None,'inc':'curl/curl.h','lib':'curl','lang':'C'},
# plugins without external dependencies requiring CheckLibWithHeader...
'shape': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'},
'csv': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'},
'raster': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'},
'geojson': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'},
'kismet': {'default':False,'path':None,'inc':None,'lib':None,'lang':'C++'},
'python': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'},
'python': {'default':False,'path':None,'inc':None,'lib':None,'lang':'C++'},
}
@ -170,10 +174,14 @@ def shortest_name(libs):
name = lib
return name
def rm_path(item,set,_env):
for i in _env[set]:
if item in i:
_env[set].remove(i)
def sort_paths(items,priority):
"""Sort paths such that compiling and linking will globally prefer custom or local libs
over system libraries by fixing up the order libs are passed to gcc and the linker.
over system libraries by fixing up the order libs are passed to the compiler and the linker.
Ideally preference could be by-target instead of global, but our SCons implementation
is not currently utilizing different SCons build env()'s as we should.
@ -243,7 +251,7 @@ def pretty_dep(dep):
if pretty:
return '%s (%s)' % (dep,pretty)
elif 'boost' in dep:
return '%s (%s)' % (dep,'more info see: https://github.com/mapnik/mapnik/wiki//MapnikInstallation & 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
@ -258,15 +266,15 @@ opts = Variables()
opts.AddVariables(
# Compiler options
('CXX', 'The C++ compiler to use to compile mapnik (defaults to g++).', 'g++'),
('CC', 'The C compiler used for configure checks of C libs (defaults to gcc).', 'gcc'),
('CXX', 'The C++ compiler to use to compile mapnik', DEFAULT_CXX),
('CC', 'The C compiler used for configure checks of C libs.', DEFAULT_CC),
('CUSTOM_CXXFLAGS', 'Custom C++ flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>', ''),
('CUSTOM_DEFINES', 'Custom Compiler DEFINES, e.g. -DENABLE_THIS', ''),
('CUSTOM_CFLAGS', 'Custom C flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> (only used for configure checks)', ''),
('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>', ''),
EnumVariable('LINKING', "Set library format for libmapnik",'shared', ['shared','static']),
EnumVariable('RUNTIME_LINK', "Set preference for linking dependencies",'shared', ['shared','static']),
EnumVariable('OPTIMIZATION','Set g++ optimization level','3', ['0','1','2','3','4','s']),
EnumVariable('OPTIMIZATION','Set compiler optimization level','3', ['0','1','2','3','4','s']),
# Note: setting DEBUG=True will override any custom OPTIMIZATION level
BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'),
BoolVariable('DEBUG_UNDEFINED', 'Compile a version of Mapnik using clang/llvm undefined behavior asserts', 'False'),
@ -307,10 +315,9 @@ opts.AddVariables(
('XML2_CONFIG', 'The path to the xml2-config executable.', 'xml2-config'),
PathVariable('ICU_INCLUDES', 'Search path for ICU include files', '/usr/include', PathVariable.PathAccept),
PathVariable('ICU_LIBS','Search path for ICU include files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
('ICU_LIB_NAME', 'The library name for icu (such as icuuc, sicuuc, or icucore)', 'icuuc',
PathVariable.PathAccept),
PathVariable('LTDL_INCLUDES', 'Search path for libltdl (part of libtool) include files', '/usr/include', PathVariable.PathAccept),
PathVariable('LTDL_LIBS','Search path for libltdl (ltdl.h) library files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
('ICU_LIB_NAME', 'The library name for icu (such as icuuc, sicuuc, or icucore)', 'icuuc', PathVariable.PathAccept),
PathVariable('HB_INCLUDES', 'Search path for HarfBuzz include files', '/usr/include', PathVariable.PathAccept),
PathVariable('HB_LIBS','Search path for HarfBuzz include files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
BoolVariable('PNG', 'Build Mapnik with PNG read and write support', 'True'),
PathVariable('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include', PathVariable.PathAccept),
PathVariable('PNG_LIBS','Search path for libpng library files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
@ -331,9 +338,9 @@ PathVariable.PathAccept),
BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'False'),
BoolVariable('CPP_TESTS', 'Compile the C++ tests', 'True'),
BoolVariable('BENCHMARK', 'Compile the C++ benchmark scripts', 'False'),
# Variables for optional dependencies
('GEOS_CONFIG', 'The path to the geos-config executable.', 'geos-config'),
# Note: cairo and and pycairo are optional but configured automatically through pkg-config
# Therefore, we use a single boolean for whether to attempt to build cairo support.
BoolVariable('CAIRO', 'Attempt to build with Cairo rendering support', 'True'),
@ -353,6 +360,9 @@ PathVariable.PathAccept),
BoolVariable('ENABLE_STATS', 'Enable global statistics during map processing', 'False'),
('DEFAULT_LOG_SEVERITY', 'The default severity of the logger (eg. ' + ', '.join(severities) + ')', 'error'),
# Plugin linking
EnumVariable('PLUGIN_LINKING', "Set plugin linking with libmapnik", 'shared', ['shared','static']),
# Other variables
BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'),
('SYSTEM_FONTS','Provide location for python bindings to register fonts (if provided then the bundled DejaVu fonts are not installed)',''),
@ -400,6 +410,7 @@ pickle_store = [# Scons internal variables
'PLUGINS',
'ABI_VERSION',
'MAPNIK_VERSION_STRING',
'MAPNIK_VERSION',
'PLATFORM',
'BOOST_ABI',
'BOOST_APPEND',
@ -434,12 +445,13 @@ pickle_store = [# Scons internal variables
'LIBMAPNIK_DEFINES',
'LIBMAPNIK_CXXFLAGS',
'CAIRO_LIBPATHS',
'CAIRO_LINKFLAGS',
'CAIRO_ALL_LIBS',
'CAIRO_CPPPATHS',
'SVG_RENDERER',
'SQLITE_LINKFLAGS',
'BOOST_LIB_VERSION_FROM_HEADER',
'BIGINT'
'BIGINT',
'HOST'
]
# Add all other user configurable options to pickle pickle_store
@ -552,7 +564,7 @@ def parse_config(context, config, checks='--libs --cflags'):
env = context.env
tool = config.lower().replace('_','-')
toolname = tool
if config in ('GDAL_CONFIG','GEOS_CONFIG'):
if config in ('GDAL_CONFIG'):
toolname += ' %s' % checks
context.Message( 'Checking for %s... ' % toolname)
cmd = '%s %s' % (env[config],checks)
@ -581,7 +593,7 @@ def parse_config(context, config, checks='--libs --cflags'):
ret = False
print ' (xml2-config not found!)'
if not parsed:
if config in ('GDAL_CONFIG','GEOS_CONFIG'):
if config in ('GDAL_CONFIG'):
# optional deps...
env['SKIPPED_DEPS'].append(tool)
conf.rollback_option(config)
@ -729,25 +741,23 @@ def FindBoost(context, prefixes, thread_flag):
msg = str()
if BOOST_LIB_DIR:
msg += '\n *libs found: %s' % BOOST_LIB_DIR
msg += '\nFound boost libs: %s' % BOOST_LIB_DIR
env['BOOST_LIBS'] = BOOST_LIB_DIR
else:
env['BOOST_LIBS'] = '/usr/' + env['LIBDIR_SCHEMA']
msg += '\n *using default boost lib dir: %s' % env['BOOST_LIBS']
msg += '\nUsing default boost lib dir: %s' % env['BOOST_LIBS']
if BOOST_INCLUDE_DIR:
msg += '\n *headers found: %s' % BOOST_INCLUDE_DIR
msg += '\nFound boost headers: %s' % BOOST_INCLUDE_DIR
env['BOOST_INCLUDES'] = BOOST_INCLUDE_DIR
else:
env['BOOST_INCLUDES'] = '/usr/include'
msg += '\n *using default boost include dir: %s' % env['BOOST_INCLUDES']
msg += '\nUsing default boost include dir: %s' % env['BOOST_INCLUDES']
if not env['BOOST_TOOLKIT'] and not env['BOOST_ABI'] and not env['BOOST_VERSION']:
if BOOST_APPEND:
msg += '\n *lib naming extension found: %s' % BOOST_APPEND
msg += '\nFound boost lib name extension: %s' % BOOST_APPEND
env['BOOST_APPEND'] = BOOST_APPEND
else:
msg += '\n *no lib naming extension found'
else:
# Creating BOOST_APPEND according to the Boost library naming order,
# which goes <toolset>-<threading>-<abi>-<version>. See:
@ -762,7 +772,7 @@ def FindBoost(context, prefixes, thread_flag):
# Boost libraries.
if len(append_params) > 1:
env['BOOST_APPEND'] = '-'.join(append_params)
msg += '\n *using boost lib naming: %s' % env['BOOST_APPEND']
msg += '\nFound boost lib name extension: %s' % env['BOOST_APPEND']
env.AppendUnique(CPPPATH = os.path.realpath(env['BOOST_INCLUDES']))
env.AppendUnique(LIBPATH = os.path.realpath(env['BOOST_LIBS']))
@ -799,6 +809,32 @@ int main()
context.Result(ret)
return ret
def CheckCairoHasFreetype(context, silent=False):
if not silent:
context.Message('Checking for cairo freetype font support ... ')
context.env.AppendUnique(CPPPATH=copy(env['CAIRO_CPPPATHS']))
ret = context.TryRun("""
#include <cairo-features.h>
int main()
{
#ifdef CAIRO_HAS_FT_FONT
return 0;
#else
return 1;
#endif
}
""", '.cpp')[0]
if silent:
context.did_show_result=1
context.Result(ret)
for item in env['CAIRO_CPPPATHS']:
rm_path(item,'CPPPATH',context.env)
return ret
def GetBoostLibVersion(context):
ret = context.TryRun("""
@ -869,8 +905,7 @@ int main()
def boost_regex_has_icu(context):
if env['RUNTIME_LINK'] == 'static':
context.env.Append(LIBS='icui18n')
context.env.Append(LIBS='icudata')
context.env.AppendUnique(LIBS='icudata')
ret = context.TryRun("""
#include <boost/regex/icu.hpp>
@ -897,7 +932,7 @@ int main()
return True
return False
def sqlite_has_rtree(context):
def sqlite_has_rtree(context, silent=False):
""" check an sqlite3 install has rtree support.
PRAGMA compile_options;
@ -934,7 +969,10 @@ int main()
}
""", '.c')
context.Message('Checking if SQLite supports RTREE... ')
if not silent:
context.Message('Checking if SQLite supports RTREE... ')
if silent:
context.did_show_result=1
context.Result(ret[0])
if ret[0]:
return True
@ -946,6 +984,7 @@ conf_tests = { 'prioritize_paths' : prioritize_paths,
'CheckPKGVersion' : CheckPKGVersion,
'FindBoost' : FindBoost,
'CheckBoost' : CheckBoost,
'CheckCairoHasFreetype' : CheckCairoHasFreetype,
'GetBoostLibVersion' : GetBoostLibVersion,
'GetMapnikLibVersion' : GetMapnikLibVersion,
'parse_config' : parse_config,
@ -1007,11 +1046,12 @@ if not preconfigured:
env['SKIPPED_DEPS'] = []
env['HAS_CAIRO'] = False
env['CAIRO_LIBPATHS'] = []
env['CAIRO_LINKFLAGS'] = []
env['CAIRO_ALL_LIBS'] = []
env['CAIRO_CPPPATHS'] = []
env['HAS_PYCAIRO'] = False
env['HAS_LIBXML2'] = False
env['LIBMAPNIK_LIBS'] = []
env['LIBMAPNIK_LINKFLAGS'] = []
env['LIBMAPNIK_CPPATHS'] = []
env['LIBMAPNIK_DEFINES'] = []
env['LIBMAPNIK_CXXFLAGS'] = []
@ -1090,7 +1130,7 @@ if not preconfigured:
SOLARIS = env['PLATFORM'] == 'SunOS'
env['SUNCC'] = SOLARIS and env['CXX'].startswith('CC')
# If the Sun Studio C++ compiler (`CC`) is used instead of GCC.
# If the Sun Studio C++ compiler (`CC`) is used instead of gcc.
if env['SUNCC']:
env['CC'] = 'cc'
# To be compatible w/Boost everything needs to be compiled
@ -1115,7 +1155,7 @@ if not preconfigured:
# Adding the required prerequisite library directories to the include path for
# compiling and the library path for linking, respectively.
for required in ('ICU', 'SQLITE', 'LTDL'):
for required in ('ICU', 'SQLITE', 'HB'):
inc_path = env['%s_INCLUDES' % required]
lib_path = env['%s_LIBS' % required]
env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
@ -1137,11 +1177,13 @@ if not preconfigured:
# https://github.com/mapnik/mapnik/issues/913
if conf.parse_config('XML2_CONFIG',checks='--cflags'):
env['HAS_LIBXML2'] = True
else:
env['MISSING_DEPS'].append('libxml2')
LIBSHEADERS = [
['z', 'zlib.h', True,'C'],
['ltdl', 'ltdl.h', True,'C'],
[env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'],
['harfbuzz', 'harfbuzz/hb.h',True,'C++'],
]
if env['JPEG']:
@ -1186,7 +1228,7 @@ if not preconfigured:
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
if env['PRIORITIZE_LINKING']:
conf.prioritize_paths(silent=False)
conf.prioritize_paths(silent=True)
if not env['HOST']:
for libname, headers, required, lang in LIBSHEADERS:
@ -1214,52 +1256,63 @@ if not preconfigured:
conf.FindBoost(BOOST_SEARCH_PREFIXES,thread_flag)
env['BOOST_LIB_VERSION_FROM_HEADER'] = conf.GetBoostLibVersion()
# The other required boost headers.
BOOST_LIBSHEADERS = [
['system', 'boost/system/system_error.hpp', True],
['filesystem', 'boost/filesystem/operations.hpp', True],
['regex', 'boost/regex.hpp', True],
['program_options', 'boost/program_options.hpp', False]
]
if env['THREADING'] == 'multi':
BOOST_LIBSHEADERS.append(['thread', 'boost/thread/mutex.hpp', True])
# on solaris the configure checks for boost_thread
# require the -pthreads flag to be able to check for
# threading support, so we add as a global library instead
# of attaching to cxxflags after configure
if env['PLATFORM'] == 'SunOS':
env.Append(CXXFLAGS = '-pthreads')
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
if env['PRIORITIZE_LINKING']:
conf.prioritize_paths()
has_boost_devel = True
if not env['HOST']:
# if the user is not setting custom boost configuration
# enforce boost version greater than or equal to BOOST_MIN_VERSION
if not conf.CheckBoost(BOOST_MIN_VERSION):
color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') )
color_print(1,'Boost version %s or greater is required' % BOOST_MIN_VERSION)
if not env['BOOST_VERSION']:
env['MISSING_DEPS'].append('boost version >=%s' % BOOST_MIN_VERSION)
else:
color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') )
if not conf.CheckHeader(header='boost/version.hpp',language='C++'):
env['MISSING_DEPS'].append('boost development headers')
has_boost_devel = False
if not env['HOST']:
for count, libinfo in enumerate(BOOST_LIBSHEADERS):
if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0],env['BOOST_APPEND']), libinfo[1], 'C++'):
if libinfo[2]:
color_print(1,'Could not find required header or shared library for boost %s' % libinfo[0])
env['MISSING_DEPS'].append('boost ' + libinfo[0])
else:
color_print(4,'Could not find optional header or shared library for boost %s' % libinfo[0])
env['SKIPPED_DEPS'].append('boost ' + libinfo[0])
if has_boost_devel:
if not env['HOST']:
env['BOOST_LIB_VERSION_FROM_HEADER'] = conf.GetBoostLibVersion()
if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']:
# The other required boost headers.
BOOST_LIBSHEADERS = [
['system', 'boost/system/system_error.hpp', True],
['filesystem', 'boost/filesystem/operations.hpp', True],
['regex', 'boost/regex.hpp', True],
['program_options', 'boost/program_options.hpp', False]
]
if env['THREADING'] == 'multi':
BOOST_LIBSHEADERS.append(['thread', 'boost/thread/mutex.hpp', True])
# on solaris the configure checks for boost_thread
# require the -pthreads flag to be able to check for
# threading support, so we add as a global library instead
# of attaching to cxxflags after configure
if env['PLATFORM'] == 'SunOS':
env.Append(CXXFLAGS = '-pthreads')
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
if env['PRIORITIZE_LINKING']:
conf.prioritize_paths(silent=True)
if not env['HOST']:
# if the user is not setting custom boost configuration
# enforce boost version greater than or equal to BOOST_MIN_VERSION
if not conf.CheckBoost(BOOST_MIN_VERSION):
color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') )
color_print(1,'Boost version %s or greater is required' % BOOST_MIN_VERSION)
if not env['BOOST_VERSION']:
env['MISSING_DEPS'].append('boost version >= %s' % BOOST_MIN_VERSION)
else:
color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') )
if not env['HOST']:
for count, libinfo in enumerate(BOOST_LIBSHEADERS):
if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0],env['BOOST_APPEND']), libinfo[1], 'C++'):
if libinfo[2]:
color_print(1,'Could not find required header or shared library for boost %s' % libinfo[0])
env['MISSING_DEPS'].append('boost ' + libinfo[0])
else:
color_print(4,'Could not find optional header or shared library for boost %s' % libinfo[0])
env['SKIPPED_DEPS'].append('boost ' + libinfo[0])
if not env['HOST'] and env['ICU_LIB_NAME'] not in env['MISSING_DEPS']:
# http://lists.boost.org/Archives/boost/2009/03/150076.php
# we need libicui18n if using static boost libraries, so it is
# important to try this check with the library linked
env.AppendUnique(LIBS='icui18n')
if conf.boost_regex_has_icu():
# TODO - should avoid having this be globally defined...
env.Append(CPPDEFINES = '-DBOOST_REGEX_HAS_ICU')
@ -1268,85 +1321,93 @@ if not preconfigured:
env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
SQLITE_HAS_RTREE = None
if env['HOST']:
SQLITE_HAS_RTREE = True
CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0')
if len(env['REQUESTED_PLUGINS']):
color_print(4,'Checking for requested plugins dependencies...')
for plugin in env['REQUESTED_PLUGINS']:
details = env['PLUGINS'][plugin]
if plugin == 'gdal':
if conf.parse_config('GDAL_CONFIG',checks='--libs'):
conf.parse_config('GDAL_CONFIG',checks='--cflags')
libname = conf.get_pkg_lib('GDAL_CONFIG','gdal')
if libname:
details['lib'] = libname
elif plugin == 'postgis':
conf.parse_pg_config('PG_CONFIG')
elif plugin == 'ogr':
if conf.ogr_enabled():
if not 'gdal' in env['REQUESTED_PLUGINS']:
conf.parse_config('GDAL_CONFIG',checks='--libs')
if env['HOST']:
for plugin in env['REQUESTED_PLUGINS']:
details = env['PLUGINS'][plugin]
if details['lib']:
env.AppendUnique(LIBS=details['lib'])
else:
color_print(4,'Checking for requested plugins dependencies...')
for plugin in env['REQUESTED_PLUGINS']:
details = env['PLUGINS'][plugin]
if plugin == 'gdal':
if conf.parse_config('GDAL_CONFIG',checks='--libs'):
conf.parse_config('GDAL_CONFIG',checks='--cflags')
libname = conf.get_pkg_lib('GDAL_CONFIG','ogr')
if libname:
details['lib'] = libname
elif plugin == 'geos':
if conf.parse_config('GEOS_CONFIG',checks='--ldflags --cflags'):
lgeos_c = env['PLUGINS']['geos']['lib']
env.Append(LIBS = lgeos_c)
libname = conf.get_pkg_lib('GDAL_CONFIG','gdal')
if libname:
details['lib'] = libname
elif plugin == 'postgis':
conf.parse_pg_config('PG_CONFIG')
elif plugin == 'ogr':
if conf.ogr_enabled():
if not 'gdal' in env['REQUESTED_PLUGINS']:
conf.parse_config('GDAL_CONFIG',checks='--libs')
conf.parse_config('GDAL_CONFIG',checks='--cflags')
libname = conf.get_pkg_lib('GDAL_CONFIG','ogr')
if libname:
details['lib'] = libname
elif details['path'] and details['lib'] and details['inc']:
backup = env.Clone().Dictionary()
# Note, the 'delete_existing' keyword makes sure that these paths are prepended
# to the beginning of the path list even if they already exist
incpath = env['%s_INCLUDES' % details['path']]
libpath = env['%s_LIBS' % details['path']]
env.PrependUnique(CPPPATH = os.path.realpath(incpath),delete_existing=True)
env.PrependUnique(LIBPATH = os.path.realpath(libpath),delete_existing=True)
if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']):
env.Replace(**backup)
env['SKIPPED_DEPS'].append(details['lib'])
if plugin == 'sqlite':
SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
sqlite_backup = env.Clone().Dictionary()
# if statically linking, on linux we likely
# need to link sqlite to pthreads and dl
if env['RUNTIME_LINK'] == 'static':
if CHECK_PKG_CONFIG and conf.CheckPKG('sqlite3'):
sqlite_env = env.Clone()
try:
sqlite_env.ParseConfig('pkg-config --static --libs sqlite3')
for lib in sqlite_env['LIBS']:
if not lib in env['LIBS']:
env["SQLITE_LINKFLAGS"].append(lib)
env.Append(LIBS=lib)
except OSError,e:
pass
if SQLITE_HAS_RTREE is None:
SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
if not SQLITE_HAS_RTREE:
env.Replace(**sqlite_backup)
if details['lib'] in env['LIBS']:
env['LIBS'].remove(details['lib'])
env['SKIPPED_DEPS'].append('sqlite_rtree')
else:
env.Replace(**sqlite_backup)
elif details['lib'] and details['inc']:
if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']):
env['SKIPPED_DEPS'].append(details['lib'])
elif details['path'] and details['lib'] and details['inc']:
backup = env.Clone().Dictionary()
# Note, the 'delete_existing' keyword makes sure that these paths are prepended
# to the beginning of the path list even if they already exist
incpath = env['%s_INCLUDES' % details['path']]
libpath = env['%s_LIBS' % details['path']]
env.PrependUnique(CPPPATH = os.path.realpath(incpath),delete_existing=True)
env.PrependUnique(LIBPATH = os.path.realpath(libpath),delete_existing=True)
if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']):
env.Replace(**backup)
env['SKIPPED_DEPS'].append(details['lib'])
if plugin == 'sqlite':
sqlite_backup = env.Clone().Dictionary()
# re-append the local paths for mapnik sources to the beginning of the list
# to make sure they come before any plugins that were 'prepended'
env.PrependUnique(CPPPATH = '#include', delete_existing=True)
env.PrependUnique(CPPPATH = '#', delete_existing=True)
env.PrependUnique(LIBPATH = '#src', delete_existing=True)
# if statically linking, on linux we likely
# need to link sqlite to pthreads and dl
if env['RUNTIME_LINK'] == 'static':
if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('sqlite3'):
sqlite_env = env.Clone()
try:
sqlite_env.ParseConfig('pkg-config --static --libs sqlite3')
for lib in sqlite_env['LIBS']:
if not lib in env['LIBS']:
env["SQLITE_LINKFLAGS"].append(lib)
env.Append(LIBS=lib)
except OSError,e:
pass
if not conf.sqlite_has_rtree():
env.Replace(**sqlite_backup)
if details['lib'] in env['LIBS']:
env['LIBS'].remove(details['lib'])
env['SKIPPED_DEPS'].append('sqlite_rtree')
else:
env.Replace(**sqlite_backup)
elif details['lib'] and details['inc']:
if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']):
env['SKIPPED_DEPS'].append(details['lib'])
# re-append the local paths for mapnik sources to the beginning of the list
# to make sure they come before any plugins that were 'prepended'
env.PrependUnique(CPPPATH = '#include', delete_existing=True)
env.PrependUnique(CPPPATH = '#', delete_existing=True)
env.PrependUnique(LIBPATH = '#src', delete_existing=True)
if env['PGSQL2SQLITE']:
if 'sqlite3' not in env['LIBS']:
env.AppendUnique(LIBS='sqlite3')
env.AppendUnique(CPPPATH = os.path.realpath(env['SQLITE_INCLUDES']))
env.AppendUnique(LIBPATH = os.path.realpath(env['SQLITE_LIBS']))
if not conf.sqlite_has_rtree():
env['SKIPPED_DEPS'].append('pgsql2sqlite_rtree')
env['PGSQL2SQLITE'] = False
if not env['HOST']:
if env['PGSQL2SQLITE']:
if 'sqlite3' not in env['LIBS']:
env.AppendUnique(LIBS='sqlite3')
env.AppendUnique(CPPPATH = os.path.realpath(env['SQLITE_INCLUDES']))
env.AppendUnique(LIBPATH = os.path.realpath(env['SQLITE_LIBS']))
if not SQLITE_HAS_RTREE:
env['SKIPPED_DEPS'].append('pgsql2sqlite_rtree')
env['PGSQL2SQLITE'] = False
# we rely on an internal, patched copy of agg with critical fixes
# prepend to make sure we link locally
@ -1375,15 +1436,15 @@ if not preconfigured:
#os.path.join(c_inc,'include/libpng'),
]
)
env["CAIRO_LINKFLAGS"] = ['cairo']
env["CAIRO_ALL_LIBS"] = ['cairo']
if env['RUNTIME_LINK'] == 'static':
env["CAIRO_LINKFLAGS"].extend(
env["CAIRO_ALL_LIBS"].extend(
['pixman-1','expat','fontconfig','iconv']
)
# todo - run actual checkLib?
env['HAS_CAIRO'] = True
else:
if not conf.CheckPKGConfig('0.15.0'):
if not CHECK_PKG_CONFIG:
env['HAS_CAIRO'] = False
env['SKIPPED_DEPS'].append('pkg-config')
env['SKIPPED_DEPS'].append('cairo')
@ -1400,7 +1461,7 @@ if not preconfigured:
cairo_env.ParseConfig(cmd)
for lib in cairo_env['LIBS']:
if not lib in env['LIBS']:
env["CAIRO_LINKFLAGS"].append(lib)
env["CAIRO_ALL_LIBS"].append(lib)
for lpath in cairo_env['LIBPATH']:
if not lpath in env['LIBPATH']:
env["CAIRO_LIBPATHS"].append(lpath)
@ -1417,6 +1478,11 @@ if not preconfigured:
else:
color_print(4,'Not building with cairo support, pass CAIRO=True to enable')
if not env['HOST'] and env['HAS_CAIRO']:
if not conf.CheckCairoHasFreetype():
env['SKIPPED_DEPS'].append('cairo')
env['HAS_CAIRO'] = False
if 'python' in env['BINDINGS'] or 'python' in env['REQUESTED_PLUGINS']:
if not os.access(env['PYTHON'], os.X_OK):
color_print(1,"Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON'])
@ -1479,7 +1545,7 @@ if not preconfigured:
else:
env['PYTHON_IS_64BIT'] = False
if 'python' in env['BINDINGS']:
if has_boost_devel and 'python' in env['BINDINGS']:
if py3 and env['BOOST_PYTHON_LIB'] == 'boost_python':
env['BOOST_PYTHON_LIB'] = 'boost_python3%s' % env['BOOST_APPEND']
elif env['BOOST_PYTHON_LIB'] == 'boost_python':
@ -1490,7 +1556,7 @@ if not preconfigured:
env['MISSING_DEPS'].append('boost python')
if env['CAIRO']:
if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'):
if CHECK_PKG_CONFIG and conf.CheckPKG('pycairo'):
env['HAS_PYCAIRO'] = True
else:
env['SKIPPED_DEPS'].extend(['pycairo'])
@ -1512,7 +1578,7 @@ if not preconfigured:
color_print(4," $ sudo python scons/scons.py install")
color_print(4,"\nTo view available path variables:\n $ python scons/scons.py --help or -h")
color_print(4,'\nTo view overall SCons help options:\n $ python scons/scons.py --help-options or -H\n')
color_print(4,'More info: https://github.com/mapnik/mapnik/wiki//MapnikInstallation')
color_print(4,'More info: https://github.com/mapnik/mapnik/wiki/Mapnik-Installation')
if not HELP_REQUESTED:
Exit(1)
else:
@ -1532,19 +1598,24 @@ if not preconfigured:
color_print(4,"Did not use user config file, no custom path variables will be saved...")
if env['SKIPPED_DEPS']:
color_print(3,'\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:\n - %s' % '\n - '.join([pretty_dep(dep) for dep in env['SKIPPED_DEPS']]))
print
# fetch the mapnik version header in order to set the
# ABI version used to build libmapnik.so on linux in src/build.py
abi = conf.GetMapnikLibVersion()
abi_fallback = "2.2.0-pre"
abi = None
abi_fallback = "3.0.0-pre"
if not env['HOST']:
abi = conf.GetMapnikLibVersion()
if not abi:
color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback)
if not env['HOST']:
color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback)
abi = abi_fallback
env['ABI_VERSION'] = abi.replace('-pre','').split('.')
abi_no_pre = abi.replace('-pre','').split('.')
env['ABI_VERSION'] = abi_no_pre
env['MAPNIK_VERSION_STRING'] = abi
env['MAPNIK_VERSION'] = str(int(abi_no_pre[0])*100000+int(abi_no_pre[1])*100+int(abi_no_pre[2]))
# Common DEFINES.
env.Append(CPPDEFINES = '-D%s' % env['PLATFORM'].upper())
@ -1601,12 +1672,20 @@ if not preconfigured:
env.Append(CPPDEFINES = ndebug_defines)
if not env['SUNCC']:
# Common flags for GCC.
gcc_cxx_flags = '-ansi -Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread)
# Common flags for CXX compiler.
common_cxx_flags = '-ansi -Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread)
# https://github.com/mapnik/mapnik/issues/1835
if sys.platform == 'darwin' and env['CXX'] == 'g++':
common_cxx_flags += '-fpermissive '
if env['DEBUG']:
env.Append(CXXFLAGS = gcc_cxx_flags + '-O0 -fno-inline')
env.Append(CXXFLAGS = common_cxx_flags + '-O0 -fno-inline')
else:
env.Append(CXXFLAGS = gcc_cxx_flags + '-O%s -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts' % (env['OPTIMIZATION']))
# TODO - add back -fvisibility-inlines-hidden
# https://github.com/mapnik/mapnik/issues/1863
env.Append(CXXFLAGS = common_cxx_flags + '-O%s -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts' % (env['OPTIMIZATION']))
if env['DEBUG_UNDEFINED']:
env.Append(CXXFLAGS = '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv -fwrapv')
@ -1636,7 +1715,7 @@ if not preconfigured:
# if requested, sort LIBPATH and CPPPATH one last time before saving...
if env['PRIORITIZE_LINKING']:
conf.prioritize_paths()
conf.prioritize_paths(silent=True)
# finish config stage and pickle results
env = conf.Finish()
@ -1694,15 +1773,11 @@ if not HELP_REQUESTED:
p = env['PATH_REMOVE']
if p in env['ENV']['PATH']:
env['ENV']['PATH'].replace(p,'')
def rm_path(set):
for i in env[set]:
if p in i:
env[set].remove(i)
rm_path('LIBPATH')
rm_path('CPPPATH')
rm_path('CXXFLAGS')
rm_path('CAIRO_LIBPATHS')
rm_path('CAIRO_CPPPATHS')
rm_path(p,'LIBPATH',env)
rm_path(p,'CPPPATH',env)
rm_path(p,'CXXFLAGS',env)
rm_path(p,'CAIRO_LIBPATHS',env)
rm_path(p,'CAIRO_CPPPATHS',env)
if env['PATH_REPLACE']:
searches,replace = env['PATH_REPLACE'].split(':')
@ -1725,11 +1800,6 @@ if not HELP_REQUESTED:
Export('env')
plugin_base = env.Clone()
# for this to work you need:
# if __GNUC__ >= 4
# define MAPNIK_EXP __attribute__ ((visibility ("default")))
#plugin_base.Append(CXXFLAGS='-fvisibility=hidden')
#plugin_base.Append(CXXFLAGS='-fvisibility-inlines-hidden')
Export('plugin_base')
@ -1759,60 +1829,69 @@ if not HELP_REQUESTED:
# Build the requested and able-to-be-compiled input plug-ins
GDAL_BUILT = False
OGR_BUILT = False
for plugin in env['REQUESTED_PLUGINS']:
details = env['PLUGINS'][plugin]
if details['lib'] in env['LIBS']:
SConscript('plugins/input/%s/build.py' % plugin)
if plugin == 'ogr': OGR_BUILT = True
if plugin == 'gdal': GDAL_BUILT = True
if plugin == 'ogr' or plugin == 'gdal':
if GDAL_BUILT and OGR_BUILT:
env['LIBS'].remove(details['lib'])
else:
env['LIBS'].remove(details['lib'])
elif not details['lib']:
# build internal shape and raster plugins
SConscript('plugins/input/%s/build.py' % plugin)
else:
color_print(1,"Notice: dependencies not met for plugin '%s', not building..." % plugin)
# also clear out locally built target
for plugin in env['PLUGINS']:
if env['PLUGIN_LINKING'] == 'static' or plugin not in env['REQUESTED_PLUGINS']:
if os.path.exists('plugins/input/%s.input' % plugin):
os.unlink('plugins/input/%s.input' % plugin)
elif plugin in env['REQUESTED_PLUGINS']:
details = env['PLUGINS'][plugin]
if details['lib'] in env['LIBS']:
if env['PLUGIN_LINKING'] == 'shared':
SConscript('plugins/input/%s/build.py' % plugin)
if plugin == 'ogr': OGR_BUILT = True
if plugin == 'gdal': GDAL_BUILT = True
if plugin == 'ogr' or plugin == 'gdal':
if GDAL_BUILT and OGR_BUILT:
env['LIBS'].remove(details['lib'])
else:
env['LIBS'].remove(details['lib'])
elif not details['lib']:
if env['PLUGIN_LINKING'] == 'shared':
# build internal datasource input plugins
SConscript('plugins/input/%s/build.py' % plugin)
else:
color_print(1,"Notice: dependencies not met for plugin '%s', not building..." % plugin)
if os.path.exists('plugins/input/%s.input' % plugin):
os.unlink('plugins/input/%s.input' % plugin)
create_uninstall_target(env, env['MAPNIK_LIB_DIR_DEST'], False)
create_uninstall_target(env, env['MAPNIK_INPUT_PLUGINS_DEST'] , False)
# before installing plugins, wipe out any previously
# installed plugins that we are no longer building
if 'install' in COMMAND_LINE_TARGETS:
# if statically linking plugins still make sure
# to create the dynamic plugins directory
if env['PLUGIN_LINKING'] == 'static':
if not os.path.exists(env['MAPNIK_INPUT_PLUGINS_DEST']):
os.makedirs(env['MAPNIK_INPUT_PLUGINS_DEST'])
# before installing plugins, wipe out any previously
# installed plugins that we are no longer building
for plugin in PLUGINS.keys():
if plugin not in env['REQUESTED_PLUGINS']:
plugin_path = os.path.join(env['MAPNIK_INPUT_PLUGINS_DEST'],'%s.input' % plugin)
if os.path.exists(plugin_path):
color_print(3,"Notice: removing out of date plugin: '%s'" % plugin_path)
plugin_path = os.path.join(env['MAPNIK_INPUT_PLUGINS_DEST'],'%s.input' % plugin)
if os.path.exists(plugin_path):
if plugin not in env['REQUESTED_PLUGINS'] or env['PLUGIN_LINKING'] == 'static':
color_print(4,"Notice: removing out of date plugin: '%s'" % plugin_path)
os.unlink(plugin_path)
# Build the c++ rundemo app if requested
if env['DEMO']:
SConscript('demo/c++/build.py')
if not env['HOST']:
if env['DEMO']:
SConscript('demo/c++/build.py')
# Build shapeindex and remove its dependency from the LIBS
if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']:
if env['SHAPEINDEX']:
SConscript('utils/shapeindex/build.py')
# Build the pgsql2psqlite app if requested
if env['PGSQL2SQLITE']:
SConscript('utils/pgsql2sqlite/build.py')
if env['SVG2PNG']:
SConscript('utils/svg2png/build.py')
# devtools not ready for public
#SConscript('utils/ogrindex/build.py')
env['LIBS'].remove('boost_program_options%s' % env['BOOST_APPEND'])
else :
color_print(1,"WARNING: Cannot find boost_program_options. 'shapeindex' and other command line programs will not be available")
if not env['HOST']:
if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']:
if env['SHAPEINDEX']:
SConscript('utils/shapeindex/build.py')
# Build the pgsql2psqlite app if requested
if env['PGSQL2SQLITE']:
SConscript('utils/pgsql2sqlite/build.py')
if env['SVG2PNG']:
SConscript('utils/svg2png/build.py')
# devtools not ready for public
#SConscript('utils/ogrindex/build.py')
env['LIBS'].remove('boost_program_options%s' % env['BOOST_APPEND'])
else :
color_print(1,"WARNING: Cannot find boost_program_options. 'shapeindex' and other command line programs will not be available")
# Build the Python bindings
if 'python' in env['BINDINGS']:
@ -1828,13 +1907,13 @@ if not HELP_REQUESTED:
SConscript('fonts/build.py')
# build C++ tests
if env['CPP_TESTS']:
SConscript('tests/cpp_tests/build.py')
SConscript('tests/cpp_tests/build.py')
if env['SVG_RENDERER']:
SConscript('tests/cpp_tests/svg_renderer_tests/build.py')
if env['CPP_TESTS'] and env['SVG_RENDERER']:
SConscript('tests/cpp_tests/svg_renderer_tests/build.py')
SConscript('benchmark/build.py')
if env['BENCHMARK']:
SConscript('benchmark/build.py')
# install pkg-config script and mapnik-config script
SConscript('utils/mapnik-config/build.py')
@ -1845,11 +1924,14 @@ if not HELP_REQUESTED:
# if requested, build the sample input plugins
if env['SAMPLE_INPUT_PLUGINS']:
SConscript('plugins/input/templates/helloworld/build.py')
elif 'install' in COMMAND_LINE_TARGETS:
plugin_path = os.path.join(env['MAPNIK_INPUT_PLUGINS_DEST'],'hello.input')
if os.path.exists(plugin_path):
color_print(3,"Notice: removing out of date plugin: '%s'" % plugin_path)
os.unlink(plugin_path)
else:
if 'install' in COMMAND_LINE_TARGETS:
plugin_path = os.path.join(env['MAPNIK_INPUT_PLUGINS_DEST'],'hello.input')
if os.path.exists(plugin_path):
color_print(4,"Notice: removing out of date plugin: '%s'" % plugin_path)
os.unlink(plugin_path)
if os.path.exists('plugins/input/templates/hello.input'):
os.unlink('plugins/input/templates/hello.input')
# update linux project files
if env['PLATFORM'] == 'Linux':

View file

@ -12,6 +12,8 @@
#include <sstream>
#include <cstdio>
#include <set>
#include <stdexcept>
// boost
#include <boost/version.hpp>
@ -708,6 +710,39 @@ struct test12
}
};
#include <mapnik/font_engine_freetype.hpp>
#include <boost/format.hpp>
struct test13
{
unsigned iter_;
unsigned threads_;
test13(unsigned iterations,
unsigned threads)
: iter_(iterations),
threads_(threads)
{}
bool validate()
{
return true;
}
void operator()()
{
mapnik::freetype_engine engine;
unsigned long count = 0;
for (unsigned i=0;i<iter_;++i)
{
BOOST_FOREACH( std::string const& name, mapnik::freetype_engine::face_names())
{
mapnik::face_ptr f = engine.create_face(name);
if (f) ++count;
}
}
}
};
int main( int argc, char** argv)
{
if (argc > 0) {
@ -864,6 +899,15 @@ int main( int argc, char** argv)
benchmark(runner,"clipping polygon with mapnik::polygon_clipper");
}
{
bool success = mapnik::freetype_engine::register_fonts("./fonts", true);
if (!success) {
std::clog << "warning, did not register any new fonts!\n";
}
unsigned face_count = mapnik::freetype_engine::face_names().size();
test13 runner(1000,10);
benchmark(runner, (boost::format("font_engihe: created %ld faces in ") % (face_count * 1000 * 10)).str());
}
std::cout << "...benchmark done\n";
return 0;
}

View file

@ -1,7 +1,7 @@
#
# This file is part of Mapnik (c++ mapping toolkit)
#
# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
# Copyright (C) 2013 Artem Pavlenko
#
# Mapnik is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -43,20 +43,18 @@ prefix = env['PREFIX']
target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik')
target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2')
libraries = ['mapnik',env['BOOST_PYTHON_LIB']]
py_env = env.Clone()
py_env.Append(CPPPATH = env['PYTHON_INCLUDES'])
py_env['LIBS'] = ['mapnik',env['BOOST_PYTHON_LIB']]
link_all_libs = env['LINKING'] == 'static' or env['RUNTIME_LINK'] == 'static' or (env['PLATFORM'] == 'Darwin' and not env['PYTHON_DYNAMIC_LOOKUP'])
if link_all_libs:
py_env.AppendUnique(LIBS=env['LIBMAPNIK_LIBS'])
# TODO - do solaris/fedora need direct linking too?
if env['PLATFORM'] == 'Darwin':
if not env['PYTHON_DYNAMIC_LOOKUP']:
if env['PNG']:
libraries.append('png')
if env['JPEG']:
libraries.append('jpeg')
libraries.append(env['ICU_LIB_NAME'])
libraries.append('boost_regex%s' % env['BOOST_APPEND'])
if env['THREADING'] == 'multi':
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
##### Python linking on OS X is tricky ###
# Confounding problems are:
# 1) likelyhood of multiple python installs of the same major.minor version
@ -96,7 +94,6 @@ if env['PLATFORM'] == 'Darwin':
else:
# should we fall back to -lpython here?
python_link_flag = '-F/ -framework Python'
# if we are not linking to a framework then use the *nix standard approach
else:
# TODO - do we need to pass -L/?
@ -147,9 +144,6 @@ except: pass
# install the shared object beside the module directory
sources = glob.glob('*.cpp')
py_env = env.Clone()
py_env.Append(CPPPATH = env['PYTHON_INCLUDES'])
if 'install' in COMMAND_LINE_TARGETS:
# install the core mapnik python files, including '__init__.py'
init_files = glob.glob('mapnik/*.py')
@ -176,15 +170,15 @@ if 'uninstall' not in COMMAND_LINE_TARGETS:
if env['HAS_CAIRO']:
py_env.Append(CPPPATH = env['CAIRO_CPPPATHS'])
py_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
if env['PLATFORM'] == 'Darwin':
py_env.Append(LIBS=env['CAIRO_LINKFLAGS'])
if link_all_libs:
py_env.Append(LIBS=env['CAIRO_ALL_LIBS'])
if env['HAS_PYCAIRO']:
py_env.ParseConfig('pkg-config --cflags pycairo')
py_env.Append(CPPDEFINES = '-DHAVE_PYCAIRO')
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags)
py_env.AppendUnique(LIBS = 'boost_thread%s' % env['BOOST_APPEND'])
_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags)
Depends(_mapnik, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))

View file

@ -275,11 +275,6 @@ class _Color(Color,_injector):
def __repr__(self):
return "Color(R=%d,G=%d,B=%d,A=%d)" % (self.r,self.g,self.b,self.a)
class _ProcessedText(ProcessedText, _injector):
def append(self, properties, text):
#More pythonic name
self.push_back(properties, text)
class _Symbolizers(Symbolizers,_injector):
def __getitem__(self, idx):
@ -340,6 +335,53 @@ def Shapefile(**keywords):
keywords['type'] = 'shape'
return CreateDatasource(keywords)
def CSV(**keywords):
"""Create a CSV Datasource.
Required keyword arguments:
file -- path to csv
Optional keyword arguments:
inline -- inline CSV string (if provided 'file' argument will be ignored and non-needed)
base -- path prefix (default None)
encoding -- file encoding (default 'utf-8')
row_limit -- integer limit of rows to return (default: 0)
strict -- throw an error if an invalid row is encountered
escape -- The escape character to use for parsing data
quote -- The quote character to use for parsing data
separator -- The separator character to use for parsing data
headers -- A comma separated list of header names that can be set to add headers to data that lacks them
filesize_max -- The maximum filesize in MB that will be accepted
>>> from mapnik import CSV
>>> csv = CSV(file='test.csv')
>>> from mapnik import CSV
>>> csv = CSV(inline='''wkt,Name\n"POINT (120.15 48.47)","Winthrop, WA"''')
For more information see https://github.com/mapnik/mapnik/wiki/CSV-Plugin
"""
keywords['type'] = 'csv'
return CreateDatasource(keywords)
def GeoJSON(**keywords):
"""Create a GeoJSON Datasource.
Required keyword arguments:
file -- path to json
Optional keyword arguments:
encoding -- file encoding (default 'utf-8')
base -- path prefix (default None)
>>> from mapnik import GeoJSON
>>> geojson = GeoJSON(file='test.json')
"""
keywords['type'] = 'geojson'
return CreateDatasource(keywords)
def PostGIS(**keywords):
"""Create a PostGIS Datasource.
@ -558,44 +600,6 @@ def Osm(**keywords):
keywords['type'] = 'osm'
return CreateDatasource(keywords)
def Kismet(**keywords):
"""Create a Kismet Datasource.
Required keyword arguments:
host -- kismet hostname
port -- kismet port
Optional keyword arguments:
encoding -- file encoding (default 'utf-8')
extent -- manually specified data extent (comma delimited string, default None)
>>> from mapnik import Kismet, Layer
>>> datasource = Kismet(host='localhost',port=2501,extent='-179,-85,179,85')
>>> lyr = Layer('Kismet Server Layer')
>>> lyr.datasource = datasource
"""
keywords['type'] = 'kismet'
return CreateDatasource(keywords)
def Geos(**keywords):
"""Create a GEOS Vector Datasource.
Required keyword arguments:
wkt -- inline WKT text of the geometry
Optional keyword arguments:
extent -- manually specified data extent (comma delimited string, default None)
>>> from mapnik import Geos, Layer
>>> datasource = Geos(wkt='MULTIPOINT(100 100, 50 50, 0 0)')
>>> lyr = Layer('GEOS Layer from WKT string')
>>> lyr.datasource = datasource
"""
keywords['type'] = 'geos'
return CreateDatasource(keywords)
def Python(**keywords):
"""Create a Python Datasource.

View file

@ -48,14 +48,30 @@ namespace
{
//user-friendly wrapper that uses Python dictionary
using namespace boost::python;
boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
boost::shared_ptr<mapnik::datasource> create_datasource(dict const& d)
{
mapnik::parameters params;
boost::python::list keys=d.keys();
for (int i=0; i<len(keys); ++i)
for (int i=0; i < len(keys); ++i)
{
std::string key = extract<std::string>(keys[i]);
object obj = d[key];
if (PyUnicode_Check(obj.ptr()))
{
PyObject* temp = PyUnicode_AsUTF8String(obj.ptr());
if (temp)
{
#if PY_VERSION_HEX >= 0x03000000
char* c_str = PyBytes_AsString(temp);
#else
char* c_str = PyString_AsString(temp);
#endif
params[key] = std::string(c_str);
Py_DecRef(temp);
}
continue;
}
extract<std::string> ex0(obj);
extract<mapnik::value_integer> ex1(obj);
extract<double> ex2(obj);

View file

@ -0,0 +1,42 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2013 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
*
*****************************************************************************/
#include <boost/python.hpp>
#include "mapnik_enumeration.hpp"
#include <mapnik/debug_symbolizer.hpp>
void export_debug_symbolizer()
{
using namespace boost::python;
mapnik::enumeration_<mapnik::debug_symbolizer_mode_e>("debug_symbolizer_mode")
.value("COLLISION",mapnik::DEBUG_SYM_MODE_COLLISION)
.value("VERTEX",mapnik::DEBUG_SYM_MODE_VERTEX)
;
class_<mapnik::debug_symbolizer>("DebugSymbolizer",
init<>("Default debug Symbolizer"))
.add_property("mode",
&mapnik::debug_symbolizer::get_mode,
&mapnik::debug_symbolizer::set_mode)
;
}

View file

@ -34,8 +34,6 @@
#include <mapnik/parse_path.hpp>
#include <mapnik/value.hpp>
using mapnik::Feature;
using mapnik::expression_ptr;
using mapnik::parse_expression;
using mapnik::to_expression_string;
@ -53,15 +51,15 @@ std::string expression_to_string_(mapnik::expr_node const& expr)
return mapnik::to_expression_string(expr);
}
mapnik::value expression_evaluate_(mapnik::expr_node const& expr, mapnik::Feature const& f)
mapnik::value expression_evaluate_(mapnik::expr_node const& expr, mapnik::feature_impl const& f)
{
// will be auto-converted to proper python type by `mapnik_value_to_python`
return boost::apply_visitor(mapnik::evaluate<mapnik::Feature,mapnik::value>(f),expr);
return boost::apply_visitor(mapnik::evaluate<mapnik::feature_impl,mapnik::value>(f),expr);
}
bool expression_evaluate_to_bool_(mapnik::expr_node const& expr, mapnik::Feature const& f)
bool expression_evaluate_to_bool_(mapnik::expr_node const& expr, mapnik::feature_impl const& f)
{
return boost::apply_visitor(mapnik::evaluate<mapnik::Feature,mapnik::value>(f),expr).to_bool();
return boost::apply_visitor(mapnik::evaluate<mapnik::feature_impl,mapnik::value>(f),expr).to_bool();
}
// path expression
@ -75,7 +73,7 @@ std::string path_to_string_(mapnik::path_expression const& expr)
return mapnik::path_processor_type::to_string(expr);
}
std::string path_evaluate_(mapnik::path_expression const& expr, mapnik::Feature const& f)
std::string path_evaluate_(mapnik::path_expression const& expr, mapnik::feature_impl const& f)
{
return mapnik::path_processor_type::evaluate(expr, f);
}

View file

@ -30,7 +30,6 @@
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/feature_kv_iterator.hpp>
@ -39,30 +38,33 @@
#include <mapnik/wkt/wkt_factory.hpp>
#include <mapnik/json/geojson_generator.hpp>
// stl
#include <stdexcept>
namespace {
using mapnik::Feature;
using mapnik::geometry_utils;
using mapnik::from_wkt;
using mapnik::context_type;
using mapnik::context_ptr;
using mapnik::feature_kv_iterator;
mapnik::geometry_type const& (mapnik::Feature::*get_geometry_by_const_ref)(unsigned) const = &mapnik::Feature::get_geometry;
boost::ptr_vector<mapnik::geometry_type> const& (mapnik::Feature::*get_paths_by_const_ref)() const = &mapnik::Feature::paths;
mapnik::geometry_type const& (mapnik::feature_impl::*get_geometry_by_const_ref)(unsigned) const = &mapnik::feature_impl::get_geometry;
boost::ptr_vector<mapnik::geometry_type> const& (mapnik::feature_impl::*get_paths_by_const_ref)() const = &mapnik::feature_impl::paths;
void feature_add_geometries_from_wkb(Feature &feature, std::string wkb)
void feature_add_geometries_from_wkb(mapnik::feature_impl &feature, std::string wkb)
{
geometry_utils::from_wkb(feature.paths(), wkb.c_str(), wkb.size());
bool result = geometry_utils::from_wkb(feature.paths(), wkb.c_str(), wkb.size());
if (!result) throw std::runtime_error("Failed to parse WKB");
}
void feature_add_geometries_from_wkt(Feature &feature, std::string wkt)
void feature_add_geometries_from_wkt(mapnik::feature_impl &feature, std::string wkt)
{
bool result = mapnik::from_wkt(wkt, feature.paths());
if (!result) throw std::runtime_error("Failed to parse WKT");
}
std::string feature_to_geojson(Feature const& feature)
std::string feature_to_geojson(mapnik::feature_impl const& feature)
{
std::string json;
mapnik::json::feature_generator g;
@ -73,22 +75,22 @@ std::string feature_to_geojson(Feature const& feature)
return json;
}
mapnik::value __getitem__(Feature const& feature, std::string const& name)
mapnik::value __getitem__(mapnik::feature_impl const& feature, std::string const& name)
{
return feature.get(name);
}
mapnik::value __getitem2__(Feature const& feature, std::size_t index)
mapnik::value __getitem2__(mapnik::feature_impl const& feature, std::size_t index)
{
return feature.get(index);
}
void __setitem__(Feature & feature, std::string const& name, mapnik::value const& val)
void __setitem__(mapnik::feature_impl & feature, std::string const& name, mapnik::value const& val)
{
feature.put_new(name,val);
}
boost::python::dict attributes(Feature const& f)
boost::python::dict attributes(mapnik::feature_impl const& f)
{
boost::python::dict attributes;
feature_kv_iterator itr = f.begin();
@ -191,7 +193,6 @@ struct value_null_from_python
void export_feature()
{
using namespace boost::python;
using mapnik::Feature;
// Python to mapnik::value converters
// NOTE: order matters here. For example value_null must be listed before
@ -211,25 +212,25 @@ void export_feature()
.def("push", &context_type::push)
;
class_<Feature,boost::shared_ptr<Feature>,
class_<mapnik::feature_impl,boost::shared_ptr<mapnik::feature_impl>,
boost::noncopyable>("Feature",init<context_ptr,mapnik::value_integer>("Default ctor."))
.def("id",&Feature::id)
.def("__str__",&Feature::to_string)
.def("id",&mapnik::feature_impl::id)
.def("__str__",&mapnik::feature_impl::to_string)
.def("add_geometries_from_wkb", &feature_add_geometries_from_wkb)
.def("add_geometries_from_wkt", &feature_add_geometries_from_wkt)
.def("add_geometry", &Feature::add_geometry)
.def("num_geometries",&Feature::num_geometries)
.def("add_geometry", &mapnik::feature_impl::add_geometry)
.def("num_geometries",&mapnik::feature_impl::num_geometries)
.def("get_geometry", make_function(get_geometry_by_const_ref,return_value_policy<reference_existing_object>()))
.def("geometries",make_function(get_paths_by_const_ref,return_value_policy<reference_existing_object>()))
.def("envelope", &Feature::envelope)
.def("has_key", &Feature::has_key)
.def("envelope", &mapnik::feature_impl::envelope)
.def("has_key", &mapnik::feature_impl::has_key)
.add_property("attributes",&attributes)
.def("__setitem__",&__setitem__)
.def("__contains__",&__getitem__)
.def("__getitem__",&__getitem__)
.def("__getitem__",&__getitem2__)
.def("__len__", &Feature::size)
.def("context",&Feature::context)
.def("__len__", &mapnik::feature_impl::size)
.def("context",&mapnik::feature_impl::context)
.def("to_geojson",&feature_to_geojson)
;
}

View file

@ -65,10 +65,7 @@ inline mapnik::feature_ptr next(mapnik::featureset_ptr const& itr)
void export_featureset()
{
using namespace boost::python;
using mapnik::Feature;
using mapnik::Featureset;
class_<Featureset,boost::shared_ptr<Featureset>,
class_<mapnik::Featureset,boost::shared_ptr<mapnik::Featureset>,
boost::noncopyable>("Featureset",no_init)
.def("__iter__",pass_through)
.def("next",next)

View file

@ -24,6 +24,7 @@
#include <boost/noncopyable.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/utils.hpp>
void export_font_engine()
{

View file

@ -43,6 +43,9 @@
#include <mapnik/util/geometry_to_svg.hpp>
#endif
// stl
#include <stdexcept>
namespace {
using mapnik::from_wkt;

View file

@ -164,6 +164,36 @@ boost::shared_ptr<image_32> open_from_file(std::string const& filename)
throw mapnik::image_reader_exception("Unsupported image format:" + filename);
}
boost::shared_ptr<image_32> fromstring(std::string const& str)
{
std::auto_ptr<image_reader> reader(get_image_reader(str.c_str(),str.size()));
if (reader.get())
{
boost::shared_ptr<image_32> image_ptr = boost::make_shared<image_32>(reader->width(),reader->height());
reader->read(0,0,image_ptr->data());
return image_ptr;
}
throw mapnik::image_reader_exception("Failed to load image from buffer" );
}
boost::shared_ptr<image_32> frombuffer(PyObject * obj)
{
void const* buffer=0;
Py_ssize_t buffer_len;
if (PyObject_AsReadBuffer(obj, &buffer, &buffer_len) == 0)
{
std::auto_ptr<image_reader> reader(get_image_reader(reinterpret_cast<char const*>(buffer),buffer_len));
if (reader.get())
{
boost::shared_ptr<image_32> image_ptr = boost::make_shared<image_32>(reader->width(),reader->height());
reader->read(0,0,image_ptr->data());
return image_ptr;
}
}
throw mapnik::image_reader_exception("Failed to load image from buffer" );
}
void blend (image_32 & im, unsigned x, unsigned y, image_32 const& im2, float opacity)
{
im.set_rectangle_alpha2(im2.data(),x,y,opacity);
@ -242,6 +272,7 @@ void export_image()
arg("mode")=mapnik::src_over,
arg("opacity")=1.0f
))
.def("premultiplied",&image_32::premultiplied)
.def("premultiply",&image_32::premultiply)
.def("demultiply",&image_32::demultiply)
.def("set_pixel",&set_pixel)
@ -257,6 +288,10 @@ void export_image()
.def("save", &save_to_file3)
.def("open",open_from_file)
.staticmethod("open")
.def("frombuffer",&frombuffer)
.staticmethod("frombuffer")
.def("fromstring",&fromstring)
.staticmethod("fromstring")
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
.def("from_cairo",&from_cairo)
.staticmethod("from_cairo")

View file

@ -30,6 +30,8 @@
#include <mapnik/parse_path.hpp>
#include "mapnik_svg.hpp"
#include "mapnik_enumeration.hpp"
#include "python_optional.hpp"
#include <mapnik/marker_cache.hpp> // for known_svg_prefix_
using mapnik::markers_symbolizer;
@ -70,16 +72,6 @@ void set_marker_type(mapnik::markers_symbolizer & symbolizer, std::string const&
}
// https://github.com/mapnik/mapnik/issues/1367
PyObject* get_fill_opacity_impl(markers_symbolizer & sym)
{
boost::optional<float> fill_opacity = sym.get_fill_opacity();
if (fill_opacity)
return ::PyFloat_FromDouble(*fill_opacity);
Py_RETURN_NONE;
}
void export_markers_symbolizer()
{
using namespace boost::python;
@ -119,7 +111,7 @@ void export_markers_symbolizer()
&markers_symbolizer::set_opacity,
"Set/get the overall opacity")
.add_property("fill_opacity",
&get_fill_opacity_impl,
&markers_symbolizer::get_fill_opacity,
&markers_symbolizer::set_fill_opacity,
"Set/get the fill opacity")
.add_property("ignore_placement",

View file

@ -28,6 +28,9 @@
//mapnik
#include <mapnik/palette.hpp>
// stl
#include <stdexcept>
static boost::shared_ptr<mapnik::rgba_palette> make_palette( std::string const& palette, std::string const& format )
{
mapnik::rgba_palette::palette_type type = mapnik::rgba_palette::PALETTE_RGBA;

View file

@ -27,6 +27,10 @@
// boost
#include <boost/python.hpp>
// stl
#include <stdexcept>
using mapnik::proj_transform;
using mapnik::projection;

View file

@ -25,6 +25,9 @@
#include <boost/python/detail/api_placeholder.hpp>
#include <boost/python/exception_translator.hpp>
// stl
#include <stdexcept>
void register_cairo();
void export_color();
void export_coord();
@ -62,6 +65,7 @@ void export_polygon_pattern_symbolizer();
void export_raster_symbolizer();
void export_text_placement();
void export_shield_symbolizer();
void export_debug_symbolizer();
void export_font_engine();
void export_projection();
void export_proj_transform();
@ -84,7 +88,6 @@ void export_logger();
#include <mapnik/rule.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/load_map.hpp>
#include <mapnik/config_error.hpp>
#include <mapnik/scale_denominator.hpp>
#include <mapnik/value_error.hpp>
#include <mapnik/save_map.hpp>
@ -333,11 +336,6 @@ double scale_denominator(mapnik::Map const &map, bool geographic)
}
// http://docs.python.org/c-api/exceptions.html#standard-exceptions
void config_error_translator(mapnik::config_error const & ex)
{
PyErr_SetString(PyExc_RuntimeError, ex.what());
}
void value_error_translator(mapnik::value_error const & ex)
{
PyErr_SetString(PyExc_ValueError, ex.what());
@ -348,6 +346,16 @@ void runtime_error_translator(std::runtime_error const & ex)
PyErr_SetString(PyExc_RuntimeError, ex.what());
}
void out_of_range_error_translator(std::out_of_range const & ex)
{
PyErr_SetString(PyExc_IndexError, ex.what());
}
void standard_error_translator(std::exception const & ex)
{
PyErr_SetString(PyExc_RuntimeError, ex.what());
}
unsigned mapnik_version()
{
return MAPNIK_VERSION;
@ -403,7 +411,7 @@ bool has_pycairo()
}
BOOST_PYTHON_FUNCTION_OVERLOADS(load_map_overloads, load_map, 2, 3)
BOOST_PYTHON_FUNCTION_OVERLOADS(load_map_overloads, load_map, 2, 4)
BOOST_PYTHON_FUNCTION_OVERLOADS(load_map_string_overloads, load_map_string, 2, 4)
BOOST_PYTHON_FUNCTION_OVERLOADS(save_map_overloads, save_map, 2, 3)
BOOST_PYTHON_FUNCTION_OVERLOADS(save_map_to_string_overloads, save_map_to_string, 1, 2)
@ -421,7 +429,8 @@ BOOST_PYTHON_MODULE(_mapnik)
using mapnik::save_map_to_string;
using mapnik::render_grid;
register_exception_translator<mapnik::config_error>(&config_error_translator);
register_exception_translator<std::exception>(&standard_error_translator);
register_exception_translator<std::out_of_range>(&out_of_range_error_translator);
register_exception_translator<mapnik::value_error>(&value_error_translator);
register_exception_translator<std::runtime_error>(&runtime_error_translator);
register_cairo();
@ -458,6 +467,7 @@ BOOST_PYTHON_MODULE(_mapnik)
export_raster_symbolizer();
export_text_placement();
export_shield_symbolizer();
export_debug_symbolizer();
export_font_engine();
export_projection();
export_proj_transform();

View file

@ -28,18 +28,7 @@
#include <mapnik/raster_colorizer.hpp>
#include <mapnik/image_scaling.hpp>
namespace {
// https://github.com/mapnik/mapnik/issues/1367
PyObject* get_premultiplied_impl(mapnik::raster_symbolizer & sym)
{
boost::optional<bool> premultiplied = sym.premultiplied();
if (premultiplied)
return ::PyBool_FromLong(*premultiplied);
Py_RETURN_NONE;
}
}
using mapnik::raster_symbolizer;
void export_raster_symbolizer()
@ -132,7 +121,7 @@ void export_raster_symbolizer()
">>> r.mesh_size = 32\n"
)
.add_property("premultiplied",
&get_premultiplied_impl,
&raster_symbolizer::premultiplied,
&raster_symbolizer::set_premultiplied,
"Get/Set premultiplied status of the source image.\n"
"Can be used to override what the source data reports (when in error)\n"

View file

@ -34,7 +34,6 @@
using mapnik::rule;
using mapnik::expr_node;
using mapnik::expression_ptr;
using mapnik::Feature;
using mapnik::point_symbolizer;
using mapnik::line_symbolizer;
using mapnik::line_pattern_symbolizer;

View file

@ -47,7 +47,7 @@ using mapnik::path_expression_ptr;
using mapnik::guess_type;
using mapnik::expression_ptr;
using mapnik::parse_path;
using mapnik::position;
using mapnik::pixel_position;
namespace {
@ -55,20 +55,20 @@ using namespace boost::python;
tuple get_shield_displacement(const shield_symbolizer& s)
{
position const& pos = s.get_shield_displacement();
return boost::python::make_tuple(pos.first, pos.second);
pixel_position const& pos = s.get_shield_displacement();
return boost::python::make_tuple(pos.x, pos.y);
}
void set_shield_displacement(shield_symbolizer & s, boost::python::tuple arg)
{
s.get_placement_options()->defaults.displacement.first = extract<double>(arg[0]);
s.get_placement_options()->defaults.displacement.second = extract<double>(arg[1]);
s.get_placement_options()->defaults.displacement.x = extract<double>(arg[0]);
s.get_placement_options()->defaults.displacement.y = extract<double>(arg[1]);
}
tuple get_text_displacement(const shield_symbolizer& t)
{
position const& pos = t.get_placement_options()->defaults.displacement;
return boost::python::make_tuple(pos.first, pos.second);
pixel_position const& pos = t.get_placement_options()->defaults.displacement;
return boost::python::make_tuple(pos.x, pos.y);
}
void set_text_displacement(shield_symbolizer & t, boost::python::tuple arg)

View file

@ -23,14 +23,14 @@
#include <boost/python/stl_iterator.hpp>
#include <boost/noncopyable.hpp>
#include <mapnik/text_properties.hpp>
#include <mapnik/text_placements/simple.hpp>
#include <mapnik/text_placements/list.hpp>
#include <mapnik/formatting/text.hpp>
#include <mapnik/formatting/list.hpp>
#include <mapnik/formatting/format.hpp>
#include <mapnik/formatting/expression_format.hpp>
#include <mapnik/processed_text.hpp>
#include <mapnik/text/text_properties.hpp>
#include <mapnik/text/placements/simple.hpp>
#include <mapnik/text/placements/list.hpp>
#include <mapnik/text/formatting/text.hpp>
#include <mapnik/text/formatting/list.hpp>
#include <mapnik/text/formatting/format.hpp>
#include <mapnik/text/formatting/expression_format.hpp>
#include <mapnik/text/layout.hpp>
#include <mapnik/expression_string.hpp>
#include <mapnik/text_symbolizer.hpp>
@ -57,7 +57,7 @@ using namespace boost::python;
boost::python::tuple get_displacement(text_symbolizer_properties const& t)
{
return boost::python::make_tuple(t.displacement.first, t.displacement.second);
return boost::python::make_tuple(t.displacement.x, t.displacement.y);
}
void set_displacement(text_symbolizer_properties &t, boost::python::tuple arg)
@ -73,7 +73,7 @@ void set_displacement(text_symbolizer_properties &t, boost::python::tuple arg)
double x = extract<double>(arg[0]);
double y = extract<double>(arg[1]);
t.displacement = std::make_pair(x, y);
t.displacement.set(x, y);
}
@ -84,7 +84,7 @@ struct NodeWrap: formatting::node, wrapper<formatting::node>
}
void apply(char_properties const& p, Feature const& feature, processed_text &output) const
void apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
python_block_auto_unblock b;
this->get_override("apply")(ptr(&p), ptr(&feature), ptr(&output));
@ -122,7 +122,7 @@ struct TextNodeWrap: formatting::text_node, wrapper<formatting::text_node>
}
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const
virtual void apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
if(override o = this->get_override("apply"))
{
@ -135,7 +135,7 @@ struct TextNodeWrap: formatting::text_node, wrapper<formatting::text_node>
}
}
void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const
void default_apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
formatting::text_node::apply(p, feature, output);
}
@ -143,7 +143,7 @@ struct TextNodeWrap: formatting::text_node, wrapper<formatting::text_node>
struct FormatNodeWrap: formatting::format_node, wrapper<formatting::format_node>
{
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const
virtual void apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
if(override o = this->get_override("apply"))
{
@ -156,7 +156,7 @@ struct FormatNodeWrap: formatting::format_node, wrapper<formatting::format_node>
}
}
void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const
void default_apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
formatting::format_node::apply(p, feature, output);
}
@ -164,7 +164,7 @@ struct FormatNodeWrap: formatting::format_node, wrapper<formatting::format_node>
struct ExprFormatWrap: formatting::expression_format, wrapper<formatting::expression_format>
{
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const
virtual void apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
if(override o = this->get_override("apply"))
{
@ -177,7 +177,7 @@ struct ExprFormatWrap: formatting::expression_format, wrapper<formatting::expres
}
}
void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const
void default_apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
formatting::expression_format::apply(p, feature, output);
}
@ -201,8 +201,8 @@ struct ListNodeWrap: formatting::list_node, wrapper<formatting::list_node>
http://wiki.python.org/moin/boost.python/HowTo#A.22Raw.22_function */
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const
{
virtual void apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
if(override o = this->get_override("apply"))
{
python_block_auto_unblock b;
@ -214,7 +214,7 @@ struct ListNodeWrap: formatting::list_node, wrapper<formatting::list_node>
}
}
void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const
void default_apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
formatting::list_node::apply(p, feature, output);
}
@ -280,12 +280,12 @@ void insert_expression(expression_set *set, expression_ptr p)
set->insert(p);
}
char_properties & get_format(text_symbolizer const& sym)
char_properties_ptr get_format(text_symbolizer const& sym)
{
return sym.get_placement_options()->defaults.format;
}
void set_format(text_symbolizer const& sym, char_properties & format)
void set_format(text_symbolizer const& sym, char_properties_ptr format)
{
sym.get_placement_options()->defaults.format = format;
}
@ -353,7 +353,7 @@ void export_text_placement()
&text_symbolizer::set_placement_options)
//TODO: Check return policy, is there a better way to do this?
.add_property("format",
make_function(&get_format, return_value_policy<reference_existing_object>()),
make_function(&get_format),
&set_format,
"Shortcut for placements.defaults.default_format")
.add_property("properties",
@ -397,6 +397,7 @@ void export_text_placement()
.def_readwrite("largest_bbox_only", &text_symbolizer_properties::largest_bbox_only)
.def_readwrite("text_ratio", &text_symbolizer_properties::text_ratio)
.def_readwrite("wrap_width", &text_symbolizer_properties::wrap_width)
.def_readwrite("wrap_before", &text_symbolizer_properties::wrap_before)
.def_readwrite("format", &text_symbolizer_properties::format)
.add_property ("format_tree",
&text_symbolizer_properties::format_tree,
@ -409,7 +410,8 @@ void export_text_placement()
;
class_with_converter<char_properties>
class_with_converter<char_properties,
boost::shared_ptr<char_properties> >
("CharProperties")
.def_readwrite_convert("text_transform", &char_properties::text_transform)
.def_readwrite_convert("fontset", &char_properties::fontset)
@ -421,7 +423,6 @@ void export_text_placement()
.def_readwrite("text_opacity", &char_properties::text_opacity)
.def_readwrite("wrap_char", &char_properties::wrap_char)
.def_readwrite("wrap_character", &char_properties::wrap_char)
.def_readwrite("wrap_before", &char_properties::wrap_before)
.def_readwrite("fill", &char_properties::fill)
.def_readwrite("halo_fill", &char_properties::halo_fill)
.def_readwrite("halo_radius", &char_properties::halo_radius)
@ -444,24 +445,12 @@ void export_text_placement()
("TextPlacementInfo",
init<text_placements const*, double>())
.def("next", pure_virtual(&text_placement_info::next))
.def("get_actual_label_spacing", &text_placement_info::get_actual_label_spacing)
.def("get_actual_minimum_distance", &text_placement_info::get_actual_minimum_distance)
.def("get_actual_minimum_padding", &text_placement_info::get_actual_minimum_padding)
.def_readwrite("properties", &text_placement_info::properties)
.def_readwrite("scale_factor", &text_placement_info::scale_factor)
;
register_ptr_to_python<boost::shared_ptr<text_placement_info> >();
class_<processed_text,
boost::shared_ptr<processed_text>,
boost::noncopyable>
("ProcessedText", no_init)
.def("push_back", &processed_text::push_back)
.def("clear", &processed_text::clear)
;
class_<expression_set,
boost::shared_ptr<expression_set>,
boost::noncopyable>
@ -509,7 +498,6 @@ void export_text_placement()
.def_readwrite_convert("text_opacity", &formatting::format_node::text_opacity)
.def_readwrite_convert("wrap_char", &formatting::format_node::wrap_char)
.def_readwrite_convert("wrap_character", &formatting::format_node::wrap_char)
.def_readwrite_convert("wrap_before", &formatting::format_node::wrap_before)
.def_readwrite_convert("text_transform", &formatting::format_node::text_transform)
.def_readwrite_convert("fill", &formatting::format_node::fill)
.def_readwrite_convert("halo_fill", &formatting::format_node::halo_fill)
@ -549,7 +537,6 @@ void export_text_placement()
.def_readwrite("text_opacity", &formatting::expression_format::text_opacity)
.def_readwrite("wrap_char", &formatting::expression_format::wrap_char)
.def_readwrite("wrap_character", &formatting::expression_format::wrap_char)
.def_readwrite("wrap_before", &formatting::expression_format::wrap_before)
.def_readwrite("fill", &formatting::expression_format::fill)
.def_readwrite("halo_fill", &formatting::expression_format::halo_fill)
.def_readwrite("halo_radius", &formatting::expression_format::halo_radius)

View file

@ -35,11 +35,7 @@ namespace boost { namespace python {
{
PyObject * operator() (mapnik::value_integer val) const
{
#if PY_VERSION_HEX >= 0x03000000
return ::PyLong_FromLong(val);
#else
return ::PyInt_FromLong(val);
#endif
return ::PyLong_FromLongLong(val);
}
PyObject * operator() (double val) const

View file

@ -39,6 +39,9 @@
#include "mapnik_value_converter.hpp"
#include "python_grid_utils.hpp"
// stl
#include <stdexcept>
namespace mapnik {

View file

@ -22,7 +22,8 @@
#include <boost/optional/optional.hpp>
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
#include <mapnik/noncopyable.hpp>
// boost::optional<T> to/from converter from John Wiegley
@ -46,7 +47,7 @@ struct register_python_conversion
};
template <typename T>
struct python_optional : public boost::noncopyable
struct python_optional : public mapnik::noncopyable
{
struct optional_to_python
{
@ -74,7 +75,7 @@ struct python_optional : public boost::noncopyable
rvalue_from_python_stage1(source, converters);
return rvalue_from_python_stage2(source, data, converters);
}
return NULL;
return 0;
}
static void construct(PyObject * source,
@ -94,17 +95,116 @@ struct python_optional : public boost::noncopyable
}
};
explicit python_optional() {
explicit python_optional()
{
register_python_conversion<boost::optional<T>,
optional_to_python, optional_from_python>();
}
};
/** This class works around a bug in boost python.
// to/from boost::optional<bool>
template <>
struct python_optional<float> : public mapnik::noncopyable
{
struct optional_to_python
{
static PyObject * convert(const boost::optional<float>& value)
{
return (value ? PyFloat_FromDouble(*value) :
boost::python::detail::none());
}
};
See http://osdir.com/ml/python.c++/2003-11/msg00158.html
*/
template <typename T, typename X1 = boost::python::detail::not_specified, typename X2 = boost::python::detail::not_specified, typename X3 = boost::python::detail::not_specified>
struct optional_from_python
{
static void * convertible(PyObject * source)
{
using namespace boost::python::converter;
if (source == Py_None || PyFloat_Check(source))
return source;
return 0;
}
static void construct(PyObject * source,
boost::python::converter::rvalue_from_python_stage1_data * data)
{
using namespace boost::python::converter;
void * const storage = ((rvalue_from_python_storage<boost::optional<bool> > *)
data)->storage.bytes;
if (source == Py_None) // == None
new (storage) boost::optional<float>(); // A Boost uninitialized value
else
new (storage) boost::optional<float>(PyFloat_AsDouble(source));
data->convertible = storage;
}
};
explicit python_optional()
{
register_python_conversion<boost::optional<float>,
optional_to_python, optional_from_python>();
}
};
// to/from boost::optional<float>
template <>
struct python_optional<bool> : public mapnik::noncopyable
{
struct optional_to_python
{
static PyObject * convert(const boost::optional<bool>& value)
{
if (value)
{
if (*value) Py_RETURN_TRUE;
else Py_RETURN_FALSE;
}
else return boost::python::detail::none();
}
};
struct optional_from_python
{
static void * convertible(PyObject * source)
{
using namespace boost::python::converter;
if (source == Py_None || PyBool_Check(source))
return source;
return 0;
}
static void construct(PyObject * source,
boost::python::converter::rvalue_from_python_stage1_data * data)
{
using namespace boost::python::converter;
void * const storage = ((rvalue_from_python_storage<boost::optional<bool> > *)
data)->storage.bytes;
if (source == Py_None) // == None
new (storage) boost::optional<bool>(); // A Boost uninitialized value
else
{
new (storage) boost::optional<bool>(source == Py_True ? true : false);
}
data->convertible = storage;
}
};
explicit python_optional()
{
register_python_conversion<boost::optional<bool>,
optional_to_python, optional_from_python>();
}
};
// This class works around a feature in boost python.
// See http://osdir.com/ml/python.c++/2003-11/msg00158.html
template <typename T,
typename X1 = boost::python::detail::not_specified,
typename X2 = boost::python::detail::not_specified,
typename X3 = boost::python::detail::not_specified>
class class_with_converter : public boost::python::class_<T, X1, X2, X3>
{
public:

View file

@ -1,4 +1,4 @@
CXXFLAGS = $(shell mapnik-config --cflags)
CXXFLAGS = $(shell mapnik-config --includes --defines --cxxflags --dep-includes)
LDFLAGS = $(shell mapnik-config --libs --dep-libs --ldflags)
OBJ = rundemo.o
@ -13,8 +13,15 @@ $(BIN) : $(OBJ)
.c.o :
$(CXX) -c $(CXXFLAGS) $<
gyp:
rm -rf ./build
gyp rundemo.gyp --depth=. -f make --generator-output=./build/
make -C ./build
build/out/Release/rundemo `mapnik-config --prefix`
.PHONY : clean
clean:
rm -f $(OBJ)
rm -f $(BIN)
rm -f ./build

81
demo/c++/README.md Normal file
View file

@ -0,0 +1,81 @@
## rundemo.cpp
This directory contains a simple c++ program demonstrating the Mapnik C++ API. It mimics the python 'rundemo.py' example with a couple exceptions.
If building on unix you can have this program automatically build by configuring Mapnik like:
./configure DEMO=True
However, this example code also should be able to be built standalone.
The following notes describe how to do that on various operating systems.
## Depends
- Mapnik library development headers
- `mapnik-config` on unix and `mapnik-config.bat` on windows
### Unix
On OS X and Linux you also need `make`.
### Windows
On windows, additional dependencies to build are:
- MSVS 2010 with C++ compiler
- Python 2.x
- gyp: https://code.google.com/p/gyp | https://github.com/springmeyer/hello-gyp
`mapnik-config.bat` should come with your Mapnik installation.
First confirm it is on your path:
mapnik-config # should give usage
To install gyp, which is pure python do:
svn checkout http://gyp.googlecode.com/svn/trunk/ gyp
cd gyp
python setup.py install
If you do not have svn installed you can grab gyp from:
https://github.com/TooTallNate/node-gyp/archive/master.zip
# unzip and extract the 'gyp' subfolder then do
cd gyp
python setup.py install
## Building the demo
### Unix
Simply type:
make
Then to run do:
./rundemo `mapnik-config --prefix`
On OS X you can also create an xcode project:
gyp rundemo.gyp --depth=. -f xcode --generator-output=./build/
xcodebuild -project ./build/rundemo.xcodeproj
./build/out/Release/rundemo `mapnik-config --prefix`
### Windows
First you need to build the visual studio solution with gyp:
C:\Python27\python.exe c:\Python27\Scripts\gyp rundemo.gyp --depth=. -f msvs -G msvs_version=2010
Then you can compile with `msbuild`:
msbuild rundemo.sln /p:Configuration="Release" /p:Platform=Win32
Then run it!
for /f %i in ('mapnik-config --prefix') do set MAPNIK_PREFIX=%i
Release\rundemo.exe %MAPNIK_PREFIX%

42
demo/c++/common.gypi Normal file
View file

@ -0,0 +1,42 @@
{
'variables': {
'conditions': [
['OS == "mac"', {
'target_arch%': 'x64'
}, {
'target_arch%': 'ia32'
}]
]
},
'target_defaults': {
'default_configuration': 'Release',
'defines': [ ],
'conditions': [
['OS == "mac"', {
'defines': [ 'DARWIN' ]
}, {
'defines': [ 'LINUX' ]
}],
['OS == "mac" and target_arch == "x64"', {
'xcode_settings': {
'ARCHS': [ 'x86_64' ]
},
}]
],
'configurations': {
'Debug': {
'cflags': [ '-g', '-O0' ],
'xcode_settings': {
'OTHER_CFLAGS': [ '-g', '-O0' ]
}
},
'Release': {
'cflags': [ '-O3' ],
'defines': [ 'NDEBUG' ],
'xcode_settings': {
'OTHER_CFLAGS': [ '-O3' ]
}
}
}
}
}

View file

@ -1,20 +0,0 @@
This directory contains a simple c++ program demonstrating the Mapnik C++ API. It mimics the python 'rundemo.py' example with a couple exceptions.
To build it re-configure SCons with DEMO=True then rebuild::
$ python scons/scons.py configure DEMO=True
$ python scons/scons.py
The sample program will be compiled (but not installed).
To run::
$ cd demo/c++
$ ./rundemo /usr/local/lib/mapnik
For more detailed comments have a look in demo/python/rundemo.py
Have fun!
Artem.

View file

@ -34,7 +34,6 @@
#include <mapnik/expression.hpp>
#include <mapnik/color_factory.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/config_error.hpp>
#if defined(HAVE_CAIRO)
#include <mapnik/cairo_renderer.hpp>
@ -313,11 +312,6 @@ int main ( int argc , char** argv)
#endif
}
catch ( const mapnik::config_error & ex )
{
std::cerr << "### Configuration error: " << ex.what() << std::endl;
return EXIT_FAILURE;
}
catch ( const std::exception & ex )
{
std::cerr << "### std::exception: " << ex.what() << std::endl;

48
demo/c++/rundemo.gyp Normal file
View file

@ -0,0 +1,48 @@
{
'includes': [ 'common.gypi' ],
'default_configuration': 'Release',
'targets': [
{
'target_name': 'rundemo',
'type': 'executable',
'sources': [
'rundemo.cpp',
],
'conditions': [
[ 'OS=="mac"', {
'libraries': [
'-lmapnik',
'-undefined dynamic_lookup'
],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS':[
'<!@(mapnik-config --cflags)'
],
'GCC_ENABLE_CPP_RTTI': 'YES',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
}
}],
[ 'OS=="win"', {
'defines': [
'<!@(mapnik-config --defines)',
],
'libraries': [
'<!@(mapnik-config --libs)',
'<!@(mapnik-config --dep-libs)'
],
'include_dirs': [
'<!@(mapnik-config --includes)',
'<!@(mapnik-config --dep-includes)',
],
'msvs_settings': {
'VCLinkerTool': {
'AdditionalLibraryDirectories': [
'<!@(mapnik-config --ldflags)'
]
}
}
}]
]
}
],
}

View file

@ -1,25 +0,0 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>charplacement</Name>
<ElementPath>charplacement</ElementPath>
<DatasetSpecificInfo>
<FeatureCount>1</FeatureCount>
<ExtentXMin>1.00000</ExtentXMin>
<ExtentXMax>2.00000</ExtentXMax>
<ExtentYMin>1.00000</ExtentYMin>
<ExtentYMax>5.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>NAME</Name>
<ElementPath>NAME</ElementPath>
<Type>String</Type>
<Width>0</Width>
</PropertyDefn>
<PropertyDefn>
<Name>CLASS</Name>
<ElementPath>CLASS</ElementPath>
<Type>String</Type>
<Width>0</Width>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View file

@ -1,99 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="charplacement.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
<gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:charplacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-1 1,-3 2,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>TRIANGLE</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F1">
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-1 4,-3 3,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>TRIANGLE</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F7">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
1,-12 13,-12
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>STRAIGHT</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F8">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
1,-13 2,-13 5,-13 10,-13 13,-13
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>STRAIGHT</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F9">
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-1 5,-3 5,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>BEND</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F10">
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-1 8,-3 8,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>BEND</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F11">
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-6 5,-8 6,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>BEND</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F12">
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-6 8,-8 7,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>BEND</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F13">
<ogr:geometryProperty><gml:LineString><gml:coordinates>10.055915,-1.00031738281 10.6649858,-1.077712483 11.274056,-1.26950068 11.77921,-1.55298308 12.191993,-1.92815928 12.51529,-2.369132 12.746218,-2.8329032 12.884774,-3.2968745 12.930959,-3.875339</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CURVE</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F14">
<ogr:geometryProperty><gml:LineString><gml:coordinates>10.0555,-8.875339 10.6645708,-8.7979439 11.273641,-8.6061557 11.778795,-8.3226733 12.191578,-7.9474971 12.514875,-7.5065244 12.745803,-7.0427532 12.884359,-6.5787819 12.930544,-6.0003174</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CURVE</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F15">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
9.055915,-2.00031738281 9.6649858,-2.077712483 10.274056,-2.26950068 10.77921,-2.55298308 11.191993,-2.92815928 11.51529,-3.369132 11.746218,-3.8329032 11.884774,-4.2968745 11.930959,-4.875339
11.930544,-5.0003174 11.884359,-5.5787819 11.745803,-6.0427532 11.514875,-6.5065244 11.191578,-6.9474971 10.778795,-7.3226733 10.273641,-7.6061557 9.6645708,-7.7979439 9.0555,-7.875339
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CURVE</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F16">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
9.0435048,-10.5550195 9.480786,-10.2191668 9.963148,-10.0731439 10.540222,-10.2495527 10.968444,-10.525815 11.419238,-10.8336443 12.01882,-10.9565825 12.559787,-10.7996079 12.956495,-10.4089966
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>SQUIGGLE</ogr:CLASS>
</ogr:charplacement>
<ogr:charplacement fid="F16">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
1,-9 1.4,-10 1.8,-9 2.2,-10 2.6,-9 3.0,-10 3.4,-9 3.8,-10 4.2,-9 4.6,-10
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long ZigZag Road Name</ogr:NAME>
<ogr:CLASS>ZIGZAG</ogr:CLASS>
</ogr:charplacement>
</gml:featureMember>
</ogr:FeatureCollection>

View file

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="charplacement" type="ogr:charplacement_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="charplacement_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
<xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

View file

@ -1,25 +0,0 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>displacement</Name>
<ElementPath>displacement</ElementPath>
<DatasetSpecificInfo>
<FeatureCount>1</FeatureCount>
<ExtentXMin>1.00000</ExtentXMin>
<ExtentXMax>2.00000</ExtentXMax>
<ExtentYMin>1.00000</ExtentYMin>
<ExtentYMax>5.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>NAME</Name>
<ElementPath>NAME</ElementPath>
<Type>String</Type>
<Width>0</Width>
</PropertyDefn>
<PropertyDefn>
<Name>CLASS</Name>
<ElementPath>CLASS</ElementPath>
<Type>String</Type>
<Width>0</Width>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View file

@ -1,173 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="displacement.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
<gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-3 1,-2</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-2 2,-1</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-1 3,-1</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-1 4,-2</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>4,-2 4,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>4,-3 3,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-4 2,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-4 1,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-3 6,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-4 7,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-4 8,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-3 8,-2</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-2 7,-1</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-1 6,-1</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-1 5,-2</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-2 5,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road</ogr:NAME>
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
1,-6.5 2,-5.5 3,-5 4,-5 5,-5.5 6,-6.5
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name To Go Around The Whole Curve!</ogr:NAME>
<ogr:CLASS>CURVE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
1,-7 2,-8 3,-8.5 4,-8.5 5,-8 6,-7
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name To Go Around The Whole Curve!</ogr:NAME>
<ogr:CLASS>CURVE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
3,-8.5 2,-9.5 1.5,-10.5 1.5,-11.5 2,-12.5 3,-13.5
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name To Go Around The Whole Curve!</ogr:NAME>
<ogr:CLASS>VERTCURVE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
4,-8.5 5,-9.5 5.5,-10.5 5.5,-11.5 5,-12.5 4,-13.5
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name To Go Around The Whole Curve!</ogr:NAME>
<ogr:CLASS>VERTCURVE</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
9.2,-4 9,-3 10,-3 10.2,-4
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>PARALLELOGRAM</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
9,-2 9.2,-1 10.2,-1 10,-2
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>PARALLELOGRAM</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
11,-1 11,-2 12,-2
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CORNER</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
11,-4 12,-4 12,-3
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CORNER</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
12.5,-1 13.5,-1 13.5,-2
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CORNER</ogr:CLASS>
</ogr:displacement>
<ogr:displacement fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
12.5,-4 12.5,-3 13.5,-3
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CORNER</ogr:CLASS>
</ogr:displacement>
</gml:featureMember>
</ogr:FeatureCollection>

View file

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="displacement" type="ogr:displacement_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="displacement_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
<xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

View file

@ -1,25 +0,0 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>overlap</Name>
<ElementPath>overlap</ElementPath>
<DatasetSpecificInfo>
<FeatureCount>1</FeatureCount>
<ExtentXMin>1.00000</ExtentXMin>
<ExtentXMax>2.00000</ExtentXMax>
<ExtentYMin>1.00000</ExtentYMin>
<ExtentYMax>5.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>NAME</Name>
<ElementPath>NAME</ElementPath>
<Type>String</Type>
<Width>0</Width>
</PropertyDefn>
<PropertyDefn>
<Name>CLASS</Name>
<ElementPath>CLASS</ElementPath>
<Type>String</Type>
<Width>0</Width>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View file

@ -1,127 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="overlap.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
<gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-1 1,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-3 7,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-3 7,-7</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-2 3,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-7 1,-7</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-2 5,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-3 12,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CROSS</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>10,-1 10,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CROSS</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
10,-9 13,-9 13,-11 11,-11 11,-8
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>SELFOVERLAP</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>4,-9 4,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK2</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-9 8,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK2</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-11 9,-11</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK2</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-9 2,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK2</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-9 6,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>NETWORK2</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>8.8,-6 8.8,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name</ogr:NAME>
<ogr:CLASS>BENDOVER</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-6 8,-7 10,-7 10,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name</ogr:NAME>
<ogr:CLASS>BENDUNDER</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>12.2,-6 12.2,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name</ogr:NAME>
<ogr:CLASS>BENDOVER</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>11,-6 11,-7 13,-7 13,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name</ogr:NAME>
<ogr:CLASS>BENDUNDER</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>12.2,-3.5 12.2,-5.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name</ogr:NAME>
<ogr:CLASS>BENDOVER</ogr:CLASS>
</ogr:overlap>
<ogr:overlap fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>11,-4.5 13,-4.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Long Road Name</ogr:NAME>
<ogr:CLASS>BENDUNDER</ogr:CLASS>
</ogr:overlap>
</gml:featureMember>
</ogr:FeatureCollection>

View file

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="overlap" type="ogr:overlap_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="overlap_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
<xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

View file

@ -1,25 +0,0 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>textspacing</Name>
<ElementPath>textspacing</ElementPath>
<DatasetSpecificInfo>
<FeatureCount>1</FeatureCount>
<ExtentXMin>1.00000</ExtentXMin>
<ExtentXMax>2.00000</ExtentXMax>
<ExtentYMin>1.00000</ExtentYMin>
<ExtentYMax>5.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>NAME</Name>
<ElementPath>NAME</ElementPath>
<Type>String</Type>
<Width>0</Width>
</PropertyDefn>
<PropertyDefn>
<Name>CLASS</Name>
<ElementPath>CLASS</ElementPath>
<Type>String</Type>
<Width>0</Width>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View file

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="textspacing.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
<gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:textspacing fid="F0">
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-1 1,-3 2,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>TRIANGLE</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F1">
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-1 4,-3 3,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>TRIANGLE</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F2">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-7 2,-7</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>STRAIGHT</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F3">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-8 3,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>STRAIGHT</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F4">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-9 4,-9</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>STRAIGHT</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F5">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-10 5,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>STRAIGHT</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F6">
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-11 7,-11</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>STRAIGHT</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F7">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
1,-12 13,-12
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>STRAIGHT</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F8">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
1,-13 2,-13 5,-13 10,-13 13,-13
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>STRAIGHT</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F9">
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-1 5,-3 5,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>BEND</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F10">
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-1 8,-3 8,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>BEND</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F11">
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-6 5,-8 6,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>BEND</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F12">
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-6 8,-8 7,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>BEND</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F13">
<ogr:geometryProperty><gml:LineString><gml:coordinates>10.055915,-1.00031738281 10.6649858,-1.077712483 11.274056,-1.26950068 11.77921,-1.55298308 12.191993,-1.92815928 12.51529,-2.369132 12.746218,-2.8329032 12.884774,-3.2968745 12.930959,-3.875339</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CURVE</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F14">
<ogr:geometryProperty><gml:LineString><gml:coordinates>10.0555,-8.875339 10.6645708,-8.7979439 11.273641,-8.6061557 11.778795,-8.3226733 12.191578,-7.9474971 12.514875,-7.5065244 12.745803,-7.0427532 12.884359,-6.5787819 12.930544,-6.0003174</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CURVE</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F15">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
9.055915,-2.00031738281 9.6649858,-2.077712483 10.274056,-2.26950068 10.77921,-2.55298308 11.191993,-2.92815928 11.51529,-3.369132 11.746218,-3.8329032 11.884774,-4.2968745 11.930959,-4.875339
11.930544,-5.0003174 11.884359,-5.5787819 11.745803,-6.0427532 11.514875,-6.5065244 11.191578,-6.9474971 10.778795,-7.3226733 10.273641,-7.6061557 9.6645708,-7.7979439 9.0555,-7.875339
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>CURVE</ogr:CLASS>
</ogr:textspacing>
<ogr:textspacing fid="F16">
<ogr:geometryProperty><gml:LineString><gml:coordinates>
9.0435048,-10.5550195 9.480786,-10.2191668 9.963148,-10.0731439 10.540222,-10.2495527 10.968444,-10.525815 11.419238,-10.8336443 12.01882,-10.9565825 12.559787,-10.7996079 12.956495,-10.4089966
</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:NAME>Road Name</ogr:NAME>
<ogr:CLASS>SQUIGGLE</ogr:CLASS>
</ogr:textspacing>
</gml:featureMember>
</ogr:FeatureCollection>

View file

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="textspacing" type="ogr:textspacing_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="textspacing_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
<xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

View file

@ -1,3 +0,0 @@
These files are for testing various rendering parts of mapnik, they have been created by hand.
The raw files are in the raw/ folder (they were created with inkscape to assist!)
Run the regenerate.sh script to regenerate the shape files from the gml files, this requires ogr2ogr to run.

View file

@ -1,20 +0,0 @@
#!/bin/sh
rm -f textspacing.shp textspacing.shx textspacing.dbf
ogr2ogr -f "ESRI Shapefile" textspacing raw/textspacing.gml
mv textspacing/* ./
rmdir textspacing
rm -f overlap.shp overlap.shx overlap.dbf
ogr2ogr -f "ESRI Shapefile" overlap raw/overlap.gml
mv overlap/* ./
rmdir overlap
rm -f displacement.shp displacement.shx displacement.dbf
ogr2ogr -f "ESRI Shapefile" displacement raw/displacement.gml
mv displacement/* ./
rmdir displacement
rm -f charplacement.shp charplacement.shx charplacement.dbf
ogr2ogr -f "ESRI Shapefile" charplacement raw/charplacement.gml
mv charplacement/* ./
rmdir charplacement

View file

@ -19,15 +19,15 @@
// qt
#include <QApplication>
#include <QtWidgets/QApplication>
#include <QStringList>
#include <QSettings>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include "mainwindow.hpp"
// boost
#include <boost/algorithm/string.hpp>
#include <boost/filesystem/operations.hpp>
int main( int argc, char **argv )

View file

@ -32,7 +32,10 @@
#include <QSlider>
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QFileDialog>
#include <QMenu>
#include <QMenuBar>
#include <QToolBar>
// mapnik
#ifndef Q_MOC_RUN // QT moc chokes on BOOST_JOIN

View file

@ -22,7 +22,6 @@
#define MAINWINDOW_HPP
#include <QMainWindow>
#include <QPrinter>
#include <QList>
#include <QActionGroup>
#include <QStatusBar>
@ -78,7 +77,6 @@ private:
LayerTab *layerTab_;
StyleTab * styleTab_;
MapWidget * mapWidget_;
QPrinter printer;
//actions
QList<QAction *> exportAsActs;
QActionGroup *toolsGroup;

View file

@ -26,7 +26,6 @@
#include <mapnik/agg_renderer.hpp>
#include <mapnik/graphics.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/layer.hpp>
#include <mapnik/projection.hpp>
#include <mapnik/scale_denominator.hpp>
@ -528,42 +527,7 @@ void render_agg(mapnik::Map const& map, double scaling_factor, QPixmap & pix)
void render_grid(mapnik::Map const& map, double scaling_factor, QPixmap & pix)
{
unsigned width=map.width();
unsigned height=map.height();
mapnik::grid buf(width,height,"F_CODE", 1);
mapnik::grid_renderer<mapnik::grid> ren(map,buf,scaling_factor);
try
{
ren.apply();
mapnik::value_integer * imdata = static_cast<mapnik::value_integer*>(buf.raw_data());
// Not sure how to display long long values ??
//QImage image(width,height,QImage::Format_RGB32);
//for (unsigned i = 0 ; i < height ; ++i)
//{
// for (unsigned j = 0 ; j < width ; ++j)
// {
// image.setPixel(j,i,qRgb((uint8_t)(imdata[i*width+j]>>8),
// (uint8_t)(imdata[i*width+j+1]>>8),
// (uint8_t)(imdata[i*width+j+2]>>8)));
// }
//}
//pix = QPixmap::fromImage(image);
}
catch (mapnik::config_error & ex)
{
std::cerr << ex.what() << std::endl;
}
catch (const std::exception & ex)
{
std::cerr << "exception: " << ex.what() << std::endl;
}
catch (...)
{
std::cerr << "Unknown exception caught!\n";
}
std::cerr << "Not supported" << std::endl;
}

View file

@ -2,8 +2,10 @@
# Mapnik viewer - Copyright (C) 2007 Artem Pavlenko
######################################################################
TEMPLATE = app
QT += core gui widgets
QMAKE_CXX = clang++
QMAKE_CXXFLAGS += $$system(mapnik-config --cxxflags)
QMAKE_CXXFLAGS += $$system(mapnik-config --includes --dep-includes)
QMAKE_LFLAGS += $$system(mapnik-config --libs)
QMAKE_LFLAGS += $$system(mapnik-config --ldflags --dep-libs)
QMAKE_LFLAGS += -lboost_timer

View file

@ -1,16 +1,16 @@
/*******************************************************************************
* *
* Author : Angus Johnson *
* Version : 1.1 *
* Date : 4 April 2011 *
* Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2011 *
* *
* License: *
* Use, modification & distribution is subject to Boost Software License Ver 1. *
* http://www.boost.org/LICENSE_1_0.txt *
* *
*******************************************************************************/
* *
* Author : Angus Johnson *
* Version : 1.1 *
* Date : 4 April 2011 *
* Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2011 *
* *
* License: *
* Use, modification & distribution is subject to Boost Software License Ver 1. *
* http://www.boost.org/LICENSE_1_0.txt *
* *
*******************************************************************************/
#ifndef AGG_CONV_CLIPPER_INCLUDED
#define AGG_CONV_CLIPPER_INCLUDED
@ -22,46 +22,44 @@
namespace agg
{
enum clipper_op_e { clipper_or,
clipper_and, clipper_xor, clipper_a_minus_b, clipper_b_minus_a };
enum clipper_PolyFillType {clipper_even_odd, clipper_non_zero, clipper_positive, clipper_negative};
enum clipper_op_e { clipper_or,
clipper_and, clipper_xor, clipper_a_minus_b, clipper_b_minus_a };
enum clipper_PolyFillType {clipper_even_odd, clipper_non_zero, clipper_positive, clipper_negative};
template<class VSA, class VSB> class conv_clipper
{
template<class VSA, class VSB> class conv_clipper
{
enum status { status_move_to, status_line_to, status_stop };
typedef VSA source_a_type;
typedef VSB source_b_type;
typedef conv_clipper<source_a_type, source_b_type> self_type;
private:
source_a_type* m_src_a;
source_b_type* m_src_b;
status m_status;
int m_vertex;
int m_contour;
int m_scaling_factor;
clipper_op_e m_operation;
pod_bvector<ClipperLib::IntPoint, 8> m_vertex_accumulator;
ClipperLib::Polygons m_poly_a;
ClipperLib::Polygons m_poly_b;
ClipperLib::Polygons m_result;
ClipperLib::Clipper m_clipper;
clipper_PolyFillType m_subjFillType;
clipper_PolyFillType m_clipFillType;
double start_x_;
double start_y_;
private:
source_a_type* m_src_a;
source_b_type* m_src_b;
status m_status;
int m_vertex;
int m_contour;
int m_scaling_factor;
clipper_op_e m_operation;
pod_bvector<ClipperLib::IntPoint, 8> m_vertex_accumulator;
ClipperLib::Polygons m_poly_a;
ClipperLib::Polygons m_poly_b;
ClipperLib::Polygons m_result;
ClipperLib::Clipper m_clipper;
clipper_PolyFillType m_subjFillType;
clipper_PolyFillType m_clipFillType;
int Round(double val)
{
if ((val < 0)) return (int)(val - 0.5); else return (int)(val + 0.5);
if ((val < 0)) return (int)(val - 0.5); else return (int)(val + 0.5);
}
public:
public:
conv_clipper(source_a_type &a, source_b_type &b,
clipper_op_e op = clipper_or,
clipper_PolyFillType subjFillType = clipper_even_odd,
clipper_PolyFillType clipFillType = clipper_even_odd,
int scaling_factor = 2) :
clipper_op_e op = clipper_or,
clipper_PolyFillType subjFillType = clipper_even_odd,
clipper_PolyFillType clipFillType = clipper_even_odd,
int scaling_factor = 2) :
m_src_a(&a),
m_src_b(&b),
m_status(status_move_to),
@ -69,41 +67,20 @@ public:
m_contour(-1),
m_operation(op),
m_subjFillType(subjFillType),
m_clipFillType(clipFillType),
start_x_(0),
start_y_(0)
m_clipFillType(clipFillType)
{
m_scaling_factor = std::max(std::min(scaling_factor, 6),0);
m_scaling_factor = Round(std::pow((double)10, m_scaling_factor));
}
conv_clipper(source_a_type &a,
clipper_op_e op = clipper_and,
clipper_PolyFillType subjFillType = clipper_non_zero,
clipper_PolyFillType clipFillType = clipper_non_zero,
int scaling_factor = 6) :
m_src_a(&a),
m_status(status_move_to),
m_vertex(-1),
m_contour(-1),
m_operation(op),
m_subjFillType(subjFillType),
m_clipFillType(clipFillType),
start_x_(0),
start_y_(0)
{
m_scaling_factor = std::max(std::min(scaling_factor, 6),0);
m_scaling_factor = Round(std::pow((double)10, m_scaling_factor));
}
m_scaling_factor = std::max(std::min(scaling_factor, 6),0);
m_scaling_factor = Round(std::pow((double)10, m_scaling_factor));
}
~conv_clipper()
{
}
unsigned type() const { return m_src_a->type(); }
void attach1(VSA &source, clipper_PolyFillType subjFillType = clipper_even_odd)
{ m_src_a = &source; m_subjFillType = subjFillType; }
{ m_src_a = &source; m_subjFillType = subjFillType; }
void attach2(VSB &source, clipper_PolyFillType clipFillType = clipper_even_odd)
{ m_src_b = &source; m_clipFillType = clipFillType; }
{ m_src_b = &source; m_clipFillType = clipFillType; }
void operation(clipper_op_e v) { m_operation = v; }
@ -116,55 +93,55 @@ public:
void add_vertex_(double &x, double &y);
void end_contour(ClipperLib::Polygons &p);
template<class VS> void add(VS &src, ClipperLib::Polygons &p){
unsigned cmd;
double x; double y; double start_x; double start_y;
bool starting_first_line;
template<class VS> void add(VS &src, ClipperLib::Polygons &p){
unsigned cmd;
double x; double y; double start_x; double start_y;
bool starting_first_line;
start_x = 0.0;
start_y = 0.0;
starting_first_line = true;
p.resize(0);
start_x = 0.0;
start_y = 0.0;
starting_first_line = true;
p.resize(0);
cmd = src->vertex( &x , &y );
while(!is_stop(cmd))
{
if(is_vertex(cmd))
{
if(is_move_to(cmd))
{
if(!starting_first_line ) end_contour(p);
start_x = x;
start_y = y;
}
add_vertex_( x, y );
starting_first_line = false;
}
else if(is_end_poly(cmd))
{
if(!starting_first_line && is_closed(cmd))
add_vertex_( start_x, start_y );
}
cmd = src->vertex( &x, &y );
}
end_contour(p);
}
};
cmd = src->vertex( &x , &y );
while(!is_stop(cmd))
{
if(is_vertex(cmd))
{
if(is_move_to(cmd))
{
if(!starting_first_line ) end_contour(p);
start_x = x;
start_y = y;
}
add_vertex_( x, y );
starting_first_line = false;
}
else if(is_end_poly(cmd))
{
if(!starting_first_line && is_closed(cmd))
add_vertex_( start_x, start_y );
}
cmd = src->vertex( &x, &y );
}
end_contour(p);
}
};
//------------------------------------------------------------------------
//------------------------------------------------------------------------
template<class VSA, class VSB>
void conv_clipper<VSA, VSB>::start_extracting()
{
template<class VSA, class VSB>
void conv_clipper<VSA, VSB>::start_extracting()
{
m_status = status_move_to;
m_contour = -1;
m_vertex = -1;
}
//------------------------------------------------------------------------------
}
//------------------------------------------------------------------------------
template<class VSA, class VSB>
void conv_clipper<VSA, VSB>::rewind(unsigned path_id)
{
template<class VSA, class VSB>
void conv_clipper<VSA, VSB>::rewind(unsigned path_id)
{
m_src_a->rewind( path_id );
m_src_b->rewind( path_id );
@ -175,149 +152,141 @@ void conv_clipper<VSA, VSB>::rewind(unsigned path_id)
ClipperLib::PolyFillType pftSubj, pftClip;
switch (m_subjFillType)
{
case clipper_even_odd: pftSubj = ClipperLib::pftEvenOdd; break;
case clipper_non_zero: pftSubj = ClipperLib::pftNonZero; break;
case clipper_positive: pftSubj = ClipperLib::pftPositive; break;
default: pftSubj = ClipperLib::pftNegative;
case clipper_even_odd: pftSubj = ClipperLib::pftEvenOdd; break;
case clipper_non_zero: pftSubj = ClipperLib::pftNonZero; break;
case clipper_positive: pftSubj = ClipperLib::pftPositive; break;
default: pftSubj = ClipperLib::pftNegative;
}
switch (m_clipFillType)
{
case clipper_even_odd: pftClip = ClipperLib::pftEvenOdd; break;
case clipper_non_zero: pftClip = ClipperLib::pftNonZero; break;
case clipper_positive: pftClip = ClipperLib::pftPositive; break;
default: pftClip = ClipperLib::pftNegative;
case clipper_even_odd: pftClip = ClipperLib::pftEvenOdd; break;
case clipper_non_zero: pftClip = ClipperLib::pftNonZero; break;
case clipper_positive: pftClip = ClipperLib::pftPositive; break;
default: pftClip = ClipperLib::pftNegative;
}
m_clipper.Clear();
switch( m_operation ) {
case clipper_or:
{
case clipper_or:
{
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
m_clipper.Execute( ClipperLib::ctUnion , m_result , pftSubj, pftClip);
break;
}
case clipper_and:
{
break;
}
case clipper_and:
{
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
m_clipper.Execute( ClipperLib::ctIntersection , m_result, pftSubj, pftClip );
break;
}
case clipper_xor:
{
break;
}
case clipper_xor:
{
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
m_clipper.Execute( ClipperLib::ctXor , m_result, pftSubj, pftClip );
break;
}
case clipper_a_minus_b:
{
break;
}
case clipper_a_minus_b:
{
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
m_clipper.Execute( ClipperLib::ctDifference , m_result, pftSubj, pftClip );
break;
}
case clipper_b_minus_a:
{
break;
}
case clipper_b_minus_a:
{
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptSubject );
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptClip );
m_clipper.Execute( ClipperLib::ctDifference , m_result, pftSubj, pftClip );
break;
}
break;
}
}
start_extracting();
}
//------------------------------------------------------------------------------
template<class VSA, class VSB>
void conv_clipper<VSA, VSB>::end_contour( ClipperLib::Polygons &p)
{
unsigned i, len;
if( m_vertex_accumulator.size() < 3 ) return;
len = p.size();
p.resize(len+1);
p[len].resize(m_vertex_accumulator.size());
for( i = 0 ; i < m_vertex_accumulator.size() ; i++ )
p[len][i] = m_vertex_accumulator[i];
m_vertex_accumulator.remove_all();
}
//------------------------------------------------------------------------------
template<class VSA, class VSB>
void conv_clipper<VSA, VSB>::add_vertex_(double &x, double &y)
{
ClipperLib::IntPoint v;
v.X = Round(x * m_scaling_factor);
v.Y = Round(y * m_scaling_factor);
m_vertex_accumulator.add( v );
}
//------------------------------------------------------------------------------
template<class VSA, class VSB>
bool conv_clipper<VSA, VSB>::next_contour()
{
m_contour++;
if(m_contour >= (int)m_result.size()) return false;
m_vertex =-1;
return true;
}
//------------------------------------------------------------------------------
template<class VSA, class VSB>
void conv_clipper<VSA, VSB>::end_contour( ClipperLib::Polygons &p)
{
unsigned i, len;
if( m_vertex_accumulator.size() < 3 ) return;
len = p.size();
p.resize(len+1);
p[len].resize(m_vertex_accumulator.size());
for( i = 0 ; i < m_vertex_accumulator.size() ; i++ )
p[len][i] = m_vertex_accumulator[i];
m_vertex_accumulator.remove_all();
}
//------------------------------------------------------------------------------
template<class VSA, class VSB>
void conv_clipper<VSA, VSB>::add_vertex_(double &x, double &y)
{
ClipperLib::IntPoint v;
v.X = Round(x * m_scaling_factor);
v.Y = Round(y * m_scaling_factor);
m_vertex_accumulator.add( v );
}
//------------------------------------------------------------------------------
template<class VSA, class VSB>
bool conv_clipper<VSA, VSB>::next_contour()
{
m_contour++;
if(m_contour >= (int)m_result.size()) return false;
m_vertex =-1;
return true;
}
//------------------------------------------------------------------------------
template<class VSA, class VSB>
bool conv_clipper<VSA, VSB>::next_vertex(double *x, double *y)
{
template<class VSA, class VSB>
bool conv_clipper<VSA, VSB>::next_vertex(double *x, double *y)
{
m_vertex++;
if(m_vertex >= (int)m_result[m_contour].size()) return false;
*x = (double)m_result[ m_contour ][ m_vertex ].X / m_scaling_factor;
*y = (double)m_result[ m_contour ][ m_vertex ].Y / m_scaling_factor;
return true;
}
//------------------------------------------------------------------------------
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
template<class VSA, class VSB>
unsigned conv_clipper<VSA, VSB>::vertex(double *x, double *y)
template<class VSA, class VSB>
unsigned conv_clipper<VSA, VSB>::vertex(double *x, double *y)
{
if( m_status == status_move_to )
if( m_status == status_move_to )
{
if( next_contour() )
{
if( next_contour() )
{
if( next_vertex( x, y ) )
{
m_status =status_line_to;
start_x_ = *x;
start_y_ = *y;
return path_cmd_move_to;
}
else
{
*x = start_x_;
*y = start_y_;
m_status = status_stop;
return path_cmd_end_poly | path_flags_close;
}
}
else
return path_cmd_stop;
if( next_vertex( x, y ) )
{
m_status =status_line_to;
return path_cmd_move_to;
}
else
{
m_status = status_stop;
return path_cmd_end_poly | path_flags_close;
}
}
else
else
return path_cmd_stop;
}
else
{
if( next_vertex( x, y ) )
{
if( next_vertex( x, y ) )
{
return path_cmd_line_to;
}
else
{
m_status = status_move_to;
*x = start_x_;
*y = start_y_;
return path_cmd_end_poly | path_flags_close;
}
return path_cmd_line_to;
}
else
{
m_status = status_move_to;
return path_cmd_end_poly | path_flags_close;
}
}
}
//------------------------------------------------------------------------------

View file

@ -18,6 +18,9 @@
#include "agg_basics.h"
// https://github.com/mapnik/mapnik/issues/1860
#include <mapnik/config.hpp>
namespace agg
{
@ -25,7 +28,8 @@ namespace agg
//
// See Implementation agg_vpgen_clip_polygon.cpp
//
class vpgen_clip_polygon
class MAPNIK_DECL vpgen_clip_polygon
{
public:
vpgen_clip_polygon() :

View file

@ -18,6 +18,9 @@
#include "agg_basics.h"
// https://github.com/mapnik/mapnik/issues/1860
#include <mapnik/config.hpp>
namespace agg
{
@ -25,7 +28,7 @@ namespace agg
//
// See Implementation agg_vpgen_clip_polyline.cpp
//
class vpgen_clip_polyline
class MAPNIK_DECL vpgen_clip_polyline
{
public:
vpgen_clip_polyline() :

27
deps/clipper/include/clipper.hpp vendored Normal file → Executable file
View file

@ -1,8 +1,8 @@
/*******************************************************************************
* *
* Author : Angus Johnson *
* Version : 5.1.3 *
* Date : 27 February 2013 *
* Version : 5.1.5 *
* Date : 4 May 2013 *
* Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2013 *
* *
@ -34,6 +34,8 @@
#ifndef clipper_hpp
#define clipper_hpp
#include <mapnik/config.hpp>
#include <vector>
#include <stdexcept>
#include <cstring>
@ -103,7 +105,7 @@ private:
enum JoinType { jtSquare, jtRound, jtMiter };
bool Orientation(const Polygon &poly);
double Area(const Polygon &poly);
MAPNIK_DECL double Area(const Polygon &poly);
void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys,
double delta, JoinType jointype = jtSquare, double limit = 0, bool autoFix = true);
@ -134,7 +136,6 @@ struct TEdge {
double dx;
long64 deltaX;
long64 deltaY;
long64 tmpX;
PolyType polyType;
EdgeSide side;
int windDelta; //1 or -1 depending on winding direction
@ -211,7 +212,7 @@ typedef std::vector < HorzJoinRec* > HorzJoinList;
//ClipperBase is the ancestor to the Clipper class. It should not be
//instantiated directly. This class simply abstracts the conversion of sets of
//polygon coordinates into edge objects that are stored in a LocalMinima list.
class ClipperBase
class MAPNIK_DECL ClipperBase
{
public:
ClipperBase();
@ -232,7 +233,7 @@ protected:
EdgeList m_edges;
};
class Clipper : public virtual ClipperBase
class MAPNIK_DECL Clipper : public virtual ClipperBase
{
public:
Clipper();
@ -248,6 +249,8 @@ public:
void Clear();
bool ReverseSolution() {return m_ReverseOutput;};
void ReverseSolution(bool value) {m_ReverseOutput = value;};
bool ForceSimple() {return m_ForceSimple;};
void ForceSimple(bool value) {m_ForceSimple = value;};
protected:
void Reset();
virtual bool ExecuteInternal();
@ -265,6 +268,7 @@ private:
PolyFillType m_SubjFillType;
bool m_ReverseOutput;
bool m_UsingPolyTree;
bool m_ForceSimple;
void DisposeScanbeamList();
void SetWindingCount(TEdge& edge);
bool IsEvenOddFillType(const TEdge& edge) const;
@ -287,10 +291,8 @@ private:
void ProcessHorizontal(TEdge *horzEdge);
void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
void AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
OutRec* GetOutRec(int idx);
void AppendPolygon(TEdge *e1, TEdge *e2);
void DoEdge1(TEdge *edge1, TEdge *edge2, const IntPoint &pt);
void DoEdge2(TEdge *edge1, TEdge *edge2, const IntPoint &pt);
void DoBothEdges(TEdge *edge1, TEdge *edge2, const IntPoint &pt);
void IntersectEdges(TEdge *e1, TEdge *e2,
const IntPoint &pt, const IntersectProtects protects);
OutRec* CreateOutRec();
@ -304,12 +306,12 @@ private:
void ProcessEdgesAtTopOfScanbeam(const long64 topY);
void BuildResult(Polygons& polys);
void BuildResult2(PolyTree& polytree);
void SetHoleState(TEdge *e, OutRec *OutRec);
void SetHoleState(TEdge *e, OutRec *outrec);
void DisposeIntersectNodes();
bool FixupIntersectionOrder();
void FixupOutPolygon(OutRec &outRec);
void FixupOutPolygon(OutRec &outrec);
bool IsHole(TEdge *e);
void FixHoleLinkage(OutRec &outRec);
void FixHoleLinkage(OutRec &outrec);
void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1);
void ClearJoins();
void AddHorzJoin(TEdge *e, int idx);
@ -317,6 +319,7 @@ private:
bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2);
void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx);
void JoinCommonEdges();
void DoSimplePolygons();
void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec);
void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec);
};

610
deps/clipper/src/clipper.cpp vendored Normal file → Executable file

File diff suppressed because it is too large Load diff

25
docs/text_layout.gv Normal file
View file

@ -0,0 +1,25 @@
/* process with:
dot text_layout.gv -Tsvg > text_layout.svg
dot text_layout.gv -Tpng > text_layout.png
*/
digraph textrendering {
Text [color=red]
text_layout[shape=box]
renderer [color=red]
Text -> text_layout
text_layout -> Freetype[dir=both]
text_layout -> text_itemizer [dir=both]
text_layout -> HarfBuzz [dir=both]
text_layout -> text_layout [label="line breaking"]
text_layout -> text_line
text_line -> format_run
format_run -> char_properties
format_run -> glyph_info
text_layout -> placement_finder
placement_finder -> glyph_positions
glyph_positions -> renderer
// { rank=same; text_layout HarfBuzz Freetype text_itemizer }
}

BIN
docs/text_layout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View file

@ -4,7 +4,7 @@ from glob import glob
Import('env')
base = './mapnik/'
subdirs = ['','svg','wkt','grid','json','util','text_placements','formatting']
subdirs = ['','svg','wkt','grid','json','util','text','text/placements','text/formatting']
if env['SVG_RENDERER']:
subdirs.append('svg/output')

View file

@ -30,6 +30,7 @@
#include <mapnik/noncopyable.hpp> // for noncopyable
#include <mapnik/rule.hpp> // for rule, symbolizers
#include <mapnik/box2d.hpp> // for box2d
#include <mapnik/pixel_position.hpp>
#include <mapnik/color.hpp> // for color
#include <mapnik/ctrans.hpp> // for CoordTransform
#include <mapnik/image_compositing.hpp> // for composite_mode_e

View file

@ -44,7 +44,7 @@
#include <mapnik/expression_node.hpp>
#include <mapnik/parse_path.hpp> // for path_processor_type
#include <mapnik/path_expression.hpp> // for path_expression_ptr
#include <mapnik/text_placements/base.hpp> // for text_placements
#include <mapnik/text/placements/base.hpp> // for text_placements
// boost
#include <boost/concept_check.hpp>

View file

@ -26,6 +26,7 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/pixel_position.hpp>
// boost
#include <boost/operators.hpp>
@ -94,12 +95,15 @@ public:
void pad(T padding);
bool from_string(std::string const& s);
bool valid() const;
void move(T x, T y);
// define some operators
box2d_type& operator+=(box2d_type const& other);
box2d_type& operator*=(T);
box2d_type& operator/=(T);
T operator[](int index) const;
box2d_type operator +(T other) const; //enlarge box by given amount
box2d_type& operator +=(T other); //enlarge box by given amount
// compute the bounding box of this one transformed
box2d_type operator* (agg::trans_affine const& tr) const;

View file

@ -33,15 +33,17 @@
#include <mapnik/image_compositing.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/gradient.hpp>
#include <mapnik/text/text_properties.hpp>
#include <mapnik/text/placements_list.hpp>
#include <mapnik/vertex.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/foreach.hpp>
#include <boost/shared_ptr.hpp>
// cairo
#include <cairo.h>
#include <cairo-ft.h>
// stl
#include <map>
@ -318,9 +320,9 @@ public:
void translate(double x, double y);
void save();
void restore();
void show_glyph(unsigned long index, double x, double y);
void glyph_path(unsigned long index, double x, double y);
void add_text(text_path const& path,
void show_glyph(unsigned long index, pixel_position const pos);
void glyph_path(unsigned long index, pixel_position const pos);
void add_text(glyph_positions_ptr pos,
cairo_face_manager & manager,
face_manager<freetype_engine> & font_manager,
double scale_factor = 1.0);

View file

@ -31,6 +31,7 @@
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/map.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/request.hpp>
#include <mapnik/rule.hpp> // for all symbolizers
#include <mapnik/noncopyable.hpp>

View file

@ -39,9 +39,15 @@
# pragma warning(disable : 4996) //_CRT_SECURE_NO_DEPRECATE
# endif
#else
# if __GNUC__ >= 4
# define MAPNIK_EXP __attribute__ ((visibility ("default")))
# define MAPNIK_DECL __attribute__ ((visibility ("default")))
# define MAPNIK_IMP __attribute__ ((visibility ("default")))
# else
# define MAPNIK_EXP
# define MAPNIK_IMP
# define MAPNIK_DECL
# define MAPNIK_IMP
# endif
#endif
#define PROJ_ENVELOPE_POINTS 20

View file

@ -23,6 +23,8 @@
#ifndef MAPNIK_CONFIG_ERROR_HPP
#define MAPNIK_CONFIG_ERROR_HPP
#include <mapnik/config.hpp>
#include <exception>
#include <string>

View file

@ -20,8 +20,8 @@
*
*****************************************************************************/
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_DEF_HPP
#define MAPNIK_CSS_COLOR_GRAMMAR_DEF_HPP
// NOTE: This is an implementation header file and is only meant to be included
// from implementation files. It therefore doesn't have an include guard.
// boost
#include <boost/version.hpp>
@ -100,5 +100,3 @@ css_color_grammar<Iterator>::css_color_grammar()
}
#endif
#endif

View file

@ -47,7 +47,7 @@ struct MAPNIK_DECL Featureset : private mapnik::noncopyable
virtual ~Featureset() {}
};
typedef MAPNIK_DECL boost::shared_ptr<Featureset> featureset_ptr;
typedef boost::shared_ptr<Featureset> featureset_ptr;
class MAPNIK_DECL datasource_exception : public std::exception
{
@ -134,19 +134,23 @@ public:
typedef boost::shared_ptr<datasource> datasource_ptr;
#define DATASOURCE_PLUGIN(classname) \
extern "C" MAPNIK_EXP const char * datasource_name() \
{ \
return classname::name(); \
} \
extern "C" MAPNIK_EXP datasource* create(parameters const& params) \
{ \
return new classname(params); \
} \
extern "C" MAPNIK_EXP void destroy(datasource *ds) \
{ \
delete ds; \
}
#ifdef MAPNIK_STATIC_PLUGINS
#define DATASOURCE_PLUGIN(classname)
#else
#define DATASOURCE_PLUGIN(classname) \
extern "C" MAPNIK_EXP const char * datasource_name() \
{ \
return classname::name(); \
} \
extern "C" MAPNIK_EXP datasource* create(parameters const& params) \
{ \
return new classname(params); \
} \
extern "C" MAPNIK_EXP void destroy(datasource *ds) \
{ \
delete ds; \
}
#endif
}

View file

@ -35,8 +35,6 @@
// stl
#include <map>
struct lt__handle;
namespace mapnik {
class PluginInfo;
@ -57,7 +55,6 @@ private:
~datasource_cache();
std::map<std::string,boost::shared_ptr<PluginInfo> > plugins_;
bool registered_;
bool insert(std::string const& name,lt__handle * const module);
std::vector<std::string> plugin_directories_;
};
}

View file

@ -25,14 +25,30 @@
#include <mapnik/config.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/enumeration.hpp>
namespace mapnik
{
enum debug_symbolizer_mode_enum {
DEBUG_SYM_MODE_COLLISION,
DEBUG_SYM_MODE_VERTEX,
debug_symbolizer_mode_enum_MAX
};
DEFINE_ENUM( debug_symbolizer_mode_e, debug_symbolizer_mode_enum );
struct MAPNIK_DECL debug_symbolizer :
public symbolizer_base
{
debug_symbolizer() : symbolizer_base() {}
debug_symbolizer();
debug_symbolizer(debug_symbolizer const& rhs);
debug_symbolizer_mode_e get_mode() const;
void set_mode(debug_symbolizer_mode_e mode);
private:
debug_symbolizer_mode_e mode_;
};
}

View file

@ -57,9 +57,9 @@ struct evaluate : boost::static_visitor<T1>
return attr.value<value_type,feature_type>(feature_);
}
value_type operator() (geometry_type_attribute const& attr) const
value_type operator() (geometry_type_attribute const& geom) const
{
return attr.value<value_type,feature_type>(feature_);
return geom.value<value_type,feature_type>(feature_);
}
value_type operator() (binary_node<tags::logical_and> const & x) const

View file

@ -24,6 +24,7 @@
#define MAPNIK_EXPRESSIONS_GRAMMAR_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/expression_node.hpp>

View file

@ -0,0 +1,191 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2012 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
*
*****************************************************************************/
// NOTE: This is an implementation header file and is only meant to be included
// from implementation files. It therefore doesn't have an include guard.
// mapnik
#include <mapnik/expression_node.hpp>
#include <mapnik/expression_grammar.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/value_types.hpp>
// boost
#include <boost/version.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_object.hpp>
// fwd declare
namespace mapnik {
struct attribute;
struct geometry_type_attribute;
}
namespace mapnik
{
template <typename T0,typename T1>
expr_node regex_match_impl::operator() (T0 & node, T1 const& pattern) const
{
#if defined(BOOST_REGEX_HAS_ICU)
return regex_match_node(node,tr_.transcode(pattern.c_str()));
#else
return regex_match_node(node,pattern);
#endif
}
template <typename T0,typename T1,typename T2>
expr_node regex_replace_impl::operator() (T0 & node, T1 const& pattern, T2 const& format) const
{
#if defined(BOOST_REGEX_HAS_ICU)
return regex_replace_node(node,tr_.transcode(pattern.c_str()),tr_.transcode(format.c_str()));
#else
return regex_replace_node(node,pattern,format);
#endif
}
template <typename Iterator>
expression_grammar<Iterator>::expression_grammar(mapnik::transcoder const& tr)
: expression_grammar::base_type(expr),
unicode_(unicode_impl(tr)),
regex_match_(regex_match_impl(tr)),
regex_replace_(regex_replace_impl(tr))
{
using boost::phoenix::construct;
using qi::_1;
using qi::_a;
using qi::_b;
using qi::_r1;
#if BOOST_VERSION > 104200
using qi::no_skip;
#endif
using qi::lexeme;
using qi::_val;
using qi::lit;
using qi::double_;
using qi::hex;
using qi::omit;
using standard_wide::char_;
using standard_wide::no_case;
expr = logical_expr.alias();
logical_expr = not_expr [_val = _1]
>>
*( ( ( lit("and") | lit("&&")) >> not_expr [_val && _1] )
| (( lit("or") | lit("||")) >> not_expr [_val || _1])
)
;
not_expr =
cond_expr [_val = _1 ]
| ((lit("not") | lit('!')) >> cond_expr [ _val = !_1 ])
;
cond_expr = equality_expr [_val = _1] | additive_expr [_val = _1]
;
equality_expr =
relational_expr [_val = _1]
>> *( ( (lit("=") | lit("eq") | lit("is")) >> relational_expr [_val == _1])
| (( lit("!=") | lit("<>") | lit("neq") ) >> relational_expr [_val != _1])
)
;
regex_match_expr = lit(".match")
>> lit('(')
>> ustring [_val = _1]
>> lit(')')
;
regex_replace_expr =
lit(".replace")
>> lit('(')
>> ustring [_a = _1]
>> lit(',')
>> ustring [_b = _1]
>> lit(')') [_val = regex_replace_(_r1,_a,_b)]
;
relational_expr = additive_expr[_val = _1]
>>
*( ( (lit("<=") | lit("le") ) >> additive_expr [ _val <= _1 ])
| ( (lit('<') | lit("lt") ) >> additive_expr [ _val < _1 ])
| ( (lit(">=") | lit("ge") ) >> additive_expr [ _val >= _1 ])
| ( (lit('>') | lit("gt") ) >> additive_expr [ _val > _1 ])
)
;
additive_expr = multiplicative_expr [_val = _1]
>> * ( '+' >> multiplicative_expr[_val += _1]
| '-' >> multiplicative_expr[_val -= _1]
)
;
multiplicative_expr = unary_expr [_val = _1]
>> *( '*' >> unary_expr [_val *= _1]
| '/' >> unary_expr [_val /= _1]
| '%' >> unary_expr [_val %= _1]
| regex_match_expr[_val = regex_match_(_val, _1)]
| regex_replace_expr(_val) [_val = _1]
)
;
unary_expr = primary_expr [_val = _1]
| '+' >> primary_expr [_val = _1]
| '-' >> primary_expr [_val = -_1]
;
primary_expr = strict_double [_val = _1]
| int__[_val = _1]
| no_case[lit("true")] [_val = true]
| no_case[lit("false")] [_val = false]
| no_case[lit("null")] [_val = value_null() ]
| no_case[geom_type][_val = _1 ]
| ustring [_val = unicode_(_1) ]
| lit("[mapnik::geometry_type]")[_val = construct<mapnik::geometry_type_attribute>()]
| attr [_val = construct<mapnik::attribute>( _1 ) ]
| '(' >> expr [_val = _1 ] >> ')'
;
unesc_char.add("\\a", '\a')("\\b", '\b')("\\f", '\f')("\\n", '\n')
("\\r", '\r')("\\t", '\t')("\\v", '\v')("\\\\", '\\')
("\\\'", '\'')("\\\"", '\"')
;
#if BOOST_VERSION > 104500
quote_char %= char_('\'') | char_('"');
ustring %= omit[quote_char[_a = _1]]
>> *(unesc_char | "\\x" >> hex | (char_ - lit(_a)))
>> lit(_a);
attr %= '[' >> no_skip[+~char_(']')] >> ']';
#else
ustring %= lit('\'')
>> *(unesc_char | "\\x" >> hex | (char_ - lit('\'')))
>> lit('\'');
attr %= '[' >> lexeme[+(char_ - ']')] >> ']';
#endif
}
}

View file

@ -40,7 +40,7 @@ public:
{
const char* what() const throw()
{
return "uknown object type";
return "unknown object type";
}
};
static product_type* on_unknown_type(const key_type&)
@ -83,7 +83,17 @@ public:
{
return (pos->second)(file);
}
return factory_error_policy<key_type,product_type>::on_unknown_type(key);
return 0;
}
product_type* create_object(const key_type& key, char const* data, std::size_t size)
{
typename product_map::const_iterator pos=map_.find(key);
if (pos!=map_.end())
{
return (pos->second)(data, size);
}
return 0;
}
};
}

View file

@ -1,112 +0,0 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 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_FASTMATH_HPP
#define MAPNIK_FASTMATH_HPP
/* Timings:
* fast_sin(not inlined) 8.95s
* fast_sin(inlined) 6.64s
* sin 28.7s
* => 4.3x speedup
* worst case accuracy abs(fast_sin(x)/sin(x) - 1) = 0.000018 (at 0.664, M_PI-0.664, M_PI+0.664; 2*M_PI-0.664)
*/
static inline double fast_sin(double x)
{
bool negative = false;
double result;
while (x > 2*M_PI) x -= 2*M_PI;
while (x < 0) x += 2*M_PI;
if (x > M_PI) {
x -= M_PI;
negative = true;
}
if (x < 0.664 || x > M_PI-0.664) {
//series expansion at x=0: x-x^3/6+x^5/120-x^7/5040+...
if (x > M_PI-0.664) x = M_PI - x;
result = x*(1. + x*x*(-1/6. + x*x/120.));
} else {
//series expansion at x=pi/2
//1-x^2/2+x^4/24-x^6/720+x^8/40320+...
x -= M_PI/2;
result = 1. + x*x*(-1/2.+x*x*(1/24. + x*x*(-1/720.)));
}
return negative?-result:result;
}
static inline double fast_cos(double x)
{
return fast_sin(x + M_PI/2);
}
static inline double atan_helper(double x)
{
//Series expansion at x=0:
// x-x^3/3+x^5/5-x^7/7+...
if (x < 0.30) {
return x * (1 + x*x*(-1/3. + x*x*(1/5.) + x*x*(-1/7. + x*x*(1/9.))));
}
else if (x < 0.71) {
//Series expansion at x=0.5
//atan(1/2)+(4 x)/5-(8 x^2)/25-(16 x^3)/375+(96 x^4)/625 +...
x -= 0.5;
return 0.463647609000806116 /*atan(0.5) */ + x *(4./5. + x *(-8./25. + (-16./375.*x)));
} else {
//series expansion at x=1:
//pi/4+x/2-x^2/4+x^3/12-x^5/40+...
x -= 1;
return (M_PI/4.) + x * (1/2. + x*(-1/4. +x*(1/12. + x * (-1/40.))));
}
}
/*
* fast_atan(not inlined) 6.74s
* fast_atan(everything inlined) 6.78s
* fast_atan(only helper inlined) 6.75
* atan 27.5s
* => 4x speedup
* worst case accuracy abs(fast_atan(x)/atan(x) - 1) = 0.000271 (at 1.411)
*/
double inline fast_atan(double x)
{
double negative = false;
double result;
if (x < 0) {
x = -x;
negative = true;
}
if (x <= 1) result = atan_helper(x); else result = M_PI/2 - atan_helper(1/x);
return negative?-result:result;
}
static inline double fast_atan2(double y, double x)
{
double result = M_PI/2;
if (x == 0 && y == 0) return 0;
if (x != 0) result = fast_atan(y/x);
if (x < 0 && y >= 0) return result + M_PI;
if (x <= 0 && y < 0) return -M_PI + result;
return result;
}
#endif // MAPNIK_FASTMATH_HPP

View file

@ -87,8 +87,8 @@ private:
map_type mapping_;
};
typedef MAPNIK_DECL context<std::map<std::string,std::size_t> > context_type;
typedef MAPNIK_DECL boost::shared_ptr<context_type> context_ptr;
typedef context<std::map<std::string,std::size_t> > context_type;
typedef boost::shared_ptr<context_type> context_ptr;
static const value default_value;
@ -306,9 +306,10 @@ inline std::ostream& operator<< (std::ostream & out,feature_impl const& f)
return out;
}
// TODO - remove at Mapnik 3.x
typedef feature_impl Feature;
typedef MAPNIK_DECL boost::shared_ptr<Feature> feature_ptr;
typedef boost::shared_ptr<feature_impl> feature_ptr;
}

View file

@ -35,11 +35,11 @@ namespace mapnik
{
struct feature_factory
{
static boost::shared_ptr<Feature> create (context_ptr const& ctx, mapnik::value_integer fid)
static boost::shared_ptr<feature_impl> create (context_ptr const& ctx, mapnik::value_integer fid)
{
//return boost::allocate_shared<Feature>(boost::pool_allocator<Feature>(),fid);
//return boost::allocate_shared<Feature>(boost::fast_pool_allocator<Feature>(),fid);
return boost::make_shared<Feature>(ctx,fid);
//return boost::allocate_shared<feature_impl>(boost::pool_allocator<feature_impl>(),fid);
//return boost::allocate_shared<feature_impl>(boost::fast_pool_allocator<feature_impl>(),fid);
return boost::make_shared<feature_impl>(ctx,fid);
}
};
}

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/datasource.hpp> // for featureset_ptr
#include <mapnik/config.hpp>
// stl
#include <set>
@ -48,7 +49,7 @@ enum eAttributeCollectionPolicy
};
template <typename Processor>
class feature_style_processor
class MAPNIK_DECL feature_style_processor
{
struct symbol_dispatch;
public:

View file

@ -54,7 +54,7 @@
// stl
#include <vector>
#include <stdexcept>
#if defined(RENDERING_STATS)
#include <mapnik/timer.hpp>
@ -160,36 +160,29 @@ void feature_style_processor<Processor>::apply(double scale_denom)
Processor & p = static_cast<Processor&>(*this);
p.start_map_processing(m_);
try
{
projection proj(m_.srs(),true);
if (scale_denom <= 0.0)
scale_denom = mapnik::scale_denominator(m_.scale(),proj.is_geographic());
scale_denom *= scale_factor_;
projection proj(m_.srs(),true);
if (scale_denom <= 0.0)
scale_denom = mapnik::scale_denominator(m_.scale(),proj.is_geographic());
scale_denom *= scale_factor_;
BOOST_FOREACH ( layer const& lyr, m_.layers() )
BOOST_FOREACH ( layer const& lyr, m_.layers() )
{
if (lyr.visible(scale_denom))
{
if (lyr.visible(scale_denom))
{
std::set<std::string> names;
apply_to_layer(lyr,
p,
proj,
m_.scale(),
scale_denom,
m_.width(),
m_.height(),
m_.get_current_extent(),
m_.buffer_size(),
names);
std::set<std::string> names;
apply_to_layer(lyr,
p,
proj,
m_.scale(),
scale_denom,
m_.width(),
m_.height(),
m_.get_current_extent(),
m_.buffer_size(),
names);
}
}
}
catch (proj_init_error const& ex)
{
MAPNIK_LOG_ERROR(feature_style_processor) << "feature_style_processor: proj_init_error=" << ex.what();
}
p.end_map_processing(m_);
@ -207,30 +200,23 @@ void feature_style_processor<Processor>::apply(mapnik::layer const& lyr,
{
Processor & p = static_cast<Processor&>(*this);
p.start_map_processing(m_);
try
{
projection proj(m_.srs(),true);
if (scale_denom <= 0.0)
scale_denom = mapnik::scale_denominator(m_.scale(),proj.is_geographic());
scale_denom *= scale_factor_;
projection proj(m_.srs(),true);
if (scale_denom <= 0.0)
scale_denom = mapnik::scale_denominator(m_.scale(),proj.is_geographic());
scale_denom *= scale_factor_;
if (lyr.visible(scale_denom))
{
apply_to_layer(lyr,
p,
proj,
m_.scale(),
scale_denom,
m_.width(),
m_.height(),
m_.get_current_extent(),
m_.buffer_size(),
names);
}
}
catch (proj_init_error const& ex)
if (lyr.visible(scale_denom))
{
MAPNIK_LOG_ERROR(feature_style_processor) << "feature_style_processor: proj_init_error=" << ex.what();
apply_to_layer(lyr,
p,
proj,
m_.scale(),
scale_denom,
m_.width(),
m_.height(),
m_.get_current_extent(),
m_.buffer_size(),
names);
}
p.end_map_processing(m_);
}
@ -606,7 +592,7 @@ void feature_style_processor<Processor>::render_style(
BOOST_FOREACH(rule const* r, rc.get_if_rules() )
{
expression_ptr const& expr=r->get_filter();
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(*feature),*expr);
value_type result = boost::apply_visitor(evaluate<feature_impl,value_type>(*feature),*expr);
if (result.to_bool())
{
#if defined(RENDERING_STATS)

View file

@ -1,2 +1,8 @@
// TODO - remove this file at mapnik 3.x
#ifdef _MSC_VER
#pragma NOTE("filter_factory.hpp" is now called "expression.hpp")
#else
#warning "filter_factory.hpp" is now called "expression.hpp"
#endif
#include <mapnik/expression.hpp>

View file

@ -24,15 +24,9 @@
#define MAPNIK_FONT_ENGINE_FREETYPE_HPP
// mapnik
#include <mapnik/debug.hpp>
#include <mapnik/color.hpp>
#include <mapnik/utils.hpp>
#include <mapnik/config.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/ctrans.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/font_set.hpp>
#include <mapnik/char_info.hpp>
#include <mapnik/image_compositing.hpp>
#include <mapnik/text_symbolizer.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/value_types.hpp>
@ -40,94 +34,40 @@
// boost
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp>
#include <boost/optional.hpp>
#ifdef MAPNIK_THREADSAFE
#include <boost/thread/mutex.hpp>
#endif
// stl
#include <string>
//// stl
#include <vector>
#include <map>
// uci
#include <unicode/unistr.h>
struct FT_LibraryRec_;
namespace mapnik
{
class font_face;
class text_path;
class string_info;
struct char_properties;
class stroker;
struct glyph_t;
//struct char_properties;
// typedef std::vector<face_ptr> container_type;
// typedef container_type::size_type size_type;
class stroker;
typedef boost::shared_ptr<stroker> stroker_ptr;
class font_face_set;
typedef boost::shared_ptr<font_face_set> face_set_ptr;
class font_face;
typedef boost::shared_ptr<font_face> face_ptr;
class MAPNIK_DECL font_glyph : private mapnik::noncopyable
{
public:
font_glyph(face_ptr face, unsigned index)
: face_(face), index_(index) {}
face_ptr get_face() const
{
return face_;
}
unsigned get_index() const
{
return index_;
}
private:
face_ptr face_;
unsigned index_;
};
typedef boost::shared_ptr<font_glyph> glyph_ptr;
class MAPNIK_DECL font_face_set : private mapnik::noncopyable
{
public:
typedef std::vector<face_ptr> container_type;
typedef container_type::size_type size_type;
font_face_set(void)
: faces_(),
dimension_cache_() {}
void add(face_ptr face);
size_type size() const;
glyph_ptr get_glyph(unsigned c) const;
char_info character_dimensions(unsigned c);
void get_string_info(string_info & info, UnicodeString const& ustr, char_properties *format);
void set_pixel_sizes(unsigned size);
void set_character_sizes(double size);
private:
container_type faces_;
std::map<unsigned, char_info> dimension_cache_;
};
typedef boost::shared_ptr<font_face_set> face_set_ptr;
typedef boost::shared_ptr<stroker> stroker_ptr;
class MAPNIK_DECL freetype_engine
{
public:
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);
/*! \brief register a font file
* @param dir - path to a directory containing fonts or subdirectories.
* @param recurse - default false, whether to search for fonts in sub directories.
@ -141,18 +81,19 @@ public:
virtual ~freetype_engine();
freetype_engine();
private:
FT_LibraryRec_ * library_;
FT_LibraryRec_ *library_;
#ifdef MAPNIK_THREADSAFE
static boost::mutex mutex_;
#endif
static std::map<std::string,std::pair<int,std::string> > name2file_;
static std::map<std::string, std::pair<int,std::string> > name2file_;
static std::map<std::string, std::string> memory_fonts_;
};
template <typename T>
class MAPNIK_DECL face_manager : private mapnik::noncopyable
{
typedef T font_engine_type;
typedef std::map<std::string,face_ptr> face_ptr_cache_type;
typedef std::map<std::string, face_ptr> face_ptr_cache_type;
public:
face_manager(T & engine)
@ -160,74 +101,13 @@ public:
stroker_(engine_.create_stroker()),
face_ptr_cache_() {}
face_ptr get_face(std::string const& name)
{
face_ptr_cache_type::iterator itr;
itr = face_ptr_cache_.find(name);
if (itr != face_ptr_cache_.end())
{
return itr->second;
}
else
{
face_ptr face = engine_.create_face(name);
if (face)
{
face_ptr_cache_.insert(make_pair(name,face));
}
return face;
}
}
face_ptr get_face(std::string const& name);
face_set_ptr get_face_set(std::string const& name);
face_set_ptr get_face_set(font_set const& fset);
face_set_ptr get_face_set(std::string const& name, boost::optional<font_set> fset);
face_set_ptr get_face_set(std::string const& name)
{
face_set_ptr face_set = boost::make_shared<font_face_set>();
if (face_ptr face = get_face(name))
{
face_set->add(face);
}
return face_set;
}
face_set_ptr get_face_set(font_set const& fset)
{
std::vector<std::string> const& names = fset.get_face_names();
face_set_ptr face_set = boost::make_shared<font_face_set>();
BOOST_FOREACH( std::string const& name, names)
{
face_ptr face = get_face(name);
if (face)
{
face_set->add(face);
}
#ifdef MAPNIK_LOG
else
{
MAPNIK_LOG_DEBUG(font_engine_freetype)
<< "Failed to find face '" << name
<< "' in font set '" << fset.get_name() << "'\n";
}
#endif
}
return face_set;
}
face_set_ptr get_face_set(std::string const& name, boost::optional<font_set> fset)
{
if (fset && fset->size() > 0)
{
return get_face_set(*fset);
}
else
{
return get_face_set(name);
}
}
inline stroker_ptr get_stroker()
{
return stroker_;
}
inline stroker_ptr get_stroker() { return stroker_; }
private:
font_engine_type & engine_;
@ -235,31 +115,6 @@ private:
face_ptr_cache_type face_ptr_cache_;
};
template <typename T>
struct text_renderer : private mapnik::noncopyable
{
typedef boost::ptr_vector<glyph_t> glyphs_t;
typedef T pixmap_type;
text_renderer (pixmap_type & pixmap,
face_manager<freetype_engine> & font_manager,
halo_rasterizer_e rasterizer,
composite_mode_e comp_op = src_over,
double scale_factor=1.0);
box2d<double> prepare_glyphs(text_path const& path);
void render(pixel_position const& pos);
void render_id(mapnik::value_integer feature_id,
pixel_position const& pos);
private:
pixmap_type & pixmap_;
face_manager<freetype_engine> & font_manager_;
halo_rasterizer_e rasterizer_;
glyphs_t glyphs_;
composite_mode_e comp_op_;
double scale_factor_;
};
typedef face_manager<freetype_engine> face_manager_freetype;
}

View file

@ -200,10 +200,10 @@ inline bool point_on_path(double x,double y,Iter start,Iter end, double tol)
struct filter_in_box
{
box2d<double> box_;
explicit filter_in_box(const box2d<double>& box)
explicit filter_in_box(box2d<double> const& box)
: box_(box) {}
bool pass(const box2d<double>& extent) const
bool pass(box2d<double> const& extent) const
{
return extent.intersects(box_);
}
@ -211,23 +211,16 @@ struct filter_in_box
struct filter_at_point
{
coord2d pt_;
double tol_;
explicit filter_at_point(const coord2d& pt, double tol=0)
: pt_(pt),
tol_(tol) {}
bool pass(const box2d<double>& extent) const
box2d<double> box_;
explicit filter_at_point(coord2d const& pt, double tol=0)
: box_(pt,pt)
{
if (tol_ == 0)
{
return extent.contains(pt_);
}
else
{
box2d<double> extent2 = extent;
extent2.pad(tol_);
return extent2.contains(pt_);
}
box_.pad(tol);
}
bool pass(box2d<double> const& extent) const
{
return extent.intersects(box_);
}
};

View file

@ -2,7 +2,7 @@
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
* Copyright (C) 2013 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -29,6 +29,7 @@
// stl
#include <cstring>
#include <cmath>
namespace mapnik
{

View file

@ -54,6 +54,7 @@ private:
boost::optional<color> background_;
image_data_32 data_;
bool painted_;
bool premultiplied_;
public:
image_32(int width,int height);
image_32(image_32 const& rhs);
@ -72,6 +73,11 @@ public:
return painted_;
}
bool premultiplied() const
{
return premultiplied_;
}
inline void clear()
{
std::memset(data_.getData(),0,sizeof(mapnik::image_data_32::pixel_type)*data_.width()*data_.height());

View file

@ -256,7 +256,7 @@ public:
};
typedef MAPNIK_DECL hit_grid<mapnik::value_integer> grid;
typedef hit_grid<mapnik::value_integer> grid;
}
#endif //MAPNIK_GRID_HPP

View file

@ -123,7 +123,7 @@ struct raster_markers_rasterizer_dispatch_grid
sym_.get_max_error(),
sym_.get_allow_overlap());
double x, y, angle;
while (placement.get_point(x, y, angle))
while (placement.get_point(x, y, angle, sym_.get_ignore_placement()))
{
agg::trans_affine matrix = marker_trans_;
matrix.rotate(angle);
@ -260,7 +260,7 @@ struct vector_markers_rasterizer_dispatch_grid
sym_.get_max_error(),
sym_.get_allow_overlap());
double x, y, angle;
while (placement.get_point(x, y, angle))
while (placement.get_point(x, y, angle, sym_.get_ignore_placement()))
{
agg::trans_affine matrix = marker_trans_;
matrix.rotate(angle);

View file

@ -28,6 +28,7 @@
#include <mapnik/feature_style_processor.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/rule.hpp> // for rule, symbolizers
#include <mapnik/box2d.hpp> // for box2d

View file

@ -79,7 +79,7 @@ public:
{
if (x_ >= data_.width()) x_=data_.width()-1;
if (y_ >= data_.height()) x_=data_.height()-1;
if (y_ >= data_.height()) y_=data_.height()-1;
if (x_ + width_ > data_.width()) width_= data_.width() - x_;
if (y_ + height_ > data_.height()) height_= data_.height() - y_;
}

View file

@ -38,7 +38,7 @@ public:
y_(y),
tol_(tol) {}
bool pass(Feature & feature)
bool pass(feature_impl & feature)
{
BOOST_FOREACH(geometry_type & geom, feature.paths())
{

View file

@ -29,6 +29,8 @@
// stl
#include <cassert>
#include <cstring>
#include <stdexcept>
namespace mapnik
{
@ -37,11 +39,19 @@ template <class T> class ImageData
public:
typedef T pixel_type;
ImageData(unsigned width,unsigned height)
: width_(width),
height_(height),
pData_((width!=0 && height!=0)? static_cast<T*>(::operator new(sizeof(T)*width*height)):0)
ImageData(int width,int height)
: width_(static_cast<unsigned>(width)),
height_(static_cast<unsigned>(height))
{
if (width < 0)
{
throw std::runtime_error("negative width not allowed for image_data");
}
if (height < 0)
{
throw std::runtime_error("negative height not allowed for image_data");
}
pData_ = (width!=0 && height!=0)? static_cast<T*>(::operator new(sizeof(T)*width*height)):0;
if (pData_) std::memset(pData_,0,sizeof(T)*width_*height_);
}

View file

@ -483,6 +483,7 @@ void apply_filter(Src & src, colorize_alpha const& op)
}
}
/*
template <typename Src>
void apply_filter(Src & src, hsla const& transform)
{
@ -572,6 +573,7 @@ void apply_filter(Src & src, hsla const& transform)
}
}
}
*/
template <typename Src>
void apply_filter(Src & src, gray const& op)

View file

@ -67,8 +67,8 @@ struct image_filter_grammar :
qi::rule<Iterator, ContType(), qi::ascii::space_type> start;
qi::rule<Iterator, ContType(), qi::ascii::space_type> filter;
qi::rule<Iterator, qi::locals<int,int>, void(ContType&), qi::ascii::space_type> agg_blur_filter;
qi::rule<Iterator, qi::locals<double,double,double,double,double,double,double,double>,
void(ContType&), qi::ascii::space_type> hsla_filter;
//qi::rule<Iterator, qi::locals<double,double,double,double,double,double,double,double>,
// void(ContType&), qi::ascii::space_type> hsla_filter;
qi::rule<Iterator, qi::locals<mapnik::filter::colorize_alpha, mapnik::filter::color_stop>, void(ContType&), qi::ascii::space_type> colorize_alpha_filter;
qi::rule<Iterator, qi::ascii::space_type> no_args;
qi::uint_parser< unsigned, 10, 1, 3 > radius_;

View file

@ -54,6 +54,7 @@ struct agg_stack_blur
unsigned ry;
};
/*
struct hsla
{
hsla(double _h0, double _h1,
@ -97,6 +98,7 @@ struct hsla
double a0;
double a1;
};
*/
struct color_stop
{
@ -122,7 +124,7 @@ typedef boost::variant<filter::blur,
filter::x_gradient,
filter::y_gradient,
filter::invert,
filter::hsla,
//filter::hsla,
filter::colorize_alpha> filter_type;
inline std::ostream& operator<< (std::ostream& os, blur)
@ -143,6 +145,7 @@ inline std::ostream& operator<< (std::ostream& os, agg_stack_blur const& filter)
return os;
}
/*
inline std::ostream& operator<< (std::ostream& os, hsla const& filter)
{
os << "hsla(" << filter.h0 << 'x' << filter.h1 << ':'
@ -151,6 +154,7 @@ inline std::ostream& operator<< (std::ostream& os, hsla const& filter)
<< filter.a0 << 'x' << filter.a1 << ')';
return os;
}
*/
inline std::ostream& operator<< (std::ostream& os, emboss)
{

View file

@ -26,13 +26,17 @@
// mapnik
#include <mapnik/image_data.hpp>
#include <mapnik/config.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/factory.hpp>
// boost
#include <boost/optional.hpp>
// stl
#include <stdexcept>
#include <string>
namespace mapnik
{
class image_reader_exception : public std::exception
{
private:
@ -49,7 +53,7 @@ public:
}
};
struct MAPNIK_DECL image_reader
struct MAPNIK_DECL image_reader : private mapnik::noncopyable
{
virtual unsigned width() const=0;
virtual unsigned height() const=0;
@ -59,8 +63,11 @@ struct MAPNIK_DECL image_reader
};
bool register_image_reader(std::string const& type,image_reader* (*)(std::string const&));
bool register_image_reader(std::string const& type,image_reader* (*)(char const*, std::size_t));
MAPNIK_DECL image_reader* get_image_reader(std::string const& file,std::string const& type);
MAPNIK_DECL image_reader* get_image_reader(std::string const& file);
MAPNIK_DECL image_reader* get_image_reader(char const* data, size_t size);
}

View file

@ -64,11 +64,13 @@ public:
#if defined(HAVE_CAIRO)
MAPNIK_DECL void save_to_cairo_file(mapnik::Map const& map,
std::string const& filename,
double scale_factor=1.0);
double scale_factor=1.0,
double scale_denominator=0.0);
MAPNIK_DECL void save_to_cairo_file(mapnik::Map const& map,
std::string const& filename,
std::string const& type,
double scale_factor=1.0);
double scale_factor=1.0,
double scale_denominator=0.0);
#endif
template <typename T>

View file

@ -39,7 +39,7 @@ public:
data_(data)
{
if (x_ >= data_.width()) x_=data_.width()-1;
if (y_ >= data_.height()) x_=data_.height()-1;
if (y_ >= data_.height()) y_=data_.height()-1;
if (x_ + width_ > data_.width()) width_= data_.width() - x_;
if (y_ + height_ > data_.height()) height_= data_.height() - y_;
}

View file

@ -87,7 +87,7 @@ struct feature_collection_grammar :
> lit(']')
;
feature = eps[_a = construct<mapnik::feature_ptr>(new_<mapnik::feature_impl>(ctx_,generate_id_()))]
feature = eps[_a = phoenix::construct<mapnik::feature_ptr>(new_<mapnik::feature_impl>(ctx_,generate_id_()))]
>> feature_g(*_a)[push_back(_r1,_a)]
;

View file

@ -40,7 +40,7 @@ namespace mapnik { namespace json {
template <typename Iterator, typename FeatureType> struct feature_collection_grammar;
template <typename Iterator>
class feature_collection_parser : private mapnik::noncopyable
class MAPNIK_DECL feature_collection_parser : private mapnik::noncopyable
{
typedef Iterator iterator_type;
typedef mapnik::feature_impl feature_type;

View file

@ -133,6 +133,7 @@ struct feature_grammar :
phoenix::function<put_property> put_property_;
phoenix::function<extract_geometry> extract_geometry_;
boost::phoenix::function<where_message> where_message_;
geometry_grammar<Iterator> geometry_grammar_;
};

Some files were not shown because too many files have changed in this diff Show more