Merge pull request #4445 from mapnik/feature/drop_boost_cpp17
replace majority of boost->std optional and boost->std string_view
This commit is contained in:
commit
d7a490ffc2
150 changed files with 1038 additions and 1427 deletions
|
@ -2,7 +2,7 @@
|
||||||
# See https://pre-commit.com/hooks.html for more hooks
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.3.0
|
rev: v4.6.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
files: ^.*\.cmake|CMakeLists\.txt$
|
files: ^.*\.cmake|CMakeLists\.txt$
|
||||||
|
@ -10,7 +10,7 @@ repos:
|
||||||
files: ^.*\.cmake|CMakeLists\.txt$
|
files: ^.*\.cmake|CMakeLists\.txt$
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||||
rev: v14.0.6
|
rev: v18.1.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: clang-format
|
- id: clang-format
|
||||||
types_or: [c++, c]
|
types_or: [c++, c]
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
// mapnik
|
// mapnik
|
||||||
|
|
||||||
#ifndef Q_MOC_RUN // QT moc chokes on BOOST_JOIN
|
#ifndef Q_MOC_RUN // QT moc chokes on BOOST_JOIN
|
||||||
//#include <mapnik/config_error.hpp>
|
// #include <mapnik/config_error.hpp>
|
||||||
#include <mapnik/load_map.hpp>
|
#include <mapnik/load_map.hpp>
|
||||||
#include <mapnik/save_map.hpp>
|
#include <mapnik/save_map.hpp>
|
||||||
#include <mapnik/projection.hpp>
|
#include <mapnik/projection.hpp>
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -96,10 +96,7 @@ class MAPNIK_DECL logger : public singleton<logger, CreateStatic>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// format
|
// format
|
||||||
static std::string const& get_format()
|
static std::string const& get_format() { return format_; }
|
||||||
{
|
|
||||||
return format_;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set_format(std::string const& format)
|
static void set_format(std::string const& format)
|
||||||
{
|
{
|
||||||
|
@ -211,10 +208,7 @@ class base_log : public util::noncopyable
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
inline bool check_severity()
|
inline bool check_severity() { return Severity >= logger::get_object_severity(object_name_); }
|
||||||
{
|
|
||||||
return Severity >= logger::get_object_severity(object_name_);
|
|
||||||
}
|
|
||||||
|
|
||||||
typename output_policy::stream_buffer streambuf_;
|
typename output_policy::stream_buffer streambuf_;
|
||||||
std::string object_name_;
|
std::string object_name_;
|
||||||
|
|
|
@ -35,11 +35,7 @@
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <map>
|
#include <map>
|
||||||
#if __cpp_lib_string_view >= 201606L
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <mapnik/warning.hpp>
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
|
@ -62,60 +58,9 @@ class illegal_enum_value : public std::exception
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
#if __cpp_lib_string_view >= 201606L
|
|
||||||
using mapnik_string_view = std::string_view;
|
|
||||||
#else
|
|
||||||
class mapnik_string_view // use std::string_view in C++17
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
template<std::size_t N>
|
|
||||||
constexpr mapnik_string_view(const char (&s)[N])
|
|
||||||
: size_(N)
|
|
||||||
, data_(s)
|
|
||||||
{}
|
|
||||||
|
|
||||||
constexpr mapnik_string_view(const char* s, std::size_t N)
|
|
||||||
: size_(N)
|
|
||||||
, data_(s)
|
|
||||||
{}
|
|
||||||
|
|
||||||
constexpr char operator[](std::size_t index) const
|
|
||||||
{
|
|
||||||
return (index >= size_) ? throw std::out_of_range("Invalid index.") : data_[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr char const* data() const { return data_; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::size_t size_;
|
|
||||||
const char* data_;
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr bool mapnik_string_view_equals(mapnik_string_view const& a, char const* b, std::size_t i)
|
|
||||||
{
|
|
||||||
if (a[i] != b[i])
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (a[i] == 0 || b[i] == 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mapnik_string_view_equals(a, b, i + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool operator==(mapnik_string_view const& a, char const* b)
|
|
||||||
{
|
|
||||||
return mapnik_string_view_equals(a, b, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class EnumT>
|
template<class EnumT>
|
||||||
using EnumStringT = std::tuple<EnumT, mapnik_string_view>;
|
using EnumStringT = std::tuple<EnumT, std::string_view>;
|
||||||
|
|
||||||
template<class EnumT, std::size_t N>
|
template<class EnumT, std::size_t N>
|
||||||
using EnumMapT = std::array<EnumStringT<EnumT>, N>;
|
using EnumMapT = std::array<EnumStringT<EnumT>, N>;
|
||||||
|
@ -189,12 +134,12 @@ struct MAPNIK_DECL enumeration
|
||||||
std::map<enum_class, std::string> fnc_name##_lookup() \
|
std::map<enum_class, std::string> fnc_name##_lookup() \
|
||||||
{ \
|
{ \
|
||||||
std::map<enum_class, std::string> val_map; \
|
std::map<enum_class, std::string> val_map; \
|
||||||
std::transform( \
|
std::transform(fnc_name##_map.begin(), \
|
||||||
fnc_name##_map.begin(), \
|
|
||||||
fnc_name##_map.end(), \
|
fnc_name##_map.end(), \
|
||||||
std::inserter(val_map, val_map.end()), \
|
std::inserter(val_map, val_map.end()), \
|
||||||
[](const mapnik::detail::EnumStringT<enum_class>& val) { \
|
[](const mapnik::detail::EnumStringT<enum_class>& val) { \
|
||||||
return std::pair<enum_class, std::string>{std::get<0>(val), std::string{std::get<1>(val).data()}}; \
|
return std::pair<enum_class, std::string>{std::get<0>(val), \
|
||||||
|
std::string{std::get<1>(val).data()}}; \
|
||||||
}); \
|
}); \
|
||||||
return val_map; \
|
return val_map; \
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <mapnik/value/types.hpp>
|
#include <mapnik/value/types.hpp>
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
//#include <boost/pool/pool_alloc.hpp>
|
// #include <boost/pool/pool_alloc.hpp>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
struct feature_factory
|
struct feature_factory
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -152,10 +152,7 @@ class hextree : private util::noncopyable
|
||||||
|
|
||||||
~hextree() {}
|
~hextree() {}
|
||||||
|
|
||||||
void setMaxColors(unsigned max_colors)
|
void setMaxColors(unsigned max_colors) { max_colors_ = max_colors; }
|
||||||
{
|
|
||||||
max_colors_ = max_colors;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setGamma(double g)
|
void setGamma(double g)
|
||||||
{
|
{
|
||||||
|
@ -166,15 +163,9 @@ class hextree : private util::noncopyable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTransMode(unsigned t)
|
void setTransMode(unsigned t) { trans_mode_ = t; }
|
||||||
{
|
|
||||||
trans_mode_ = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
transparency_mode_t getTransMode() const
|
transparency_mode_t getTransMode() const { return trans_mode_; }
|
||||||
{
|
|
||||||
return trans_mode_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// process alpha value based on trans_mode_
|
// process alpha value based on trans_mode_
|
||||||
std::uint8_t preprocessAlpha(std::uint8_t a) const
|
std::uint8_t preprocessAlpha(std::uint8_t a) const
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -561,15 +561,13 @@ struct offset_converter
|
||||||
if (bulge_steps == 0)
|
if (bulge_steps == 0)
|
||||||
{
|
{
|
||||||
// inside turn (sharp/obtuse angle)
|
// inside turn (sharp/obtuse angle)
|
||||||
MAPNIK_LOG_DEBUG(ctrans) << "offset_converter:"
|
MAPNIK_LOG_DEBUG(ctrans) << "offset_converter:" << " Sharp joint [<< inside turn "
|
||||||
<< " Sharp joint [<< inside turn "
|
|
||||||
<< static_cast<int>(util::degrees(joint_angle)) << " degrees >>]";
|
<< static_cast<int>(util::degrees(joint_angle)) << " degrees >>]";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// outside turn (reflex angle)
|
// outside turn (reflex angle)
|
||||||
MAPNIK_LOG_DEBUG(ctrans) << "offset_converter:"
|
MAPNIK_LOG_DEBUG(ctrans) << "offset_converter:" << " Bulge joint >)) outside turn "
|
||||||
<< " Bulge joint >)) outside turn "
|
|
||||||
<< static_cast<int>(util::degrees(joint_angle)) << " degrees ((< with "
|
<< static_cast<int>(util::degrees(joint_angle)) << " degrees ((< with "
|
||||||
<< bulge_steps << " segments";
|
<< bulge_steps << " segments";
|
||||||
}
|
}
|
||||||
|
@ -640,10 +638,7 @@ struct offset_converter
|
||||||
return cur_.cmd;
|
return cur_.cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void push_vertex(vertex2d const& v)
|
void push_vertex(vertex2d const& v) { vertices_.push_back(v); }
|
||||||
{
|
|
||||||
vertices_.push_back(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
Geometry& geom_;
|
Geometry& geom_;
|
||||||
double offset_;
|
double offset_;
|
||||||
|
|
|
@ -46,7 +46,7 @@ MAPNIK_DISABLE_WARNING_POP
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
#define U2RED(x) ((x)&0xff)
|
#define U2RED(x) ((x) & 0xff)
|
||||||
#define U2GREEN(x) (((x) >> 8) & 0xff)
|
#define U2GREEN(x) (((x) >> 8) & 0xff)
|
||||||
#define U2BLUE(x) (((x) >> 16) & 0xff)
|
#define U2BLUE(x) (((x) >> 16) & 0xff)
|
||||||
#define U2ALPHA(x) (((x) >> 24) & 0xff)
|
#define U2ALPHA(x) (((x) >> 24) & 0xff)
|
||||||
|
|
|
@ -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,103 @@ 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 source; }
|
||||||
{
|
|
||||||
return boost::optional<value_bool>(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 +170,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 +193,7 @@ struct value_extractor_visitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<T>& var_;
|
std::optional<T>& var_;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace params_detail {
|
namespace params_detail {
|
||||||
|
@ -209,11 +202,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 +219,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)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
#include <xmmintrin.h>
|
#include <xmmintrin.h>
|
||||||
|
|
||||||
#define ROUND_DOWN(x, s) ((x) & ~((s)-1))
|
#define ROUND_DOWN(x, s) ((x) & ~((s) - 1))
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
__m128i v;
|
__m128i v;
|
||||||
|
|
|
@ -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_{};
|
||||||
|
|
|
@ -613,15 +613,9 @@ class renderer_agg : util::noncopyable
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline VertexSource& source() const
|
inline VertexSource& source() const { return source_; }
|
||||||
{
|
|
||||||
return source_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline group const& svg_group() const
|
inline group const& svg_group() const { return svg_group_; }
|
||||||
{
|
|
||||||
return svg_group_;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -384,14 +384,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
|
||||||
|
@ -419,7 +419,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));
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,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;
|
||||||
|
@ -440,14 +440,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
|
||||||
{
|
{
|
||||||
|
@ -471,25 +471,24 @@ 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(result_value.to_string());
|
||||||
detail::enum_traits<value_type>::from_string(std::get<0>(result).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;
|
||||||
|
|
|
@ -60,25 +60,13 @@ class file : public util::noncopyable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_open() const
|
inline bool is_open() const { return file_ ? true : false; }
|
||||||
{
|
|
||||||
return file_ ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit operator bool() const
|
explicit operator bool() const { return this->is_open(); }
|
||||||
{
|
|
||||||
return this->is_open();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::FILE* get() const
|
inline std::FILE* get() const { return file_.get(); }
|
||||||
{
|
|
||||||
return file_.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::size_t size() const
|
inline std::size_t size() const { return size_; }
|
||||||
{
|
|
||||||
return size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline data_type data() const
|
inline data_type data() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -77,10 +77,7 @@ class singleton
|
||||||
singleton(const singleton& rhs);
|
singleton(const singleton& rhs);
|
||||||
singleton& operator=(const singleton&);
|
singleton& operator=(const singleton&);
|
||||||
|
|
||||||
static void onDeadReference()
|
static void onDeadReference() { throw std::runtime_error("dead reference!"); }
|
||||||
{
|
|
||||||
throw std::runtime_error("dead reference!");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DestroySingleton()
|
static void DestroySingleton()
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,6 @@
|
||||||
|
|
||||||
#define MAPNIK_VERSION_AT_LEAST(major, minor, patch) (MAPNIK_VERSION >= MAPNIK_VERSION_ENCODE(major, minor, patch))
|
#define MAPNIK_VERSION_AT_LEAST(major, minor, patch) (MAPNIK_VERSION >= MAPNIK_VERSION_ENCODE(major, minor, patch))
|
||||||
|
|
||||||
#define MAPNIK_VERSION_ENCODE(major, minor, patch) ((major)*100000 + (minor)*100 + (patch))
|
#define MAPNIK_VERSION_ENCODE(major, minor, patch) ((major) * 100000 + (minor) * 100 + (patch))
|
||||||
|
|
||||||
#endif // MAPNIK_VERSION_HPP
|
#endif // MAPNIK_VERSION_HPP
|
||||||
|
|
|
@ -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,11 +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 +90,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)
|
||||||
|
@ -404,8 +404,8 @@ 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,
|
||||||
read_multi_linestring(T& reader, boost::optional<std::vector<std::uint32_t>> const& lengths)
|
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_);
|
||||||
|
|
|
@ -139,20 +139,11 @@ class ogr_layer_ptr
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& layer_name() const
|
std::string const& layer_name() const { return layer_name_; }
|
||||||
{
|
|
||||||
return layer_name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
OGRLayer* layer() const
|
OGRLayer* layer() const { return layer_; }
|
||||||
{
|
|
||||||
return layer_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_valid() const
|
bool is_valid() const { return is_valid_; }
|
||||||
{
|
|
||||||
return is_valid_;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -160,10 +160,10 @@ typedef enum {
|
||||||
#define BANDTYPE_FLAG_RESERVED3 (1 << 4)
|
#define BANDTYPE_FLAG_RESERVED3 (1 << 4)
|
||||||
|
|
||||||
#define BANDTYPE_PIXTYPE_MASK 0x0F
|
#define BANDTYPE_PIXTYPE_MASK 0x0F
|
||||||
#define BANDTYPE_PIXTYPE(x) ((x)&BANDTYPE_PIXTYPE_MASK)
|
#define BANDTYPE_PIXTYPE(x) ((x) & BANDTYPE_PIXTYPE_MASK)
|
||||||
#define BANDTYPE_IS_OFFDB(x) ((x)&BANDTYPE_FLAG_OFFDB)
|
#define BANDTYPE_IS_OFFDB(x) ((x) & BANDTYPE_FLAG_OFFDB)
|
||||||
#define BANDTYPE_HAS_NODATA(x) ((x)&BANDTYPE_FLAG_HASNODATA)
|
#define BANDTYPE_HAS_NODATA(x) ((x) & BANDTYPE_FLAG_HASNODATA)
|
||||||
#define BANDTYPE_IS_NODATA(x) ((x)&BANDTYPE_FLAG_ISNODATA)
|
#define BANDTYPE_IS_NODATA(x) ((x) & BANDTYPE_FLAG_ISNODATA)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -236,20 +236,11 @@ class Connection
|
||||||
return std::make_shared<ResultSet>(result);
|
return std::make_shared<ResultSet>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string client_encoding() const
|
std::string client_encoding() const { return PQparameterStatus(conn_, "client_encoding"); }
|
||||||
{
|
|
||||||
return PQparameterStatus(conn_, "client_encoding");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isOK() const
|
bool isOK() const { return (!closed_) && (PQstatus(conn_) != CONNECTION_BAD); }
|
||||||
{
|
|
||||||
return (!closed_) && (PQstatus(conn_) != CONNECTION_BAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isPending() const
|
bool isPending() const { return pending_; }
|
||||||
{
|
|
||||||
return pending_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void close()
|
void close()
|
||||||
{
|
{
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -171,30 +171,15 @@ class shape_file : public mapnik::util::mapped_memory_file
|
||||||
file_.read(reinterpret_cast<char*>(&envelope), sizeof(envelope));
|
file_.read(reinterpret_cast<char*>(&envelope), sizeof(envelope));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void rewind()
|
inline void rewind() { seek(100); }
|
||||||
{
|
|
||||||
seek(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void seek(std::streampos pos)
|
inline void seek(std::streampos pos) { file_.seekg(pos, std::ios::beg); }
|
||||||
{
|
|
||||||
file_.seekg(pos, std::ios::beg);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::streampos pos()
|
inline std::streampos pos() { return file_.tellg(); }
|
||||||
{
|
|
||||||
return file_.tellg();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool is_eof()
|
inline bool is_eof() { return file_.eof(); }
|
||||||
{
|
|
||||||
return file_.eof();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool is_good()
|
inline bool is_good() { return file_.good(); }
|
||||||
{
|
|
||||||
return file_.good();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHAPEFILE_HPP
|
#endif // SHAPEFILE_HPP
|
||||||
|
|
|
@ -115,8 +115,7 @@ class sqlite_connection
|
||||||
s << "'" << sqlite3_errmsg(db_) << "'";
|
s << "'" << sqlite3_errmsg(db_) << "'";
|
||||||
else
|
else
|
||||||
s << "unknown error, lost connection";
|
s << "unknown error, lost connection";
|
||||||
s << " (" << file_ << ")"
|
s << " (" << file_ << ")" << "\nFull sql was: '" << sql << "'";
|
||||||
<< "\nFull sql was: '" << sql << "'";
|
|
||||||
|
|
||||||
throw mapnik::datasource_exception(s.str());
|
throw mapnik::datasource_exception(s.str());
|
||||||
}
|
}
|
||||||
|
@ -160,10 +159,7 @@ class sqlite_connection
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3* operator*()
|
sqlite3* operator*() { return db_; }
|
||||||
{
|
|
||||||
return db_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool load_extension(std::string const& ext_path)
|
bool load_extension(std::string const& ext_path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -260,9 +260,8 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
||||||
if (geometry_field_.empty())
|
if (geometry_field_.empty())
|
||||||
{
|
{
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "Sqlite Plugin: unable to detect the column "
|
s << "Sqlite Plugin: unable to detect the column " << "containing a valid geometry on table '"
|
||||||
<< "containing a valid geometry on table '" << geometry_table_ << "'. "
|
<< geometry_table_ << "'. " << "Please provide a column name by passing the 'geometry_field' option "
|
||||||
<< "Please provide a column name by passing the 'geometry_field' option "
|
|
||||||
<< "or indicate a different spatial table to use by passing the 'geometry_table' option";
|
<< "or indicate a different spatial table to use by passing the 'geometry_table' option";
|
||||||
throw datasource_exception(s.str());
|
throw datasource_exception(s.str());
|
||||||
}
|
}
|
||||||
|
@ -316,12 +315,9 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "Sqlite Plugin: could not generate spatial index"
|
s << "Sqlite Plugin: could not generate spatial index" << " for table '" << geometry_table_ << "'"
|
||||||
<< " for table '" << geometry_table_ << "'"
|
<< " as no primary key can be detected." << " You should either declare an INTEGER PRIMARY KEY"
|
||||||
<< " as no primary key can be detected."
|
<< " or set the 'key_field' option to force a" << " given field to be used as the primary key";
|
||||||
<< " You should either declare an INTEGER PRIMARY KEY"
|
|
||||||
<< " or set the 'key_field' option to force a"
|
|
||||||
<< " given field to be used as the primary key";
|
|
||||||
throw datasource_exception(s.str());
|
throw datasource_exception(s.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -426,13 +422,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 +466,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
|
||||||
|
|
|
@ -144,6 +144,7 @@ class sqlite_utils
|
||||||
static void get_tables(std::shared_ptr<sqlite_connection> ds, std::vector<std::string>& tables)
|
static void get_tables(std::shared_ptr<sqlite_connection> ds, std::vector<std::string>& tables)
|
||||||
{
|
{
|
||||||
std::ostringstream sql;
|
std::ostringstream sql;
|
||||||
|
// clang-format off
|
||||||
// todo handle finding tables from attached db's
|
// todo handle finding tables from attached db's
|
||||||
sql << " SELECT name FROM sqlite_master"
|
sql << " SELECT name FROM sqlite_master"
|
||||||
<< " WHERE type IN ('table','view')"
|
<< " WHERE type IN ('table','view')"
|
||||||
|
@ -155,6 +156,7 @@ class sqlite_utils
|
||||||
<< " SELECT name FROM sqlite_temp_master"
|
<< " SELECT name FROM sqlite_temp_master"
|
||||||
<< " WHERE type IN ('table','view')"
|
<< " WHERE type IN ('table','view')"
|
||||||
<< " ORDER BY 1";
|
<< " ORDER BY 1";
|
||||||
|
// clang-format on
|
||||||
sqlite3_stmt* stmt = 0;
|
sqlite3_stmt* stmt = 0;
|
||||||
const int rc = sqlite3_prepare_v2(*(*ds), sql.str().c_str(), -1, &stmt, 0);
|
const int rc = sqlite3_prepare_v2(*(*ds), sql.str().c_str(), -1, &stmt, 0);
|
||||||
if (rc == SQLITE_OK)
|
if (rc == SQLITE_OK)
|
||||||
|
@ -352,8 +354,7 @@ class sqlite_utils
|
||||||
{
|
{
|
||||||
std::ostringstream error_msg;
|
std::ostringstream error_msg;
|
||||||
error_msg << "Sqlite Plugin: invalid type for key field '" << rs->column_name(1)
|
error_msg << "Sqlite Plugin: invalid type for key field '" << rs->column_name(1)
|
||||||
<< "' when creating index "
|
<< "' when creating index " << "type was: " << type_oid << "";
|
||||||
<< "type was: " << type_oid << "";
|
|
||||||
throw mapnik::datasource_exception(error_msg.str());
|
throw mapnik::datasource_exception(error_msg.str());
|
||||||
}
|
}
|
||||||
const sqlite_int64 pkid = rs->column_integer64(1);
|
const sqlite_int64 pkid = rs->column_integer64(1);
|
||||||
|
|
|
@ -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())
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,8 +61,7 @@ std::atomic<logger::severity_type> logger::severity_level_
|
||||||
bool logger::severity_env_check_{true};
|
bool logger::severity_env_check_{true};
|
||||||
bool logger::format_env_check_{true};
|
bool logger::format_env_check_{true};
|
||||||
|
|
||||||
logger::severity_type logger::severity_level_
|
logger::severity_type logger::severity_level_{
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
#if MAPNIK_DEFAULT_LOG_SEVERITY == 0
|
#if MAPNIK_DEFAULT_LOG_SEVERITY == 0
|
||||||
logger::debug
|
logger::debug
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue