[mapnik] 01/05: Imported Upstream version 3.0.0~rc3+ds

Jérémy Lal kapouer at moszumanska.debian.org
Wed May 27 18:59:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

kapouer pushed a commit to branch master
in repository mapnik.

commit 1a45dd3c8d8457fe8d237b9ec9a099b52a7bbc48
Author: Jérémy Lal <kapouer at melix.org>
Date:   Wed May 27 18:20:37 2015 +0200

    Imported Upstream version 3.0.0~rc3+ds
---
 .gitignore                                         |   1 +
 Makefile                                           |   6 +-
 SConstruct                                         |  13 +--
 bootstrap.sh                                       |  43 ++++++---
 configure                                          |   2 +-
 deps/agg/build.py                                  |   3 +-
 deps/agg/src/agg_pixfmt_rgba.cpp                   |   1 +
 deps/boost/gil/extension/toolbox/hsl.hpp           |   5 ++
 deps/boost/gil/extension/toolbox/hsv.hpp           |   5 ++
 deps/clipper/build.py                              |   3 +-
 deps/clipper/src/clipper.cpp                       |   4 +-
 include/mapnik/geometry_strategy.hpp               |  48 +---------
 include/mapnik/grid/grid.hpp                       |  40 ++++-----
 include/mapnik/image_filter.hpp                    |   1 +
 include/mapnik/json/feature_parser.hpp             |   2 +-
 include/mapnik/json/generic_json.hpp               |   4 +-
 include/mapnik/json/geometry_parser.hpp            |   2 +-
 include/mapnik/json/topojson_grammar.hpp           |   2 +-
 include/mapnik/proj_strategy.hpp                   |  48 +---------
 include/mapnik/util/file_io.hpp                    |   2 +-
 include/mapnik/view_strategy.hpp                   |   4 +-
 include/mapnik/webp_io.hpp                         |  14 +--
 plugins/input/geojson/geojson_datasource.cpp       |   8 +-
 plugins/input/geojson/geojson_datasource.hpp       |   3 -
 plugins/input/geojson/large_geojson_featureset.cpp |   2 +-
 plugins/input/rasterlite/rasterlite_featureset.cpp |   1 -
 plugins/input/topojson/topojson_datasource.cpp     |  12 +--
 plugins/input/topojson/topojson_datasource.hpp     |   6 +-
 src/build.py                                       |   3 +
 src/grid/grid.cpp                                  |   2 +-
 src/json/build.py                                  |   3 +-
 src/wkt/build.py                                   |   3 +-
 test/build.py                                      |  10 ++-
 test/run                                           |  46 ++++++----
 test/unit/font/fontset_runtime_test.cpp            |   4 -
 test/unit/geometry/geometry.cpp                    |   8 +-
 test/unit/geometry/geometry_strategy_test.cpp      |  54 +----------
 test/unit/imaging/webp_io.cpp                      |  26 ++++++
 test/visual/renderer.hpp                           | 100 +++++++++++++++++++--
 test/visual/run.cpp                                |  44 ++++++++-
 test/visual/runner.cpp                             |  12 ++-
 test/visual/runner.hpp                             |  11 ++-
 utils/mapnik-config/build.py                       |   2 +-
 43 files changed, 333 insertions(+), 280 deletions(-)

diff --git a/.gitignore b/.gitignore
index b090f4c..0293fee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
 *.pyc
 *.os
 *.so
+*.so.*
 *.a
 *.swp
 *.dylib
diff --git a/Makefile b/Makefile
index 46307d5..b86f8fe 100755
--- a/Makefile
+++ b/Makefile
@@ -86,11 +86,13 @@ pep8:
 
 # note: pass --gen-suppressions=yes to create new suppression entries
 grind:
-	@source localize.sh && source mapnik-settings.env && \
+	@source localize.sh && \
+	    valgrind --suppressions=./test/unit/valgrind.supp --leak-check=full --log-fd=1 ./test/visual/run | grep definitely;
+	@source localize.sh && \
 	for FILE in test/standalone/*-bin; do \
 		valgrind --suppressions=./test/unit/valgrind.supp --leak-check=full --log-fd=1 $${FILE} | grep definitely; \
 	done
-	@source localize.sh && source mapnik-settings.env && \
+	@source localize.sh && \
 	    valgrind --suppressions=./test/unit/valgrind.supp --leak-check=full --log-fd=1 ./test/unit/run | grep definitely;
 
 render:
diff --git a/SConstruct b/SConstruct
index c5266d0..15b9e82 100644
--- a/SConstruct
+++ b/SConstruct
@@ -39,13 +39,11 @@ severities = ['debug', 'warn', 'error', 'none']
 ICU_INCLUDES_DEFAULT='/usr/include'
 ICU_LIBS_DEFAULT='/usr/'
 
-DEFAULT_CC = "gcc"
-DEFAULT_CXX = "g++"
+DEFAULT_CC = "cc"
+DEFAULT_CXX = "c++"
 DEFAULT_CXX11_CXXFLAGS = " -std=c++11"
 DEFAULT_CXX11_LINKFLAGS = ""
 if sys.platform == 'darwin':
-    DEFAULT_CC = "clang"
-    DEFAULT_CXX = "clang++"
     # homebrew default
     ICU_INCLUDES_DEFAULT='/usr/local/opt/icu4c/include/'
     ICU_LIBS_DEFAULT='/usr/local/opt/icu4c/'
@@ -307,7 +305,7 @@ opts.AddVariables(
     ('WARNING_CXXFLAGS', 'Compiler flags you can set to reduce warning levels which are placed after -Wall.', ''),
 
     # SCons build behavior options
-    ('HOST', 'Set the target host for cross compiling"', ''),
+    ('HOST', 'Set the target host for cross compiling', ''),
     ('CONFIG', "The path to the python file in which to save user configuration options. Currently : '%s'" % SCONS_LOCAL_CONFIG,SCONS_LOCAL_CONFIG),
     BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'),
     # http://www.scons.org/wiki/GoFastButton
@@ -1734,11 +1732,6 @@ if not preconfigured:
         # c++11 support / https://github.com/mapnik/mapnik/issues/1683
         #  - upgrade to PHOENIX_V3 since that is needed for c++11 compile
         env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1')
-        if 'clang++' in env['CXX']:
-            #  - workaround boost gil channel_algorithm.hpp narrowing error
-            # TODO - remove when building against >= 1.55
-            # https://github.com/mapnik/mapnik/issues/1970
-            env.Append(CXXFLAGS = '-Wno-c++11-narrowing')
 
         # Enable logging in debug mode (always) and release mode (when specified)
         if env['DEFAULT_LOG_SEVERITY']:
diff --git a/bootstrap.sh b/bootstrap.sh
index 5baccd0..695613d 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -23,16 +23,33 @@ function setup_mason() {
     export CC=${CC:-clang}
 }
 
+if [[ $(uname -s) == 'Darwin' ]]; then
+    FIND_PATTERN="\/Users\/travis\/build\/mapbox\/mason"
+else
+    FIND_PATTERN="\/home\/travis\/build\/mapbox\/mason"
+fi
+
+REPLACE="$(pwd)"
+REPLACE=${REPLACE////\\/}
+
 function install() {
     MASON_PLATFORM_ID=$(mason env MASON_PLATFORM_ID)
     if [[ ! -d ./mason_packages/${MASON_PLATFORM_ID}/${1}/${2} ]]; then
         mason install $1 $2
         mason link $1 $2
+        if [[ $3 ]]; then
+            LA_FILE=$(${MASON_DIR:-~/.mason}/mason prefix $1 $2)/lib/$3.la
+            if [[ -f ${LA_FILE} ]]; then
+               perl -i -p -e "s/${FIND_PATTERN}/${REPLACE}/g;" ${LA_FILE}
+            else
+                echo "$LA_FILE not found"
+            fi
+        fi
     fi
 }
 
 function install_mason_deps() {
-    install gdal 1.11.2 &
+    install gdal 1.11.2 libgdal &
     install boost 1.57.0 &
     install boost_libsystem 1.57.0 &
     install boost_libthread 1.57.0 &
@@ -40,20 +57,20 @@ function install_mason_deps() {
     install boost_libprogram_options 1.57.0 &
     install boost_libregex 1.57.0 &
     install boost_libpython 1.57.0 &
-    install freetype 2.5.5 &
-    install harfbuzz 0.9.40 &
-    install jpeg_turbo 1.4.0 &
-    install libxml2 2.9.2 &
-    install libpng 1.6.16 &
-    install webp 0.4.2 &
+    install freetype 2.5.5 libfreetype &
+    install harfbuzz 0.9.40 libharfbuzz &
+    install jpeg_turbo 1.4.0 libjpeg &
+    install libxml2 2.9.2 libxml2 &
+    install libpng 1.6.16 libpng &
+    install webp 0.4.2 libwebp &
     install icu 54.1 &
-    install proj 4.8.0 &
-    install libtiff 4.0.4beta &
+    install proj 4.8.0 libproj &
+    install libtiff 4.0.4beta libtiff &
     install libpq 9.4.0 &
-    install sqlite 3.8.8.1 &
-    install expat 2.1.0 &
-    install pixman 0.32.6 &
-    install cairo 1.12.18 &
+    install sqlite 3.8.8.1 libsqlite3 &
+    install expat 2.1.0 libexpat &
+    install pixman 0.32.6 libpixman-1 &
+    install cairo 1.12.18 libcairo &
     wait
 }
 
diff --git a/configure b/configure
index 8abbff1..b468f85 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 PYTHON=${PYTHON:-python}
 
diff --git a/deps/agg/build.py b/deps/agg/build.py
index 0f87da1..51e6bc8 100644
--- a/deps/agg/build.py
+++ b/deps/agg/build.py
@@ -24,6 +24,5 @@ from glob import glob
 
 Import('env')
 lib_env = env.Clone()
-if 'g++' in env['CXX']:
-    lib_env.Append(CXXFLAGS='-fPIC')
+lib_env.Append(CXXFLAGS='-fPIC')
 lib_env.StaticLibrary('agg', glob('./src/' + '*.cpp'), LIBS=[])
diff --git a/deps/agg/src/agg_pixfmt_rgba.cpp b/deps/agg/src/agg_pixfmt_rgba.cpp
index f07c540..05b8734 100644
--- a/deps/agg/src/agg_pixfmt_rgba.cpp
+++ b/deps/agg/src/agg_pixfmt_rgba.cpp
@@ -4,6 +4,7 @@
 // boost
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wc++11-narrowing"
 #pragma GCC diagnostic ignored "-Wunused-local-typedef"
 #include <boost/gil/gil_all.hpp>
 #include <boost/gil/extension/toolbox/hsv.hpp>
diff --git a/deps/boost/gil/extension/toolbox/hsl.hpp b/deps/boost/gil/extension/toolbox/hsl.hpp
index ecbf897..c77dd72 100644
--- a/deps/boost/gil/extension/toolbox/hsl.hpp
+++ b/deps/boost/gil/extension/toolbox/hsl.hpp
@@ -14,7 +14,12 @@
 /// \author Christian Henning \n
 ////////////////////////////////////////////////////////////////////////////////////////
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wc++11-narrowing"
+#pragma GCC diagnostic ignored "-Wunused-local-typedef"
 #include <boost/gil/gil_all.hpp>
+#pragma GCC diagnostic pop
 
 namespace boost { namespace gil {
 
diff --git a/deps/boost/gil/extension/toolbox/hsv.hpp b/deps/boost/gil/extension/toolbox/hsv.hpp
index ba12cbd..5195cc2 100644
--- a/deps/boost/gil/extension/toolbox/hsv.hpp
+++ b/deps/boost/gil/extension/toolbox/hsv.hpp
@@ -14,7 +14,12 @@
 /// \author Christian Henning \n
 ////////////////////////////////////////////////////////////////////////////////////////
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wc++11-narrowing"
+#pragma GCC diagnostic ignored "-Wunused-local-typedef"
 #include <boost/gil/gil_all.hpp>
+#pragma GCC diagnostic pop
 
 namespace boost { namespace gil {
 
diff --git a/deps/clipper/build.py b/deps/clipper/build.py
index db9938c..618bd3f 100644
--- a/deps/clipper/build.py
+++ b/deps/clipper/build.py
@@ -22,6 +22,5 @@ from glob import glob
 
 Import('env')
 lib_env = env.Clone()
-if 'g++' in env['CXX']:
-    lib_env.Append(CXXFLAGS='-fPIC')
+lib_env.Append(CXXFLAGS='-fPIC')
 lib_env.StaticLibrary('clipper', ['./src/clipper.cpp',], LIBS=[])
diff --git a/deps/clipper/src/clipper.cpp b/deps/clipper/src/clipper.cpp
index b9727c6..d515439 100755
--- a/deps/clipper/src/clipper.cpp
+++ b/deps/clipper/src/clipper.cpp
@@ -1240,7 +1240,7 @@ void ClipperBase::Reset()
 {
   m_CurrentLM = m_MinimaList.begin();
   if (m_CurrentLM == m_MinimaList.end()) return; //ie nothing to process
-  std::sort(m_MinimaList.begin(), m_MinimaList.end(), LocMinSorter());
+  std::stable_sort(m_MinimaList.begin(), m_MinimaList.end(), LocMinSorter());
 
   //reset all edges ...
   for (MinimaList::iterator lm = m_MinimaList.begin(); lm != m_MinimaList.end(); ++lm)
@@ -2894,7 +2894,7 @@ bool Clipper::FixupIntersectionOrder()
   //Now it's crucial that intersections are made only between adjacent edges,
   //so to ensure this the order of intersections may need adjusting ...
   CopyAELToSEL();
-  std::sort(m_IntersectList.begin(), m_IntersectList.end(), IntersectListSort);
+  std::stable_sort(m_IntersectList.begin(), m_IntersectList.end(), IntersectListSort);
   size_t cnt = m_IntersectList.size();
   for (size_t i = 0; i < cnt; ++i) 
   {
diff --git a/include/mapnik/geometry_strategy.hpp b/include/mapnik/geometry_strategy.hpp
index 0a322dd..cc4121e 100644
--- a/include/mapnik/geometry_strategy.hpp
+++ b/include/mapnik/geometry_strategy.hpp
@@ -155,28 +155,8 @@ struct scale_strategy
         using p2_type = typename boost::geometry::coordinate_type<P2>::type;
         double x = (boost::geometry::get<0>(p1) * scale_) + offset_;
         double y = (boost::geometry::get<1>(p1) * scale_) + offset_;
-        try {
-            boost::geometry::set<0>(p2, boost::numeric_cast<p2_type>(x));
-        }
-        catch(boost::numeric::negative_overflow&)
-        {
-            boost::geometry::set<0>(p2, std::numeric_limits<p2_type>::min());
-        }
-        catch(boost::numeric::positive_overflow&) 
-        {
-            boost::geometry::set<0>(p2, std::numeric_limits<p2_type>::max());
-        }
-        try {
-            boost::geometry::set<1>(p2, boost::numeric_cast<p2_type>(y));
-        }
-        catch(boost::numeric::negative_overflow&)
-        {
-            boost::geometry::set<1>(p2, std::numeric_limits<p2_type>::min());
-        }
-        catch(boost::numeric::positive_overflow&) 
-        {
-            boost::geometry::set<1>(p2, std::numeric_limits<p2_type>::max());
-        }
+        boost::geometry::set<0>(p2, static_cast<p2_type>(x));
+        boost::geometry::set<1>(p2, static_cast<p2_type>(y));
         return true;
     }
     
@@ -205,28 +185,8 @@ struct scale_rounding_strategy
         using p2_type = typename boost::geometry::coordinate_type<P2>::type;
         double x = (boost::geometry::get<0>(p1) * scale_) + offset_;
         double y = (boost::geometry::get<1>(p1) * scale_) + offset_;
-        try {
-            boost::geometry::set<0>(p2, util::rounding_cast<p2_type>(x));
-        }
-        catch(boost::numeric::negative_overflow&)
-        {
-            boost::geometry::set<0>(p2, std::numeric_limits<p2_type>::min());
-        }
-        catch(boost::numeric::positive_overflow&) 
-        {
-            boost::geometry::set<0>(p2, std::numeric_limits<p2_type>::max());
-        }
-        try {
-            boost::geometry::set<1>(p2, util::rounding_cast<p2_type>(y));
-        }
-        catch(boost::numeric::negative_overflow&)
-        {
-            boost::geometry::set<1>(p2, std::numeric_limits<p2_type>::min());
-        }
-        catch(boost::numeric::positive_overflow&) 
-        {
-            boost::geometry::set<1>(p2, std::numeric_limits<p2_type>::max());
-        }
+        boost::geometry::set<0>(p2, static_cast<p2_type>(std::round(x)));
+        boost::geometry::set<1>(p2, static_cast<p2_type>(std::round(y)));
         return true;
     }
     
diff --git a/include/mapnik/grid/grid.hpp b/include/mapnik/grid/grid.hpp
index 223d4a2..a00479e 100644
--- a/include/mapnik/grid/grid.hpp
+++ b/include/mapnik/grid/grid.hpp
@@ -57,8 +57,8 @@ public:
     static const value_type base_mask;
 
 private:
-    unsigned width_;
-    unsigned height_;
+    std::size_t width_;
+    std::size_t height_;
     std::string key_;
     data_type data_;
     std::string id_name_;
@@ -70,7 +70,7 @@ private:
 
 public:
 
-    hit_grid(int width, int height, std::string const& key);
+    hit_grid(std::size_t width, std::size_t height, std::string const& key);
 
     hit_grid(hit_grid<T> const& rhs);
 
@@ -145,20 +145,20 @@ public:
         return data_.data();
     }
 
-    inline value_type const * get_row(unsigned row) const
+    inline value_type const * get_row(std::size_t row) const
     {
         return data_.get_row(row);
     }
 
-    inline mapnik::grid_view get_view(unsigned x, unsigned y, unsigned w, unsigned h)
+    inline mapnik::grid_view get_view(std::size_t x, std::size_t y, std::size_t w, std::size_t h)
     {
-        return mapnik::grid_view(x,y,w,h,
-                                 data_,key_,id_name_,names_,f_keys_,features_);
+        return mapnik::grid_view(x, y, w, h,
+                                 data_, key_, id_name_, names_, f_keys_, features_);
     }
 
 private:
 
-    inline bool checkBounds(unsigned x, unsigned y) const
+    inline bool checkBounds(std::size_t x, std::size_t y) const
     {
         return (x < width_ && y < height_);
     }
@@ -166,39 +166,39 @@ private:
     hit_grid& operator=(const hit_grid&);
 
 public:
-    inline void setPixel(int x,int y,value_type feature_id)
+    inline void setPixel(std::size_t x, std::size_t y, value_type feature_id)
     {
-        if (checkBounds(x,y))
+        if (checkBounds(x, y))
         {
-            data_(x,y) = feature_id;
+            data_(x, y) = feature_id;
         }
     }
-    inline unsigned width() const
+    inline std::size_t width() const
     {
         return width_;
     }
 
-    inline unsigned height() const
+    inline std::size_t height() const
     {
         return height_;
     }
 
-    inline void set_rectangle(value_type id,image_rgba8 const& data,int x0,int y0)
+    inline void set_rectangle(value_type id, image_rgba8 const& data, std::size_t x0, std::size_t y0)
     {
-        box2d<int> ext0(0,0,width_,height_);
-        box2d<int> ext1(x0,y0,x0+data.width(),y0+data.height());
+        box2d<int> ext0(0, 0, width_, height_);
+        box2d<int> ext1(x0, y0, x0 + data.width(), y0 + data.height());
 
         if (ext0.intersects(ext1))
         {
             box2d<int> box = ext0.intersect(ext1);
-            for (int y = box.miny(); y < box.maxy(); ++y)
+            for (std::size_t y = box.miny(); y < box.maxy(); ++y)
             {
                 value_type* row_to =  data_.get_row(y);
-                unsigned int const * row_from = data.get_row(y-y0);
+                image_rgba8::pixel_type const * row_from = data.get_row(y - y0);
 
-                for (int x = box.minx(); x < box.maxx(); ++x)
+                for (std::size_t x = box.minx(); x < box.maxx(); ++x)
                 {
-                    unsigned rgba = row_from[x-x0];
+                    image_rgba8::pixel_type rgba = row_from[x - x0];
                     unsigned a = (rgba >> 24) & 0xff;
                     // if the pixel is more than a tenth
                     // opaque then burn in the feature id
diff --git a/include/mapnik/image_filter.hpp b/include/mapnik/image_filter.hpp
index ed7cb56..eef8141 100644
--- a/include/mapnik/image_filter.hpp
+++ b/include/mapnik/image_filter.hpp
@@ -31,6 +31,7 @@
 // boost GIL
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wc++11-narrowing"
 #pragma GCC diagnostic ignored "-Wunused-local-typedef"
 #include <boost/gil/gil_all.hpp>
 #pragma GCC diagnostic pop
diff --git a/include/mapnik/json/feature_parser.hpp b/include/mapnik/json/feature_parser.hpp
index e4cf569..3e5b2b3 100644
--- a/include/mapnik/json/feature_parser.hpp
+++ b/include/mapnik/json/feature_parser.hpp
@@ -39,7 +39,7 @@ inline bool from_geojson(std::string const& json, mapnik::feature_impl & feature
     using iterator_type = char const*;
     static const mapnik::json::feature_grammar<iterator_type,mapnik::feature_impl> g(tr);
     using namespace boost::spirit;
-    ascii::space_type space;
+    standard::space_type space;
     iterator_type start = json.c_str();
     iterator_type end = start + json.length();
     return qi::phrase_parse(start, end, (g)(boost::phoenix::ref(feature)), space);
diff --git a/include/mapnik/json/generic_json.hpp b/include/mapnik/json/generic_json.hpp
index c4fa67c..16124ad 100644
--- a/include/mapnik/json/generic_json.hpp
+++ b/include/mapnik/json/generic_json.hpp
@@ -37,9 +37,9 @@
 namespace mapnik { namespace json {
 
 namespace qi = boost::spirit::qi;
-namespace ascii = boost::spirit::ascii;
+namespace standard = boost::spirit::standard;
 namespace phoenix = boost::phoenix;
-using space_type = ascii::space_type;
+using space_type = standard::space_type;
 using json_value = mapnik::util::variant<value_null,value_bool, value_integer, value_double, std::string>;
 using uchar = std::uint32_t; // a unicode code point
 
diff --git a/include/mapnik/json/geometry_parser.hpp b/include/mapnik/json/geometry_parser.hpp
index f4aabe5..941abb0 100644
--- a/include/mapnik/json/geometry_parser.hpp
+++ b/include/mapnik/json/geometry_parser.hpp
@@ -38,7 +38,7 @@ inline bool from_geojson(std::string const& json, mapnik::geometry::geometry<dou
 {
     using namespace boost::spirit;
     static const geometry_grammar<char const*> g;
-    ascii::space_type space;
+    standard::space_type space;
     char const* start = json.c_str();
     char const* end = start + json.length();
     return qi::phrase_parse(start, end, g, space, geom);
diff --git a/include/mapnik/json/topojson_grammar.hpp b/include/mapnik/json/topojson_grammar.hpp
index 881dcb5..e3db099 100644
--- a/include/mapnik/json/topojson_grammar.hpp
+++ b/include/mapnik/json/topojson_grammar.hpp
@@ -44,7 +44,7 @@ namespace mapnik { namespace topojson {
 
 namespace qi = boost::spirit::qi;
 namespace fusion = boost::fusion;
-using space_type = boost::spirit::ascii::space_type;
+using space_type = mapnik::json::space_type;
 
 template <typename Iterator, typename ErrorHandler = json::error_handler<Iterator> >
 struct topojson_grammar : qi::grammar<Iterator, space_type, topology()>
diff --git a/include/mapnik/proj_strategy.hpp b/include/mapnik/proj_strategy.hpp
index 69ef18a..688e6d3 100644
--- a/include/mapnik/proj_strategy.hpp
+++ b/include/mapnik/proj_strategy.hpp
@@ -59,28 +59,8 @@ struct proj_strategy
         double y = boost::geometry::get<1>(p1);
         double z = 0.0;
         if (!prj_trans_.forward(x, y, z)) return false;
-        try {
-            boost::geometry::set<0>(p2, boost::numeric_cast<p2_type>(x));
-        }
-        catch(boost::numeric::negative_overflow&)
-        {
-            boost::geometry::set<0>(p2, std::numeric_limits<p2_type>::min());
-        }
-        catch(boost::numeric::positive_overflow&) 
-        {
-            boost::geometry::set<0>(p2, std::numeric_limits<p2_type>::max());
-        }
-        try {
-            boost::geometry::set<1>(p2, boost::numeric_cast<p2_type>(y));
-        }
-        catch(boost::numeric::negative_overflow&)
-        {
-            boost::geometry::set<1>(p2, std::numeric_limits<p2_type>::min());
-        }
-        catch(boost::numeric::positive_overflow&) 
-        {
-            boost::geometry::set<1>(p2, std::numeric_limits<p2_type>::max());
-        }
+        boost::geometry::set<0>(p2, static_cast<p2_type>(x));
+        boost::geometry::set<1>(p2, static_cast<p2_type>(y));
         return true;
     }
     
@@ -108,28 +88,8 @@ struct proj_backward_strategy
         double y = boost::geometry::get<1>(p1);
         double z = 0.0;
         if (!prj_trans_.backward(x, y, z)) return false;
-        try {
-            boost::geometry::set<0>(p2, boost::numeric_cast<p2_type>(x));
-        }
-        catch(boost::numeric::negative_overflow&)
-        {
-            boost::geometry::set<0>(p2, std::numeric_limits<p2_type>::min());
-        }
-        catch(boost::numeric::positive_overflow&) 
-        {
-            boost::geometry::set<0>(p2, std::numeric_limits<p2_type>::max());
-        }
-        try {
-            boost::geometry::set<1>(p2, boost::numeric_cast<p2_type>(y));
-        }
-        catch(boost::numeric::negative_overflow&)
-        {
-            boost::geometry::set<1>(p2, std::numeric_limits<p2_type>::min());
-        }
-        catch(boost::numeric::positive_overflow&) 
-        {
-            boost::geometry::set<1>(p2, std::numeric_limits<p2_type>::max());
-        }
+        boost::geometry::set<0>(p2, static_cast<p2_type>(x));
+        boost::geometry::set<1>(p2, static_cast<p2_type>(y));
         return true;
     }
     
diff --git a/include/mapnik/util/file_io.hpp b/include/mapnik/util/file_io.hpp
index 6c65533..ff9f37e 100644
--- a/include/mapnik/util/file_io.hpp
+++ b/include/mapnik/util/file_io.hpp
@@ -66,7 +66,7 @@ public:
 
     inline std::FILE * get() const
     {
-        return file_.get();;
+        return file_.get();
     }
 
     inline std::size_t size() const
diff --git a/include/mapnik/view_strategy.hpp b/include/mapnik/view_strategy.hpp
index a984dc4..7bddb9b 100644
--- a/include/mapnik/view_strategy.hpp
+++ b/include/mapnik/view_strategy.hpp
@@ -74,8 +74,8 @@ struct unview_strategy
         double x = boost::geometry::get<0>(p1);
         double y = boost::geometry::get<1>(p1);
         tr_.backward(&x,&y);
-        boost::geometry::set<0>(p2, boost::numeric_cast<coordinate_type>(x));
-        boost::geometry::set<1>(p2, boost::numeric_cast<coordinate_type>(y));
+        boost::geometry::set<0>(p2, static_cast<coordinate_type>(x));
+        boost::geometry::set<1>(p2, static_cast<coordinate_type>(y));
         return true;
     }
 
diff --git a/include/mapnik/webp_io.hpp b/include/mapnik/webp_io.hpp
index be10b80..3caf281 100644
--- a/include/mapnik/webp_io.hpp
+++ b/include/mapnik/webp_io.hpp
@@ -78,9 +78,11 @@ inline int import_image(T2 const& im_in,
                              bool alpha)
 {
     image<typename T2::pixel> const& data = im_in.data();
-    int stride = sizeof(typename T2::pixel_type) * im_in.width();
-    if (data.width() == im_in.width() &&
-        data.height() == im_in.height())
+    std::size_t width = im_in.width();
+    std::size_t height = im_in.height();
+    int stride = sizeof(typename T2::pixel_type) * width;
+    if (data.width() == width &&
+        data.height() == height)
     {
         if (alpha)
         {
@@ -98,12 +100,12 @@ inline int import_image(T2 const& im_in,
     else
     {
         // need to copy: https://github.com/mapnik/mapnik/issues/2024
-        image_rgba8 im(im_in.width(),im_in.height());
-        for (unsigned y = 0; y < im_in.height(); ++y)
+        image_rgba8 im(width,height);
+        for (unsigned y = 0; y < height; ++y)
         {
             typename T2::pixel_type const * row_from = im_in.get_row(y);
             image_rgba8::pixel_type * row_to = im.get_row(y);
-            std::copy(row_from, row_from + stride, row_to);
+            std::copy(row_from, row_from + width, row_to);
         }
         if (alpha)
         {
diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp
index 1d3dfd8..c30d258 100644
--- a/plugins/input/geojson/geojson_datasource.cpp
+++ b/plugins/input/geojson/geojson_datasource.cpp
@@ -192,7 +192,7 @@ template <typename Iterator>
 void geojson_datasource::initialise_index(Iterator start, Iterator end)
 {
     mapnik::json::boxes boxes;
-    boost::spirit::ascii::space_type space;
+    boost::spirit::standard::space_type space;
     Iterator itr = start;
     if (!boost::spirit::qi::phrase_parse(itr, end, (geojson_datasource_static_bbox_grammar)(boost::phoenix::ref(boxes)) , space))
     {
@@ -214,7 +214,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
             Iterator end = itr + geometry_index.second;
             mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
             mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
-            boost::spirit::ascii::space_type space;
+            boost::spirit::standard::space_type space;
             if (!boost::spirit::qi::phrase_parse(itr, end, (geojson_datasource_static_feature_grammar)(boost::phoenix::ref(*feature)), space))
             {
                 throw std::runtime_error("Failed to parse geojson feature");
@@ -236,7 +236,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
 template <typename Iterator>
 void geojson_datasource::parse_geojson(Iterator start, Iterator end)
 {
-    boost::spirit::ascii::space_type space;
+    boost::spirit::standard::space_type space;
     mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
     std::size_t start_id = 1;
 
@@ -355,7 +355,7 @@ boost::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_
             chr_iterator_type end = start + json.size();
 
             using namespace boost::spirit;
-            ascii::space_type space;
+            standard::space_type space;
             mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
             if (!qi::phrase_parse(start, end, (geojson_datasource_static_feature_grammar)(boost::phoenix::ref(*feature)), space))
             {
diff --git a/plugins/input/geojson/geojson_datasource.hpp b/plugins/input/geojson/geojson_datasource.hpp
index 42610db..c9b320d 100644
--- a/plugins/input/geojson/geojson_datasource.hpp
+++ b/plugins/input/geojson/geojson_datasource.hpp
@@ -39,9 +39,6 @@
 #pragma GCC diagnostic ignored "-Wunused-parameter"
 #pragma GCC diagnostic ignored "-Wunused-variable"
 #pragma GCC diagnostic ignored "-Wunused-local-typedef"
-#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/geometries/box.hpp>
-#include <boost/geometry/geometries/geometries.hpp>
 #include <boost/version.hpp>
 #include <boost/geometry/index/rtree.hpp>
 #pragma GCC diagnostic pop
diff --git a/plugins/input/geojson/large_geojson_featureset.cpp b/plugins/input/geojson/large_geojson_featureset.cpp
index 795d619..f3922b2 100644
--- a/plugins/input/geojson/large_geojson_featureset.cpp
+++ b/plugins/input/geojson/large_geojson_featureset.cpp
@@ -70,7 +70,7 @@ mapnik::feature_ptr large_geojson_featureset::next()
         static const mapnik::transcoder tr("utf8");
         static const mapnik::json::feature_grammar<chr_iterator_type,mapnik::feature_impl> grammar(tr);
         using namespace boost::spirit;
-        ascii::space_type space;
+        standard::space_type space;
         mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,1));
         if (!qi::phrase_parse(start, end, (grammar)(boost::phoenix::ref(*feature)), space))
         {
diff --git a/plugins/input/rasterlite/rasterlite_featureset.cpp b/plugins/input/rasterlite/rasterlite_featureset.cpp
index 14e2f3d..97912b7 100644
--- a/plugins/input/rasterlite/rasterlite_featureset.cpp
+++ b/plugins/input/rasterlite/rasterlite_featureset.cpp
@@ -36,7 +36,6 @@
 using mapnik::coord2d;
 using mapnik::box2d;
 using mapnik::feature_ptr;
-using mapnik::geometry_type;
 using mapnik::query;
 using mapnik::feature_factory;
 
diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp
index 6aceb32..cd9c327 100644
--- a/plugins/input/topojson/topojson_datasource.cpp
+++ b/plugins/input/topojson/topojson_datasource.cpp
@@ -33,6 +33,7 @@
 #include <mapnik/unicode.hpp>
 #include <mapnik/value_types.hpp>
 #include <mapnik/box2d.hpp>
+#include <mapnik/geometry_adapters.hpp>
 #include <mapnik/json/topojson_grammar.hpp>
 #include <mapnik/json/topojson_utils.hpp>
 #include <mapnik/util/variant.hpp>
@@ -190,7 +191,7 @@ const mapnik::topojson::topojson_grammar<base_iterator_type> g;
 template <typename T>
 void topojson_datasource::parse_topojson(T const& buffer)
 {
-    boost::spirit::ascii::space_type space;
+    boost::spirit::standard::space_type space;
     bool result = boost::spirit::qi::phrase_parse(buffer.begin(), buffer.end(), g, space, topo_);
     if (!result)
     {
@@ -218,9 +219,9 @@ void topojson_datasource::parse_topojson(T const& buffer)
             {
                 extent_.expand_to_include(box);
             }
+            values.emplace_back(box, geometry_index);
+            ++geometry_index;
         }
-        values.emplace_back(box_type(point_type(box.minx(),box.miny()),point_type(box.maxx(),box.maxy())), geometry_index);
-        ++geometry_index;
     }
 
     // packing algorithm
@@ -278,10 +279,9 @@ mapnik::layer_descriptor topojson_datasource::get_descriptor() const
 mapnik::featureset_ptr topojson_datasource::features(mapnik::query const& q) const
 {
     // if the query box intersects our world extent then query for features
-    mapnik::box2d<double> const& b = q.get_bbox();
-    if (extent_.intersects(b))
+    mapnik::box2d<double> const& box = q.get_bbox();
+    if (extent_.intersects(box))
     {
-        box_type box(point_type(b.minx(),b.miny()),point_type(b.maxx(),b.maxy()));
         topojson_featureset::array_type index_array;
         if (tree_)
         {
diff --git a/plugins/input/topojson/topojson_datasource.hpp b/plugins/input/topojson/topojson_datasource.hpp
index 6b090e8..fff936d 100644
--- a/plugins/input/topojson/topojson_datasource.hpp
+++ b/plugins/input/topojson/topojson_datasource.hpp
@@ -39,8 +39,6 @@
 #pragma GCC diagnostic ignored "-Wunused-parameter"
 #pragma GCC diagnostic ignored "-Wunused-variable"
 #pragma GCC diagnostic ignored "-Wunused-local-typedef"
-#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/geometries/box.hpp>
 #include <boost/geometry/geometries/geometries.hpp>
 #include <boost/geometry.hpp>
 #include <boost/version.hpp>
@@ -57,9 +55,7 @@
 class topojson_datasource : public mapnik::datasource
 {
 public:
-    using point_type = boost::geometry::model::d2::point_xy<double>;
-    using box_type = boost::geometry::model::box<point_type>;
-
+    using box_type = mapnik::box2d<double>;
     using item_type = std::pair<box_type,std::size_t>;
     using linear_type = boost::geometry::index::linear<16,4>;
     using spatial_index_type = boost::geometry::index::rtree<item_type,linear_type>;
diff --git a/src/build.py b/src/build.py
index 8e86db7..a7a812b 100644
--- a/src/build.py
+++ b/src/build.py
@@ -113,6 +113,9 @@ if env['RUNTIME_LINK'] != 'static':
 
 lib_env['LIBS'].append('z')
 
+if env['PLATFORM'] == 'FreeBSD':
+    lib_env['LIBS'].append('pthread')
+
 if env['PLATFORM'] == 'Darwin':
     mapnik_libname = env.subst(env['MAPNIK_LIB_NAME'])
     if env['FULL_LIB_PATH']:
diff --git a/src/grid/grid.cpp b/src/grid/grid.cpp
index 0ca7965..279ac4c 100644
--- a/src/grid/grid.cpp
+++ b/src/grid/grid.cpp
@@ -37,7 +37,7 @@ template <typename T>
 const typename hit_grid<T>::value_type hit_grid<T>::base_mask = std::numeric_limits<typename T::type>::min();
 
 template <typename T>
-hit_grid<T>::hit_grid(int width, int height, std::string const& key)
+hit_grid<T>::hit_grid(std::size_t width, std::size_t height, std::string const& key)
     : width_(width),
       height_(height),
       key_(key),
diff --git a/src/json/build.py b/src/json/build.py
index c7b1b96..2e6902f 100644
--- a/src/json/build.py
+++ b/src/json/build.py
@@ -24,8 +24,7 @@ from glob import glob
 
 Import('env')
 lib_env = env.Clone()
-if 'g++' in env['CXX']:
-    lib_env.Append(CXXFLAGS='-fPIC')
+lib_env.Append(CXXFLAGS='-fPIC')
 
 name = "mapnik-json"
 lib = lib_env.StaticLibrary(name, glob('./' + '*.cpp'), LIBS=[])
diff --git a/src/wkt/build.py b/src/wkt/build.py
index c1c4f70..88ac36a 100644
--- a/src/wkt/build.py
+++ b/src/wkt/build.py
@@ -24,8 +24,7 @@ from glob import glob
 
 Import('env')
 lib_env = env.Clone()
-if 'g++' in env['CXX']:
-    lib_env.Append(CXXFLAGS='-fPIC')
+lib_env.Append(CXXFLAGS='-fPIC')
 
 name = "mapnik-wkt"
 lib = lib_env.StaticLibrary(name, glob('./' + '*.cpp'), LIBS=[])
diff --git a/test/build.py b/test/build.py
index 18cabcd..c600d01 100644
--- a/test/build.py
+++ b/test/build.py
@@ -36,11 +36,15 @@ else:
     Depends(test_program, env.subst('../src/%s' % env['MAPNIK_LIB_NAME']))
     Depends(test_program, env.subst('../src/json/libmapnik-json${LIBSUFFIX}'))
     Depends(test_program, env.subst('../src/wkt/libmapnik-wkt${LIBSUFFIX}'))
+    if 'install' in COMMAND_LINE_TARGETS:
+        env.Alias('install',test_program)
 
     # standalone tests
     for standalone in glob.glob('./standalone/*cpp'):
-        test_program = test_env_local.Program(standalone.replace('.cpp','-bin'), source=standalone)
+        test_program2 = test_env_local.Program(standalone.replace('.cpp','-bin'), source=standalone)
         Depends(test_program, env.subst('../src/%s' % env['MAPNIK_LIB_NAME']))
+        if 'install' in COMMAND_LINE_TARGETS:
+            env.Alias('install',test_program2)
 
     # visual tests
     source = Split(
@@ -50,9 +54,9 @@ else:
         visual/run.cpp
         """
         )
-    test_program = test_env_local.Program('visual/run', source=source)
+    test_program3 = test_env_local.Program('visual/run', source=source)
     Depends(test_program, env.subst('../src/%s' % env['MAPNIK_LIB_NAME']))
 
     # build locally if installing
     if 'install' in COMMAND_LINE_TARGETS:
-        env.Alias('install',test_program)
+        env.Alias('install',test_program3)
diff --git a/test/run b/test/run
index 43f5ced..cd45c68 100755
--- a/test/run
+++ b/test/run
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 failures=0
 
@@ -12,23 +12,33 @@ function run_success { >&2 echo -e "\033[1m\033[32m* $1\033[0m"; }
 
 run_step "Starting Mapnik tests"
 
-run_substep "Running C++ Unit tests..."
-./test/unit/run
-failures=$((failures+$?))
-
-run_substep "Running standalone C++ tests..."
-if [ -n "$(find test/standalone/ -maxdepth 1 -name '*-bin' -print -quit)" ]; then
-    for FILE in test/standalone/*-bin; do 
-        ${FILE};
-      failures=$((failures+$?))
-    done
-fi
-
-run_substep "Running visual tests..."
-if [ -z "$JOBS" ]; then
-    JOBS=1
+if [ -d "test/data" ]; then
+
+    run_substep "Running C++ Unit tests..."
+    ./test/unit/run
+    failures=$((failures+$?))
+
+    run_substep "Running standalone C++ tests..."
+    if [ -n "$(find test/standalone/ -maxdepth 1 -name '*-bin' -print -quit)" ]; then
+        for FILE in test/standalone/*-bin; do
+            ${FILE};
+          failures=$((failures+$?))
+        done
+    fi
+
+    if [ -d "test/data-visual/styles" ]; then
+        run_substep "Running visual tests..."
+        if [ -z "$JOBS" ]; then
+            JOBS=1
+        fi
+        ./test/visual/run -j $JOBS
+        failures=$((failures+$?))
+    else
+        echo "Notice: Skipping visual tests, the visual tests data are not present under the standard directory \"test/data-visual\"."
+    fi
+
+else
+    echo "Notice: Skipping all tests, the test data are not present under the standard directory \"test/data\"."
 fi
-./test/visual/run -j $JOBS
-failures=$((failures+$?))
 
 exit $failures
diff --git a/test/unit/font/fontset_runtime_test.cpp b/test/unit/font/fontset_runtime_test.cpp
index 72305b1..4e703fa 100644
--- a/test/unit/font/fontset_runtime_test.cpp
+++ b/test/unit/font/fontset_runtime_test.cpp
@@ -24,9 +24,6 @@
 #include <algorithm>
 #include <mapnik/make_unique.hpp>
 
-// icu - for memory cleanup (to make valgrind happy)
-#include "unicode/uclean.h"
-
 TEST_CASE("fontset") {
 
 SECTION("error") {
@@ -80,6 +77,5 @@ SECTION("error") {
     } catch (std::exception const& ex) {
         REQUIRE(std::string(ex.what()) == std::string("Unable to find specified font face 'DejaVu Sans Book' in font set: 'fontset'"));
     }
-    u_cleanup();
 }
 }
\ No newline at end of file
diff --git a/test/unit/geometry/geometry.cpp b/test/unit/geometry/geometry.cpp
index b3e01cc..4e0598a 100644
--- a/test/unit/geometry/geometry.cpp
+++ b/test/unit/geometry/geometry.cpp
@@ -11,9 +11,9 @@ TEST_CASE("geometry") {
 SECTION("json point") {
     mapnik::util::file input("./test/data/json/point1.json");
     REQUIRE( input.open() );
-    auto json = input.data();
     mapnik::geometry::geometry<double> geom;
-    std::string json_string(json.get());
+    REQUIRE( input.data() );
+    std::string json_string(input.data().get(), input.size());
     REQUIRE( mapnik::json::from_geojson(json_string, geom) );
     REQUIRE( geom.is<mapnik::geometry::point<double> >() );
     auto const& point = mapnik::util::get<mapnik::geometry::point<double> >(geom);
@@ -26,9 +26,9 @@ SECTION("json point") {
 SECTION("json point reversed") {
     mapnik::util::file input("./test/data/json/point2.json");
     REQUIRE( input.open() );
-    auto json = input.data();
     mapnik::geometry::geometry<double> geom;
-    std::string json_string(json.get());
+    REQUIRE( input.data() );
+    std::string json_string(input.data().get(), input.size());
     REQUIRE( mapnik::json::from_geojson(json_string,geom) );
     REQUIRE( geom.is<mapnik::geometry::point<double> >() );
     auto const& point = mapnik::util::get<mapnik::geometry::point<double> >(geom);
diff --git a/test/unit/geometry/geometry_strategy_test.cpp b/test/unit/geometry/geometry_strategy_test.cpp
index 124b343..a5fe01f 100644
--- a/test/unit/geometry/geometry_strategy_test.cpp
+++ b/test/unit/geometry/geometry_strategy_test.cpp
@@ -29,7 +29,6 @@ SECTION("proj and view strategy") {
         point<double> p1(-97.553098,35.523105);
         point<double> r1(-1.08596e+07, 4.2352e+06);
         point<double> p3 = transform<double>(p1, ps);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
     }
     {
@@ -37,7 +36,6 @@ SECTION("proj and view strategy") {
         point<double> p1(-1.08596e+07, 4.2352e+06);
         point<double> r1(58.6287 , 100.945);
         point<double> p3 = transform<double>(p1, vs);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
 
     }
@@ -48,7 +46,6 @@ SECTION("proj and view strategy") {
         using sg_type = strategy_group<mapnik::view_strategy>;
         sg_type sg(vs);
         point<double> p3 = transform<double>(p1, sg);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
 
     }
@@ -59,7 +56,6 @@ SECTION("proj and view strategy") {
         point<double> p1(-97.553098,35.523105);
         point<double> r1(58.6287 , 100.945);
         point<double> p3 = transform<double>(p1, sg);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
     }
     {
@@ -71,7 +67,6 @@ SECTION("proj and view strategy") {
         geometry<double> p2 = transform<double>(p1, sg);
         REQUIRE(p2.is<point<double> >());
         point<double> p3 = mapnik::util::get<point<double> >(p2);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
     }
     {
@@ -83,7 +78,6 @@ SECTION("proj and view strategy") {
         geometry<std::int64_t> p2 = transform<std::int64_t>(p1, sg);
         REQUIRE(p2.is<point<std::int64_t> >());
         point<std::int64_t> p3 = mapnik::util::get<point<std::int64_t> >(p2);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
     }
     {
@@ -96,7 +90,6 @@ SECTION("proj and view strategy") {
         geometry<std::int64_t> p2 = transform<std::int64_t>(p1, sg);
         REQUIRE(p2.is<point<std::int64_t> >());
         point<std::int64_t> p3 = mapnik::util::get<point<std::int64_t> >(p2);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
     }
     {
@@ -109,7 +102,6 @@ SECTION("proj and view strategy") {
         geometry<double> p2 = transform<double>(p1, sg);
         REQUIRE(p2.is<point<double> >());
         point<double> p3 = mapnik::util::get<point<double> >(p2);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
     }
     {
@@ -122,7 +114,6 @@ SECTION("proj and view strategy") {
         geometry<std::int64_t> p2 = transform<std::int64_t>(p1, sg);
         REQUIRE(p2.is<point<std::int64_t> >());
         point<std::int64_t> p3 = mapnik::util::get<point<std::int64_t> >(p2);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
     }
     {
@@ -135,7 +126,6 @@ SECTION("proj and view strategy") {
         geometry<double> p2 = transform<double>(p1, sg);
         REQUIRE(p2.is<point<double> >());
         point<double> p3 = mapnik::util::get<point<double> >(p2);
-        //std::cout << p3.x << " , " << p3.y << std::endl;
         assert_g_equal(r1, p3);
     }
 
@@ -159,10 +149,9 @@ SECTION("scaling strategies - double to double") {
         assert_g_equal(r, o);
     }
     {   
-        // Not the rounding doesn't apply because not casting to ints
         scale_rounding_strategy ss(0.5, -2.0);
         point<double> p(-90.3, 35.5);
-        point<double> r(-47.15, 15.75);
+        point<double> r(-47.0, 16.0);
         point<double> o = transform<double>(p, ss);
         assert_g_equal(r, o);
     }
@@ -193,47 +182,6 @@ SECTION("scaling strategies - double to int64") {
         point<std::int64_t> o = transform<std::int64_t>(p, ss);
         assert_g_equal(r, o);
     }
-    {   
-        // Test underflow and overflow
-        std::int64_t min = std::numeric_limits<std::int64_t>::min();
-        std::int64_t max = std::numeric_limits<std::int64_t>::max();
-        scale_strategy ss(1.0E100);
-        point<double> p(-90.3, 35.5);
-        point<std::int64_t> r(min, max);
-        point<std::int64_t> o = transform<std::int64_t>(p, ss);
-        assert_g_equal(r, o);
-    }
-    {   
-        // Test underflow and overflow
-        std::int64_t min = std::numeric_limits<std::int64_t>::min();
-        std::int64_t max = std::numeric_limits<std::int64_t>::max();
-        scale_rounding_strategy ss(1.0E100);
-        point<double> p(-90.3, 35.5);
-        point<std::int64_t> r(min, max);
-        point<std::int64_t> o = transform<std::int64_t>(p, ss);
-        assert_g_equal(r, o);
-    }
-    {   
-        // Test overrflow and underflow
-        std::int64_t min = std::numeric_limits<std::int64_t>::min();
-        std::int64_t max = std::numeric_limits<std::int64_t>::max();
-        scale_strategy ss(1.0E100);
-        point<double> p(90.3, -35.5);
-        point<std::int64_t> r(max, min);
-        point<std::int64_t> o = transform<std::int64_t>(p, ss);
-        assert_g_equal(r, o);
-    }
-    {   
-        // Test overflow and underflow
-        std::int64_t min = std::numeric_limits<std::int64_t>::min();
-        std::int64_t max = std::numeric_limits<std::int64_t>::max();
-        scale_rounding_strategy ss(1.0E100);
-        point<double> p(90.3, -35.5);
-        point<std::int64_t> r(max, min);
-        point<std::int64_t> o = transform<std::int64_t>(p, ss);
-        assert_g_equal(r, o);
-    }
-
 } // END SECTION
 
 } // END TEST CASE
diff --git a/test/unit/imaging/webp_io.cpp b/test/unit/imaging/webp_io.cpp
new file mode 100644
index 0000000..6f580a4
--- /dev/null
+++ b/test/unit/imaging/webp_io.cpp
@@ -0,0 +1,26 @@
+
+#if defined(HAVE_WEBP)
+
+#include "catch.hpp"
+
+#include <mapnik/image_util.hpp>
+#include <mapnik/image_view_any.hpp>
+#include <mapnik/webp_io.hpp>
+
+TEST_CASE("webp io") {
+
+SECTION("does not crash accessing view") {
+    std::stringstream s;
+    mapnik::image_rgba8 im(1024,1024);
+    mapnik::image_view_rgba8 view(512,512,1024,1024,im);
+    WebPConfig config;
+    if (!WebPConfigInit(&config))
+    {
+        throw std::runtime_error("version mismatch");
+    }
+    save_as_webp(s,view,config,true);
+}
+
+}
+
+#endif
diff --git a/test/visual/renderer.hpp b/test/visual/renderer.hpp
index 58cb4cd..6d99c3a 100644
--- a/test/visual/renderer.hpp
+++ b/test/visual/renderer.hpp
@@ -28,14 +28,19 @@
 // stl
 #include <sstream>
 #include <iomanip>
+#include <fstream>
 
 // mapnik
 #include <mapnik/map.hpp>
 #include <mapnik/agg_renderer.hpp>
+#include <mapnik/grid/grid_renderer.hpp>
 #if defined(HAVE_CAIRO)
 #include <mapnik/cairo/cairo_renderer.hpp>
 #include <mapnik/cairo/cairo_image_util.hpp>
 #endif
+#if defined(SVG_RENDERER)
+#include <mapnik/svg/output/svg_renderer.hpp>
+#endif
 
 // boost
 #include <boost/filesystem.hpp>
@@ -48,6 +53,8 @@ struct renderer_base
 {
     using image_type = ImageType;
 
+    static constexpr const char * ext = ".png";
+
     unsigned compare(image_type const & actual, boost::filesystem::path const& reference) const
     {
         return compare_images(actual, reference.string());
@@ -92,14 +99,90 @@ struct cairo_renderer : renderer_base<mapnik::image_rgba8>
 };
 #endif
 
-struct grid_renderer : renderer_base<mapnik::image_gray8>
+#if defined(SVG_RENDERER)
+struct svg_renderer : renderer_base<std::string>
+{
+    static constexpr const char * name = "svg";
+    static constexpr const char * ext = ".svg";
+
+    image_type render(mapnik::Map const & map, double scale_factor) const
+    {
+        std::stringstream ss;
+        std::ostream_iterator<char> output_stream_iterator(ss);
+        mapnik::svg_renderer<std::ostream_iterator<char>> ren(map, output_stream_iterator, scale_factor);
+        ren.apply();
+        return ss.str();
+    }
+
+    unsigned compare(image_type const & actual, boost::filesystem::path const& reference) const
+    {
+        std::ifstream stream(reference.string().c_str(),std::ios_base::in|std::ios_base::binary);
+        if (!stream.is_open())
+        {
+            throw std::runtime_error("could not open: '" + reference.string() + "'");
+        }
+        std::string expected(std::istreambuf_iterator<char>(stream.rdbuf()),(std::istreambuf_iterator<char>()));
+        stream.close();
+        return std::fabs(actual.size() - expected.size());
+    }
+
+    void save(image_type const & image, boost::filesystem::path const& path) const
+    {
+        std::ofstream file(path.string().c_str(), std::ios::out | std::ios::trunc | std::ios::binary);
+        if (!file) {
+            throw std::runtime_error((std::string("cannot open file for writing file ") + path.string()).c_str());
+        } else {
+            file << image;
+            file.close();
+        }
+    }
+
+};
+#endif
+
+struct grid_renderer : renderer_base<mapnik::image_rgba8>
 {
     static constexpr const char * name = "grid";
 
+    void convert(mapnik::grid::data_type const & grid, image_type & image) const
+    {
+        for (std::size_t y = 0; y < grid.height(); ++y)
+        {
+            mapnik::grid::value_type const * grid_row = grid.get_row(y);
+            image_type::pixel_type * image_row = image.get_row(y);
+            for (std::size_t x = 0; x < grid.width(); ++x)
+            {
+                mapnik::grid::value_type val = grid_row[x];
+
+                if (val == mapnik::grid::base_mask)
+                {
+                    image_row[x] = 0;
+                    continue;
+                }
+                if (val < 0)
+                {
+                    throw std::runtime_error("grid renderer: feature id is negative.");
+                }
+
+                val *= 100;
+
+                if (val > 0x00ffffff)
+                {
+                    throw std::runtime_error("grid renderer: feature id is too high.");
+                }
+
+                image_row[x] = val | 0xff000000;
+            }
+        }
+    }
+
     image_type render(mapnik::Map const & map, double scale_factor) const
     {
+        mapnik::grid grid(map.width(), map.height(), "__id__");
+        mapnik::grid_renderer<mapnik::grid> ren(map, grid, scale_factor);
+        ren.apply();
         image_type image(map.width(), map.height());
-        // TODO: Render grid here.
+        convert(grid.data(), image);
         return image;
     }
 };
@@ -109,14 +192,14 @@ class renderer
 {
 public:
     renderer(boost::filesystem::path const & output_dir, boost::filesystem::path const & reference_dir, bool overwrite)
-        : output_dir(output_dir), reference_dir(reference_dir), overwrite(overwrite)
+        : ren(), output_dir(output_dir), reference_dir(reference_dir), overwrite(overwrite)
     {
     }
 
     result test(std::string const & name, mapnik::Map const & map, double scale_factor) const
     {
         typename Renderer::image_type image(ren.render(map, scale_factor));
-        boost::filesystem::path reference = reference_dir / image_file_name(name, map.width(), map.height(), scale_factor, true);
+        boost::filesystem::path reference = reference_dir / image_file_name(name, map.width(), map.height(), scale_factor, true, Renderer::ext);
         bool reference_exists = boost::filesystem::exists(reference);
         result res;
 
@@ -131,7 +214,7 @@ public:
         if (res.diff)
         {
             boost::filesystem::create_directories(output_dir);
-            boost::filesystem::path path = output_dir / image_file_name(name, map.width(), map.height(), scale_factor);
+            boost::filesystem::path path = output_dir / image_file_name(name, map.width(), map.height(), scale_factor, false, Renderer::ext);
             res.actual_image_path = path;
             res.state = STATE_FAIL;
             ren.save(image, path);
@@ -151,16 +234,17 @@ private:
                                 double width,
                                 double height,
                                 double scale_factor,
-                                bool reference=false) const
+                                bool reference,
+                                std::string const& ext) const
     {
         std::stringstream s;
         s << test_name << '-' << width << '-' << height << '-'
           << std::fixed << std::setprecision(1) << scale_factor
-          << '-' << Renderer::name << (reference ? "-reference" : "") << ".png";
+          << '-' << Renderer::name << (reference ? "-reference" : "") << ext;
         return s.str();
     }
 
-    Renderer ren;
+    const Renderer ren;
     boost::filesystem::path const & output_dir;
     boost::filesystem::path const & reference_dir;
     const bool overwrite;
diff --git a/test/visual/run.cpp b/test/visual/run.cpp
index 6875e20..89e7b0a 100644
--- a/test/visual/run.cpp
+++ b/test/visual/run.cpp
@@ -29,6 +29,14 @@
 // boost
 #include <boost/program_options.hpp>
 
+#include <libxml/parser.h> // for xmlInitParser(), xmlCleanupParser()
+#include <cairo.h>
+#include <unicode/uclean.h>
+
+#ifdef MAPNIK_USE_PROJ4
+#include <proj_api.h>
+#endif
+
 int main(int argc, char** argv)
 {
     using namespace visual_tests;
@@ -79,13 +87,21 @@ int main(int argc, char** argv)
     report_type report = vm.count("verbose") ? report_type((console_report())) : report_type((console_short_report()));
     result_list results;
 
-    if (vm.count("styles"))
+    try
     {
-        results = run.test(vm["styles"].as<std::vector<std::string>>(), report);
+        if (vm.count("styles"))
+        {
+            results = run.test(vm["styles"].as<std::vector<std::string>>(), report);
+        }
+        else
+        {
+            results = run.test_all(report);
+        }
     }
-    else
+    catch (std::exception & e)
     {
-        results = run.test_all(report);
+        std::cerr << "Error runnig tests: " << e.what() << std::endl;
+        return 1;
     }
 
     unsigned failed_count = mapnik::util::apply_visitor(summary_visitor(results), report);
@@ -95,5 +111,25 @@ int main(int argc, char** argv)
         html_summary(results, output_dir);
     }
 
+    // only call this once, on exit
+    // to make sure valgrind output is clean
+    // http://xmlsoft.org/xmlmem.html
+    xmlCleanupParser();
+
+    // http://cairographics.org/manual/cairo-Error-handling.html#cairo-debug-reset-static-data
+    cairo_debug_reset_static_data();
+
+    // http://icu-project.org/apiref/icu4c/uclean_8h.html#a93f27d0ddc7c196a1da864763f2d8920
+    u_cleanup();
+
+#ifdef MAPNIK_USE_PROJ4
+    // http://trac.osgeo.org/proj/ticket/149
+ #if PJ_VERSION >= 480
+    pj_clear_initcache();
+ #endif
+    // https://trac.osgeo.org/proj/wiki/ProjAPI#EnvironmentFunctions
+    pj_deallocate_grids();
+#endif
+
     return failed_count;
 }
diff --git a/test/visual/runner.cpp b/test/visual/runner.cpp
index 64b475f..317c7cf 100644
--- a/test/visual/runner.cpp
+++ b/test/visual/runner.cpp
@@ -60,9 +60,15 @@ runner::runner(runner::path_type const & styles_dir,
       output_dir_(output_dir),
       reference_dir_(reference_dir),
       jobs_(jobs),
-      renderers_{ renderer<agg_renderer>(output_dir_, reference_dir_, overwrite),
-                  renderer<cairo_renderer>(output_dir_, reference_dir_, overwrite)/*,
-                  renderer<grid_renderer>(output_dir_, reference_dir_, overwrite)*/ }
+      renderers_{ renderer<agg_renderer>(output_dir_, reference_dir_, overwrite)
+#if defined(HAVE_CAIRO)
+                  ,renderer<cairo_renderer>(output_dir_, reference_dir_, overwrite)
+#endif
+#if defined(SVG_RENDERER)
+                  ,renderer<svg_renderer>(output_dir_, reference_dir_, overwrite)
+#endif
+                  ,renderer<grid_renderer>(output_dir_, reference_dir_, overwrite)
+                }
 {
 }
 
diff --git a/test/visual/runner.hpp b/test/visual/runner.hpp
index 848249d..5a4fd39 100644
--- a/test/visual/runner.hpp
+++ b/test/visual/runner.hpp
@@ -35,9 +35,14 @@ namespace visual_tests
 
 class runner
 {
-    using renderer_type = mapnik::util::variant<renderer<agg_renderer>,
-                                                renderer<cairo_renderer>/*,
-                                                renderer<grid_renderer>*/>;
+    using renderer_type = mapnik::util::variant<renderer<agg_renderer>
+#if defined(HAVE_CAIRO)
+                                                ,renderer<cairo_renderer>
+#endif
+#if defined(SVG_RENDERER)
+                                                ,renderer<svg_renderer>
+#endif
+                                                ,renderer<grid_renderer>>;
     using path_type = boost::filesystem::path;
     using files_iterator = std::vector<path_type>::const_iterator;
 
diff --git a/utils/mapnik-config/build.py b/utils/mapnik-config/build.py
index d21b2a7..987dd25 100644
--- a/utils/mapnik-config/build.py
+++ b/utils/mapnik-config/build.py
@@ -29,7 +29,7 @@ Import('env')
 
 config_env = env.Clone()
 
-config_variables = '''#!/bin/bash
+config_variables = '''#!/usr/bin/env bash
 
 ## variables
 

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