Merge branch 'master' of github.com:mapnik/mapnik into future-rendering-api

This commit is contained in:
Dane Springmeyer 2013-07-31 21:54:03 -04:00
commit 569de8569b
137 changed files with 1346 additions and 839 deletions

View file

@ -8,6 +8,12 @@ For a complete change history, see the git log.
## Future
- Added the ability to create a mapnik Feature from a geojson feature with `mapnik.Feature.from_geojson` in python.
- Added to python bindings: `has_tiff`, `has_png`, `has_webp`, `has_proj4`, `has_svg_renderer`, and `has_grid_renderer`
- Made it possible to disable compilation of `grid_renderer` with `./configure GRID_RENDERER=False` (#1962)
- Added `webp` image encoding and decoding support (#1955)
- Added `premultiplied` property on mapnik::image_32 / mapnik.Image to enable knowledge of premultiplied status of image buffer.

View file

@ -336,6 +336,7 @@ opts.AddVariables(
# Variables affecting rendering back-ends
BoolVariable('GRID_RENDERER', 'build support for native grid renderer', 'True'),
BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'False'),
BoolVariable('CPP_TESTS', 'Compile the C++ tests', 'True'),
BoolVariable('BENCHMARK', 'Compile the C++ benchmark scripts', 'False'),
@ -447,6 +448,7 @@ pickle_store = [# Scons internal variables
'CAIRO_LIBPATHS',
'CAIRO_ALL_LIBS',
'CAIRO_CPPPATHS',
'GRID_RENDERER',
'SVG_RENDERER',
'SQLITE_LINKFLAGS',
'BOOST_LIB_VERSION_FROM_HEADER',
@ -613,6 +615,10 @@ def get_pkg_lib(context, config, lib):
if ret:
try:
value = call(cmd,silent=True)
if ' ' in value:
parts = value.split(' ')
if len(parts) > 1:
value = parts[1]
libnames = re.findall(libpattern,value)
if libnames:
libname = libnames[0]
@ -1325,19 +1331,19 @@ if not preconfigured:
else:
env['SKIPPED_DEPS'].append('boost_regex_icu')
if not env['HOST']:
for libname, headers, required, lang, define in OPTIONAL_LIBSHEADERS:
if not conf.CheckLibWithHeader(libname, headers, lang):
if required:
color_print(1, 'Could not find required header or shared library for %s' % libname)
env['MISSING_DEPS'].append(libname)
if not env['HOST']:
if not conf.CheckLibWithHeader(libname, headers, lang):
if required:
color_print(1, 'Could not find required header or shared library for %s' % libname)
env['MISSING_DEPS'].append(libname)
else:
color_print(4, 'Could not find optional header or shared library for %s' % libname)
env['SKIPPED_DEPS'].append(libname)
else:
color_print(4, 'Could not find optional header or shared library for %s' % libname)
env['SKIPPED_DEPS'].append(libname)
env.Append(CPPDEFINES = define)
else:
env.Append(CPPDEFINES = define)
else:
env.Append(CPPDEFINES = define)
env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
@ -1362,7 +1368,12 @@ if not preconfigured:
conf.parse_config('GDAL_CONFIG',checks='--cflags')
libname = conf.get_pkg_lib('GDAL_CONFIG','gdal')
if libname:
details['lib'] = libname
if not conf.CheckLibWithHeader(libname, details['inc'], details['lang']):
env['SKIPPED_DEPS'].append('gdal')
if libname in env['LIBS']:
env['LIBS'].remove(libname)
else:
details['lib'] = libname
elif plugin == 'postgis':
conf.parse_pg_config('PG_CONFIG')
elif plugin == 'ogr':
@ -1372,7 +1383,13 @@ if not preconfigured:
conf.parse_config('GDAL_CONFIG',checks='--cflags')
libname = conf.get_pkg_lib('GDAL_CONFIG','ogr')
if libname:
details['lib'] = libname
if not conf.CheckLibWithHeader(libname, details['inc'], details['lang']):
if 'gdal' not in env['SKIPPED_DEPS']:
env['SKIPPED_DEPS'].append('gdal')
if libname in env['LIBS']:
env['LIBS'].remove(libname)
else:
details['lib'] = libname
elif details['path'] and details['lib'] and details['inc']:
backup = env.Clone().Dictionary()
# Note, the 'delete_existing' keyword makes sure that these paths are prepended
@ -1385,7 +1402,6 @@ if not preconfigured:
env.Replace(**backup)
env['SKIPPED_DEPS'].append(details['lib'])
if plugin == 'sqlite':
SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
sqlite_backup = env.Clone().Dictionary()
# if statically linking, on linux we likely
# need to link sqlite to pthreads and dl
@ -1400,8 +1416,7 @@ if not preconfigured:
env.Append(LIBS=lib)
except OSError,e:
pass
if SQLITE_HAS_RTREE is None:
SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
if not SQLITE_HAS_RTREE:
env.Replace(**sqlite_backup)
if details['lib'] in env['LIBS']:
@ -1654,6 +1669,16 @@ if not preconfigured:
debug_defines = ['-DDEBUG', '-DMAPNIK_DEBUG']
ndebug_defines = ['-DNDEBUG']
# c++11 support / https://github.com/mapnik/mapnik/issues/1683
# - upgrade to PHOENIX_V3 since that is needed for c++11 compile
if 'c++11' in env['CUSTOM_CXXFLAGS']:
env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1')
# - workaround boost gil channel_algorithm.hpp narrowing error
# TODO - remove when building against >= 1.55
# https://github.com/mapnik/mapnik/issues/1970
if 'clang++' in env['CXX']:
env.Append(CXXFLAGS = '-Wno-c++11-narrowing')
# Enable logging in debug mode (always) and release mode (when specified)
if env['DEFAULT_LOG_SEVERITY']:
if env['DEFAULT_LOG_SEVERITY'] not in severities:
@ -1694,7 +1719,7 @@ if not preconfigured:
if not env['SUNCC']:
# Common flags for CXX compiler.
common_cxx_flags = '-ansi -Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread)
common_cxx_flags = '-Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread)
# https://github.com/mapnik/mapnik/issues/1835
if sys.platform == 'darwin' and env['CXX'] == 'g++':

View file

@ -266,7 +266,7 @@ struct test5
s.resize(s.capacity());
while (true)
{
size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%g", val_));
size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%g", val));
if (n2 <= s.size())
{
s.resize(n2);

View file

@ -46,6 +46,8 @@ target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.pa
py_env = env.Clone()
py_env.Append(CPPPATH = env['PYTHON_INCLUDES'])
py_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
py_env['LIBS'] = ['mapnik',env['BOOST_PYTHON_LIB']]
link_all_libs = env['LINKING'] == 'static' or env['RUNTIME_LINK'] == 'static' or (env['PLATFORM'] == 'Darwin' and not env['PYTHON_DYNAMIC_LOOKUP'])

View file

@ -30,12 +30,15 @@
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp>
#include <mapnik/feature_kv_iterator.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/wkb.hpp>
#include <mapnik/wkt/wkt_factory.hpp>
#include <mapnik/json/feature_parser.hpp>
#include <mapnik/json/geojson_generator.hpp>
// stl
@ -49,7 +52,7 @@ using mapnik::context_type;
using mapnik::context_ptr;
using mapnik::feature_kv_iterator;
mapnik::geometry_type const& (mapnik::feature_impl::*get_geometry_by_const_ref)(unsigned) const = &mapnik::feature_impl::get_geometry;
mapnik::geometry_type const& (mapnik::feature_impl::*get_geometry_by_const_ref)(std::size_t) const = &mapnik::feature_impl::get_geometry;
boost::ptr_vector<mapnik::geometry_type> const& (mapnik::feature_impl::*get_paths_by_const_ref)() const = &mapnik::feature_impl::paths;
void feature_add_geometries_from_wkb(mapnik::feature_impl &feature, std::string wkb)
@ -64,6 +67,18 @@ void feature_add_geometries_from_wkt(mapnik::feature_impl &feature, std::string
if (!result) throw std::runtime_error("Failed to parse WKT");
}
mapnik::feature_ptr from_geojson_impl(std::string const& json, mapnik::context_ptr const& ctx)
{
mapnik::transcoder tr("utf8");
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
mapnik::json::feature_parser<std::string::const_iterator> parser(tr);
if (!parser.parse(json.begin(), json.end(), *feature))
{
throw std::runtime_error("Failed to parse geojson feature");
}
return feature;
}
std::string feature_to_geojson(mapnik::feature_impl const& feature)
{
std::string json;
@ -232,5 +247,7 @@ void export_feature()
.def("__len__", &mapnik::feature_impl::size)
.def("context",&mapnik::feature_impl::context)
.def("to_geojson",&feature_to_geojson)
.def("from_geojson",from_geojson_impl)
.staticmethod("from_geojson")
;
}

View file

@ -20,6 +20,8 @@
*
*****************************************************************************/
#if defined(GRID_RENDERER)
// boost
#include <boost/python.hpp>
#include <boost/python/module.hpp>
@ -80,3 +82,5 @@ void export_grid()
;
}
#endif

View file

@ -20,6 +20,8 @@
*
*****************************************************************************/
#if defined(GRID_RENDERER)
// boost
#include <boost/python.hpp>
#include <boost/python/module.hpp>
@ -49,3 +51,5 @@ void export_grid_view()
)
;
}
#endif

View file

@ -106,17 +106,6 @@ double get_scale_denominator(mapnik::Map const& map)
return mapnik::scale_denominator( map.scale(), map_proj.is_geographic());
}
// deepcopy
/*
mapnik::Map map_deepcopy(mapnik::Map & m, boost::python::dict memo)
{
// FIXME: ignore memo for now
mapnik::Map result;
mapnik::util::deepcopy(m, result);
return result;
}
*/
void set_maximum_extent(mapnik::Map & m, boost::optional<mapnik::box2d<double> > const& box)
{
if (box)

View file

@ -41,8 +41,10 @@ void export_image();
void export_image_view();
void export_gamma_method();
void export_scaling_method();
#if defined(GRID_RENDERER)
void export_grid();
void export_grid_view();
#endif
void export_map();
void export_python();
void export_expression();
@ -92,7 +94,9 @@ void export_logger();
#include <mapnik/value_error.hpp>
#include <mapnik/save_map.hpp>
#include <mapnik/scale_denominator.hpp>
#if defined(GRID_RENDERER)
#include "python_grid_utils.hpp"
#endif
#include "mapnik_value_converter.hpp"
#include "mapnik_threads.hpp"
#include "python_optional.hpp"
@ -365,7 +369,33 @@ std::string mapnik_version_string()
return MAPNIK_VERSION_STRING;
}
// indicator for jpeg read/write support within libmapnik
bool has_proj4()
{
#if defined(MAPNIK_USE_PROJ4)
return true;
#else
return false;
#endif
}
bool has_svg_renderer()
{
#if defined(SVG_RENDERER)
return true;
#else
return false;
#endif
}
bool has_grid_renderer()
{
#if defined(GRID_RENDERER)
return true;
#else
return false;
#endif
}
bool has_jpeg()
{
#if defined(HAVE_JPEG)
@ -375,6 +405,33 @@ bool has_jpeg()
#endif
}
bool has_png()
{
#if defined(HAVE_PNG)
return true;
#else
return false;
#endif
}
bool has_tiff()
{
#if defined(HAVE_TIFF)
return true;
#else
return false;
#endif
}
bool has_webp()
{
#if defined(HAVE_WEBP)
return true;
#else
return false;
#endif
}
// indicator for cairo rendering support inside libmapnik
bool has_cairo()
{
@ -426,7 +483,6 @@ BOOST_PYTHON_MODULE(_mapnik)
using mapnik::load_map_string;
using mapnik::save_map;
using mapnik::save_map_to_string;
using mapnik::render_grid;
register_exception_translator<std::exception>(&standard_error_translator);
register_exception_translator<std::out_of_range>(&out_of_range_error_translator);
@ -447,8 +503,10 @@ BOOST_PYTHON_MODULE(_mapnik)
export_image_view();
export_gamma_method();
export_scaling_method();
#if defined(GRID_RENDERER)
export_grid();
export_grid_view();
#endif
export_expression();
export_rule();
export_style();
@ -486,7 +544,8 @@ BOOST_PYTHON_MODULE(_mapnik)
">>> clear_cache()\n"
);
def("render_grid",&render_grid,
#if defined(GRID_RENDERER)
def("render_grid",&mapnik::render_grid,
( arg("map"),
arg("layer"),
args("key")="__id__",
@ -494,6 +553,7 @@ BOOST_PYTHON_MODULE(_mapnik)
arg("fields")=boost::python::list()
)
);
#endif
def("render_to_file",&render_to_file1,
"\n"
@ -578,9 +638,11 @@ BOOST_PYTHON_MODULE(_mapnik)
(arg("map"),arg("image"),args("layer"))
);
#if defined(GRID_RENDERER)
def("render_layer", &mapnik::render_layer_for_grid,
(arg("map"),arg("grid"),args("layer"),arg("fields")=boost::python::list())
);
#endif
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
def("render",&render3,
@ -738,7 +800,12 @@ BOOST_PYTHON_MODULE(_mapnik)
def("save_map_to_string", &save_map_to_string, save_map_to_string_overloads());
def("mapnik_version", &mapnik_version,"Get the Mapnik version number");
def("mapnik_version_string", &mapnik_version_string,"Get the Mapnik version string");
def("has_proj4", &has_proj4, "Get proj4 status");
def("has_jpeg", &has_jpeg, "Get jpeg read/write support status");
def("has_png", &has_png, "Get png read/write support status");
def("has_tiff", &has_jpeg, "Get tiff read/write support status");
def("has_webp", &has_jpeg, "Get webp read/write support status");
def("has_grid_renderer", &has_grid_renderer, "Get grid_renderer status");
def("has_cairo", &has_cairo, "Get cairo library status");
def("has_pycairo", &has_pycairo, "Get pycairo module status");

View file

@ -194,13 +194,16 @@ struct ListNodeWrap: formatting::list_node, wrapper<formatting::list_node>
ListNodeWrap(object l) : formatting::list_node(), wrapper<formatting::list_node>()
{
stl_input_iterator<formatting::node_ptr> begin(l), end;
children_.insert(children_.end(), begin, end);
while (begin != end)
{
children_.push_back(*begin);
++begin;
}
}
/* TODO: Add constructor taking variable number of arguments.
http://wiki.python.org/moin/boost.python/HowTo#A.22Raw.22_function */
virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
{
if(override o = this->get_override("apply"))

View file

@ -20,6 +20,8 @@
*
*****************************************************************************/
#if defined(GRID_RENDERER)
// boost
#include <boost/python.hpp>
#include <boost/scoped_array.hpp>
@ -472,3 +474,5 @@ boost::python::dict render_grid(mapnik::Map const& map,
}
}
#endif

View file

@ -228,7 +228,7 @@ public:
: boost::python::class_<T, X1, X2, X3>(name, doc, i) { }
template <class D>
self& def_readwrite_convert(char const* name, D const& d, char const* doc=0)
self& def_readwrite_convert(char const* name, D const& d, char const* /*doc*/=0)
{
this->add_property(name,
boost::python::make_getter(d, boost::python::return_value_policy<boost::python::return_by_value>()),

View file

@ -34,6 +34,7 @@ demo_env = env.Clone()
demo_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
demo_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
if env['HAS_CAIRO']:
demo_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS'])
@ -41,9 +42,6 @@ if env['HAS_CAIRO']:
libraries = ['mapnik']
libraries.extend(copy(env['LIBMAPNIK_LIBS']))
if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux':
libraries.append('dl')
rundemo = demo_env.Program('rundemo', source, LIBS=libraries, LINKFLAGS=env["CUSTOM_LDFLAGS"])
Depends(rundemo, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))

View file

@ -134,7 +134,7 @@ namespace agg
static AGG_INLINE void blend_pix(value_type* p,
unsigned cr, unsigned cg, unsigned cb,
unsigned alpha,
unsigned cover=0)
unsigned /*cover*/=0)
{
calc_type r = p[Order::R];
calc_type g = p[Order::G];

View file

@ -9,6 +9,9 @@ subdirs = ['','svg','wkt','grid','json','util','text_placements','formatting']
if env['SVG_RENDERER']:
subdirs.append('svg/output')
if env['GRID_RENDERER']:
subdirs.append('grid')
if 'install' in COMMAND_LINE_TARGETS:
for subdir in subdirs:
pathdir = os.path.join(base,subdir,'*.hpp')

View file

@ -25,17 +25,12 @@
// mapnik
#include <mapnik/gamma_method.hpp>
#include <mapnik/stroke.hpp>
#include <mapnik/stroke.hpp> // for line_cap_e, line_join_e, etc
// agg
#include "agg_basics.h"
#include "agg_gamma_functions.h"
#include "agg_math_stroke.h"
#include "agg_pixfmt_rgba.h"
#include "agg_scanline_u.h"
#include "agg_scanline_p.h"
#include "agg_renderer_outline_aa.h"
#include "agg_renderer_scanline.h"
#include "agg_gamma_functions.h" // for gamma_power, gamma_linear, etc
#include "agg_math_stroke.h" // for line_join_e::miter_join, etc
#include "agg_rasterizer_outline_aa.h"
namespace mapnik {

View file

@ -47,7 +47,6 @@
#include <mapnik/text_placements/base.hpp> // for text_placements
// boost
#include <boost/concept_check.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
@ -62,12 +61,11 @@ struct expression_attributes : boost::static_visitor<void>
explicit expression_attributes(Container& names)
: names_(names) {}
void operator() (value_type const& x) const
void operator() (value_type const& /*x*/) const
{
boost::ignore_unused_variable_warning(x);
}
void operator() (geometry_type_attribute const& type) const
void operator() (geometry_type_attribute const& /*type*/) const
{
// do nothing
}

View file

@ -59,7 +59,7 @@ typedef cairo_status_t ErrorStatus;
/// Throws the appropriate exception, if exceptions are enabled.
inline void throw_exception(ErrorStatus status)
{
throw std::runtime_error("cairo: fixme");
throw std::runtime_error(std::string("cairo: ") + cairo_status_to_string(status));
}
//We inline this because it is called so often.
@ -70,7 +70,7 @@ inline void check_status_and_throw_exception(ErrorStatus status)
}
template<class T>
void check_object_status_and_throw_exception(const T& object)
void check_object_status_and_throw_exception(T const& object)
{
check_status_and_throw_exception(object.get_status());
}

View file

@ -43,10 +43,6 @@
// boost
#include <boost/scoped_ptr.hpp>
// FIXME
// forward declare so that
// apps using mapnik do not
// need agg headers
namespace agg {
struct trans_affine;
}

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/color.hpp>
#include <mapnik/util/hsl.hpp>
// spirit2
#include <boost/spirit/include/qi.hpp>
@ -39,24 +40,6 @@
// stl
#include <string>
namespace mapnik {
// http://www.w3.org/TR/css3-color/#hsl-color
inline double hue_to_rgb( double m1, double m2, double h)
{
if (h < 0.0) h = h + 1.0;
else if (h > 1) h = h - 1.0;
if (h * 6 < 1.0)
return m1 + (m2 - m1) * h * 6.0;
if (h * 2 < 1.0)
return m2;
if (h * 3 < 2.0)
return m1 + (m2 - m1)* (2.0/3.0 - h) * 6.0;
return m1;
}
} // namespace mapnik
// boost
#include <boost/version.hpp>
@ -125,7 +108,11 @@ struct alpha_conv_impl
struct hsl_conv_impl
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template<typename T>
#else
template<typename T0,typename T1, typename T2, typename T3>
#endif
struct result
{
typedef void type;

View file

@ -164,7 +164,7 @@ namespace mapnik {
public:
typedef std::basic_ostringstream<Ch, Tr, A> stream_buffer;
void operator()(const logger::severity_type& severity, const stream_buffer &s)
void operator()(const logger::severity_type& /*severity*/, const stream_buffer &s)
{
#ifdef MAPNIK_THREADSAFE
static boost::mutex mutex;
@ -193,15 +193,19 @@ namespace mapnik {
base_log() {}
#ifdef MAPNIK_LOG
base_log(const char* object_name)
{
#ifdef MAPNIK_LOG
if (object_name != NULL)
{
object_name_ = object_name;
}
#endif
}
#else
base_log(const char* /*object_name*/)
{
}
#endif
~base_log()
{
@ -214,13 +218,20 @@ namespace mapnik {
}
template<class T>
#ifdef MAPNIK_LOG
base_log &operator<<(const T &x)
{
#ifdef MAPNIK_LOG
streambuf_ << x;
#endif
return *this;
}
#else
base_log &operator<<(const T& /*x*/)
{
return *this;
}
#endif
private:
#ifdef MAPNIK_LOG

View file

@ -65,7 +65,11 @@ struct unicode_impl
struct regex_match_impl
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef expr_node type;
@ -82,7 +86,12 @@ struct regex_match_impl
struct regex_replace_impl
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T>
#else
template <typename T0, typename T1, typename T2>
#endif
struct result
{
typedef expr_node type;

View file

@ -145,7 +145,7 @@ expression_grammar<Iterator>::expression_grammar(mapnik::transcoder const& tr)
multiplicative_expr = unary_expr [_val = _1]
>> *( '*' >> unary_expr [_val *= _1]
| '/' >> unary_expr [_val /= _1]
| '%' >> unary_expr [_val %= _1]
| '%' >> unary_expr [_val %= construct<mapnik::expr_node>(_1)] //needed by clang++ with -std=c++11
| regex_match_expr[_val = regex_match_(_val, _1)]
| regex_replace_expr(_val) [_val = _1]
)

View file

@ -211,17 +211,17 @@ public:
geom_cont_.push_back(geom);
}
unsigned num_geometries() const
std::size_t num_geometries() const
{
return geom_cont_.size();
}
geometry_type const& get_geometry(unsigned index) const
geometry_type const& get_geometry(std::size_t index) const
{
return geom_cont_[index];
}
geometry_type& get_geometry(unsigned index)
geometry_type& get_geometry(std::size_t index)
{
return geom_cont_[index];
}

View file

@ -49,7 +49,6 @@
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/foreach.hpp>
#include <boost/concept_check.hpp>
// stl
#include <vector>
@ -74,11 +73,8 @@ template <> // No-op specialization
struct process_impl<false>
{
template <typename T0, typename T1, typename T2, typename T3>
static void process(T0 & ren, T1 const& sym, T2 & f, T3 const& tr)
static void process(T0 & /*ren*/, T1 const& /*sym*/, T2 & /*f*/, T3 const& /*tr*/)
{
boost::ignore_unused_variable_warning(ren);
boost::ignore_unused_variable_warning(f);
boost::ignore_unused_variable_warning(tr);
#ifdef MAPNIK_DEBUG
std::clog << "NO-OP ...\n";
#endif

View file

@ -137,59 +137,6 @@ public:
data_(x,y)=rgba;
}
}
inline void blendPixel(int x,int y,unsigned int rgba1,int t)
{
blendPixel2(x,y,rgba1,t,1.0); // do not change opacity
}
inline void blendPixel2(int x,int y,unsigned int rgba1,int t,double opacity)
{
if (checkBounds(x,y))
{
unsigned rgba0 = data_(x,y);
#ifdef MAPNIK_BIG_ENDIAN
unsigned a1 = (unsigned)((rgba1 & 0xff) * opacity) & 0xff; // adjust for desired opacity
a1 = (t*a1) / 255;
if (a1 == 0) return;
unsigned r1 = (rgba1 >> 24) & 0xff;
unsigned g1 = (rgba1 >> 16 ) & 0xff;
unsigned b1 = (rgba1 >> 8) & 0xff;
unsigned a0 = (rgba0 & 0xff);
unsigned r0 = ((rgba0 >> 24 ) & 0xff) * a0;
unsigned g0 = ((rgba0 >> 16 ) & 0xff) * a0;
unsigned b0 = ((rgba0 >> 8) & 0xff) * a0;
a0 = ((a1 + a0) << 8) - a0*a1;
r0 = ((((r1 << 8) - r0) * a1 + (r0 << 8)) / a0);
g0 = ((((g1 << 8) - g0) * a1 + (g0 << 8)) / a0);
b0 = ((((b1 << 8) - b0) * a1 + (b0 << 8)) / a0);
a0 = a0 >> 8;
data_(x,y)= (a0)| (b0 << 8) | (g0 << 16) | (r0 << 24) ;
#else
unsigned a1 = (unsigned)(((rgba1 >> 24) & 0xff) * opacity) & 0xff; // adjust for desired opacity
a1 = (t*a1) / 255;
if (a1 == 0) return;
unsigned r1 = rgba1 & 0xff;
unsigned g1 = (rgba1 >> 8 ) & 0xff;
unsigned b1 = (rgba1 >> 16) & 0xff;
unsigned a0 = (rgba0 >> 24) & 0xff;
unsigned r0 = (rgba0 & 0xff) * a0;
unsigned g0 = ((rgba0 >> 8 ) & 0xff) * a0;
unsigned b0 = ((rgba0 >> 16) & 0xff) * a0;
a0 = ((a1 + a0) << 8) - a0*a1;
r0 = ((((r1 << 8) - r0) * a1 + (r0 << 8)) / a0);
g0 = ((((g1 << 8) - g0) * a1 + (g0 << 8)) / a0);
b0 = ((((b1 << 8) - b0) * a1 + (b0 << 8)) / a0);
a0 = a0 >> 8;
data_(x,y)= (a0 << 24)| (b0 << 16) | (g0 << 8) | (r0) ;
#endif
}
}
void composite_pixel(unsigned op, int x,int y,unsigned c, unsigned cover, double opacity);

View file

@ -198,30 +198,6 @@ public:
return height_;
}
inline void blendPixel(value_type feature_id,int x,int y,unsigned int rgba1,int t)
{
blendPixel2(feature_id ,x,y,rgba1,t,1.0); // do not change opacity
}
inline void blendPixel2(value_type feature_id,int x,int y,unsigned int rgba1,int t,double opacity)
{
if (checkBounds(x,y))
{
#ifdef MAPNIK_BIG_ENDIAN
unsigned a = (int)((rgba1 & 0xff) * opacity) & 0xff; // adjust for desired opacity
#else
unsigned a = (int)(((rgba1 >> 24) & 0xff) * opacity) & 0xff; // adjust for desired opacity
#endif
// if the pixel is more than a tenth
// opaque then burn in the feature id
if (a >= 25)
{
data_(x,y) = feature_id;
}
}
}
inline void set_rectangle(value_type id,image_data_32 const& data,int x0,int y0)
{
box2d<int> ext0(0,0,width_,height_);

View file

@ -40,7 +40,7 @@ template<class ColorT> struct blender_gray
enum base_scale_e { base_shift = color_type::base_shift };
static AGG_INLINE void blend_pix(value_type* p, unsigned cv,
unsigned alpha, unsigned cover=0)
unsigned alpha, unsigned /*cover*/=0)
{
*p = (value_type)((((cv - calc_type(*p)) * alpha) + (calc_type(*p) << base_shift)) >> base_shift);
}
@ -256,7 +256,7 @@ public:
void blend_hline(int x, int y,
unsigned len,
const color_type& c,
agg::int8u cover)
agg::int8u /*cover*/)
{
value_type* p = (value_type*)
m_rbuf->row_ptr(x, y, len) + x * Step + Offset;
@ -588,7 +588,7 @@ public:
void blend_from_color(const SrcPixelFormatRenderer& from,
const color_type& color,
int xdst, int ydst,
int xsrc, int ysrc,
int /*xsrc*/, int ysrc,
unsigned len,
agg::int8u cover)
{
@ -615,7 +615,7 @@ public:
void blend_from_lut(const SrcPixelFormatRenderer& from,
const color_type* color_lut,
int xdst, int ydst,
int xsrc, int ysrc,
int /*xsrc*/, int ysrc,
unsigned len,
agg::int8u cover)
{

View file

@ -73,8 +73,8 @@ public:
void end_map_processing(Map const& map);
void start_layer_processing(layer const& lay, box2d<double> const& query_extent);
void end_layer_processing(layer const& lay);
void start_style_processing(feature_type_style const& st) {}
void end_style_processing(feature_type_style const& st) {}
void start_style_processing(feature_type_style const& /*st*/) {}
void end_style_processing(feature_type_style const& /*st*/) {}
void render_marker(mapnik::feature_impl & feature, unsigned int step, pixel_position const& pos, marker const& marker, const agg::trans_affine & tr, double opacity, composite_mode_e comp_op);
void process(point_symbolizer const& sym,

View file

@ -37,6 +37,7 @@
// agg
#include "agg_basics.h"
#include "agg_rendering_buffer.h"
#include "agg_color_rgba.h"
#include "agg_pixfmt_rgba.h"
#include "agg_scanline_u.h"
#include "agg_blur.h"
@ -401,7 +402,7 @@ template <typename Src>
void apply_filter(Src & src, agg_stack_blur const& op)
{
agg::rendering_buffer buf(src.raw_data(),src.width(),src.height(), src.width() * 4);
agg::pixfmt_rgba32 pixf(buf);
agg::pixfmt_rgba32_pre pixf(buf);
agg::stack_blur_rgba32(pixf,op.rx,op.ry);
}
@ -503,41 +504,46 @@ void apply_filter(Src & src, scale_hsla const& transform)
uint8_t & g = get_color(src_it[x], green_t());
uint8_t & b = get_color(src_it[x], blue_t());
uint8_t & a = get_color(src_it[x], alpha_t());
double r2 = static_cast<double>(r)/255.0;
double g2 = static_cast<double>(g)/255.0;
double b2 = static_cast<double>(b)/255.0;
double a2 = static_cast<double>(a)/255.0;
double a1 = a2;
bool alpha_modified = false;
if (set_alpha && a2 > 0.01)
// demultiply
if (a2 <= 0.0)
{
r = g = b = 0;
continue;
}
else
{
r2 /= a2;
g2 /= a2;
b2 /= a2;
}
if (set_alpha)
{
a2 = transform.a0 + (a2 * (transform.a1 - transform.a0));
if (a2 <= 0)
{
a = 0;
r = g = b = a = 0;
continue;
}
else if (a2 > 1)
{
a2 = 1;
a = 255;
}
else
{
a = static_cast<unsigned>(std::floor((a2 * 255.0) +.5));
if (a > 255) a = 255;
a = static_cast<uint8_t>(std::floor((a2 * 255.0) +.5));
}
alpha_modified = true;
}
if (tinting && a > 1)
if (tinting)
{
double h;
double s;
double l;
// demultiply
if (a1 <= 0.0)
{
r = g = b = 0;
continue;
}
else if (a1 < 1)
{
r /= a1;
g /= a1;
b /= a1;
}
rgb2hsl(r,g,b,h,s,l);
rgb2hsl(r2,g2,b2,h,s,l);
double h2 = transform.h0 + (h * (transform.h1 - transform.h0));
double s2 = transform.s0 + (s * (transform.s1 - transform.s0));
double l2 = transform.l0 + (l * (transform.l1 - transform.l0));
@ -547,42 +553,26 @@ void apply_filter(Src & src, scale_hsla const& transform)
else if (s2 < 0) { s2 = 0; }
if (l2 > 1) { l2 = 1; }
else if (l2 < 0) { l2 = 0; }
hsl2rgb(h2,s2,l2,r,g,b);
// premultiply
// we only work with premultiplied source,
// thus all color values must be <= alpha
r *= a2;
g *= a2;
b *= a2;
}
else if (alpha_modified)
{
// demultiply
if (a1 <= 0.0)
{
r = g = b = 0;
continue;
}
else if (a1 < 1)
{
r /= a1;
g /= a1;
b /= a1;
}
// premultiply
// we only work with premultiplied source,
// thus all color values must be <= alpha
r *= a2;
g *= a2;
b *= a2;
hsl2rgb(h2,s2,l2,r2,g2,b2);
}
// premultiply
r2 *= a2;
g2 *= a2;
b2 *= a2;
r = static_cast<uint8_t>(std::floor((r2*255.0)+.5));
g = static_cast<uint8_t>(std::floor((g2*255.0)+.5));
b = static_cast<uint8_t>(std::floor((b2*255.0)+.5));
// all color values must be <= alpha
if (r>a) r=a;
if (g>a) g=a;
if (b>a) b=a;
}
}
}
}
template <typename Src>
void apply_filter(Src & src, gray const& op)
void apply_filter(Src & src, gray const& /*op*/)
{
using namespace boost::gil;
@ -632,14 +622,14 @@ void x_gradient_impl(Src const& src_view, Dst const& dst_view)
}
template <typename Src>
void apply_filter(Src & src, x_gradient const& op)
void apply_filter(Src & src, x_gradient const& /*op*/)
{
double_buffer<Src> tb(src);
x_gradient_impl(tb.src_view, tb.dst_view);
}
template <typename Src>
void apply_filter(Src & src, y_gradient const& op)
void apply_filter(Src & src, y_gradient const& /*op*/)
{
double_buffer<Src> tb(src);
x_gradient_impl(rotated90ccw_view(tb.src_view),
@ -647,7 +637,7 @@ void apply_filter(Src & src, y_gradient const& op)
}
template <typename Src>
void apply_filter(Src & src, invert const& op)
void apply_filter(Src & src, invert const& /*op*/)
{
using namespace boost::gil;

View file

@ -26,13 +26,17 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/color.hpp>
#include <mapnik/config_error.hpp>
// boost
#include <boost/variant.hpp>
// stl
#include <vector>
#include <ostream>
#include <iterator> // for std::back_insert_iterator
namespace mapnik { namespace filter {
struct blur {};
@ -66,7 +70,19 @@ struct scale_hsla
l0(_l0),
l1(_l1),
a0(_a0),
a1(_a1) {}
a1(_a1) {
if (h0 < 0 || h0 > 1 ||
h1 < 0 || h1 > 1 ||
s0 < 0 || s0 > 1 ||
s1 < 0 || s1 > 1 ||
l0 < 0 || l0 > 1 ||
l1 < 0 || l1 > 1 ||
a0 < 0 || a0 > 1 ||
a1 < 0 || a1 > 1)
{
throw config_error("scale-hsla values must be between 0 and 1");
}
}
inline bool is_identity() const {
return (h0 == 0 &&
h1 == 1 &&

View file

@ -42,14 +42,14 @@ using standard_wide::space_type;
struct generate_id
{
typedef int result_type;
generate_id(int start)
: id_(start) {}
int operator() () const
{
return id_++;
}
}
mutable int id_;
};
@ -76,7 +76,7 @@ struct feature_collection_grammar :
feature_collection = lit('{') >> (type | features) % lit(",") >> lit('}')
;
type = lit("\"type\"") > lit(":") > lit("\"FeatureCollection\"")
;
@ -86,29 +86,29 @@ struct feature_collection_grammar :
> -(feature(_val) % lit(','))
> lit(']')
;
feature = eps[_a = phoenix::construct<mapnik::feature_ptr>(new_<mapnik::feature_impl>(ctx_,generate_id_()))]
>> feature_g(*_a)[push_back(_r1,_a)]
;
type.name("type");
features.name("features");
feature.name("feature");
feature_g.name("feature-grammar");
qi::on_error<qi::fail>
(
feature_collection
, std::clog
<< phoenix::val("Error parsing GeoJSON ")
<< qi::_4
<< qi::_4
<< phoenix::val(" here: \"")
<< construct<std::string>(qi::_3, qi::_2)
<< construct<std::string>(qi::_3, qi::_2)
<< phoenix::val("\"")
<< std::endl
);
}
context_ptr ctx_;
qi::rule<Iterator, std::vector<feature_ptr>(), space_type> feature_collection; // START
qi::rule<Iterator, space_type> type;

View file

@ -66,6 +66,31 @@ public:
mapnik::transcoder const& tr_;
};
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
struct put_property
{
typedef void result_type;
explicit put_property(mapnik::transcoder const& tr)
: tr_(tr) {}
template <typename T0,typename T1, typename T2>
result_type operator() (T0 & feature, T1 const& key, T2 const& val) const
{
mapnik::value v = boost::apply_visitor(attribute_value_visitor(tr_),val); // TODO: optimize
feature.put_new(key, v);
}
mapnik::transcoder const& tr_;
};
struct extract_geometry
{
typedef boost::ptr_vector<mapnik::geometry_type>& result_type;
template <typename T>
result_type operator() (T & feature) const
{
return feature.paths();
}
};
#else
struct put_property
{
template <typename T0,typename T1, typename T2>
@ -100,11 +125,12 @@ struct extract_geometry
return feature.paths();
}
};
#endif
template <typename Iterator, typename FeatureType>
struct feature_grammar :
qi::grammar<Iterator, void(FeatureType&),
space_type>
qi::grammar<Iterator, void(FeatureType&),
space_type>
{
feature_grammar(mapnik::transcoder const& tr);

View file

@ -0,0 +1,57 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2012 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef MAPNIK_FEATURE_PARSER_HPP
#define MAPNIK_FEATURE_PARSER_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/unicode.hpp>
// boost
#include <boost/scoped_ptr.hpp>
// stl
#include <vector>
namespace mapnik { namespace json {
template <typename Iterator, typename FeatureType> struct feature_grammar;
template <typename Iterator>
class MAPNIK_DECL feature_parser : private mapnik::noncopyable
{
typedef Iterator iterator_type;
typedef mapnik::feature_impl feature_type;
public:
feature_parser(mapnik::transcoder const& tr);
~feature_parser();
bool parse(iterator_type first, iterator_type last, mapnik::feature_impl & f);
private:
boost::scoped_ptr<feature_grammar<iterator_type,feature_type> > grammar_;
};
}}
#endif //MAPNIK_FEATURE_PARSER_HPP

View file

@ -39,10 +39,7 @@
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_statement.hpp>
#include <boost/fusion/include/boost_tuple.hpp>
#include <boost/math/special_functions/trunc.hpp> // trunc to avoid needing C++11
//#define BOOST_SPIRIT_USE_PHOENIX_V3 1
#include <boost/math/special_functions/trunc.hpp> // for vc++
namespace boost { namespace spirit { namespace traits {
@ -61,6 +58,52 @@ namespace phoenix = boost::phoenix;
namespace {
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
struct get_type
{
typedef int result_type;
result_type operator() (geometry_type const& geom) const
{
return static_cast<int>(geom.type());
}
};
struct get_first
{
typedef geometry_type::value_type const result_type;
result_type operator() (geometry_type const& geom) const
{
geometry_type::value_type coord;
boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord));
return coord;
}
};
struct multi_geometry_type
{
typedef boost::tuple<unsigned,bool> result_type;
result_type operator() (geometry_container const& geom) const
{
unsigned type = 0u;
bool collection = false;
geometry_container::const_iterator itr = geom.begin();
geometry_container::const_iterator end = geom.end();
for ( ; itr != end; ++itr)
{
if (type != 0u && itr->type() != type)
{
collection = true;
break;
}
type = itr->type();
}
if (geom.size() > 1) type +=3;
return boost::tuple<unsigned,bool>(type, collection);
}
};
#else
struct get_type
{
template <typename T>
@ -111,6 +154,7 @@ struct multi_geometry_type
return boost::tuple<unsigned,bool>(type, collection);
}
};
#endif
template <typename T>
@ -123,7 +167,7 @@ struct json_coordinate_policy : karma::real_policies<T>
{
if (n == 0.0) return 0;
using namespace boost::spirit;
return static_cast<unsigned>(15 - boost::math::trunc(log10(traits::get_absolute_value(n))));
return static_cast<unsigned>(14 - boost::math::trunc(log10(traits::get_absolute_value(n))));
}
template <typename OutputIterator>
@ -135,7 +179,7 @@ struct json_coordinate_policy : karma::real_policies<T>
template <typename OutputIterator>
static bool fraction_part(OutputIterator& sink, T n
, unsigned adjprec, unsigned precision)
, unsigned adjprec, unsigned precision)
{
if (n == 0) return true;
return base_type::fraction_part(sink, n, adjprec, precision);
@ -187,7 +231,10 @@ struct geometry_generator_grammar :
polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) << eps[_r1 += 1]
<< karma::string[ if_ (_r1 > 1) [_1 = "],["]
.else_[_1 = '[' ]] | &uint_ << lit(','))
.else_[_1 = '[' ]]
|
&uint_(mapnik::SEG_LINETO))
<< lit(',')
<< lit('[') << coord_type
<< lit(',')
<< coord_type << lit(']')
@ -258,9 +305,9 @@ struct multi_geometry_generator_grammar :
geometry = (lit("{\"type\":")
<< geometry_types[_1 = phoenix::at_c<0>(_a)][_a = _multi_type(_val)]
<< lit(",\"coordinates\":")
<< karma::string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = '[']]
<< karma::string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3) [_1 = '['].else_[_1 = ""]]
<< coordinates
<< karma::string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = ']']]
<< karma::string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3) [_1 = ']'].else_[_1 = ""]]
<< lit('}')) | lit("null")
;

View file

@ -37,6 +37,55 @@ namespace qi = boost::spirit::qi;
namespace standard_wide = boost::spirit::standard_wide;
using standard_wide::space_type;
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
struct push_vertex
{
typedef void result_type;
template <typename T0,typename T1, typename T2, typename T3>
result_type operator() (T0 c, T1 path, T2 x, T3 y) const
{
BOOST_ASSERT( path!=0 );
path->push_vertex(x,y,c);
}
};
struct close_path
{
typedef void result_type;
template <typename T>
result_type operator() (T path) const
{
BOOST_ASSERT( path!=0 );
path->close_path();
}
};
struct cleanup
{
typedef void result_type;
template <typename T0>
void operator() (T0 & path) const
{
if (path) delete path, path=0;
}
};
struct where_message
{
typedef std::string result_type;
template <typename Iterator>
std::string operator() (Iterator first, Iterator last, std::size_t size) const
{
std::string str(first, last);
if (str.length() > size)
return str.substr(0, size) + "..." ;
return str;
}
};
#else
struct push_vertex
{
template <typename T0,typename T1, typename T2, typename T3>
@ -101,12 +150,13 @@ struct where_message
return str;
}
};
#endif
template <typename Iterator>
struct geometry_grammar :
qi::grammar<Iterator,qi::locals<int>, void(boost::ptr_vector<mapnik::geometry_type>& )
, space_type>
, space_type>
{
geometry_grammar();
qi::rule<Iterator, qi::locals<int>, void(boost::ptr_vector<mapnik::geometry_type>& ),space_type> geometry;

View file

@ -38,6 +38,7 @@
// agg
#include "agg_ellipse.h"
#include "agg_basics.h"
#include "agg_color_rgba.h"
#include "agg_renderer_base.h"
#include "agg_renderer_scanline.h"
#include "agg_rendering_buffer.h"

View file

@ -76,7 +76,7 @@ public:
}
else
{
for (unsigned i=0; i<(*pos_)->num_geometries();++i)
for (std::size_t i=0; i<(*pos_)->num_geometries();++i)
{
geometry_type & geom = (*pos_)->get_geometry(i);
if (bbox_.intersects(geom.envelope()))

View file

@ -37,6 +37,7 @@
- avoiding including miniz.c here requires fwd declaring the two structs below
- being able to fwd declare requires removing typedef from struct declarations in miniz.c
- being able to fwd declare also requires using pointers to structs
- if updated, need to apply c++11 fix: https://github.com/mapnik/mapnik/issues/1967
*/
// TODO: try using #define MINIZ_HEADER_FILE_ONLY

View file

@ -47,7 +47,7 @@ namespace mapnik { namespace detail {
template <typename T>
struct extract_value
{
static inline boost::optional<T> do_extract_from_string(std::string const& source)
static inline boost::optional<T> do_extract_from_string(std::string const& /*source*/)
{
std::string err_msg = (boost::format("No conversion from std::string to %s") % typeid(T).name()).str();
throw std::runtime_error(err_msg);

View file

@ -57,8 +57,7 @@ template <typename DetectorT>
class placement_finder : mapnik::noncopyable
{
public:
placement_finder(feature_impl const& feature,
text_placement_info const& placement_info,
placement_finder(text_placement_info const& placement_info,
string_info const& info,
DetectorT & detector,
box2d<double> const& extent);

View file

@ -79,8 +79,8 @@ public:
void end_map_processing(Map const& map);
void start_layer_processing(layer const& lay, box2d<double> const& query_extent);
void end_layer_processing(layer const& lay);
void start_style_processing(feature_type_style const& st) {}
void end_style_processing(feature_type_style const& st) {}
void start_style_processing(feature_type_style const& /*st*/) {}
void end_style_processing(feature_type_style const& /*st*/) {}
/*!
* @brief Overloads that process each kind of symbolizer individually.
@ -115,9 +115,9 @@ public:
void process(markers_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(debug_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans) {}
void process(debug_symbolizer const& /*sym*/,
mapnik::feature_impl & /*feature*/,
proj_transform const& /*prj_trans*/) {}
/*!
* @brief Overload that process the whole set of symbolizers of a rule.
@ -127,7 +127,7 @@ public:
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void painted(bool painted)
void painted(bool /*painted*/)
{
// nothing to do
}

View file

@ -26,7 +26,6 @@
// agg
#include "agg_math_stroke.h"
#include "agg_color_rgba.h"
#include "agg_pixfmt_rgba.h"
#include "agg_trans_affine.h"
// mapnik

View file

@ -45,7 +45,12 @@ inline double deg2rad(double deg)
template <typename PathType>
struct move_to
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef void type;
@ -66,7 +71,11 @@ struct move_to
template <typename PathType>
struct hline_to
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef void type;
@ -88,7 +97,11 @@ struct hline_to
template <typename PathType>
struct vline_to
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef void type;
@ -109,7 +122,11 @@ struct vline_to
template <typename PathType>
struct line_to
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef void type;
@ -131,7 +148,11 @@ struct line_to
template <typename PathType>
struct curve4
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1, typename T2, typename T3>
#endif
struct result
{
typedef void type;
@ -156,7 +177,11 @@ struct curve4
template <typename PathType>
struct curve4_smooth
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1, typename T2>
#endif
struct result
{
typedef void type;
@ -178,7 +203,11 @@ struct curve4_smooth
template <typename PathType>
struct curve3
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1, typename T2>
#endif
struct result
{
typedef void type;
@ -201,7 +230,11 @@ struct curve3
template <typename PathType>
struct curve3_smooth
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef void type;
@ -223,7 +256,11 @@ struct curve3_smooth
template <typename PathType>
struct arc_to
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
#endif
struct result
{
typedef void type;

View file

@ -27,7 +27,11 @@
#include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/gradient.hpp>
#include <mapnik/box2d.hpp>
#if defined(GRID_RENDERER)
#include <mapnik/grid/grid_pixel.hpp>
#endif
#include <mapnik/noncopyable.hpp>
// boost
@ -52,7 +56,6 @@
#include "agg_gradient_lut.h"
#include "agg_gamma_lut.h"
#include "agg_span_interpolator_linear.h"
#include "agg_pixfmt_rgba.h"
namespace mapnik {
namespace svg {
@ -335,14 +338,15 @@ public:
}
}
#if defined(GRID_RENDERER)
template <typename Rasterizer, typename Scanline, typename Renderer>
void render_id(Rasterizer& ras,
Scanline& sl,
Renderer& ren,
int feature_id,
agg::trans_affine const& mtx,
double opacity,
box2d<double> const& symbol_bbox)
double /*opacity*/,
box2d<double> const& /*symbol_bbox*/)
{
using namespace agg;
@ -417,6 +421,7 @@ public:
}
}
}
#endif
private:

View file

@ -50,7 +50,11 @@ namespace mapnik { namespace svg {
template <typename TransformType>
struct process_matrix
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
#endif
struct result
{
typedef void type;
@ -70,7 +74,11 @@ namespace mapnik { namespace svg {
template <typename TransformType>
struct process_rotate
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1, typename T2>
#endif
struct result
{
typedef void type;
@ -101,7 +109,11 @@ namespace mapnik { namespace svg {
template <typename TransformType>
struct process_translate
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef void type;
@ -123,7 +135,11 @@ namespace mapnik { namespace svg {
template <typename TransformType>
struct process_scale
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef void type;
@ -146,7 +162,11 @@ namespace mapnik { namespace svg {
template <typename TransformType>
struct process_skew
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T0>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef void type;

View file

@ -34,10 +34,9 @@ namespace mapnik {
struct symbolizer_hash
{
template <typename T>
static std::size_t value(T const& sym)
static std::size_t value(T const& /*sym*/)
{
std::size_t seed = 0;
return seed;
return 0;
}
// specialisation for polygon_symbolizer
static std::size_t value(polygon_symbolizer const& sym)

View file

@ -2,7 +2,7 @@
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
* Copyright (C) 2013 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -86,7 +86,7 @@ static toff_t tiff_seek_proc(thandle_t fd, toff_t off, int whence)
// grow std::stringstream buffer (re: libtiff/tif_stream.cxx)
std::ios::pos_type pos = out->tellp();
// second check needed for clang (libcxx doesn't set failbit when seeking beyond the current buffer size
if( out->fail() || off != pos)
if( out->fail() || static_cast<std::streamoff>(off) != pos)
{
std::ios::iostate old_state;
std::ios::pos_type origin;
@ -146,16 +146,16 @@ static toff_t tiff_size_proc(thandle_t fd)
return (toff_t)len;
}
static tsize_t tiff_dummy_read_proc(thandle_t fd, tdata_t buf, tsize_t size)
static tsize_t tiff_dummy_read_proc(thandle_t , tdata_t , tsize_t)
{
return 0;
}
static void tiff_dummy_unmap_proc(thandle_t fd, tdata_t base, toff_t size)
static void tiff_dummy_unmap_proc(thandle_t , tdata_t , toff_t)
{
}
static int tiff_dummy_map_proc(thandle_t fd, tdata_t* pbase, toff_t* psize)
static int tiff_dummy_map_proc(thandle_t , tdata_t*, toff_t* )
{
return 0;
}
@ -193,17 +193,16 @@ void save_as_tiff(T1 & file, T2 const& image)
// TODO - handle palette images
// std::vector<mapnik::rgb> const& palette
/*
unsigned short r[256], g[256], b[256];
for (int i = 0; i < (1 << 24); ++i)
{
r[i] = (unsigned short)palette[i * 3 + 0] << 8;
g[i] = (unsigned short)palette[i * 3 + 1] << 8;
b[i] = (unsigned short)palette[i * 3 + 2] << 8;
}
TIFFSetField(output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
TIFFSetField(output, TIFFTAG_COLORMAP, r, g, b);
*/
// unsigned short r[256], g[256], b[256];
// for (int i = 0; i < (1 << 24); ++i)
// {
// r[i] = (unsigned short)palette[i * 3 + 0] << 8;
// g[i] = (unsigned short)palette[i * 3 + 1] << 8;
// b[i] = (unsigned short)palette[i * 3 + 2] << 8;
// }
// TIFFSetField(output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
// TIFFSetField(output, TIFFTAG_COLORMAP, r, g, b);
#ifdef HAVE_GEOTIFF
GTIF* geotiff = GTIFNew(output);

View file

@ -55,7 +55,7 @@ template <>
struct end_container<mapnik::geometry_type const>
{
static mapnik::util::path_iterator<mapnik::geometry_type>
call (mapnik::geometry_type const& g)
call (mapnik::geometry_type const& /*g*/)
{
return mapnik::util::path_iterator<mapnik::geometry_type>();
}

View file

@ -23,6 +23,7 @@
#ifndef MAPNIK_GEOMETRY_SVG_GENERATOR_HPP
#define MAPNIK_GEOMETRY_SVG_GENERATOR_HPP
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/geometry.hpp> // for container stuff
@ -41,8 +42,6 @@
#include <boost/fusion/include/boost_tuple.hpp>
#include <boost/type_traits/remove_pointer.hpp>
//#define BOOST_SPIRIT_USE_PHOENIX_V3 1
/*!
* adapted to conform to the concepts
* required by Karma to be recognized as a container of
@ -76,7 +75,7 @@ template <>
struct end_container<path_type const>
{
static mapnik::util::path_iterator<path_type>
call (path_type const& g)
call (path_type const& /*g*/)
{
return mapnik::util::path_iterator<path_type>();
}
@ -92,6 +91,31 @@ namespace mapnik { namespace util {
namespace svg_detail {
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename Geometry>
struct get_type
{
typedef int result_type;
result_type operator() (Geometry const& geom) const
{
return static_cast<int>(geom.type());
}
};
template <typename T>
struct get_first
{
typedef T geometry_type;
typedef typename geometry_type::value_type const result_type;
result_type operator() (geometry_type const& geom) const
{
typename geometry_type::value_type coord;
geom.rewind(0);
boost::get<0>(coord) = geom.vertex(&boost::get<1>(coord),&boost::get<2>(coord));
return coord;
}
};
#else
template <typename Geometry>
struct get_type
{
@ -112,7 +136,7 @@ namespace mapnik { namespace util {
template <typename U>
struct result { typedef typename geometry_type::value_type const type; };
typename geometry_type::value_type const operator() (geometry_type const& geom) const
typename geometry_type::value_type operator() (geometry_type const& geom) const
{
typename geometry_type::value_type coord;
geom.rewind(0);
@ -121,6 +145,7 @@ namespace mapnik { namespace util {
}
};
#endif
template <typename T>
struct coordinate_policy : karma::real_policies<T>
{
@ -169,7 +194,7 @@ namespace mapnik { namespace util {
;
svg_path %= ((&uint_(mapnik::SEG_MOVETO) << lit('M')
| &uint_(mapnik::SEG_LINETO) [_a +=1] << karma::string [if_(_a == 1) [_1 = "L" ] ])
| &uint_(mapnik::SEG_LINETO) [_a +=1] << karma::string [if_(_a == 1) [_1 = "L" ].else_[_1 =""]])
<< lit(' ') << coordinate << lit(' ') << coordinate) % lit(' ')
;

View file

@ -40,7 +40,6 @@
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/math/special_functions/trunc.hpp> // trunc to avoid needing C++11
//#define BOOST_SPIRIT_USE_PHOENIX_V3 1
namespace boost { namespace spirit { namespace traits {

View file

@ -27,11 +27,8 @@
namespace mapnik {
static inline void rgb2hsl(unsigned char red, unsigned char green, unsigned char blue,
double & h, double & s, double & l) {
double r = red/255.0;
double g = green/255.0;
double b = blue/255.0;
inline void rgb2hsl(double r, double g, double b,
double & h, double & s, double & l) {
double max = std::max(r,std::max(g,b));
double min = std::min(r,std::min(g,b));
double delta = max - min;
@ -46,25 +43,30 @@ static inline void rgb2hsl(unsigned char red, unsigned char green, unsigned char
}
}
static inline double hueToRGB(double m1, double m2, double h) {
if(h < 0) h += 1;
if(h > 1) h -= 1;
if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
if (h * 2 < 1) return m2;
if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
// http://www.w3.org/TR/css3-color/#hsl-color
inline double hue_to_rgb(double m1, double m2, double h)
{
if (h < 0.0) h = h + 1.0;
else if (h > 1.0) h = h - 1.0;
if (h * 6 < 1.0)
return m1 + (m2 - m1) * h * 6.0;
if (h * 2 < 1.0)
return m2;
if (h * 3 < 2.0)
return m1 + (m2 - m1)* (2.0/3.0 - h) * 6.0;
return m1;
}
static inline void hsl2rgb(double h, double s, double l,
unsigned char & r, unsigned char & g, unsigned char & b) {
inline void hsl2rgb(double h, double s, double l,
double & r, double & g, double & b) {
if (!s) {
r = g = b = static_cast<unsigned char>(std::floor((l * 255.0)+.5));
r = g = b = l;
}
double m2 = (l <= 0.5) ? l * (s + 1) : l + s - l * s;
double m1 = l * 2 - m2;
r = static_cast<unsigned char>(std::floor((hueToRGB(m1, m2, h + 0.33333) * 255.0)+.5));
g = static_cast<unsigned char>(std::floor((hueToRGB(m1, m2, h) * 255.0)+.5));
b = static_cast<unsigned char>(std::floor((hueToRGB(m1, m2, h - 0.33333) * 255.0)+.5));
double m2 = (l <= 0.5) ? l * (s + 1.0) : l + s - l * s;
double m1 = l * 2.0 - m2;
r = hue_to_rgb(m1, m2, h + 1.0/3.0);
g = hue_to_rgb(m1, m2, h);
b = hue_to_rgb(m1, m2, h - 1.0/3.0);
}
}

View file

@ -122,7 +122,7 @@ struct equals
}
template <typename T, typename U>
bool operator() (T const& lhs, U const& rhs) const
bool operator() (T const& /*lhs*/, U const& /*rhs*/) const
{
return false;
}
@ -182,7 +182,7 @@ struct not_equals
// back compatibility shim to equate empty string with null for != test
// https://github.com/mapnik/mapnik/issues/1859
// TODO - consider removing entire specialization at Mapnik 3.x
bool operator() (value_null lhs,value_unicode_string const& rhs) const
bool operator() (value_null /*lhs*/, value_unicode_string const& rhs) const
{
if (rhs.isEmpty()) return false;
return true;

View file

@ -47,12 +47,12 @@ typedef bool value_bool;
struct value_null
{
bool operator==(value_null const& other) const
bool operator==(value_null const& /*other*/) const
{
return true;
}
bool operator!=(value_null const& other) const
bool operator!=(value_null const& /*other*/) const
{
return false;
}
@ -88,11 +88,11 @@ struct value_null
}
};
inline std::size_t hash_value(const value_null& val) {
inline std::size_t hash_value(const value_null& /*val*/) {
return 0;
}
inline std::ostream& operator<< (std::ostream & out,value_null const& v)
inline std::ostream& operator<< (std::ostream & out,value_null const& /*v*/)
{
return out;
}

View file

@ -64,6 +64,9 @@
#include "agg_conv_clipper.h"
#include "agg_path_storage.h"
// stl
#include <stdexcept>
namespace mapnik {
struct transform_tag {};
@ -86,9 +89,9 @@ struct converter_traits
typedef T0 geometry_type;
typedef geometry_type conv_type;
template <typename Args>
static void setup(geometry_type & geom, Args const& args)
static void setup(geometry_type & /*geom*/, Args const& /*args*/)
{
throw "BOOM!";
throw std::runtime_error("invalid call to setup");
}
};
@ -216,7 +219,7 @@ struct converter_traits<T,mapnik::close_poly_tag>
typedef T geometry_type;
typedef typename agg::conv_close_polygon<geometry_type> conv_type;
template <typename Args>
static void setup(geometry_type & geom, Args const& args)
static void setup(geometry_type & /*geom*/, Args const& /*args*/)
{
// no-op
}
@ -291,7 +294,7 @@ template <>
struct converter_fwd<true>
{
template <typename Base, typename T0,typename T1,typename T2, typename Iter,typename End>
static void forward(Base& base, T0 & geom,T1 const& args)
static void forward(Base& base, T0 & geom,T1 const& /*args*/)
{
base.template dispatch<Iter,End>(geom, typename boost::is_same<Iter,End>::type());
}

View file

@ -40,12 +40,15 @@
namespace mapnik { namespace wkt {
using namespace boost::spirit;
using namespace boost::fusion;
using namespace boost::phoenix;
struct push_vertex
{
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T>
#else
template <typename T0,typename T1, typename T2, typename T3>
#endif
struct result
{
typedef void type;

View file

@ -44,7 +44,7 @@ namespace mapnik { namespace detail {
template <typename T>
struct do_xml_attribute_cast
{
static inline boost::optional<T> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
static inline boost::optional<T> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& /*source*/)
{
std::string err_msg = (boost::format("No conversion from std::string to %s") % typeid(T).name()).str();
throw std::runtime_error(err_msg);
@ -55,7 +55,7 @@ struct do_xml_attribute_cast
template <>
struct do_xml_attribute_cast<mapnik::boolean>
{
static inline boost::optional<mapnik::boolean> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
static inline boost::optional<mapnik::boolean> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
{
bool result;
if (mapnik::util::string2bool(source, result))
@ -68,7 +68,7 @@ struct do_xml_attribute_cast<mapnik::boolean>
template <>
struct do_xml_attribute_cast<int>
{
static inline boost::optional<int> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
static inline boost::optional<int> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
{
int result;
if (mapnik::util::string2int(source, result))
@ -82,7 +82,7 @@ struct do_xml_attribute_cast<int>
template <>
struct do_xml_attribute_cast<long long>
{
static inline boost::optional<long long> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
static inline boost::optional<long long> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
{
int result;
if (mapnik::util::string2int(source, result))
@ -98,7 +98,7 @@ struct do_xml_attribute_cast<long long>
template <>
struct do_xml_attribute_cast<unsigned>
{
static inline boost::optional<unsigned> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
static inline boost::optional<unsigned> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
{
int result;
if (mapnik::util::string2int(source, result))
@ -111,7 +111,7 @@ struct do_xml_attribute_cast<unsigned>
template <>
struct do_xml_attribute_cast<float>
{
static inline boost::optional<float> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
static inline boost::optional<float> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
{
float result;
if (mapnik::util::string2float(source, result))
@ -124,7 +124,7 @@ struct do_xml_attribute_cast<float>
template <>
struct do_xml_attribute_cast<double>
{
static inline boost::optional<double> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
static inline boost::optional<double> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
{
double result;
if (mapnik::util::string2double(source, result))
@ -137,7 +137,7 @@ struct do_xml_attribute_cast<double>
template <typename T, int MAX>
struct do_xml_attribute_cast<mapnik::enumeration<T,MAX> >
{
static inline boost::optional<mapnik::enumeration<T,MAX> > xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
static inline boost::optional<mapnik::enumeration<T,MAX> > xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
{
typedef typename boost::optional<mapnik::enumeration<T,MAX> > result_type;
try
@ -168,7 +168,7 @@ struct do_xml_attribute_cast<mapnik::color>
template <>
struct do_xml_attribute_cast<std::string>
{
static inline boost::optional<std::string> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
static inline boost::optional<std::string> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
{
return boost::optional<std::string>(source);
}

View file

@ -144,7 +144,7 @@ feature_ptr shape_index_featureset<filterT>::next()
return feature_ptr();
}
// FIXME
// FIXME: https://github.com/mapnik/mapnik/issues/1020
feature->set_id(shape_.id_);
if (attr_ids_.size())
{

View file

@ -45,10 +45,9 @@
#include <mapnik/image_compositing.hpp>
#include <mapnik/image_filter.hpp>
#include <mapnik/image_util.hpp>
// agg
#define AGG_RENDERING_BUFFER row_ptr_cache<int8u>
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"
#include "agg_scanline_u.h"
#include "agg_image_filters.h"
#include "agg_trans_bilinear.h"
@ -193,7 +192,7 @@ void agg_renderer<T>::end_map_processing(Map const& )
{
agg::rendering_buffer buf(pixmap_.raw_data(),width_,height_, width_ * 4);
agg::pixfmt_rgba32 pixf(buf);
agg::pixfmt_rgba32_pre pixf(buf);
pixf.demultiply();
MAPNIK_LOG_DEBUG(agg_renderer) << "agg_renderer: End map processing";
}
@ -298,7 +297,6 @@ void agg_renderer<T>::render_marker(pixel_position const& pos,
{
typedef agg::rgba8 color_type;
typedef agg::order_rgba order_type;
typedef agg::pixel32_type pixel_type;
typedef agg::comp_op_adaptor_rgba<color_type, order_type> blender_type; // comp blender
typedef agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer> pixfmt_comp_type;
typedef agg::renderer_base<pixfmt_comp_type> renderer_base;
@ -427,7 +425,7 @@ template <typename T> template <typename R>
void agg_renderer<T>::debug_draw_box(R& buf, box2d<double> const& box,
double x, double y, double angle)
{
typedef agg::pixfmt_rgba32 pixfmt;
typedef agg::pixfmt_rgba32_pre pixfmt;
typedef agg::renderer_base<pixfmt> renderer_base;
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_type;

View file

@ -39,6 +39,7 @@
// agg
#include "agg_basics.h"
#include "agg_rendering_buffer.h"
#include "agg_color_rgba.h"
#include "agg_pixfmt_rgba.h"
#include "agg_rasterizer_scanline_aa.h"
#include "agg_scanline_u.h"
@ -54,11 +55,11 @@ void agg_renderer<T>::process(building_symbolizer const& sym,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
typedef agg::renderer_base<agg::pixfmt_rgba32> ren_base;
typedef agg::renderer_base<agg::pixfmt_rgba32_pre> ren_base;
typedef agg::renderer_scanline_aa_solid<ren_base> renderer;
agg::rendering_buffer buf(current_buffer_->raw_data(),current_buffer_->width(),current_buffer_->height(), current_buffer_->width() * 4);
agg::pixfmt_rgba32 pixf(buf);
agg::pixfmt_rgba32_pre pixf(buf);
ren_base renb(pixf);
color const& fill_ = sym.get_fill();
@ -85,7 +86,7 @@ void agg_renderer<T>::process(building_symbolizer const& sym,
height = result.to_double() * scale_factor_;
}
for (unsigned i=0;i<feature.num_geometries();++i)
for (std::size_t i=0;i<feature.num_geometries();++i)
{
geometry_type const& geom = feature.get_geometry(i);
if (geom.size() > 2)

View file

@ -63,7 +63,7 @@ void agg_renderer<T>::process(debug_symbolizer const& sym,
}
else if (mode == DEBUG_SYM_MODE_VERTEX)
{
for (unsigned i=0; i<feature.num_geometries(); ++i)
for (std::size_t i=0; i<feature.num_geometries(); ++i)
{
geometry_type const& geom = feature.get_geometry(i);
double x;

View file

@ -36,8 +36,9 @@
// agg
#include "agg_basics.h"
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"
#include "agg_rendering_buffer.h"
#include "agg_rasterizer_outline.h"
#include "agg_rasterizer_outline_aa.h"
#include "agg_scanline_u.h"
@ -90,7 +91,6 @@ void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
{
typedef agg::rgba8 color;
typedef agg::order_rgba order;
typedef agg::pixel32_type pixel_type;
typedef agg::comp_op_adaptor_rgba_pre<color, order> blender_type;
typedef agg::pattern_filter_bilinear_rgba8 pattern_filter_type;
typedef agg::line_image_pattern<pattern_filter_type> pattern_type;

View file

@ -34,6 +34,7 @@
#include "agg_basics.h"
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"
#include "agg_rasterizer_scanline_aa.h"
#include "agg_scanline_u.h"
#include "agg_renderer_scanline.h"
@ -77,7 +78,6 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
typedef agg::rgba8 color_type;
typedef agg::order_rgba order_type;
typedef agg::pixel32_type pixel_type;
typedef agg::comp_op_adaptor_rgba_pre<color_type, order_type> blender_type; // comp blender
typedef agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer> pixfmt_comp_type;
typedef agg::renderer_base<pixfmt_comp_type> renderer_base;

View file

@ -45,6 +45,7 @@
#include "agg_renderer_scanline.h"
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"
#include "agg_rasterizer_scanline_aa.h"
#include "agg_scanline_u.h"
#include "agg_path_storage.h"
@ -64,7 +65,6 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
{
typedef agg::rgba8 color_type;
typedef agg::order_rgba order_type;
typedef agg::pixel32_type pixel_type;
typedef agg::comp_op_adaptor_rgba_pre<color_type, order_type> blender_type; // comp blender
typedef agg::rendering_buffer buf_type;
typedef agg::pixfmt_custom_blend_rgba<blender_type, buf_type> pixfmt_comp_type;

View file

@ -74,7 +74,7 @@ void agg_renderer<T>::process(point_symbolizer const& sym,
agg::trans_affine recenter_tr = recenter * tr;
box2d<double> label_ext = bbox * recenter_tr * agg::trans_affine_scaling(scale_factor_);
for (unsigned i=0; i<feature.num_geometries(); ++i)
for (std::size_t i=0; i<feature.num_geometries(); ++i)
{
geometry_type const& geom = feature.get_geometry(i);
double x;

View file

@ -40,6 +40,7 @@
#include "agg_basics.h"
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"
#include "agg_rasterizer_scanline_aa.h"
#include "agg_scanline_u.h"
// for polygon_pattern_symbolizer
@ -93,13 +94,12 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
typedef agg::rgba8 color;
typedef agg::order_rgba order;
typedef agg::pixel32_type pixel_type;
typedef agg::comp_op_adaptor_rgba_pre<color, order> blender_type;
typedef agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer> pixfmt_type;
typedef agg::wrap_mode_repeat wrap_x_type;
typedef agg::wrap_mode_repeat wrap_y_type;
typedef agg::image_accessor_wrap<agg::pixfmt_rgba32,
typedef agg::image_accessor_wrap<agg::pixfmt_rgba32_pre,
wrap_x_type,
wrap_y_type> img_source_type;
@ -117,7 +117,7 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
unsigned w=(*pat)->width();
unsigned h=(*pat)->height();
agg::rendering_buffer pattern_rbuf((agg::int8u*)(*pat)->getBytes(),w,h,w*4);
agg::pixfmt_rgba32 pixf_pattern(pattern_rbuf);
agg::pixfmt_rgba32_pre pixf_pattern(pattern_rbuf);
img_source_type img_src(pixf_pattern);
pattern_alignment_e align = sym.get_alignment();

View file

@ -36,6 +36,8 @@
#include "agg_basics.h"
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"
#include "agg_renderer_scanline.h"
#include "agg_rasterizer_scanline_aa.h"
#include "agg_scanline_u.h"
@ -86,7 +88,6 @@ void agg_renderer<T>::process(polygon_symbolizer const& sym,
typedef agg::rgba8 color_type;
typedef agg::order_rgba order_type;
typedef agg::pixel32_type pixel_type;
typedef agg::comp_op_adaptor_rgba_pre<color_type, order_type> blender_type; // comp blender
typedef agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer> pixfmt_comp_type;
typedef agg::renderer_base<pixfmt_comp_type> renderer_base;

View file

@ -95,6 +95,8 @@ if '-DBOOST_REGEX_HAS_ICU' in env['CPPDEFINES']:
if env['RUNTIME_LINK'] == 'static':
if 'icuuc' in env['ICU_LIB_NAME']:
lib_env['LIBS'].append('icudata')
if env['PLATFORM'] == 'Linux':
lib_env['LIBS'].append('dl')
else:
lib_env['LIBS'].insert(0, 'agg')
@ -199,6 +201,7 @@ source = Split(
json/geometry_grammar.cpp
json/geometry_parser.cpp
json/feature_grammar.cpp
json/feature_parser.cpp
json/feature_collection_parser.cpp
json/geojson_generator.cpp
processed_text.cpp
@ -292,21 +295,24 @@ if env['RUNTIME_LINK'] == "static":
source += glob.glob('../deps/agg/src/' + '*.cpp')
# grid backend
source += Split(
"""
grid/grid.cpp
grid/grid_renderer.cpp
grid/process_building_symbolizer.cpp
grid/process_line_pattern_symbolizer.cpp
grid/process_line_symbolizer.cpp
grid/process_markers_symbolizer.cpp
grid/process_point_symbolizer.cpp
grid/process_polygon_pattern_symbolizer.cpp
grid/process_polygon_symbolizer.cpp
grid/process_raster_symbolizer.cpp
grid/process_shield_symbolizer.cpp
grid/process_text_symbolizer.cpp
""")
if env['GRID_RENDERER']:
source += Split(
"""
grid/grid.cpp
grid/grid_renderer.cpp
grid/process_building_symbolizer.cpp
grid/process_line_pattern_symbolizer.cpp
grid/process_line_symbolizer.cpp
grid/process_markers_symbolizer.cpp
grid/process_point_symbolizer.cpp
grid/process_polygon_pattern_symbolizer.cpp
grid/process_polygon_symbolizer.cpp
grid/process_raster_symbolizer.cpp
grid/process_shield_symbolizer.cpp
grid/process_text_symbolizer.cpp
""")
lib_env.Append(CPPDEFINES = '-DGRID_RENDERER')
libmapnik_defines.append('-DGRID_RENDERER')
# https://github.com/mapnik/mapnik/issues/1438
if env['SVG_RENDERER']: # svg backend

View file

@ -354,7 +354,7 @@ void cairo_renderer_base::process(building_symbolizer const& sym,
height = result.to_double() * scale_factor_;
}
for (unsigned i = 0; i < feature.num_geometries(); ++i)
for (std::size_t i = 0; i < feature.num_geometries(); ++i)
{
geometry_type const& geom = feature.get_geometry(i);
@ -673,7 +673,7 @@ void cairo_renderer_base::process(point_symbolizer const& sym,
agg::trans_affine recenter_tr = recenter * tr;
box2d<double> label_ext = bbox * recenter_tr * agg::trans_affine_scaling(scale_factor_);
for (unsigned i = 0; i < feature.num_geometries(); ++i)
for (std::size_t i = 0; i < feature.num_geometries(); ++i)
{
geometry_type const& geom = feature.get_geometry(i);
double x;
@ -760,7 +760,7 @@ void cairo_renderer_base::process(line_pattern_symbolizer const& sym,
pattern.set_filter(CAIRO_FILTER_BILINEAR);
context_.set_line_width(height * scale_factor_);
for (unsigned i = 0; i < feature.num_geometries(); ++i)
for (std::size_t i = 0; i < feature.num_geometries(); ++i)
{
geometry_type & geom = feature.get_geometry(i);
@ -816,8 +816,8 @@ void cairo_renderer_base::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
//typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
//typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
cairo_save_restore guard(context_);
context_.set_operator(sym.comp_op());

View file

@ -1,5 +1,5 @@
#include <mapnik/config_error.hpp>
#include <mapnik/xml_tree.hpp>
#include <mapnik/xml_node.hpp>
#include <mapnik/util/conversions.hpp>
namespace mapnik

View file

@ -133,23 +133,24 @@ static datasource_map ds_map = boost::assign::map_list_of
;
#endif
#ifdef MAPNIK_STATIC_PLUGINS
datasource_ptr create_static_datasource(parameters const& params)
{
datasource_ptr ds;
#ifdef MAPNIK_STATIC_PLUGINS
boost::optional<std::string> type = params.get<std::string>("type");
datasource_map::iterator it = ds_map.find(*type);
if (it != ds_map.end())
{
ds = it->second(params);
}
#endif
return ds;
}
#else
datasource_ptr create_static_datasource(parameters const& /*params*/)
{
return datasource_ptr();
}
#endif
std::vector<std::string> get_static_datasource_names()
{

View file

@ -137,7 +137,7 @@ void logger::use_file(std::string const& filepath)
else
{
std::stringstream s;
s << "cannot redirect log to file " << file_output_;
s << "cannot redirect log to file " << file_name_;
throw std::runtime_error(s.str());
}
}

View file

@ -59,7 +59,7 @@ struct expression_string : boost::static_visitor<void>
str_ += "]";
}
void operator() (geometry_type_attribute const& attr) const
void operator() (geometry_type_attribute const& /*attr*/) const
{
str_ += "[mapnik::geometry_type]";
}

View file

@ -24,8 +24,11 @@
#include <mapnik/feature_style_processor_impl.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/graphics.hpp>
#if defined(GRID_RENDERER)
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid.hpp>
#endif
#if defined(HAVE_CAIRO)
#include <cairo.h>
@ -48,7 +51,10 @@ template class feature_style_processor<cairo_renderer<cairo_surface_ptr> >;
template class feature_style_processor<svg_renderer<std::ostream_iterator<char> > >;
#endif
#if defined(GRID_RENDERER)
template class feature_style_processor<grid_renderer<grid> >;
#endif
template class feature_style_processor<agg_renderer<image_32> >;
}

View file

@ -25,7 +25,11 @@
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/text_properties.hpp>
#include <mapnik/graphics.hpp>
#if defined(GRID_RENDERER)
#include <mapnik/grid/grid.hpp>
#endif
#include <mapnik/text_path.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/font_util.hpp>
@ -686,6 +690,7 @@ void text_renderer<T>::render(pixel_position const& pos)
}
}
#if defined(GRID_RENDERER)
template <typename T>
void text_renderer<T>::render_id(mapnik::value_integer feature_id,
pixel_position const& pos)
@ -715,6 +720,7 @@ void text_renderer<T>::render_id(mapnik::value_integer feature_id,
}
}
}
#endif
#ifdef MAPNIK_THREADSAFE
boost::mutex freetype_engine::mutex_;
@ -729,6 +735,7 @@ template text_renderer<image_32>::text_renderer(image_32&,
double);
template box2d<double>text_renderer<image_32>::prepare_glyphs(text_path const&);
template void text_renderer<image_32>::render(pixel_position const&);
#if defined(GRID_RENDERER)
template void text_renderer<grid>::render_id(mapnik::value_integer,
pixel_position const&);
template text_renderer<grid>::text_renderer(grid&,
@ -736,4 +743,5 @@ template text_renderer<grid>::text_renderer(grid&,
halo_rasterizer_e,
composite_mode_e, double);
template box2d<double>text_renderer<grid>::prepare_glyphs(text_path const& );
#endif
}

View file

@ -30,13 +30,15 @@
// boost
#include <boost/property_tree/ptree.hpp>
// stl
#include <stdexcept>
namespace mapnik {
namespace formatting {
void node::to_xml(boost::property_tree::ptree &xml) const
void node::to_xml(boost::property_tree::ptree & /*xml*/) const
{
//TODO: Should this throw a config_error?
MAPNIK_LOG_ERROR(base) << "Trying to write unsupported node type to XML.";
throw std::runtime_error("Trying to write unsupported node type to XML");
}
node_ptr node::from_xml(xml_node const& xml)
@ -62,7 +64,7 @@ node_ptr node::from_xml(xml_node const& xml)
}
}
void node::add_expressions(expression_set &output) const
void node::add_expressions(expression_set & /*output*/) const
{
//Do nothing by default
}

View file

@ -30,6 +30,7 @@
// agg
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"
// boost
#include <boost/scoped_array.hpp>
@ -202,7 +203,7 @@ void image_32::premultiply()
void image_32::demultiply()
{
agg::rendering_buffer buffer(data_.getBytes(),width_,height_,width_ * 4);
agg::pixfmt_rgba32 pixf(buffer);
agg::pixfmt_rgba32_pre pixf(buffer);
pixf.demultiply();
premultiplied_ = false;
}

View file

@ -109,7 +109,7 @@ void grid_renderer<T>::start_map_processing(Map const& m)
}
template <typename T>
void grid_renderer<T>::end_map_processing(Map const& m)
void grid_renderer<T>::end_map_processing(Map const& /*m*/)
{
MAPNIK_LOG_DEBUG(grid_renderer) << "grid_renderer: End map processing";
}
@ -140,7 +140,7 @@ void grid_renderer<T>::end_layer_processing(layer const&)
}
template <typename T>
void grid_renderer<T>::render_marker(mapnik::feature_impl & feature, unsigned int step, pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, double opacity, composite_mode_e comp_op)
void grid_renderer<T>::render_marker(mapnik::feature_impl & feature, unsigned int step, pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, double opacity, composite_mode_e /*comp_op*/)
{
if (marker.is_vector())
{

View file

@ -73,7 +73,7 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
height = result.to_double() * scale_factor_;
}
for (unsigned i=0;i<feature.num_geometries();++i)
for (std::size_t i=0;i<feature.num_geometries();++i)
{
geometry_type & geom = feature.get_geometry(i);
if (geom.size() > 2)

View file

@ -62,7 +62,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
// TODO - actually handle image dimensions
int stroke_width = 2;
for (unsigned i=0;i<feature.num_geometries();++i)
for (std::size_t i=0;i<feature.num_geometries();++i)
{
geometry_type & geom = feature.get_geometry(i);
if (geom.size() > 1)

View file

@ -65,7 +65,6 @@ porting notes -->
// agg
#include "agg_basics.h"
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
#include "agg_rasterizer_scanline_aa.h"
// boost

View file

@ -76,7 +76,7 @@ void grid_renderer<T>::process(point_symbolizer const& sym,
agg::trans_affine recenter_tr = recenter * tr;
box2d<double> label_ext = bbox * recenter_tr * agg::trans_affine_scaling(scale_factor_) ;
for (unsigned i=0; i<feature.num_geometries(); ++i)
for (std::size_t i=0; i<feature.num_geometries(); ++i)
{
geometry_type const& geom = feature.get_geometry(i);
double x;

View file

@ -34,6 +34,7 @@
#include "agg_scanline_u.h"
#include "agg_renderer_scanline.h"
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"
namespace mapnik
{

View file

@ -33,6 +33,7 @@
// agg
#include "agg_image_accessors.h"
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"
#include "agg_rasterizer_scanline_aa.h"
#include "agg_renderer_scanline.h"
#include "agg_rendering_buffer.h"

View file

@ -178,7 +178,7 @@ void jpeg_reader<T>::skip(j_decompress_ptr cinfo, long count)
}
template <typename T>
void jpeg_reader<T>::term (j_decompress_ptr cinfo)
void jpeg_reader<T>::term (j_decompress_ptr /*cinfo*/)
{
// no-op
}
@ -203,15 +203,16 @@ void jpeg_reader<T>::attach_stream (j_decompress_ptr cinfo, input_stream* in)
}
template <typename T>
void jpeg_reader<T>::on_error(j_common_ptr cinfo)
void jpeg_reader<T>::on_error(j_common_ptr /*cinfo*/)
{
throw image_reader_exception("JPEG Reader: libjpeg could not read image");
}
template <typename T>
void jpeg_reader<T>::on_error_message(j_common_ptr cinfo)
{
// used to supress jpeg from printing to stderr
char buffer[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo, buffer);
throw image_reader_exception(std::string("JPEG Reader: libjpeg could not read image: ") + buffer);
}
template <typename T>

View file

@ -23,8 +23,10 @@
// TODO https://github.com/mapnik/mapnik/issues/1658
#include <boost/version.hpp>
#if BOOST_VERSION >= 105200
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#define BOOST_SPIRIT_USE_PHOENIX_V3
#endif
#endif
// mapnik
#include <mapnik/json/feature_collection_parser.hpp>
@ -68,4 +70,3 @@ namespace mapnik { namespace json {
template class feature_collection_parser<boost::spirit::multi_pass<std::istreambuf_iterator<char> > >;
}}

View file

@ -0,0 +1,61 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2013 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#include <boost/version.hpp>
// mapnik
#include <mapnik/json/feature_parser.hpp>
#include <mapnik/json/feature_grammar.hpp>
// boost
#include <boost/version.hpp>
#include <boost/spirit/include/qi.hpp>
namespace mapnik { namespace json {
#if BOOST_VERSION >= 104700
template <typename Iterator>
feature_parser<Iterator>::feature_parser(mapnik::transcoder const& tr)
: grammar_(new feature_grammar<iterator_type,feature_type>(tr)) {}
template <typename Iterator>
feature_parser<Iterator>::~feature_parser() {}
#endif
template <typename Iterator>
bool feature_parser<Iterator>::parse(iterator_type first, iterator_type last, mapnik::feature_impl & f)
{
#if BOOST_VERSION >= 104700
using namespace boost::spirit;
return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(f)), standard_wide::space);
#else
std::ostringstream s;
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
throw std::runtime_error("mapnik::feature_parser::parse() requires at least boost 1.47 while your build was compiled against boost " + s.str());
return false;
#endif
}
template class feature_parser<std::string::const_iterator>;
}}

View file

@ -44,7 +44,6 @@ bool feature_generator::generate(std::string & geojson, mapnik::feature_impl con
return karma::generate(sink, *grammar_,f);
}
geometry_generator::geometry_generator()
: grammar_(new multi_geometry_generator_grammar<sink_type>()) {}

View file

@ -269,8 +269,6 @@ void map_parser::parse_map(Map & map, xml_node const& pt, std::string const& bas
{
throw config_error(std::string("Invalid version string encountered: '")
+ *beg + "' in '" + *min_version_string + "'");
break;
}
if (i==2)
{

View file

@ -42,7 +42,7 @@ struct accumulate_extent
void operator() (feature_ptr feat)
{
for (unsigned i=0;i<feat->num_geometries();++i)
for (std::size_t i=0;i<feat->num_geometries();++i)
{
geometry_type & geom = feat->get_geometry(i);
if ( first_ )

View file

@ -798,7 +798,7 @@ size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void
void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out);
// Output stream interface. The compressor uses this interface to write compressed data. It'll typically be called TDEFL_OUT_BUF_SIZE at a time.
typedef mz_bool (*tdefl_put_buf_func_ptr)(const void* pBuf, int len, void *pUser);
typedef mz_bool (*tdefl_put_buf_func_ptr)(const void* pBuf, size_t len, void *pUser);
// tdefl_compress_mem_to_output() compresses a block to an output stream. The above helpers use this function internally.
mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags);
@ -2704,7 +2704,7 @@ struct tdefl_output_buffer
mz_bool m_expandable;
};
static mz_bool tdefl_output_buffer_putter(const void *pBuf, int len, void *pUser)
static mz_bool tdefl_output_buffer_putter(const void *pBuf, size_t len, void *pUser)
{
tdefl_output_buffer *p = (tdefl_output_buffer *)pUser;
size_t new_size = p->m_size + len;
@ -2778,7 +2778,7 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h,
*pLen_out = out_buf.m_size-41;
{
mz_uint8 pnghdr[41]={0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52,
0,0,(mz_uint8)(w>>8),(mz_uint8)w,0,0,(mz_uint8)(h>>8),(mz_uint8)h,8,"\0\0\04\02\06"[num_chans],0,0,0,0,0,0,0,
0,0,(mz_uint8)(w>>8),(mz_uint8)w,0,0,(mz_uint8)(h>>8),(mz_uint8)h,8, (mz_uint8)"\0\0\04\02\06"[num_chans],0,0,0,0,0,0,0,
(mz_uint8)(*pLen_out>>24),(mz_uint8)(*pLen_out>>16),(mz_uint8)(*pLen_out>>8),(mz_uint8)*pLen_out,0x49,0x44,0x41,0x54};
c=(mz_uint32)mz_crc32(MZ_CRC32_INIT,pnghdr+12,17); for (i=0; i<4; ++i, c<<=8) ((mz_uint8*)(pnghdr+29))[i]=(mz_uint8)(c>>24);
memcpy(out_buf.m_pBuf, pnghdr, 41);
@ -4831,4 +4831,4 @@ void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
*/
*/

View file

@ -28,10 +28,11 @@
// miniz
#define MINIZ_NO_ARCHIVE_APIS
#define MINIZ_NO_STDIO
#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
#include "miniz.c"
extern "C" {
#include "miniz.c"
}
// zlib
#include <zlib.h>
@ -137,12 +138,14 @@ void PNGWriter::finishChunk(size_t start)
{
// Write chunk length at the beginning of the chunk.
size_t payloadLength = buffer->m_size - start - 4 - 4;
writeUInt32BE(buffer->m_pBuf + start, payloadLength);
writeUInt32BE(buffer->m_pBuf + start, static_cast<mz_uint32>(payloadLength));
// Write CRC32 checksum. Don't include the 4-byte length, but /do/ include
// the 4-byte chunk name.
mz_uint32 crc = mz_crc32(MZ_CRC32_INIT, buffer->m_pBuf + start + 4, payloadLength + 4);
mz_uint8 checksum[] = { crc >> 24, crc >> 16, crc >> 8, crc };
mz_uint8 checksum[] = { static_cast<mz_uint8>(crc >> 24),
static_cast<mz_uint8>(crc >> 16),
static_cast<mz_uint8>(crc >> 8),
static_cast<mz_uint8>(crc) };
mz_bool status = tdefl_output_buffer_putter(checksum, 4, buffer);
if (status != MZ_TRUE)
{
@ -362,4 +365,3 @@ template void PNGWriter::writeIDATStripAlpha<image_data_32>(image_data_32 const&
template void PNGWriter::writeIDATStripAlpha<image_view<image_data_32> >(image_view<image_data_32> const& image);
}}

View file

@ -97,8 +97,7 @@ double get_total_distance(T & shape_path)
}
template <typename DetectorT>
placement_finder<DetectorT>::placement_finder(feature_impl const& feature,
text_placement_info const& placement_info,
placement_finder<DetectorT>::placement_finder(text_placement_info const& placement_info,
string_info const& info,
DetectorT & detector,
box2d<double> const& extent)

View file

@ -96,12 +96,12 @@ const bool registered2 = register_image_reader("png", create_png_reader2);
}
void user_error_fn(png_structp png_ptr, png_const_charp error_msg)
void user_error_fn(png_structp /*png_ptr*/, png_const_charp error_msg)
{
throw image_reader_exception(std::string("failed to read invalid png: '") + error_msg + "'");
}
void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg)
void user_warning_fn(png_structp /*png_ptr*/, png_const_charp warning_msg)
{
MAPNIK_LOG_DEBUG(png_reader) << "libpng warning: '" << warning_msg << "'";
}

View file

@ -190,8 +190,7 @@ public:
if (sym.get_colorizer())
{
serialize_raster_colorizer(sym_node, sym.get_colorizer(),
explicit_defaults_);
serialize_raster_colorizer(sym_node, sym.get_colorizer());
}
boost::optional<bool> premultiplied = sym.premultiplied();
@ -352,13 +351,16 @@ public:
}
template <typename Symbolizer>
#ifdef MAPNIK_DEBUG
void operator () ( Symbolizer const& sym)
{
// not-supported
#ifdef MAPNIK_DEBUG
MAPNIK_LOG_WARN(save_map) << typeid(sym).name() << " is not supported";
#endif
}
#else
void operator () ( Symbolizer const& /*sym*/)
{
}
#endif
private:
serialize_symbolizer();
@ -394,16 +396,23 @@ private:
}
void serialize_raster_colorizer(ptree & sym_node,
raster_colorizer_ptr const& colorizer,
bool explicit_defaults)
raster_colorizer_ptr const& colorizer)
{
ptree & col_node = sym_node.push_back(
ptree::value_type("RasterColorizer", ptree() ))->second;
set_attr(col_node, "default-mode", colorizer->get_default_mode());
set_attr(col_node, "default-color", colorizer->get_default_color());
set_attr(col_node, "epsilon", colorizer->get_epsilon());
raster_colorizer dfl;
if (colorizer->get_default_mode() != dfl.get_default_mode() || explicit_defaults_)
{
set_attr(col_node, "default-mode", colorizer->get_default_mode());
}
if (colorizer->get_default_color() != dfl.get_default_color() || explicit_defaults_)
{
set_attr(col_node, "default-color", colorizer->get_default_color());
}
if (colorizer->get_epsilon() != dfl.get_epsilon() || explicit_defaults_)
{
set_attr(col_node, "epsilon", colorizer->get_epsilon());
}
unsigned i;
colorizer_stops const &stops = colorizer->get_stops();
for (i=0; i<stops.size(); i++) {
@ -414,7 +423,6 @@ private:
if (stops[i].get_label()!=std::string(""))
set_attr(stop_node, "label", stops[i].get_label());
}
}
void add_image_attributes(ptree & node, symbolizer_with_image const& sym)
@ -673,22 +681,22 @@ public:
serialize_type( boost::property_tree::ptree & node):
node_(node) {}
void operator () ( mapnik::value_integer val ) const
void operator () ( mapnik::value_integer /*val*/ ) const
{
node_.put("<xmlattr>.type", "int" );
}
void operator () ( mapnik::value_double val ) const
void operator () ( mapnik::value_double /*val*/ ) const
{
node_.put("<xmlattr>.type", "float" );
}
void operator () ( std::string const& val ) const
void operator () ( std::string const& /*val*/ ) const
{
node_.put("<xmlattr>.type", "string" );
}
void operator () ( mapnik::value_null val ) const
void operator () ( mapnik::value_null /*val*/ ) const
{
node_.put("<xmlattr>.type", "string" );
}

View file

@ -30,8 +30,8 @@ namespace mapnik
*/
template <typename T>
void svg_renderer<T>::process(line_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
mapnik::feature_impl & /*feature*/,
proj_transform const& /*prj_trans*/)
{
path_attributes_.set_stroke_color(sym.get_stroke().get_color());
path_attributes_.set_stroke_opacity(sym.get_stroke().get_opacity());

View file

@ -71,7 +71,7 @@ bool svg_renderer<OutputIterator>::process(rule::symbolizers const& syms,
if (process_path)
{
// generate path output for each geometry of the current feature.
for(unsigned i=0; i<feature.num_geometries(); ++i)
for(std::size_t i=0; i<feature.num_geometries(); ++i)
{
geometry_type & geom = feature.get_geometry(i);
if(geom.size() > 0)

View file

@ -29,6 +29,7 @@
#include "agg_ellipse.h"
#include "agg_rounded_rect.h"
#include "agg_span_gradient.h"
#include "agg_color_rgba.h"
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
@ -64,7 +65,6 @@ void parse_linear_gradient(svg_parser & parser,xmlTextReaderPtr reader);
void parse_radial_gradient(svg_parser & parser,xmlTextReaderPtr reader);
bool parse_common_gradient(svg_parser & parser,xmlTextReaderPtr reader);
void parse_gradient_stop(svg_parser & parser,xmlTextReaderPtr reader);
void parse_pattern(svg_parser & parser,xmlTextReaderPtr reader);
void parse_attr(svg_parser & parser,xmlTextReaderPtr reader);
void parse_attr(svg_parser & parser,const xmlChar * name, const xmlChar * value );
@ -1046,11 +1046,6 @@ void parse_linear_gradient(svg_parser & parser, xmlTextReaderPtr reader)
//MAPNIK_LOG_DEBUG(svg_parser) << "Found Linear Gradient: " << "(" << x1 << " " << y1 << "),(" << x2 << " " << y2 << ")";
}
void parse_pattern(svg_parser & parser, xmlTextReaderPtr reader)
{
//const xmlChar *value;
}
svg_parser::svg_parser(svg_converter<svg_path_adapter,
agg::pod_bvector<mapnik::svg::path_attributes> > & path)
: path_(path),

View file

@ -211,8 +211,8 @@ template <typename FaceManagerT, typename DetectorT>
void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_geometries()
{
bool largest_box_only = false;
unsigned num_geom = feature_.num_geometries();
for (unsigned i=0; i<num_geom; ++i)
std::size_t num_geom = feature_.num_geometries();
for (std::size_t i=0; i<num_geom; ++i)
{
geometry_type const& geom = feature_.get_geometry(i);
@ -330,7 +330,7 @@ bool text_symbolizer_helper<FaceManagerT, DetectorT>::next_placement()
angle_ = 0.0;
}
finder_.reset(new placement_finder<DetectorT>(feature_, *placement_,
finder_.reset(new placement_finder<DetectorT>(*placement_,
text_.get_string_info(),
detector_, dims_));
placement_valid_ = true;

View file

@ -61,7 +61,7 @@ static toff_t tiff_seek_proc(thandle_t fd, toff_t off, int whence)
return static_cast<toff_t>(in->tellg());
}
static int tiff_close_proc(thandle_t fd)
static int tiff_close_proc(thandle_t /*fd*/)
{
return 0;
}
@ -86,16 +86,16 @@ static tsize_t tiff_read_proc(thandle_t fd, tdata_t buf, tsize_t size)
return static_cast<tsize_t>(in->gcount());
}
static tsize_t tiff_write_proc(thandle_t fd, tdata_t buf, tsize_t size)
static tsize_t tiff_write_proc(thandle_t /*fd*/, tdata_t /*buf*/, tsize_t /*size*/)
{
return 0;
}
static void tiff_unmap_proc(thandle_t fd, tdata_t base, toff_t size)
static void tiff_unmap_proc(thandle_t /*fd*/, tdata_t /*base*/, toff_t /*size*/)
{
}
static int tiff_map_proc(thandle_t fd, tdata_t* pbase, toff_t* psize)
static int tiff_map_proc(thandle_t /*fd*/, tdata_t* /*pbase*/, toff_t* /*psize*/)
{
return 0;
}

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