use std::optional instead of boost::optional
This commit is contained in:
parent
e1feef5a79
commit
7ef431ece2
123 changed files with 774 additions and 978 deletions
|
@ -15,8 +15,6 @@
|
||||||
#include <cstdio> // snprintf
|
#include <cstdio> // snprintf
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <set>
|
|
||||||
#include <sstream>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -9,7 +9,7 @@ class test : public benchmark::test_case
|
||||||
: test_case(params)
|
: test_case(params)
|
||||||
, line_data_("this is one line\nand this is a second line\nand a third line")
|
, line_data_("this is one line\nand this is a second line\nand a third line")
|
||||||
{
|
{
|
||||||
boost::optional<std::string> line_data = params.get<std::string>("line");
|
auto line_data = params.get<std::string>("line");
|
||||||
if (line_data)
|
if (line_data)
|
||||||
{
|
{
|
||||||
line_data_ = *line_data;
|
line_data_ = *line_data;
|
||||||
|
@ -57,7 +57,7 @@ class test2 : public benchmark::test_case
|
||||||
: test_case(params)
|
: test_case(params)
|
||||||
, line_data_("this is one line\nand this is a second line\nand a third line")
|
, line_data_("this is one line\nand this is a second line\nand a third line")
|
||||||
{
|
{
|
||||||
boost::optional<std::string> line_data = params.get<std::string>("line");
|
auto line_data = params.get<std::string>("line");
|
||||||
if (line_data)
|
if (line_data)
|
||||||
{
|
{
|
||||||
line_data_ = *line_data;
|
line_data_ = *line_data;
|
||||||
|
|
|
@ -26,14 +26,14 @@ class test : public benchmark::test_case
|
||||||
, scale_factor_(*params.get<mapnik::value_double>("scale_factor", 1.0))
|
, scale_factor_(*params.get<mapnik::value_double>("scale_factor", 1.0))
|
||||||
, preview_(*params.get<std::string>("preview", ""))
|
, preview_(*params.get<std::string>("preview", ""))
|
||||||
{
|
{
|
||||||
boost::optional<std::string> map = params.get<std::string>("map");
|
const auto map = params.get<std::string>("map");
|
||||||
if (!map)
|
if (!map)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("please provide a --map <path to xml> arg");
|
throw std::runtime_error("please provide a --map <path to xml> arg");
|
||||||
}
|
}
|
||||||
xml_ = *map;
|
xml_ = *map;
|
||||||
|
|
||||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
const auto ext = params.get<std::string>("extent");
|
||||||
if (ext && !ext->empty())
|
if (ext && !ext->empty())
|
||||||
{
|
{
|
||||||
if (!extent_.from_string(*ext))
|
if (!extent_.from_string(*ext))
|
||||||
|
@ -101,7 +101,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
mapnik::parameters params;
|
mapnik::parameters params;
|
||||||
benchmark::handle_args(argc, argv, params);
|
benchmark::handle_args(argc, argv, params);
|
||||||
boost::optional<std::string> name = params.get<std::string>("name");
|
const auto name = params.get<std::string>("name");
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
std::clog << "please provide a name for this test\n";
|
std::clog << "please provide a name for this test\n";
|
||||||
|
|
|
@ -64,14 +64,14 @@ class test : public benchmark::test_case
|
||||||
, preview_(*params.get<std::string>("preview", ""))
|
, preview_(*params.get<std::string>("preview", ""))
|
||||||
, im_(m_->width(), m_->height())
|
, im_(m_->width(), m_->height())
|
||||||
{
|
{
|
||||||
boost::optional<std::string> map = params.get<std::string>("map");
|
const auto map = params.get<std::string>("map");
|
||||||
if (!map)
|
if (!map)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("please provide a --map=<path to xml> arg");
|
throw std::runtime_error("please provide a --map=<path to xml> arg");
|
||||||
}
|
}
|
||||||
xml_ = *map;
|
xml_ = *map;
|
||||||
|
|
||||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
auto ext = params.get<std::string>("extent");
|
||||||
mapnik::load_map(*m_, xml_, true);
|
mapnik::load_map(*m_, xml_, true);
|
||||||
if (ext && !ext->empty())
|
if (ext && !ext->empty())
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
mapnik::parameters params;
|
mapnik::parameters params;
|
||||||
benchmark::handle_args(argc, argv, params);
|
benchmark::handle_args(argc, argv, params);
|
||||||
boost::optional<std::string> name = params.get<std::string>("name");
|
const auto name = params.get<std::string>("name");
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
std::clog << "please provide a name for this test\n";
|
std::clog << "please provide a name for this test\n";
|
||||||
|
|
|
@ -175,14 +175,14 @@ struct symbolizer_attributes
|
||||||
|
|
||||||
void operator()(raster_symbolizer const& sym)
|
void operator()(raster_symbolizer const& sym)
|
||||||
{
|
{
|
||||||
boost::optional<double> filter_factor = get_optional<double>(sym, keys::filter_factor);
|
const auto filter_factor = get_optional<double>(sym, keys::filter_factor);
|
||||||
if (filter_factor)
|
if (filter_factor)
|
||||||
{
|
{
|
||||||
filter_factor_ = *filter_factor;
|
filter_factor_ = *filter_factor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::optional<scaling_method_e> scaling_method = get_optional<scaling_method_e>(sym, keys::scaling);
|
const auto scaling_method = get_optional<scaling_method_e>(sym, keys::scaling);
|
||||||
if (scaling_method && *scaling_method != SCALING_NEAR)
|
if (scaling_method && *scaling_method != SCALING_NEAR)
|
||||||
{
|
{
|
||||||
filter_factor_ = 2;
|
filter_factor_ = 2;
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ class MAPNIK_DECL datasource : private util::noncopyable
|
||||||
// default implementation without context use features method
|
// default implementation without context use features method
|
||||||
return features(q);
|
return features(q);
|
||||||
}
|
}
|
||||||
virtual boost::optional<datasource_geometry_t> get_geometry_type() const = 0;
|
virtual std::optional<datasource_geometry_t> get_geometry_type() const = 0;
|
||||||
virtual featureset_ptr features(query const& q) const = 0;
|
virtual featureset_ptr features(query const& q) const = 0;
|
||||||
virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const = 0;
|
virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const = 0;
|
||||||
virtual box2d<double> envelope() const = 0;
|
virtual box2d<double> envelope() const = 0;
|
||||||
|
|
|
@ -131,11 +131,11 @@ struct evaluate_expression
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct evaluate_expression<T, boost::none_t>
|
struct evaluate_expression<T, std::nullopt_t>
|
||||||
{
|
{
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
|
|
||||||
evaluate_expression(boost::none_t) {}
|
evaluate_expression(std::nullopt_t) {}
|
||||||
|
|
||||||
value_type operator()(attribute const&) const
|
value_type operator()(attribute const&) const
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ std::tuple<T, bool> pre_evaluate_expression(expression_ptr const& expr)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return std::make_tuple(util::apply_visitor(mapnik::evaluate_expression<T, boost::none_t>(boost::none), *expr),
|
return std::make_tuple(util::apply_visitor(mapnik::evaluate_expression<T, std::nullopt_t>(std::nullopt), *expr),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
MAPNIK_DISABLE_UNUSED_VARIABLE
|
MAPNIK_DISABLE_UNUSED_VARIABLE
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/msm/back/state_machine.hpp>
|
#include <boost/msm/back/state_machine.hpp>
|
||||||
#include <boost/msm/front/state_machine_def.hpp>
|
#include <boost/msm/front/state_machine_def.hpp>
|
||||||
#include <boost/msm/front/functor_row.hpp>
|
#include <boost/msm/front/functor_row.hpp>
|
||||||
|
@ -37,6 +36,7 @@ MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ struct store
|
||||||
{
|
{
|
||||||
m.v2 = m.v1;
|
m.v2 = m.v1;
|
||||||
m.v1 = e.vertex;
|
m.v1 = e.vertex;
|
||||||
m.output = boost::none;
|
m.output = std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ struct extender_def : public msm::front::state_machine_def<extender_def>
|
||||||
: extend_length(extend_length)
|
: extend_length(extend_length)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
boost::optional<vertex2d> output;
|
std::optional<vertex2d> output;
|
||||||
vertex2d v1, v2;
|
vertex2d v1, v2;
|
||||||
double extend_length;
|
double extend_length;
|
||||||
};
|
};
|
||||||
|
|
|
@ -248,7 +248,7 @@ void feature_style_processor<Processor>::prepare_layer(layer_rendering_material&
|
||||||
box2d<double> buffered_query_ext(query_ext); // buffered
|
box2d<double> buffered_query_ext(query_ext); // buffered
|
||||||
|
|
||||||
double buffer_padding = 2.0 * scale * p.scale_factor();
|
double buffer_padding = 2.0 * scale * p.scale_factor();
|
||||||
boost::optional<int> layer_buffer_size = lay.buffer_size();
|
const auto layer_buffer_size = lay.buffer_size();
|
||||||
if (layer_buffer_size) // if layer overrides buffer size, use this value to compute buffered extent
|
if (layer_buffer_size) // if layer overrides buffer size, use this value to compute buffered extent
|
||||||
{
|
{
|
||||||
buffer_padding *= *layer_buffer_size;
|
buffer_padding *= *layer_buffer_size;
|
||||||
|
@ -261,7 +261,7 @@ void feature_style_processor<Processor>::prepare_layer(layer_rendering_material&
|
||||||
buffered_query_ext.height(query_ext.height() + buffer_padding);
|
buffered_query_ext.height(query_ext.height() + buffer_padding);
|
||||||
|
|
||||||
// clip buffered extent by maximum extent, if supplied
|
// clip buffered extent by maximum extent, if supplied
|
||||||
boost::optional<box2d<double>> const& maximum_extent = m_.maximum_extent();
|
auto&& maximum_extent = m_.maximum_extent();
|
||||||
if (maximum_extent)
|
if (maximum_extent)
|
||||||
{
|
{
|
||||||
buffered_query_ext.clip(*maximum_extent);
|
buffered_query_ext.clip(*maximum_extent);
|
||||||
|
|
|
@ -29,15 +29,11 @@
|
||||||
#include <mapnik/image_filter_types.hpp>
|
#include <mapnik/image_filter_types.hpp>
|
||||||
#include <mapnik/image_compositing.hpp>
|
#include <mapnik/image_compositing.hpp>
|
||||||
#include <mapnik/rule.hpp>
|
#include <mapnik/rule.hpp>
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -56,7 +52,7 @@ class MAPNIK_DECL feature_type_style
|
||||||
std::vector<filter::filter_type> filters_;
|
std::vector<filter::filter_type> filters_;
|
||||||
std::vector<filter::filter_type> direct_filters_;
|
std::vector<filter::filter_type> direct_filters_;
|
||||||
// comp-op
|
// comp-op
|
||||||
boost::optional<composite_mode_e> comp_op_;
|
std::optional<composite_mode_e> comp_op_;
|
||||||
float opacity_;
|
float opacity_;
|
||||||
bool image_filters_inflate_;
|
bool image_filters_inflate_;
|
||||||
friend void swap(feature_type_style& lhs, feature_type_style& rhs);
|
friend void swap(feature_type_style& lhs, feature_type_style& rhs);
|
||||||
|
@ -87,7 +83,7 @@ class MAPNIK_DECL feature_type_style
|
||||||
std::vector<filter::filter_type>& direct_image_filters();
|
std::vector<filter::filter_type>& direct_image_filters();
|
||||||
// compositing
|
// compositing
|
||||||
void set_comp_op(composite_mode_e comp_op);
|
void set_comp_op(composite_mode_e comp_op);
|
||||||
boost::optional<composite_mode_e> comp_op() const;
|
std::optional<composite_mode_e> comp_op() const;
|
||||||
void set_opacity(float opacity);
|
void set_opacity(float opacity);
|
||||||
float get_opacity() const;
|
float get_opacity() const;
|
||||||
void set_image_filters_inflate(bool inflate);
|
void set_image_filters_inflate(bool inflate);
|
||||||
|
|
|
@ -35,11 +35,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <utility> // pair
|
#include <utility> // pair
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <optional>
|
||||||
namespace boost {
|
|
||||||
template<class T>
|
|
||||||
class optional;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -117,7 +113,7 @@ class MAPNIK_DECL face_manager
|
||||||
face_ptr get_face(std::string const& name);
|
face_ptr get_face(std::string const& name);
|
||||||
face_set_ptr get_face_set(std::string const& name);
|
face_set_ptr get_face_set(std::string const& name);
|
||||||
face_set_ptr get_face_set(font_set const& fset);
|
face_set_ptr get_face_set(font_set const& fset);
|
||||||
face_set_ptr get_face_set(std::string const& name, boost::optional<font_set> fset);
|
face_set_ptr get_face_set(std::string const& name, std::optional<font_set> fset);
|
||||||
stroker_ptr get_stroker() const { return stroker_; }
|
stroker_ptr get_stroker() const { return stroker_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -26,14 +26,9 @@
|
||||||
#include <mapnik/config.hpp>
|
#include <mapnik/config.hpp>
|
||||||
#include <mapnik/image.hpp>
|
#include <mapnik/image.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -80,8 +75,8 @@ enum composite_mode_e {
|
||||||
divide
|
divide
|
||||||
};
|
};
|
||||||
|
|
||||||
MAPNIK_DECL boost::optional<composite_mode_e> comp_op_from_string(std::string const& name);
|
MAPNIK_DECL std::optional<composite_mode_e> comp_op_from_string(std::string const& name);
|
||||||
MAPNIK_DECL boost::optional<std::string> comp_op_to_string(composite_mode_e comp_op);
|
MAPNIK_DECL std::optional<std::string> comp_op_to_string(composite_mode_e comp_op);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
MAPNIK_DECL void composite(T& dst, T const& src, composite_mode_e mode, float opacity = 1, int dx = 0, int dy = 0);
|
MAPNIK_DECL void composite(T& dst, T const& src, composite_mode_e mode, float opacity = 1, int dx = 0, int dy = 0);
|
||||||
|
|
|
@ -25,17 +25,12 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <optional>
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
using image_options_map = std::map<std::string, boost::optional<std::string>>;
|
using image_options_map = std::map<std::string, std::optional<std::string>>;
|
||||||
inline std::string to_string(boost::optional<std::string> const& val)
|
inline std::string to_string(std::optional<std::string> const& val)
|
||||||
{
|
{
|
||||||
return val ? *val : "<unitialised>";
|
return val ? *val : "<unitialised>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,15 +30,9 @@
|
||||||
#include <mapnik/factory.hpp>
|
#include <mapnik/factory.hpp>
|
||||||
#include <mapnik/geometry/box2d.hpp>
|
#include <mapnik/geometry/box2d.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -62,7 +56,7 @@ struct MAPNIK_DECL image_reader : private util::noncopyable
|
||||||
virtual unsigned width() const = 0;
|
virtual unsigned width() const = 0;
|
||||||
virtual unsigned height() const = 0;
|
virtual unsigned height() const = 0;
|
||||||
virtual bool has_alpha() const = 0;
|
virtual bool has_alpha() const = 0;
|
||||||
virtual boost::optional<box2d<double>> bounding_box() const = 0;
|
virtual std::optional<box2d<double>> bounding_box() const = 0;
|
||||||
virtual void read(unsigned x, unsigned y, image_rgba8& image) = 0;
|
virtual void read(unsigned x, unsigned y, image_rgba8& image) = 0;
|
||||||
virtual image_any read(unsigned x, unsigned y, unsigned width, unsigned height) = 0;
|
virtual image_any read(unsigned x, unsigned y, unsigned width, unsigned height) = 0;
|
||||||
virtual ~image_reader() {}
|
virtual ~image_reader() {}
|
||||||
|
|
|
@ -28,13 +28,8 @@
|
||||||
#include <mapnik/image.hpp>
|
#include <mapnik/image.hpp>
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <iosfwd>
|
#include <string>
|
||||||
|
#include <optional>
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -58,8 +53,8 @@ enum scaling_method_e {
|
||||||
SCALING_BLACKMAN
|
SCALING_BLACKMAN
|
||||||
};
|
};
|
||||||
|
|
||||||
MAPNIK_DECL boost::optional<scaling_method_e> scaling_method_from_string(std::string const& name);
|
MAPNIK_DECL std::optional<scaling_method_e> scaling_method_from_string(std::string const& name);
|
||||||
MAPNIK_DECL boost::optional<std::string> scaling_method_to_string(scaling_method_e scaling_method);
|
MAPNIK_DECL std::optional<std::string> scaling_method_to_string(scaling_method_e scaling_method);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
MAPNIK_DECL void scale_image_agg(T& target,
|
MAPNIK_DECL void scale_image_agg(T& target,
|
||||||
|
@ -70,7 +65,7 @@ MAPNIK_DECL void scale_image_agg(T& target,
|
||||||
double x_off_f,
|
double x_off_f,
|
||||||
double y_off_f,
|
double y_off_f,
|
||||||
double filter_factor,
|
double filter_factor,
|
||||||
boost::optional<double> const& nodata_value);
|
std::optional<double> const& nodata_value);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void scale_image_agg(T& target,
|
inline void scale_image_agg(T& target,
|
||||||
T const& source,
|
T const& source,
|
||||||
|
@ -89,7 +84,7 @@ inline void scale_image_agg(T& target,
|
||||||
x_off_f,
|
x_off_f,
|
||||||
y_off_f,
|
y_off_f,
|
||||||
filter_factor,
|
filter_factor,
|
||||||
boost::optional<double>());
|
std::optional<double>());
|
||||||
}
|
}
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,12 @@
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -361,25 +361,23 @@ inline bool is_webp(std::string const& filename)
|
||||||
return boost::algorithm::iends_with(filename, std::string(".webp"));
|
return boost::algorithm::iends_with(filename, std::string(".webp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline boost::optional<std::string> type_from_filename(std::string const& filename)
|
inline std::optional<std::string> type_from_filename(std::string const& filename)
|
||||||
|
|
||||||
{
|
{
|
||||||
using result_type = boost::optional<std::string>;
|
|
||||||
if (is_png(filename))
|
if (is_png(filename))
|
||||||
return result_type("png");
|
return "png";
|
||||||
if (is_jpeg(filename))
|
if (is_jpeg(filename))
|
||||||
return result_type("jpeg");
|
return "jpeg";
|
||||||
if (is_tiff(filename))
|
if (is_tiff(filename))
|
||||||
return result_type("tiff");
|
return "tiff";
|
||||||
if (is_pdf(filename))
|
if (is_pdf(filename))
|
||||||
return result_type("pdf");
|
return "pdf";
|
||||||
if (is_svg(filename))
|
if (is_svg(filename))
|
||||||
return result_type("svg");
|
return "svg";
|
||||||
if (is_ps(filename))
|
if (is_ps(filename))
|
||||||
return result_type("ps");
|
return "ps";
|
||||||
if (is_webp(filename))
|
if (is_webp(filename))
|
||||||
return result_type("webp");
|
return "webp";
|
||||||
return result_type();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string guess_type(std::string const& filename)
|
inline std::string guess_type(std::string const& filename)
|
||||||
|
|
|
@ -26,12 +26,7 @@
|
||||||
#include <mapnik/json/json_value.hpp>
|
#include <mapnik/json/json_value.hpp>
|
||||||
#include <mapnik/util/variant.hpp>
|
#include <mapnik/util/variant.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
#include <optional>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -53,37 +48,37 @@ using properties = std::vector<property>;
|
||||||
struct point
|
struct point
|
||||||
{
|
{
|
||||||
coordinate coord;
|
coordinate coord;
|
||||||
boost::optional<properties> props;
|
std::optional<properties> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct multi_point
|
struct multi_point
|
||||||
{
|
{
|
||||||
std::vector<coordinate> points;
|
std::vector<coordinate> points;
|
||||||
boost::optional<properties> props;
|
std::optional<properties> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct linestring
|
struct linestring
|
||||||
{
|
{
|
||||||
std::vector<index_type> rings;
|
std::vector<index_type> rings;
|
||||||
boost::optional<properties> props;
|
std::optional<properties> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct multi_linestring
|
struct multi_linestring
|
||||||
{
|
{
|
||||||
std::vector<std::vector<index_type>> lines;
|
std::vector<std::vector<index_type>> lines;
|
||||||
boost::optional<properties> props;
|
std::optional<properties> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct polygon
|
struct polygon
|
||||||
{
|
{
|
||||||
std::vector<std::vector<index_type>> rings;
|
std::vector<std::vector<index_type>> rings;
|
||||||
boost::optional<properties> props;
|
std::optional<properties> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct multi_polygon
|
struct multi_polygon
|
||||||
{
|
{
|
||||||
std::vector<std::vector<std::vector<index_type>>> polygons;
|
std::vector<std::vector<std::vector<index_type>>> polygons;
|
||||||
boost::optional<properties> props;
|
std::optional<properties> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct empty
|
struct empty
|
||||||
|
@ -118,8 +113,8 @@ struct topology
|
||||||
{
|
{
|
||||||
std::vector<geometry> geometries;
|
std::vector<geometry> geometries;
|
||||||
std::vector<arc> arcs;
|
std::vector<arc> arcs;
|
||||||
boost::optional<transform> tr;
|
std::optional<transform> tr;
|
||||||
boost::optional<bounding_box> bbox;
|
std::optional<bounding_box> bbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace topojson
|
} // namespace topojson
|
||||||
|
|
|
@ -210,15 +210,15 @@ class MAPNIK_DECL layer
|
||||||
|
|
||||||
// compositing
|
// compositing
|
||||||
void set_comp_op(composite_mode_e comp_op);
|
void set_comp_op(composite_mode_e comp_op);
|
||||||
boost::optional<composite_mode_e> comp_op() const;
|
std::optional<composite_mode_e> comp_op() const;
|
||||||
void set_opacity(double opacity);
|
void set_opacity(double opacity);
|
||||||
double get_opacity() const;
|
double get_opacity() const;
|
||||||
|
|
||||||
void set_maximum_extent(box2d<double> const& box);
|
void set_maximum_extent(box2d<double> const& box);
|
||||||
boost::optional<box2d<double>> const& maximum_extent() const;
|
std::optional<box2d<double>> const& maximum_extent() const;
|
||||||
void reset_maximum_extent();
|
void reset_maximum_extent();
|
||||||
void set_buffer_size(int size);
|
void set_buffer_size(int size);
|
||||||
boost::optional<int> const& buffer_size() const;
|
std::optional<int> const& buffer_size() const;
|
||||||
void reset_buffer_size();
|
void reset_buffer_size();
|
||||||
~layer();
|
~layer();
|
||||||
|
|
||||||
|
@ -235,9 +235,9 @@ class MAPNIK_DECL layer
|
||||||
std::vector<std::string> styles_;
|
std::vector<std::string> styles_;
|
||||||
std::vector<layer> layers_;
|
std::vector<layer> layers_;
|
||||||
datasource_ptr ds_;
|
datasource_ptr ds_;
|
||||||
boost::optional<int> buffer_size_;
|
std::optional<int> buffer_size_;
|
||||||
boost::optional<box2d<double>> maximum_extent_;
|
std::optional<box2d<double>> maximum_extent_;
|
||||||
boost::optional<composite_mode_e> comp_op_;
|
std::optional<composite_mode_e> comp_op_;
|
||||||
double opacity_;
|
double opacity_;
|
||||||
};
|
};
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
|
@ -33,11 +33,8 @@
|
||||||
#include <mapnik/well_known_srs.hpp>
|
#include <mapnik/well_known_srs.hpp>
|
||||||
#include <mapnik/image_compositing.hpp>
|
#include <mapnik/image_compositing.hpp>
|
||||||
#include <mapnik/font_engine_freetype.hpp>
|
#include <mapnik/font_engine_freetype.hpp>
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
#include <boost/optional/optional_fwd.hpp>
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -84,8 +81,8 @@ class MAPNIK_DECL Map : boost::equality_comparable<Map>
|
||||||
unsigned height_;
|
unsigned height_;
|
||||||
std::string srs_;
|
std::string srs_;
|
||||||
int buffer_size_;
|
int buffer_size_;
|
||||||
boost::optional<color> background_;
|
std::optional<color> background_;
|
||||||
boost::optional<std::string> background_image_;
|
std::optional<std::string> background_image_;
|
||||||
composite_mode_e background_image_comp_op_;
|
composite_mode_e background_image_comp_op_;
|
||||||
float background_image_opacity_;
|
float background_image_opacity_;
|
||||||
std::map<std::string, feature_type_style> styles_;
|
std::map<std::string, feature_type_style> styles_;
|
||||||
|
@ -93,10 +90,10 @@ class MAPNIK_DECL Map : boost::equality_comparable<Map>
|
||||||
std::vector<layer> layers_;
|
std::vector<layer> layers_;
|
||||||
aspect_fix_mode aspectFixMode_;
|
aspect_fix_mode aspectFixMode_;
|
||||||
box2d<double> current_extent_;
|
box2d<double> current_extent_;
|
||||||
boost::optional<box2d<double>> maximum_extent_;
|
std::optional<box2d<double>> maximum_extent_;
|
||||||
std::string base_path_;
|
std::string base_path_;
|
||||||
parameters extra_params_;
|
parameters extra_params_;
|
||||||
boost::optional<std::string> font_directory_;
|
std::optional<std::string> font_directory_;
|
||||||
freetype_engine::font_file_mapping_type font_file_mapping_;
|
freetype_engine::font_file_mapping_type font_file_mapping_;
|
||||||
freetype_engine::font_memory_cache_type font_memory_cache_;
|
freetype_engine::font_memory_cache_type font_memory_cache_;
|
||||||
|
|
||||||
|
@ -318,7 +315,7 @@ class MAPNIK_DECL Map : boost::equality_comparable<Map>
|
||||||
* @return Background color as boost::optional
|
* @return Background color as boost::optional
|
||||||
* object
|
* object
|
||||||
*/
|
*/
|
||||||
boost::optional<color> const& background() const;
|
std::optional<color> const& background() const;
|
||||||
|
|
||||||
/*! \brief Set the map background image filename.
|
/*! \brief Set the map background image filename.
|
||||||
* @param image_filename Background image filename.
|
* @param image_filename Background image filename.
|
||||||
|
@ -329,7 +326,7 @@ class MAPNIK_DECL Map : boost::equality_comparable<Map>
|
||||||
* @return Background image path as std::string
|
* @return Background image path as std::string
|
||||||
* object
|
* object
|
||||||
*/
|
*/
|
||||||
boost::optional<std::string> const& background_image() const;
|
std::optional<std::string> const& background_image() const;
|
||||||
|
|
||||||
/*! \brief Set the compositing operation uses to blend the background image into the background color.
|
/*! \brief Set the compositing operation uses to blend the background image into the background color.
|
||||||
* @param comp_op compositing operation.
|
* @param comp_op compositing operation.
|
||||||
|
@ -369,7 +366,7 @@ class MAPNIK_DECL Map : boost::equality_comparable<Map>
|
||||||
|
|
||||||
/*! \brief Get the map maximum extent as box2d<double>
|
/*! \brief Get the map maximum extent as box2d<double>
|
||||||
*/
|
*/
|
||||||
boost::optional<box2d<double>> const& maximum_extent() const;
|
std::optional<box2d<double>> const& maximum_extent() const;
|
||||||
|
|
||||||
void reset_maximum_extent();
|
void reset_maximum_extent();
|
||||||
|
|
||||||
|
@ -467,7 +464,7 @@ class MAPNIK_DECL Map : boost::equality_comparable<Map>
|
||||||
*/
|
*/
|
||||||
void set_extra_parameters(parameters& params);
|
void set_extra_parameters(parameters& params);
|
||||||
|
|
||||||
boost::optional<std::string> const& font_directory() const { return font_directory_; }
|
std::optional<std::string> const& font_directory() const { return font_directory_; }
|
||||||
|
|
||||||
void set_font_directory(std::string const& dir) { font_directory_ = dir; }
|
void set_font_directory(std::string const& dir) { font_directory_ = dir; }
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <optional>
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace interprocess {
|
namespace interprocess {
|
||||||
|
@ -64,7 +59,7 @@ class MAPNIK_DECL mapped_memory_cache : public singleton<mapped_memory_cache, Cr
|
||||||
* @return false if the resource was not removed or wasn't in the cache
|
* @return false if the resource was not removed or wasn't in the cache
|
||||||
*/
|
*/
|
||||||
bool remove(std::string const& key);
|
bool remove(std::string const& key);
|
||||||
boost::optional<mapped_region_ptr> find(std::string const& key, bool update_cache = false);
|
std::optional<mapped_region_ptr> find(std::string const& key, bool update_cache = false);
|
||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class MAPNIK_DECL memory_datasource : public datasource
|
||||||
virtual featureset_ptr features(query const& q) const;
|
virtual featureset_ptr features(query const& q) const;
|
||||||
virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const;
|
virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const;
|
||||||
virtual box2d<double> envelope() const;
|
virtual box2d<double> envelope() const;
|
||||||
virtual boost::optional<datasource_geometry_t> get_geometry_type() const;
|
virtual std::optional<datasource_geometry_t> get_geometry_type() const;
|
||||||
virtual layer_descriptor get_descriptor() const;
|
virtual layer_descriptor get_descriptor() const;
|
||||||
//
|
//
|
||||||
void push(feature_ptr feature);
|
void push(feature_ptr feature);
|
||||||
|
|
|
@ -28,15 +28,10 @@
|
||||||
#include <mapnik/value/types.hpp>
|
#include <mapnik/value/types.hpp>
|
||||||
#include <mapnik/util/variant.hpp>
|
#include <mapnik/util/variant.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -72,33 +67,33 @@ class MAPNIK_DECL parameters : public param_map
|
||||||
public:
|
public:
|
||||||
parameters() {}
|
parameters() {}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T> get(std::string const& key) const;
|
std::optional<T> get(std::string const& key) const;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T> get(std::string const& key, T const& default_opt_value) const;
|
std::optional<T> get(std::string const& key, T const& default_opt_value) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
template MAPNIK_DECL boost::optional<std::string> parameters::get(std::string const& key) const;
|
template MAPNIK_DECL std::optional<std::string> parameters::get(std::string const& key) const;
|
||||||
template MAPNIK_DECL boost::optional<std::string> parameters::get(std::string const& key,
|
template MAPNIK_DECL std::optional<std::string> parameters::get(std::string const& key,
|
||||||
std::string const& default_opt_value) const;
|
std::string const& default_opt_value) const;
|
||||||
template MAPNIK_DECL boost::optional<value_double> parameters::get(std::string const& key) const;
|
template MAPNIK_DECL std::optional<value_double> parameters::get(std::string const& key) const;
|
||||||
template MAPNIK_DECL boost::optional<value_double> parameters::get(std::string const& key,
|
template MAPNIK_DECL std::optional<value_double> parameters::get(std::string const& key,
|
||||||
value_double const& default_opt_value) const;
|
value_double const& default_opt_value) const;
|
||||||
|
|
||||||
template MAPNIK_DECL boost::optional<value_integer> parameters::get(std::string const& key) const;
|
template MAPNIK_DECL std::optional<value_integer> parameters::get(std::string const& key) const;
|
||||||
template MAPNIK_DECL boost::optional<value_integer> parameters::get(std::string const& key,
|
template MAPNIK_DECL std::optional<value_integer> parameters::get(std::string const& key,
|
||||||
value_integer const& default_opt_value) const;
|
value_integer const& default_opt_value) const;
|
||||||
|
|
||||||
template MAPNIK_DECL boost::optional<value_bool> parameters::get(std::string const& key) const;
|
template MAPNIK_DECL std::optional<value_bool> parameters::get(std::string const& key) const;
|
||||||
template MAPNIK_DECL boost::optional<value_bool> parameters::get(std::string const& key,
|
template MAPNIK_DECL std::optional<value_bool> parameters::get(std::string const& key,
|
||||||
value_bool const& default_opt_value) const;
|
value_bool const& default_opt_value) const;
|
||||||
|
|
||||||
template MAPNIK_DECL boost::optional<mapnik::boolean_type> parameters::get(std::string const& key) const;
|
template MAPNIK_DECL std::optional<mapnik::boolean_type> parameters::get(std::string const& key) const;
|
||||||
template MAPNIK_DECL boost::optional<mapnik::boolean_type>
|
template MAPNIK_DECL std::optional<mapnik::boolean_type>
|
||||||
parameters::get(std::string const& key, mapnik::boolean_type const& default_opt_value) const;
|
parameters::get(std::string const& key, mapnik::boolean_type const& default_opt_value) const;
|
||||||
|
|
||||||
template MAPNIK_DECL boost::optional<mapnik::value_null> parameters::get(std::string const& key) const;
|
template MAPNIK_DECL std::optional<mapnik::value_null> parameters::get(std::string const& key) const;
|
||||||
template MAPNIK_DECL boost::optional<mapnik::value_null>
|
template MAPNIK_DECL std::optional<mapnik::value_null>
|
||||||
parameters::get(std::string const& key, mapnik::value_null const& default_opt_value) const;
|
parameters::get(std::string const& key, mapnik::value_null const& default_opt_value) const;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
|
@ -40,6 +39,7 @@ MAPNIK_DISABLE_WARNING_POP
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
@ -47,13 +47,13 @@ namespace detail {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct extract_value
|
struct extract_value
|
||||||
{
|
{
|
||||||
static inline boost::optional<T> do_extract_from_string(std::string const& /*source*/)
|
static inline std::optional<T> do_extract_from_string(std::string const& /*source*/)
|
||||||
{
|
{
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "No conversion from std::string to " << typeid(T).name();
|
s << "No conversion from std::string to " << typeid(T).name();
|
||||||
throw std::runtime_error(s.str());
|
throw std::runtime_error(s.str());
|
||||||
}
|
}
|
||||||
static inline boost::optional<T> do_extract_from_bool(value_bool const& /*source*/)
|
static inline std::optional<T> do_extract_from_bool(value_bool const& /*source*/)
|
||||||
{
|
{
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "No conversion from boolean to " << typeid(T).name();
|
s << "No conversion from boolean to " << typeid(T).name();
|
||||||
|
@ -64,110 +64,106 @@ struct extract_value
|
||||||
template<>
|
template<>
|
||||||
struct extract_value<value_bool>
|
struct extract_value<value_bool>
|
||||||
{
|
{
|
||||||
static inline boost::optional<value_bool> do_extract_from_string(std::string const& source)
|
static inline std::optional<value_bool> do_extract_from_string(std::string const& source)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
if (mapnik::util::string2bool(source, result))
|
if (mapnik::util::string2bool(source, result))
|
||||||
return boost::optional<value_bool>(result);
|
return std::optional<value_bool>(result);
|
||||||
return boost::optional<value_bool>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline boost::optional<value_bool> do_extract_from_bool(value_bool const& source)
|
static inline std::optional<value_bool> do_extract_from_bool(value_bool const& source)
|
||||||
{
|
{
|
||||||
return boost::optional<value_bool>(source);
|
return source;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct extract_value<mapnik::boolean_type>
|
struct extract_value<mapnik::boolean_type>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::boolean_type> do_extract_from_string(std::string const& source)
|
static inline std::optional<mapnik::boolean_type> do_extract_from_string(std::string const& source)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
if (mapnik::util::string2bool(source, result))
|
if (mapnik::util::string2bool(source, result))
|
||||||
return boost::optional<mapnik::boolean_type>(result);
|
return std::optional<mapnik::boolean_type>(result);
|
||||||
return boost::optional<mapnik::boolean_type>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline boost::optional<mapnik::boolean_type> do_extract_from_bool(value_bool const& source)
|
static inline std::optional<mapnik::boolean_type> do_extract_from_bool(value_bool const& source)
|
||||||
{
|
{
|
||||||
return boost::optional<mapnik::boolean_type>(source);
|
return std::optional<mapnik::boolean_type>(source);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct extract_value<mapnik::value_integer>
|
struct extract_value<mapnik::value_integer>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::value_integer> do_extract_from_string(std::string const& source)
|
static inline std::optional<mapnik::value_integer> do_extract_from_string(std::string const& source)
|
||||||
{
|
{
|
||||||
mapnik::value_integer result;
|
mapnik::value_integer result;
|
||||||
if (mapnik::util::string2int(source, result))
|
if (mapnik::util::string2int(source, result))
|
||||||
return boost::optional<mapnik::value_integer>(result);
|
return std::optional<mapnik::value_integer>(result);
|
||||||
return boost::optional<mapnik::value_integer>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
static inline boost::optional<mapnik::value_integer> do_extract_from_bool(value_bool const& source)
|
static inline std::optional<mapnik::value_integer> do_extract_from_bool(value_bool const& source)
|
||||||
{
|
{
|
||||||
return boost::optional<mapnik::value_integer>(boost::lexical_cast<mapnik::value_integer>(source));
|
return std::optional<mapnik::value_integer>(boost::lexical_cast<mapnik::value_integer>(source));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct extract_value<mapnik::value_double>
|
struct extract_value<mapnik::value_double>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::value_double> do_extract_from_string(std::string const& source)
|
static inline std::optional<mapnik::value_double> do_extract_from_string(std::string const& source)
|
||||||
{
|
{
|
||||||
mapnik::value_double result;
|
mapnik::value_double result;
|
||||||
if (mapnik::util::string2double(source, result))
|
if (mapnik::util::string2double(source, result))
|
||||||
return boost::optional<double>(result);
|
return std::optional<double>(result);
|
||||||
return boost::optional<double>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline boost::optional<mapnik::value_double> do_extract_from_bool(value_bool const& source)
|
static inline std::optional<mapnik::value_double> do_extract_from_bool(value_bool const& source)
|
||||||
{
|
{
|
||||||
return boost::optional<double>(boost::lexical_cast<double>(source));
|
return std::optional<double>(boost::lexical_cast<double>(source));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct extract_value<mapnik::value_null>
|
struct extract_value<mapnik::value_null>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::value_null> do_extract_from_string(std::string const&)
|
static inline std::optional<mapnik::value_null> do_extract_from_string(std::string const&)
|
||||||
{
|
{
|
||||||
return boost::optional<mapnik::value_null>(); // FIXME
|
return std::nullopt; // FIXME
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline boost::optional<mapnik::value_null> do_extract_from_bool(value_bool const&)
|
static inline std::optional<mapnik::value_null> do_extract_from_bool(value_bool const&)
|
||||||
{
|
{
|
||||||
return boost::optional<mapnik::value_null>(); // FIXME
|
return std::nullopt; // FIXME
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct extract_value<std::string>
|
struct extract_value<std::string>
|
||||||
{
|
{
|
||||||
static inline boost::optional<std::string> do_extract_from_string(std::string const& source)
|
static inline std::optional<std::string> do_extract_from_string(std::string const& source)
|
||||||
{
|
{
|
||||||
return boost::optional<std::string>(source);
|
return std::optional<std::string>(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline boost::optional<std::string> do_extract_from_bool(value_bool const& source)
|
static inline std::optional<std::string> do_extract_from_bool(value_bool const& source)
|
||||||
{
|
{
|
||||||
if (source)
|
return source ? "true" : "false";
|
||||||
{
|
|
||||||
return boost::optional<std::string>("true");
|
|
||||||
}
|
|
||||||
return boost::optional<std::string>("false");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T> param_cast(std::string const& source)
|
std::optional<T> param_cast(std::string const& source)
|
||||||
{
|
{
|
||||||
return extract_value<T>::do_extract_from_string(source);
|
return extract_value<T>::do_extract_from_string(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T> param_cast(value_bool const& source)
|
std::optional<T> param_cast(value_bool const& source)
|
||||||
{
|
{
|
||||||
return extract_value<T>::do_extract_from_bool(source);
|
return extract_value<T>::do_extract_from_bool(source);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +173,7 @@ boost::optional<T> param_cast(value_bool const& source)
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct value_extractor_visitor
|
struct value_extractor_visitor
|
||||||
{
|
{
|
||||||
value_extractor_visitor(boost::optional<T>& var)
|
value_extractor_visitor(std::optional<T>& var)
|
||||||
: var_(var)
|
: var_(var)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -200,7 +196,7 @@ struct value_extractor_visitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<T>& var_;
|
std::optional<T>& var_;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace params_detail {
|
namespace params_detail {
|
||||||
|
@ -209,11 +205,11 @@ template<typename T>
|
||||||
struct converter
|
struct converter
|
||||||
{
|
{
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
using return_type = boost::optional<value_type>;
|
using return_type = std::optional<value_type>;
|
||||||
static return_type
|
static return_type
|
||||||
extract(parameters const& params, std::string const& name, boost::optional<T> const& default_opt_value)
|
extract(parameters const& params, std::string const& name, std::optional<T> const& default_opt_value)
|
||||||
{
|
{
|
||||||
boost::optional<T> result(default_opt_value);
|
std::optional<T> result(default_opt_value);
|
||||||
parameters::const_iterator itr = params.find(name);
|
parameters::const_iterator itr = params.find(name);
|
||||||
if (itr != params.end())
|
if (itr != params.end())
|
||||||
{
|
{
|
||||||
|
@ -226,15 +222,15 @@ struct converter
|
||||||
} // end namespace params_detail
|
} // end namespace params_detail
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T> parameters::get(std::string const& key) const
|
std::optional<T> parameters::get(std::string const& key) const
|
||||||
{
|
{
|
||||||
return params_detail::converter<T>::extract(*this, key, boost::none);
|
return params_detail::converter<T>::extract(*this, key, std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T> parameters::get(std::string const& key, T const& default_opt_value) const
|
std::optional<T> parameters::get(std::string const& key, T const& default_opt_value) const
|
||||||
{
|
{
|
||||||
return params_detail::converter<T>::extract(*this, key, boost::optional<T>(default_opt_value));
|
return params_detail::converter<T>::extract(*this, key, std::optional<T>(default_opt_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
|
@ -73,7 +73,7 @@ class MAPNIK_DECL projection
|
||||||
bool operator!=(const projection& other) const;
|
bool operator!=(const projection& other) const;
|
||||||
bool is_initialized() const;
|
bool is_initialized() const;
|
||||||
bool is_geographic() const;
|
bool is_geographic() const;
|
||||||
boost::optional<well_known_srs_e> well_known() const;
|
std::optional<well_known_srs_e> well_known() const;
|
||||||
std::string const& params() const;
|
std::string const& params() const;
|
||||||
void forward(double& x, double& y) const;
|
void forward(double& x, double& y) const;
|
||||||
void inverse(double& x, double& y) const;
|
void inverse(double& x, double& y) const;
|
||||||
|
|
|
@ -29,11 +29,7 @@
|
||||||
#include <mapnik/util/noncopyable.hpp>
|
#include <mapnik/util/noncopyable.hpp>
|
||||||
#include <mapnik/util/variant.hpp>
|
#include <mapnik/util/variant.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
#include <optional>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -44,7 +40,7 @@ class raster : private util::noncopyable
|
||||||
box2d<double> query_ext_;
|
box2d<double> query_ext_;
|
||||||
image_any data_;
|
image_any data_;
|
||||||
double filter_factor_;
|
double filter_factor_;
|
||||||
boost::optional<double> nodata_;
|
std::optional<double> nodata_;
|
||||||
|
|
||||||
template<typename ImageData>
|
template<typename ImageData>
|
||||||
raster(box2d<double> const& ext, box2d<double> const& query_ext, ImageData&& data, double filter_factor)
|
raster(box2d<double> const& ext, box2d<double> const& query_ext, ImageData&& data, double filter_factor)
|
||||||
|
@ -64,7 +60,7 @@ class raster : private util::noncopyable
|
||||||
|
|
||||||
void set_nodata(double _nodata) { nodata_ = _nodata; }
|
void set_nodata(double _nodata) { nodata_ = _nodata; }
|
||||||
|
|
||||||
boost::optional<double> const& nodata() const { return nodata_; }
|
std::optional<double> const& nodata() const { return nodata_; }
|
||||||
|
|
||||||
double get_filter_factor() const { return filter_factor_; }
|
double get_filter_factor() const { return filter_factor_; }
|
||||||
|
|
||||||
|
|
|
@ -42,14 +42,9 @@
|
||||||
#include <mapnik/enumeration.hpp>
|
#include <mapnik/enumeration.hpp>
|
||||||
#include <mapnik/image.hpp>
|
#include <mapnik/image.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -193,7 +188,7 @@ class MAPNIK_DECL raster_colorizer
|
||||||
colorizer_stops const& get_stops() const { return stops_; }
|
colorizer_stops const& get_stops() const { return stops_; }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void colorize(image_rgba8& out, T const& in, boost::optional<double> const& nodata, feature_impl const& f) const;
|
void colorize(image_rgba8& out, T const& in, std::optional<double> const& nodata, feature_impl const& f) const;
|
||||||
|
|
||||||
//! \brief Perform the translation of input to output
|
//! \brief Perform the translation of input to output
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <mapnik/raster_colorizer.hpp>
|
#include <mapnik/raster_colorizer.hpp>
|
||||||
#include <mapnik/proj_transform.hpp>
|
#include <mapnik/proj_transform.hpp>
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
|
#include <mapnik/renderer_common.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
|
@ -66,7 +67,7 @@ struct image_dispatcher
|
||||||
raster_symbolizer const& sym,
|
raster_symbolizer const& sym,
|
||||||
feature_impl const& feature,
|
feature_impl const& feature,
|
||||||
F& composite,
|
F& composite,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
bool need_scaling)
|
bool need_scaling)
|
||||||
: start_x_(start_x)
|
: start_x_(start_x)
|
||||||
, start_y_(start_y)
|
, start_y_(start_y)
|
||||||
|
@ -156,7 +157,7 @@ struct image_dispatcher
|
||||||
raster_symbolizer const& sym_;
|
raster_symbolizer const& sym_;
|
||||||
feature_impl const& feature_;
|
feature_impl const& feature_;
|
||||||
composite_function& composite_;
|
composite_function& composite_;
|
||||||
boost::optional<double> const& nodata_;
|
std::optional<double> const& nodata_;
|
||||||
bool need_scaling_;
|
bool need_scaling_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,7 +182,7 @@ struct image_warp_dispatcher
|
||||||
raster_symbolizer const& sym,
|
raster_symbolizer const& sym,
|
||||||
feature_impl const& feature,
|
feature_impl const& feature,
|
||||||
F& composite,
|
F& composite,
|
||||||
boost::optional<double> const& nodata)
|
std::optional<double> const& nodata)
|
||||||
: prj_trans_(prj_trans)
|
: prj_trans_(prj_trans)
|
||||||
, start_x_(start_x)
|
, start_x_(start_x)
|
||||||
, start_y_(start_y)
|
, start_y_(start_y)
|
||||||
|
@ -265,7 +266,7 @@ struct image_warp_dispatcher
|
||||||
raster_symbolizer const& sym_;
|
raster_symbolizer const& sym_;
|
||||||
feature_impl const& feature_;
|
feature_impl const& feature_;
|
||||||
composite_function& composite_;
|
composite_function& composite_;
|
||||||
boost::optional<double> const& nodata_;
|
std::optional<double> const& nodata_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
|
@ -6,19 +6,14 @@
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <optional>
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
enum simplify_algorithm_e { radial_distance = 0, douglas_peucker, visvalingam_whyatt, zhao_saalfeld };
|
enum simplify_algorithm_e { radial_distance = 0, douglas_peucker, visvalingam_whyatt, zhao_saalfeld };
|
||||||
|
|
||||||
MAPNIK_DECL boost::optional<simplify_algorithm_e> simplify_algorithm_from_string(std::string const& name);
|
MAPNIK_DECL std::optional<simplify_algorithm_e> simplify_algorithm_from_string(std::string const& name);
|
||||||
MAPNIK_DECL boost::optional<std::string> simplify_algorithm_to_string(simplify_algorithm_e algorithm);
|
MAPNIK_DECL std::optional<std::string> simplify_algorithm_to_string(simplify_algorithm_e algorithm);
|
||||||
|
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,6 @@
|
||||||
#define MAPNIK_SPAN_IMAGE_FILTER_INCLUDED
|
#define MAPNIK_SPAN_IMAGE_FILTER_INCLUDED
|
||||||
|
|
||||||
#include <mapnik/safe_cast.hpp>
|
#include <mapnik/safe_cast.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore_agg.hpp>
|
#include <mapnik/warning_ignore_agg.hpp>
|
||||||
|
@ -38,7 +31,7 @@ MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include "agg_span_image_filter_rgba.h"
|
#include "agg_span_image_filter_rgba.h"
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
#include <limits>
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -58,7 +51,7 @@ class span_image_resample_gray_affine : public agg::span_image_resample_affine<S
|
||||||
span_image_resample_gray_affine(source_type& src,
|
span_image_resample_gray_affine(source_type& src,
|
||||||
interpolator_type& inter,
|
interpolator_type& inter,
|
||||||
agg::image_filter_lut const& filter,
|
agg::image_filter_lut const& filter,
|
||||||
boost::optional<value_type> const& nodata_value)
|
std::optional<value_type> const& nodata_value)
|
||||||
: base_type(src, inter, filter)
|
: base_type(src, inter, filter)
|
||||||
, nodata_value_(nodata_value)
|
, nodata_value_(nodata_value)
|
||||||
{}
|
{}
|
||||||
|
@ -152,7 +145,7 @@ class span_image_resample_gray_affine : public agg::span_image_resample_affine<S
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::optional<value_type> nodata_value_;
|
std::optional<value_type> nodata_value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Source>
|
template<class Source>
|
||||||
|
@ -170,7 +163,7 @@ class span_image_resample_rgba_affine : public agg::span_image_resample_rgba_aff
|
||||||
span_image_resample_rgba_affine(source_type& src,
|
span_image_resample_rgba_affine(source_type& src,
|
||||||
interpolator_type& inter,
|
interpolator_type& inter,
|
||||||
agg::image_filter_lut const& _filter,
|
agg::image_filter_lut const& _filter,
|
||||||
boost::optional<value_type> const& nodata_value)
|
std::optional<value_type> const& nodata_value)
|
||||||
: agg::span_image_resample_rgba_affine<Source>(src, inter, _filter)
|
: agg::span_image_resample_rgba_affine<Source>(src, inter, _filter)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
// boost
|
#include <optional>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace property_tree {
|
namespace property_tree {
|
||||||
|
@ -109,7 +108,7 @@ class MAPNIK_DECL svg_parser : private util::noncopyable
|
||||||
std::map<std::string, gradient> gradient_map_;
|
std::map<std::string, gradient> gradient_map_;
|
||||||
std::map<std::string, boost::property_tree::detail::rapidxml::xml_node<char> const*> node_cache_;
|
std::map<std::string, boost::property_tree::detail::rapidxml::xml_node<char> const*> node_cache_;
|
||||||
mapnik::css_data css_data_;
|
mapnik::css_data css_data_;
|
||||||
boost::optional<viewbox> vbox_{};
|
std::optional<viewbox> vbox_{};
|
||||||
double normalized_diagonal_ = 0.0;
|
double normalized_diagonal_ = 0.0;
|
||||||
agg::trans_affine viewbox_tr_{};
|
agg::trans_affine viewbox_tr_{};
|
||||||
std::deque<double> font_sizes_{};
|
std::deque<double> font_sizes_{};
|
||||||
|
|
|
@ -50,12 +50,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <optional>
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -129,21 +124,21 @@ struct enum_traits
|
||||||
template<>
|
template<>
|
||||||
struct enum_traits<composite_mode_e>
|
struct enum_traits<composite_mode_e>
|
||||||
{
|
{
|
||||||
using result_type = boost::optional<composite_mode_e>;
|
using result_type = std::optional<composite_mode_e>;
|
||||||
static result_type from_string(std::string const& str) { return comp_op_from_string(str); }
|
static result_type from_string(std::string const& str) { return comp_op_from_string(str); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct enum_traits<scaling_method_e>
|
struct enum_traits<scaling_method_e>
|
||||||
{
|
{
|
||||||
using result_type = boost::optional<scaling_method_e>;
|
using result_type = std::optional<scaling_method_e>;
|
||||||
static result_type from_string(std::string const& str) { return scaling_method_from_string(str); }
|
static result_type from_string(std::string const& str) { return scaling_method_from_string(str); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct enum_traits<simplify_algorithm_e>
|
struct enum_traits<simplify_algorithm_e>
|
||||||
{
|
{
|
||||||
using result_type = boost::optional<simplify_algorithm_e>;
|
using result_type = std::optional<simplify_algorithm_e>;
|
||||||
static result_type from_string(std::string const& str) { return simplify_algorithm_from_string(str); }
|
static result_type from_string(std::string const& str) { return simplify_algorithm_from_string(str); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -151,7 +146,7 @@ struct enum_traits<simplify_algorithm_e>
|
||||||
template<> \
|
template<> \
|
||||||
struct enum_traits<e> \
|
struct enum_traits<e> \
|
||||||
{ \
|
{ \
|
||||||
using result_type = boost::optional<e>; \
|
using result_type = std::optional<e>; \
|
||||||
static result_type from_string(std::string const& str) \
|
static result_type from_string(std::string const& str) \
|
||||||
{ \
|
{ \
|
||||||
enumeration<e, alias##_to_string, alias##_from_string, alias##_lookup> enum_; \
|
enumeration<e, alias##_to_string, alias##_from_string, alias##_lookup> enum_; \
|
||||||
|
@ -433,7 +428,7 @@ T get(symbolizer_base const& sym,
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T>
|
std::optional<T>
|
||||||
get_optional(symbolizer_base const& sym, keys key, mapnik::feature_impl const& feature, attributes const& vars)
|
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;
|
using const_iterator = symbolizer_base::cont_type::const_iterator;
|
||||||
|
@ -442,7 +437,7 @@ boost::optional<T>
|
||||||
{
|
{
|
||||||
return util::apply_visitor(extract_value<T>(feature, vars), itr->second);
|
return util::apply_visitor(extract_value<T>(feature, vars), itr->second);
|
||||||
}
|
}
|
||||||
return boost::optional<T>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -470,7 +465,7 @@ T get(symbolizer_base const& sym, keys key, T const& default_value)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T> get_optional(symbolizer_base const& sym, keys key)
|
std::optional<T> get_optional(symbolizer_base const& sym, keys key)
|
||||||
{
|
{
|
||||||
using const_iterator = symbolizer_base::cont_type::const_iterator;
|
using const_iterator = symbolizer_base::cont_type::const_iterator;
|
||||||
const_iterator itr = sym.properties.find(key);
|
const_iterator itr = sym.properties.find(key);
|
||||||
|
@ -478,7 +473,7 @@ boost::optional<T> get_optional(symbolizer_base const& sym, keys key)
|
||||||
{
|
{
|
||||||
return util::apply_visitor(extract_raw_value<T>(), itr->second);
|
return util::apply_visitor(extract_raw_value<T>(), itr->second);
|
||||||
}
|
}
|
||||||
return boost::optional<T>{};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
|
@ -360,14 +360,14 @@ struct set_symbolizer_property_impl
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boost::optional<value_type> val = node.get_opt_attr<value_type>(name);
|
const auto val = node.get_opt_attr<value_type>(name);
|
||||||
if (val)
|
if (val)
|
||||||
put(sym, key, *val);
|
put(sym, key, *val);
|
||||||
}
|
}
|
||||||
catch (config_error const& ex)
|
catch (config_error const& ex)
|
||||||
{
|
{
|
||||||
// try parsing as an expression
|
// try parsing as an expression
|
||||||
boost::optional<expression_ptr> val = node.get_opt_attr<expression_ptr>(name);
|
const auto val = node.get_opt_attr<expression_ptr>(name);
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
// first try pre-evaluate expressions which don't have dynamic properties
|
// first try pre-evaluate expressions which don't have dynamic properties
|
||||||
|
@ -395,7 +395,7 @@ struct set_symbolizer_property_impl<Symbolizer, transform_type, false>
|
||||||
{
|
{
|
||||||
static void apply(Symbolizer& sym, keys key, std::string const& name, xml_node const& node)
|
static void apply(Symbolizer& sym, keys key, std::string const& name, xml_node const& node)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> transform = node.get_opt_attr<std::string>(name);
|
const auto transform = node.get_opt_attr<std::string>(name);
|
||||||
if (transform)
|
if (transform)
|
||||||
put(sym, key, mapnik::parse_transform(*transform));
|
put(sym, key, mapnik::parse_transform(*transform));
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ struct set_symbolizer_property_impl<Symbolizer, dash_array, false>
|
||||||
{
|
{
|
||||||
static void apply(Symbolizer& sym, keys key, std::string const& name, xml_node const& node)
|
static void apply(Symbolizer& sym, keys key, std::string const& name, xml_node const& node)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> str = node.get_opt_attr<std::string>(name);
|
const auto str = node.get_opt_attr<std::string>(name);
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
dash_array dash;
|
dash_array dash;
|
||||||
|
@ -416,14 +416,14 @@ struct set_symbolizer_property_impl<Symbolizer, dash_array, false>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::optional<expression_ptr> val = node.get_opt_attr<expression_ptr>(name);
|
const auto val = node.get_opt_attr<expression_ptr>(name);
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
// first try pre-evaluate expressions which don't have dynamic properties
|
// first try pre-evaluate expressions which don't have dynamic properties
|
||||||
auto result = pre_evaluate_expression<mapnik::value>(*val);
|
const auto [value, is_evaluated] = pre_evaluate_expression<mapnik::value>(*val);
|
||||||
if (std::get<1>(result))
|
if (is_evaluated)
|
||||||
{
|
{
|
||||||
set_property_from_value(sym, key, std::get<0>(result));
|
set_property_from_value(sym, key, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -447,25 +447,25 @@ struct set_symbolizer_property_impl<Symbolizer, T, true>
|
||||||
static void apply(Symbolizer& sym, keys key, std::string const& name, xml_node const& node)
|
static void apply(Symbolizer& sym, keys key, std::string const& name, xml_node const& node)
|
||||||
{
|
{
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
boost::optional<std::string> enum_str = node.get_opt_attr<std::string>(name);
|
const auto enum_str = node.get_opt_attr<std::string>(name);
|
||||||
if (enum_str)
|
if (enum_str)
|
||||||
{
|
{
|
||||||
boost::optional<value_type> enum_val = detail::enum_traits<value_type>::from_string(*enum_str);
|
const auto enum_val = detail::enum_traits<value_type>::from_string(*enum_str);
|
||||||
if (enum_val)
|
if (enum_val)
|
||||||
{
|
{
|
||||||
put(sym, key, *enum_val);
|
put(sym, key, *enum_val);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::optional<expression_ptr> val = node.get_opt_attr<expression_ptr>(name);
|
const auto val = node.get_opt_attr<expression_ptr>(name);
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
// first try pre-evaluating expression
|
// first try pre-evaluating expression
|
||||||
auto result = pre_evaluate_expression<value>(*val);
|
const auto [result_value, is_evaluated] = pre_evaluate_expression<value>(*val);
|
||||||
if (std::get<1>(result))
|
if (is_evaluated)
|
||||||
{
|
{
|
||||||
boost::optional<value_type> enum_val2 =
|
const auto enum_val2 =
|
||||||
detail::enum_traits<value_type>::from_string(std::get<0>(result).to_string());
|
detail::enum_traits<value_type>::from_string(result_value.to_string());
|
||||||
if (enum_val2)
|
if (enum_val2)
|
||||||
{
|
{
|
||||||
put(sym, key, *enum_val);
|
put(sym, key, *enum_val);
|
||||||
|
|
|
@ -50,19 +50,19 @@ class MAPNIK_DECL format_node : public node
|
||||||
void set_child(node_ptr child);
|
void set_child(node_ptr child);
|
||||||
node_ptr get_child() const;
|
node_ptr get_child() const;
|
||||||
|
|
||||||
boost::optional<std::string> face_name;
|
std::optional<std::string> face_name;
|
||||||
boost::optional<font_set> fontset;
|
std::optional<font_set> fontset;
|
||||||
boost::optional<symbolizer_base::value_type> text_size;
|
std::optional<symbolizer_base::value_type> text_size;
|
||||||
boost::optional<symbolizer_base::value_type> character_spacing;
|
std::optional<symbolizer_base::value_type> character_spacing;
|
||||||
boost::optional<symbolizer_base::value_type> line_spacing;
|
std::optional<symbolizer_base::value_type> line_spacing;
|
||||||
boost::optional<symbolizer_base::value_type> text_opacity;
|
std::optional<symbolizer_base::value_type> text_opacity;
|
||||||
boost::optional<symbolizer_base::value_type> wrap_before;
|
std::optional<symbolizer_base::value_type> wrap_before;
|
||||||
boost::optional<symbolizer_base::value_type> repeat_wrap_char;
|
std::optional<symbolizer_base::value_type> repeat_wrap_char;
|
||||||
boost::optional<symbolizer_base::value_type> text_transform;
|
std::optional<symbolizer_base::value_type> text_transform;
|
||||||
boost::optional<symbolizer_base::value_type> fill;
|
std::optional<symbolizer_base::value_type> fill;
|
||||||
boost::optional<symbolizer_base::value_type> halo_fill;
|
std::optional<symbolizer_base::value_type> halo_fill;
|
||||||
boost::optional<symbolizer_base::value_type> halo_radius;
|
std::optional<symbolizer_base::value_type> halo_radius;
|
||||||
boost::optional<symbolizer_base::value_type> ff_settings;
|
std::optional<symbolizer_base::value_type> ff_settings;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
node_ptr child_;
|
node_ptr child_;
|
||||||
|
|
|
@ -25,12 +25,7 @@
|
||||||
|
|
||||||
#include <mapnik/text/formatting/base.hpp>
|
#include <mapnik/text/formatting/base.hpp>
|
||||||
#include <mapnik/text/text_properties.hpp>
|
#include <mapnik/text/text_properties.hpp>
|
||||||
|
#include <optional>
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
namespace formatting {
|
namespace formatting {
|
||||||
|
@ -48,18 +43,18 @@ class MAPNIK_DECL layout_node : public node
|
||||||
void set_child(node_ptr child);
|
void set_child(node_ptr child);
|
||||||
node_ptr get_child() const;
|
node_ptr get_child() const;
|
||||||
//
|
//
|
||||||
boost::optional<symbolizer_base::value_type> dx;
|
std::optional<symbolizer_base::value_type> dx;
|
||||||
boost::optional<symbolizer_base::value_type> dy;
|
std::optional<symbolizer_base::value_type> dy;
|
||||||
boost::optional<symbolizer_base::value_type> halign;
|
std::optional<symbolizer_base::value_type> halign;
|
||||||
boost::optional<symbolizer_base::value_type> valign;
|
std::optional<symbolizer_base::value_type> valign;
|
||||||
boost::optional<symbolizer_base::value_type> jalign;
|
std::optional<symbolizer_base::value_type> jalign;
|
||||||
boost::optional<symbolizer_base::value_type> text_ratio;
|
std::optional<symbolizer_base::value_type> text_ratio;
|
||||||
boost::optional<symbolizer_base::value_type> wrap_width;
|
std::optional<symbolizer_base::value_type> wrap_width;
|
||||||
boost::optional<symbolizer_base::value_type> wrap_char;
|
std::optional<symbolizer_base::value_type> wrap_char;
|
||||||
boost::optional<symbolizer_base::value_type> wrap_before;
|
std::optional<symbolizer_base::value_type> wrap_before;
|
||||||
boost::optional<symbolizer_base::value_type> repeat_wrap_char;
|
std::optional<symbolizer_base::value_type> repeat_wrap_char;
|
||||||
boost::optional<symbolizer_base::value_type> rotate_displacement;
|
std::optional<symbolizer_base::value_type> rotate_displacement;
|
||||||
boost::optional<symbolizer_base::value_type> orientation;
|
std::optional<symbolizer_base::value_type> orientation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
node_ptr child_;
|
node_ptr child_;
|
||||||
|
|
|
@ -60,13 +60,13 @@ struct set_property_from_xml_impl
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boost::optional<target_type> val_ = node.get_opt_attr<target_type>(name);
|
const auto val_ = node.get_opt_attr<target_type>(name);
|
||||||
if (val_)
|
if (val_)
|
||||||
val = *val_;
|
val = *val_;
|
||||||
}
|
}
|
||||||
catch (config_error const& ex)
|
catch (config_error const& ex)
|
||||||
{
|
{
|
||||||
boost::optional<expression_ptr> val_ = node.get_opt_attr<expression_ptr>(name);
|
const auto val_ = node.get_opt_attr<expression_ptr>(name);
|
||||||
if (val_)
|
if (val_)
|
||||||
val = *val_;
|
val = *val_;
|
||||||
else
|
else
|
||||||
|
@ -86,13 +86,13 @@ struct set_property_from_xml_impl<std::string, false>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boost::optional<expression_ptr> val_ = node.get_opt_attr<expression_ptr>(name);
|
const auto val_ = node.get_opt_attr<expression_ptr>(name);
|
||||||
if (val_)
|
if (val_)
|
||||||
val = *val_;
|
val = *val_;
|
||||||
}
|
}
|
||||||
catch (config_error const& ex)
|
catch (config_error const& ex)
|
||||||
{
|
{
|
||||||
boost::optional<target_type> val_ = node.get_opt_attr<target_type>(name);
|
const auto val_ = node.get_opt_attr<target_type>(name);
|
||||||
if (val_)
|
if (val_)
|
||||||
val = *val_;
|
val = *val_;
|
||||||
else
|
else
|
||||||
|
@ -112,7 +112,7 @@ struct set_property_from_xml_impl<T0, true>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boost::optional<std::string> enum_str = node.get_opt_attr<std::string>(name);
|
const auto enum_str = node.get_opt_attr<std::string>(name);
|
||||||
if (enum_str)
|
if (enum_str)
|
||||||
{
|
{
|
||||||
target_enum_type e;
|
target_enum_type e;
|
||||||
|
@ -122,7 +122,7 @@ struct set_property_from_xml_impl<T0, true>
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
boost::optional<expression_ptr> expr = node.get_opt_attr<expression_ptr>(name);
|
const auto expr = node.get_opt_attr<expression_ptr>(name);
|
||||||
if (expr)
|
if (expr)
|
||||||
val = *expr;
|
val = *expr;
|
||||||
else
|
else
|
||||||
|
|
|
@ -35,11 +35,11 @@
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/property_tree/ptree_fwd.hpp>
|
#include <boost/property_tree/ptree_fwd.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace detail {
|
||||||
struct evaluated_format_properties
|
struct evaluated_format_properties
|
||||||
{
|
{
|
||||||
std::string face_name;
|
std::string face_name;
|
||||||
boost::optional<font_set> fontset;
|
std::optional<font_set> fontset;
|
||||||
double text_size;
|
double text_size;
|
||||||
double character_spacing;
|
double character_spacing;
|
||||||
double line_spacing;
|
double line_spacing;
|
||||||
|
@ -113,7 +113,7 @@ struct MAPNIK_DECL format_properties
|
||||||
void add_expressions(expression_set& output) const;
|
void add_expressions(expression_set& output) const;
|
||||||
|
|
||||||
std::string face_name;
|
std::string face_name;
|
||||||
boost::optional<font_set> fontset;
|
std::optional<font_set> fontset;
|
||||||
// expressions
|
// expressions
|
||||||
symbolizer_base::value_type text_size;
|
symbolizer_base::value_type text_size;
|
||||||
symbolizer_base::value_type character_spacing;
|
symbolizer_base::value_type character_spacing;
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/fusion/include/at.hpp>
|
#include <boost/fusion/include/at.hpp>
|
||||||
#include <boost/fusion/include/vector.hpp>
|
#include <boost/fusion/include/vector.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
|
@ -40,7 +40,7 @@ MAPNIK_DECL void reproject_and_scale_raster(raster& target,
|
||||||
double offset_y,
|
double offset_y,
|
||||||
unsigned mesh_size,
|
unsigned mesh_size,
|
||||||
scaling_method_e scaling_method,
|
scaling_method_e scaling_method,
|
||||||
boost::optional<double> const& nodata_value);
|
std::optional<double> const& nodata_value);
|
||||||
|
|
||||||
MAPNIK_DECL void reproject_and_scale_raster(raster& target,
|
MAPNIK_DECL void reproject_and_scale_raster(raster& target,
|
||||||
raster const& source,
|
raster const& source,
|
||||||
|
@ -61,7 +61,7 @@ MAPNIK_DECL void warp_image(T& target,
|
||||||
unsigned mesh_size,
|
unsigned mesh_size,
|
||||||
scaling_method_e scaling_method,
|
scaling_method_e scaling_method,
|
||||||
double filter_factor,
|
double filter_factor,
|
||||||
boost::optional<double> const& nodata_value);
|
std::optional<double> const& nodata_value);
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
||||||
#endif // MAPNIK_WARP_HPP
|
#endif // MAPNIK_WARP_HPP
|
||||||
|
|
|
@ -28,13 +28,8 @@
|
||||||
#include <mapnik/geometry/point.hpp>
|
#include <mapnik/geometry/point.hpp>
|
||||||
#include <mapnik/util/math.hpp>
|
#include <mapnik/util/math.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
@ -51,8 +46,8 @@ constexpr double MERC_MAX_LATITUDE = 85.0511287798065923778;
|
||||||
extern MAPNIK_DECL std::string const MAPNIK_GEOGRAPHIC_PROJ;
|
extern MAPNIK_DECL std::string const MAPNIK_GEOGRAPHIC_PROJ;
|
||||||
extern MAPNIK_DECL std::string const MAPNIK_WEBMERCATOR_PROJ;
|
extern MAPNIK_DECL std::string const MAPNIK_WEBMERCATOR_PROJ;
|
||||||
|
|
||||||
MAPNIK_DECL boost::optional<bool> is_known_geographic(std::string const& srs);
|
MAPNIK_DECL std::optional<bool> is_known_geographic(std::string const& srs);
|
||||||
MAPNIK_DECL boost::optional<well_known_srs_e> is_well_known_srs(std::string const& srs);
|
MAPNIK_DECL std::optional<well_known_srs_e> is_well_known_srs(std::string const& srs);
|
||||||
|
|
||||||
MAPNIK_DECL bool lonlat2merc(double& x, double& y);
|
MAPNIK_DECL bool lonlat2merc(double& x, double& y);
|
||||||
MAPNIK_DECL bool lonlat2merc(double* x, double* y, std::size_t point_count, std::size_t stride = 1);
|
MAPNIK_DECL bool lonlat2merc(double* x, double* y, std::size_t point_count, std::size_t stride = 1);
|
||||||
|
|
|
@ -36,17 +36,12 @@
|
||||||
#include <mapnik/attribute.hpp>
|
#include <mapnik/attribute.hpp>
|
||||||
#include <mapnik/text/font_feature_settings.hpp>
|
#include <mapnik/text/font_feature_settings.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <optional>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
@ -55,7 +50,7 @@ namespace detail {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct do_xml_attribute_cast
|
struct do_xml_attribute_cast
|
||||||
{
|
{
|
||||||
static inline boost::optional<T> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& /*source*/)
|
static inline std::optional<T> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& /*source*/)
|
||||||
{
|
{
|
||||||
std::string err_msg("No conversion from std::string to ");
|
std::string err_msg("No conversion from std::string to ");
|
||||||
err_msg += std::string(typeid(T).name());
|
err_msg += std::string(typeid(T).name());
|
||||||
|
@ -67,13 +62,13 @@ struct do_xml_attribute_cast
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<mapnik::boolean_type>
|
struct do_xml_attribute_cast<mapnik::boolean_type>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::boolean_type> xml_attribute_cast_impl(xml_tree const& /*tree*/,
|
static inline std::optional<mapnik::boolean_type> xml_attribute_cast_impl(xml_tree const& /*tree*/,
|
||||||
std::string const& source)
|
std::string const& source)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
if (mapnik::util::string2bool(source, result))
|
if (mapnik::util::string2bool(source, result))
|
||||||
return boost::optional<mapnik::boolean_type>(result);
|
return result;
|
||||||
return boost::optional<mapnik::boolean_type>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,13 +76,13 @@ struct do_xml_attribute_cast<mapnik::boolean_type>
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<mapnik::value_bool>
|
struct do_xml_attribute_cast<mapnik::value_bool>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::value_bool> xml_attribute_cast_impl(xml_tree const& /*tree*/,
|
static inline std::optional<mapnik::value_bool> xml_attribute_cast_impl(xml_tree const& /*tree*/,
|
||||||
std::string const& source)
|
std::string const& source)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
if (mapnik::util::string2bool(source, result))
|
if (mapnik::util::string2bool(source, result))
|
||||||
return boost::optional<mapnik::value_bool>(result);
|
return result;
|
||||||
return boost::optional<mapnik::value_bool>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,12 +90,12 @@ struct do_xml_attribute_cast<mapnik::value_bool>
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<int>
|
struct do_xml_attribute_cast<int>
|
||||||
{
|
{
|
||||||
static inline boost::optional<int> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
static inline std::optional<int> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
if (mapnik::util::string2int(source, result))
|
if (mapnik::util::string2int(source, result))
|
||||||
return boost::optional<int>(result);
|
return result;
|
||||||
return boost::optional<int>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,13 +104,13 @@ struct do_xml_attribute_cast<int>
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<mapnik::value_integer>
|
struct do_xml_attribute_cast<mapnik::value_integer>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::value_integer> xml_attribute_cast_impl(xml_tree const& /*tree*/,
|
static inline std::optional<mapnik::value_integer> xml_attribute_cast_impl(xml_tree const& /*tree*/,
|
||||||
std::string const& source)
|
std::string const& source)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
if (mapnik::util::string2int(source, result))
|
if (mapnik::util::string2int(source, result))
|
||||||
return boost::optional<mapnik::value_integer>(result);
|
return result;
|
||||||
return boost::optional<mapnik::value_integer>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -126,12 +121,12 @@ struct do_xml_attribute_cast<mapnik::value_integer>
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<unsigned>
|
struct do_xml_attribute_cast<unsigned>
|
||||||
{
|
{
|
||||||
static inline boost::optional<unsigned> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
static inline std::optional<unsigned> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
if (mapnik::util::string2int(source, result) && result >= 0)
|
if (mapnik::util::string2int(source, result) && result >= 0)
|
||||||
return boost::optional<unsigned>(static_cast<unsigned>(result));
|
return static_cast<unsigned>(result);
|
||||||
return boost::optional<unsigned>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -139,12 +134,12 @@ struct do_xml_attribute_cast<unsigned>
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<float>
|
struct do_xml_attribute_cast<float>
|
||||||
{
|
{
|
||||||
static inline boost::optional<float> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
static inline std::optional<float> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
||||||
{
|
{
|
||||||
float result;
|
float result;
|
||||||
if (mapnik::util::string2float(source, result))
|
if (mapnik::util::string2float(source, result))
|
||||||
return boost::optional<float>(result);
|
return result;
|
||||||
return boost::optional<float>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -152,12 +147,12 @@ struct do_xml_attribute_cast<float>
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<double>
|
struct do_xml_attribute_cast<double>
|
||||||
{
|
{
|
||||||
static inline boost::optional<double> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
static inline std::optional<double> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
||||||
{
|
{
|
||||||
double result;
|
double result;
|
||||||
if (mapnik::util::string2double(source, result))
|
if (mapnik::util::string2double(source, result))
|
||||||
return boost::optional<double>(result);
|
return result;
|
||||||
return boost::optional<double>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -169,19 +164,19 @@ template<typename ENUM,
|
||||||
struct do_xml_attribute_cast<mapnik::enumeration<ENUM, F_TO_STRING, F_FROM_STRING, F_LOOKUP>>
|
struct do_xml_attribute_cast<mapnik::enumeration<ENUM, F_TO_STRING, F_FROM_STRING, F_LOOKUP>>
|
||||||
{
|
{
|
||||||
using Enum = mapnik::enumeration<ENUM, F_TO_STRING, F_FROM_STRING, F_LOOKUP>;
|
using Enum = mapnik::enumeration<ENUM, F_TO_STRING, F_FROM_STRING, F_LOOKUP>;
|
||||||
static inline boost::optional<Enum> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
static inline std::optional<Enum> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
|
||||||
{
|
{
|
||||||
using result_type = typename boost::optional<Enum>;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Enum e;
|
Enum e;
|
||||||
e.from_string(source);
|
e.from_string(source);
|
||||||
return result_type(e);
|
return e;
|
||||||
}
|
}
|
||||||
catch (illegal_enum_value const& ex)
|
catch (illegal_enum_value const& ex)
|
||||||
{
|
{
|
||||||
MAPNIK_LOG_ERROR(do_xml_attribute_cast) << ex.what();
|
MAPNIK_LOG_ERROR(do_xml_attribute_cast) << ex.what();
|
||||||
return result_type();
|
return std::nullopt;
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -190,7 +185,7 @@ struct do_xml_attribute_cast<mapnik::enumeration<ENUM, F_TO_STRING, F_FROM_STRIN
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<mapnik::color>
|
struct do_xml_attribute_cast<mapnik::color>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::color> xml_attribute_cast_impl(xml_tree const&, std::string const& source)
|
static inline std::optional<mapnik::color> xml_attribute_cast_impl(xml_tree const&, std::string const& source)
|
||||||
{
|
{
|
||||||
return parse_color(source);
|
return parse_color(source);
|
||||||
}
|
}
|
||||||
|
@ -200,9 +195,9 @@ struct do_xml_attribute_cast<mapnik::color>
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<std::string>
|
struct do_xml_attribute_cast<std::string>
|
||||||
{
|
{
|
||||||
static inline boost::optional<std::string> xml_attribute_cast_impl(xml_tree const&, std::string const& source)
|
static inline std::optional<std::string> xml_attribute_cast_impl(xml_tree const&, std::string const& source)
|
||||||
{
|
{
|
||||||
return boost::optional<std::string>(source);
|
return source;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -210,7 +205,7 @@ struct do_xml_attribute_cast<std::string>
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<mapnik::expression_ptr>
|
struct do_xml_attribute_cast<mapnik::expression_ptr>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::expression_ptr> xml_attribute_cast_impl(xml_tree const& tree,
|
static inline std::optional<mapnik::expression_ptr> xml_attribute_cast_impl(xml_tree const& tree,
|
||||||
std::string const& source)
|
std::string const& source)
|
||||||
{
|
{
|
||||||
std::map<std::string, mapnik::expression_ptr>::const_iterator itr = tree.expr_cache_.find(source);
|
std::map<std::string, mapnik::expression_ptr>::const_iterator itr = tree.expr_cache_.find(source);
|
||||||
|
@ -231,7 +226,7 @@ struct do_xml_attribute_cast<mapnik::expression_ptr>
|
||||||
template<>
|
template<>
|
||||||
struct do_xml_attribute_cast<mapnik::font_feature_settings>
|
struct do_xml_attribute_cast<mapnik::font_feature_settings>
|
||||||
{
|
{
|
||||||
static inline boost::optional<mapnik::font_feature_settings> xml_attribute_cast_impl(xml_tree const&,
|
static inline std::optional<mapnik::font_feature_settings> xml_attribute_cast_impl(xml_tree const&,
|
||||||
std::string const& source)
|
std::string const& source)
|
||||||
{
|
{
|
||||||
return mapnik::font_feature_settings(source);
|
return mapnik::font_feature_settings(source);
|
||||||
|
@ -241,7 +236,7 @@ struct do_xml_attribute_cast<mapnik::font_feature_settings>
|
||||||
} // end namespace detail
|
} // end namespace detail
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T> xml_attribute_cast(xml_tree const& tree, std::string const& source)
|
std::optional<T> xml_attribute_cast(xml_tree const& tree, std::string const& source)
|
||||||
{
|
{
|
||||||
return detail::do_xml_attribute_cast<T>::xml_attribute_cast_impl(tree, source);
|
return detail::do_xml_attribute_cast<T>::xml_attribute_cast_impl(tree, source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,17 +26,12 @@
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/config.hpp> // for MAPNIK_DECL
|
#include <mapnik/config.hpp> // for MAPNIK_DECL
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
class MAPNIK_DECL xml_tree;
|
class MAPNIK_DECL xml_tree;
|
||||||
|
@ -129,7 +124,7 @@ class MAPNIK_DECL xml_node
|
||||||
bool has_attribute(std::string const& name) const;
|
bool has_attribute(std::string const& name) const;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<T> get_opt_attr(std::string const& name) const;
|
std::optional<T> get_opt_attr(std::string const& name) const;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T get_attr(std::string const& name, T const& default_opt_value) const;
|
T get_attr(std::string const& name, T const& default_opt_value) const;
|
||||||
|
|
|
@ -96,23 +96,23 @@ csv_datasource::csv_datasource(parameters const& params)
|
||||||
separator_ = val.front();
|
separator_ = val.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
const auto ext = params.get<std::string>("extent");
|
||||||
if (ext && !ext->empty())
|
if (ext && !ext->empty())
|
||||||
{
|
{
|
||||||
extent_initialized_ = extent_.from_string(*ext);
|
extent_initialized_ = extent_.from_string(*ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> inline_string = params.get<std::string>("inline");
|
const auto inline_string = params.get<std::string>("inline");
|
||||||
if (inline_string)
|
if (inline_string)
|
||||||
{
|
{
|
||||||
inline_string_ = *inline_string;
|
inline_string_ = *inline_string;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
const auto file = params.get<std::string>("file");
|
||||||
if (!file)
|
if (!file)
|
||||||
throw mapnik::datasource_exception("CSV Plugin: missing <file> parameter");
|
throw mapnik::datasource_exception("CSV Plugin: missing <file> parameter");
|
||||||
boost::optional<std::string> base = params.get<std::string>("base");
|
const auto base = params.get<std::string>("base");
|
||||||
if (base)
|
if (base)
|
||||||
filename_ = *base + "/" + *file;
|
filename_ = *base + "/" + *file;
|
||||||
else
|
else
|
||||||
|
@ -254,9 +254,9 @@ mapnik::layer_descriptor csv_datasource::get_descriptor() const
|
||||||
return desc_;
|
return desc_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type_impl(std::istream& stream) const
|
std::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type_impl(std::istream& stream) const
|
||||||
{
|
{
|
||||||
boost::optional<mapnik::datasource_geometry_t> result;
|
std::optional<mapnik::datasource_geometry_t> result;
|
||||||
if (tree_)
|
if (tree_)
|
||||||
{
|
{
|
||||||
int multi_type = 0;
|
int multi_type = 0;
|
||||||
|
@ -282,7 +282,7 @@ boost::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type
|
||||||
int type = static_cast<int>(*result);
|
int type = static_cast<int>(*result);
|
||||||
if (multi_type > 0 && multi_type != type)
|
if (multi_type > 0 && multi_type != type)
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
multi_type = type;
|
multi_type = type;
|
||||||
|
@ -329,7 +329,7 @@ boost::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type
|
||||||
int type = static_cast<int>(*result);
|
int type = static_cast<int>(*result);
|
||||||
if (multi_type > 0 && multi_type != type)
|
if (multi_type > 0 && multi_type != type)
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
multi_type = type;
|
multi_type = type;
|
||||||
|
@ -347,7 +347,7 @@ boost::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
if (inline_string_.empty())
|
if (inline_string_.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,12 +32,12 @@
|
||||||
#include <mapnik/coord.hpp>
|
#include <mapnik/coord.hpp>
|
||||||
#include <mapnik/feature_layer_desc.hpp>
|
#include <mapnik/feature_layer_desc.hpp>
|
||||||
#include <mapnik/value/types.hpp>
|
#include <mapnik/value/types.hpp>
|
||||||
|
#include <mapnik/datasource_plugin.hpp>
|
||||||
#include "csv_utils.hpp"
|
#include "csv_utils.hpp"
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <boost/geometry/strategies/cartesian/disjoint_box_box.hpp>
|
#include <boost/geometry/strategies/cartesian/disjoint_box_box.hpp>
|
||||||
#include <boost/geometry/index/rtree.hpp>
|
#include <boost/geometry/index/rtree.hpp>
|
||||||
|
@ -45,10 +45,8 @@ MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <mapnik/datasource_plugin.hpp>
|
|
||||||
|
|
||||||
template<std::size_t Max, std::size_t Min>
|
template<std::size_t Max, std::size_t Min>
|
||||||
struct csv_linear : boost::geometry::index::linear<Max, Min>
|
struct csv_linear : boost::geometry::index::linear<Max, Min>
|
||||||
|
@ -93,18 +91,18 @@ class csv_datasource : public mapnik::datasource,
|
||||||
|
|
||||||
csv_datasource(mapnik::parameters const& params);
|
csv_datasource(mapnik::parameters const& params);
|
||||||
virtual ~csv_datasource();
|
virtual ~csv_datasource();
|
||||||
mapnik::datasource::datasource_t type() const;
|
mapnik::datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
mapnik::featureset_ptr features(mapnik::query const& q) const override;
|
||||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
mapnik::layer_descriptor get_descriptor() const;
|
mapnik::layer_descriptor get_descriptor() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parse_csv(std::istream&);
|
void parse_csv(std::istream&);
|
||||||
virtual void add_feature(mapnik::value_integer index, mapnik::csv_line const& values);
|
virtual void add_feature(mapnik::value_integer index, mapnik::csv_line const& values) override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type_impl(std::istream&) const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type_impl(std::istream&) const;
|
||||||
|
|
||||||
mapnik::layer_descriptor desc_;
|
mapnik::layer_descriptor desc_;
|
||||||
std::string filename_;
|
std::string filename_;
|
||||||
|
|
|
@ -59,8 +59,8 @@ csv_featureset::csv_featureset(std::string const& filename,
|
||||||
, tr_("utf8")
|
, tr_("utf8")
|
||||||
{
|
{
|
||||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||||
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::instance().find(filename, true);
|
const auto memory = mapnik::mapped_memory_cache::instance().find(filename, true);
|
||||||
if (memory)
|
if (memory.has_value())
|
||||||
{
|
{
|
||||||
mapped_region_ = *memory;
|
mapped_region_ = *memory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ csv_index_featureset::csv_index_featureset(std::string const& filename,
|
||||||
|
|
||||||
{
|
{
|
||||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||||
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::instance().find(filename, true);
|
const auto memory = mapnik::mapped_memory_cache::instance().find(filename, true);
|
||||||
if (memory)
|
if (memory.has_value())
|
||||||
{
|
{
|
||||||
mapped_region_ = *memory;
|
mapped_region_ = *memory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
|
|
||||||
#include <gdal_version.h>
|
#include <gdal_version.h>
|
||||||
|
|
||||||
#include <mutex>
|
|
||||||
|
|
||||||
using mapnik::datasource;
|
using mapnik::datasource;
|
||||||
using mapnik::parameters;
|
using mapnik::parameters;
|
||||||
|
|
||||||
|
@ -69,12 +67,12 @@ gdal_datasource::gdal_datasource(parameters const& params)
|
||||||
mapnik::progress_timer __stats__(std::clog, "gdal_datasource::init");
|
mapnik::progress_timer __stats__(std::clog, "gdal_datasource::init");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
auto file = params.get<std::string>("file");
|
||||||
if (!file)
|
if (!file.has_value())
|
||||||
throw datasource_exception("missing <file> parameter");
|
throw datasource_exception("missing <file> parameter");
|
||||||
|
|
||||||
boost::optional<std::string> base = params.get<std::string>("base");
|
auto base = params.get<std::string>("base");
|
||||||
if (base)
|
if (base.has_value())
|
||||||
{
|
{
|
||||||
dataset_name_ = *base + "/" + *file;
|
dataset_name_ = *base + "/" + *file;
|
||||||
}
|
}
|
||||||
|
@ -120,8 +118,8 @@ gdal_datasource::gdal_datasource(parameters const& params)
|
||||||
|
|
||||||
double tr[6];
|
double tr[6];
|
||||||
bool bbox_override = false;
|
bool bbox_override = false;
|
||||||
boost::optional<std::string> bbox_s = params.get<std::string>("extent");
|
const auto bbox_s = params.get<std::string>("extent");
|
||||||
if (bbox_s)
|
if (bbox_s.has_value())
|
||||||
{
|
{
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: BBox Parameter=" << *bbox_s;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: BBox Parameter=" << *bbox_s;
|
||||||
|
|
||||||
|
@ -212,9 +210,9 @@ box2d<double> gdal_datasource::envelope() const
|
||||||
return extent_;
|
return extent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> gdal_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> gdal_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
return boost::optional<mapnik::datasource_geometry_t>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
layer_descriptor gdal_datasource::get_descriptor() const
|
layer_descriptor gdal_datasource::get_descriptor() const
|
||||||
|
|
|
@ -49,13 +49,13 @@ class gdal_datasource : public mapnik::datasource
|
||||||
public:
|
public:
|
||||||
gdal_datasource(mapnik::parameters const& params);
|
gdal_datasource(mapnik::parameters const& params);
|
||||||
virtual ~gdal_datasource();
|
virtual ~gdal_datasource();
|
||||||
mapnik::datasource::datasource_t type() const;
|
mapnik::datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
mapnik::featureset_ptr features(mapnik::query const& q) const override;
|
||||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
mapnik::layer_descriptor get_descriptor() const;
|
mapnik::layer_descriptor get_descriptor() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<GDALDataset, decltype(&GDALClose)> dataset_;
|
std::unique_ptr<GDALDataset, decltype(&GDALClose)> dataset_;
|
||||||
|
@ -69,7 +69,7 @@ class gdal_datasource : public mapnik::datasource
|
||||||
double dy_;
|
double dy_;
|
||||||
int nbands_;
|
int nbands_;
|
||||||
bool shared_dataset_;
|
bool shared_dataset_;
|
||||||
boost::optional<double> nodata_value_;
|
std::optional<double> nodata_value_;
|
||||||
double nodata_tolerance_;
|
double nodata_tolerance_;
|
||||||
int64_t max_image_area_;
|
int64_t max_image_area_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -86,7 +86,7 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset,
|
||||||
int nbands,
|
int nbands,
|
||||||
double dx,
|
double dx,
|
||||||
double dy,
|
double dy,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
double nodata_tolerance,
|
double nodata_tolerance,
|
||||||
int64_t max_image_area)
|
int64_t max_image_area)
|
||||||
: dataset_(dataset)
|
: dataset_(dataset)
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
#define GDAL_FEATURESET_HPP
|
#define GDAL_FEATURESET_HPP
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#include <mapnik/feature.hpp>
|
||||||
#include <mapnik/featureset.hpp>
|
#include <mapnik/featureset.hpp>
|
||||||
#include <mapnik/query.hpp>
|
#include <mapnik/query.hpp>
|
||||||
#include <mapnik/util/variant.hpp>
|
#include <mapnik/util/variant.hpp>
|
||||||
// boost
|
#include <optional>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
|
|
||||||
class GDALDataset;
|
class GDALDataset;
|
||||||
class GDALRasterBand;
|
class GDALRasterBand;
|
||||||
|
@ -60,7 +60,7 @@ class gdal_featureset : public mapnik::Featureset
|
||||||
int nbands,
|
int nbands,
|
||||||
double dx,
|
double dx,
|
||||||
double dy,
|
double dy,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
double nodata_tolerance,
|
double nodata_tolerance,
|
||||||
int64_t max_image_area);
|
int64_t max_image_area);
|
||||||
virtual ~gdal_featureset();
|
virtual ~gdal_featureset();
|
||||||
|
@ -85,7 +85,7 @@ class gdal_featureset : public mapnik::Featureset
|
||||||
double dx_;
|
double dx_;
|
||||||
double dy_;
|
double dy_;
|
||||||
int nbands_;
|
int nbands_;
|
||||||
boost::optional<double> nodata_value_;
|
std::optional<double> nodata_value_;
|
||||||
double nodata_tolerance_;
|
double nodata_tolerance_;
|
||||||
int64_t max_image_area_;
|
int64_t max_image_area_;
|
||||||
bool first_;
|
bool first_;
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <protozero/pbf_reader.hpp>
|
#include <protozero/pbf_reader.hpp>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
@ -293,7 +293,7 @@ struct geobuf : util::noncopyable
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
geometry::geometry<double>
|
geometry::geometry<double>
|
||||||
read_coords(T& reader, geometry_type_e type, boost::optional<std::vector<std::uint32_t>> const& lengths)
|
read_coords(T& reader, geometry_type_e type, std::optional<std::vector<std::uint32_t>> const& lengths)
|
||||||
{
|
{
|
||||||
geometry::geometry<double> geom = geometry::geometry_empty();
|
geometry::geometry<double> geom = geometry::geometry_empty();
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -405,7 +405,7 @@ struct geobuf : util::noncopyable
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
geometry::multi_line_string<double>
|
geometry::multi_line_string<double>
|
||||||
read_multi_linestring(T& reader, boost::optional<std::vector<std::uint32_t>> const& lengths)
|
read_multi_linestring(T& reader, std::optional<std::vector<std::uint32_t>> const& lengths)
|
||||||
{
|
{
|
||||||
geometry::multi_line_string<double> multi_line;
|
geometry::multi_line_string<double> multi_line;
|
||||||
multi_line.reserve(!lengths ? 1 : lengths->size());
|
multi_line.reserve(!lengths ? 1 : lengths->size());
|
||||||
|
@ -432,7 +432,7 @@ struct geobuf : util::noncopyable
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
geometry::polygon<double> read_polygon(T& reader, boost::optional<std::vector<std::uint32_t>> const& lengths)
|
geometry::polygon<double> read_polygon(T& reader, std::optional<std::vector<std::uint32_t>> const& lengths)
|
||||||
{
|
{
|
||||||
geometry::polygon<double> poly;
|
geometry::polygon<double> poly;
|
||||||
poly.reserve(!lengths ? 1 : lengths->size());
|
poly.reserve(!lengths ? 1 : lengths->size());
|
||||||
|
@ -460,7 +460,7 @@ struct geobuf : util::noncopyable
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
geometry::multi_polygon<double> read_multi_polygon(T& reader,
|
geometry::multi_polygon<double> read_multi_polygon(T& reader,
|
||||||
boost::optional<std::vector<std::uint32_t>> const& lengths)
|
std::optional<std::vector<std::uint32_t>> const& lengths)
|
||||||
{
|
{
|
||||||
geometry::multi_polygon<double> multi_poly;
|
geometry::multi_polygon<double> multi_poly;
|
||||||
if (!lengths)
|
if (!lengths)
|
||||||
|
@ -496,7 +496,7 @@ struct geobuf : util::noncopyable
|
||||||
{
|
{
|
||||||
geometry::geometry<double> geom = geometry::geometry_empty();
|
geometry::geometry<double> geom = geometry::geometry_empty();
|
||||||
geometry_type_e type = Unknown;
|
geometry_type_e type = Unknown;
|
||||||
boost::optional<std::vector<std::uint32_t>> lengths;
|
std::optional<std::vector<std::uint32_t>> lengths;
|
||||||
while (reader.next())
|
while (reader.next())
|
||||||
{
|
{
|
||||||
switch (reader.tag())
|
switch (reader.tag())
|
||||||
|
|
|
@ -79,12 +79,12 @@ geobuf_datasource::geobuf_datasource(parameters const& params)
|
||||||
, features_()
|
, features_()
|
||||||
, tree_(nullptr)
|
, tree_(nullptr)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
const auto file = params.get<std::string>("file");
|
||||||
if (!file)
|
if (!file.has_value())
|
||||||
throw mapnik::datasource_exception("Geobuf Plugin: missing <file> parameter");
|
throw mapnik::datasource_exception("Geobuf Plugin: missing <file> parameter");
|
||||||
|
|
||||||
boost::optional<std::string> base = params.get<std::string>("base");
|
const auto base = params.get<std::string>("base");
|
||||||
if (base)
|
if (base.has_value())
|
||||||
filename_ = *base + "/" + *file;
|
filename_ = *base + "/" + *file;
|
||||||
else
|
else
|
||||||
filename_ = *file;
|
filename_ = *file;
|
||||||
|
@ -159,9 +159,9 @@ const char* geobuf_datasource::name()
|
||||||
return "geobuf";
|
return "geobuf";
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> geobuf_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> geobuf_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
boost::optional<mapnik::datasource_geometry_t> result;
|
std::optional<mapnik::datasource_geometry_t> result;
|
||||||
int multi_type = 0;
|
int multi_type = 0;
|
||||||
unsigned num_features = features_.size();
|
unsigned num_features = features_.size();
|
||||||
for (unsigned i = 0; i < num_features && i < 5; ++i)
|
for (unsigned i = 0; i < num_features && i < 5; ++i)
|
||||||
|
@ -172,7 +172,7 @@ boost::optional<mapnik::datasource_geometry_t> geobuf_datasource::get_geometry_t
|
||||||
int type = static_cast<int>(*result);
|
int type = static_cast<int>(*result);
|
||||||
if (multi_type > 0 && multi_type != type)
|
if (multi_type > 0 && multi_type != type)
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
multi_type = type;
|
multi_type = type;
|
||||||
|
|
|
@ -34,11 +34,9 @@
|
||||||
#include <mapnik/unicode.hpp>
|
#include <mapnik/unicode.hpp>
|
||||||
#include <mapnik/datasource_plugin.hpp>
|
#include <mapnik/datasource_plugin.hpp>
|
||||||
// boost
|
// boost
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <boost/geometry/strategies/cartesian/disjoint_box_box.hpp>
|
#include <boost/geometry/strategies/cartesian/disjoint_box_box.hpp>
|
||||||
#include <boost/geometry/index/rtree.hpp>
|
#include <boost/geometry/index/rtree.hpp>
|
||||||
|
@ -96,13 +94,13 @@ class geobuf_datasource : public mapnik::datasource
|
||||||
// constructor
|
// constructor
|
||||||
geobuf_datasource(mapnik::parameters const& params);
|
geobuf_datasource(mapnik::parameters const& params);
|
||||||
virtual ~geobuf_datasource();
|
virtual ~geobuf_datasource();
|
||||||
mapnik::datasource::datasource_t type() const;
|
mapnik::datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
mapnik::featureset_ptr features(mapnik::query const& q) const override;
|
||||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
mapnik::layer_descriptor get_descriptor() const;
|
mapnik::layer_descriptor get_descriptor() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
void parse_geobuf(char const* buffer, std::size_t size);
|
void parse_geobuf(char const* buffer, std::size_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -101,14 +101,14 @@ geojson_datasource::geojson_datasource(parameters const& params)
|
||||||
, num_features_to_query_(
|
, num_features_to_query_(
|
||||||
std::max(mapnik::value_integer(1), *params.get<mapnik::value_integer>("num_features_to_query", 5)))
|
std::max(mapnik::value_integer(1), *params.get<mapnik::value_integer>("num_features_to_query", 5)))
|
||||||
{
|
{
|
||||||
boost::optional<std::string> inline_string = params.get<std::string>("inline");
|
const auto inline_string = params.get<std::string>("inline");
|
||||||
if (!inline_string)
|
if (!inline_string)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
const auto file = params.get<std::string>("file");
|
||||||
if (!file)
|
if (!file)
|
||||||
throw mapnik::datasource_exception("GeoJSON Plugin: missing <file> parameter");
|
throw mapnik::datasource_exception("GeoJSON Plugin: missing <file> parameter");
|
||||||
|
|
||||||
boost::optional<std::string> base = params.get<std::string>("base");
|
const auto base = params.get<std::string>("base");
|
||||||
if (base)
|
if (base)
|
||||||
filename_ = *base + "/" + *file;
|
filename_ = *base + "/" + *file;
|
||||||
else
|
else
|
||||||
|
@ -143,9 +143,8 @@ geojson_datasource::geojson_datasource(parameters const& params)
|
||||||
char const* start = file_buffer.c_str();
|
char const* start = file_buffer.c_str();
|
||||||
char const* end = (count == 1) ? start + file_buffer.length() : start;
|
char const* end = (count == 1) ? start + file_buffer.length() : start;
|
||||||
#else
|
#else
|
||||||
boost::optional<mapnik::mapped_region_ptr> mapped_region =
|
const auto mapped_region = mapnik::mapped_memory_cache::instance().find(filename_, false);
|
||||||
mapnik::mapped_memory_cache::instance().find(filename_, false);
|
if (!mapped_region.has_value())
|
||||||
if (!mapped_region)
|
|
||||||
{
|
{
|
||||||
throw std::runtime_error("could not get file mapping for " + filename_);
|
throw std::runtime_error("could not get file mapping for " + filename_);
|
||||||
}
|
}
|
||||||
|
@ -440,9 +439,9 @@ mapnik::layer_descriptor geojson_datasource::get_descriptor() const
|
||||||
return desc_;
|
return desc_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
boost::optional<mapnik::datasource_geometry_t> result;
|
std::optional<mapnik::datasource_geometry_t> result;
|
||||||
int multi_type = 0;
|
int multi_type = 0;
|
||||||
if (has_disk_index_)
|
if (has_disk_index_)
|
||||||
{
|
{
|
||||||
|
@ -489,7 +488,7 @@ boost::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_
|
||||||
int type = static_cast<int>(*result);
|
int type = static_cast<int>(*result);
|
||||||
if (multi_type > 0 && multi_type != type)
|
if (multi_type > 0 && multi_type != type)
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
multi_type = type;
|
multi_type = type;
|
||||||
|
@ -507,7 +506,7 @@ boost::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_
|
||||||
int type = static_cast<int>(*result);
|
int type = static_cast<int>(*result);
|
||||||
if (multi_type > 0 && multi_type != type)
|
if (multi_type > 0 && multi_type != type)
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
multi_type = type;
|
multi_type = type;
|
||||||
|
@ -554,7 +553,7 @@ boost::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_
|
||||||
int type = static_cast<int>(*result);
|
int type = static_cast<int>(*result);
|
||||||
if (multi_type > 0 && multi_type != type)
|
if (multi_type > 0 && multi_type != type)
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
multi_type = type;
|
multi_type = type;
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <boost/geometry/strategies/cartesian/disjoint_box_box.hpp>
|
#include <boost/geometry/strategies/cartesian/disjoint_box_box.hpp>
|
||||||
#include <boost/geometry/index/rtree.hpp>
|
#include <boost/geometry/index/rtree.hpp>
|
||||||
|
@ -50,6 +49,7 @@ MAPNIK_DISABLE_WARNING_POP
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
template<std::size_t Max, std::size_t Min>
|
template<std::size_t Max, std::size_t Min>
|
||||||
struct geojson_linear : boost::geometry::index::linear<Max, Min>
|
struct geojson_linear : boost::geometry::index::linear<Max, Min>
|
||||||
|
@ -94,13 +94,13 @@ class geojson_datasource : public mapnik::datasource
|
||||||
// constructor
|
// constructor
|
||||||
geojson_datasource(mapnik::parameters const& params);
|
geojson_datasource(mapnik::parameters const& params);
|
||||||
virtual ~geojson_datasource();
|
virtual ~geojson_datasource();
|
||||||
mapnik::datasource::datasource_t type() const;
|
mapnik::datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
mapnik::featureset_ptr features(mapnik::query const& q) const override;
|
||||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
mapnik::layer_descriptor get_descriptor() const;
|
mapnik::layer_descriptor get_descriptor() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
void parse_geojson(Iterator start, Iterator end);
|
void parse_geojson(Iterator start, Iterator end);
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
|
|
|
@ -50,8 +50,8 @@ geojson_index_featureset::geojson_index_featureset(std::string const& filename,
|
||||||
ctx_(std::make_shared<mapnik::context_type>())
|
ctx_(std::make_shared<mapnik::context_type>())
|
||||||
{
|
{
|
||||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||||
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::instance().find(filename, true);
|
const auto memory = mapnik::mapped_memory_cache::instance().find(filename, true);
|
||||||
if (memory)
|
if (memory.has_value())
|
||||||
{
|
{
|
||||||
mapped_region_ = *memory;
|
mapped_region_ = *memory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ MAPNIK_DISABLE_WARNING_POP
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include "ogr_utils.hpp"
|
||||||
|
|
||||||
using mapnik::datasource;
|
using mapnik::datasource;
|
||||||
using mapnik::parameters;
|
using mapnik::parameters;
|
||||||
|
|
||||||
|
@ -100,8 +102,8 @@ void ogr_datasource::init(mapnik::parameters const& params)
|
||||||
mapnik::progress_timer __stats__(std::clog, "ogr_datasource::init");
|
mapnik::progress_timer __stats__(std::clog, "ogr_datasource::init");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
const auto file = params.get<std::string>("file");
|
||||||
boost::optional<std::string> string = params.get<std::string>("string");
|
auto string = params.get<std::string>("string");
|
||||||
if (!string)
|
if (!string)
|
||||||
string = params.get<std::string>("inline");
|
string = params.get<std::string>("inline");
|
||||||
if (!file && !string)
|
if (!file && !string)
|
||||||
|
@ -115,7 +117,7 @@ void ogr_datasource::init(mapnik::parameters const& params)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::optional<std::string> base = params.get<std::string>("base");
|
const auto base = params.get<std::string>("base");
|
||||||
if (base)
|
if (base)
|
||||||
{
|
{
|
||||||
dataset_name_ = *base + "/" + *file;
|
dataset_name_ = *base + "/" + *file;
|
||||||
|
@ -164,14 +166,14 @@ void ogr_datasource::init(mapnik::parameters const& params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize layer
|
// initialize layer
|
||||||
boost::optional<std::string> layer_by_name = params.get<std::string>("layer");
|
const auto layer_by_name = params.get<std::string>("layer");
|
||||||
boost::optional<mapnik::value_integer> layer_by_index = params.get<mapnik::value_integer>("layer_by_index");
|
const auto layer_by_index = params.get<mapnik::value_integer>("layer_by_index");
|
||||||
boost::optional<std::string> layer_by_sql = params.get<std::string>("layer_by_sql");
|
const auto layer_by_sql = params.get<std::string>("layer_by_sql");
|
||||||
|
|
||||||
int passed_parameters = 0;
|
int passed_parameters = 0;
|
||||||
passed_parameters += layer_by_name ? 1 : 0;
|
passed_parameters += layer_by_name.has_value() ? 1 : 0;
|
||||||
passed_parameters += layer_by_index ? 1 : 0;
|
passed_parameters += layer_by_index.has_value() ? 1 : 0;
|
||||||
passed_parameters += layer_by_sql ? 1 : 0;
|
passed_parameters += layer_by_sql.has_value() ? 1 : 0;
|
||||||
|
|
||||||
if (passed_parameters > 1)
|
if (passed_parameters > 1)
|
||||||
{
|
{
|
||||||
|
@ -267,8 +269,8 @@ void ogr_datasource::init(mapnik::parameters const& params)
|
||||||
OGRLayer* layer = layer_.layer();
|
OGRLayer* layer = layer_.layer();
|
||||||
|
|
||||||
// initialize envelope
|
// initialize envelope
|
||||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
const auto ext = params.get<std::string>("extent");
|
||||||
if (ext && !ext->empty())
|
if (ext.has_value() && !ext->empty())
|
||||||
{
|
{
|
||||||
extent_.from_string(*ext);
|
extent_.from_string(*ext);
|
||||||
}
|
}
|
||||||
|
@ -402,9 +404,9 @@ box2d<double> ogr_datasource::envelope() const
|
||||||
return extent_;
|
return extent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> ogr_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> ogr_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
boost::optional<mapnik::datasource_geometry_t> result;
|
std::optional<mapnik::datasource_geometry_t> result;
|
||||||
if (dataset_ && layer_.is_valid())
|
if (dataset_ && layer_.is_valid())
|
||||||
{
|
{
|
||||||
OGRLayer* layer = layer_.layer();
|
OGRLayer* layer = layer_.layer();
|
||||||
|
@ -417,19 +419,19 @@ boost::optional<mapnik::datasource_geometry_t> ogr_datasource::get_geometry_type
|
||||||
{
|
{
|
||||||
case wkbPoint:
|
case wkbPoint:
|
||||||
case wkbMultiPoint:
|
case wkbMultiPoint:
|
||||||
result.reset(mapnik::datasource_geometry_t::Point);
|
result = mapnik::datasource_geometry_t::Point;
|
||||||
break;
|
break;
|
||||||
case wkbLinearRing:
|
case wkbLinearRing:
|
||||||
case wkbLineString:
|
case wkbLineString:
|
||||||
case wkbMultiLineString:
|
case wkbMultiLineString:
|
||||||
result.reset(mapnik::datasource_geometry_t::LineString);
|
result = mapnik::datasource_geometry_t::LineString;
|
||||||
break;
|
break;
|
||||||
case wkbPolygon:
|
case wkbPolygon:
|
||||||
case wkbMultiPolygon:
|
case wkbMultiPolygon:
|
||||||
result.reset(mapnik::datasource_geometry_t::Polygon);
|
result = mapnik::datasource_geometry_t::Polygon;
|
||||||
break;
|
break;
|
||||||
case wkbGeometryCollection:
|
case wkbGeometryCollection:
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
break;
|
break;
|
||||||
case wkbNone:
|
case wkbNone:
|
||||||
case wkbUnknown: {
|
case wkbUnknown: {
|
||||||
|
@ -451,19 +453,19 @@ boost::optional<mapnik::datasource_geometry_t> ogr_datasource::get_geometry_type
|
||||||
{
|
{
|
||||||
case wkbPoint:
|
case wkbPoint:
|
||||||
case wkbMultiPoint:
|
case wkbMultiPoint:
|
||||||
result.reset(mapnik::datasource_geometry_t::Point);
|
result = mapnik::datasource_geometry_t::Point;
|
||||||
break;
|
break;
|
||||||
case wkbLinearRing:
|
case wkbLinearRing:
|
||||||
case wkbLineString:
|
case wkbLineString:
|
||||||
case wkbMultiLineString:
|
case wkbMultiLineString:
|
||||||
result.reset(mapnik::datasource_geometry_t::LineString);
|
result = mapnik::datasource_geometry_t::LineString;
|
||||||
break;
|
break;
|
||||||
case wkbPolygon:
|
case wkbPolygon:
|
||||||
case wkbMultiPolygon:
|
case wkbMultiPolygon:
|
||||||
result.reset(mapnik::datasource_geometry_t::Polygon);
|
result = mapnik::datasource_geometry_t::Polygon;
|
||||||
break;
|
break;
|
||||||
case wkbGeometryCollection:
|
case wkbGeometryCollection:
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -33,12 +33,7 @@
|
||||||
#include <mapnik/feature_layer_desc.hpp>
|
#include <mapnik/feature_layer_desc.hpp>
|
||||||
#include <mapnik/datasource_plugin.hpp>
|
#include <mapnik/datasource_plugin.hpp>
|
||||||
|
|
||||||
// boost
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
|
@ -47,7 +42,6 @@ MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <ogrsf_frmts.h>
|
#include <ogrsf_frmts.h>
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
MAPNIK_DISABLE_WARNING_POP
|
||||||
#include "ogr_layer_ptr.hpp"
|
#include "ogr_layer_ptr.hpp"
|
||||||
#include "ogr_utils.hpp"
|
|
||||||
|
|
||||||
DATASOURCE_PLUGIN_DEF(ogr_datasource_plugin, ogr);
|
DATASOURCE_PLUGIN_DEF(ogr_datasource_plugin, ogr);
|
||||||
|
|
||||||
|
@ -56,13 +50,13 @@ class ogr_datasource : public mapnik::datasource
|
||||||
public:
|
public:
|
||||||
ogr_datasource(mapnik::parameters const& params);
|
ogr_datasource(mapnik::parameters const& params);
|
||||||
virtual ~ogr_datasource();
|
virtual ~ogr_datasource();
|
||||||
mapnik::datasource::datasource_t type() const;
|
mapnik::datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
mapnik::featureset_ptr features(mapnik::query const& q) const override;
|
||||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
mapnik::layer_descriptor get_descriptor() const;
|
mapnik::layer_descriptor get_descriptor() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init(mapnik::parameters const& params);
|
void init(mapnik::parameters const& params);
|
||||||
|
|
|
@ -70,8 +70,8 @@ ogr_index_featureset<filterT>::ogr_index_featureset(mapnik::context_ptr const& c
|
||||||
, feature_envelope_()
|
, feature_envelope_()
|
||||||
{
|
{
|
||||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||||
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::instance().find(index_file, true);
|
const auto memory = mapnik::mapped_memory_cache::instance().find(index_file, true);
|
||||||
if (memory)
|
if (memory.has_value())
|
||||||
{
|
{
|
||||||
boost::interprocess::ibufferstream file(static_cast<char*>((*memory)->get_address()), (*memory)->get_size());
|
boost::interprocess::ibufferstream file(static_cast<char*>((*memory)->get_address()), (*memory)->get_size());
|
||||||
ogr_index<filterT, boost::interprocess::ibufferstream>::query(filter, file, ids_);
|
ogr_index<filterT, boost::interprocess::ibufferstream>::query(filter, file, ids_);
|
||||||
|
|
|
@ -104,8 +104,8 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
|
||||||
throw mapnik::datasource_exception("Pgraster Plugin: missing <table> parameter");
|
throw mapnik::datasource_exception("Pgraster Plugin: missing <table> parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
const auto ext = params.get<std::string>("extent");
|
||||||
if (ext && !ext->empty())
|
if (ext.has_value() && !ext->empty())
|
||||||
{
|
{
|
||||||
extent_initialized_ = extent_.from_string(*ext);
|
extent_initialized_ = extent_.from_string(*ext);
|
||||||
}
|
}
|
||||||
|
@ -124,9 +124,8 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
|
||||||
asynchronous_request_ = true;
|
asynchronous_request_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<value_integer> initial_size = params.get<value_integer>("initial_size", 1);
|
const auto initial_size = params.get<value_integer>("initial_size", 1);
|
||||||
boost::optional<mapnik::boolean_type> autodetect_key_field =
|
const auto autodetect_key_field = params.get<mapnik::boolean_type>("autodetect_key_field", false);
|
||||||
params.get<mapnik::boolean_type>("autodetect_key_field", false);
|
|
||||||
|
|
||||||
ConnectionManager::instance().registerPool(creator_, *initial_size, pool_max_size_);
|
ConnectionManager::instance().registerPool(creator_, *initial_size, pool_max_size_);
|
||||||
CnxPool_ptr pool = ConnectionManager::instance().getPool(creator_.id());
|
CnxPool_ptr pool = ConnectionManager::instance().getPool(creator_.id());
|
||||||
|
@ -298,14 +297,12 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
|
||||||
std::ostringstream err;
|
std::ostringstream err;
|
||||||
if (parsed_schema_.empty())
|
if (parsed_schema_.empty())
|
||||||
{
|
{
|
||||||
err << "Pgraster Plugin: unable to lookup available table"
|
err << "Pgraster Plugin: unable to lookup available table" << " overviews due to unknown schema";
|
||||||
<< " overviews due to unknown schema";
|
|
||||||
throw mapnik::datasource_exception(err.str());
|
throw mapnik::datasource_exception(err.str());
|
||||||
}
|
}
|
||||||
if (geometryColumn_.empty())
|
if (geometryColumn_.empty())
|
||||||
{
|
{
|
||||||
err << "Pgraster Plugin: unable to lookup available table"
|
err << "Pgraster Plugin: unable to lookup available table" << " overviews due to unknown column name";
|
||||||
<< " overviews due to unknown column name";
|
|
||||||
throw mapnik::datasource_exception(err.str());
|
throw mapnik::datasource_exception(err.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,8 +412,7 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
|
||||||
else if (result_rows > 1)
|
else if (result_rows > 1)
|
||||||
{
|
{
|
||||||
std::ostringstream err;
|
std::ostringstream err;
|
||||||
err << "PostGIS Plugin: Error: '"
|
err << "PostGIS Plugin: Error: '" << "multi column primary key detected but is not supported";
|
||||||
<< "multi column primary key detected but is not supported";
|
|
||||||
throw mapnik::datasource_exception(err.str());
|
throw mapnik::datasource_exception(err.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,8 +485,7 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
|
||||||
}
|
}
|
||||||
|
|
||||||
rs_oid->close();
|
rs_oid->close();
|
||||||
error_s << " for key_field '" << fld_name << "' - "
|
error_s << " for key_field '" << fld_name << "' - " << "must be an integer primary key";
|
||||||
<< "must be an integer primary key";
|
|
||||||
|
|
||||||
rs->close();
|
rs->close();
|
||||||
throw mapnik::datasource_exception(error_s.str());
|
throw mapnik::datasource_exception(error_s.str());
|
||||||
|
@ -1120,8 +1115,8 @@ box2d<double> pgraster_datasource::envelope() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s << "SELECT ST_XMin(ext),ST_YMin(ext),ST_XMax(ext),ST_YMax(ext)"
|
s << "SELECT ST_XMin(ext),ST_YMin(ext),ST_XMax(ext),ST_YMax(ext)" << " FROM (SELECT ST_Extent("
|
||||||
<< " FROM (SELECT ST_Extent(" << identifier(col) << "::geometry) as ext from ";
|
<< identifier(col) << "::geometry) as ext from ";
|
||||||
|
|
||||||
if (extent_from_subquery_)
|
if (extent_from_subquery_)
|
||||||
{
|
{
|
||||||
|
@ -1167,7 +1162,7 @@ box2d<double> pgraster_datasource::envelope() const
|
||||||
return extent_;
|
return extent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> pgraster_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> pgraster_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
return boost::optional<mapnik::datasource_geometry_t>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,15 +80,15 @@ class pgraster_datasource : public datasource
|
||||||
public:
|
public:
|
||||||
pgraster_datasource(const parameters& params);
|
pgraster_datasource(const parameters& params);
|
||||||
~pgraster_datasource();
|
~pgraster_datasource();
|
||||||
mapnik::datasource::datasource_t type() const;
|
mapnik::datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
processor_context_ptr get_context(feature_style_context_map&) const;
|
processor_context_ptr get_context(feature_style_context_map&) const override;
|
||||||
featureset_ptr features_with_context(query const& q, processor_context_ptr ctx) const;
|
featureset_ptr features_with_context(query const& q, processor_context_ptr ctx) const override;
|
||||||
featureset_ptr features(query const& q) const;
|
featureset_ptr features(query const& q) const override;
|
||||||
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const;
|
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
layer_descriptor get_descriptor() const;
|
layer_descriptor get_descriptor() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string sql_bbox(box2d<double> const& env) const;
|
std::string sql_bbox(box2d<double> const& env) const;
|
||||||
|
|
|
@ -42,7 +42,7 @@ extern "C" {
|
||||||
class Connection
|
class Connection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Connection(std::string const& connection_str, boost::optional<std::string> const& password)
|
Connection(std::string const& connection_str, std::optional<std::string> const& password)
|
||||||
: cursorId(0)
|
: cursorId(0)
|
||||||
, closed_(false)
|
, closed_(false)
|
||||||
, pending_(false)
|
, pending_(false)
|
||||||
|
|
|
@ -30,12 +30,10 @@
|
||||||
#include <mapnik/pool.hpp>
|
#include <mapnik/pool.hpp>
|
||||||
#include <mapnik/util/singleton.hpp>
|
#include <mapnik/util/singleton.hpp>
|
||||||
|
|
||||||
// boost
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
using mapnik::CreateStatic;
|
using mapnik::CreateStatic;
|
||||||
using mapnik::Pool;
|
using mapnik::Pool;
|
||||||
|
@ -78,7 +76,7 @@ class ConnectionCreator
|
||||||
{
|
{
|
||||||
// only set fallback_application_name, so that application_name
|
// only set fallback_application_name, so that application_name
|
||||||
// can still be overriden with PGAPPNAME environment variable
|
// can still be overriden with PGAPPNAME environment variable
|
||||||
append_param(connect_str, "fallback_application_name=", "mapnik");
|
append_param(connect_str, "fallback_application_name=", std::string{"mapnik"});
|
||||||
}
|
}
|
||||||
return connect_str;
|
return connect_str;
|
||||||
}
|
}
|
||||||
|
@ -96,18 +94,18 @@ class ConnectionCreator
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool append_param(std::string& dest, char const* key, boost::optional<std::string> const& opt)
|
static bool append_param(std::string& dest, char const* key, std::optional<std::string> const& opt)
|
||||||
{
|
{
|
||||||
return opt && append_param(dest, key, *opt);
|
return opt && append_param(dest, key, *opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> host_;
|
std::optional<std::string> host_;
|
||||||
boost::optional<std::string> port_;
|
std::optional<std::string> port_;
|
||||||
boost::optional<std::string> dbname_;
|
std::optional<std::string> dbname_;
|
||||||
boost::optional<std::string> user_;
|
std::optional<std::string> user_;
|
||||||
boost::optional<std::string> password_;
|
std::optional<std::string> password_;
|
||||||
boost::optional<std::string> connect_timeout_;
|
std::optional<std::string> connect_timeout_;
|
||||||
boost::optional<std::string> application_name_;
|
std::optional<std::string> application_name_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConnectionManager : public singleton<ConnectionManager, CreateStatic>
|
class ConnectionManager : public singleton<ConnectionManager, CreateStatic>
|
||||||
|
|
|
@ -107,8 +107,8 @@ postgis_datasource::postgis_datasource(parameters const& params)
|
||||||
throw mapnik::datasource_exception("Postgis Plugin: missing <table> parameter");
|
throw mapnik::datasource_exception("Postgis Plugin: missing <table> parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
const auto ext = params.get<std::string>("extent");
|
||||||
if (ext && !ext->empty())
|
if (ext.has_value() && !ext->empty())
|
||||||
{
|
{
|
||||||
extent_initialized_ = extent_.from_string(*ext);
|
extent_initialized_ = extent_.from_string(*ext);
|
||||||
}
|
}
|
||||||
|
@ -127,19 +127,17 @@ postgis_datasource::postgis_datasource(parameters const& params)
|
||||||
asynchronous_request_ = true;
|
asynchronous_request_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::value_integer> initial_size = params.get<mapnik::value_integer>("initial_size", 1);
|
const auto initial_size = params.get<mapnik::value_integer>("initial_size", 1);
|
||||||
boost::optional<mapnik::boolean_type> autodetect_key_field =
|
const auto autodetect_key_field = params.get<mapnik::boolean_type>("autodetect_key_field", false);
|
||||||
params.get<mapnik::boolean_type>("autodetect_key_field", false);
|
const auto estimate_extent = params.get<mapnik::boolean_type>("estimate_extent", false);
|
||||||
boost::optional<mapnik::boolean_type> estimate_extent = params.get<mapnik::boolean_type>("estimate_extent", false);
|
|
||||||
estimate_extent_ = estimate_extent && *estimate_extent;
|
estimate_extent_ = estimate_extent && *estimate_extent;
|
||||||
boost::optional<mapnik::boolean_type> simplify_opt = params.get<mapnik::boolean_type>("simplify_geometries", false);
|
const auto simplify_opt = params.get<mapnik::boolean_type>("simplify_geometries", false);
|
||||||
simplify_geometries_ = simplify_opt && *simplify_opt;
|
simplify_geometries_ = simplify_opt && *simplify_opt;
|
||||||
|
|
||||||
boost::optional<mapnik::boolean_type> twkb_opt = params.get<mapnik::boolean_type>("twkb_encoding", false);
|
const auto twkb_opt = params.get<mapnik::boolean_type>("twkb_encoding", false);
|
||||||
twkb_encoding_ = twkb_opt && *twkb_opt;
|
twkb_encoding_ = twkb_opt && *twkb_opt;
|
||||||
|
|
||||||
boost::optional<mapnik::boolean_type> simplify_preserve_opt =
|
const auto simplify_preserve_opt = params.get<mapnik::boolean_type>("simplify_dp_preserve", false);
|
||||||
params.get<mapnik::boolean_type>("simplify_dp_preserve", false);
|
|
||||||
simplify_dp_preserve_ = simplify_preserve_opt && *simplify_preserve_opt;
|
simplify_dp_preserve_ = simplify_preserve_opt && *simplify_preserve_opt;
|
||||||
|
|
||||||
ConnectionManager::instance().registerPool(creator_, *initial_size, pool_max_size_);
|
ConnectionManager::instance().registerPool(creator_, *initial_size, pool_max_size_);
|
||||||
|
@ -310,8 +308,7 @@ postgis_datasource::postgis_datasource(parameters const& params)
|
||||||
else if (result_rows > 1)
|
else if (result_rows > 1)
|
||||||
{
|
{
|
||||||
std::ostringstream err;
|
std::ostringstream err;
|
||||||
err << "PostGIS Plugin: Error: '"
|
err << "PostGIS Plugin: Error: '" << "multi column primary key detected but is not supported";
|
||||||
<< "multi column primary key detected but is not supported";
|
|
||||||
throw mapnik::datasource_exception(err.str());
|
throw mapnik::datasource_exception(err.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,8 +384,7 @@ postgis_datasource::postgis_datasource(parameters const& params)
|
||||||
}
|
}
|
||||||
|
|
||||||
rs_oid->close();
|
rs_oid->close();
|
||||||
error_s << " for key_field '" << fld_name << "' - "
|
error_s << " for key_field '" << fld_name << "' - " << "must be an integer primary key";
|
||||||
<< "must be an integer primary key";
|
|
||||||
|
|
||||||
rs->close();
|
rs->close();
|
||||||
throw mapnik::datasource_exception(error_s.str());
|
throw mapnik::datasource_exception(error_s.str());
|
||||||
|
@ -1024,8 +1020,8 @@ box2d<double> postgis_datasource::envelope() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s << "SELECT ST_XMin(ext),ST_YMin(ext),ST_XMax(ext),ST_YMax(ext)"
|
s << "SELECT ST_XMin(ext),ST_YMin(ext),ST_XMax(ext),ST_YMax(ext)" << " FROM (SELECT ST_Extent("
|
||||||
<< " FROM (SELECT ST_Extent(" << identifier(geometryColumn_) << ") as ext from ";
|
<< identifier(geometryColumn_) << ") as ext from ";
|
||||||
|
|
||||||
if (extent_from_subquery_)
|
if (extent_from_subquery_)
|
||||||
{
|
{
|
||||||
|
@ -1067,9 +1063,9 @@ box2d<double> postgis_datasource::envelope() const
|
||||||
return extent_;
|
return extent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> postgis_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> postgis_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
boost::optional<mapnik::datasource_geometry_t> result;
|
std::optional<mapnik::datasource_geometry_t> result;
|
||||||
|
|
||||||
CnxPool_ptr pool = ConnectionManager::instance().getPool(creator_.id());
|
CnxPool_ptr pool = ConnectionManager::instance().getPool(creator_.id());
|
||||||
if (pool)
|
if (pool)
|
||||||
|
@ -1099,17 +1095,17 @@ boost::optional<mapnik::datasource_geometry_t> postgis_datasource::get_geometry_
|
||||||
g_type = rs->getValue("type");
|
g_type = rs->getValue("type");
|
||||||
if (boost::algorithm::contains(g_type, "line"))
|
if (boost::algorithm::contains(g_type, "line"))
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::LineString);
|
result = mapnik::datasource_geometry_t::LineString;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else if (boost::algorithm::contains(g_type, "point"))
|
else if (boost::algorithm::contains(g_type, "point"))
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Point);
|
result = mapnik::datasource_geometry_t::Point;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else if (boost::algorithm::contains(g_type, "polygon"))
|
else if (boost::algorithm::contains(g_type, "polygon"))
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Polygon);
|
result = mapnik::datasource_geometry_t::Polygon;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else // geometry
|
else // geometry
|
||||||
|
@ -1131,8 +1127,8 @@ boost::optional<mapnik::datasource_geometry_t> postgis_datasource::get_geometry_
|
||||||
|
|
||||||
std::string prev_type("");
|
std::string prev_type("");
|
||||||
|
|
||||||
s << "SELECT ST_GeometryType(" << identifier(geometryColumn_) << ") AS geom"
|
s << "SELECT ST_GeometryType(" << identifier(geometryColumn_) << ") AS geom" << " FROM "
|
||||||
<< " FROM " << populate_tokens(table_);
|
<< populate_tokens(table_);
|
||||||
|
|
||||||
if (row_limit_ > 0 && row_limit_ < 5)
|
if (row_limit_ > 0 && row_limit_ < 5)
|
||||||
{
|
{
|
||||||
|
@ -1150,26 +1146,26 @@ boost::optional<mapnik::datasource_geometry_t> postgis_datasource::get_geometry_
|
||||||
if (boost::algorithm::icontains(data, "line"))
|
if (boost::algorithm::icontains(data, "line"))
|
||||||
{
|
{
|
||||||
g_type = "linestring";
|
g_type = "linestring";
|
||||||
result.reset(mapnik::datasource_geometry_t::LineString);
|
result = mapnik::datasource_geometry_t::LineString;
|
||||||
}
|
}
|
||||||
else if (boost::algorithm::icontains(data, "point"))
|
else if (boost::algorithm::icontains(data, "point"))
|
||||||
{
|
{
|
||||||
g_type = "point";
|
g_type = "point";
|
||||||
result.reset(mapnik::datasource_geometry_t::Point);
|
result = mapnik::datasource_geometry_t::Point;
|
||||||
}
|
}
|
||||||
else if (boost::algorithm::icontains(data, "polygon"))
|
else if (boost::algorithm::icontains(data, "polygon"))
|
||||||
{
|
{
|
||||||
g_type = "polygon";
|
g_type = "polygon";
|
||||||
result.reset(mapnik::datasource_geometry_t::Polygon);
|
result = mapnik::datasource_geometry_t::Polygon;
|
||||||
}
|
}
|
||||||
else // geometry
|
else // geometry
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (!prev_type.empty() && g_type != prev_type)
|
if (!prev_type.empty() && g_type != prev_type)
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
prev_type = g_type;
|
prev_type = g_type;
|
||||||
|
|
|
@ -69,15 +69,15 @@ class postgis_datasource : public datasource
|
||||||
public:
|
public:
|
||||||
postgis_datasource(const parameters& params);
|
postgis_datasource(const parameters& params);
|
||||||
~postgis_datasource();
|
~postgis_datasource();
|
||||||
mapnik::datasource::datasource_t type() const;
|
mapnik::datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
processor_context_ptr get_context(feature_style_context_map&) const;
|
processor_context_ptr get_context(feature_style_context_map&) const override;
|
||||||
featureset_ptr features_with_context(query const& q, processor_context_ptr ctx) const;
|
featureset_ptr features_with_context(query const& q, processor_context_ptr ctx) const override;
|
||||||
featureset_ptr features(query const& q) const;
|
featureset_ptr features(query const& q) const override;
|
||||||
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const;
|
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
layer_descriptor get_descriptor() const;
|
layer_descriptor get_descriptor() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string sql_bbox(box2d<double> const& env) const;
|
std::string sql_bbox(box2d<double> const& env) const;
|
||||||
|
|
|
@ -55,11 +55,11 @@ raster_datasource::raster_datasource(parameters const& params)
|
||||||
{
|
{
|
||||||
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing...";
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing...";
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
const auto file = params.get<std::string>("file");
|
||||||
if (!file)
|
if (!file)
|
||||||
throw datasource_exception("Raster Plugin: missing <file> parameter ");
|
throw datasource_exception("Raster Plugin: missing <file> parameter ");
|
||||||
|
|
||||||
boost::optional<std::string> base = params.get<std::string>("base");
|
const auto base = params.get<std::string>("base");
|
||||||
if (base)
|
if (base)
|
||||||
filename_ = *base + "/" + *file;
|
filename_ = *base + "/" + *file;
|
||||||
else
|
else
|
||||||
|
@ -69,15 +69,15 @@ raster_datasource::raster_datasource(parameters const& params)
|
||||||
tile_size_ = *params.get<mapnik::value_integer>("tile_size", 1024);
|
tile_size_ = *params.get<mapnik::value_integer>("tile_size", 1024);
|
||||||
tile_stride_ = *params.get<mapnik::value_integer>("tile_stride", 1);
|
tile_stride_ = *params.get<mapnik::value_integer>("tile_stride", 1);
|
||||||
|
|
||||||
boost::optional<std::string> format_from_filename = mapnik::type_from_filename(*file);
|
const auto format_from_filename = mapnik::type_from_filename(*file);
|
||||||
format_ = *params.get<std::string>("format", format_from_filename ? (*format_from_filename) : "tiff");
|
format_ = *params.get<std::string>("format", format_from_filename ? (*format_from_filename) : "tiff");
|
||||||
|
|
||||||
boost::optional<mapnik::value_double> lox = params.get<mapnik::value_double>("lox");
|
const auto lox = params.get<mapnik::value_double>("lox");
|
||||||
boost::optional<mapnik::value_double> loy = params.get<mapnik::value_double>("loy");
|
const auto loy = params.get<mapnik::value_double>("loy");
|
||||||
boost::optional<mapnik::value_double> hix = params.get<mapnik::value_double>("hix");
|
const auto hix = params.get<mapnik::value_double>("hix");
|
||||||
boost::optional<mapnik::value_double> hiy = params.get<mapnik::value_double>("hiy");
|
const auto hiy = params.get<mapnik::value_double>("hiy");
|
||||||
|
|
||||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
const auto ext = params.get<std::string>("extent");
|
||||||
|
|
||||||
if (lox && loy && hix && hiy)
|
if (lox && loy && hix && hiy)
|
||||||
{
|
{
|
||||||
|
@ -108,8 +108,8 @@ raster_datasource::raster_datasource(parameters const& params)
|
||||||
|
|
||||||
if (multi_tiles_)
|
if (multi_tiles_)
|
||||||
{
|
{
|
||||||
boost::optional<mapnik::value_integer> x_width = params.get<mapnik::value_integer>("x_width");
|
const auto x_width = params.get<mapnik::value_integer>("x_width");
|
||||||
boost::optional<mapnik::value_integer> y_width = params.get<mapnik::value_integer>("y_width");
|
const auto y_width = params.get<mapnik::value_integer>("y_width");
|
||||||
|
|
||||||
if (!x_width)
|
if (!x_width)
|
||||||
{
|
{
|
||||||
|
@ -121,8 +121,8 @@ raster_datasource::raster_datasource(parameters const& params)
|
||||||
throw datasource_exception("Raster Plugin: y-width parameter not supplied for multi-tiled data source.");
|
throw datasource_exception("Raster Plugin: y-width parameter not supplied for multi-tiled data source.");
|
||||||
}
|
}
|
||||||
|
|
||||||
width_ = x_width.get() * tile_size_;
|
width_ = x_width.value() * tile_size_;
|
||||||
height_ = y_width.get() * tile_size_;
|
height_ = y_width.value() * tile_size_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -174,9 +174,9 @@ mapnik::box2d<double> raster_datasource::envelope() const
|
||||||
return extent_;
|
return extent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> raster_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> raster_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
return boost::optional<mapnik::datasource_geometry_t>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
layer_descriptor raster_datasource::get_descriptor() const
|
layer_descriptor raster_datasource::get_descriptor() const
|
||||||
|
|
|
@ -33,14 +33,6 @@
|
||||||
#include <mapnik/feature_layer_desc.hpp>
|
#include <mapnik/feature_layer_desc.hpp>
|
||||||
#include <mapnik/datasource_plugin.hpp>
|
#include <mapnik/datasource_plugin.hpp>
|
||||||
|
|
||||||
// boost
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// stl
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
DATASOURCE_PLUGIN_DEF(raster_datasource_plugin, raster);
|
DATASOURCE_PLUGIN_DEF(raster_datasource_plugin, raster);
|
||||||
|
|
||||||
class raster_datasource : public mapnik::datasource
|
class raster_datasource : public mapnik::datasource
|
||||||
|
@ -48,13 +40,13 @@ class raster_datasource : public mapnik::datasource
|
||||||
public:
|
public:
|
||||||
raster_datasource(const mapnik::parameters& params);
|
raster_datasource(const mapnik::parameters& params);
|
||||||
virtual ~raster_datasource();
|
virtual ~raster_datasource();
|
||||||
datasource::datasource_t type() const;
|
datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
mapnik::featureset_ptr features(const mapnik::query& q) const;
|
mapnik::featureset_ptr features(const mapnik::query& q) const override;
|
||||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
mapnik::layer_descriptor get_descriptor() const;
|
mapnik::layer_descriptor get_descriptor() const override;
|
||||||
bool log_enabled() const;
|
bool log_enabled() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -72,12 +72,12 @@ shape_datasource::shape_datasource(parameters const& params)
|
||||||
#ifdef MAPNIK_STATS
|
#ifdef MAPNIK_STATS
|
||||||
mapnik::progress_timer __stats__(std::clog, "shape_datasource::init");
|
mapnik::progress_timer __stats__(std::clog, "shape_datasource::init");
|
||||||
#endif
|
#endif
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
const auto file = params.get<std::string>("file");
|
||||||
if (!file)
|
if (!file.has_value())
|
||||||
throw datasource_exception("Shape Plugin: missing <file> parameter");
|
throw datasource_exception("Shape Plugin: missing <file> parameter");
|
||||||
|
|
||||||
boost::optional<std::string> base = params.get<std::string>("base");
|
const auto base = params.get<std::string>("base");
|
||||||
if (base)
|
if (base.has_value())
|
||||||
shape_name_ = *base + "/" + *file;
|
shape_name_ = *base + "/" + *file;
|
||||||
else
|
else
|
||||||
shape_name_ = *file;
|
shape_name_ = *file;
|
||||||
|
@ -307,13 +307,13 @@ box2d<double> shape_datasource::envelope() const
|
||||||
return extent_;
|
return extent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> shape_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> shape_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_STATS
|
#ifdef MAPNIK_STATS
|
||||||
mapnik::progress_timer __stats__(std::clog, "shape_datasource::get_geometry_type");
|
mapnik::progress_timer __stats__(std::clog, "shape_datasource::get_geometry_type");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> result;
|
std::optional<mapnik::datasource_geometry_t> result;
|
||||||
switch (shape_type_)
|
switch (shape_type_)
|
||||||
{
|
{
|
||||||
case shape_io::shape_point:
|
case shape_io::shape_point:
|
||||||
|
@ -322,19 +322,19 @@ boost::optional<mapnik::datasource_geometry_t> shape_datasource::get_geometry_ty
|
||||||
case shape_io::shape_multipoint:
|
case shape_io::shape_multipoint:
|
||||||
case shape_io::shape_multipointm:
|
case shape_io::shape_multipointm:
|
||||||
case shape_io::shape_multipointz: {
|
case shape_io::shape_multipointz: {
|
||||||
result.reset(mapnik::datasource_geometry_t::Point);
|
result = mapnik::datasource_geometry_t::Point;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case shape_io::shape_polyline:
|
case shape_io::shape_polyline:
|
||||||
case shape_io::shape_polylinem:
|
case shape_io::shape_polylinem:
|
||||||
case shape_io::shape_polylinez: {
|
case shape_io::shape_polylinez: {
|
||||||
result.reset(mapnik::datasource_geometry_t::LineString);
|
result = mapnik::datasource_geometry_t::LineString;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case shape_io::shape_polygon:
|
case shape_io::shape_polygon:
|
||||||
case shape_io::shape_polygonm:
|
case shape_io::shape_polygonm:
|
||||||
case shape_io::shape_polygonz: {
|
case shape_io::shape_polygonz: {
|
||||||
result.reset(mapnik::datasource_geometry_t::Polygon);
|
result = mapnik::datasource_geometry_t::Polygon;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -34,12 +34,7 @@
|
||||||
#include <mapnik/value/types.hpp>
|
#include <mapnik/value/types.hpp>
|
||||||
#include <mapnik/datasource_plugin.hpp>
|
#include <mapnik/datasource_plugin.hpp>
|
||||||
|
|
||||||
// boost
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "shape_io.hpp"
|
#include "shape_io.hpp"
|
||||||
|
@ -58,13 +53,13 @@ class shape_datasource : public datasource
|
||||||
public:
|
public:
|
||||||
shape_datasource(parameters const& params);
|
shape_datasource(parameters const& params);
|
||||||
virtual ~shape_datasource();
|
virtual ~shape_datasource();
|
||||||
datasource::datasource_t type() const;
|
datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
featureset_ptr features(query const& q) const;
|
featureset_ptr features(query const& q) const override;
|
||||||
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const;
|
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const override;
|
||||||
box2d<double> envelope() const;
|
box2d<double> envelope() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
layer_descriptor get_descriptor() const;
|
layer_descriptor get_descriptor() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init(shape_io& shape);
|
void init(shape_io& shape);
|
||||||
|
|
|
@ -86,11 +86,11 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
||||||
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::init");
|
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::init");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
const auto file = params.get<std::string>("file");
|
||||||
if (!file)
|
if (!file)
|
||||||
throw datasource_exception("Sqlite Plugin: missing <file> parameter");
|
throw datasource_exception("Sqlite Plugin: missing <file> parameter");
|
||||||
|
|
||||||
boost::optional<std::string> base = params.get<std::string>("base");
|
const auto base = params.get<std::string>("base");
|
||||||
if (base)
|
if (base)
|
||||||
dataset_name_ = *base + "/" + *file;
|
dataset_name_ = *base + "/" + *file;
|
||||||
else
|
else
|
||||||
|
@ -106,12 +106,12 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
||||||
// TODO - remove this option once all datasources have an indexing api
|
// TODO - remove this option once all datasources have an indexing api
|
||||||
bool auto_index = *params.get<mapnik::boolean_type>("auto_index", true);
|
bool auto_index = *params.get<mapnik::boolean_type>("auto_index", true);
|
||||||
|
|
||||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
const auto ext = params.get<std::string>("extent");
|
||||||
if (ext)
|
if (ext.has_value())
|
||||||
extent_initialized_ = extent_.from_string(*ext);
|
extent_initialized_ = extent_.from_string(*ext);
|
||||||
|
|
||||||
boost::optional<std::string> wkb = params.get<std::string>("wkb_format");
|
const auto wkb = params.get<std::string>("wkb_format");
|
||||||
if (wkb)
|
if (wkb.has_value())
|
||||||
{
|
{
|
||||||
if (*wkb == "spatialite")
|
if (*wkb == "spatialite")
|
||||||
{
|
{
|
||||||
|
@ -139,14 +139,14 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
||||||
// databases are relative to directory containing dataset_name_. Sqlite
|
// databases are relative to directory containing dataset_name_. Sqlite
|
||||||
// will default to attaching from cwd. Typicaly usage means that the
|
// will default to attaching from cwd. Typicaly usage means that the
|
||||||
// map loader will produce full paths here.
|
// map loader will produce full paths here.
|
||||||
boost::optional<std::string> attachdb = params.get<std::string>("attachdb");
|
const auto attachdb = params.get<std::string>("attachdb");
|
||||||
if (attachdb)
|
if (attachdb.has_value())
|
||||||
{
|
{
|
||||||
parse_attachdb(*attachdb);
|
parse_attachdb(*attachdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> initdb = params.get<std::string>("initdb");
|
const auto initdb = params.get<std::string>("initdb");
|
||||||
if (initdb)
|
if (initdb.has_value())
|
||||||
{
|
{
|
||||||
init_statements_.push_back(*initdb);
|
init_statements_.push_back(*initdb);
|
||||||
}
|
}
|
||||||
|
@ -154,11 +154,11 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
||||||
// now actually create the connection and start executing setup sql
|
// now actually create the connection and start executing setup sql
|
||||||
dataset_ = std::make_shared<sqlite_connection>(dataset_name_);
|
dataset_ = std::make_shared<sqlite_connection>(dataset_name_);
|
||||||
|
|
||||||
boost::optional<mapnik::value_integer> table_by_index = params.get<mapnik::value_integer>("table_by_index");
|
const auto table_by_index = params.get<mapnik::value_integer>("table_by_index");
|
||||||
|
|
||||||
int passed_parameters = 0;
|
int passed_parameters = 0;
|
||||||
passed_parameters += params.get<std::string>("table") ? 1 : 0;
|
passed_parameters += params.get<std::string>("table") ? 1 : 0;
|
||||||
passed_parameters += table_by_index ? 1 : 0;
|
passed_parameters += table_by_index.has_value() ? 1 : 0;
|
||||||
|
|
||||||
if (passed_parameters > 1)
|
if (passed_parameters > 1)
|
||||||
{
|
{
|
||||||
|
@ -426,13 +426,13 @@ box2d<double> sqlite_datasource::envelope() const
|
||||||
return extent_;
|
return extent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> sqlite_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> sqlite_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_STATS
|
#ifdef MAPNIK_STATS
|
||||||
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::get_geometry_type");
|
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::get_geometry_type");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> result;
|
std::optional<mapnik::datasource_geometry_t> result;
|
||||||
if (dataset_)
|
if (dataset_)
|
||||||
{
|
{
|
||||||
// get geometry type by querying first features
|
// get geometry type by querying first features
|
||||||
|
@ -470,7 +470,7 @@ boost::optional<mapnik::datasource_geometry_t> sqlite_datasource::get_geometry_t
|
||||||
int type = static_cast<int>(*result);
|
int type = static_cast<int>(*result);
|
||||||
if (multi_type > 0 && multi_type != type)
|
if (multi_type > 0 && multi_type != type)
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
multi_type = type;
|
multi_type = type;
|
||||||
|
|
|
@ -35,13 +35,10 @@
|
||||||
#include <mapnik/value/types.hpp>
|
#include <mapnik/value/types.hpp>
|
||||||
#include <mapnik/datasource_plugin.hpp>
|
#include <mapnik/datasource_plugin.hpp>
|
||||||
|
|
||||||
// boost
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
// sqlite
|
// sqlite
|
||||||
#include "sqlite_connection.hpp"
|
#include "sqlite_connection.hpp"
|
||||||
|
@ -53,13 +50,13 @@ class sqlite_datasource : public mapnik::datasource
|
||||||
public:
|
public:
|
||||||
sqlite_datasource(mapnik::parameters const& params);
|
sqlite_datasource(mapnik::parameters const& params);
|
||||||
virtual ~sqlite_datasource();
|
virtual ~sqlite_datasource();
|
||||||
datasource::datasource_t type() const;
|
datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
mapnik::featureset_ptr features(mapnik::query const& q) const override;
|
||||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
mapnik::layer_descriptor get_descriptor() const;
|
mapnik::layer_descriptor get_descriptor() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Fill init_statements with any statements
|
// Fill init_statements with any statements
|
||||||
|
|
|
@ -23,9 +23,6 @@
|
||||||
#include "topojson_datasource.hpp"
|
#include "topojson_datasource.hpp"
|
||||||
#include "topojson_featureset.hpp"
|
#include "topojson_featureset.hpp"
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
|
@ -132,18 +129,18 @@ topojson_datasource::topojson_datasource(parameters const& params)
|
||||||
, tr_(new mapnik::transcoder(*params.get<std::string>("encoding", "utf-8")))
|
, tr_(new mapnik::transcoder(*params.get<std::string>("encoding", "utf-8")))
|
||||||
, tree_(nullptr)
|
, tree_(nullptr)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> inline_string = params.get<std::string>("inline");
|
const auto inline_string = params.get<std::string>("inline");
|
||||||
if (inline_string)
|
if (inline_string)
|
||||||
{
|
{
|
||||||
inline_string_ = *inline_string;
|
inline_string_ = *inline_string;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
const auto file = params.get<std::string>("file");
|
||||||
if (!file)
|
if (!file)
|
||||||
throw mapnik::datasource_exception("TopoJSON Plugin: missing <file> parameter");
|
throw mapnik::datasource_exception("TopoJSON Plugin: missing <file> parameter");
|
||||||
|
|
||||||
boost::optional<std::string> base = params.get<std::string>("base");
|
const auto base = params.get<std::string>("base");
|
||||||
if (base)
|
if (base)
|
||||||
filename_ = *base + "/" + *file;
|
filename_ = *base + "/" + *file;
|
||||||
else
|
else
|
||||||
|
@ -225,9 +222,9 @@ const char* topojson_datasource::name()
|
||||||
return "topojson";
|
return "topojson";
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapnik::datasource_geometry_t> topojson_datasource::get_geometry_type() const
|
std::optional<mapnik::datasource_geometry_t> topojson_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
boost::optional<mapnik::datasource_geometry_t> result;
|
std::optional<mapnik::datasource_geometry_t> result;
|
||||||
int multi_type = 0;
|
int multi_type = 0;
|
||||||
std::size_t num_features = topo_.geometries.size();
|
std::size_t num_features = topo_.geometries.size();
|
||||||
for (std::size_t i = 0; i < num_features && i < 5; ++i)
|
for (std::size_t i = 0; i < num_features && i < 5; ++i)
|
||||||
|
@ -238,12 +235,12 @@ boost::optional<mapnik::datasource_geometry_t> topojson_datasource::get_geometry
|
||||||
{
|
{
|
||||||
if (multi_type > 0 && multi_type != type)
|
if (multi_type > 0 && multi_type != type)
|
||||||
{
|
{
|
||||||
result.reset(mapnik::datasource_geometry_t::Collection);
|
result = mapnik::datasource_geometry_t::Collection;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.reset(static_cast<mapnik::datasource_geometry_t>(type));
|
result = static_cast<mapnik::datasource_geometry_t>(type);
|
||||||
}
|
}
|
||||||
multi_type = type;
|
multi_type = type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/geometry/geometries/geometries.hpp>
|
#include <boost/geometry/geometries/geometries.hpp>
|
||||||
#include <boost/geometry.hpp>
|
#include <boost/geometry.hpp>
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
|
@ -47,11 +46,10 @@ MAPNIK_DISABLE_WARNING_PUSH
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <deque>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
DATASOURCE_PLUGIN_DEF(topojson_datasource_plugin, topojson);
|
DATASOURCE_PLUGIN_DEF(topojson_datasource_plugin, topojson);
|
||||||
|
|
||||||
|
@ -66,13 +64,13 @@ class topojson_datasource : public mapnik::datasource
|
||||||
// constructor
|
// constructor
|
||||||
topojson_datasource(mapnik::parameters const& params);
|
topojson_datasource(mapnik::parameters const& params);
|
||||||
virtual ~topojson_datasource();
|
virtual ~topojson_datasource();
|
||||||
mapnik::datasource::datasource_t type() const;
|
mapnik::datasource::datasource_t type() const override;
|
||||||
static const char* name();
|
static const char* name();
|
||||||
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
mapnik::featureset_ptr features(mapnik::query const& q) const override;
|
||||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override;
|
||||||
mapnik::box2d<double> envelope() const;
|
mapnik::box2d<double> envelope() const override;
|
||||||
mapnik::layer_descriptor get_descriptor() const;
|
mapnik::layer_descriptor get_descriptor() const override;
|
||||||
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
std::optional<mapnik::datasource_geometry_t> get_geometry_type() const override;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void parse_topojson(T const& buffer);
|
void parse_topojson(T const& buffer);
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,6 @@ MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include "agg_span_image_filter_rgba.h"
|
#include "agg_span_image_filter_rgba.h"
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
@ -167,7 +161,7 @@ void agg_renderer<T0, T1>::setup(Map const& m, buffer_type& pixmap)
|
||||||
buffers_.emplace(pixmap);
|
buffers_.emplace(pixmap);
|
||||||
|
|
||||||
mapnik::set_premultiplied_alpha(pixmap, true);
|
mapnik::set_premultiplied_alpha(pixmap, true);
|
||||||
boost::optional<color> const& bg = m.background();
|
auto&& bg = m.background();
|
||||||
if (bg)
|
if (bg)
|
||||||
{
|
{
|
||||||
if (bg->alpha() < 255)
|
if (bg->alpha() < 255)
|
||||||
|
@ -184,7 +178,7 @@ void agg_renderer<T0, T1>::setup(Map const& m, buffer_type& pixmap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> const& image_filename = m.background_image();
|
auto&& image_filename = m.background_image();
|
||||||
if (image_filename)
|
if (image_filename)
|
||||||
{
|
{
|
||||||
// NOTE: marker_cache returns premultiplied image, if needed
|
// NOTE: marker_cache returns premultiplied image, if needed
|
||||||
|
@ -229,7 +223,7 @@ void agg_renderer<T0, T1>::start_layer_processing(layer const& lay, box2d<double
|
||||||
}
|
}
|
||||||
|
|
||||||
common_.query_extent_ = query_extent;
|
common_.query_extent_ = query_extent;
|
||||||
boost::optional<box2d<double>> const& maximum_extent = lay.maximum_extent();
|
auto&& maximum_extent = lay.maximum_extent();
|
||||||
if (maximum_extent)
|
if (maximum_extent)
|
||||||
{
|
{
|
||||||
common_.query_extent_.clip(*maximum_extent);
|
common_.query_extent_.clip(*maximum_extent);
|
||||||
|
|
|
@ -118,13 +118,13 @@ struct setup_marker_visitor
|
||||||
void operator()(marker_rgba8 const& marker) const
|
void operator()(marker_rgba8 const& marker) const
|
||||||
{
|
{
|
||||||
mapnik::image_rgba8 const& bg_image = marker.get_data();
|
mapnik::image_rgba8 const& bg_image = marker.get_data();
|
||||||
std::size_t w = bg_image.width();
|
const std::size_t w = bg_image.width();
|
||||||
std::size_t h = bg_image.height();
|
const std::size_t h = bg_image.height();
|
||||||
if (w > 0 && h > 0)
|
if (w > 0 && h > 0)
|
||||||
{
|
{
|
||||||
// repeat background-image both vertically and horizontally
|
// repeat background-image both vertically and horizontally
|
||||||
std::size_t x_steps = std::size_t(std::ceil(common_.width_ / double(w)));
|
const std::size_t x_steps = std::size_t(std::ceil(common_.width_ / double(w)));
|
||||||
std::size_t y_steps = std::size_t(std::ceil(common_.height_ / double(h)));
|
const std::size_t y_steps = std::size_t(std::ceil(common_.height_ / double(h)));
|
||||||
for (std::size_t x = 0; x < x_steps; ++x)
|
for (std::size_t x = 0; x < x_steps; ++x)
|
||||||
{
|
{
|
||||||
for (std::size_t y = 0; y < y_steps; ++y)
|
for (std::size_t y = 0; y < y_steps; ++y)
|
||||||
|
@ -144,16 +144,16 @@ struct setup_marker_visitor
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void cairo_renderer<T>::setup(Map const& map)
|
void cairo_renderer<T>::setup(Map const& map)
|
||||||
{
|
{
|
||||||
boost::optional<color> bg = m_.background();
|
const auto bg = m_.background();
|
||||||
if (bg)
|
if (bg.has_value())
|
||||||
{
|
{
|
||||||
cairo_save_restore guard(context_);
|
cairo_save_restore guard(context_);
|
||||||
context_.set_color(*bg);
|
context_.set_color(*bg);
|
||||||
context_.set_operator(composite_mode_e::src);
|
context_.set_operator(composite_mode_e::src);
|
||||||
context_.paint();
|
context_.paint();
|
||||||
}
|
}
|
||||||
boost::optional<std::string> const& image_filename = map.background_image();
|
auto&& image_filename = map.background_image();
|
||||||
if (image_filename)
|
if (image_filename.has_value())
|
||||||
{
|
{
|
||||||
// NOTE: marker_cache returns premultiplied image, if needed
|
// NOTE: marker_cache returns premultiplied image, if needed
|
||||||
std::shared_ptr<mapnik::marker const> bg_marker = mapnik::marker_cache::instance().find(*image_filename, true);
|
std::shared_ptr<mapnik::marker const> bg_marker = mapnik::marker_cache::instance().find(*image_filename, true);
|
||||||
|
@ -166,7 +166,7 @@ template<typename T>
|
||||||
void cairo_renderer<T>::start_map_processing(Map const& map)
|
void cairo_renderer<T>::start_map_processing(Map const& map)
|
||||||
{
|
{
|
||||||
MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer: Start map processing bbox=" << map.get_current_extent();
|
MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer: Start map processing bbox=" << map.get_current_extent();
|
||||||
box2d<double> bounds = common_.t_.forward(common_.t_.extent());
|
const box2d<double> bounds = common_.t_.forward(common_.t_.extent());
|
||||||
context_.rectangle(bounds.minx(), bounds.miny(), bounds.maxx(), bounds.maxy());
|
context_.rectangle(bounds.minx(), bounds.miny(), bounds.maxx(), bounds.maxy());
|
||||||
context_.clip();
|
context_.clip();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,8 @@ void save_to_cairo_file(mapnik::Map const& map,
|
||||||
double scale_factor,
|
double scale_factor,
|
||||||
double scale_denominator)
|
double scale_denominator)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> type = type_from_filename(filename);
|
const auto type = type_from_filename(filename);
|
||||||
if (type)
|
if (type.has_value())
|
||||||
{
|
{
|
||||||
save_to_cairo_file(map, filename, *type, scale_factor, scale_denominator);
|
save_to_cairo_file(map, filename, *type, scale_factor, scale_denominator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,8 @@ datasource_cache::~datasource_cache() {}
|
||||||
|
|
||||||
datasource_ptr datasource_cache::create(parameters const& params)
|
datasource_ptr datasource_cache::create(parameters const& params)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> type = params.get<std::string>("type");
|
const auto type = params.get<std::string>("type");
|
||||||
if (!type)
|
if (!type.has_value())
|
||||||
{
|
{
|
||||||
throw config_error(std::string("Could not create datasource. Required ") + "parameter 'type' is missing");
|
throw config_error(std::string("Could not create datasource. Required ") + "parameter 'type' is missing");
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ void init_datasource_cache_static()
|
||||||
|
|
||||||
datasource_ptr create_static_datasource(parameters const& params)
|
datasource_ptr create_static_datasource(parameters const& params)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> type = params.get<std::string>("type");
|
const auto type = params.get<std::string>("type");
|
||||||
datasource_map::iterator it = ds_map.find(*type);
|
datasource_map::iterator it = ds_map.find(*type);
|
||||||
if (it != ds_map.end())
|
if (it != ds_map.end())
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,12 +23,6 @@
|
||||||
#include <mapnik/feature_kv_iterator.hpp>
|
#include <mapnik/feature_kv_iterator.hpp>
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
feature_kv_iterator::feature_kv_iterator(feature_impl const& f, bool begin)
|
feature_kv_iterator::feature_kv_iterator(feature_impl const& f, bool begin)
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <mapnik/feature_type_style.hpp>
|
#include <mapnik/feature_type_style.hpp>
|
||||||
#include <mapnik/rule.hpp>
|
#include <mapnik/rule.hpp>
|
||||||
#include <mapnik/enumeration.hpp>
|
#include <mapnik/enumeration.hpp>
|
||||||
|
@ -150,7 +148,7 @@ void feature_type_style::set_comp_op(composite_mode_e _comp_op)
|
||||||
comp_op_ = _comp_op;
|
comp_op_ = _comp_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<composite_mode_e> feature_type_style::comp_op() const
|
std::optional<composite_mode_e> feature_type_style::comp_op() const
|
||||||
{
|
{
|
||||||
return comp_op_;
|
return comp_op_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
|
|
||||||
// freetype2
|
// freetype2
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -45,7 +44,6 @@ MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
template class MAPNIK_DECL singleton<freetype_engine, CreateUsingNew>;
|
template class MAPNIK_DECL singleton<freetype_engine, CreateUsingNew>;
|
||||||
|
@ -481,7 +479,7 @@ face_set_ptr face_manager::get_face_set(font_set const& fset)
|
||||||
return face_set;
|
return face_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
face_set_ptr face_manager::get_face_set(std::string const& name, boost::optional<font_set> fset)
|
face_set_ptr face_manager::get_face_set(std::string const& name, std::optional<font_set> fset)
|
||||||
{
|
{
|
||||||
if (fset && fset->size() > 0)
|
if (fset && fset->size() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,15 +28,8 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
|
||||||
#include <mapnik/warning_ignore.hpp>
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
namespace geometry {
|
namespace geometry {
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,8 @@ void grid_renderer<T>::start_layer_processing(layer const& lay, box2d<double> co
|
||||||
common_.detector_->clear();
|
common_.detector_->clear();
|
||||||
}
|
}
|
||||||
common_.query_extent_ = query_extent;
|
common_.query_extent_ = query_extent;
|
||||||
boost::optional<box2d<double>> const& maximum_extent = lay.maximum_extent();
|
auto&& maximum_extent = lay.maximum_extent();
|
||||||
if (maximum_extent)
|
if (maximum_extent.has_value())
|
||||||
{
|
{
|
||||||
common_.query_extent_.clip(*maximum_extent);
|
common_.query_extent_.clip(*maximum_extent);
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,6 @@ struct grid_render_marker_visitor
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image_rgba8 target(data.width(), data.height());
|
image_rgba8 target(data.width(), data.height());
|
||||||
boost::optional<double> nodata;
|
|
||||||
mapnik::scale_image_agg(target,
|
mapnik::scale_image_agg(target,
|
||||||
data,
|
data,
|
||||||
SCALING_NEAR,
|
SCALING_NEAR,
|
||||||
|
@ -216,7 +215,7 @@ struct grid_render_marker_visitor
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
1.0,
|
1.0,
|
||||||
nodata); // TODO: is 1.0 a valid default here, and do we even care in grid_renderer
|
std::nullopt); // TODO: is 1.0 a valid default here, and do we even care in grid_renderer
|
||||||
// what the image looks like?
|
// what the image looks like?
|
||||||
pixmap_.set_rectangle(feature_.id(),
|
pixmap_.set_rectangle(feature_.id(),
|
||||||
target,
|
target,
|
||||||
|
|
|
@ -64,24 +64,24 @@ static const comp_op_lookup_type comp_lookup =
|
||||||
_color,
|
_color,
|
||||||
"color")(_value, "value")(linear_dodge, "linear-dodge")(linear_burn, "linear-burn")(divide, "divide");
|
"color")(_value, "value")(linear_dodge, "linear-dodge")(linear_burn, "linear-burn")(divide, "divide");
|
||||||
|
|
||||||
boost::optional<composite_mode_e> comp_op_from_string(std::string const& name)
|
std::optional<composite_mode_e> comp_op_from_string(std::string const& name)
|
||||||
{
|
{
|
||||||
boost::optional<composite_mode_e> mode;
|
std::optional<composite_mode_e> mode;
|
||||||
comp_op_lookup_type::right_const_iterator right_iter = comp_lookup.right.find(name);
|
comp_op_lookup_type::right_const_iterator right_iter = comp_lookup.right.find(name);
|
||||||
if (right_iter != comp_lookup.right.end())
|
if (right_iter != comp_lookup.right.end())
|
||||||
{
|
{
|
||||||
mode.reset(right_iter->second);
|
mode = right_iter->second;
|
||||||
}
|
}
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> comp_op_to_string(composite_mode_e comp_op)
|
std::optional<std::string> comp_op_to_string(composite_mode_e comp_op)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> mode;
|
std::optional<std::string> mode;
|
||||||
comp_op_lookup_type::left_const_iterator left_iter = comp_lookup.left.find(comp_op);
|
comp_op_lookup_type::left_const_iterator left_iter = comp_lookup.left.find(comp_op);
|
||||||
if (left_iter != comp_lookup.left.end())
|
if (left_iter != comp_lookup.left.end())
|
||||||
{
|
{
|
||||||
mode.reset(left_iter->second);
|
mode = left_iter->second;
|
||||||
}
|
}
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace x3 = boost::spirit::x3;
|
||||||
|
|
||||||
using x3::lit;
|
using x3::lit;
|
||||||
using x3::ascii::char_;
|
using x3::ascii::char_;
|
||||||
using pair_type = std::pair<std::string, boost::optional<std::string>>;
|
using pair_type = std::pair<std::string, std::optional<std::string>>;
|
||||||
|
|
||||||
x3::rule<class image_options, image_options_map> const image_options("image options");
|
x3::rule<class image_options, image_options_map> const image_options("image options");
|
||||||
x3::rule<class key_value, pair_type> const key_value("key_value");
|
x3::rule<class key_value, pair_type> const key_value("key_value");
|
||||||
|
|
|
@ -27,20 +27,19 @@
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
inline boost::optional<std::string> type_from_bytes(char const* data, size_t size)
|
inline std::optional<std::string> type_from_bytes(char const* data, size_t size)
|
||||||
{
|
{
|
||||||
using result_type = boost::optional<std::string>;
|
|
||||||
unsigned char const* header = reinterpret_cast<unsigned char const*>(data);
|
unsigned char const* header = reinterpret_cast<unsigned char const*>(data);
|
||||||
if (size >= 4)
|
if (size >= 4)
|
||||||
{
|
{
|
||||||
unsigned int magic = (header[0] << 24) | (header[1] << 16) | (header[2] << 8) | header[3];
|
unsigned int magic = (header[0] << 24) | (header[1] << 16) | (header[2] << 8) | header[3];
|
||||||
if (magic == 0x89504E47U)
|
if (magic == 0x89504E47U)
|
||||||
{
|
{
|
||||||
return result_type("png");
|
return "png";
|
||||||
}
|
}
|
||||||
else if (magic == 0x49492A00U || magic == 0x4D4D002AU)
|
else if (magic == 0x49492A00U || magic == 0x4D4D002AU)
|
||||||
{
|
{
|
||||||
return result_type("tiff");
|
return "tiff";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (size >= 2)
|
if (size >= 2)
|
||||||
|
@ -48,7 +47,7 @@ inline boost::optional<std::string> type_from_bytes(char const* data, size_t siz
|
||||||
unsigned int magic = ((header[0] << 8) | header[1]) & 0xffff;
|
unsigned int magic = ((header[0] << 8) | header[1]) & 0xffff;
|
||||||
if (magic == 0xffd8)
|
if (magic == 0xffd8)
|
||||||
{
|
{
|
||||||
return result_type("jpeg");
|
return "jpeg";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,16 +56,16 @@ inline boost::optional<std::string> type_from_bytes(char const* data, size_t siz
|
||||||
if (header[0] == 'R' && header[1] == 'I' && header[2] == 'F' && header[3] == 'F' && header[8] == 'W' &&
|
if (header[0] == 'R' && header[1] == 'I' && header[2] == 'F' && header[3] == 'F' && header[8] == 'W' &&
|
||||||
header[9] == 'E' && header[10] == 'B' && header[11] == 'P')
|
header[9] == 'E' && header[10] == 'B' && header[11] == 'P')
|
||||||
{
|
{
|
||||||
return result_type("webp");
|
return "webp";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result_type();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
image_reader* get_image_reader(char const* data, size_t size)
|
image_reader* get_image_reader(char const* data, size_t size)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> type = type_from_bytes(data, size);
|
const auto type = type_from_bytes(data, size);
|
||||||
if (type)
|
if (type.has_value())
|
||||||
return factory<image_reader, std::string, char const*, size_t>::instance().create_object(*type, data, size);
|
return factory<image_reader, std::string, char const*, size_t>::instance().create_object(*type, data, size);
|
||||||
else
|
else
|
||||||
throw image_reader_exception("image_reader: can't determine type from input data");
|
throw image_reader_exception("image_reader: can't determine type from input data");
|
||||||
|
@ -79,8 +78,8 @@ image_reader* get_image_reader(std::string const& filename, std::string const& t
|
||||||
|
|
||||||
image_reader* get_image_reader(std::string const& filename)
|
image_reader* get_image_reader(std::string const& filename)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> type = type_from_filename(filename);
|
const auto type = type_from_filename(filename);
|
||||||
if (type)
|
if (type.has_value())
|
||||||
{
|
{
|
||||||
return factory<image_reader, std::string, std::string const&>::instance().create_object(*type, filename);
|
return factory<image_reader, std::string, std::string const&>::instance().create_object(*type, filename);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,26 +66,24 @@ static const scaling_method_lookup_type scaling_lookup =
|
||||||
SCALING_SINC,
|
SCALING_SINC,
|
||||||
"sinc")(SCALING_LANCZOS, "lanczos")(SCALING_BLACKMAN, "blackman");
|
"sinc")(SCALING_LANCZOS, "lanczos")(SCALING_BLACKMAN, "blackman");
|
||||||
|
|
||||||
boost::optional<scaling_method_e> scaling_method_from_string(std::string const& name)
|
std::optional<scaling_method_e> scaling_method_from_string(std::string const& name)
|
||||||
{
|
{
|
||||||
boost::optional<scaling_method_e> mode;
|
|
||||||
scaling_method_lookup_type::right_const_iterator right_iter = scaling_lookup.right.find(name);
|
scaling_method_lookup_type::right_const_iterator right_iter = scaling_lookup.right.find(name);
|
||||||
if (right_iter != scaling_lookup.right.end())
|
if (right_iter != scaling_lookup.right.end())
|
||||||
{
|
{
|
||||||
mode.reset(right_iter->second);
|
return right_iter->second;
|
||||||
}
|
}
|
||||||
return mode;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> scaling_method_to_string(scaling_method_e scaling_method)
|
std::optional<std::string> scaling_method_to_string(scaling_method_e scaling_method)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> mode;
|
|
||||||
scaling_method_lookup_type::left_const_iterator left_iter = scaling_lookup.left.find(scaling_method);
|
scaling_method_lookup_type::left_const_iterator left_iter = scaling_lookup.left.find(scaling_method);
|
||||||
if (left_iter != scaling_lookup.left.end())
|
if (left_iter != scaling_lookup.left.end())
|
||||||
{
|
{
|
||||||
mode.reset(left_iter->second);
|
return left_iter->second;
|
||||||
}
|
}
|
||||||
return mode;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -97,7 +95,7 @@ void scale_image_agg(T& target,
|
||||||
double x_off_f,
|
double x_off_f,
|
||||||
double y_off_f,
|
double y_off_f,
|
||||||
double filter_factor,
|
double filter_factor,
|
||||||
boost::optional<double> const& nodata_value)
|
std::optional<double> const& nodata_value)
|
||||||
{
|
{
|
||||||
// "the image filters should work namely in the premultiplied color space"
|
// "the image filters should work namely in the premultiplied color space"
|
||||||
// http://old.nabble.com/Re:--AGG--Basic-image-transformations-p1110665.html
|
// http://old.nabble.com/Re:--AGG--Basic-image-transformations-p1110665.html
|
||||||
|
@ -157,8 +155,8 @@ void scale_image_agg(T& target,
|
||||||
using span_gen_type = typename detail::agg_scaling_traits<image_type>::span_image_resample_affine;
|
using span_gen_type = typename detail::agg_scaling_traits<image_type>::span_image_resample_affine;
|
||||||
agg::image_filter_lut filter;
|
agg::image_filter_lut filter;
|
||||||
detail::set_scaling_method(filter, scaling_method, filter_factor);
|
detail::set_scaling_method(filter, scaling_method, filter_factor);
|
||||||
boost::optional<typename span_gen_type::value_type> nodata;
|
std::optional<typename span_gen_type::value_type> nodata;
|
||||||
if (nodata_value)
|
if (nodata_value.has_value())
|
||||||
{
|
{
|
||||||
nodata.emplace(safe_cast<typename span_gen_type::value_type>(*nodata_value));
|
nodata.emplace(safe_cast<typename span_gen_type::value_type>(*nodata_value));
|
||||||
}
|
}
|
||||||
|
@ -175,7 +173,7 @@ template MAPNIK_DECL void scale_image_agg(image_rgba8&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray8&,
|
template MAPNIK_DECL void scale_image_agg(image_gray8&,
|
||||||
image_gray8 const&,
|
image_gray8 const&,
|
||||||
|
@ -185,7 +183,7 @@ template MAPNIK_DECL void scale_image_agg(image_gray8&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray8s&,
|
template MAPNIK_DECL void scale_image_agg(image_gray8s&,
|
||||||
image_gray8s const&,
|
image_gray8s const&,
|
||||||
|
@ -195,7 +193,7 @@ template MAPNIK_DECL void scale_image_agg(image_gray8s&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray16&,
|
template MAPNIK_DECL void scale_image_agg(image_gray16&,
|
||||||
image_gray16 const&,
|
image_gray16 const&,
|
||||||
|
@ -205,7 +203,7 @@ template MAPNIK_DECL void scale_image_agg(image_gray16&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray16s&,
|
template MAPNIK_DECL void scale_image_agg(image_gray16s&,
|
||||||
image_gray16s const&,
|
image_gray16s const&,
|
||||||
|
@ -215,7 +213,7 @@ template MAPNIK_DECL void scale_image_agg(image_gray16s&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray32&,
|
template MAPNIK_DECL void scale_image_agg(image_gray32&,
|
||||||
image_gray32 const&,
|
image_gray32 const&,
|
||||||
|
@ -225,7 +223,7 @@ template MAPNIK_DECL void scale_image_agg(image_gray32&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray32s&,
|
template MAPNIK_DECL void scale_image_agg(image_gray32s&,
|
||||||
image_gray32s const&,
|
image_gray32s const&,
|
||||||
|
@ -235,7 +233,7 @@ template MAPNIK_DECL void scale_image_agg(image_gray32s&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray32f&,
|
template MAPNIK_DECL void scale_image_agg(image_gray32f&,
|
||||||
image_gray32f const&,
|
image_gray32f const&,
|
||||||
|
@ -245,7 +243,7 @@ template MAPNIK_DECL void scale_image_agg(image_gray32f&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray64&,
|
template MAPNIK_DECL void scale_image_agg(image_gray64&,
|
||||||
image_gray64 const&,
|
image_gray64 const&,
|
||||||
|
@ -255,7 +253,7 @@ template MAPNIK_DECL void scale_image_agg(image_gray64&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray64s&,
|
template MAPNIK_DECL void scale_image_agg(image_gray64s&,
|
||||||
image_gray64s const&,
|
image_gray64s const&,
|
||||||
|
@ -265,7 +263,7 @@ template MAPNIK_DECL void scale_image_agg(image_gray64s&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_gray64f&,
|
template MAPNIK_DECL void scale_image_agg(image_gray64f&,
|
||||||
image_gray64f const&,
|
image_gray64f const&,
|
||||||
|
@ -275,5 +273,5 @@ template MAPNIK_DECL void scale_image_agg(image_gray64f&,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
boost::optional<double> const&);
|
std::optional<double> const&);
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
|
@ -313,8 +313,8 @@ MAPNIK_DECL void
|
||||||
template<typename T>
|
template<typename T>
|
||||||
MAPNIK_DECL void save_to_file(T const& image, std::string const& filename)
|
MAPNIK_DECL void save_to_file(T const& image, std::string const& filename)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> type = type_from_filename(filename);
|
const auto type = type_from_filename(filename);
|
||||||
if (type)
|
if (type.has_value())
|
||||||
{
|
{
|
||||||
save_to_file<T>(image, filename, *type);
|
save_to_file<T>(image, filename, *type);
|
||||||
}
|
}
|
||||||
|
@ -325,8 +325,8 @@ MAPNIK_DECL void save_to_file(T const& image, std::string const& filename)
|
||||||
template<typename T>
|
template<typename T>
|
||||||
MAPNIK_DECL void save_to_file(T const& image, std::string const& filename, rgba_palette const& palette)
|
MAPNIK_DECL void save_to_file(T const& image, std::string const& filename, rgba_palette const& palette)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> type = type_from_filename(filename);
|
const auto type = type_from_filename(filename);
|
||||||
if (type)
|
if (type.has_value())
|
||||||
{
|
{
|
||||||
save_to_file<T>(image, filename, *type, palette);
|
save_to_file<T>(image, filename, *type, palette);
|
||||||
}
|
}
|
||||||
|
@ -425,11 +425,11 @@ struct is_solid_visitor
|
||||||
if (image.size() > 0)
|
if (image.size() > 0)
|
||||||
{
|
{
|
||||||
pixel_type const first_p = *image.begin();
|
pixel_type const first_p = *image.begin();
|
||||||
auto itr = std::find_if(/*std::execution::par_unseq,*/ // still missing on ubuntu with
|
const auto itr = std::find_if(/*std::execution::par_unseq,*/ // still missing on ubuntu with
|
||||||
// clang++10/libc++ (!)
|
// clang++10/libc++ (!)
|
||||||
image.begin(),
|
image.begin(),
|
||||||
image.end(),
|
image.end(),
|
||||||
[first_p](pixel_type const p) { return first_p != p; });
|
[first_p](auto&& p) { return first_p != p; });
|
||||||
return (itr == image.end());
|
return (itr == image.end());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -75,7 +75,7 @@ class jpeg_reader : public image_reader
|
||||||
~jpeg_reader();
|
~jpeg_reader();
|
||||||
unsigned width() const final;
|
unsigned width() const final;
|
||||||
unsigned height() const final;
|
unsigned height() const final;
|
||||||
boost::optional<box2d<double>> bounding_box() const final;
|
std::optional<box2d<double>> bounding_box() const override final;
|
||||||
inline bool has_alpha() const final { return false; }
|
inline bool has_alpha() const final { return false; }
|
||||||
void read(unsigned x, unsigned y, image_rgba8& image) final;
|
void read(unsigned x, unsigned y, image_rgba8& image) final;
|
||||||
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
||||||
|
@ -260,9 +260,9 @@ unsigned jpeg_reader<T>::height() const
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<box2d<double>> jpeg_reader<T>::bounding_box() const
|
std::optional<box2d<double>> jpeg_reader<T>::bounding_box() const
|
||||||
{
|
{
|
||||||
return boost::optional<box2d<double>>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -289,8 +289,8 @@ void jpeg_reader<T>::read(unsigned x0, unsigned y0, image_rgba8& image)
|
||||||
row_stride = cinfo.output_width * cinfo.output_components;
|
row_stride = cinfo.output_width * cinfo.output_components;
|
||||||
buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo, JPOOL_IMAGE, row_stride, 1);
|
buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo, JPOOL_IMAGE, row_stride, 1);
|
||||||
|
|
||||||
unsigned w = std::min(unsigned(image.width()), width_ - x0);
|
const unsigned w = std::min(unsigned(image.width()), width_ - x0);
|
||||||
unsigned h = std::min(unsigned(image.height()), height_ - y0);
|
const unsigned h = std::min(unsigned(image.height()), height_ - y0);
|
||||||
|
|
||||||
const std::unique_ptr<unsigned int[]> out_row(new unsigned int[w]);
|
const std::unique_ptr<unsigned int[]> out_row(new unsigned int[w]);
|
||||||
unsigned row = 0;
|
unsigned row = 0;
|
||||||
|
|
|
@ -227,10 +227,10 @@ void layer::set_datasource(datasource_ptr const& ds)
|
||||||
|
|
||||||
void layer::set_maximum_extent(box2d<double> const& box)
|
void layer::set_maximum_extent(box2d<double> const& box)
|
||||||
{
|
{
|
||||||
maximum_extent_.reset(box);
|
maximum_extent_ = box;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<box2d<double>> const& layer::maximum_extent() const
|
std::optional<box2d<double>> const& layer::maximum_extent() const
|
||||||
{
|
{
|
||||||
return maximum_extent_;
|
return maximum_extent_;
|
||||||
}
|
}
|
||||||
|
@ -242,10 +242,10 @@ void layer::reset_maximum_extent()
|
||||||
|
|
||||||
void layer::set_buffer_size(int size)
|
void layer::set_buffer_size(int size)
|
||||||
{
|
{
|
||||||
buffer_size_.reset(size);
|
buffer_size_ = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<int> const& layer::buffer_size() const
|
std::optional<int> const& layer::buffer_size() const
|
||||||
{
|
{
|
||||||
return buffer_size_;
|
return buffer_size_;
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ void layer::set_comp_op(composite_mode_e comp_op)
|
||||||
comp_op_ = comp_op;
|
comp_op_ = comp_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<composite_mode_e> layer::comp_op() const
|
std::optional<composite_mode_e> layer::comp_op() const
|
||||||
{
|
{
|
||||||
return comp_op_;
|
return comp_op_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@
|
||||||
#include <mapnik/warning.hpp>
|
#include <mapnik/warning.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_PUSH
|
MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <mapnik/warning_ignore.hpp>
|
#include <mapnik/warning_ignore.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/tokenizer.hpp>
|
#include <boost/tokenizer.hpp>
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <boost/property_tree/xml_parser.hpp>
|
#include <boost/property_tree/xml_parser.hpp>
|
||||||
|
@ -82,7 +81,7 @@ MAPNIK_DISABLE_WARNING_POP
|
||||||
using boost::tokenizer;
|
using boost::tokenizer;
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
using boost::optional;
|
using std::optional;
|
||||||
using util::name_to_int;
|
using util::name_to_int;
|
||||||
using util::operator"" _case;
|
using util::operator"" _case;
|
||||||
|
|
||||||
|
@ -135,10 +134,10 @@ class map_parser : util::noncopyable
|
||||||
void ensure_font_face(std::string const& face_name);
|
void ensure_font_face(std::string const& face_name);
|
||||||
void find_unused_nodes(xml_node const& root);
|
void find_unused_nodes(xml_node const& root);
|
||||||
void find_unused_nodes_recursive(xml_node const& node, std::string& error_text);
|
void find_unused_nodes_recursive(xml_node const& node, std::string& error_text);
|
||||||
std::string ensure_relative_to_xml(boost::optional<std::string> const& opt_path);
|
std::string ensure_relative_to_xml(std::optional<std::string> const& opt_path);
|
||||||
void ensure_exists(std::string const& file_path);
|
void ensure_exists(std::string const& file_path);
|
||||||
void check_styles(Map const& map);
|
void check_styles(Map const& map);
|
||||||
boost::optional<color> get_opt_color_attr(boost::property_tree::ptree const& node, std::string const& name);
|
std::optional<color> get_opt_color_attr(boost::property_tree::ptree const& node, std::string const& name);
|
||||||
|
|
||||||
bool strict_;
|
bool strict_;
|
||||||
std::string filename_;
|
std::string filename_;
|
||||||
|
@ -849,15 +848,15 @@ void map_parser::parse_layer(Parent& parent, xml_node const& node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> base_param = params.get<std::string>("base");
|
const auto base_param = params.get<std::string>("base");
|
||||||
boost::optional<std::string> file_param = params.get<std::string>("file");
|
const auto file_param = params.get<std::string>("file");
|
||||||
|
|
||||||
if (base_param)
|
if (base_param.has_value())
|
||||||
{
|
{
|
||||||
params["base"] = ensure_relative_to_xml(base_param);
|
params["base"] = ensure_relative_to_xml(base_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (file_param)
|
else if (file_param.has_value())
|
||||||
{
|
{
|
||||||
params["file"] = ensure_relative_to_xml(file_param);
|
params["file"] = ensure_relative_to_xml(file_param);
|
||||||
}
|
}
|
||||||
|
@ -1461,8 +1460,8 @@ void map_parser::parse_raster_symbolizer(rule& rule, xml_node const& node)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::optional<scaling_method_e> method = scaling_method_from_string(scaling_method);
|
const auto method = scaling_method_from_string(scaling_method);
|
||||||
if (method)
|
if (method.has_value())
|
||||||
{
|
{
|
||||||
put(raster_sym, keys::scaling, *method);
|
put(raster_sym, keys::scaling, *method);
|
||||||
}
|
}
|
||||||
|
@ -1753,7 +1752,7 @@ void map_parser::ensure_font_face(std::string const& face_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string map_parser::ensure_relative_to_xml(boost::optional<std::string> const& opt_path)
|
std::string map_parser::ensure_relative_to_xml(std::optional<std::string> const& opt_path)
|
||||||
{
|
{
|
||||||
if (marker_cache::instance().is_uri(*opt_path))
|
if (marker_cache::instance().is_uri(*opt_path))
|
||||||
return *opt_path;
|
return *opt_path;
|
||||||
|
|
|
@ -427,7 +427,7 @@ int Map::buffer_size() const
|
||||||
return buffer_size_;
|
return buffer_size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<color> const& Map::background() const
|
std::optional<color> const& Map::background() const
|
||||||
{
|
{
|
||||||
return background_;
|
return background_;
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ void Map::set_background(color const& c)
|
||||||
background_ = c;
|
background_ = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> const& Map::background_image() const
|
std::optional<std::string> const& Map::background_image() const
|
||||||
{
|
{
|
||||||
return background_image_;
|
return background_image_;
|
||||||
}
|
}
|
||||||
|
@ -469,10 +469,10 @@ void Map::set_background_image_opacity(float opacity)
|
||||||
|
|
||||||
void Map::set_maximum_extent(box2d<double> const& box)
|
void Map::set_maximum_extent(box2d<double> const& box)
|
||||||
{
|
{
|
||||||
maximum_extent_.reset(box);
|
maximum_extent_ = box;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<box2d<double>> const& Map::maximum_extent() const
|
std::optional<box2d<double>> const& Map::maximum_extent() const
|
||||||
{
|
{
|
||||||
return maximum_extent_;
|
return maximum_extent_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,19 +63,17 @@ bool mapped_memory_cache::remove(std::string const& key)
|
||||||
return cache_.erase(key) > 0;
|
return cache_.erase(key) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<mapped_region_ptr> mapped_memory_cache::find(std::string const& uri, bool update_cache)
|
std::optional<mapped_region_ptr> mapped_memory_cache::find(std::string const& uri, bool update_cache)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_THREADSAFE
|
#ifdef MAPNIK_THREADSAFE
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using iterator_type = std::unordered_map<std::string, mapped_region_ptr>::const_iterator;
|
using iterator_type = std::unordered_map<std::string, mapped_region_ptr>::const_iterator;
|
||||||
boost::optional<mapped_region_ptr> result;
|
|
||||||
iterator_type itr = cache_.find(uri);
|
iterator_type itr = cache_.find(uri);
|
||||||
if (itr != cache_.end())
|
if (itr != cache_.end())
|
||||||
{
|
{
|
||||||
result.reset(itr->second);
|
return itr->second;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapnik::util::exists(uri))
|
if (mapnik::util::exists(uri))
|
||||||
|
@ -85,12 +83,11 @@ boost::optional<mapped_region_ptr> mapped_memory_cache::find(std::string const&
|
||||||
boost::interprocess::file_mapping mapping(uri.c_str(), boost::interprocess::read_only);
|
boost::interprocess::file_mapping mapping(uri.c_str(), boost::interprocess::read_only);
|
||||||
mapped_region_ptr region(
|
mapped_region_ptr region(
|
||||||
std::make_shared<boost::interprocess::mapped_region>(mapping, boost::interprocess::read_only));
|
std::make_shared<boost::interprocess::mapped_region>(mapping, boost::interprocess::read_only));
|
||||||
result.reset(region);
|
|
||||||
if (update_cache)
|
if (update_cache)
|
||||||
{
|
{
|
||||||
cache_.emplace(uri, *result);
|
cache_.emplace(uri, region);
|
||||||
}
|
}
|
||||||
return result;
|
return region;
|
||||||
}
|
}
|
||||||
catch (std::exception const& ex)
|
catch (std::exception const& ex)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +101,7 @@ boost::optional<mapped_region_ptr> mapped_memory_cache::find(std::string const&
|
||||||
MAPNIK_LOG_WARN(mapped_memory_cache) << "Memory region does not exist file: " << uri;
|
MAPNIK_LOG_WARN(mapped_memory_cache) << "Memory region does not exist file: " << uri;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
return result;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
|
@ -83,11 +83,11 @@ namespace detail {
|
||||||
struct push_explicit_style
|
struct push_explicit_style
|
||||||
{
|
{
|
||||||
push_explicit_style(svg::group& dst,
|
push_explicit_style(svg::group& dst,
|
||||||
boost::optional<color> const& fill_color,
|
std::optional<color> const& fill_color,
|
||||||
boost::optional<double> const& fill_opacity,
|
std::optional<double> const& fill_opacity,
|
||||||
boost::optional<color> const& stroke_color,
|
std::optional<color> const& stroke_color,
|
||||||
boost::optional<double> const& stroke_width,
|
std::optional<double> const& stroke_width,
|
||||||
boost::optional<double> const& stroke_opacity)
|
std::optional<double> const& stroke_opacity)
|
||||||
: current_group_(&dst)
|
: current_group_(&dst)
|
||||||
, fill_color_(fill_color)
|
, fill_color_(fill_color)
|
||||||
, fill_opacity_(fill_opacity)
|
, fill_opacity_(fill_opacity)
|
||||||
|
@ -168,11 +168,11 @@ struct push_explicit_style
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
mutable svg::group* current_group_;
|
mutable svg::group* current_group_;
|
||||||
boost::optional<color> const& fill_color_;
|
std::optional<color> const& fill_color_;
|
||||||
boost::optional<double> const& fill_opacity_;
|
std::optional<double> const& fill_opacity_;
|
||||||
boost::optional<color> const& stroke_color_;
|
std::optional<color> const& stroke_color_;
|
||||||
boost::optional<double> const& stroke_width_;
|
std::optional<double> const& stroke_width_;
|
||||||
boost::optional<double> const& stroke_opacity_;
|
std::optional<double> const& stroke_opacity_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
|
@ -159,7 +159,7 @@ box2d<double> memory_datasource::envelope() const
|
||||||
return extent_;
|
return extent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<datasource_geometry_t> memory_datasource::get_geometry_type() const
|
std::optional<datasource_geometry_t> memory_datasource::get_geometry_type() const
|
||||||
{
|
{
|
||||||
// TODO - detect this?
|
// TODO - detect this?
|
||||||
return datasource_geometry_t::Collection;
|
return datasource_geometry_t::Collection;
|
||||||
|
|
|
@ -28,26 +28,26 @@
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
template boost::optional<std::string> parameters::get(std::string const& key) const;
|
template std::optional<std::string> parameters::get(std::string const& key) const;
|
||||||
template boost::optional<std::string> parameters::get(std::string const& key,
|
template std::optional<std::string> parameters::get(std::string const& key,
|
||||||
std::string const& default_opt_value) const;
|
std::string const& default_opt_value) const;
|
||||||
|
|
||||||
template boost::optional<value_double> parameters::get(std::string const& key) const;
|
template std::optional<value_double> parameters::get(std::string const& key) const;
|
||||||
template boost::optional<value_double> parameters::get(std::string const& key,
|
template std::optional<value_double> parameters::get(std::string const& key,
|
||||||
value_double const& default_opt_value) const;
|
value_double const& default_opt_value) const;
|
||||||
|
|
||||||
template boost::optional<value_bool> parameters::get(std::string const& key) const;
|
template std::optional<value_bool> parameters::get(std::string const& key) const;
|
||||||
template boost::optional<value_bool> parameters::get(std::string const& key, value_bool const& default_opt_value) const;
|
template std::optional<value_bool> parameters::get(std::string const& key, value_bool const& default_opt_value) const;
|
||||||
|
|
||||||
template boost::optional<boolean_type> parameters::get(std::string const& key) const;
|
template std::optional<boolean_type> parameters::get(std::string const& key) const;
|
||||||
template boost::optional<boolean_type> parameters::get(std::string const& key,
|
template std::optional<boolean_type> parameters::get(std::string const& key,
|
||||||
boolean_type const& default_opt_value) const;
|
boolean_type const& default_opt_value) const;
|
||||||
|
|
||||||
template boost::optional<value_null> parameters::get(std::string const& key) const;
|
template std::optional<value_null> parameters::get(std::string const& key) const;
|
||||||
template boost::optional<value_null> parameters::get(std::string const& key, value_null const& default_opt_value) const;
|
template std::optional<value_null> parameters::get(std::string const& key, value_null const& default_opt_value) const;
|
||||||
|
|
||||||
template boost::optional<value_integer> parameters::get(std::string const& key) const;
|
template std::optional<value_integer> parameters::get(std::string const& key) const;
|
||||||
template boost::optional<value_integer> parameters::get(std::string const& key,
|
template std::optional<value_integer> parameters::get(std::string const& key,
|
||||||
value_integer const& default_opt_value) const;
|
value_integer const& default_opt_value) const;
|
||||||
|
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
|
@ -70,7 +70,7 @@ class png_reader : public image_reader
|
||||||
~png_reader();
|
~png_reader();
|
||||||
unsigned width() const final;
|
unsigned width() const final;
|
||||||
unsigned height() const final;
|
unsigned height() const final;
|
||||||
boost::optional<box2d<double>> bounding_box() const final;
|
std::optional<box2d<double>> bounding_box() const final;
|
||||||
inline bool has_alpha() const final { return has_alpha_; }
|
inline bool has_alpha() const final { return has_alpha_; }
|
||||||
void read(unsigned x, unsigned y, image_rgba8& image) final;
|
void read(unsigned x, unsigned y, image_rgba8& image) final;
|
||||||
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
||||||
|
@ -211,9 +211,9 @@ unsigned png_reader<T>::height() const
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::optional<box2d<double>> png_reader<T>::bounding_box() const
|
std::optional<box2d<double>> png_reader<T>::bounding_box() const
|
||||||
{
|
{
|
||||||
return boost::optional<box2d<double>>();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -104,8 +104,8 @@ proj_transform::proj_transform(projection const& source, projection const& dest)
|
||||||
{
|
{
|
||||||
is_source_longlat_ = source.is_geographic();
|
is_source_longlat_ = source.is_geographic();
|
||||||
is_dest_longlat_ = dest.is_geographic();
|
is_dest_longlat_ = dest.is_geographic();
|
||||||
boost::optional<well_known_srs_e> src_k = source.well_known();
|
const auto src_k = source.well_known();
|
||||||
boost::optional<well_known_srs_e> dest_k = dest.well_known();
|
const auto dest_k = dest.well_known();
|
||||||
bool known_trans = false;
|
bool known_trans = false;
|
||||||
if (src_k && dest_k)
|
if (src_k && dest_k)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,8 +44,8 @@ projection::projection(std::string const& params, bool defer_proj_init)
|
||||||
, proj_(nullptr)
|
, proj_(nullptr)
|
||||||
, proj_ctx_(nullptr)
|
, proj_ctx_(nullptr)
|
||||||
{
|
{
|
||||||
boost::optional<bool> is_known = is_known_geographic(params_);
|
const auto is_known = is_known_geographic(params_);
|
||||||
if (is_known)
|
if (is_known.has_value())
|
||||||
{
|
{
|
||||||
is_geographic_ = *is_known;
|
is_geographic_ = *is_known;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ bool projection::is_geographic() const
|
||||||
return is_geographic_;
|
return is_geographic_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<well_known_srs_e> projection::well_known() const
|
std::optional<well_known_srs_e> projection::well_known() const
|
||||||
{
|
{
|
||||||
return is_well_known_srs(params_);
|
return is_well_known_srs(params_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ float get_nodata_color<std::uint8_t>()
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void raster_colorizer::colorize(image_rgba8& out,
|
void raster_colorizer::colorize(image_rgba8& out,
|
||||||
T const& in,
|
T const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const
|
feature_impl const& f) const
|
||||||
{
|
{
|
||||||
using image_type = T;
|
using image_type = T;
|
||||||
|
@ -313,43 +313,43 @@ unsigned raster_colorizer::get_color(float val) const
|
||||||
|
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray8 const& in,
|
image_gray8 const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray8s const& in,
|
image_gray8s const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray16 const& in,
|
image_gray16 const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray16s const& in,
|
image_gray16s const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray32 const& in,
|
image_gray32 const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray32s const& in,
|
image_gray32s const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray32f const& in,
|
image_gray32f const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray64 const& in,
|
image_gray64 const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray64s const& in,
|
image_gray64s const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_rgba8& out,
|
template void raster_colorizer::colorize(image_rgba8& out,
|
||||||
image_gray64f const& in,
|
image_gray64f const& in,
|
||||||
boost::optional<double> const& nodata,
|
std::optional<double> const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
|
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
|
@ -53,15 +53,15 @@ MAPNIK_DISABLE_WARNING_PUSH
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <boost/property_tree/xml_parser.hpp>
|
#include <boost/property_tree/xml_parser.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
MAPNIK_DISABLE_WARNING_POP
|
MAPNIK_DISABLE_WARNING_POP
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
using boost::optional;
|
using std::optional;
|
||||||
using boost::property_tree::ptree;
|
using boost::property_tree::ptree;
|
||||||
|
|
||||||
void serialize_text_placements(ptree& node, text_placements_ptr const& p, bool explicit_defaults)
|
void serialize_text_placements(ptree& node, text_placements_ptr const& p, bool explicit_defaults)
|
||||||
|
@ -405,7 +405,7 @@ void serialize_style(ptree& map_node, std::string const& name, feature_type_styl
|
||||||
set_attr(style_node, "image-filters-inflate", image_filters_inflate);
|
set_attr(style_node, "image-filters-inflate", image_filters_inflate);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<composite_mode_e> comp_op = style.comp_op();
|
auto&& comp_op = style.comp_op();
|
||||||
if (comp_op)
|
if (comp_op)
|
||||||
{
|
{
|
||||||
set_attr(style_node, "comp-op", *comp_op_to_string(*comp_op));
|
set_attr(style_node, "comp-op", *comp_op_to_string(*comp_op));
|
||||||
|
@ -547,7 +547,7 @@ void serialize_layer(ptree& map_node, layer const& lyr, bool explicit_defaults)
|
||||||
set_attr(layer_node, "group-by", lyr.group_by());
|
set_attr(layer_node, "group-by", lyr.group_by());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<int> const& buffer_size = lyr.buffer_size();
|
auto&& buffer_size = lyr.buffer_size();
|
||||||
if (buffer_size || explicit_defaults)
|
if (buffer_size || explicit_defaults)
|
||||||
{
|
{
|
||||||
set_attr(layer_node, "buffer-size", *buffer_size);
|
set_attr(layer_node, "buffer-size", *buffer_size);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue