[mapnik] 01/05: Imported Upstream version 3.0.12~rc2+ds
Bas Couwenberg
sebastic at debian.org
Wed Aug 10 11:32:41 UTC 2016
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository mapnik.
commit 48e5ccbfa618af4b9b9586f5458c44971a154a48
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Wed Aug 10 12:34:10 2016 +0200
Imported Upstream version 3.0.12~rc2+ds
---
.travis.yml | 4 ++--
bootstrap.sh | 25 ++++++++++++++++++-------
circle.yml | 2 +-
include/mapnik/cairo/cairo_context.hpp | 4 ++++
include/mapnik/cairo/cairo_renderer.hpp | 1 +
src/cairo/cairo_context.cpp | 18 ++++++++++++++++++
src/cairo/cairo_renderer.cpp | 31 ++++++++++++++++++++++++++-----
src/expression_node.cpp | 4 ++--
src/load_map.cpp | 2 +-
src/map.cpp | 2 +-
src/marker_cache.cpp | 2 +-
test/unit/core/expressions_test.cpp | 18 +++++++++++++++---
12 files changed, 90 insertions(+), 23 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 5de9299..c16bfa3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,7 +29,7 @@ matrix:
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test']
- packages: [ 'libstdc++6', 'libstdc++-5-dev']
+ packages: [ 'libstdc++-5-dev', 'xutils']
- os: linux
sudo: false
compiler: ": clang-coverage"
@@ -37,7 +37,7 @@ matrix:
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test']
- packages: [ 'libstdc++6','libstdc++-5-dev' ]
+ packages: ['libstdc++-5-dev', 'xutils' ]
- os: osx
compiler: ": clang-osx"
# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
diff --git a/bootstrap.sh b/bootstrap.sh
index fd877a6..b0ebcf8 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
-#set -eu
+set -eu
+set -o pipefail
: '
@@ -10,7 +11,7 @@ todo
- shrink icu data
'
-MASON_VERSION="b709931"
+MASON_VERSION="7ed8931"
function setup_mason() {
if [[ ! -d ./.mason ]]; then
@@ -33,7 +34,7 @@ function install() {
if [[ ${3:-false} != false ]]; then
LA_FILE=$(mason prefix $1 $2)/lib/$3.la
if [[ -f ${LA_FILE} ]]; then
- perl -i -p -e 's:\Q$ENV{HOME}/build/mapbox/mason\E:$ENV{PWD}:g' ${LA_FILE}
+ perl -i -p -e 's:\Q$ENV{HOME}/build/mapbox/mason\E:$ENV{PWD}:g' ${LA_FILE}
else
echo "$LA_FILE not found"
fi
@@ -44,6 +45,7 @@ function install() {
ICU_VERSION="55.1"
function install_mason_deps() {
+ FAIL=0
install ccache 3.2.4 &
install jpeg_turbo 1.4.0 libjpeg &
install libpng 1.6.20 libpng &
@@ -51,7 +53,6 @@ function install_mason_deps() {
install libpq 9.4.1 &
install sqlite 3.8.8.3 libsqlite3 &
install expat 2.1.0 libexpat &
- wait
install icu ${ICU_VERSION} &
install proj 4.8.0 libproj &
install pixman 0.32.6 libpixman-1 &
@@ -59,17 +60,22 @@ function install_mason_deps() {
install protobuf 2.6.1 &
# technically protobuf is not a mapnik core dep, but installing
# here by default helps make mapnik-vector-tile builds easier
- wait
install webp 0.4.2 libwebp &
install gdal 1.11.2 libgdal &
install boost 1.61.0 &
install boost_libsystem 1.61.0 &
install boost_libfilesystem 1.61.0 &
install boost_libprogram_options 1.61.0 &
- install boost_libregex 1.61.0 &
+ install boost_libregex_icu 1.61.0 &
install freetype 2.6 libfreetype &
install harfbuzz 0.9.41 libharfbuzz &
- wait
+ for job in $(jobs -p)
+ do
+ wait $job || let "FAIL+=1"
+ done
+ if [[ "$FAIL" != "0" ]]; then
+ exit ${FAIL}
+ fi
}
MASON_LINKED_ABS=$(pwd)/mason_packages/.link
@@ -140,3 +146,8 @@ function main() {
}
main
+
+# allow sourcing of script without
+# causing the terminal to bail on error
+set +eu
+set +o pipefail
diff --git a/circle.yml b/circle.yml
index cf3e31c..435cd07 100644
--- a/circle.yml
+++ b/circle.yml
@@ -21,13 +21,13 @@ dependencies:
cache_directories:
- "~/.ccache"
- "~/.apt-cache"
- - "mason_packages"
pre:
# https://discuss.circleci.com/t/add-ability-to-cache-apt-get-programs/598/3
- sudo rm -rf /var/cache/apt/archives && sudo ln -s ~/.apt-cache /var/cache/apt/archives && mkdir -p ~/.apt-cache/partial
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
override:
- sudo apt-get update -y
+ - sudo apt-get install -y libstdc++-5-dev xutils
database:
pre:
diff --git a/include/mapnik/cairo/cairo_context.hpp b/include/mapnik/cairo/cairo_context.hpp
index 9733efb..c15f87c 100644
--- a/include/mapnik/cairo/cairo_context.hpp
+++ b/include/mapnik/cairo/cairo_context.hpp
@@ -308,6 +308,7 @@ public:
void stroke();
void fill();
void paint();
+ void paint(double opacity);
void set_pattern(cairo_pattern const& pattern);
void set_gradient(cairo_gradient const& pattern, box2d<double> const& bbox);
void add_image(double x, double y, image_rgba8 const& data, double opacity = 1.0);
@@ -327,6 +328,9 @@ public:
composite_mode_e halo_comp_op = src_over,
double scale_factor = 1.0);
+ void push_group();
+ void pop_group();
+
template <typename T>
void add_path(T& path, unsigned start_index = 0)
{
diff --git a/include/mapnik/cairo/cairo_renderer.hpp b/include/mapnik/cairo/cairo_renderer.hpp
index a39b4ed..0563149 100644
--- a/include/mapnik/cairo/cairo_renderer.hpp
+++ b/include/mapnik/cairo/cairo_renderer.hpp
@@ -177,6 +177,7 @@ protected:
cairo_context context_;
renderer_common common_;
cairo_face_manager face_manager_;
+ bool style_level_compositing_;
void setup(Map const& m);
};
diff --git a/src/cairo/cairo_context.cpp b/src/cairo/cairo_context.cpp
index c8ba13c..cb9216d 100644
--- a/src/cairo/cairo_context.cpp
+++ b/src/cairo/cairo_context.cpp
@@ -304,6 +304,12 @@ void cairo_context::paint()
check_object_status_and_throw_exception(*this);
}
+void cairo_context::paint(double opacity)
+{
+ cairo_paint_with_alpha(cairo_.get(), opacity);
+ check_object_status_and_throw_exception(*this);
+}
+
void cairo_context::set_pattern(cairo_pattern const& pattern)
{
cairo_set_source(cairo_.get(), pattern.pattern());
@@ -489,6 +495,18 @@ void cairo_context::add_text(glyph_positions const& pos,
}
+void cairo_context::push_group()
+{
+ cairo_push_group(cairo_.get());
+ check_object_status_and_throw_exception(*this);
+}
+
+void cairo_context::pop_group()
+{
+ cairo_pop_group_to_source(cairo_.get());
+ check_object_status_and_throw_exception(*this);
+}
+
cairo_face_manager::cairo_face_manager(std::shared_ptr<font_library> font_library)
: font_library_(font_library)
{
diff --git a/src/cairo/cairo_renderer.cpp b/src/cairo/cairo_renderer.cpp
index 83e1208..2f845a5 100644
--- a/src/cairo/cairo_renderer.cpp
+++ b/src/cairo/cairo_renderer.cpp
@@ -36,6 +36,7 @@
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/marker.hpp>
#include <mapnik/marker_cache.hpp>
+#include <mapnik/feature_type_style.hpp>
// agg
#include "agg/include/agg_trans_affine.h" // for trans_affine, etc
@@ -58,7 +59,8 @@ cairo_renderer<T>::cairo_renderer(Map const& m,
m_(m),
context_(cairo),
common_(m, attributes(), offset_x, offset_y, m.width(), m.height(), scale_factor),
- face_manager_(common_.shared_font_library_)
+ face_manager_(common_.shared_font_library_),
+ style_level_compositing_(false)
{
setup(m);
}
@@ -75,7 +77,9 @@ cairo_renderer<T>::cairo_renderer(Map const& m,
m_(m),
context_(cairo),
common_(m, req, vars, offset_x, offset_y, req.width(), req.height(), scale_factor),
- face_manager_(common_.shared_font_library_)
+ face_manager_(common_.shared_font_library_),
+ style_level_compositing_(false)
+
{
setup(m);
}
@@ -91,7 +95,9 @@ cairo_renderer<T>::cairo_renderer(Map const& m,
m_(m),
context_(cairo),
common_(m, attributes(), offset_x, offset_y, m.width(), m.height(), scale_factor, detector),
- face_manager_(common_.shared_font_library_)
+ face_manager_(common_.shared_font_library_),
+ style_level_compositing_(false)
+
{
setup(m);
}
@@ -191,15 +197,30 @@ void cairo_renderer<T>::end_layer_processing(layer const&)
}
template <typename T>
-void cairo_renderer<T>::start_style_processing(feature_type_style const&)
+void cairo_renderer<T>::start_style_processing(feature_type_style const & st)
{
MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer:start style processing";
+
+ style_level_compositing_ = st.comp_op() || st.get_opacity() < 1;
+
+ if (style_level_compositing_)
+ {
+ context_.push_group();
+ }
}
template <typename T>
-void cairo_renderer<T>::end_style_processing(feature_type_style const&)
+void cairo_renderer<T>::end_style_processing(feature_type_style const & st)
{
MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer:end style processing";
+
+ if (style_level_compositing_)
+ {
+ context_.pop_group();
+ composite_mode_e comp_op = st.comp_op() ? *st.comp_op() : src_over;
+ context_.set_operator(comp_op);
+ context_.paint(st.get_opacity());
+ }
}
struct cairo_render_marker_visitor
diff --git a/src/expression_node.cpp b/src/expression_node.cpp
index 380c36a..549f4c8 100644
--- a/src/expression_node.cpp
+++ b/src/expression_node.cpp
@@ -130,9 +130,9 @@ value regex_replace_node::apply(value const& v) const
auto const& pattern = impl_.get()->pattern_;
auto const& format = impl_.get()->format_;
#if defined(BOOST_REGEX_HAS_ICU)
- return boost::u32regex_replace(v.to_unicode(),pattern,format);
+ return boost::u32regex_replace(v.to_unicode(), pattern, format);
#else
- std::string repl = boost::regex_replace(v.to_string(),pattern,format);
+ std::string repl = boost::regex_replace(v.to_string(), pattern, format);
transcoder tr_("utf8");
return tr_.transcode(repl.c_str());
#endif
diff --git a/src/load_map.cpp b/src/load_map.cpp
index fcb04c0..bf6324d 100644
--- a/src/load_map.cpp
+++ b/src/load_map.cpp
@@ -755,7 +755,7 @@ void map_parser::parse_layer(Map & map, xml_node const& node)
}
catch (...)
{
- throw config_error("Unknown exception occured attempting to create datasoure for layer '" + lyr.name() + "'");
+ throw config_error("Unknown exception occurred attempting to create datasoure for layer '" + lyr.name() + "'");
}
}
}
diff --git a/src/map.cpp b/src/map.cpp
index ca813e2..9f1b6a5 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -695,7 +695,7 @@ featureset_ptr Map::query_point(unsigned index, double x, double y) const
{
if (!current_extent_.valid())
{
- throw std::runtime_error("query_point: map extent is not intialized, you need to set a valid extent before querying");
+ throw std::runtime_error("query_point: map extent is not initialized, you need to set a valid extent before querying");
}
if (!current_extent_.intersects(x,y))
{
diff --git a/src/marker_cache.cpp b/src/marker_cache.cpp
index 6fef861..059280c 100644
--- a/src/marker_cache.cpp
+++ b/src/marker_cache.cpp
@@ -267,7 +267,7 @@ std::shared_ptr<mapnik::marker const> marker_cache::find(std::string const& uri,
}
else
{
- MAPNIK_LOG_ERROR(marker_cache) << "could not intialize reader for: '" << uri << "'";
+ MAPNIK_LOG_ERROR(marker_cache) << "could not initialize reader for: '" << uri << "'";
return std::make_shared<mapnik::marker const>(mapnik::marker_null());
}
}
diff --git a/test/unit/core/expressions_test.cpp b/test/unit/core/expressions_test.cpp
index e60d612..c10982f 100644
--- a/test/unit/core/expressions_test.cpp
+++ b/test/unit/core/expressions_test.cpp
@@ -1,4 +1,3 @@
-
#include "catch_ext.hpp"
#include <mapnik/expression.hpp>
@@ -176,6 +175,19 @@ TEST_CASE("expressions")
// regex
// replace
TRY_CHECK(eval(" [foo].replace('(\\B)|( )','$1 ') ") == tr.transcode("b a r"));
+
+ // https://en.wikipedia.org/wiki/Chess_symbols_in_Unicode
+ //'\u265C\u265E\u265D\u265B\u265A\u265D\u265E\u265C' - black chess figures
+ // replace black knights with white knights
+ auto val0 = eval(u8"'\u265C\u265E\u265D\u265B\u265A\u265D\u265E\u265C'.replace('\u265E','\u2658')");
+ auto val1 = eval(u8"'♜♞♝♛♚♝♞♜'.replace('♞','♘')"); // ==> expected ♜♘♝♛♚♝♘♜
+ TRY_CHECK(val0 == val1);
+ TRY_CHECK(val0.to_string() == val1.to_string()); // UTF-8
+ TRY_CHECK(val0.to_unicode() == val1.to_unicode()); // Unicode (UTF-16)
+
+ // following test will fail if boost_regex is built without ICU support (unpaired surrogates in output)
+ TRY_CHECK(eval("[name].replace('(\\B)|( )',' ') ") == tr.transcode(u8"Q u é b e c"));
+ TRY_CHECK(eval("'Москва'.replace('(?<!^)(\\B|b)(?!$)',' ')") == tr.transcode(u8"М о с к в а"));
// 'foo' =~ s:(\w)\1:$1x:r
TRY_CHECK(eval(" 'foo'.replace('(\\w)\\1', '$1x') ") == tr.transcode("fox"));
TRY_CHECK(parse_and_dump(" 'foo'.replace('(\\w)\\1', '$1x') ") == "'foo'.replace('(\\w)\\1','$1x')");
@@ -187,8 +199,8 @@ TEST_CASE("expressions")
TRY_CHECK(parse_and_dump(" [name].match('^Q\\S*$') ") == "[name].match('^Q\\S*$')");
// string & value concatenation
- // this should evaluate as two strings concatenating, but currently fails
+ // this should evaluate as two strings concatenating
TRY_CHECK(eval("Hello + '!'") == eval("'Hello!'"));
- // this should evaulate as a combination of an int value and string, but fails
+ // this should evaulate as a combination of an int value and string
TRY_CHECK(eval("[int]+m") == eval("'123m'"));
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapnik.git
More information about the Pkg-grass-devel
mailing list