mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
Merge branch 'master' into custom-variant-2
Conflicts: include/mapnik/value.hpp
This commit is contained in:
commit
e315922b70
19
.travis.yml
19
.travis.yml
@ -4,6 +4,11 @@ compiler:
|
||||
- clang
|
||||
# - gcc
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- DEBUG=True ENABLE_LOG=True DEFAULT_LOG_SEVERITY=debug XMLPARSER="libxml2" DEMO=False BENCHMARK=False CUSTOM_CXXFLAGS="" CUSTOM_LDFLAGS=""
|
||||
- DEBUG=False ENABLE_LOG=False DEFAULT_LOG_SEVERITY=none XMLPARSER="ptree" DEMO=False BENCHMARK=False CUSTOM_CXXFLAGS="-flto" CUSTOM_LDFLAGS="-flto"
|
||||
|
||||
addons:
|
||||
postgresql: "9.3"
|
||||
|
||||
@ -37,7 +42,7 @@ before_install:
|
||||
|
||||
install:
|
||||
- export RANLIB=/bin/true
|
||||
- ./configure CXX="${CXX}" CC="${CC}" CUSTOM_CXXFLAGS="-flto" CUSTOM_LDFLAGS="-flto" DEMO=True BENCHMARK=True CPP_TESTS=True CAIRO=True FAST=True || cat config.log
|
||||
- ./configure CXX="${CXX}" CC="${CC}" CUSTOM_CXXFLAGS="${CUSTOM_CXXFLAGS}" CUSTOM_LDFLAGS="${CUSTOM_LDFLAGS}" XML_PARSER=${XML_PARSER} ENABLE_LOG=${ENABLE_LOG} DEBUG=${DEBUG} DEMO=${DEMO} BENCHMARK=${BENCHMARK} CPP_TESTS=True CAIRO=True FAST=True || cat config.log
|
||||
# workaround ar bug: https://sourceware.org/bugzilla/show_bug.cgi?id=13256
|
||||
- echo 'ar "$@" --plugin /usr/lib/LLVMgold.so' > ar-lto && chmod +x ./ar-lto && export AR=$(pwd)/ar-lto
|
||||
- if [[ "${CXX}" == 'g++-4.8' ]]; then JOBS=2 make; else JOBS=6 make; fi;
|
||||
@ -46,10 +51,8 @@ before_script:
|
||||
- make test
|
||||
|
||||
script:
|
||||
- make bench
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
channels:
|
||||
- "irc.freenode.org#mapnik"
|
||||
use_notice: true
|
||||
- if [[ ${BENCHMARK} != False ]]; then make bench; fi;
|
||||
# install some exotic fonts to ensure we don't crash registering them
|
||||
- sudo apt-get install ttf-wqy-microhei
|
||||
- source localize.sh
|
||||
- python -c "import mapnik;mapnik.logger.set_severity(mapnik.severity_type.Debug);mapnik.register_fonts('/usr/share/fonts/');mapnik.register_fonts('/usr/share/fonts/');print '\n'.join(list(mapnik.FontEngine.instance().face_names()))"
|
||||
|
||||
@ -1785,7 +1785,7 @@ if not preconfigured:
|
||||
else:
|
||||
# TODO - add back -fvisibility-inlines-hidden
|
||||
# https://github.com/mapnik/mapnik/issues/1863
|
||||
env.Append(CXXFLAGS = common_cxx_flags + '-O%s -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts' % (env['OPTIMIZATION']))
|
||||
env.Append(CXXFLAGS = common_cxx_flags + '-O%s -fno-strict-aliasing -Wno-inline -Wno-parentheses -Wno-char-subscripts' % (env['OPTIMIZATION']))
|
||||
if env['DEBUG_UNDEFINED']:
|
||||
env.Append(CXXFLAGS = '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv -fwrapv')
|
||||
|
||||
|
||||
@ -241,7 +241,7 @@ void render3(mapnik::Map const& map,
|
||||
{
|
||||
python_unblock_auto_block b;
|
||||
mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer());
|
||||
mapnik::cairo_renderer<mapnik::cairo_surface_ptr> ren(map,surface,scale_factor,offset_x,offset_y);
|
||||
mapnik::cairo_renderer<mapnik::cairo_ptr> ren(map,mapnik::create_context(surface),scale_factor,offset_x,offset_y);
|
||||
ren.apply();
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ void render4(mapnik::Map const& map, PycairoSurface* py_surface)
|
||||
{
|
||||
python_unblock_auto_block b;
|
||||
mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer());
|
||||
mapnik::cairo_renderer<mapnik::cairo_surface_ptr> ren(map,surface);
|
||||
mapnik::cairo_renderer<mapnik::cairo_ptr> ren(map,mapnik::create_context(surface));
|
||||
ren.apply();
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ void render_with_detector4(
|
||||
{
|
||||
python_unblock_auto_block b;
|
||||
mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer());
|
||||
mapnik::cairo_renderer<mapnik::cairo_surface_ptr> ren(map, surface, detector);
|
||||
mapnik::cairo_renderer<mapnik::cairo_ptr> ren(map, mapnik::create_context(surface), detector);
|
||||
ren.apply();
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ void render_with_detector5(
|
||||
{
|
||||
python_unblock_auto_block b;
|
||||
mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer());
|
||||
mapnik::cairo_renderer<mapnik::cairo_surface_ptr> ren(map, surface, detector, scale_factor, offset_x, offset_y);
|
||||
mapnik::cairo_renderer<mapnik::cairo_ptr> ren(map, mapnik::create_context(surface), detector, scale_factor, offset_x, offset_y);
|
||||
ren.apply();
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/value.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/attribute.hpp>
|
||||
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@ namespace mapnik {
|
||||
class marker;
|
||||
class proj_transform;
|
||||
struct rasterizer;
|
||||
class image_32;
|
||||
}
|
||||
|
||||
namespace mapnik {
|
||||
@ -165,6 +166,8 @@ private:
|
||||
void setup(Map const& m);
|
||||
};
|
||||
|
||||
extern template class MAPNIK_DECL agg_renderer<image_32>;
|
||||
|
||||
} // namespace mapnik
|
||||
|
||||
#endif // MAPNIK_AGG_RENDERER_HPP
|
||||
|
||||
@ -56,7 +56,7 @@ struct expression_attributes : boost::static_visitor<void>
|
||||
|
||||
void operator() (attribute const& attr) const
|
||||
{
|
||||
names_.insert(attr.name());
|
||||
names_.emplace(attr.name());
|
||||
}
|
||||
|
||||
template <typename Tag>
|
||||
@ -289,7 +289,7 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym)
|
||||
{
|
||||
std::string col_idx_name = col_name;
|
||||
boost::replace_all(col_idx_name, "%", col_idx_str);
|
||||
names_.insert(col_idx_name);
|
||||
names_.emplace(col_idx_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -298,7 +298,7 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym)
|
||||
{
|
||||
// This is not an indexed column, or we are ignoring indexes.
|
||||
// Insert the name as is.
|
||||
names_.insert(col_name);
|
||||
names_.emplace(col_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,17 +22,22 @@
|
||||
#ifndef MAPNIK_BOOLEAN_HPP
|
||||
#define MAPNIK_BOOLEAN_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
|
||||
// std
|
||||
#include <istream>
|
||||
#include <iosfwd>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
//#include <istream>
|
||||
//#include <ostream>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
// Helper for class bool
|
||||
class boolean_type {
|
||||
class MAPNIK_DECL boolean_type
|
||||
{
|
||||
public:
|
||||
boolean_type()
|
||||
: b_(false) {}
|
||||
@ -63,25 +68,12 @@ template <typename charT, typename traits>
|
||||
std::basic_istream<charT, traits> &
|
||||
operator >> ( std::basic_istream<charT, traits> & s, boolean_type & b )
|
||||
{
|
||||
std::string word;
|
||||
s >> word;
|
||||
std::transform(word.begin(), word.end(), word.begin(), ::tolower);
|
||||
if ( s )
|
||||
{
|
||||
if ( word == "true" || word == "yes" || word == "on" ||
|
||||
word == "1")
|
||||
{
|
||||
b = true;
|
||||
}
|
||||
else if ( word == "false" || word == "no" || word == "off" ||
|
||||
word == "0")
|
||||
{
|
||||
b = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
s.setstate( std::ios::failbit );
|
||||
}
|
||||
std::string word;
|
||||
s >> word;
|
||||
bool result;
|
||||
if (util::string2bool(word,result)) b = result;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
49
include/mapnik/cairo/cairo_render_vector.hpp
Normal file
49
include/mapnik/cairo/cairo_render_vector.hpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
#ifndef MAPNIK_CAIRO_RENDER_VECTOR_HPP
|
||||
#define MAPNIK_CAIRO_RENDER_VECTOR_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||
|
||||
namespace agg { struct trans_affine; }
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
class cairo_context;
|
||||
struct pixel_position;
|
||||
template <typename T> class box2d;
|
||||
namespace svg { struct path_attributes; }
|
||||
|
||||
void render_vector_marker(cairo_context & context, pixel_position const& pos,
|
||||
svg::svg_path_adapter & svg_path, box2d<double> const& bbox,
|
||||
agg::pod_bvector<svg::path_attributes> const & attributes,
|
||||
agg::trans_affine const& tr, double opacity, bool recenter);
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_CAIRO_RENDER_VECTOR_HPP
|
||||
|
||||
#endif
|
||||
@ -28,19 +28,13 @@
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/feature_style_processor.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include <mapnik/label_collision_detector.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/request.hpp>
|
||||
#include <mapnik/rule.hpp> // for all symbolizers
|
||||
#include <mapnik/noncopyable.hpp>
|
||||
#include <mapnik/rule.hpp> // for all symbolizers
|
||||
#include <mapnik/cairo/cairo_context.hpp>
|
||||
#include <mapnik/pixel_position.hpp>
|
||||
#include <mapnik/ctrans.hpp> // for CoordTransform
|
||||
#include <mapnik/renderer_common.hpp>
|
||||
|
||||
// cairo
|
||||
#include <cairo.h>
|
||||
// stl
|
||||
#include <memory>
|
||||
|
||||
namespace agg {
|
||||
struct trans_affine;
|
||||
@ -48,34 +42,57 @@ struct trans_affine;
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
class Map;
|
||||
class feature_impl;
|
||||
class feature_type_style;
|
||||
class label_collision_detector4;
|
||||
class layer;
|
||||
class marker;
|
||||
|
||||
class MAPNIK_DECL cairo_renderer_base : private mapnik::noncopyable
|
||||
class proj_transform;
|
||||
class request;
|
||||
struct pixel_position;
|
||||
struct cairo_save_restore
|
||||
{
|
||||
cairo_save_restore(cairo_context & context)
|
||||
: context_(context)
|
||||
{
|
||||
context_.save();
|
||||
}
|
||||
~cairo_save_restore()
|
||||
{
|
||||
context_.restore();
|
||||
}
|
||||
cairo_context & context_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class MAPNIK_DECL cairo_renderer : public feature_style_processor<cairo_renderer<T> >,
|
||||
private mapnik::noncopyable
|
||||
{
|
||||
protected:
|
||||
cairo_renderer_base(Map const& m,
|
||||
cairo_ptr const& cairo,
|
||||
attributes const& vars,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer_base(Map const& m,
|
||||
request const& req,
|
||||
cairo_ptr const& cairo,
|
||||
attributes const& vars,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer_base(Map const& m,
|
||||
cairo_ptr const& cairo,
|
||||
attributes const& vars,
|
||||
std::shared_ptr<label_collision_detector4> detector,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
public:
|
||||
~cairo_renderer_base();
|
||||
using processor_impl_type = cairo_renderer<T>;
|
||||
cairo_renderer(Map const& m,
|
||||
T const& obj,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m,
|
||||
request const& req,
|
||||
attributes const& vars,
|
||||
T const& obj,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m,
|
||||
T const& obj,
|
||||
std::shared_ptr<label_collision_detector4> detector,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
|
||||
~cairo_renderer();
|
||||
void start_map_processing(Map const& map);
|
||||
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);
|
||||
@ -155,34 +172,11 @@ protected:
|
||||
renderer_common common_;
|
||||
cairo_face_manager face_manager_;
|
||||
void setup(Map const& m);
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class MAPNIK_DECL cairo_renderer : public feature_style_processor<cairo_renderer<T> >,
|
||||
public cairo_renderer_base
|
||||
{
|
||||
public:
|
||||
using processor_impl_type = cairo_renderer_base;
|
||||
cairo_renderer(Map const& m,
|
||||
T const& obj,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m,
|
||||
request const& req,
|
||||
attributes const& vars,
|
||||
T const& obj,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m,
|
||||
T const& obj,
|
||||
std::shared_ptr<label_collision_detector4> detector,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
void end_map_processing(Map const& map);
|
||||
};
|
||||
extern template class MAPNIK_DECL cairo_renderer<cairo_ptr>;
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_CAIRO_RENDERER_HPP
|
||||
|
||||
@ -58,6 +58,9 @@ private:
|
||||
bool registered_;
|
||||
std::set<std::string> plugin_directories_;
|
||||
};
|
||||
|
||||
extern template class MAPNIK_DECL singleton<datasource_cache, CreateStatic>;
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_DATASOURCE_CACHE_HPP
|
||||
|
||||
@ -333,8 +333,8 @@ operator>>(std::istream & is, mapnik::enumeration<ENUM, THE_MAX> & e)
|
||||
*/
|
||||
|
||||
#define IMPLEMENT_ENUM( name, strings ) \
|
||||
template <> const char ** name ::our_strings_ = strings; \
|
||||
template <> std::string name ::our_name_ = #name; \
|
||||
template <> bool name ::our_verified_flag_( name ::verify_mapnik_enum(__FILE__, __LINE__));
|
||||
template <> MAPNIK_DECL const char ** name ::our_strings_ = strings; \
|
||||
template <> MAPNIK_DECL std::string name ::our_name_ = #name; \
|
||||
template <> MAPNIK_DECL bool name ::our_verified_flag_( name ::verify_mapnik_enum(__FILE__, __LINE__));
|
||||
|
||||
#endif // MAPNIK_ENUMERATION_HPP
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include <mapnik/attribute.hpp>
|
||||
#include <mapnik/expression_node.hpp>
|
||||
#include <mapnik/color_factory.hpp>
|
||||
#include <mapnik/noncopyable.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/variant/static_visitor.hpp>
|
||||
|
||||
@ -67,13 +67,13 @@ public:
|
||||
inline size_type push(key_type const& name)
|
||||
{
|
||||
size_type index = mapping_.size();
|
||||
mapping_.insert(std::make_pair(name, index));
|
||||
mapping_.emplace(name, index);
|
||||
return index;
|
||||
}
|
||||
|
||||
inline void add(key_type const& name, size_type index)
|
||||
{
|
||||
mapping_.insert(std::make_pair(name, index));
|
||||
mapping_.emplace(name, index);
|
||||
}
|
||||
|
||||
inline size_type size() const { return mapping_.size(); }
|
||||
|
||||
@ -36,7 +36,7 @@ namespace mapnik
|
||||
* be rendered atomically when the filter attached to
|
||||
* this rule is matched.
|
||||
*/
|
||||
struct group_rule
|
||||
struct MAPNIK_DECL group_rule
|
||||
{
|
||||
using symbolizers = std::vector<symbolizer>;
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
// stl
|
||||
#include <cassert>
|
||||
@ -34,7 +35,7 @@
|
||||
namespace mapnik
|
||||
{
|
||||
template <typename T>
|
||||
class ImageData
|
||||
class MAPNIK_DECL ImageData
|
||||
{
|
||||
public:
|
||||
using pixel_type = T;
|
||||
|
||||
@ -31,8 +31,6 @@
|
||||
// boost
|
||||
#include <boost/variant/static_visitor.hpp>
|
||||
#include <boost/gil/gil_all.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
|
||||
// agg
|
||||
#include "agg_basics.h"
|
||||
@ -176,11 +174,8 @@ void process_channel_impl (Src const& src, Dst & dst, Conv const& k)
|
||||
}
|
||||
|
||||
template <typename Src, typename Dst, typename Conv>
|
||||
void process_channel (Src const& src, Dst & dst, Conv const& k)
|
||||
void process_channel (Src const&, Dst &, Conv const&)
|
||||
{
|
||||
boost::ignore_unused_variable_warning(src);
|
||||
boost::ignore_unused_variable_warning(dst);
|
||||
boost::ignore_unused_variable_warning(k);
|
||||
}
|
||||
|
||||
template <typename Src, typename Dst>
|
||||
|
||||
@ -25,10 +25,8 @@
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <mapnik/graphics.hpp>
|
||||
#endif
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
@ -37,6 +35,7 @@
|
||||
// stl
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
@ -132,44 +131,43 @@ void save_as_jpeg(std::string const& filename,
|
||||
T const& image);
|
||||
#endif
|
||||
|
||||
inline bool is_png (std::string const& filename)
|
||||
inline bool is_png(std::string const& filename)
|
||||
{
|
||||
return boost::algorithm::iends_with(filename,std::string(".png"));
|
||||
}
|
||||
|
||||
inline bool is_jpeg (std::string const& filename)
|
||||
inline bool is_jpeg(std::string const& filename)
|
||||
{
|
||||
return boost::algorithm::iends_with(filename,std::string(".jpg")) ||
|
||||
boost::algorithm::iends_with(filename,std::string(".jpeg"));
|
||||
}
|
||||
|
||||
inline bool is_tiff (std::string const& filename)
|
||||
inline bool is_tiff(std::string const& filename)
|
||||
{
|
||||
return boost::algorithm::iends_with(filename,std::string(".tif")) ||
|
||||
boost::algorithm::iends_with(filename,std::string(".tiff"));
|
||||
}
|
||||
|
||||
inline bool is_pdf (std::string const& filename)
|
||||
inline bool is_pdf(std::string const& filename)
|
||||
{
|
||||
return boost::algorithm::iends_with(filename,std::string(".pdf"));
|
||||
}
|
||||
|
||||
inline bool is_svg (std::string const& filename)
|
||||
inline bool is_svg(std::string const& filename)
|
||||
{
|
||||
return boost::algorithm::iends_with(filename,std::string(".svg"));
|
||||
}
|
||||
|
||||
inline bool is_ps (std::string const& filename)
|
||||
inline bool is_ps(std::string const& filename)
|
||||
{
|
||||
return boost::algorithm::iends_with(filename,std::string(".ps"));
|
||||
}
|
||||
|
||||
inline bool is_webp (std::string const& filename)
|
||||
inline bool is_webp(std::string const& filename)
|
||||
{
|
||||
return boost::algorithm::iends_with(filename,std::string(".webp"));
|
||||
}
|
||||
|
||||
|
||||
inline boost::optional<std::string> type_from_filename(std::string const& filename)
|
||||
|
||||
{
|
||||
@ -193,15 +191,6 @@ inline std::string guess_type( std::string const& filename )
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
double distance(T x0,T y0,T x1,T y1)
|
||||
{
|
||||
double dx = x1-x0;
|
||||
double dy = y1-y0;
|
||||
return std::sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
|
||||
// add 1-px border around image - useful for debugging alignment issues
|
||||
template <typename T>
|
||||
void add_border(T & image)
|
||||
@ -257,53 +246,53 @@ MAPNIK_DECL void save_to_stream(image_32 const& image,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef _MSC_VER
|
||||
template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
extern template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
std::string const&,
|
||||
std::string const&,
|
||||
rgba_palette const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
extern template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
std::string const&,
|
||||
std::string const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
extern template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
std::string const&,
|
||||
rgba_palette const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
extern template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
std::string const&);
|
||||
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
extern template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
std::string const&,
|
||||
std::string const&,
|
||||
rgba_palette const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
extern template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
std::string const&,
|
||||
std::string const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
extern template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
std::string const&,
|
||||
rgba_palette const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
extern template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
std::string const&);
|
||||
|
||||
template MAPNIK_DECL std::string save_to_string<image_data_32>(image_data_32 const&,
|
||||
extern template MAPNIK_DECL std::string save_to_string<image_data_32>(image_data_32 const&,
|
||||
std::string const&);
|
||||
|
||||
template MAPNIK_DECL std::string save_to_string<image_data_32>(image_data_32 const&,
|
||||
extern template MAPNIK_DECL std::string save_to_string<image_data_32>(image_data_32 const&,
|
||||
std::string const&,
|
||||
rgba_palette const&);
|
||||
|
||||
template MAPNIK_DECL std::string save_to_string<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
extern template MAPNIK_DECL std::string save_to_string<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
std::string const&);
|
||||
|
||||
template MAPNIK_DECL std::string save_to_string<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
extern template MAPNIK_DECL std::string save_to_string<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
std::string const&,
|
||||
rgba_palette const&);
|
||||
#ifdef _MSC_VER
|
||||
|
||||
template MAPNIK_DECL void save_to_stream<image_data_32>(
|
||||
image_data_32 const& image,
|
||||
|
||||
@ -28,6 +28,9 @@
|
||||
#include <mapnik/noncopyable.hpp>
|
||||
#include <mapnik/value_types.hpp>
|
||||
|
||||
// icu
|
||||
#include <unicode/unistr.h>
|
||||
|
||||
// stl
|
||||
#include <vector>
|
||||
|
||||
|
||||
@ -387,10 +387,6 @@ private:
|
||||
|
||||
void push_vertex(vertex2d const& v)
|
||||
{
|
||||
#ifdef MAPNIK_LOG
|
||||
MAPNIK_LOG_DEBUG(ctrans) << "offset_converter: " << v;
|
||||
#endif
|
||||
|
||||
vertices_.push_back(v);
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,12 @@
|
||||
#ifndef MAPNIK_RENDERER_COMMON_PROCESS_BUILDING_SYMBOLIZER_HPP
|
||||
#define MAPNIK_RENDERER_COMMON_PROCESS_BUILDING_SYMBOLIZER_HPP
|
||||
|
||||
#include <mapnik/segment.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
template <typename F1, typename F2, typename F3>
|
||||
@ -106,4 +112,4 @@ void render_building_symbolizer(mapnik::feature_impl &feature,
|
||||
|
||||
} // namespace mapnik
|
||||
|
||||
#endif /* MAPNIK_RENDERER_COMMON_PROCESS_BUILDING_SYMBOLIZER_HPP */
|
||||
#endif // MAPNIK_RENDERER_COMMON_PROCESS_BUILDING_SYMBOLIZER_HPP
|
||||
|
||||
@ -23,28 +23,29 @@
|
||||
#ifndef MAPNIK_RENDERER_COMMON_PROCESS_GROUP_SYMBOLIZER_HPP
|
||||
#define MAPNIK_RENDERER_COMMON_PROCESS_GROUP_SYMBOLIZER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/pixel_position.hpp>
|
||||
#include <mapnik/marker_cache.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/feature_factory.hpp>
|
||||
#include <mapnik/renderer_common.hpp>
|
||||
#include <mapnik/label_collision_detector.hpp>
|
||||
#include <mapnik/symbolizer.hpp>
|
||||
#include <mapnik/attribute_collector.hpp>
|
||||
#include <mapnik/group/group_layout.hpp>
|
||||
#include <mapnik/group/group_layout_manager.hpp>
|
||||
#include <mapnik/group/group_rule.hpp>
|
||||
#include <mapnik/group/group_symbolizer_helper.hpp>
|
||||
#include <mapnik/group/group_symbolizer_properties.hpp>
|
||||
#include <mapnik/renderer_common/process_point_symbolizer.hpp>
|
||||
#include <mapnik/text/placements_list.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
#include <mapnik/label_collision_detector.hpp>
|
||||
|
||||
// agg
|
||||
#include <agg_trans_affine.h>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
class proj_transform;
|
||||
struct glyph_info;
|
||||
class text_symbolizer_helper;
|
||||
|
||||
// General:
|
||||
|
||||
@ -268,7 +269,7 @@ void render_group_symbolizer(group_symbolizer const& sym,
|
||||
*(rule->get_filter())).to_bool())
|
||||
{
|
||||
// add matched rule and feature to the list of things to draw
|
||||
matches.push_back(std::make_pair(rule, sub_feature));
|
||||
matches.emplace_back(rule, sub_feature);
|
||||
|
||||
// construct a bounding box around all symbolizers for the matched rule
|
||||
bound_box bounds;
|
||||
@ -345,4 +346,4 @@ void render_group_symbolizer(group_symbolizer const& sym,
|
||||
|
||||
} // namespace mapnik
|
||||
|
||||
#endif /* MAPNIK_RENDERER_COMMON_PROCESS_GROUP_SYMBOLIZER_HPP */
|
||||
#endif // MAPNIK_RENDERER_COMMON_PROCESS_GROUP_SYMBOLIZER_HPP
|
||||
|
||||
@ -27,6 +27,9 @@
|
||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||
#include <mapnik/vertex_converters.hpp>
|
||||
#include <mapnik/marker_helpers.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/mpl/vector.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2013 Artem Pavlenko
|
||||
* Copyright (C) 2014 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -24,8 +24,11 @@
|
||||
#define MAPNIK_RENDERER_COMMON_PROCESS_POINT_SYMBOLIZER_HPP
|
||||
|
||||
#include <mapnik/geom_util.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/marker.hpp>
|
||||
#include <mapnik/marker_cache.hpp>
|
||||
#include <mapnik/label_collision_detector.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
||||
@ -23,6 +23,8 @@
|
||||
#ifndef MAPNIK_RENDERER_COMMON_PROCESS_POLYGON_SYMBOLIZER_HPP
|
||||
#define MAPNIK_RENDERER_COMMON_PROCESS_POLYGON_SYMBOLIZER_HPP
|
||||
|
||||
#include <mapnik/vertex_converters.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
template <typename vertex_converter_type, typename rasterizer_type, typename F>
|
||||
|
||||
@ -25,6 +25,10 @@
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/warp.hpp>
|
||||
#include <mapnik/raster.hpp>
|
||||
#include <mapnik/raster_colorizer.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_rendering_buffer.h"
|
||||
@ -136,4 +140,4 @@ void render_raster_symbolizer(raster_symbolizer const &sym,
|
||||
|
||||
} // namespace mapnik
|
||||
|
||||
#endif /* MAPNIK_RENDERER_COMMON_PROCESS_RASTER_SYMBOLIZER_HPP */
|
||||
#endif // MAPNIK_RENDERER_COMMON_PROCESS_RASTER_SYMBOLIZER_HPP
|
||||
|
||||
@ -31,7 +31,7 @@ namespace mapnik
|
||||
|
||||
using segment_t = std::tuple<double,double,double,double>;
|
||||
|
||||
static bool y_order(segment_t const& first,segment_t const& second)
|
||||
static inline bool y_order(segment_t const& first,segment_t const& second)
|
||||
{
|
||||
double miny0 = std::min(std::get<1>(first), std::get<3>(first));
|
||||
double miny1 = std::min(std::get<1>(second), std::get<3>(second));
|
||||
|
||||
@ -51,7 +51,6 @@
|
||||
#include <functional>
|
||||
// boost
|
||||
#include <boost/variant/variant_fwd.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
namespace agg { struct trans_affine; }
|
||||
|
||||
@ -91,7 +90,7 @@ using dash_array = std::vector<std::pair<double,double> >;
|
||||
class text_placements;
|
||||
using text_placements_ptr = std::shared_ptr<text_placements>;
|
||||
|
||||
struct MAPNIK_DECL symbolizer_base
|
||||
struct MAPNIK_DECL symbolizer_base
|
||||
{
|
||||
using value_type = boost::variant<value_bool,
|
||||
value_integer,
|
||||
@ -163,10 +162,8 @@ struct evaluate_path_wrapper
|
||||
{
|
||||
using result_type = T;
|
||||
template <typename T1, typename T2>
|
||||
result_type operator() (T1 const& expr, T2 const& feature) const
|
||||
result_type operator() (T1 const&, T2 const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(expr);
|
||||
boost::ignore_unused_variable_warning(feature);
|
||||
return result_type();
|
||||
}
|
||||
|
||||
@ -291,9 +288,8 @@ template <typename T>
|
||||
struct enumeration_result<T,false>
|
||||
{
|
||||
using result_type = T;
|
||||
static result_type convert(enumeration_wrapper const& e)
|
||||
static result_type convert(enumeration_wrapper const&)
|
||||
{
|
||||
boost::ignore_unused_variable_warning(e);
|
||||
return result_type();// FAIL
|
||||
}
|
||||
};
|
||||
@ -311,10 +307,7 @@ struct put_impl
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE: we use insert here instead of emplace
|
||||
// because of lacking std::map emplace support in libstdc++
|
||||
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44436
|
||||
sym.properties.insert(std::make_pair(key, enumeration_wrapper(val)));
|
||||
sym.properties.emplace(key, enumeration_wrapper(val));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -331,7 +324,7 @@ struct put_impl<T, false>
|
||||
}
|
||||
else
|
||||
{
|
||||
sym.properties.insert(std::make_pair(key, val));
|
||||
sym.properties.emplace(key, val);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -428,9 +421,8 @@ struct extract_value : public boost::static_visitor<T>
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
auto operator() (T1 const& val) const -> result_type
|
||||
auto operator() (T1 const&) const -> result_type
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return result_type();
|
||||
}
|
||||
|
||||
@ -461,20 +453,20 @@ struct extract_raw_value : public boost::static_visitor<T1>
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void put(symbolizer_base & sym, keys key, T const& val)
|
||||
MAPNIK_DECL void put(symbolizer_base & sym, keys key, T const& val)
|
||||
{
|
||||
constexpr bool enum_ = std::is_enum<T>::value;
|
||||
detail::put_impl<T, enum_ >::apply(sym, key, val);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool has_key(symbolizer_base const& sym, keys key)
|
||||
MAPNIK_DECL bool has_key(symbolizer_base const& sym, keys key)
|
||||
{
|
||||
return (sym.properties.count(key) == 1);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T get(symbolizer_base const& sym, keys key, mapnik::feature_impl const& feature, attributes const& vars, T const& _default_value = T())
|
||||
MAPNIK_DECL T get(symbolizer_base const& sym, keys key, mapnik::feature_impl const& feature, attributes const& vars, T const& _default_value = T())
|
||||
{
|
||||
using const_iterator = symbolizer_base::cont_type::const_iterator;
|
||||
const_iterator itr = sym.properties.find(key);
|
||||
@ -486,7 +478,7 @@ T get(symbolizer_base const& sym, keys key, mapnik::feature_impl const& feature,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
boost::optional<T> get_optional(symbolizer_base const& sym, keys key, mapnik::feature_impl const& feature, attributes const& vars)
|
||||
MAPNIK_DECL boost::optional<T> get_optional(symbolizer_base const& sym, keys key, mapnik::feature_impl const& feature, attributes const& vars)
|
||||
{
|
||||
using const_iterator = symbolizer_base::cont_type::const_iterator;
|
||||
const_iterator itr = sym.properties.find(key);
|
||||
@ -498,7 +490,7 @@ boost::optional<T> get_optional(symbolizer_base const& sym, keys key, mapnik::fe
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T get(symbolizer_base const& sym, keys key, T const& _default_value = T())
|
||||
MAPNIK_DECL T get(symbolizer_base const& sym, keys key, T const& _default_value = T())
|
||||
{
|
||||
using const_iterator = symbolizer_base::cont_type::const_iterator;
|
||||
const_iterator itr = sym.properties.find(key);
|
||||
@ -510,7 +502,7 @@ T get(symbolizer_base const& sym, keys key, T const& _default_value = T())
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
boost::optional<T> get_optional(symbolizer_base const& sym, keys key)
|
||||
MAPNIK_DECL boost::optional<T> get_optional(symbolizer_base const& sym, keys key)
|
||||
{
|
||||
using const_iterator = symbolizer_base::cont_type::const_iterator;
|
||||
const_iterator itr = sym.properties.find(key);
|
||||
@ -528,8 +520,8 @@ constexpr auto to_integral(Enum e) -> typename std::underlying_type<Enum>::type
|
||||
}
|
||||
|
||||
using property_meta_type = std::tuple<const char*, mapnik::symbolizer_base::value_type, std::function<std::string(enumeration_wrapper)>, property_types>;
|
||||
property_meta_type const& get_meta(mapnik::keys key);
|
||||
mapnik::keys get_key(std::string const& name);
|
||||
MAPNIK_DECL property_meta_type const& get_meta(mapnik::keys key);
|
||||
MAPNIK_DECL mapnik::keys get_key(std::string const& name);
|
||||
|
||||
// concrete symbolizer types
|
||||
struct MAPNIK_DECL point_symbolizer : public symbolizer_base {};
|
||||
|
||||
@ -127,9 +127,8 @@ struct symbolizer_name_impl : public boost::static_visitor<std::string>
|
||||
{
|
||||
public:
|
||||
template <typename Symbolizer>
|
||||
std::string operator () (Symbolizer const& sym) const
|
||||
std::string operator () (Symbolizer const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(sym);
|
||||
return symbolizer_traits<Symbolizer>::name();
|
||||
}
|
||||
};
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/text/placements/base.hpp>
|
||||
// boost
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
// mapnik
|
||||
#include <mapnik/pixel_position.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_basics.h"
|
||||
@ -41,7 +42,7 @@ class vertex_cache;
|
||||
using vertex_cache_ptr = std::shared_ptr<vertex_cache>;
|
||||
|
||||
// Caches all path points and their lengths. Allows easy moving in both directions.
|
||||
class vertex_cache
|
||||
class MAPNIK_DECL vertex_cache
|
||||
{
|
||||
struct segment
|
||||
{
|
||||
|
||||
@ -57,9 +57,8 @@ struct transform_processor
|
||||
attribute_collector(Container& names)
|
||||
: collect_(names) {}
|
||||
|
||||
void operator() (identity_node const& node) const
|
||||
void operator() (identity_node const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(node);
|
||||
}
|
||||
|
||||
void operator() (matrix_node const& node) const
|
||||
@ -113,9 +112,8 @@ struct transform_processor
|
||||
vars_(v),
|
||||
scale_factor_(scale_factor) {}
|
||||
|
||||
void operator() (identity_node const& node)
|
||||
void operator() (identity_node const&)
|
||||
{
|
||||
boost::ignore_unused_variable_warning(node);
|
||||
}
|
||||
|
||||
void operator() (matrix_node const& node)
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
// stl
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
|
||||
namespace mapnik { namespace util {
|
||||
|
||||
|
||||
@ -196,13 +196,13 @@ wkb_buffer_ptr to_polygon_wkb( GeometryType const& g, wkbByteOrder byte_order)
|
||||
if (command == SEG_MOVETO)
|
||||
{
|
||||
rings.push_back(new linear_ring); // start new loop
|
||||
rings.back().push_back(std::make_pair(x,y));
|
||||
rings.back().emplace_back(x,y);
|
||||
size += 4; // num_points
|
||||
size += 2 * 8; // point
|
||||
}
|
||||
else if (command == SEG_LINETO)
|
||||
{
|
||||
rings.back().push_back(std::make_pair(x,y));
|
||||
rings.back().emplace_back(x,y);
|
||||
size += 2 * 8; // point
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,12 +29,17 @@
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
#include <mapnik/util/variant.hpp>
|
||||
// boost
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
// stl
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
|
||||
#include <iosfwd>
|
||||
#include <cstddef>
|
||||
#include <new>
|
||||
|
||||
// icu
|
||||
#include <unicode/unistr.h>
|
||||
#include <unicode/ustring.h>
|
||||
@ -114,7 +119,7 @@ struct equals
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
bool operator() (T const& /*lhs*/, U const& /*rhs*/) const
|
||||
bool operator() (T const&, U const&) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -174,9 +179,8 @@ 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, value_unicode_string const& rhs) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
if (rhs.isEmpty()) return false;
|
||||
return true;
|
||||
}
|
||||
@ -349,15 +353,13 @@ struct add : public util::static_visitor<V>
|
||||
return lhs + rhs;
|
||||
}
|
||||
|
||||
value_type operator() (value_unicode_string const& lhs, value_null rhs) const
|
||||
value_type operator() (value_unicode_string const& lhs, value_null) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(rhs);
|
||||
return lhs;
|
||||
}
|
||||
|
||||
value_type operator() (value_null lhs, value_unicode_string const& rhs) const
|
||||
value_type operator() (value_null, value_unicode_string const& rhs) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
return rhs;
|
||||
}
|
||||
|
||||
@ -413,11 +415,9 @@ struct sub : public util::static_visitor<V>
|
||||
return lhs - rhs ;
|
||||
}
|
||||
|
||||
value_type operator() (value_unicode_string const& lhs,
|
||||
value_unicode_string const& rhs) const
|
||||
value_type operator() (value_unicode_string const&,
|
||||
value_unicode_string const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
boost::ignore_unused_variable_warning(rhs);
|
||||
return value_type();
|
||||
}
|
||||
|
||||
@ -452,11 +452,9 @@ struct mult : public util::static_visitor<V>
|
||||
return lhs * rhs;
|
||||
}
|
||||
|
||||
value_type operator() (value_unicode_string const& lhs,
|
||||
value_unicode_string const& rhs) const
|
||||
value_type operator() (value_unicode_string const&,
|
||||
value_unicode_string const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
boost::ignore_unused_variable_warning(rhs);
|
||||
return value_type();
|
||||
}
|
||||
|
||||
@ -470,10 +468,8 @@ struct mult : public util::static_visitor<V>
|
||||
return lhs * rhs;
|
||||
}
|
||||
|
||||
value_type operator() (value_bool lhs, value_bool rhs) const
|
||||
value_type operator() (value_bool, value_bool) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
boost::ignore_unused_variable_warning(rhs);
|
||||
return value_integer(0);
|
||||
}
|
||||
};
|
||||
@ -495,18 +491,14 @@ struct div: public util::static_visitor<V>
|
||||
return lhs / rhs;
|
||||
}
|
||||
|
||||
value_type operator() (value_bool lhs, value_bool rhs) const
|
||||
value_type operator() (value_bool, value_bool) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
boost::ignore_unused_variable_warning(rhs);
|
||||
return false;
|
||||
}
|
||||
|
||||
value_type operator() (value_unicode_string const& lhs,
|
||||
value_unicode_string const& rhs) const
|
||||
value_type operator() (value_unicode_string const&,
|
||||
value_unicode_string const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
boost::ignore_unused_variable_warning(rhs);
|
||||
return value_type();
|
||||
}
|
||||
|
||||
@ -539,19 +531,15 @@ struct mod: public util::static_visitor<V>
|
||||
return lhs % rhs;
|
||||
}
|
||||
|
||||
value_type operator() (value_unicode_string const& lhs,
|
||||
value_unicode_string const& rhs) const
|
||||
value_type operator() (value_unicode_string const&,
|
||||
value_unicode_string const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
boost::ignore_unused_variable_warning(rhs);
|
||||
return value_type();
|
||||
}
|
||||
|
||||
value_type operator() (value_bool lhs,
|
||||
value_bool rhs) const
|
||||
value_type operator() (value_bool,
|
||||
value_bool) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
boost::ignore_unused_variable_warning(rhs);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -592,9 +580,8 @@ struct negate : public util::static_visitor<V>
|
||||
return val ? value_integer(-1) : value_integer(0);
|
||||
}
|
||||
|
||||
value_type operator() (value_unicode_string const& ustr) const
|
||||
value_type operator() (value_unicode_string const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(ustr);
|
||||
return value_type();
|
||||
}
|
||||
};
|
||||
@ -616,9 +603,8 @@ struct convert<value_bool> : public util::static_visitor<value_bool>
|
||||
return !ustr.isEmpty();
|
||||
}
|
||||
|
||||
value_bool operator() (value_null const& val) const
|
||||
value_bool operator() (value_null const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -662,9 +648,8 @@ struct convert<value_double> : public util::static_visitor<value_double>
|
||||
return operator()(utf8);
|
||||
}
|
||||
|
||||
value_double operator() (value_null const& val) const
|
||||
value_double operator() (value_null const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return 0.0;
|
||||
}
|
||||
};
|
||||
@ -702,9 +687,8 @@ struct convert<value_integer> : public util::static_visitor<value_integer>
|
||||
return operator()(utf8);
|
||||
}
|
||||
|
||||
value_integer operator() (value_null const& val) const
|
||||
value_integer operator() (value_null const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return value_integer(0);
|
||||
}
|
||||
};
|
||||
@ -735,9 +719,8 @@ struct convert<std::string> : public util::static_visitor<std::string>
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string operator() (value_null const& val) const
|
||||
std::string operator() (value_null const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return "";
|
||||
}
|
||||
};
|
||||
@ -766,9 +749,8 @@ struct to_unicode : public util::static_visitor<value_unicode_string>
|
||||
return value_unicode_string(str.c_str());
|
||||
}
|
||||
|
||||
value_unicode_string operator() (value_null const& val) const
|
||||
value_unicode_string operator() (value_null const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return value_unicode_string("");
|
||||
}
|
||||
};
|
||||
@ -801,9 +783,8 @@ struct to_expression_string : public util::static_visitor<std::string>
|
||||
return val ? "true":"false";
|
||||
}
|
||||
|
||||
std::string operator() (value_null const& val) const
|
||||
std::string operator() (value_null const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return "null";
|
||||
}
|
||||
};
|
||||
@ -1057,16 +1038,14 @@ struct is_null_visitor : public util::static_visitor<bool>
|
||||
return val.is_null();
|
||||
}
|
||||
|
||||
bool operator() (value_null const& val) const
|
||||
bool operator() (value_null const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator() (T const& val) const
|
||||
bool operator() (T const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@ -23,14 +23,19 @@
|
||||
#ifndef MAPNIK_VALUE_TYPES_HPP
|
||||
#define MAPNIK_VALUE_TYPES_HPP
|
||||
|
||||
// icu
|
||||
#include <unicode/unistr.h> // for UnicodeString
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/concept_check.hpp>
|
||||
// icu
|
||||
#include <unicode/uversion.h> // for U_NAMESPACE_QUALIFIER
|
||||
|
||||
// stl
|
||||
#include <iosfwd> // for ostream
|
||||
#include <iosfwd>
|
||||
#include <cstddef>
|
||||
|
||||
namespace U_ICU_NAMESPACE {
|
||||
class UnicodeString;
|
||||
}
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
@ -45,84 +50,73 @@ using value_double = double;
|
||||
using value_unicode_string = U_NAMESPACE_QUALIFIER UnicodeString;
|
||||
using value_bool = bool;
|
||||
|
||||
struct value_null
|
||||
struct MAPNIK_DECL value_null
|
||||
{
|
||||
bool operator==(value_null const& other) const
|
||||
bool operator==(value_null const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(other);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator==(T const& other) const
|
||||
bool operator==(T const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(other);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator!=(value_null const& other) const
|
||||
bool operator!=(value_null const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(other);
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator!=(T const& other) const
|
||||
bool operator!=(T const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(other);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
value_null operator+ (T const& other) const
|
||||
value_null operator+ (T const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
value_null operator- (T const& other) const
|
||||
value_null operator- (T const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
value_null operator* (T const& other) const
|
||||
value_null operator* (T const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
value_null operator/ (T const& other) const
|
||||
value_null operator/ (T const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
value_null operator% (T const& other) const
|
||||
value_null operator% (T const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(other);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
inline std::size_t hash_value(const value_null& val)
|
||||
inline std::size_t hash_value(value_null const&)
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline std::ostream& operator<< (std::ostream & out,value_null const& v)
|
||||
{
|
||||
boost::ignore_unused_variable_warning(v);
|
||||
template <typename TChar, typename TTraits>
|
||||
inline std::basic_ostream<TChar, TTraits>& operator<<(std::basic_ostream<TChar, TTraits>& out, value_null const& v) {
|
||||
return out;
|
||||
}
|
||||
inline std::istream& operator>> ( std::istream & s, value_null & null )
|
||||
|
||||
inline std::istream& operator>> ( std::istream & s, value_null & )
|
||||
{
|
||||
boost::ignore_unused_variable_warning(null);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,10 @@
|
||||
// webp
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
extern "C"
|
||||
{
|
||||
#include <webp/encode.h>
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// stl
|
||||
|
||||
@ -194,7 +194,7 @@ struct do_xml_attribute_cast<mapnik::expression_ptr>
|
||||
else
|
||||
{
|
||||
mapnik::expression_ptr expr = parse_expression(source);
|
||||
tree.expr_cache_.insert(std::make_pair(source,expr));
|
||||
tree.expr_cache_.emplace(source,expr);
|
||||
return expr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include <mapnik/geom_util.hpp>
|
||||
#include <mapnik/timer.hpp>
|
||||
#include <mapnik/value_types.hpp>
|
||||
#include <mapnik/boolean.hpp>
|
||||
|
||||
#include <gdal_version.h>
|
||||
|
||||
|
||||
@ -684,7 +684,7 @@ processor_context_ptr postgis_datasource::get_context(feature_style_context_map
|
||||
}
|
||||
else
|
||||
{
|
||||
return ctx.insert(std::make_pair(ds_name,std::make_shared<postgis_processor_context>())).first->second;
|
||||
return ctx.emplace(ds_name,std::make_shared<postgis_processor_context>()).first->second;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ python_datasource::python_datasource(parameters const& params)
|
||||
{
|
||||
if((kv.first != "type") && (kv.first != "factory"))
|
||||
{
|
||||
kwargs_.insert(std::make_pair(kv.first, *params.get<std::string>(kv.first)));
|
||||
kwargs_.emplace(kv.first, *params.get<std::string>(kv.first));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
14
src/build.py
14
src/build.py
@ -272,8 +272,20 @@ if env['HAS_CAIRO']:
|
||||
lib_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
|
||||
libmapnik_defines.append('-DHAVE_CAIRO')
|
||||
lib_env.AppendUnique(CPPPATH=copy(env['CAIRO_CPPPATHS']))
|
||||
source.append('cairo/cairo_renderer.cpp')
|
||||
source.append('cairo/cairo_context.cpp')
|
||||
source.append('cairo/cairo_renderer.cpp')
|
||||
source.append('cairo/cairo_render_vector.cpp')
|
||||
source.append('cairo/process_markers_symbolizer.cpp')
|
||||
source.append('cairo/process_text_symbolizer.cpp')
|
||||
source.append('cairo/process_group_symbolizer.cpp')
|
||||
source.append('cairo/process_line_symbolizer.cpp')
|
||||
source.append('cairo/process_line_pattern_symbolizer.cpp')
|
||||
source.append('cairo/process_polygon_symbolizer.cpp')
|
||||
source.append('cairo/process_polygon_pattern_symbolizer.cpp')
|
||||
source.append('cairo/process_debug_symbolizer.cpp')
|
||||
source.append('cairo/process_point_symbolizer.cpp')
|
||||
source.append('cairo/process_raster_symbolizer.cpp')
|
||||
source.append('cairo/process_building_symbolizer.cpp')
|
||||
|
||||
for cpp in enabled_imaging_libraries:
|
||||
source.append(cpp)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2013 Artem Pavlenko
|
||||
* Copyright (C) 2014 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -525,9 +525,8 @@ cairo_face_ptr cairo_face_manager::get_face(face_ptr face)
|
||||
else
|
||||
{
|
||||
entry = std::make_shared<cairo_face>(font_engine_, face);
|
||||
cache_.insert(std::make_pair(face, entry));
|
||||
cache_.emplace(face, entry);
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
131
src/cairo/cairo_render_vector.cpp
Normal file
131
src/cairo/cairo_render_vector.cpp
Normal file
@ -0,0 +1,131 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
#include <mapnik/cairo/cairo_render_vector.hpp>
|
||||
#include <mapnik/cairo/cairo_context.hpp>
|
||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
void render_vector_marker(cairo_context & context, pixel_position const& pos,
|
||||
svg::svg_path_adapter & svg_path, box2d<double> const& bbox,
|
||||
agg::pod_bvector<svg::path_attributes> const & attributes,
|
||||
agg::trans_affine const& tr, double opacity, bool recenter)
|
||||
{
|
||||
using namespace mapnik::svg;
|
||||
agg::trans_affine mtx = tr;
|
||||
if (recenter)
|
||||
{
|
||||
coord<double,2> c = bbox.center();
|
||||
mtx = agg::trans_affine_translation(-c.x,-c.y);
|
||||
mtx *= tr;
|
||||
mtx.translate(pos.x, pos.y);
|
||||
}
|
||||
|
||||
agg::trans_affine transform;
|
||||
|
||||
for(unsigned i = 0; i < attributes.size(); ++i)
|
||||
{
|
||||
mapnik::svg::path_attributes const& attr = attributes[i];
|
||||
if (!attr.visibility_flag)
|
||||
continue;
|
||||
cairo_save_restore guard(context);
|
||||
transform = attr.transform;
|
||||
transform *= mtx;
|
||||
|
||||
// TODO - this 'is_valid' check is not used in the AGG renderer and also
|
||||
// appears to lead to bogus results with
|
||||
// tests/data/good_maps/markers_symbolizer_lines_file.xml
|
||||
//if (transform.is_valid() && !transform.is_identity())
|
||||
if (!transform.is_identity())
|
||||
{
|
||||
double m[6];
|
||||
transform.store_to(m);
|
||||
cairo_matrix_t matrix;
|
||||
cairo_matrix_init(&matrix,m[0],m[1],m[2],m[3],m[4],m[5]);
|
||||
context.transform(matrix);
|
||||
}
|
||||
|
||||
if (attr.fill_flag || attr.fill_gradient.get_gradient_type() != NO_GRADIENT)
|
||||
{
|
||||
context.add_agg_path(svg_path,attr.index);
|
||||
if (attr.even_odd_flag)
|
||||
{
|
||||
context.set_fill_rule(CAIRO_FILL_RULE_EVEN_ODD);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.set_fill_rule(CAIRO_FILL_RULE_WINDING);
|
||||
}
|
||||
if(attr.fill_gradient.get_gradient_type() != NO_GRADIENT)
|
||||
{
|
||||
cairo_gradient g(attr.fill_gradient,attr.fill_opacity * attr.opacity * opacity);
|
||||
|
||||
context.set_gradient(g,bbox);
|
||||
context.fill();
|
||||
}
|
||||
else if(attr.fill_flag)
|
||||
{
|
||||
double fill_opacity = attr.fill_opacity * attr.opacity * opacity * attr.fill_color.opacity();
|
||||
context.set_color(attr.fill_color.r/255.0,attr.fill_color.g/255.0,
|
||||
attr.fill_color.b/255.0, fill_opacity);
|
||||
context.fill();
|
||||
}
|
||||
}
|
||||
|
||||
if (attr.stroke_gradient.get_gradient_type() != NO_GRADIENT || attr.stroke_flag)
|
||||
{
|
||||
context.add_agg_path(svg_path,attr.index);
|
||||
if(attr.stroke_gradient.get_gradient_type() != NO_GRADIENT)
|
||||
{
|
||||
context.set_line_width(attr.stroke_width);
|
||||
context.set_line_cap(line_cap_enum(attr.line_cap));
|
||||
context.set_line_join(line_join_enum(attr.line_join));
|
||||
context.set_miter_limit(attr.miter_limit);
|
||||
cairo_gradient g(attr.stroke_gradient,attr.fill_opacity * attr.opacity * opacity);
|
||||
context.set_gradient(g,bbox);
|
||||
context.stroke();
|
||||
}
|
||||
else if (attr.stroke_flag)
|
||||
{
|
||||
double stroke_opacity = attr.stroke_opacity * attr.opacity * opacity * attr.stroke_color.opacity();
|
||||
context.set_color(attr.stroke_color.r/255.0,attr.stroke_color.g/255.0,
|
||||
attr.stroke_color.b/255.0, stroke_opacity);
|
||||
context.set_line_width(attr.stroke_width);
|
||||
context.set_line_cap(line_cap_enum(attr.line_cap));
|
||||
context.set_line_join(line_join_enum(attr.line_join));
|
||||
context.set_miter_limit(attr.miter_limit);
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
File diff suppressed because it is too large
Load Diff
84
src/cairo/process_building_symbolizer.cpp
Normal file
84
src/cairo/process_building_symbolizer.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/make_unique.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
// mapnik symbolizer generics
|
||||
#include <mapnik/renderer_common/process_building_symbolizer.hpp>
|
||||
|
||||
// stl
|
||||
#include <cmath>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(building_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
using path_type = coord_transform<CoordTransform,geometry_type>;
|
||||
cairo_save_restore guard(context_);
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
||||
mapnik::color fill = get<mapnik::color>(sym, keys::fill, feature, common_.vars_, mapnik::color(128,128,128));
|
||||
double opacity = get<double>(sym, keys::fill_opacity, feature, common_.vars_, 1.0);
|
||||
double height = get<double>(sym, keys::height, feature, common_.vars_, 0.0);
|
||||
|
||||
context_.set_operator(comp_op);
|
||||
|
||||
render_building_symbolizer(
|
||||
feature, height,
|
||||
[&](geometry_type &faces) {
|
||||
path_type faces_path(common_.t_, faces, prj_trans);
|
||||
context_.set_color(fill.red() * 0.8 / 255.0, fill.green() * 0.8 / 255.0,
|
||||
fill.blue() * 0.8 / 255.0, fill.alpha() * opacity / 255.0);
|
||||
context_.add_path(faces_path);
|
||||
context_.fill();
|
||||
},
|
||||
[&](geometry_type &frame) {
|
||||
path_type path(common_.t_, frame, prj_trans);
|
||||
context_.set_color(fill.red() * 0.8 / 255.0, fill.green() * 0.8/255.0,
|
||||
fill.blue() * 0.8 / 255.0, fill.alpha() * opacity / 255.0);
|
||||
context_.set_line_width(common_.scale_factor_);
|
||||
context_.add_path(path);
|
||||
context_.stroke();
|
||||
},
|
||||
[&](geometry_type &roof) {
|
||||
path_type roof_path(common_.t_, roof, prj_trans);
|
||||
context_.set_color(fill, opacity);
|
||||
context_.add_path(roof_path);
|
||||
context_.fill();
|
||||
});
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(building_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
110
src/cairo/process_debug_symbolizer.cpp
Normal file
110
src/cairo/process_debug_symbolizer.cpp
Normal file
@ -0,0 +1,110 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
#include <mapnik/label_collision_detector.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
namespace {
|
||||
|
||||
// special implementation of the box drawing so that it's pixel-aligned
|
||||
inline void render_debug_box(cairo_context &context, box2d<double> const& b)
|
||||
{
|
||||
cairo_save_restore guard(context);
|
||||
double minx = std::floor(b.minx()) + 0.5;
|
||||
double miny = std::floor(b.miny()) + 0.5;
|
||||
double maxx = std::floor(b.maxx()) + 0.5;
|
||||
double maxy = std::floor(b.maxy()) + 0.5;
|
||||
context.move_to(minx, miny);
|
||||
context.line_to(minx, maxy);
|
||||
context.line_to(maxx, maxy);
|
||||
context.line_to(maxx, miny);
|
||||
context.close_path();
|
||||
context.stroke();
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(debug_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
using detector_type = label_collision_detector4;
|
||||
cairo_save_restore guard(context_);
|
||||
|
||||
debug_symbolizer_mode_enum mode = get<debug_symbolizer_mode_enum>(sym, keys::mode, feature, common_.vars_, DEBUG_SYM_MODE_COLLISION);
|
||||
|
||||
context_.set_operator(src_over);
|
||||
context_.set_color(mapnik::color(255, 0, 0), 1.0);
|
||||
context_.set_line_join(MITER_JOIN);
|
||||
context_.set_line_cap(BUTT_CAP);
|
||||
context_.set_miter_limit(4.0);
|
||||
context_.set_line_width(1.0);
|
||||
|
||||
if (mode == DEBUG_SYM_MODE_COLLISION)
|
||||
{
|
||||
typename detector_type::query_iterator itr = common_.detector_->begin();
|
||||
typename detector_type::query_iterator end = common_.detector_->end();
|
||||
for ( ;itr!=end; ++itr)
|
||||
{
|
||||
render_debug_box(context_, itr->box);
|
||||
}
|
||||
}
|
||||
else if (mode == DEBUG_SYM_MODE_VERTEX)
|
||||
{
|
||||
for (auto const& geom : feature.paths())
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z = 0;
|
||||
geom.rewind(0);
|
||||
unsigned cmd = 1;
|
||||
while ((cmd = geom.vertex(&x, &y)) != mapnik::SEG_END)
|
||||
{
|
||||
if (cmd == SEG_CLOSE) continue;
|
||||
prj_trans.backward(x,y,z);
|
||||
common_.t_.forward(&x,&y);
|
||||
context_.move_to(std::floor(x) - 0.5, std::floor(y) + 0.5);
|
||||
context_.line_to(std::floor(x) + 1.5, std::floor(y) + 0.5);
|
||||
context_.move_to(std::floor(x) + 0.5, std::floor(y) - 0.5);
|
||||
context_.line_to(std::floor(x) + 0.5, std::floor(y) + 1.5);
|
||||
context_.stroke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(debug_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
126
src/cairo/process_group_symbolizer.cpp
Normal file
126
src/cairo/process_group_symbolizer.cpp
Normal file
@ -0,0 +1,126 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/make_unique.hpp>
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
|
||||
// mapnik symbolizer generics
|
||||
#include <mapnik/renderer_common/process_group_symbolizer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
class feature_impl;
|
||||
class proj_transform;
|
||||
struct group_symbolizer;
|
||||
|
||||
namespace {
|
||||
|
||||
// Render a thunk which was frozen from a previous call to
|
||||
// extract_bboxes. We should now have a new offset at which
|
||||
// to render it, and the boxes themselves should already be
|
||||
// in the detector from the placement_finder.
|
||||
template <typename T>
|
||||
struct thunk_renderer : public boost::static_visitor<>
|
||||
{
|
||||
using renderer_type = cairo_renderer<T>;
|
||||
|
||||
thunk_renderer(renderer_type & ren,
|
||||
cairo_context & context,
|
||||
cairo_face_manager & face_manager,
|
||||
renderer_common & common,
|
||||
pixel_position const& offset)
|
||||
: ren_(ren), context_(context), face_manager_(face_manager),
|
||||
common_(common), offset_(offset)
|
||||
{}
|
||||
|
||||
void operator()(point_render_thunk const &thunk) const
|
||||
{
|
||||
pixel_position new_pos(thunk.pos_.x + offset_.x, thunk.pos_.y + offset_.y);
|
||||
ren_.render_marker(new_pos, *thunk.marker_, thunk.tr_, thunk.opacity_,
|
||||
thunk.comp_op_);
|
||||
}
|
||||
|
||||
void operator()(text_render_thunk const &thunk) const
|
||||
{
|
||||
cairo_save_restore guard(context_);
|
||||
context_.set_operator(thunk.comp_op_);
|
||||
|
||||
render_offset_placements(
|
||||
thunk.placements_,
|
||||
offset_,
|
||||
[&] (glyph_positions_ptr glyphs)
|
||||
{
|
||||
if (glyphs->marker())
|
||||
{
|
||||
ren_.render_marker(glyphs->marker_pos(),
|
||||
*(glyphs->marker()->marker),
|
||||
glyphs->marker()->transform,
|
||||
thunk.opacity_, thunk.comp_op_);
|
||||
}
|
||||
context_.add_text(glyphs, face_manager_, common_.font_manager_, src_over, src_over, common_.scale_factor_);
|
||||
});
|
||||
}
|
||||
|
||||
template <typename T0>
|
||||
void operator()(T0 const &) const
|
||||
{
|
||||
// TODO: warning if unimplemented?
|
||||
}
|
||||
|
||||
private:
|
||||
renderer_type & ren_;
|
||||
cairo_context & context_;
|
||||
cairo_face_manager & face_manager_;
|
||||
renderer_common & common_;
|
||||
pixel_position offset_;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(group_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
render_group_symbolizer(
|
||||
sym, feature, common_.vars_, prj_trans, common_.query_extent_, common_,
|
||||
[&](render_thunk_list const& thunks, pixel_position const& render_offset)
|
||||
{
|
||||
thunk_renderer<T> ren(*this, context_, face_manager_, common_, render_offset);
|
||||
for (render_thunk_ptr const& thunk : thunks)
|
||||
{
|
||||
boost::apply_visitor(ren, *thunk);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(group_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
141
src/cairo/process_line_pattern_symbolizer.cpp
Normal file
141
src/cairo/process_line_pattern_symbolizer.cpp
Normal file
@ -0,0 +1,141 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/make_unique.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
#include <mapnik/renderer_common/render_pattern.hpp>
|
||||
#include <mapnik/vertex_converters.hpp>
|
||||
#include <mapnik/marker.hpp>
|
||||
#include <mapnik/marker_cache.hpp>
|
||||
#include <mapnik/agg_rasterizer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
|
||||
using conv_types = boost::mpl::vector<clip_line_tag, transform_tag,
|
||||
affine_transform_tag,
|
||||
simplify_tag, smooth_tag,
|
||||
offset_transform_tag,
|
||||
dash_tag, stroke_tag>;
|
||||
|
||||
std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_);
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
||||
bool clip = get<bool>(sym, keys::clip, feature, common_.vars_, false);
|
||||
double offset = get<double>(sym, keys::offset, feature, common_.vars_, 0.0);
|
||||
double simplify_tolerance = get<double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
|
||||
double smooth = get<double>(sym, keys::smooth, feature, common_.vars_, 0.0);
|
||||
|
||||
boost::optional<marker_ptr> marker;
|
||||
if ( !filename.empty() )
|
||||
{
|
||||
marker = marker_cache::instance().find(filename, true);
|
||||
}
|
||||
if (!marker || !(*marker)) return;
|
||||
|
||||
unsigned width = (*marker)->width();
|
||||
unsigned height = (*marker)->height();
|
||||
|
||||
cairo_save_restore guard(context_);
|
||||
context_.set_operator(comp_op);
|
||||
std::shared_ptr<cairo_pattern> pattern;
|
||||
image_ptr image = nullptr;
|
||||
// TODO - re-implement at renderer level like polygon_pattern symbolizer
|
||||
double opacity = get<value_double>(sym, keys::opacity, feature, common_.vars_,1.0);
|
||||
if ((*marker)->is_bitmap())
|
||||
{
|
||||
pattern = std::make_unique<cairo_pattern>(**((*marker)->get_bitmap_data()));
|
||||
context_.set_line_width(height);
|
||||
}
|
||||
else
|
||||
{
|
||||
mapnik::rasterizer ras;
|
||||
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
|
||||
auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
|
||||
if (image_transform) evaluate_transform(image_tr, feature, common_.vars_, *image_transform);
|
||||
image = render_pattern(ras, **marker, image_tr, opacity);
|
||||
pattern = std::make_unique<cairo_pattern>(*image);
|
||||
width = image->width();
|
||||
height = image->height();
|
||||
context_.set_line_width(height);
|
||||
}
|
||||
|
||||
pattern->set_extend(CAIRO_EXTEND_REPEAT);
|
||||
pattern->set_filter(CAIRO_FILTER_BILINEAR);
|
||||
|
||||
agg::trans_affine tr;
|
||||
auto geom_transform = get_optional<transform_type>(sym, keys::geometry_transform);
|
||||
if (geom_transform) { evaluate_transform(tr, feature, common_.vars_, *geom_transform, common_.scale_factor_); }
|
||||
|
||||
box2d<double> clipping_extent = common_.query_extent_;
|
||||
if (clip)
|
||||
{
|
||||
double padding = (double)(common_.query_extent_.width()/common_.width_);
|
||||
double half_stroke = width/2.0;
|
||||
if (half_stroke > 1)
|
||||
padding *= half_stroke;
|
||||
if (std::fabs(offset) > 0)
|
||||
padding *= std::fabs(offset) * 1.2;
|
||||
padding *= common_.scale_factor_;
|
||||
clipping_extent.pad(padding);
|
||||
}
|
||||
|
||||
using rasterizer_type = line_pattern_rasterizer<cairo_context>;
|
||||
rasterizer_type ras(context_, *pattern, width, height);
|
||||
vertex_converter<box2d<double>, rasterizer_type, line_pattern_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clipping_extent, ras, sym, common_.t_, prj_trans, tr, feature, common_.vars_, common_.scale_factor_);
|
||||
|
||||
if (clip) converter.set<clip_line_tag>(); // optional clip (default: true)
|
||||
converter.set<transform_tag>(); // always transform
|
||||
if (std::fabs(offset) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
converter.set<affine_transform_tag>(); // optional affine transform
|
||||
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
|
||||
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
|
||||
|
||||
|
||||
for (auto & geom : feature.paths())
|
||||
{
|
||||
if (geom.size() > 1)
|
||||
{
|
||||
converter.apply(geom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(line_pattern_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
116
src/cairo/process_line_symbolizer.cpp
Normal file
116
src/cairo/process_line_symbolizer.cpp
Normal file
@ -0,0 +1,116 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
#include <mapnik/vertex_converters.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(line_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
using conv_types = boost::mpl::vector<clip_line_tag, transform_tag,
|
||||
affine_transform_tag,
|
||||
simplify_tag, smooth_tag,
|
||||
offset_transform_tag,
|
||||
dash_tag, stroke_tag>;
|
||||
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
||||
bool clip = get<bool>(sym, keys::clip, feature, common_.vars_, false);
|
||||
double offset = get<double>(sym, keys::offset, feature, common_.vars_, 0.0);
|
||||
double simplify_tolerance = get<double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
|
||||
double smooth = get<double>(sym, keys::smooth, feature, common_.vars_, 0.0);
|
||||
|
||||
mapnik::color stroke = get<mapnik::color>(sym, keys::stroke, feature, common_.vars_, mapnik::color(0,0,0));
|
||||
double stroke_opacity = get<double>(sym, keys::stroke_opacity, feature, common_.vars_, 1.0);
|
||||
line_join_enum stroke_join = get<line_join_enum>(sym, keys::stroke_linejoin, feature, common_.vars_, MITER_JOIN);
|
||||
line_cap_enum stroke_cap = get<line_cap_enum>(sym, keys::stroke_linecap, feature, common_.vars_, BUTT_CAP);
|
||||
auto dash = get_optional<dash_array>(sym, keys::stroke_dasharray, feature, common_.vars_);
|
||||
double miterlimit = get<double>(sym, keys::stroke_miterlimit, feature, common_.vars_, 4.0);
|
||||
double width = get<double>(sym, keys::stroke_width, feature, common_.vars_, 1.0);
|
||||
|
||||
cairo_save_restore guard(context_);
|
||||
context_.set_operator(comp_op);
|
||||
context_.set_color(stroke, stroke_opacity);
|
||||
context_.set_line_join(stroke_join);
|
||||
context_.set_line_cap(stroke_cap);
|
||||
context_.set_miter_limit(miterlimit);
|
||||
context_.set_line_width(width * common_.scale_factor_);
|
||||
if (dash)
|
||||
{
|
||||
context_.set_dash(*dash, common_.scale_factor_);
|
||||
}
|
||||
|
||||
agg::trans_affine tr;
|
||||
auto geom_transform = get_optional<transform_type>(sym, keys::geometry_transform);
|
||||
if (geom_transform) { evaluate_transform(tr, feature, common_.vars_, *geom_transform, common_.scale_factor_); }
|
||||
|
||||
box2d<double> clipping_extent = common_.query_extent_;
|
||||
if (clip)
|
||||
{
|
||||
double padding = (double)(common_.query_extent_.width()/common_.width_);
|
||||
double half_stroke = width/2.0;
|
||||
if (half_stroke > 1)
|
||||
padding *= half_stroke;
|
||||
if (std::fabs(offset) > 0)
|
||||
padding *= std::fabs(offset) * 1.2;
|
||||
padding *= common_.scale_factor_;
|
||||
clipping_extent.pad(padding);
|
||||
}
|
||||
vertex_converter<box2d<double>, cairo_context, line_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clipping_extent,context_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
|
||||
|
||||
if (clip) converter.set<clip_line_tag>(); // optional clip (default: true)
|
||||
converter.set<transform_tag>(); // always transform
|
||||
if (std::fabs(offset) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
converter.set<affine_transform_tag>(); // optional affine transform
|
||||
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
|
||||
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
|
||||
|
||||
for (geometry_type & geom : feature.paths())
|
||||
{
|
||||
if (geom.size() > 1)
|
||||
{
|
||||
converter.apply(geom);
|
||||
}
|
||||
}
|
||||
// stroke
|
||||
context_.set_fill_rule(CAIRO_FILL_RULE_WINDING);
|
||||
context_.stroke();
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(line_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
224
src/cairo/process_markers_symbolizer.cpp
Normal file
224
src/cairo/process_markers_symbolizer.cpp
Normal file
@ -0,0 +1,224 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
#include <mapnik/cairo/cairo_render_vector.hpp>
|
||||
#include <mapnik/markers_placement.hpp>
|
||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||
#include <mapnik/noncopyable.hpp>
|
||||
#include <mapnik/pixel_position.hpp>
|
||||
#include <mapnik/attribute.hpp>
|
||||
#include <mapnik/marker.hpp>
|
||||
#include <mapnik/marker_cache.hpp>
|
||||
#include <mapnik/renderer_common/process_markers_symbolizer.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg/include/agg_array.h" // for pod_bvector
|
||||
#include "agg/include/agg_trans_affine.h" // for trans_affine, etc
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
class feature_impl;
|
||||
class proj_transform;
|
||||
namespace svg { struct path_attributes; }
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename RendererContext, typename SvgPath, typename Attributes, typename Detector>
|
||||
struct markers_dispatch : mapnik::noncopyable
|
||||
{
|
||||
markers_dispatch(SvgPath & marker,
|
||||
Attributes const& attributes,
|
||||
box2d<double> const& bbox,
|
||||
agg::trans_affine const& marker_trans,
|
||||
markers_symbolizer const& sym,
|
||||
Detector & detector,
|
||||
double scale_factor,
|
||||
feature_impl const& feature,
|
||||
mapnik::attributes const& vars,
|
||||
bool snap_to_pixels,
|
||||
RendererContext const& renderer_context)
|
||||
:marker_(marker),
|
||||
attributes_(attributes),
|
||||
bbox_(bbox),
|
||||
marker_trans_(marker_trans),
|
||||
sym_(sym),
|
||||
detector_(detector),
|
||||
scale_factor_(scale_factor),
|
||||
feature_(feature),
|
||||
vars_(vars),
|
||||
ctx_(std::get<0>(renderer_context))
|
||||
{}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void add_path(T & path)
|
||||
{
|
||||
marker_placement_enum placement_method = get<marker_placement_enum>(
|
||||
sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
|
||||
bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
|
||||
bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
|
||||
double opacity = get<double>(sym_, keys::opacity, feature_, vars_, 1.0);
|
||||
double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
|
||||
double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
|
||||
coord2d center = bbox_.center();
|
||||
agg::trans_affine_translation recenter(-center.x, -center.y);
|
||||
agg::trans_affine tr = recenter * marker_trans_;
|
||||
markers_placement_finder<T, label_collision_detector4> placement_finder(
|
||||
placement_method,
|
||||
path,
|
||||
bbox_,
|
||||
tr,
|
||||
detector_,
|
||||
spacing * scale_factor_,
|
||||
max_error,
|
||||
allow_overlap);
|
||||
double x, y, angle = .0;
|
||||
while (placement_finder.get_point(x, y, angle, ignore_placement))
|
||||
{
|
||||
agg::trans_affine matrix = tr;
|
||||
matrix.rotate(angle);
|
||||
matrix.translate(x, y);
|
||||
render_vector_marker(
|
||||
ctx_,
|
||||
pixel_position(x, y),
|
||||
marker_,
|
||||
bbox_,
|
||||
attributes_,
|
||||
matrix,
|
||||
opacity,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
SvgPath & marker_;
|
||||
Attributes const& attributes_;
|
||||
box2d<double> const& bbox_;
|
||||
agg::trans_affine const& marker_trans_;
|
||||
markers_symbolizer const& sym_;
|
||||
Detector & detector_;
|
||||
double scale_factor_;
|
||||
feature_impl const& feature_;
|
||||
attributes const& vars_;
|
||||
cairo_context & ctx_;
|
||||
};
|
||||
|
||||
template <typename RendererContext, typename Detector>
|
||||
struct raster_markers_dispatch : mapnik::noncopyable
|
||||
{
|
||||
raster_markers_dispatch(mapnik::image_data_32 & src,
|
||||
agg::trans_affine const& marker_trans,
|
||||
markers_symbolizer const& sym,
|
||||
Detector & detector,
|
||||
double scale_factor,
|
||||
feature_impl const& feature,
|
||||
mapnik::attributes const& vars,
|
||||
RendererContext const& renderer_context)
|
||||
: src_(src),
|
||||
detector_(detector),
|
||||
sym_(sym),
|
||||
marker_trans_(marker_trans),
|
||||
scale_factor_(scale_factor),
|
||||
feature_(feature),
|
||||
vars_(vars),
|
||||
ctx_(std::get<0>(renderer_context)) {}
|
||||
|
||||
template <typename T>
|
||||
void add_path(T & path)
|
||||
{
|
||||
marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
|
||||
double opacity = get<double>(sym_, keys::opacity, feature_, vars_, 1.0);
|
||||
double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
|
||||
double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
|
||||
bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
|
||||
bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
|
||||
box2d<double> bbox_(0,0, src_.width(),src_.height());
|
||||
markers_placement_finder<T, label_collision_detector4> placement_finder(
|
||||
placement_method,
|
||||
path,
|
||||
bbox_,
|
||||
marker_trans_,
|
||||
detector_,
|
||||
spacing * scale_factor_,
|
||||
max_error,
|
||||
allow_overlap);
|
||||
double x, y, angle = .0;
|
||||
while (placement_finder.get_point(x, y, angle, ignore_placement))
|
||||
{
|
||||
agg::trans_affine matrix = marker_trans_;
|
||||
matrix.rotate(angle);
|
||||
matrix.translate(x, y);
|
||||
ctx_.add_image(matrix, src_, opacity);
|
||||
}
|
||||
}
|
||||
|
||||
image_data_32 & src_;
|
||||
Detector & detector_;
|
||||
markers_symbolizer const& sym_;
|
||||
agg::trans_affine const& marker_trans_;
|
||||
double scale_factor_;
|
||||
feature_impl const& feature_;
|
||||
attributes const& vars_;
|
||||
cairo_context & ctx_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(markers_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
using svg_attribute_type = agg::pod_bvector<svg::path_attributes>;
|
||||
|
||||
cairo_save_restore guard(context_);
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
||||
context_.set_operator(comp_op);
|
||||
box2d<double> clip_box = common_.query_extent_;
|
||||
|
||||
auto renderer_context = std::tie(context_);
|
||||
|
||||
using RendererContextType = decltype(renderer_context);
|
||||
using vector_dispatch_type = detail::markers_dispatch<RendererContextType,
|
||||
svg::path_adapter<svg::vertex_stl_adapter<svg::svg_path_storage> >,
|
||||
svg_attribute_type,label_collision_detector4>;
|
||||
|
||||
using raster_dispatch_type = detail::raster_markers_dispatch<RendererContextType,
|
||||
label_collision_detector4>;
|
||||
|
||||
|
||||
render_markers_symbolizer<vector_dispatch_type, raster_dispatch_type>(
|
||||
sym, feature, prj_trans, common_, clip_box,
|
||||
renderer_context);
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(markers_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
66
src/cairo/process_point_symbolizer.cpp
Normal file
66
src/cairo/process_point_symbolizer.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/symbolizer.hpp>
|
||||
#include <mapnik/symbolizer_keys.hpp>
|
||||
#include <mapnik/image_compositing.hpp>
|
||||
#include <mapnik/cairo/cairo_context.hpp>
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
#include <mapnik/renderer_common.hpp>
|
||||
#include <mapnik/renderer_common/process_point_symbolizer.hpp>
|
||||
|
||||
namespace agg { struct trans_affine; }
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
class feature_impl;
|
||||
class proj_transform;
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(point_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
||||
|
||||
cairo_save_restore guard(context_);
|
||||
context_.set_operator(comp_op);
|
||||
|
||||
render_point_symbolizer(
|
||||
sym, feature, prj_trans, common_,
|
||||
[this](pixel_position const& pos, marker const& marker,
|
||||
agg::trans_affine const& tr, double opacity) {
|
||||
render_marker(pos, marker, tr, opacity);
|
||||
});
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(point_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
135
src/cairo/process_polygon_pattern_symbolizer.cpp
Normal file
135
src/cairo/process_polygon_pattern_symbolizer.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
#include <mapnik/cairo/cairo_render_vector.hpp>
|
||||
#include <mapnik/renderer_common/render_pattern.hpp>
|
||||
#include <mapnik/vertex_converters.hpp>
|
||||
#include <mapnik/marker.hpp>
|
||||
#include <mapnik/marker_cache.hpp>
|
||||
#include <mapnik/agg_rasterizer.hpp>
|
||||
#include <mapnik/renderer_common/clipping_extent.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
||||
std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_);
|
||||
bool clip = get<bool>(sym, keys::clip, feature, common_.vars_, false);
|
||||
double simplify_tolerance = get<double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
|
||||
double smooth = get<double>(sym, keys::smooth, feature, common_.vars_, 0.0);
|
||||
|
||||
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
|
||||
auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
|
||||
if (image_transform) evaluate_transform(image_tr, feature, common_.vars_, *image_transform);
|
||||
|
||||
cairo_save_restore guard(context_);
|
||||
context_.set_operator(comp_op);
|
||||
|
||||
boost::optional<mapnik::marker_ptr> marker = mapnik::marker_cache::instance().find(filename,true);
|
||||
if (!marker || !(*marker)) return;
|
||||
|
||||
unsigned offset_x=0;
|
||||
unsigned offset_y=0;
|
||||
box2d<double> const& clip_box = clipping_extent(common_);
|
||||
pattern_alignment_enum alignment = get<pattern_alignment_enum>(sym, keys::alignment, feature, common_.vars_, GLOBAL_ALIGNMENT);
|
||||
if (alignment == LOCAL_ALIGNMENT)
|
||||
{
|
||||
double x0 = 0.0;
|
||||
double y0 = 0.0;
|
||||
|
||||
if (feature.num_geometries() > 0)
|
||||
{
|
||||
using clipped_geometry_type = agg::conv_clip_polygon<geometry_type>;
|
||||
using path_type = coord_transform<CoordTransform,clipped_geometry_type>;
|
||||
clipped_geometry_type clipped(feature.get_geometry(0));
|
||||
clipped.clip_box(clip_box.minx(), clip_box.miny(),
|
||||
clip_box.maxx(), clip_box.maxy());
|
||||
path_type path(common_.t_, clipped, prj_trans);
|
||||
path.vertex(&x0, &y0);
|
||||
}
|
||||
offset_x = std::abs(clip_box.width() - x0);
|
||||
offset_y = std::abs(clip_box.height() - y0);
|
||||
}
|
||||
|
||||
if ((*marker)->is_bitmap())
|
||||
{
|
||||
cairo_pattern pattern(**((*marker)->get_bitmap_data()));
|
||||
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
||||
pattern.set_origin(offset_x, offset_y);
|
||||
context_.set_pattern(pattern);
|
||||
}
|
||||
else
|
||||
{
|
||||
mapnik::rasterizer ras;
|
||||
double opacity = get<double>(sym,keys::opacity, feature, common_.vars_, 1.0);
|
||||
image_ptr image = render_pattern(ras, **marker, image_tr, opacity);
|
||||
cairo_pattern pattern(*image);
|
||||
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
||||
pattern.set_origin(offset_x, offset_y);
|
||||
context_.set_pattern(pattern);
|
||||
}
|
||||
|
||||
agg::trans_affine tr;
|
||||
auto geom_transform = get_optional<transform_type>(sym, keys::geometry_transform);
|
||||
if (geom_transform) { evaluate_transform(tr, feature, common_.vars_, *geom_transform, common_.scale_factor_); }
|
||||
|
||||
using conv_types = boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>;
|
||||
vertex_converter<box2d<double>, cairo_context, polygon_pattern_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clip_box, context_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
|
||||
|
||||
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)
|
||||
converter.set<transform_tag>(); //always transform
|
||||
converter.set<affine_transform_tag>();
|
||||
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
|
||||
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
|
||||
|
||||
for ( geometry_type & geom : feature.paths())
|
||||
{
|
||||
if (geom.size() > 2)
|
||||
{
|
||||
converter.apply(geom);
|
||||
}
|
||||
}
|
||||
// fill polygon
|
||||
context_.set_fill_rule(CAIRO_FILL_RULE_EVEN_ODD);
|
||||
context_.fill();
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(polygon_pattern_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
66
src/cairo/process_polygon_symbolizer.cpp
Normal file
66
src/cairo/process_polygon_symbolizer.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
#include <mapnik/renderer_common/process_polygon_symbolizer.hpp>
|
||||
#include <mapnik/vertex_converters.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(polygon_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
using conv_types = boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>;
|
||||
using vertex_converter_type = vertex_converter<box2d<double>, cairo_context, polygon_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine,
|
||||
conv_types, feature_impl>;
|
||||
|
||||
cairo_save_restore guard(context_);
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
||||
context_.set_operator(comp_op);
|
||||
|
||||
render_polygon_symbolizer<vertex_converter_type>(
|
||||
sym, feature, prj_trans, common_, common_.query_extent_, context_,
|
||||
[&](color const &fill, double opacity) {
|
||||
context_.set_color(fill, opacity);
|
||||
// fill polygon
|
||||
context_.set_fill_rule(CAIRO_FILL_RULE_EVEN_ODD);
|
||||
context_.fill();
|
||||
});
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(polygon_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
59
src/cairo/process_raster_symbolizer.cpp
Normal file
59
src/cairo/process_raster_symbolizer.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/make_unique.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
|
||||
// mapnik symbolizer generics
|
||||
#include <mapnik/renderer_common/process_raster_symbolizer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(raster_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
cairo_save_restore guard(context_);
|
||||
render_raster_symbolizer(
|
||||
sym, feature, prj_trans, common_,
|
||||
[&](image_data_32 &target, composite_mode_e comp_op, double opacity,
|
||||
int start_x, int start_y) {
|
||||
context_.set_operator(comp_op);
|
||||
context_.add_image(start_x, start_y, target, opacity);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(raster_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
107
src/cairo/process_text_symbolizer.cpp
Normal file
107
src/cairo/process_text_symbolizer.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/cairo/cairo_renderer.hpp>
|
||||
#include <mapnik/text/symbolizer_helpers.hpp>
|
||||
#include <mapnik/pixel_position.hpp>
|
||||
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
class feature_impl;
|
||||
class proj_transform;
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(shield_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
agg::trans_affine tr;
|
||||
auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
|
||||
if (transform) evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
|
||||
text_symbolizer_helper helper(
|
||||
sym, feature, common_.vars_, prj_trans,
|
||||
common_.width_, common_.height_,
|
||||
common_.scale_factor_,
|
||||
common_.t_, common_.font_manager_, *common_.detector_,
|
||||
common_.query_extent_, tr);
|
||||
|
||||
cairo_save_restore guard(context_);
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
||||
composite_mode_e halo_comp_op = get<composite_mode_e>(sym, keys::halo_comp_op, feature, common_.vars_, src_over);
|
||||
double opacity = get<double>(sym,keys::opacity,feature, common_.vars_, 1.0);
|
||||
|
||||
placements_list const &placements = helper.get();
|
||||
for (glyph_positions_ptr glyphs : placements)
|
||||
{
|
||||
if (glyphs->marker()) {
|
||||
pixel_position pos = glyphs->marker_pos();
|
||||
render_marker(pos,
|
||||
*(glyphs->marker()->marker),
|
||||
glyphs->marker()->transform,
|
||||
opacity);
|
||||
}
|
||||
context_.add_text(glyphs, face_manager_, common_.font_manager_, comp_op, halo_comp_op, common_.scale_factor_);
|
||||
}
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(shield_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
template <typename T>
|
||||
void cairo_renderer<T>::process(text_symbolizer const& sym,
|
||||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
agg::trans_affine tr;
|
||||
auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
|
||||
if (transform) evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
|
||||
text_symbolizer_helper helper(
|
||||
sym, feature, common_.vars_, prj_trans,
|
||||
common_.width_, common_.height_,
|
||||
common_.scale_factor_,
|
||||
common_.t_, common_.font_manager_, *common_.detector_,
|
||||
common_.query_extent_, tr);
|
||||
|
||||
cairo_save_restore guard(context_);
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
||||
composite_mode_e halo_comp_op = get<composite_mode_e>(sym, keys::halo_comp_op, feature, common_.vars_, src_over);
|
||||
|
||||
placements_list const& placements = helper.get();
|
||||
for (glyph_positions_ptr glyphs : placements)
|
||||
{
|
||||
context_.add_text(glyphs, face_manager_, common_.font_manager_, comp_op, halo_comp_op, common_.scale_factor_);
|
||||
}
|
||||
}
|
||||
|
||||
template void cairo_renderer<cairo_ptr>::process(text_symbolizer const&,
|
||||
mapnik::feature_impl &,
|
||||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE_CAIRO
|
||||
@ -42,6 +42,8 @@
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
template class singleton<datasource_cache, CreateStatic>;
|
||||
|
||||
extern datasource_ptr create_static_datasource(parameters const& params);
|
||||
extern std::vector<std::string> get_static_datasource_names();
|
||||
|
||||
@ -224,7 +226,7 @@ bool datasource_cache::register_datasource(std::string const& filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plugins_.insert(std::make_pair(plugin->name(),plugin)).second)
|
||||
if (plugins_.emplace(plugin->name(),plugin).second)
|
||||
{
|
||||
MAPNIK_LOG_DEBUG(datasource_cache)
|
||||
<< "datasource_cache: Registered="
|
||||
|
||||
@ -45,7 +45,6 @@ namespace mapnik
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
template class feature_style_processor<cairo_renderer<cairo_ptr> >;
|
||||
template class feature_style_processor<cairo_renderer<cairo_surface_ptr> >;
|
||||
#endif
|
||||
|
||||
#if defined(SVG_RENDERER)
|
||||
|
||||
@ -132,6 +132,7 @@ bool freetype_engine::register_font(std::string const& file_name)
|
||||
|
||||
bool freetype_engine::register_font_impl(std::string const& file_name, FT_LibraryRec_ * library)
|
||||
{
|
||||
MAPNIK_LOG_DEBUG(font_engine_freetype) << "registering: " << file_name;
|
||||
#ifdef _WINDOWS
|
||||
FILE * file = _wfopen(mapnik::utf8_to_utf16(file_name).c_str(), L"rb");
|
||||
#else
|
||||
@ -177,7 +178,7 @@ bool freetype_engine::register_font_impl(std::string const& file_name, FT_Librar
|
||||
// skip fonts with leading . in the name
|
||||
if (!boost::algorithm::starts_with(name,"."))
|
||||
{
|
||||
name2file_.insert(std::make_pair(name, std::make_pair(i,file_name)));
|
||||
name2file_.emplace(name,std::make_pair(i,file_name));
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
@ -332,7 +333,7 @@ face_ptr freetype_engine::create_face(std::string const& family_name)
|
||||
std::fseek(file.get(), 0, SEEK_SET);
|
||||
std::unique_ptr<char[]> buffer(new char[file_size]);
|
||||
std::fread(buffer.get(), file_size, 1, file.get());
|
||||
auto result = memory_fonts_.insert(std::make_pair(itr->second.second, std::make_pair(std::move(buffer),file_size)));
|
||||
auto result = memory_fonts_.emplace(itr->second.second, std::make_pair(std::move(buffer),file_size));
|
||||
FT_Error error = FT_New_Memory_Face (library_,
|
||||
reinterpret_cast<FT_Byte const*>(result.first->second.first.get()),
|
||||
static_cast<FT_Long>(result.first->second.second),
|
||||
@ -377,7 +378,7 @@ face_ptr face_manager<T>::get_face(std::string const& name)
|
||||
face_ptr face = engine_.create_face(name);
|
||||
if (face)
|
||||
{
|
||||
face_ptr_cache_.insert(make_pair(name,face));
|
||||
face_ptr_cache_.emplace(name,face);
|
||||
}
|
||||
return face;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ void hit_grid<T>::add_feature(mapnik::feature_impl const& feature)
|
||||
{
|
||||
// TODO - consider shortcutting f_keys if feature_id == lookup_value
|
||||
// create a mapping between the pixel id and the feature key
|
||||
f_keys_.insert(std::make_pair(feature_id,lookup_value));
|
||||
f_keys_.emplace(feature_id,lookup_value);
|
||||
// if extra fields have been supplied, push them into grid memory
|
||||
if (!names_.empty())
|
||||
{
|
||||
@ -136,7 +136,7 @@ void hit_grid<T>::add_feature(mapnik::feature_impl const& feature)
|
||||
// https://github.com/mapnik/mapnik/issues/1198
|
||||
mapnik::feature_ptr feature2(mapnik::feature_factory::create(ctx_,feature_id));
|
||||
feature2->set_data(feature.get_data());
|
||||
features_.insert(std::make_pair(lookup_value,feature2));
|
||||
features_.emplace(lookup_value,feature2);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -58,17 +58,16 @@ extern "C"
|
||||
#include <cairo.h>
|
||||
#ifdef CAIRO_HAS_PDF_SURFACE
|
||||
#include <cairo-pdf.h>
|
||||
#endif // CAIRO_HAS_PDF_SURFACE
|
||||
#endif
|
||||
#ifdef CAIRO_HAS_PS_SURFACE
|
||||
#include <cairo-ps.h>
|
||||
#endif // CAIRO_HAS_PS_SURFACE
|
||||
#endif
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
#include <cairo-svg.h>
|
||||
#endif // CAIRO_HAS_SVG_SURFACE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// boost
|
||||
|
||||
#include <boost/tokenizer.hpp>
|
||||
|
||||
// stl
|
||||
|
||||
@ -501,7 +501,7 @@ void map_parser::parse_fontset(Map & map, xml_node const& node)
|
||||
|
||||
// XXX Hack because map object isn't accessible by text_symbolizer
|
||||
// when it's parsed
|
||||
fontsets_.insert(std::make_pair(name, fontset));
|
||||
fontsets_.emplace(name, fontset);
|
||||
map.insert_fontset(name, std::move(fontset));
|
||||
}
|
||||
catch (config_error const& ex)
|
||||
|
||||
@ -201,7 +201,7 @@ Map::const_style_iterator Map::end_styles() const
|
||||
|
||||
bool Map::insert_style(std::string const& name,feature_type_style style)
|
||||
{
|
||||
return styles_.insert(make_pair(name, std::move(style))).second;
|
||||
return styles_.emplace(name, std::move(style)).second;
|
||||
}
|
||||
|
||||
void Map::remove_style(std::string const& name)
|
||||
@ -224,7 +224,7 @@ bool Map::insert_fontset(std::string const& name, font_set fontset)
|
||||
{
|
||||
throw mapnik::config_error("Fontset name must match the name used to reference it on the map");
|
||||
}
|
||||
return fontsets_.insert(make_pair(name, std::move(fontset))).second;
|
||||
return fontsets_.emplace(name, std::move(fontset)).second;
|
||||
}
|
||||
|
||||
boost::optional<font_set const&> Map::find_fontset(std::string const& name) const
|
||||
|
||||
@ -48,7 +48,7 @@ bool mapped_memory_cache::insert(std::string const& uri, mapped_region_ptr mem)
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
mapnik::scoped_lock lock(mutex_);
|
||||
#endif
|
||||
return cache_.insert(std::make_pair(uri,mem)).second;
|
||||
return cache_.emplace(uri,mem).second;
|
||||
}
|
||||
|
||||
boost::optional<mapped_region_ptr> mapped_memory_cache::find(std::string const& uri, bool update_cache)
|
||||
@ -71,12 +71,10 @@ boost::optional<mapped_region_ptr> mapped_memory_cache::find(std::string const&
|
||||
{
|
||||
boost::interprocess::file_mapping mapping(uri.c_str(),boost::interprocess::read_only);
|
||||
mapped_region_ptr region(std::make_shared<boost::interprocess::mapped_region>(mapping,boost::interprocess::read_only));
|
||||
|
||||
result.reset(region);
|
||||
|
||||
if (update_cache)
|
||||
{
|
||||
cache_.insert(std::make_pair(uri,*result));
|
||||
cache_.emplace(uri,*result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ marker_cache::marker_cache()
|
||||
boost::optional<mapnik::image_ptr> bitmap_data = boost::optional<mapnik::image_ptr>(std::make_shared<image_data_32>(4,4));
|
||||
(*bitmap_data)->set(0xff000000);
|
||||
marker_ptr mark = std::make_shared<mapnik::marker>(bitmap_data);
|
||||
marker_cache_.insert(std::make_pair("image://square",mark));
|
||||
marker_cache_.emplace("image://square",mark);
|
||||
}
|
||||
|
||||
marker_cache::~marker_cache() {}
|
||||
@ -103,7 +103,7 @@ bool marker_cache::insert_svg(std::string const& name, std::string const& svg_st
|
||||
iterator_type itr = svg_cache_.find(key);
|
||||
if (itr == svg_cache_.end())
|
||||
{
|
||||
return svg_cache_.insert(std::make_pair(key,svg_string)).second;
|
||||
return svg_cache_.emplace(key,svg_string).second;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -113,7 +113,7 @@ bool marker_cache::insert_marker(std::string const& uri, marker_ptr path)
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
mapnik::scoped_lock lock(mutex_);
|
||||
#endif
|
||||
return marker_cache_.insert(std::make_pair(uri,path)).second;
|
||||
return marker_cache_.emplace(uri,path).second;
|
||||
}
|
||||
|
||||
boost::optional<marker_ptr> marker_cache::find(std::string const& uri,
|
||||
@ -165,7 +165,7 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri,
|
||||
result.reset(mark);
|
||||
if (update_cache)
|
||||
{
|
||||
marker_cache_.insert(std::make_pair(uri,*result));
|
||||
marker_cache_.emplace(uri,*result);
|
||||
}
|
||||
}
|
||||
// otherwise assume file-based
|
||||
@ -194,7 +194,7 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri,
|
||||
result.reset(mark);
|
||||
if (update_cache)
|
||||
{
|
||||
marker_cache_.insert(std::make_pair(uri,*result));
|
||||
marker_cache_.emplace(uri,*result);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -218,7 +218,7 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri,
|
||||
result.reset(mark);
|
||||
if (update_cache)
|
||||
{
|
||||
marker_cache_.insert(std::make_pair(uri,*result));
|
||||
marker_cache_.emplace(uri,*result);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -102,9 +102,8 @@ namespace path_processor_detail {
|
||||
collect_ (std::set<std::string> & cont)
|
||||
: cont_(cont) {}
|
||||
|
||||
void operator() (std::string const& token) const
|
||||
void operator() (std::string const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(token);
|
||||
}
|
||||
|
||||
void operator() (attribute const& attr) const
|
||||
|
||||
@ -49,6 +49,7 @@ namespace mapnik {
|
||||
projection::projection(std::string const& params, bool defer_proj_init)
|
||||
: params_(params),
|
||||
defer_proj_init_(defer_proj_init),
|
||||
is_geographic_(false),
|
||||
proj_(nullptr),
|
||||
proj_ctx_(nullptr)
|
||||
{
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include <mapnik/renderer_common/process_group_symbolizer.hpp>
|
||||
#include <mapnik/renderer_common/process_point_symbolizer.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/xml_parser.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
// stl
|
||||
#include <iostream>
|
||||
|
||||
@ -488,27 +488,23 @@ public:
|
||||
serialize_type( boost::property_tree::ptree & node):
|
||||
node_(node) {}
|
||||
|
||||
void operator () ( mapnik::value_integer val ) const
|
||||
void operator () ( mapnik::value_integer ) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
node_.put("<xmlattr>.type", "int" );
|
||||
}
|
||||
|
||||
void operator () ( mapnik::value_double val ) const
|
||||
void operator () ( mapnik::value_double ) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
node_.put("<xmlattr>.type", "float" );
|
||||
}
|
||||
|
||||
void operator () ( std::string const& val ) const
|
||||
void operator () ( std::string const& ) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
node_.put("<xmlattr>.type", "string" );
|
||||
}
|
||||
|
||||
void operator () ( mapnik::value_null val ) const
|
||||
void operator () ( mapnik::value_null ) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
node_.put("<xmlattr>.type", "string" );
|
||||
}
|
||||
|
||||
|
||||
@ -36,10 +36,6 @@ void evaluate_transform(agg::trans_affine& tr,
|
||||
{
|
||||
if (trans_expr)
|
||||
{
|
||||
#ifdef MAPNIK_LOG
|
||||
MAPNIK_LOG_DEBUG(transform) << "transform: evaluate "
|
||||
<< transform_processor_type::to_string(*trans_expr);
|
||||
#endif
|
||||
transform_processor_type::evaluate(tr, feature, vars, *trans_expr, scale_factor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ bool font_face::glyph_dimensions(glyph_info & glyph) const
|
||||
glyph.unscaled_ymax = glyph_bbox.yMax;
|
||||
glyph.unscaled_advance = face_->glyph->advance.x;
|
||||
glyph.unscaled_line_height = face_->size->metrics.height;
|
||||
glyph_info_cache_.insert(std::make_pair(glyph.glyph_index, glyph));
|
||||
glyph_info_cache_.emplace(glyph.glyph_index, glyph);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ void registry::register_name(std::string const& name, from_xml_function_ptr ptr,
|
||||
if (overwrite) {
|
||||
map_[name] = ptr;
|
||||
} else {
|
||||
map_.insert(make_pair(name, ptr));
|
||||
map_.emplace(name, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ void registry::register_name(std::string name, from_xml_function_ptr ptr, bool o
|
||||
if (overwrite) {
|
||||
map_[name] = ptr;
|
||||
} else {
|
||||
map_.insert(make_pair(name, ptr));
|
||||
map_.emplace(name, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,9 +37,8 @@ struct transform_node_to_expression_string
|
||||
transform_node_to_expression_string(std::ostringstream& os)
|
||||
: os_(os) {}
|
||||
|
||||
void operator() (identity_node const& node) const
|
||||
void operator() (identity_node const&) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(node);
|
||||
}
|
||||
|
||||
void operator() (matrix_node const& node)
|
||||
|
||||
@ -25,11 +25,14 @@
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
extern "C"
|
||||
{
|
||||
#include <webp/types.h>
|
||||
#include <webp/decode.h>
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// boost
|
||||
#include <boost/iostreams/device/file.hpp>
|
||||
|
||||
@ -226,7 +226,7 @@ xml_node &xml_node::add_child(std::string && name, unsigned line, bool is_text)
|
||||
|
||||
void xml_node::add_attribute(const char * name, const char * value)
|
||||
{
|
||||
attributes_.insert(std::make_pair(name,xml_attribute(value)));
|
||||
attributes_.emplace(name,xml_attribute(value));
|
||||
}
|
||||
|
||||
xml_node::attribute_map const& xml_node::get_attributes() const
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user