more const
strictness, update to work with latest mapbox::variant/visitor-no-copy
branch
This commit is contained in:
parent
c7a964abf6
commit
d027ed67c7
21 changed files with 113 additions and 113 deletions
2
deps/mapbox/variant
vendored
2
deps/mapbox/variant
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 9afd6406065440e02b6bf42db4633b815846db0d
|
||||
Subproject commit f7b63cc1501bf9d9f740e9a8957a25bc9be5f1ca
|
|
@ -178,12 +178,12 @@ struct geom_reproj_copy_visitor
|
|||
: proj_trans_(proj_trans),
|
||||
n_err_(n_err) {}
|
||||
|
||||
geometry<T> operator() (geometry_empty const&)
|
||||
geometry<T> operator() (geometry_empty const&) const
|
||||
{
|
||||
return geometry_empty();
|
||||
}
|
||||
|
||||
geometry<T> operator() (point<T> const& p)
|
||||
geometry<T> operator() (point<T> const& p) const
|
||||
{
|
||||
geometry<T> geom; // default empty
|
||||
unsigned int intial_err = n_err_;
|
||||
|
@ -193,7 +193,7 @@ struct geom_reproj_copy_visitor
|
|||
return geom;
|
||||
}
|
||||
|
||||
geometry<T> operator() (line_string<T> const& ls)
|
||||
geometry<T> operator() (line_string<T> const& ls) const
|
||||
{
|
||||
geometry<T> geom; // default empty
|
||||
unsigned int intial_err = n_err_;
|
||||
|
@ -203,7 +203,7 @@ struct geom_reproj_copy_visitor
|
|||
return geom;
|
||||
}
|
||||
|
||||
geometry<T> operator() (polygon<T> const& poly)
|
||||
geometry<T> operator() (polygon<T> const& poly) const
|
||||
{
|
||||
geometry<T> geom; // default empty
|
||||
polygon<T> new_poly = reproject_internal(poly, proj_trans_, n_err_);
|
||||
|
@ -212,7 +212,7 @@ struct geom_reproj_copy_visitor
|
|||
return geom;
|
||||
}
|
||||
|
||||
geometry<T> operator() (multi_point<T> const& mp)
|
||||
geometry<T> operator() (multi_point<T> const& mp) const
|
||||
{
|
||||
geometry<T> geom; // default empty
|
||||
multi_point<T> new_mp = reproject_internal(mp, proj_trans_, n_err_);
|
||||
|
@ -221,7 +221,7 @@ struct geom_reproj_copy_visitor
|
|||
return geom;
|
||||
}
|
||||
|
||||
geometry<T> operator() (multi_line_string<T> const& mls)
|
||||
geometry<T> operator() (multi_line_string<T> const& mls) const
|
||||
{
|
||||
geometry<T> geom; // default empty
|
||||
multi_line_string<T> new_mls = reproject_internal(mls, proj_trans_, n_err_);
|
||||
|
@ -230,7 +230,7 @@ struct geom_reproj_copy_visitor
|
|||
return geom;
|
||||
}
|
||||
|
||||
geometry<T> operator() (multi_polygon<T> const& mpoly)
|
||||
geometry<T> operator() (multi_polygon<T> const& mpoly) const
|
||||
{
|
||||
geometry<T> geom; // default empty
|
||||
multi_polygon<T> new_mpoly = reproject_internal(mpoly, proj_trans_, n_err_);
|
||||
|
@ -239,7 +239,7 @@ struct geom_reproj_copy_visitor
|
|||
return geom;
|
||||
}
|
||||
|
||||
geometry<T> operator() (geometry_collection<T> const& c)
|
||||
geometry<T> operator() (geometry_collection<T> const& c) const
|
||||
{
|
||||
geometry<T> geom; // default empty
|
||||
geometry_collection<T> new_c = reproject_internal(c, proj_trans_, n_err_);
|
||||
|
@ -284,15 +284,15 @@ struct geom_reproj_visitor {
|
|||
: proj_trans_(proj_trans) {}
|
||||
|
||||
template <typename T>
|
||||
bool operator() (geometry<T> & geom)
|
||||
bool operator() (geometry<T> & geom) const
|
||||
{
|
||||
return mapnik::util::apply_visitor((*this), geom);
|
||||
}
|
||||
|
||||
bool operator() (geometry_empty &) { return true; }
|
||||
bool operator() (geometry_empty &) const { return true; }
|
||||
|
||||
template <typename T>
|
||||
bool operator() (point<T> & p)
|
||||
bool operator() (point<T> & p) const
|
||||
{
|
||||
if (!proj_trans_.forward(p))
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ struct geom_reproj_visitor {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator() (line_string<T> & ls)
|
||||
bool operator() (line_string<T> & ls) const
|
||||
{
|
||||
if (proj_trans_.forward(ls) > 0)
|
||||
{
|
||||
|
@ -312,7 +312,7 @@ struct geom_reproj_visitor {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator() (polygon<T> & poly)
|
||||
bool operator() (polygon<T> & poly) const
|
||||
{
|
||||
if (proj_trans_.forward(poly.exterior_ring) > 0)
|
||||
{
|
||||
|
@ -330,13 +330,13 @@ struct geom_reproj_visitor {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator() (multi_point<T> & mp)
|
||||
bool operator() (multi_point<T> & mp) const
|
||||
{
|
||||
return (*this) (static_cast<line_string<T> &>(mp));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator() (multi_line_string<T> & mls)
|
||||
bool operator() (multi_line_string<T> & mls) const
|
||||
{
|
||||
for (auto & ls : mls)
|
||||
{
|
||||
|
@ -349,7 +349,7 @@ struct geom_reproj_visitor {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator() (multi_polygon<T> & mpoly)
|
||||
bool operator() (multi_polygon<T> & mpoly) const
|
||||
{
|
||||
for (auto & poly : mpoly)
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ struct geom_reproj_visitor {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator() (geometry_collection<T> & c)
|
||||
bool operator() (geometry_collection<T> & c) const
|
||||
{
|
||||
for (auto & g : c)
|
||||
{
|
||||
|
|
|
@ -683,7 +683,7 @@ void color_blind_filter(Src & src, ColorBlindFilter const& op)
|
|||
using namespace boost::gil;
|
||||
rgba8_view_t src_view = rgba8_view(src);
|
||||
bool premultiplied = src.get_premultiplied();
|
||||
|
||||
|
||||
for (std::ptrdiff_t y = 0; y < src_view.height(); ++y)
|
||||
{
|
||||
rgba8_view_t::x_iterator src_it = src_view.row_begin(static_cast<long>(y));
|
||||
|
@ -738,7 +738,7 @@ void color_blind_filter(Src & src, ColorBlindFilter const& op)
|
|||
X = deviate_x * Y / deviate_y;
|
||||
Z = (1.0 - (deviate_x + deviate_y)) * Y / deviate_y;
|
||||
// Neutral grey calculated from luminance (in D65)
|
||||
double neutral_X = 0.312713 * Y / 0.329016;
|
||||
double neutral_X = 0.312713 * Y / 0.329016;
|
||||
double neutral_Z = 0.358271 * Y / 0.329016;
|
||||
// Difference between simulated color and neutral grey
|
||||
double diff_X = neutral_X - X;
|
||||
|
@ -761,12 +761,12 @@ void color_blind_filter(Src & src, ColorBlindFilter const& op)
|
|||
// Convert to RGB color space
|
||||
dr = X * 3.24071 + Y * -1.53726 + Z * -0.498571; // XYZ->RGB (sRGB:D65)
|
||||
dg = X * -0.969258 + Y * 1.87599 + Z * 0.0415557;
|
||||
db = X * 0.0556352 + Y * -0.203996 + Z * 1.05707;
|
||||
db = X * 0.0556352 + Y * -0.203996 + Z * 1.05707;
|
||||
// Compensate simulated color towards a neutral fit in RGB space
|
||||
double fit_r = ((dr < 0.0 ? 0.0 : 1.0) - dr) / diff_r;
|
||||
double fit_g = ((dg < 0.0 ? 0.0 : 1.0) - dg) / diff_g;
|
||||
double fit_b = ((db < 0.0 ? 0.0 : 1.0) - db) / diff_b;
|
||||
double adjust = std::max( (fit_r > 1.0 || fit_r < 0.0) ? 0.0 : fit_r,
|
||||
double adjust = std::max( (fit_r > 1.0 || fit_r < 0.0) ? 0.0 : fit_r,
|
||||
(fit_g > 1.0 || fit_g < 0.0) ? 0.0 : fit_g
|
||||
);
|
||||
adjust = std::max((fit_b > 1.0 || fit_b < 0.0) ? 0.0 : fit_b, adjust);
|
||||
|
@ -777,7 +777,7 @@ void color_blind_filter(Src & src, ColorBlindFilter const& op)
|
|||
// Apply gamma correction
|
||||
dr = std::pow(dr, 1.0 / 2.2);
|
||||
dg = std::pow(dg, 1.0 / 2.2);
|
||||
db = std::pow(db, 1.0 / 2.2);
|
||||
db = std::pow(db, 1.0 / 2.2);
|
||||
// premultiply
|
||||
dr *= da;
|
||||
dg *= da;
|
||||
|
@ -917,7 +917,7 @@ struct filter_visitor
|
|||
: src_(src) {}
|
||||
|
||||
template <typename T>
|
||||
void operator () (T const& filter)
|
||||
void operator () (T const& filter) const
|
||||
{
|
||||
apply_filter(src_, filter);
|
||||
}
|
||||
|
@ -931,9 +931,9 @@ struct filter_radius_visitor
|
|||
filter_radius_visitor(int & radius)
|
||||
: radius_(radius) {}
|
||||
template <typename T>
|
||||
void operator () (T const& /*filter*/) {}
|
||||
void operator () (T const& /*filter*/) const {}
|
||||
|
||||
void operator () (agg_stack_blur const& op)
|
||||
void operator () (agg_stack_blur const& op) const
|
||||
{
|
||||
if (static_cast<int>(op.rx) > radius_) radius_ = static_cast<int>(op.rx);
|
||||
if (static_cast<int>(op.ry) > radius_) radius_ = static_cast<int>(op.ry);
|
||||
|
|
|
@ -31,7 +31,7 @@ struct apply_vertex_converter
|
|||
apply_vertex_converter(VertexConverter & converter, Processor & proc)
|
||||
: converter_(converter), proc_(proc) {}
|
||||
template <typename Adapter>
|
||||
void operator() (Adapter const& adapter) const
|
||||
void operator() (Adapter const& adapter)
|
||||
{
|
||||
converter_.apply(adapter, proc_);
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ struct render_marker_symbolizer_visitor
|
|||
clip_box_(clip_box),
|
||||
renderer_context_(renderer_context) {}
|
||||
|
||||
void operator() (marker_null const&) {}
|
||||
void operator() (marker_null const&) const {}
|
||||
|
||||
void operator() (marker_svg const& mark)
|
||||
void operator() (marker_svg const& mark) const
|
||||
{
|
||||
using namespace mapnik::svg;
|
||||
bool clip = get<value_bool, keys::clip>(sym_, feature_, common_.vars_);
|
||||
|
@ -179,7 +179,7 @@ struct render_marker_symbolizer_visitor
|
|||
}
|
||||
}
|
||||
|
||||
void operator() (marker_rgba8 const& mark)
|
||||
void operator() (marker_rgba8 const& mark) const
|
||||
{
|
||||
using namespace mapnik::svg;
|
||||
bool clip = get<value_bool, keys::clip>(sym_, feature_, common_.vars_);
|
||||
|
|
|
@ -111,11 +111,11 @@ struct transform_processor
|
|||
vars_(v),
|
||||
scale_factor_(scale_factor) {}
|
||||
|
||||
void operator() (identity_node const&)
|
||||
void operator() (identity_node const&) const
|
||||
{
|
||||
}
|
||||
|
||||
void operator() (matrix_node const& node)
|
||||
void operator() (matrix_node const& node) const
|
||||
{
|
||||
double a = eval(node.a_); // scale x;
|
||||
double b = eval(node.b_);
|
||||
|
@ -126,21 +126,21 @@ struct transform_processor
|
|||
transform_.multiply(agg::trans_affine(a, b, c, d, e, f));
|
||||
}
|
||||
|
||||
void operator() (translate_node const& node)
|
||||
void operator() (translate_node const& node) const
|
||||
{
|
||||
double tx = eval(node.tx_) * scale_factor_;
|
||||
double ty = eval(node.ty_, 0.0) * scale_factor_;
|
||||
transform_.translate(tx, ty);
|
||||
}
|
||||
|
||||
void operator() (scale_node const& node)
|
||||
void operator() (scale_node const& node) const
|
||||
{
|
||||
double sx = eval(node.sx_);
|
||||
double sy = eval(node.sy_, sx);
|
||||
transform_.scale(sx, sy);
|
||||
}
|
||||
|
||||
void operator() (rotate_node const& node)
|
||||
void operator() (rotate_node const& node) const
|
||||
{
|
||||
double angle = deg2rad(eval(node.angle_));
|
||||
double cx = eval(node.cx_, 0.0);
|
||||
|
@ -150,7 +150,7 @@ struct transform_processor
|
|||
transform_.translate(cx, cy);
|
||||
}
|
||||
|
||||
void operator() (skewX_node const& node)
|
||||
void operator() (skewX_node const& node) const
|
||||
{
|
||||
auto degrees = std::fmod(eval(node.angle_),90.0);
|
||||
if (degrees < -89.0) degrees = -89.0;
|
||||
|
@ -159,7 +159,7 @@ struct transform_processor
|
|||
transform_.multiply(agg::trans_affine_skewing(angle, 0.0));
|
||||
}
|
||||
|
||||
void operator() (skewY_node const& node)
|
||||
void operator() (skewY_node const& node) const
|
||||
{
|
||||
auto degrees = std::fmod(eval(node.angle_),90.0);
|
||||
if (degrees < -89.0) degrees = -89.0;
|
||||
|
|
|
@ -46,30 +46,31 @@ public:
|
|||
|
||||
// unary visitor interface
|
||||
// const
|
||||
template <typename V, typename F>
|
||||
auto VARIANT_INLINE static apply_visitor(F f, V const& v) -> decltype(V::visit(v, f))
|
||||
template <typename F, typename V>
|
||||
auto VARIANT_INLINE static apply_visitor(F && f, V const& v) -> decltype(V::visit(v, f))
|
||||
{
|
||||
return V::visit(v, f);
|
||||
return V::visit(v, std::forward<F>(f));
|
||||
}
|
||||
// non-const
|
||||
template <typename V, typename F>
|
||||
auto VARIANT_INLINE static apply_visitor(F f, V & v) -> decltype(V::visit(v, f))
|
||||
template <typename F, typename V>
|
||||
auto VARIANT_INLINE static apply_visitor(F && f, V & v) -> decltype(V::visit(v, f))
|
||||
{
|
||||
return V::visit(v, f);
|
||||
return V::visit(v, std::forward<F>(f));
|
||||
}
|
||||
|
||||
// binary visitor interface
|
||||
// const
|
||||
template <typename V, typename F>
|
||||
auto VARIANT_INLINE static apply_visitor(F f, V const& v0, V const& v1) -> decltype(V::binary_visit(v0, v1, f))
|
||||
template <typename F, typename V>
|
||||
auto VARIANT_INLINE static apply_visitor(F && f, V const& v0, V const& v1) -> decltype(V::binary_visit(v0, v1, f))
|
||||
{
|
||||
return V::binary_visit(v0, v1, f);
|
||||
return V::binary_visit(v0, v1, std::forward<F>(f));
|
||||
}
|
||||
|
||||
// non-const
|
||||
template <typename V, typename F>
|
||||
auto VARIANT_INLINE static apply_visitor(F f, V & v0, V & v1) -> decltype(V::binary_visit(v0, v1, f))
|
||||
template <typename F, typename V>
|
||||
auto VARIANT_INLINE static apply_visitor(F && f, V & v0, V & v1) -> decltype(V::binary_visit(v0, v1, f))
|
||||
{
|
||||
return V::binary_visit(v0, v1, f);
|
||||
return V::binary_visit(v0, v1, std::forward<F>(f));
|
||||
}
|
||||
|
||||
// getter interface
|
||||
|
|
|
@ -35,38 +35,38 @@ struct vertex_processor
|
|||
: proc_(proc) {}
|
||||
|
||||
template <typename Geometry>
|
||||
void operator() (Geometry const& geom)
|
||||
void operator() (Geometry const& geom) const
|
||||
{
|
||||
util::apply_visitor(*this, geom);
|
||||
}
|
||||
void operator() (geometry_empty const&)
|
||||
void operator() (geometry_empty const&) const
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
template <typename T1>
|
||||
void operator() (point<T1> const& pt)
|
||||
void operator() (point<T1> const& pt) const
|
||||
{
|
||||
point_vertex_adapter<T1> va(pt);
|
||||
proc_(va);
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
void operator() (line_string<T1> const& line)
|
||||
void operator() (line_string<T1> const& line) const
|
||||
{
|
||||
line_string_vertex_adapter<T1> va(line);
|
||||
proc_(va);
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
void operator() (polygon<T1> const& poly)
|
||||
void operator() (polygon<T1> const& poly) const
|
||||
{
|
||||
polygon_vertex_adapter<T1> va(poly);
|
||||
proc_(va);
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
void operator() (multi_point<T1> const& multi_pt)
|
||||
void operator() (multi_point<T1> const& multi_pt) const
|
||||
{
|
||||
for (auto const& pt : multi_pt)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ struct vertex_processor
|
|||
}
|
||||
|
||||
template <typename T1>
|
||||
void operator() (multi_line_string<T1> const& multi_line)
|
||||
void operator() (multi_line_string<T1> const& multi_line) const
|
||||
{
|
||||
for (auto const& line : multi_line)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ struct vertex_processor
|
|||
}
|
||||
|
||||
template <typename T1>
|
||||
void operator() (multi_polygon<T1> const& multi_poly)
|
||||
void operator() (multi_polygon<T1> const& multi_poly) const
|
||||
{
|
||||
for ( auto const& poly : multi_poly)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ struct vertex_processor
|
|||
}
|
||||
|
||||
template <typename T1>
|
||||
void operator() (geometry_collection<T1> const& collection)
|
||||
void operator() (geometry_collection<T1> const& collection) const
|
||||
{
|
||||
for (auto const& geom : collection)
|
||||
{
|
||||
|
|
|
@ -121,11 +121,11 @@ struct setup_agg_bg_visitor
|
|||
mode_(mode),
|
||||
opacity_(opacity) {}
|
||||
|
||||
void operator() (marker_null const&) {}
|
||||
void operator() (marker_null const&) const {}
|
||||
|
||||
void operator() (marker_svg const&) {}
|
||||
void operator() (marker_svg const&) const {}
|
||||
|
||||
void operator() (marker_rgba8 const& marker)
|
||||
void operator() (marker_rgba8 const& marker) const
|
||||
{
|
||||
mapnik::image_rgba8 const& bg_image = marker.get_data();
|
||||
std::size_t w = bg_image.width();
|
||||
|
@ -361,9 +361,9 @@ struct agg_render_marker_visitor
|
|||
opacity_(opacity),
|
||||
comp_op_(comp_op) {}
|
||||
|
||||
void operator() (marker_null const&) {}
|
||||
void operator() (marker_null const&) const {}
|
||||
|
||||
void operator() (marker_svg const& marker)
|
||||
void operator() (marker_svg const& marker) const
|
||||
{
|
||||
using color_type = agg::rgba8;
|
||||
using order_type = agg::order_rgba;
|
||||
|
@ -414,7 +414,7 @@ struct agg_render_marker_visitor
|
|||
svg_renderer.render(*ras_ptr_, sl, renb, mtx, opacity_, bbox);
|
||||
}
|
||||
|
||||
void operator() (marker_rgba8 const& marker)
|
||||
void operator() (marker_rgba8 const& marker) const
|
||||
{
|
||||
using color_type = agg::rgba8;
|
||||
using order_type = agg::order_rgba;
|
||||
|
|
|
@ -165,12 +165,12 @@ struct RingRenderer {
|
|||
};
|
||||
|
||||
template <typename BufferType>
|
||||
struct render_ring_visitor {
|
||||
|
||||
struct render_ring_visitor
|
||||
{
|
||||
render_ring_visitor(RingRenderer<BufferType> & renderer)
|
||||
: renderer_(renderer) {}
|
||||
|
||||
void operator()(mapnik::geometry::multi_polygon<double> const& geom)
|
||||
void operator()(mapnik::geometry::multi_polygon<double> const& geom) const
|
||||
{
|
||||
for (auto const& poly : geom)
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ struct render_ring_visitor {
|
|||
}
|
||||
}
|
||||
|
||||
void operator()(mapnik::geometry::polygon<double> const& geom)
|
||||
void operator()(mapnik::geometry::polygon<double> const& geom) const
|
||||
{
|
||||
agg::rgba8 red(255,0,0,255);
|
||||
agg::rgba8 green(0,255,255,255);
|
||||
|
@ -199,7 +199,7 @@ struct render_ring_visitor {
|
|||
}
|
||||
|
||||
template<typename GeomType>
|
||||
void operator()(GeomType const&) {}
|
||||
void operator()(GeomType const&) const {}
|
||||
|
||||
RingRenderer<BufferType> & renderer_;
|
||||
};
|
||||
|
|
|
@ -71,9 +71,9 @@ struct agg_renderer_process_visitor_l
|
|||
feature_(feature),
|
||||
prj_trans_(prj_trans) {}
|
||||
|
||||
void operator() (marker_null const&) {}
|
||||
void operator() (marker_null const&) const {}
|
||||
|
||||
void operator() (marker_svg const& marker)
|
||||
void operator() (marker_svg const& marker) const
|
||||
{
|
||||
using color = agg::rgba8;
|
||||
using order = agg::order_rgba;
|
||||
|
@ -147,7 +147,7 @@ struct agg_renderer_process_visitor_l
|
|||
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
|
||||
}
|
||||
|
||||
void operator() (marker_rgba8 const& marker)
|
||||
void operator() (marker_rgba8 const& marker) const
|
||||
{
|
||||
using color = agg::rgba8;
|
||||
using order = agg::order_rgba;
|
||||
|
@ -214,7 +214,7 @@ struct agg_renderer_process_visitor_l
|
|||
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer_type>;
|
||||
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
|
||||
apply_vertex_converter_type apply(converter, ras);
|
||||
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
|
||||
mapnik::util::apply_visitor(vertex_processor_type(apply), feature_.get_geometry());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -75,9 +75,9 @@ struct agg_renderer_process_visitor_p
|
|||
feature_(feature),
|
||||
prj_trans_(prj_trans) {}
|
||||
|
||||
void operator() (marker_null const&) {}
|
||||
void operator() (marker_null const&) const {}
|
||||
|
||||
void operator() (marker_svg const& marker)
|
||||
void operator() (marker_svg const& marker) const
|
||||
{
|
||||
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
|
||||
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
|
||||
|
@ -180,7 +180,7 @@ struct agg_renderer_process_visitor_p
|
|||
agg::render_scanlines(*ras_ptr_, sl, rp);
|
||||
}
|
||||
|
||||
void operator() (marker_rgba8 const& marker)
|
||||
void operator() (marker_rgba8 const& marker) const
|
||||
{
|
||||
using color = agg::rgba8;
|
||||
using order = agg::order_rgba;
|
||||
|
|
|
@ -104,10 +104,10 @@ struct setup_marker_visitor
|
|||
setup_marker_visitor(cairo_context & context, renderer_common const& common)
|
||||
: context_(context), common_(common) {}
|
||||
|
||||
void operator() (marker_null const &) {}
|
||||
void operator() (marker_svg const &) {}
|
||||
void operator() (marker_null const &) const{}
|
||||
void operator() (marker_svg const &) const {}
|
||||
|
||||
void operator() (marker_rgba8 const& marker)
|
||||
void operator() (marker_rgba8 const& marker) const
|
||||
{
|
||||
mapnik::image_rgba8 const& bg_image = marker.get_data();
|
||||
std::size_t w = bg_image.width();
|
||||
|
|
|
@ -190,7 +190,7 @@ struct composite_visitor
|
|||
dy_(dy) {}
|
||||
|
||||
template <typename T>
|
||||
void operator() (T & dst);
|
||||
void operator() (T & dst) const;
|
||||
|
||||
private:
|
||||
image_any const& src_;
|
||||
|
@ -201,19 +201,19 @@ struct composite_visitor
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
void composite_visitor::operator() (T & dst)
|
||||
void composite_visitor::operator() (T & dst) const
|
||||
{
|
||||
throw std::runtime_error("Error: Composite with " + std::string(typeid(dst).name()) + " is not supported");
|
||||
}
|
||||
|
||||
template <>
|
||||
void composite_visitor::operator()<image_rgba8> (image_rgba8 & dst)
|
||||
void composite_visitor::operator()<image_rgba8> (image_rgba8 & dst) const
|
||||
{
|
||||
composite(dst, util::get<image_rgba8>(src_), mode_, opacity_, dx_, dy_);
|
||||
}
|
||||
|
||||
template <>
|
||||
void composite_visitor::operator()<image_gray32f> (image_gray32f & dst)
|
||||
void composite_visitor::operator()<image_gray32f> (image_gray32f & dst) const
|
||||
{
|
||||
composite(dst, util::get<image_gray32f>(src_), mode_, opacity_, dx_, dy_);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ struct visitor_image_copy
|
|||
{
|
||||
using dst_type = typename T0::pixel_type;
|
||||
|
||||
T0 operator() (image_null const&)
|
||||
T0 operator() (image_null const&) const
|
||||
{
|
||||
throw std::runtime_error("Can not cast a null image");
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ struct visitor_image_copy
|
|||
}
|
||||
|
||||
template <typename T1>
|
||||
T0 operator() (T1 const& src)
|
||||
T0 operator() (T1 const& src) const
|
||||
{
|
||||
T0 dst(safe_cast<int>(src.width()), safe_cast<int>(src.height()), false);
|
||||
for (std::size_t y = 0; y < dst.height(); ++y)
|
||||
|
@ -75,7 +75,7 @@ struct visitor_image_copy_so
|
|||
throw std::runtime_error("Can not cast a null image");
|
||||
}
|
||||
|
||||
T0 operator() (T0 const& src)
|
||||
T0 operator() (T0 const& src) const
|
||||
{
|
||||
if (offset_ == src.get_offset() && scaling_ == src.get_scaling())
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ struct visitor_image_copy_so
|
|||
}
|
||||
|
||||
template <typename T1>
|
||||
T0 operator() (T1 const& src)
|
||||
T0 operator() (T1 const& src) const
|
||||
{
|
||||
double src_offset = src.get_offset();
|
||||
double src_scaling = src.get_scaling();
|
||||
|
|
|
@ -2087,7 +2087,7 @@ struct visitor_view_to_stream
|
|||
: os_(os) {}
|
||||
|
||||
template <typename T>
|
||||
void operator() (T const& view)
|
||||
void operator() (T const& view) const
|
||||
{
|
||||
for (std::size_t i=0;i<view.height();i++)
|
||||
{
|
||||
|
|
|
@ -118,19 +118,19 @@ namespace detail
|
|||
|
||||
struct visitor_create_marker
|
||||
{
|
||||
marker operator() (image_rgba8 & data)
|
||||
marker operator() (image_rgba8 & data) const
|
||||
{
|
||||
mapnik::premultiply_alpha(data);
|
||||
return mapnik::marker(mapnik::marker_rgba8(data));
|
||||
}
|
||||
|
||||
marker operator() (image_null &)
|
||||
marker operator() (image_null &) const
|
||||
{
|
||||
throw std::runtime_error("Can not make marker from null image data type");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
marker operator() (T &)
|
||||
marker operator() (T &) const
|
||||
{
|
||||
throw std::runtime_error("Can not make marker from this data type");
|
||||
}
|
||||
|
|
|
@ -181,10 +181,10 @@ struct warp_image_visitor
|
|||
nodata_value_(nodata_value)
|
||||
{}
|
||||
|
||||
void operator() (image_null const&) {}
|
||||
void operator() (image_null const&) const {}
|
||||
|
||||
template <typename T>
|
||||
void operator() (T const& source)
|
||||
void operator() (T const& source) const
|
||||
{
|
||||
using image_type = T;
|
||||
//source and target image data types must match
|
||||
|
|
|
@ -89,26 +89,26 @@ void assert_g_equal(geometry<T> const& g1, geometry<T> const& g2);
|
|||
struct geometry_equal_visitor
|
||||
{
|
||||
template <typename T1, typename T2>
|
||||
void operator() (T1 const&, T2 const&)
|
||||
void operator() (T1 const&, T2 const&) const
|
||||
{
|
||||
// comparing two different types!
|
||||
REQUIRE(false);
|
||||
}
|
||||
|
||||
void operator() (geometry_empty const&, geometry_empty const&)
|
||||
void operator() (geometry_empty const&, geometry_empty const&) const
|
||||
{
|
||||
REQUIRE(true);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (point<T> const& p1, point<T> const& p2)
|
||||
void operator() (point<T> const& p1, point<T> const& p2) const
|
||||
{
|
||||
REQUIRE(p1.x == Approx(p2.x));
|
||||
REQUIRE(p1.y == Approx(p2.y));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (line_string<T> const& ls1, line_string<T> const& ls2)
|
||||
void operator() (line_string<T> const& ls1, line_string<T> const& ls2) const
|
||||
{
|
||||
if (ls1.size() != ls2.size())
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ struct geometry_equal_visitor
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (polygon<T> const& p1, polygon<T> const& p2)
|
||||
void operator() (polygon<T> const& p1, polygon<T> const& p2) const
|
||||
{
|
||||
(*this)(static_cast<line_string<T> const&>(p1.exterior_ring), static_cast<line_string<T> const&>(p2.exterior_ring));
|
||||
|
||||
|
@ -139,13 +139,13 @@ struct geometry_equal_visitor
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (multi_point<T> const& mp1, multi_point<T> const& mp2)
|
||||
void operator() (multi_point<T> const& mp1, multi_point<T> const& mp2) const
|
||||
{
|
||||
(*this)(static_cast<line_string<T> const&>(mp1), static_cast<line_string<T> const&>(mp2));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (multi_line_string<T> const& mls1, multi_line_string<T> const& mls2)
|
||||
void operator() (multi_line_string<T> const& mls1, multi_line_string<T> const& mls2) const
|
||||
{
|
||||
if (mls1.size() != mls2.size())
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ struct geometry_equal_visitor
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (multi_polygon<T> const& mpoly1, multi_polygon<T> const& mpoly2)
|
||||
void operator() (multi_polygon<T> const& mpoly1, multi_polygon<T> const& mpoly2) const
|
||||
{
|
||||
if (mpoly1.size() != mpoly2.size())
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ struct geometry_equal_visitor
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (mapnik::util::recursive_wrapper<geometry_collection<T> > const& c1_, mapnik::util::recursive_wrapper<geometry_collection<T> > const& c2_)
|
||||
void operator() (mapnik::util::recursive_wrapper<geometry_collection<T> > const& c1_, mapnik::util::recursive_wrapper<geometry_collection<T> > const& c2_) const
|
||||
{
|
||||
geometry_collection<T> const& c1 = static_cast<geometry_collection<T> const&>(c1_);
|
||||
geometry_collection<T> const& c2 = static_cast<geometry_collection<T> const&>(c2_);
|
||||
|
@ -189,7 +189,7 @@ struct geometry_equal_visitor
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (geometry_collection<T> const& c1, geometry_collection<T> const& c2)
|
||||
void operator() (geometry_collection<T> const& c1, geometry_collection<T> const& c2) const
|
||||
{
|
||||
if (c1.size() != c2.size())
|
||||
{
|
||||
|
|
|
@ -57,13 +57,13 @@ public:
|
|||
}
|
||||
|
||||
template <typename T, typename std::enable_if<T::renderer_type::support_tiles>::type* = nullptr>
|
||||
void operator()(T const & renderer)
|
||||
void operator()(T const& renderer) const
|
||||
{
|
||||
test(renderer);
|
||||
}
|
||||
|
||||
template <typename T, typename std::enable_if<!T::renderer_type::support_tiles>::type* = nullptr>
|
||||
void operator()(T const & renderer)
|
||||
void operator()(T const & renderer) const
|
||||
{
|
||||
if (tiles_.width == 1 && tiles_.height == 1)
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
|
||||
private:
|
||||
template <typename T>
|
||||
void test(T const & renderer)
|
||||
void test(T const & renderer) const
|
||||
{
|
||||
map_size size { map_.width(), map_.height() };
|
||||
std::chrono::high_resolution_clock::time_point start(std::chrono::high_resolution_clock::now());
|
||||
|
@ -96,7 +96,7 @@ private:
|
|||
}
|
||||
|
||||
template <typename T, typename std::enable_if<T::renderer_type::support_tiles>::type* = nullptr>
|
||||
typename T::image_type render(T const & renderer)
|
||||
typename T::image_type render(T const& renderer) const
|
||||
{
|
||||
if (tiles_.width == 1 && tiles_.height == 1)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ private:
|
|||
}
|
||||
|
||||
template <typename T, typename std::enable_if<!T::renderer_type::support_tiles>::type* = nullptr>
|
||||
typename T::image_type render(T const & renderer)
|
||||
typename T::image_type render(T const & renderer) const
|
||||
{
|
||||
return renderer.render(map_, scale_factor_);
|
||||
}
|
||||
|
@ -364,4 +364,3 @@ void runner::parse_map_sizes(std::string const & str, std::vector<map_size> & si
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ struct main_marker_visitor
|
|||
verbose_(verbose),
|
||||
auto_open_(auto_open) {}
|
||||
|
||||
int operator() (mapnik::marker_svg const& marker)
|
||||
int operator() (mapnik::marker_svg const& marker) const
|
||||
{
|
||||
using pixfmt = agg::pixfmt_rgba32_pre;
|
||||
using renderer_base = agg::renderer_base<pixfmt>;
|
||||
|
@ -122,14 +122,14 @@ struct main_marker_visitor
|
|||
|
||||
// default
|
||||
template <typename T>
|
||||
int operator() (T const&)
|
||||
int operator() (T const&) const
|
||||
{
|
||||
std::clog << "svg2png error: '" << svg_name_ << "' is not a valid vector!\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string const& svg_name_;
|
||||
std::string svg_name_;
|
||||
bool verbose_;
|
||||
bool auto_open_;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue