Merge branch 'master' of github.com:mapnik/mapnik into localized-font-cache

This commit is contained in:
Dane Springmeyer 2014-09-30 14:42:15 -07:00
commit ad43b37672
54 changed files with 437 additions and 275 deletions

View file

@ -37,9 +37,9 @@ before_script:
- psql -U postgres -c 'create extension postgis' -d template_postgis
- if [[ "${CXX}" == 'g++' ]]; then sudo apt-get install gcc-4.8 g++-4.8; export CXX="$(which g++-4.8)"; export CC="$(which gcc-4.8)"; fi;
- if [[ "${CXX}" == 'clang++' ]]; then export CXX="$(which clang++)"; export CC="$(which clang)"; fi;
- wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.34.tar.bz2
- tar xf harfbuzz-0.9.34.tar.bz2
- cd harfbuzz-0.9.34
- wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.35.tar.bz2
- tar xf harfbuzz-0.9.35.tar.bz2
- cd harfbuzz-0.9.35
- ./configure --prefix=/usr --with-icu --with-cairo=no --with-glib=no --with-gobject=no --with-graphite2=no --with-freetype --with-uniscribe=no --with-coretext=no && make -j2 && sudo make -j2 install
- cd ../

View file

@ -69,7 +69,7 @@ Mapnik Core depends on:
* libz - Zlib compression
* libfreetype - Freetype2 for font support (Install requires freetype-config)
* libxml2 - XML parsing (Install requires xml2-config)
* libharfbuzz - an OpenType text shaping engine
* libharfbuzz - an OpenType text shaping engine (>=0.9.34 needed for CSS font-feature-settings support)
Mapnik Core optionally depends on:

View file

@ -25,6 +25,7 @@
#include <mapnik/rule.hpp>
#include <mapnik/feature_type_style.hpp>
#include <mapnik/graphics.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/text/placements/dummy.hpp>
#include <mapnik/text/text_properties.hpp>
#include <mapnik/datasource_cache.hpp>

View file

@ -34,7 +34,8 @@
#include <mapnik/text/placements_list.hpp>
#include <mapnik/vertex.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_base.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
// stl
#include <memory>

View file

@ -29,6 +29,7 @@
#include <mapnik/expression_node.hpp>
#include <mapnik/function_call.hpp>
#include <mapnik/util/variant.hpp>
#include <mapnik/feature.hpp>
namespace mapnik
{

View file

@ -25,9 +25,13 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/expression_node_types.hpp>
#include <mapnik/symbolizer_base.hpp>
#include <mapnik/expression.hpp>
#include <memory>
#include <vector>
namespace mapnik
{

View file

@ -23,6 +23,8 @@
#ifndef MAPNIK_SYMBOLIZER_GRAMMAR_HPP
#define MAPNIK_SYMBOLIZER_GRAMMAR_HPP
#include <mapnik/config.hpp>
// boost
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
@ -122,21 +124,15 @@ struct symbolizer_grammar : qi::grammar<Iterator, space_type, symbolizer()>
: symbolizer_grammar::base_type(sym, "symbolizer"),
json_()
{
using qi::lit;
using qi::double_;
using qi::int_;
using qi::no_skip;
using qi::omit;
using qi::_val;
using qi::_a;
using qi::_r1;
using qi::_1;
using qi::_2;
using qi::_3;
using qi::_4;
using qi::fail;
using qi::on_error;
using standard_wide::char_;
qi::lit_type lit;
qi::double_type double_;
qi::int_type int_;
qi::no_skip_type no_skip;
qi::_val_type _val;
qi::_a_type _a;
qi::_r1_type _r1;
qi::_1_type _1;
standard_wide::char_type char_;
using phoenix::construct;
// generic json types
@ -197,7 +193,7 @@ struct symbolizer_grammar : qi::grammar<Iterator, space_type, symbolizer()>
property = (json_.string_ [_a = _1] >> lit(':') >> property_value [put_property_(_r1,_a,_1)]) % lit(',')
;
property_value %= json.number | json.string_ ;
property_value %= json_.number | json_.string_ ;
}
@ -211,7 +207,7 @@ struct symbolizer_grammar : qi::grammar<Iterator, space_type, symbolizer()>
phoenix::function<put_property> put_property_;
// error
on_error<fail>(sym, error_handler(_1, _2, _3, _4));
//qi::on_error<qi::fail>(sym, error_handler(_1, _2, _3, _4));
};

View file

@ -333,7 +333,7 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
std::size_t geom_count = feature.paths().size();
if (geom_count == 1)
{
converter.apply(feature.paths()[0]);
converter.apply(const_cast<geometry_type&>(feature.paths()[0]));
}
else if (geom_count > 1)
{
@ -372,7 +372,7 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
}
if (largest)
{
converter.apply(*largest);
converter.apply(const_cast<geometry_type&>(*largest));
}
}
else
@ -383,7 +383,7 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
}
for (geometry_type const& path : feature.paths())
{
converter.apply(path);
converter.apply(const_cast<geometry_type&>(path));
}
}
}

View file

@ -31,9 +31,7 @@
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/util/variant.hpp>
#include <boost/functional/value_factory.hpp>
// stl
#include <map>
#include <boost/function.hpp>
namespace mapnik
{
@ -88,7 +86,7 @@ private:
Detector &detector,
markers_placement_params const& params)
{
static const std::map<marker_placement_e, std::function<markers_placement(
static const std::map<marker_placement_e, boost::function<markers_placement(
Locator &locator,
Detector &detector,
markers_placement_params const& params)>> factories =

View file

@ -25,7 +25,7 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/symbolizer.hpp> // for transform_list_ptr
#include <mapnik/symbolizer_base.hpp> // for transform_list_ptr
namespace mapnik {

View file

@ -25,6 +25,7 @@
#include <mapnik/geom_util.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/proj_transform.hpp>
#include <mapnik/marker.hpp>
#include <mapnik/marker_cache.hpp>

View file

@ -26,6 +26,7 @@
// mapnik
#include <mapnik/warp.hpp>
#include <mapnik/raster.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/raster_colorizer.hpp>
#include <mapnik/proj_transform.hpp>
#include <mapnik/feature.hpp>

View file

@ -27,9 +27,6 @@
#include <mapnik/config.hpp>
#include <mapnik/box2d.hpp>
// boost
#include <boost/optional/optional.hpp>
namespace mapnik
{

View file

@ -25,7 +25,7 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_base.hpp>
#include <mapnik/expression.hpp>
// stl

View file

@ -25,7 +25,8 @@
// mapnik
#include <mapnik/color.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_base.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
// stl
#include <string>

View file

@ -25,24 +25,21 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_base.hpp>
#include <vector>
// fwd declare
namespace mapnik { namespace svg {
struct path_output_attributes;
struct rect_output_attributes;
struct root_output_attributes;
} }
struct path_output_attributes;
struct rect_output_attributes;
struct root_output_attributes;
}}
// boost
#include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/karma_omit.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_bind.hpp>
#include <boost/fusion/include/std_pair.hpp>
#include <boost/fusion/include/struct.hpp>
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/spirit/include/karma_nonterminal.hpp>
#include <boost/spirit/include/karma_rule.hpp>
#include <boost/fusion/adapted/struct.hpp>
/*!
* mapnik::svg::path_output_attributes is adapted as a fusion sequence
@ -61,7 +58,7 @@ BOOST_FUSION_ADAPT_STRUCT(
(std::string, stroke_linecap_)
(std::string, stroke_linejoin_)
(double, stroke_dashoffset_)
)
);
/*!
* mapnik::svg::rect_output_attributes is adapted as a fusion sequence
@ -74,7 +71,7 @@ BOOST_FUSION_ADAPT_STRUCT(
(unsigned, width_)
(unsigned, height_)
(std::string, fill_color_)
)
);
/*!
* mapnik::svg::root_output_attributes is adapted as a fusion sequence
@ -86,98 +83,38 @@ BOOST_FUSION_ADAPT_STRUCT(
(unsigned, height_)
(double, svg_version_)
(std::string, svg_namespace_url_)
)
);
namespace mapnik { namespace svg {
using namespace boost::spirit;
using namespace boost::phoenix;
template <typename OutputIterator>
struct svg_path_attributes_grammar : karma::grammar<OutputIterator, mapnik::svg::path_output_attributes()>
{
explicit svg_path_attributes_grammar()
: svg_path_attributes_grammar::base_type(svg_path_attributes)
{
karma::lit_type lit;
karma::double_type double_;
karma::string_type kstring;
svg_path_attributes =
lit("fill=\"")
<< kstring
<< lit("\" fill-opacity=\"") << double_
<< lit("\" stroke=\"") << kstring
<< lit("\" stroke-opacity=\"") << double_
<< lit("\" stroke-width=\"") << double_ << lit("px")
<< lit("\" stroke-linecap=\"") << kstring
<< lit("\" stroke-linejoin=\"") << kstring
<< lit("\" stroke-dashoffset=\"") << double_ << lit("px") << lit('"');
}
explicit svg_path_attributes_grammar();
karma::rule<OutputIterator, mapnik::svg::path_output_attributes()> svg_path_attributes;
};
template <typename OutputIterator>
struct svg_path_dash_array_grammar : karma::grammar<OutputIterator, mapnik::dash_array()>
{
explicit svg_path_dash_array_grammar()
: svg_path_dash_array_grammar::base_type(svg_path_dash_array)
{
karma::double_type double_;
karma::lit_type lit;
svg_path_dash_array = lit("stroke-dasharray=\"") <<
-((double_ << lit(',') << double_) % lit(',')) << lit('"');
}
explicit svg_path_dash_array_grammar();
karma::rule<OutputIterator, mapnik::dash_array()> svg_path_dash_array;
};
template <typename OutputIterator>
struct svg_rect_attributes_grammar : karma::grammar<OutputIterator, mapnik::svg::rect_output_attributes()>
{
explicit svg_rect_attributes_grammar()
: svg_rect_attributes_grammar::base_type(svg_rect_attributes)
{
karma::lit_type lit;
karma::int_type int_;
karma::string_type kstring;
svg_rect_attributes =
lit("x=\"")
<< int_
<< lit("\" y=\"") << int_
<< lit("\" width=\"") << int_ << lit("px")
<< lit("\" height=\"") << int_ << lit("px")
<< lit("\" fill=\"") << kstring << lit('"');
}
explicit svg_rect_attributes_grammar();
karma::rule<OutputIterator, mapnik::svg::rect_output_attributes()> svg_rect_attributes;
};
template <typename OutputIterator>
struct svg_root_attributes_grammar : karma::grammar<OutputIterator, mapnik::svg::root_output_attributes()>
{
explicit svg_root_attributes_grammar()
: svg_root_attributes_grammar::base_type(svg_root_attributes)
{
karma::lit_type lit;
karma::int_type int_;
karma::string_type kstring;
karma::double_type double_;
svg_root_attributes =
lit("width=\"")
<< int_
<< lit("px")
<< lit("\" height=\"") << int_ << lit("px")
<< lit("\" version=\"") << double_
<< lit("\" xmlns=\"") << kstring
<< lit("\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"");
}
explicit svg_root_attributes_grammar();
karma::rule<OutputIterator, mapnik::svg::root_output_attributes()> svg_root_attributes;
};
}

View file

@ -0,0 +1,103 @@
/*****************************************************************************
*
* 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
*
*****************************************************************************/
// NOTE: This is an implementation header file and is only meant to be included
// from implementation files. It therefore doesn't have an include guard.
// mapnik
#include <mapnik/svg/output/svg_output_grammars.hpp>
#include <boost/spirit/include/karma.hpp>
#include <boost/fusion/include/std_pair.hpp>
namespace mapnik { namespace svg {
using namespace boost::spirit;
template <typename OutputIterator>
svg_path_attributes_grammar<OutputIterator>::svg_path_attributes_grammar()
: svg_path_attributes_grammar::base_type(svg_path_attributes)
{
karma::lit_type lit;
karma::double_type double_;
karma::string_type kstring;
svg_path_attributes =
lit("fill=\"")
<< kstring
<< lit("\" fill-opacity=\"") << double_
<< lit("\" stroke=\"") << kstring
<< lit("\" stroke-opacity=\"") << double_
<< lit("\" stroke-width=\"") << double_ << lit("px")
<< lit("\" stroke-linecap=\"") << kstring
<< lit("\" stroke-linejoin=\"") << kstring
<< lit("\" stroke-dashoffset=\"") << double_ << lit("px") << lit('"');
}
template <typename OutputIterator>
svg_path_dash_array_grammar<OutputIterator>::svg_path_dash_array_grammar()
: svg_path_dash_array_grammar::base_type(svg_path_dash_array)
{
karma::double_type double_;
karma::lit_type lit;
svg_path_dash_array = lit("stroke-dasharray=\"") <<
-((double_ << lit(',') << double_) % lit(',')) << lit('"');
}
template <typename OutputIterator>
svg_rect_attributes_grammar<OutputIterator>::svg_rect_attributes_grammar()
: svg_rect_attributes_grammar::base_type(svg_rect_attributes)
{
karma::lit_type lit;
karma::int_type int_;
karma::string_type kstring;
svg_rect_attributes =
lit("x=\"")
<< int_
<< lit("\" y=\"") << int_
<< lit("\" width=\"") << int_ << lit("px")
<< lit("\" height=\"") << int_ << lit("px")
<< lit("\" fill=\"") << kstring << lit('"');
}
template <typename OutputIterator>
svg_root_attributes_grammar<OutputIterator>::svg_root_attributes_grammar()
: svg_root_attributes_grammar::base_type(svg_root_attributes)
{
karma::lit_type lit;
karma::int_type int_;
karma::string_type kstring;
karma::double_type double_;
svg_root_attributes =
lit("width=\"")
<< int_
<< lit("px")
<< lit("\" height=\"") << int_ << lit("px")
<< lit("\" version=\"") << double_
<< lit("\" xmlns=\"") << kstring
<< lit("\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"");
}
}
}

View file

@ -25,7 +25,6 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/image_scaling.hpp>
#include <mapnik/image_compositing.hpp>
#include <mapnik/simplify.hpp>
@ -36,9 +35,8 @@
#include <mapnik/parse_path.hpp>
#include <mapnik/color.hpp>
#include <mapnik/symbolizer_keys.hpp>
#include <mapnik/raster_colorizer.hpp>
#include <mapnik/group/group_symbolizer_properties.hpp>
#include <mapnik/attribute.hpp>
#include <mapnik/symbolizer_base.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/text/font_feature_settings.hpp>
#include <mapnik/util/dasharray_parser.hpp>
@ -46,7 +44,6 @@
// stl
#include <type_traits>
#include <algorithm>
#include <memory>
#include <vector>
#include <string>
@ -57,95 +54,9 @@
// boost
#include <boost/optional.hpp>
namespace agg { struct trans_affine; }
namespace mapnik
{
// fwd declares
// TODO - move these transform declares to own header
namespace detail { struct transform_node; }
using transform_list = std::vector<detail::transform_node>;
using transform_list_ptr = std::shared_ptr<transform_list>;
using transform_type = transform_list_ptr;
class feature_impl;
MAPNIK_DECL void evaluate_transform(agg::trans_affine& tr,
feature_impl const& feature,
attributes const& vars,
transform_type const& trans_expr,
double scale_factor=1.0);
struct enumeration_wrapper
{
int value;
enumeration_wrapper() = delete;
template <typename T>
explicit enumeration_wrapper(T value_)
: value(value_) {}
inline operator int() const
{
return value;
}
};
using dash_array = std::vector<std::pair<double,double> >;
class text_placements;
using text_placements_ptr = std::shared_ptr<text_placements>;
namespace detail {
using value_base_type = util::variant<value_bool,
value_integer,
enumeration_wrapper,
value_double,
std::string,
color,
expression_ptr,
path_expression_ptr,
transform_type,
text_placements_ptr,
dash_array,
raster_colorizer_ptr,
group_symbolizer_properties_ptr,
font_feature_settings_ptr>;
struct strict_value : value_base_type
{
// default ctor
strict_value()
: value_base_type() {}
// copy ctor
strict_value(const char* val)
: value_base_type(val) {}
template <typename T>
strict_value(T const& obj)
: value_base_type(typename detail::mapnik_value_type<T>::type(obj))
{}
// move ctor
template <typename T>
strict_value(T && obj) noexcept
: value_base_type(std::move(obj)) {}
};
}
struct MAPNIK_DECL symbolizer_base
{
using value_type = detail::strict_value;
using key_type = mapnik::keys;
using cont_type = std::map<key_type, value_type>;
cont_type properties;
};
inline bool is_expression(symbolizer_base::value_type const& val)
{
return val.is<expression_ptr>();
}
// symbolizer properties target types
enum class property_types : std::uint8_t
{
@ -183,12 +94,6 @@ enum class property_types : std::uint8_t
target_font_feature_settings
};
inline bool operator==(symbolizer_base const& lhs, symbolizer_base const& rhs)
{
return lhs.properties.size() == rhs.properties.size() &&
std::equal(lhs.properties.begin(), lhs.properties.end(), rhs.properties.begin());
}
template <typename T>
struct evaluate_path_wrapper
{
@ -563,33 +468,6 @@ using property_meta_type = std::tuple<const char*, mapnik::symbolizer_base::valu
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 {};
struct MAPNIK_DECL line_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL polygon_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL text_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL shield_symbolizer : public text_symbolizer {};
struct MAPNIK_DECL line_pattern_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL polygon_pattern_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL markers_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL raster_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL building_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL group_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL debug_symbolizer : public symbolizer_base {};
// symbolizer
using symbolizer = util::variant<point_symbolizer,
line_symbolizer,
line_pattern_symbolizer,
polygon_symbolizer,
polygon_pattern_symbolizer,
raster_symbolizer,
shield_symbolizer,
text_symbolizer,
building_symbolizer,
markers_symbolizer,
group_symbolizer,
debug_symbolizer>;
}

View file

@ -0,0 +1,169 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2013 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef MAPNIK_SYMBOLIZER_BASE_HPP
#define MAPNIK_SYMBOLIZER_BASE_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/path_expression.hpp>
#include <mapnik/symbolizer_keys.hpp>
#include <mapnik/raster_colorizer.hpp>
#include <mapnik/group/group_symbolizer_properties.hpp>
#include <mapnik/attribute.hpp>
#include <mapnik/text/font_feature_settings.hpp>
#include <mapnik/util/variant.hpp>
// stl
#include <memory>
#include <vector>
#include <iosfwd>
#include <map>
namespace agg { struct trans_affine; }
namespace mapnik
{
// fwd declares
// TODO - move these transform declares to own header
namespace detail { struct transform_node; }
using transform_list = std::vector<detail::transform_node>;
using transform_list_ptr = std::shared_ptr<transform_list>;
using transform_type = transform_list_ptr;
class feature_impl;
MAPNIK_DECL void evaluate_transform(agg::trans_affine& tr,
feature_impl const& feature,
attributes const& vars,
transform_type const& trans_expr,
double scale_factor=1.0);
struct enumeration_wrapper
{
int value;
enumeration_wrapper() = delete;
template <typename T>
explicit enumeration_wrapper(T value_)
: value(value_) {}
inline operator int() const
{
return value;
}
};
using dash_array = std::vector<std::pair<double,double> >;
class text_placements;
using text_placements_ptr = std::shared_ptr<text_placements>;
namespace detail {
using value_base_type = util::variant<value_bool,
value_integer,
enumeration_wrapper,
value_double,
std::string,
color,
expression_ptr,
path_expression_ptr,
transform_type,
text_placements_ptr,
dash_array,
raster_colorizer_ptr,
group_symbolizer_properties_ptr,
font_feature_settings_ptr>;
struct strict_value : value_base_type
{
// default ctor
strict_value()
: value_base_type() {}
// copy ctor
strict_value(const char* val)
: value_base_type(val) {}
template <typename T>
strict_value(T const& obj)
: value_base_type(typename detail::mapnik_value_type<T>::type(obj))
{}
// move ctor
template <typename T>
strict_value(T && obj) noexcept
: value_base_type(std::move(obj)) {}
};
}
struct MAPNIK_DECL symbolizer_base
{
using value_type = detail::strict_value;
using key_type = mapnik::keys;
using cont_type = std::map<key_type, value_type>;
cont_type properties;
};
inline bool is_expression(symbolizer_base::value_type const& val)
{
return val.is<expression_ptr>();
}
inline bool operator==(symbolizer_base const& lhs, symbolizer_base const& rhs)
{
return lhs.properties.size() == rhs.properties.size() &&
std::equal(lhs.properties.begin(), lhs.properties.end(), rhs.properties.begin());
}
// concrete symbolizer types
struct MAPNIK_DECL point_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL line_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL polygon_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL text_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL shield_symbolizer : public text_symbolizer {};
struct MAPNIK_DECL line_pattern_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL polygon_pattern_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL markers_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL raster_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL building_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL group_symbolizer : public symbolizer_base {};
struct MAPNIK_DECL debug_symbolizer : public symbolizer_base {};
// symbolizer
using symbolizer = util::variant<point_symbolizer,
line_symbolizer,
line_pattern_symbolizer,
polygon_symbolizer,
polygon_pattern_symbolizer,
raster_symbolizer,
shield_symbolizer,
text_symbolizer,
building_symbolizer,
markers_symbolizer,
group_symbolizer,
debug_symbolizer>;
}
#endif // MAPNIK_SYMBOLIZER_BASE_HPP

View file

@ -24,7 +24,7 @@
#define MAPNIK_SYMBOLIZER_HASH_HPP
// mapnik
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_base.hpp>
#include <mapnik/util/variant.hpp>
// stl
#include <typeinfo>

View file

@ -437,7 +437,7 @@ struct set_symbolizer_property_impl<Symbolizer, T, true>
boost::optional<std::string> enum_str = node.get_opt_attr<std::string>(name);
if (enum_str)
{
boost::optional<T> enum_val = detail::enum_traits<T>::from_string(*enum_str);
boost::optional<value_type> enum_val = detail::enum_traits<value_type>::from_string(*enum_str);
if (enum_val)
{
put(sym, key, *enum_val);
@ -451,7 +451,7 @@ struct set_symbolizer_property_impl<Symbolizer, T, true>
auto result = pre_evaluate_expression<value>(*val);
if (std::get<1>(result))
{
boost::optional<T> enum_val = detail::enum_traits<T>::from_string(std::get<0>(result).to_string());
boost::optional<value_type> enum_val = detail::enum_traits<value_type>::from_string(std::get<0>(result).to_string());
if (enum_val)
{
put(sym, key, *enum_val);

View file

@ -23,14 +23,18 @@
#ifndef FORMATTING_FORMAT_HPP
#define FORMATTING_FORMAT_HPP
// mapnik
#include <mapnik/text/formatting/base.hpp>
#include <mapnik/text/text_properties.hpp>
#include <mapnik/feature.hpp>
// boost
#include <boost/property_tree/ptree_fwd.hpp>
namespace mapnik { namespace formatting {
namespace mapnik {
class feature_impl;
namespace formatting {
class MAPNIK_DECL format_node: public node
{

View file

@ -24,12 +24,17 @@
// mapnik
#include <mapnik/text/formatting/base.hpp>
#include <mapnik/feature.hpp>
// boost
#include <boost/property_tree/ptree_fwd.hpp>
// stl
#include <vector>
namespace mapnik {
class feature_impl;
namespace formatting {
class MAPNIK_DECL list_node: public node {
public:

View file

@ -22,13 +22,16 @@
#ifndef FORMATTING_TEXT_HPP
#define FORMATTING_TEXT_HPP
// mapnik
#include <mapnik/text/formatting/base.hpp>
#include <mapnik/feature.hpp>
// boost
#include <boost/property_tree/ptree_fwd.hpp>
namespace mapnik {
class feature_impl;
namespace formatting {
class MAPNIK_DECL text_node: public node {
public:

View file

@ -29,7 +29,6 @@
#include <mapnik/text/placements/base.hpp>
#include <mapnik/text/placements_list.hpp>
#include <mapnik/text/rotation.hpp>
#include <mapnik/text/vertex_cache.hpp>
#include <mapnik/noncopyable.hpp>
namespace mapnik
@ -40,6 +39,8 @@ using DetectorType = label_collision_detector4;
class feature_impl;
class vertex_cache;
class text_placement_info;
struct glyph_info;
class placement_finder : mapnik::noncopyable
{

View file

@ -24,7 +24,6 @@
//mapnik
#include <mapnik/box2d.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/text/glyph_info.hpp>
#include <mapnik/text/rotation.hpp>
#include <mapnik/marker_cache.hpp>

View file

@ -23,13 +23,15 @@
#ifndef MAPNIK_PROPERTIES_UTIL_HPP
#define MAPNIK_PROPERTIES_UTIL_HPP
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_base.hpp>
#include <mapnik/xml_node.hpp>
#include <mapnik/ptree_helpers.hpp>
#include <mapnik/config_error.hpp>
#include <boost/optional.hpp>
#include <string>
// boost
#include <boost/property_tree/ptree_fwd.hpp>
namespace mapnik { namespace detail {
template <typename T, class Enable = void>

View file

@ -26,7 +26,7 @@
// mapnik
#include <mapnik/text/placement_finder.hpp>
#include <mapnik/image_compositing.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/noncopyable.hpp>
// agg
#include <agg_trans_affine.h>

View file

@ -23,17 +23,16 @@
#define SYMBOLIZER_HELPERS_HPP
//mapnik
#include <mapnik/symbolizer.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/marker.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/text/placement_finder.hpp>
#include <mapnik/proj_transform.hpp>
#include <mapnik/view_transform.hpp>
#include <mapnik/vertex_converters.hpp>
namespace mapnik {
class feature_impl;
class proj_transform;
class view_transform;
struct symbolizer_base;
template <typename T>
struct placement_finder_adapter
{

View file

@ -27,21 +27,29 @@
#include <mapnik/color.hpp>
#include <mapnik/attribute.hpp>
#include <mapnik/value.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/font_set.hpp>
#include <mapnik/enumeration.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/text/formatting/base.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_base.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/noncopyable.hpp>
// stl
#include <map>
#include <functional>
// boost
#include <boost/optional.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
namespace mapnik { namespace detail {
namespace mapnik {
class feature_impl;
class text_layout;
namespace detail {
struct evaluated_format_properties
{
@ -134,8 +142,6 @@ struct MAPNIK_DECL text_layout_properties
[](double dx, double dy) { return pixel_position(dx,dy);};
};
class text_layout;
struct text_properties_expressions
{
symbolizer_base::value_type label_placement = enumeration_wrapper(POINT_PLACEMENT);

View file

@ -37,7 +37,7 @@
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/symbolizer_keys.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/geometry.hpp>
// agg
#include "agg_math_stroke.h"
#include "agg_trans_affine.h"
@ -390,10 +390,9 @@ struct vertex_converter : private mapnik::noncopyable
double scale_factor)
: disp_(proc,bbox,sym,tr,prj_trans,affine_trans,feature,vars,scale_factor) {}
template <typename Geometry>
void apply(Geometry & geom)
void apply(geometry_type & geom)
{
detail::converters_helper<dispatcher_type, ConverterTypes...>:: template forward<Geometry>(disp_, geom);
detail::converters_helper<dispatcher_type, ConverterTypes...>:: template forward<geometry_type>(disp_, geom);
}
template <typename Converter>

View file

@ -40,6 +40,8 @@
// boost
#include <boost/bind.hpp>
#include <cstdint>
namespace {
uint8_t
@ -48,7 +50,7 @@ read_uint8(const uint8_t** from) {
}
uint16_t
read_uint16(const boost::uint8_t** from, boost::uint8_t littleEndian) {
read_uint16(const uint8_t** from, uint8_t littleEndian) {
uint16_t ret = 0;
if (littleEndian) {
@ -71,7 +73,7 @@ read_int16(const uint8_t** from, uint8_t littleEndian) {
}
double
read_float64(const boost::uint8_t** from, boost::uint8_t littleEndian) {
read_float64(const uint8_t** from, uint8_t littleEndian) {
union {
double d;
@ -104,7 +106,7 @@ read_float64(const boost::uint8_t** from, boost::uint8_t littleEndian) {
}
uint32_t
read_uint32(const boost::uint8_t** from, boost::uint8_t littleEndian) {
read_uint32(const uint8_t** from, uint8_t littleEndian) {
uint32_t ret = 0;
if (littleEndian) {
@ -125,7 +127,7 @@ read_uint32(const boost::uint8_t** from, boost::uint8_t littleEndian) {
}
int32_t
read_int32(const boost::uint8_t** from, boost::uint8_t littleEndian) {
read_int32(const uint8_t** from, uint8_t littleEndian) {
return read_uint32(from, littleEndian);
}

View file

@ -28,6 +28,7 @@
#include <mapnik/agg_rasterizer.hpp>
#include <mapnik/agg_helpers.hpp>
#include <mapnik/segment.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/expression_evaluator.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/renderer_common/process_building_symbolizer.hpp>

View file

@ -24,6 +24,7 @@
#include <mapnik/feature.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/graphics.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/label_collision_detector.hpp>
namespace mapnik {

View file

@ -346,6 +346,7 @@ if env['GRID_RENDERER']:
if env['SVG_RENDERER']: # svg backend
source += Split(
"""
svg/output/svg_output_grammars.cpp
svg/output/svg_renderer.cpp
svg/output/svg_generator.cpp
svg/output/svg_output_attributes.cpp

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/make_unique.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/proj_transform.hpp>
#include <mapnik/cairo/cairo_renderer.hpp>
#include <mapnik/transform_path_adapter.hpp>

View file

@ -24,6 +24,7 @@
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/proj_transform.hpp>
#include <mapnik/cairo/cairo_renderer.hpp>
#include <mapnik/label_collision_detector.hpp>

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/make_unique.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/proj_transform.hpp>
#include <mapnik/cairo/cairo_renderer.hpp>

View file

@ -26,7 +26,7 @@
#include <mapnik/cairo/cairo_renderer.hpp>
#include <mapnik/text/symbolizer_helpers.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/symbolizer.hpp>
namespace mapnik
{

View file

@ -33,11 +33,9 @@
#include <mapnik/segment.hpp>
#include <mapnik/expression_evaluator.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/renderer_common/process_building_symbolizer.hpp>
// boost
// stl
#include <deque>

View file

@ -20,8 +20,10 @@
*
*****************************************************************************/
// mapnik
#include <mapnik/renderer_common/process_group_symbolizer.hpp>
#include <mapnik/renderer_common/process_point_symbolizer.hpp>
#include <mapnik/text/glyph_info.hpp>
namespace mapnik {

View file

@ -22,6 +22,7 @@
// mapnik
#include <mapnik/rule.hpp>
#include <mapnik/expression_node.hpp>
// stl
#include <limits>

View file

@ -24,6 +24,8 @@
// mapnik
#include <mapnik/svg/output/svg_renderer.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
namespace mapnik
{

View file

@ -24,6 +24,8 @@
// mapnik
#include <mapnik/svg/output/svg_renderer.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
namespace mapnik
{

View file

@ -23,6 +23,7 @@
#if defined(SVG_RENDERER)
// mapnik
#include <mapnik/symbolizer.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/transform_path_adapter.hpp>
#include <mapnik/svg/output/svg_renderer.hpp>

View file

@ -0,0 +1,31 @@
/*****************************************************************************
*
* 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
*
*****************************************************************************/
#include <mapnik/svg/output/svg_output_attributes.hpp>
#include <mapnik/svg/output/svg_output_grammars.hpp>
#include <mapnik/svg/output/svg_output_grammars_impl.hpp>
#include <string>
template struct mapnik::svg::svg_path_attributes_grammar<std::ostream_iterator<char> >;
template struct mapnik::svg::svg_path_dash_array_grammar<std::ostream_iterator<char> >;
template struct mapnik::svg::svg_rect_attributes_grammar<std::ostream_iterator<char> >;
template struct mapnik::svg::svg_root_attributes_grammar<std::ostream_iterator<char> >;

View file

@ -23,6 +23,7 @@
// mapnik
#include <mapnik/debug.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/text/formatting/format.hpp>
#include <mapnik/text/properties_util.hpp>
#include <mapnik/ptree_helpers.hpp>

View file

@ -23,9 +23,9 @@
// mapnik
#include <mapnik/text/formatting/list.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
// boost
#include <boost/property_tree/ptree.hpp>
namespace mapnik {

View file

@ -24,6 +24,7 @@
#include <mapnik/expression_string.hpp>
#include <mapnik/expression_evaluator.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/text/text_properties.hpp>
#include <mapnik/xml_node.hpp>
#include <mapnik/text/text_layout.hpp>

View file

@ -26,6 +26,7 @@
#include <mapnik/expression_evaluator.hpp>
#include <mapnik/text/placement_finder_impl.hpp>
#include <mapnik/text/text_layout.hpp>
#include <mapnik/text/glyph_info.hpp>
#include <mapnik/text/text_properties.hpp>
#include <mapnik/text/placements_list.hpp>
#include <mapnik/text/vertex_cache.hpp>

View file

@ -22,6 +22,8 @@
#include <mapnik/text/properties_util.hpp>
#include <mapnik/expression_string.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/ptree_helpers.hpp>
#include <mapnik/text/font_feature_settings.hpp>
namespace mapnik { namespace detail {

View file

@ -25,6 +25,9 @@
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/text/text_layout.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/marker.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/parse_path.hpp>
#include <mapnik/debug.hpp>

View file

@ -24,6 +24,8 @@
#include <mapnik/text/text_properties.hpp>
#include <mapnik/expression_evaluator.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/text/harfbuzz_shaper.hpp>
#include <mapnik/make_unique.hpp>
// ICU

View file

@ -24,6 +24,7 @@
#include <mapnik/text/text_layout.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/ptree_helpers.hpp>
#include <mapnik/expression_string.hpp>
#include <mapnik/text/formatting/text.hpp>