Merge branch 'master' into large_csv

This commit is contained in:
artemp 2015-06-18 13:06:28 +02:00
commit d893718343
630 changed files with 1984 additions and 1435 deletions

View file

@ -67,7 +67,7 @@ script:
export MASON_VERSION=latest; export MASON_VERSION=latest;
export MASON_LIB_FILE=lib/libmapnik-wkt.a; export MASON_LIB_FILE=lib/libmapnik-wkt.a;
source ./.mason/mason.sh; source ./.mason/mason.sh;
./configure PREFIX=${MASON_PREFIX} PATH_REPLACE='' MAPNIK_BUNDLED_SHARE_DIRECTORY=True; ./configure PREFIX=${MASON_PREFIX} PATH_REPLACE='' MAPNIK_BUNDLED_SHARE_DIRECTORY=True RUNTIME_LINK='static';
else else
./configure; ./configure;
fi fi
@ -79,8 +79,6 @@ script:
- if [[ ${COVERAGE} != true ]]; then - if [[ ${COVERAGE} != true ]]; then
make bench; make bench;
fi fi
after_success:
- if [[ ${MASON_PUBLISH} == true ]]; then - if [[ ${MASON_PUBLISH} == true ]]; then
./mason_latest.sh build; ./mason_latest.sh build;
./mason_latest.sh link; ./mason_latest.sh link;

View file

@ -1770,8 +1770,8 @@ if not preconfigured:
env.Append(CPPDEFINES = ndebug_defines) env.Append(CPPDEFINES = ndebug_defines)
# Common flags for g++/clang++ CXX compiler. # Common flags for g++/clang++ CXX compiler.
# TODO: clean up code more to make -Wextra -Wsign-compare -Wsign-conversion -Wconversion -Wshadow viable # TODO: clean up code more to make -Wextra -Wsign-compare -Wsign-conversion -Wconversion viable
common_cxx_flags = '-Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread) common_cxx_flags = '-Wall %s %s -ftemplate-depth-300 -Wsign-compare -Wshadow ' % (env['WARNING_CXXFLAGS'], pthread)
if 'clang++' in env['CXX']: if 'clang++' in env['CXX']:
common_cxx_flags += ' -Wno-unknown-pragmas -Wno-unsequenced ' common_cxx_flags += ' -Wno-unknown-pragmas -Wno-unsequenced '

View file

@ -4,6 +4,8 @@
// mapnik // mapnik
#include <mapnik/params.hpp> #include <mapnik/params.hpp>
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>
#include <mapnik/safe_cast.hpp>
#include "../test/cleanup.hpp"
// stl // stl
#include <chrono> #include <chrono>
@ -25,8 +27,8 @@ protected:
public: public:
test_case(mapnik::parameters const& params) test_case(mapnik::parameters const& params)
: params_(params), : params_(params),
threads_(*params.get<mapnik::value_integer>("threads",0)), threads_(mapnik::safe_cast<std::size_t>(*params.get<mapnik::value_integer>("threads",0))),
iterations_(*params.get<mapnik::value_integer>("iterations",0)) iterations_(mapnik::safe_cast<std::size_t>(*params.get<mapnik::value_integer>("iterations",0)))
{} {}
std::size_t threads() const std::size_t threads() const
{ {
@ -66,11 +68,14 @@ void handle_args(int argc, char** argv, mapnik::parameters & params)
mapnik::parameters params; \ mapnik::parameters params; \
benchmark::handle_args(argc,argv,params); \ benchmark::handle_args(argc,argv,params); \
test_class test_runner(params); \ test_class test_runner(params); \
return run(test_runner,name); \ auto result = run(test_runner,name); \
testing::run_cleanup(); \
return result; \
} \ } \
catch (std::exception const& ex) \ catch (std::exception const& ex) \
{ \ { \
std::clog << ex.what() << "\n"; \ std::clog << ex.what() << "\n"; \
testing::run_cleanup(); \
return -1; \ return -1; \
} \ } \
} \ } \

View file

@ -44,6 +44,7 @@ benchmarks = [
"test_rendering.cpp", "test_rendering.cpp",
"test_rendering_shared_map.cpp", "test_rendering_shared_map.cpp",
"test_offset_converter.cpp", "test_offset_converter.cpp",
"test_marker_cache.cpp",
# "test_numeric_cast_vs_static_cast.cpp", # "test_numeric_cast_vs_static_cast.cpp",
] ]
for cpp_test in benchmarks: for cpp_test in benchmarks:

View file

@ -0,0 +1,42 @@
#include "bench_framework.hpp"
#include <mapnik/marker_cache.hpp>
class test : public benchmark::test_case
{
std::vector<std::string> images_;
public:
test(mapnik::parameters const& params)
: test_case(params),
images_{
"./test/data/images/dummy.jpg",
"./test/data/images/dummy.jpeg",
"./test/data/images/dummy.png",
"./test/data/images/dummy.tif",
"./test/data/images/dummy.tiff",
//"./test/data/images/landusepattern.jpeg", // will fail since it is a png
//"./test/data/images/xcode-CgBI.png", // will fail since its an invalid png
"./test/data/svg/octocat.svg",
"./test/data/svg/place-of-worship-24.svg",
"./test/data/svg/point_sm.svg",
"./test/data/svg/point.svg",
"./test/data/svg/airfield-12.svg"
} {}
bool validate() const
{
return true;
}
bool operator()() const
{
unsigned count = 0;
for (std::size_t i=0;i<iterations_;++i) {
for (auto filename : images_)
{
auto marker = mapnik::marker_cache::instance().find(filename,true);
}
++count;
}
return (count == iterations_);
}
};
BENCHMARK(test,"marker cache")

View file

@ -246,10 +246,10 @@ public:
std::string expect = expected_+".png"; std::string expect = expected_+".png";
std::string actual = expected_+"_actual.png"; std::string actual = expected_+"_actual.png";
mapnik::geometry::multi_polygon<double> mp; mapnik::geometry::multi_polygon<double> mp;
for (auto const& geom: result) for (auto const& _geom: result)
{ {
//std::clog << boost::geometry::dsv(geom) << "\n"; //std::clog << boost::geometry::dsv(geom) << "\n";
mp.emplace_back(geom); mp.emplace_back(_geom);
} }
mapnik::geometry::geometry<double> geom2(mp); mapnik::geometry::geometry<double> geom2(mp);
auto env = mapnik::geometry::envelope(geom2); auto env = mapnik::geometry::envelope(geom2);
@ -287,9 +287,9 @@ public:
std::deque<mapnik::geometry::polygon<double> > result; std::deque<mapnik::geometry::polygon<double> > result;
boost::geometry::intersection(extent_,poly,result); boost::geometry::intersection(extent_,poly,result);
unsigned count = 0; unsigned count = 0;
for (auto const& geom : result) for (auto const& _geom : result)
{ {
mapnik::geometry::polygon_vertex_adapter<double> va(geom); mapnik::geometry::polygon_vertex_adapter<double> va(_geom);
unsigned cmd; unsigned cmd;
double x,y; double x,y;
while ((cmd = va.vertex(&x, &y)) != mapnik::SEG_END) { while ((cmd = va.vertex(&x, &y)) != mapnik::SEG_END) {

View file

@ -38,15 +38,16 @@ public:
} }
bool operator()() const bool operator()() const
{ {
for (std::size_t i=0;i<iterations_;++i) { for (std::size_t i=0;i<iterations_;++i)
for (int i=-180;i<180;i=i+5) {
for (int j=-180;j<180;j=j+5)
{ {
for (int j=-85;j<85;j=j+5) for (int k=-85;k<85;k=k+5)
{ {
mapnik::projection src(src_,defer_proj4_init_); mapnik::projection src(src_,defer_proj4_init_);
mapnik::projection dest(dest_,defer_proj4_init_); mapnik::projection dest(dest_,defer_proj4_init_);
mapnik::proj_transform tr(src,dest); mapnik::proj_transform tr(src,dest);
mapnik::box2d<double> box(i,j,i,j); mapnik::box2d<double> box(j,k,j,k);
if (!tr.forward(box)) throw std::runtime_error("could not transform coords"); if (!tr.forward(box)) throw std::runtime_error("could not transform coords");
} }
} }

View file

@ -1,7 +1,7 @@
# #
# This file is part of Mapnik (c++ mapping toolkit) # This file is part of Mapnik (c++ mapping toolkit)
# #
# Copyright (C) 2009 Artem Pavlenko, Dane Springmeyer # Copyright (C) 2015 Artem Pavlenko, Dane Springmeyer
# #
# Mapnik is free software; you can redistribute it and/or # Mapnik is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@ -17,7 +17,7 @@
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# #
import os import os
from copy import copy from copy import copy

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,7 +1,7 @@
# #
# This file is part of Mapnik (c++ mapping toolkit) # This file is part of Mapnik (c++ mapping toolkit)
# #
# Copyright (C) 2013 Artem Pavlenko # Copyright (C) 2015 Artem Pavlenko
# #
# Mapnik is free software; you can redistribute it and/or # Mapnik is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@ -17,13 +17,13 @@
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# #
Import ('env') Import ('env')
import os import os
import platform import platform
lib_dir = os.path.normpath(env['DESTDIR'] + '/' + env['PREFIX'] + '/' + env['LIBDIR_SCHEMA'] + '/mapnik') lib_dir = os.path.normpath(env['DESTDIR'] + '/' + env['PREFIX'] + '/' + env['LIBDIR_SCHEMA'] + '/mapnik')
fonts = 1 fonts = 1
ini_template = ''' ini_template = '''

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,6 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* Mapnik is free software; you can redistribute it and/or * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

4
deps/agg/build.py vendored
View file

@ -1,7 +1,7 @@
# #
# This file is part of Mapnik (c++ mapping toolkit) # This file is part of Mapnik (c++ mapping toolkit)
# #
# Copyright (C) 2013 Artem Pavlenko # Copyright (C) 2015 Artem Pavlenko
# #
# Mapnik is free software; you can redistribute it and/or # Mapnik is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@ -17,7 +17,7 @@
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# #
import os import os
from glob import glob from glob import glob

View file

@ -63,7 +63,7 @@ void image_filter_lut::normalize()
if(sum == image_filter_scale) break; if(sum == image_filter_scale) break;
double k = double(image_filter_scale) / double(sum); double k = (sum > 0) ? double(image_filter_scale) / double(sum) : 1;
sum = 0; sum = 0;
for(j = 0; j < m_diameter; j++) for(j = 0; j < m_diameter; j++)
{ {

View file

@ -6,6 +6,9 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wc++11-narrowing" #pragma GCC diagnostic ignored "-Wc++11-narrowing"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/gil/gil_all.hpp> #include <boost/gil/gil_all.hpp>
#include <boost/gil/extension/toolbox/hsv.hpp> #include <boost/gil/extension/toolbox/hsv.hpp>
#include <boost/gil/extension/toolbox/hsl.hpp> #include <boost/gil/extension/toolbox/hsl.hpp>

View file

@ -91,9 +91,9 @@ void trans_single_path::finalize_path()
for(i = 0; i < m_src_vertices.size(); i++) for(i = 0; i < m_src_vertices.size(); i++)
{ {
vertex_dist& v = m_src_vertices[i]; vertex_dist& v = m_src_vertices[i];
double d = v.dist; double dd = v.dist;
v.dist = dist; v.dist = dist;
dist += d; dist += dd;
} }
m_kindex = (m_src_vertices.size() - 1) / dist; m_kindex = (m_src_vertices.size() - 1) / dist;
m_status = ready; m_status = ready;

View file

@ -169,7 +169,7 @@ unsigned vcgen_dash::vertex(double* x, double* y)
{ {
double dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start; double dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start;
unsigned cmd = (m_curr_dash & 1) ? unsigned cmd2 = (m_curr_dash & 1) ?
path_cmd_move_to : path_cmd_move_to :
path_cmd_line_to; path_cmd_line_to;
@ -217,7 +217,7 @@ unsigned vcgen_dash::vertex(double* x, double* y)
} }
} }
} }
return cmd; return cmd2;
} }
break; break;

View file

@ -1,7 +1,7 @@
# #
# This file is part of Mapnik (c++ mapping toolkit) # This file is part of Mapnik (c++ mapping toolkit)
# #
# Copyright (C) 2013 Artem Pavlenko # Copyright (C) 2015 Artem Pavlenko
# #
# Mapnik is free software; you can redistribute it and/or # Mapnik is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@ -17,7 +17,7 @@
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# #
import os import os
import glob import glob
@ -32,4 +32,4 @@ if not env['SYSTEM_FONTS']:
target_path = env['MAPNIK_FONTS_DEST'] target_path = env['MAPNIK_FONTS_DEST']
if 'uninstall' not in COMMAND_LINE_TARGETS: if 'uninstall' not in COMMAND_LINE_TARGETS:
env.Alias(target='install', source=env.Install(target_path, includes)) env.Alias(target='install', source=env.Install(target_path, includes))
env['create_uninstall_target'](env, target_path) env['create_uninstall_target'](env, target_path)

View file

@ -1,7 +1,7 @@
# #
# This file is part of Mapnik (c++ mapping toolkit) # This file is part of Mapnik (c++ mapping toolkit)
# #
# Copyright (C) 2013 Artem Pavlenko # Copyright (C) 2015 Artem Pavlenko
# #
# Mapnik is free software; you can redistribute it and/or # Mapnik is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -27,6 +27,8 @@
#include <mapnik/svg/svg_converter.hpp> #include <mapnik/svg/svg_converter.hpp>
#include <mapnik/vertex_converters.hpp> #include <mapnik/vertex_converters.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/safe_cast.hpp>
#include <mapnik/util/const_rendering_buffer.hpp>
// agg // agg
#include "agg_color_rgba.h" #include "agg_color_rgba.h"
@ -70,7 +72,9 @@ void render_raster_marker(RendererType renb, RasterizerType & ras, image_rgba8 c
float scale_factor, bool snap_to_pixels) float scale_factor, bool snap_to_pixels)
{ {
using color_type = agg::rgba8; using color_type = agg::rgba8;
using pixfmt_pre = agg::pixfmt_rgba32_pre; using const_rendering_buffer = util::rendering_buffer<image_rgba8>;
using pixfmt_pre = agg::pixfmt_alpha_blend_rgba<agg::blender_rgba32_pre, const_rendering_buffer, agg::pixel32_type>;
agg::scanline_u8 sl; agg::scanline_u8 sl;
double width = src.width(); double width = src.width();
double height = src.height(); double height = src.height();
@ -80,22 +84,22 @@ void render_raster_marker(RendererType renb, RasterizerType & ras, image_rgba8 c
&& (std::fabs(0.0 - tr.shx) < agg::affine_epsilon) && (std::fabs(0.0 - tr.shx) < agg::affine_epsilon)
&& (std::fabs(1.0 - tr.sy) < agg::affine_epsilon)) && (std::fabs(1.0 - tr.sy) < agg::affine_epsilon))
{ {
agg::rendering_buffer src_buffer((unsigned char *)src.bytes(),src.width(),src.height(),src.row_size()); const_rendering_buffer src_buffer(src);
pixfmt_pre pixf_mask(src_buffer); pixfmt_pre pixf_mask(src_buffer);
if (snap_to_pixels) if (snap_to_pixels)
{ {
renb.blend_from(pixf_mask, renb.blend_from(pixf_mask,
0, 0,
std::floor(tr.tx + .5), static_cast<int>(std::floor(tr.tx + .5)),
std::floor(tr.ty + .5), static_cast<int>(std::floor(tr.ty + .5)),
unsigned(255*opacity)); unsigned(255*opacity));
} }
else else
{ {
renb.blend_from(pixf_mask, renb.blend_from(pixf_mask,
0, 0,
tr.tx, static_cast<int>(tr.tx),
tr.ty, static_cast<int>(tr.ty),
unsigned(255*opacity)); unsigned(255*opacity));
} }
} }
@ -121,11 +125,8 @@ void render_raster_marker(RendererType renb, RasterizerType & ras, image_rgba8 c
agg::span_allocator<color_type> sa; agg::span_allocator<color_type> sa;
agg::image_filter_lut filter; agg::image_filter_lut filter;
filter.calculate(agg::image_filter_bilinear(), true); filter.calculate(agg::image_filter_bilinear(), true);
agg::rendering_buffer marker_buf((unsigned char *)src.bytes(), const_rendering_buffer src_buffer(src);
src.width(), pixfmt_pre pixf(src_buffer);
src.height(),
src.row_size());
pixfmt_pre pixf(marker_buf);
img_accessor_type ia(pixf); img_accessor_type ia(pixf);
agg::trans_affine final_tr(p, 0, 0, width, height); agg::trans_affine final_tr(p, 0, 0, width, height);
if (snap_to_pixels) if (snap_to_pixels)

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -42,6 +42,9 @@
// boost // boost
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@ -274,8 +277,8 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym)
} }
// get indexed column names // get indexed column names
int start = get<value_integer>(sym, keys::start_column); value_integer start = get<value_integer>(sym, keys::start_column);
int end = start + get<value_integer>(sym, keys::num_columns); value_integer end = start + get<value_integer>(sym, keys::num_columns);
for (auto const& col_name : group_columns) for (auto const& col_name : group_columns)
{ {
if (expand_index_columns_ && col_name.find('%') != std::string::npos) if (expand_index_columns_ && col_name.find('%') != std::string::npos)
@ -286,7 +289,7 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym)
if (col_name.size() > 1) if (col_name.size() > 1)
{ {
// Indexed column name. add column name for each index value. // Indexed column name. add column name for each index value.
for (int col_idx = start; col_idx < end; ++col_idx) for (value_integer col_idx = start; col_idx < end; ++col_idx)
{ {
std::string col_idx_str; std::string col_idx_str;
if (mapnik::util::to_string(col_idx_str,col_idx)) if (mapnik::util::to_string(col_idx_str,col_idx))

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -124,12 +124,12 @@ class cairo_pattern : private util::noncopyable
public: public:
explicit cairo_pattern(image_rgba8 const& data, double opacity = 1.0) explicit cairo_pattern(image_rgba8 const& data, double opacity = 1.0)
{ {
int pixels = data.width() * data.height(); std::size_t pixels = data.width() * data.height();
const unsigned int *in_ptr = data.data(); const unsigned int *in_ptr = data.data();
const unsigned int *in_end = in_ptr + pixels; const unsigned int *in_end = in_ptr + pixels;
unsigned int *out_ptr; unsigned int *out_ptr;
surface_ = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, data.width(), data.height()); surface_ = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, static_cast<int>(data.width()), static_cast<int>(data.height()));
out_ptr = reinterpret_cast<unsigned int *>(cairo_image_surface_get_data(surface_)); out_ptr = reinterpret_cast<unsigned int *>(cairo_image_surface_get_data(surface_));

View file

@ -41,8 +41,8 @@ static inline void cairo_image_to_rgba8(mapnik::image_rgba8 & data,
throw std::runtime_error("Unable to convert this Cairo format to rgba8 image"); throw std::runtime_error("Unable to convert this Cairo format to rgba8 image");
} }
if (cairo_image_surface_get_width(&*surface) != data.width() || if (cairo_image_surface_get_width(&*surface) != static_cast<int>(data.width()) ||
cairo_image_surface_get_height(&*surface) != data.height()) cairo_image_surface_get_height(&*surface) != static_cast<int>(data.height()))
{ {
throw std::runtime_error("Mismatch in dimensions: size of image must match side of cairo surface"); throw std::runtime_error("Mismatch in dimensions: size of image must match side of cairo surface");
} }

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -165,7 +165,7 @@ public:
{ {
return common_.vars_; return common_.vars_;
} }
void render_marker(pixel_position const& pos, void render_marker(pixel_position const& pos,
marker const& marker, marker const& marker,
agg::trans_affine const& mtx, agg::trans_affine const& mtx,

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -26,11 +26,15 @@
// mapnik // mapnik
#include <mapnik/color.hpp> #include <mapnik/color.hpp>
#include <mapnik/util/hsl.hpp> #include <mapnik/util/hsl.hpp>
#include <mapnik/safe_cast.hpp>
// boost // boost
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/qi_action.hpp> #include <boost/spirit/include/qi_action.hpp>
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>
@ -45,10 +49,10 @@
BOOST_FUSION_ADAPT_ADT( BOOST_FUSION_ADAPT_ADT(
mapnik::color, mapnik::color,
(unsigned, unsigned, obj.red(), obj.set_red(val)) (unsigned, unsigned, obj.red(), obj.set_red(mapnik::safe_cast<uint8_t>(val)))
(unsigned, unsigned, obj.green(), obj.set_green(val)) (unsigned, unsigned, obj.green(), obj.set_green(mapnik::safe_cast<uint8_t>(val)))
(unsigned, unsigned, obj.blue(), obj.set_blue(val)) (unsigned, unsigned, obj.blue(), obj.set_blue(mapnik::safe_cast<uint8_t>(val)))
(unsigned, unsigned, obj.alpha(), obj.set_alpha(val)) (unsigned, unsigned, obj.alpha(), obj.set_alpha(mapnik::safe_cast<uint8_t>(val)))
) )
namespace mapnik namespace mapnik
@ -216,15 +220,6 @@ struct named_colors_ : qi::symbols<char,color>
} }
} ; } ;
// clipper helper
template <int MIN,int MAX>
inline int clip_int(int val)
{
if (val < MIN ) return MIN;
if (val > MAX ) return MAX;
return val;
}
struct percent_conv_impl struct percent_conv_impl
{ {
template <typename T> template <typename T>
@ -235,7 +230,7 @@ struct percent_conv_impl
unsigned operator() (double val) const unsigned operator() (double val) const
{ {
return clip_int<0,255>(int((255.0 * val)/100.0 + 0.5)); return safe_cast<uint8_t>(std::lround((255.0 * val)/100.0));
} }
}; };
@ -249,7 +244,7 @@ struct alpha_conv_impl
unsigned operator() (double val) const unsigned operator() (double val) const
{ {
return clip_int<0,255>(int((255.0 * val) + 0.5)); return safe_cast<uint8_t>(std::lround((255.0 * val)));
} }
}; };
@ -284,9 +279,9 @@ struct hsl_conv_impl
double g = hue_to_rgb(m1, m2, h); double g = hue_to_rgb(m1, m2, h);
double b = hue_to_rgb(m1, m2, h - 1.0/3.0); double b = hue_to_rgb(m1, m2, h - 1.0/3.0);
c.set_red(clip_int<0,255>(int((255.0 * r) + 0.5))); c.set_red(safe_cast<uint8_t>(std::lround(255.0 * r)));
c.set_green(clip_int<0,255>(int((255.0 * g) + 0.5))); c.set_green(safe_cast<uint8_t>(std::lround(255.0 * g)));
c.set_blue(clip_int<0,255>(int((255.0 * b) + 0.5))); c.set_blue(safe_cast<uint8_t>(std::lround(255.0 * b)));
} }
}; };

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -34,6 +34,9 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/support_locals.hpp> #include <boost/spirit/include/support_locals.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -86,8 +86,8 @@ struct unary_function_call
{ {
using argument_type = expr_node; using argument_type = expr_node;
unary_function_call() = default; unary_function_call() = default;
unary_function_call(unary_function_impl fun, argument_type const& arg) unary_function_call(unary_function_impl _fun, argument_type const& _arg)
: fun(fun), arg(arg) {} : fun(_fun), arg(_arg) {}
unary_function_impl fun; unary_function_impl fun;
argument_type arg; argument_type arg;
@ -97,8 +97,8 @@ struct binary_function_call
{ {
using argument_type = expr_node; using argument_type = expr_node;
binary_function_call() = default; binary_function_call() = default;
binary_function_call(binary_function_impl fun, argument_type const& arg1, argument_type const& arg2) binary_function_call(binary_function_impl _fun, argument_type const& _arg1, argument_type const& _arg2)
: fun(fun), arg1(arg1), arg2(arg2) {} : fun(_fun), arg1(_arg1), arg2(_arg2) {}
binary_function_impl fun; binary_function_impl fun;
argument_type arg1; argument_type arg1;
argument_type arg2; argument_type arg2;

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -224,7 +224,7 @@ void feature_style_processor<Processor>::prepare_layer(layer_rendering_material
std::vector<std::string> const& style_names = lay.styles(); std::vector<std::string> const& style_names = lay.styles();
unsigned int num_styles = style_names.size(); std::size_t num_styles = style_names.size();
if (num_styles == 0) if (num_styles == 0)
{ {
MAPNIK_LOG_DEBUG(feature_style_processor) MAPNIK_LOG_DEBUG(feature_style_processor)

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -28,6 +28,10 @@
// undef B0 to workaround https://svn.boost.org/trac/boost/ticket/10467 // undef B0 to workaround https://svn.boost.org/trac/boost/ticket/10467
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#undef B0 #undef B0
#include <boost/geometry/geometries/register/linestring.hpp> #include <boost/geometry/geometries/register/linestring.hpp>
#include <boost/geometry/geometries/register/point.hpp> #include <boost/geometry/geometries/register/point.hpp>

View file

@ -50,7 +50,7 @@ struct geometry_centroid
return false; return false;
} }
result_type operator() (geometry_collection<T> const& collection) const result_type operator() (geometry_collection<T> const&) const
{ {
return false; return false;
} }

View file

@ -31,6 +31,9 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/geometry/algorithms/correct.hpp> #include <boost/geometry/algorithms/correct.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@ -72,7 +75,7 @@ struct geometry_correct
} }
template <typename T> template <typename T>
result_type operator() (T & geom) const result_type operator() (T &) const
{ {
//no-op //no-op
} }

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -195,7 +195,7 @@ struct geom_reproj_copy_visitor {
geometry<T> operator() (line_string<T> const& ls) geometry<T> operator() (line_string<T> const& ls)
{ {
geometry<T> geom; // default empty geometry<T> geom; // default empty
int intial_err = n_err_; unsigned int intial_err = n_err_;
line_string<T> new_ls = reproject_internal(ls, proj_trans_, n_err_); line_string<T> new_ls = reproject_internal(ls, proj_trans_, n_err_);
if (n_err_ > intial_err || new_ls.empty()) return geom; if (n_err_ > intial_err || new_ls.empty()) return geom;
geom = std::move(new_ls); geom = std::move(new_ls);

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -33,6 +33,7 @@
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp> #include <mapnik/feature_factory.hpp>
#include <mapnik/util/conversions.hpp> #include <mapnik/util/conversions.hpp>
#include <mapnik/safe_cast.hpp>
// stl // stl
#include <map> #include <map>
@ -191,12 +192,16 @@ public:
if (ext0.intersects(ext1)) if (ext0.intersects(ext1))
{ {
box2d<int> box = ext0.intersect(ext1); box2d<int> box = ext0.intersect(ext1);
for (std::size_t y = box.miny(); y < box.maxy(); ++y) std::size_t miny = safe_cast<std::size_t>(box.miny());
std::size_t maxy = safe_cast<std::size_t>(box.maxy());
std::size_t minx = safe_cast<std::size_t>(box.minx());
std::size_t maxx = safe_cast<std::size_t>(box.maxx());
for (std::size_t y = miny; y < maxy; ++y)
{ {
value_type* row_to = data_.get_row(y); value_type* row_to = data_.get_row(y);
image_rgba8::pixel_type const * row_from = data.get_row(y - y0); image_rgba8::pixel_type const * row_from = data.get_row(y - y0);
for (std::size_t x = box.minx(); x < box.maxx(); ++x) for (std::size_t x = minx; x < maxx; ++x)
{ {
image_rgba8::pixel_type rgba = row_from[x - x0]; image_rgba8::pixel_type rgba = row_from[x - x0];
unsigned a = (rgba >> 24) & 0xff; unsigned a = (rgba >> 24) & 0xff;

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -24,9 +24,15 @@
#define MAPNIK_GRID_PIXFMT_HPP #define MAPNIK_GRID_PIXFMT_HPP
#include <string> #include <string>
#include <mapnik/grid/grid_rendering_buffer.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include "agg_basics.h" #include "agg_basics.h"
#include <mapnik/grid/grid_pixel.hpp> #include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_rendering_buffer.hpp> #pragma GCC diagnostic pop
namespace mapnik namespace mapnik
{ {

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2012 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2014 Artem Pavlenko * Copyright (C) 2015 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -23,9 +23,14 @@
#ifndef MAPNIK_GRID_RENDERER_BASE_HPP #ifndef MAPNIK_GRID_RENDERER_BASE_HPP
#define MAPNIK_GRID_RENDERER_BASE_HPP #define MAPNIK_GRID_RENDERER_BASE_HPP
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include "agg_renderer_base.h" #include "agg_renderer_base.h"
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp> #include <mapnik/grid/grid_pixel.hpp>
#pragma GCC diagnostic pop
#include <mapnik/grid/grid_pixfmt.hpp>
namespace mapnik { namespace mapnik {

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