make mapnik::symbolizer a mapnik::util::variant<Symbolizers...>
This commit is contained in:
parent
201641a206
commit
3f8c459195
8 changed files with 39 additions and 38 deletions
|
@ -131,7 +131,7 @@ boost::python::object __getitem__(mapnik::symbolizer_base const& sym, std::strin
|
||||||
|
|
||||||
std::string __str__(mapnik::symbolizer const& sym)
|
std::string __str__(mapnik::symbolizer const& sym)
|
||||||
{
|
{
|
||||||
return boost::apply_visitor(mapnik::symbolizer_to_json(), sym);
|
return mapnik::util::apply_visitor(mapnik::symbolizer_to_json(), sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_symbolizer_type(symbolizer const& sym)
|
std::string get_symbolizer_type(symbolizer const& sym)
|
||||||
|
@ -141,7 +141,7 @@ std::string get_symbolizer_type(symbolizer const& sym)
|
||||||
|
|
||||||
std::size_t hash_impl(symbolizer const& sym)
|
std::size_t hash_impl(symbolizer const& sym)
|
||||||
{
|
{
|
||||||
return boost::apply_visitor(mapnik::symbolizer_hash_visitor(), sym);
|
return mapnik::util::apply_visitor(mapnik::symbolizer_hash_visitor(), sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -150,7 +150,7 @@ std::size_t hash_impl_2(T const& sym)
|
||||||
return mapnik::symbolizer_hash::value<T>(sym);
|
return mapnik::symbolizer_hash::value<T>(sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct extract_underlying_type_visitor : boost::static_visitor<boost::python::object>
|
struct extract_underlying_type_visitor : mapnik::util::static_visitor<boost::python::object>
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
boost::python::object operator() (T const& sym) const
|
boost::python::object operator() (T const& sym) const
|
||||||
|
@ -161,7 +161,7 @@ struct extract_underlying_type_visitor : boost::static_visitor<boost::python::ob
|
||||||
|
|
||||||
boost::python::object extract_underlying_type(symbolizer const& sym)
|
boost::python::object extract_underlying_type(symbolizer const& sym)
|
||||||
{
|
{
|
||||||
return boost::apply_visitor(extract_underlying_type_visitor(), sym);
|
return mapnik::util::apply_visitor(extract_underlying_type_visitor(), sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ private:
|
||||||
expression_attributes<std::set<std::string> > f_attr_;
|
expression_attributes<std::set<std::string> > f_attr_;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct symbolizer_attributes : public boost::static_visitor<>
|
struct symbolizer_attributes : public util::static_visitor<>
|
||||||
{
|
{
|
||||||
symbolizer_attributes(std::set<std::string>& names,
|
symbolizer_attributes(std::set<std::string>& names,
|
||||||
double & filter_factor)
|
double & filter_factor)
|
||||||
|
@ -210,7 +210,7 @@ private:
|
||||||
class attribute_collector : public mapnik::noncopyable
|
class attribute_collector : public mapnik::noncopyable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::set<std::string>& names_;
|
std::set<std::string> & names_;
|
||||||
double filter_factor_;
|
double filter_factor_;
|
||||||
expression_attributes<std::set<std::string> > f_attr;
|
expression_attributes<std::set<std::string> > f_attr;
|
||||||
public:
|
public:
|
||||||
|
@ -224,9 +224,9 @@ public:
|
||||||
{
|
{
|
||||||
typename RuleType::symbolizers const& symbols = r.get_symbolizers();
|
typename RuleType::symbolizers const& symbols = r.get_symbolizers();
|
||||||
symbolizer_attributes s_attr(names_,filter_factor_);
|
symbolizer_attributes s_attr(names_,filter_factor_);
|
||||||
for (auto symbol : symbols)
|
for (auto const& sym : symbols)
|
||||||
{
|
{
|
||||||
boost::apply_visitor(s_attr,symbol);
|
util::apply_visitor(std::ref(s_attr), sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
expression_ptr const& expr = r.get_filter();
|
expression_ptr const& expr = r.get_filter();
|
||||||
|
@ -256,12 +256,13 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym)
|
||||||
|
|
||||||
// get columns from child rules and symbolizers
|
// get columns from child rules and symbolizers
|
||||||
group_symbolizer_properties_ptr props = get<group_symbolizer_properties_ptr>(sym, keys::group_properties);
|
group_symbolizer_properties_ptr props = get<group_symbolizer_properties_ptr>(sym, keys::group_properties);
|
||||||
if (props) {
|
if (props)
|
||||||
|
{
|
||||||
for (auto const& rule : props->get_rules())
|
for (auto const& rule : props->get_rules())
|
||||||
{
|
{
|
||||||
// note that this recurses down on to the symbolizer
|
// note that this recurses down on to the symbolizer
|
||||||
// internals too, so we get all free variables.
|
// internals too, so we get all free variables.
|
||||||
column_collector(*rule);
|
// FIXME column_collector(*rule);
|
||||||
// still need to collect repeat key columns
|
// still need to collect repeat key columns
|
||||||
if (rule->get_repeat_key())
|
if (rule->get_repeat_key())
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,10 +44,10 @@
|
||||||
#include <mapnik/projection.hpp>
|
#include <mapnik/projection.hpp>
|
||||||
#include <mapnik/proj_transform.hpp>
|
#include <mapnik/proj_transform.hpp>
|
||||||
#include <mapnik/util/featureset_buffer.hpp>
|
#include <mapnik/util/featureset_buffer.hpp>
|
||||||
|
#include <mapnik/util/variant.hpp>
|
||||||
// boost
|
// boost
|
||||||
#include <boost/variant/apply_visitor.hpp>
|
#include <boost/variant/apply_visitor.hpp>
|
||||||
#include <boost/variant/static_visitor.hpp>
|
//#include <boost/variant/static_visitor.hpp>
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -87,7 +87,7 @@ struct process_impl<false>
|
||||||
* \param sym Symbolizer object
|
* \param sym Symbolizer object
|
||||||
*/
|
*/
|
||||||
template <typename Processor>
|
template <typename Processor>
|
||||||
struct feature_style_processor<Processor>::symbol_dispatch : public boost::static_visitor<>
|
struct feature_style_processor<Processor>::symbol_dispatch : public util::static_visitor<>
|
||||||
{
|
{
|
||||||
symbol_dispatch (Processor & output,
|
symbol_dispatch (Processor & output,
|
||||||
mapnik::feature_impl & f,
|
mapnik::feature_impl & f,
|
||||||
|
@ -665,7 +665,7 @@ void feature_style_processor<Processor>::render_style(
|
||||||
{
|
{
|
||||||
for (symbolizer const& sym : symbols)
|
for (symbolizer const& sym : symbols)
|
||||||
{
|
{
|
||||||
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
|
util::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (style->get_filter_mode() == FILTER_FIRST)
|
if (style->get_filter_mode() == FILTER_FIRST)
|
||||||
|
@ -686,7 +686,7 @@ void feature_style_processor<Processor>::render_style(
|
||||||
{
|
{
|
||||||
for (symbolizer const& sym : symbols)
|
for (symbolizer const& sym : symbols)
|
||||||
{
|
{
|
||||||
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
|
util::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -701,7 +701,7 @@ void feature_style_processor<Processor>::render_style(
|
||||||
{
|
{
|
||||||
for (symbolizer const& sym : symbols)
|
for (symbolizer const& sym : symbols)
|
||||||
{
|
{
|
||||||
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
|
util::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ using render_thunk_list = std::list<render_thunk_ptr>;
|
||||||
// The bounding boxes can be used for layout, and the thunks are
|
// The bounding boxes can be used for layout, and the thunks are
|
||||||
// used to re-render at locations according to the group layout.
|
// used to re-render at locations according to the group layout.
|
||||||
|
|
||||||
struct render_thunk_extractor : public boost::static_visitor<>
|
struct render_thunk_extractor : public util::static_visitor<>
|
||||||
{
|
{
|
||||||
render_thunk_extractor(box2d<double> & box,
|
render_thunk_extractor(box2d<double> & box,
|
||||||
render_thunk_list & thunks,
|
render_thunk_list & thunks,
|
||||||
|
@ -280,7 +280,7 @@ void render_group_symbolizer(group_symbolizer const& sym,
|
||||||
for (auto const& sym : *rule)
|
for (auto const& sym : *rule)
|
||||||
{
|
{
|
||||||
// TODO: construct layout and obtain bounding box
|
// TODO: construct layout and obtain bounding box
|
||||||
boost::apply_visitor(extractor, sym);
|
util::apply_visitor(extractor, sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the bounding box to the layout manager
|
// add the bounding box to the layout manager
|
||||||
|
|
|
@ -536,18 +536,18 @@ struct MAPNIK_DECL group_symbolizer : public symbolizer_base {};
|
||||||
struct MAPNIK_DECL debug_symbolizer : public symbolizer_base {};
|
struct MAPNIK_DECL debug_symbolizer : public symbolizer_base {};
|
||||||
|
|
||||||
// symbolizer
|
// symbolizer
|
||||||
using symbolizer = boost::variant<point_symbolizer,
|
using symbolizer = util::variant<point_symbolizer,
|
||||||
line_symbolizer,
|
line_symbolizer,
|
||||||
line_pattern_symbolizer,
|
line_pattern_symbolizer,
|
||||||
polygon_symbolizer,
|
polygon_symbolizer,
|
||||||
polygon_pattern_symbolizer,
|
polygon_pattern_symbolizer,
|
||||||
raster_symbolizer,
|
raster_symbolizer,
|
||||||
shield_symbolizer,
|
shield_symbolizer,
|
||||||
text_symbolizer,
|
text_symbolizer,
|
||||||
building_symbolizer,
|
building_symbolizer,
|
||||||
markers_symbolizer,
|
markers_symbolizer,
|
||||||
group_symbolizer,
|
group_symbolizer,
|
||||||
debug_symbolizer>;
|
debug_symbolizer>;
|
||||||
|
|
||||||
using dash_array = std::vector<std::pair<double,double> >;
|
using dash_array = std::vector<std::pair<double,double> >;
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct symbolizer_hash
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct symbolizer_hash_visitor : boost::static_visitor<std::size_t>
|
struct symbolizer_hash_visitor : util::static_visitor<std::size_t>
|
||||||
{
|
{
|
||||||
template <typename Symbolizer>
|
template <typename Symbolizer>
|
||||||
std::size_t operator() (Symbolizer const& sym) const
|
std::size_t operator() (Symbolizer const& sym) const
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include <mapnik/parse_transform.hpp>
|
#include <mapnik/parse_transform.hpp>
|
||||||
#include <mapnik/util/variant.hpp>
|
#include <mapnik/util/variant.hpp>
|
||||||
// boost
|
// boost
|
||||||
#include <boost/variant/apply_visitor.hpp>
|
//#include <boost/variant/apply_visitor.hpp>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ struct symbolizer_traits<debug_symbolizer>
|
||||||
// symbolizer name impl
|
// symbolizer name impl
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
struct symbolizer_name_impl : public boost::static_visitor<std::string>
|
struct symbolizer_name_impl : public util::static_visitor<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template <typename Symbolizer>
|
template <typename Symbolizer>
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
|
|
||||||
inline std::string symbolizer_name(symbolizer const& sym)
|
inline std::string symbolizer_name(symbolizer const& sym)
|
||||||
{
|
{
|
||||||
std::string type = boost::apply_visitor( detail::symbolizer_name_impl(), sym);
|
std::string type = util::apply_visitor( detail::symbolizer_name_impl(), sym);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ private:
|
||||||
Meta const& meta_;
|
Meta const& meta_;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct symbolizer_to_json : public boost::static_visitor<std::string>
|
struct symbolizer_to_json : public util::static_visitor<std::string>
|
||||||
{
|
{
|
||||||
using result_type = std::string;
|
using result_type = std::string;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
struct symbol_type_dispatch : public boost::static_visitor<bool>
|
struct symbol_type_dispatch : public util::static_visitor<bool>
|
||||||
{
|
{
|
||||||
template <typename Symbolizer>
|
template <typename Symbolizer>
|
||||||
bool operator()(Symbolizer const& sym) const
|
bool operator()(Symbolizer const& sym) const
|
||||||
|
@ -51,7 +51,7 @@ struct symbol_type_dispatch : public boost::static_visitor<bool>
|
||||||
|
|
||||||
bool is_path_based(symbolizer const& sym)
|
bool is_path_based(symbolizer const& sym)
|
||||||
{
|
{
|
||||||
return boost::apply_visitor(symbol_type_dispatch(), sym);
|
return util::apply_visitor(symbol_type_dispatch(), sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename OutputIterator, typename PathType>
|
template <typename OutputIterator, typename PathType>
|
||||||
|
@ -86,7 +86,7 @@ bool svg_renderer<OutputIterator>::process(rule::symbolizers const& syms,
|
||||||
{
|
{
|
||||||
process_path = true;
|
process_path = true;
|
||||||
}
|
}
|
||||||
boost::apply_visitor(symbol_dispatch(*this, feature, prj_trans), sym);
|
util::apply_visitor(symbol_dispatch(*this, feature, prj_trans), sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process_path)
|
if (process_path)
|
||||||
|
|
Loading…
Reference in a new issue