Merge commit 'a01a998aff27036ceee231ecc71156dcacc3e298' into harfbuzz

Conflicts:
	include/mapnik/agg_renderer.hpp
	include/mapnik/text/text_properties.hpp
This commit is contained in:
Hermann Kraus 2013-03-16 15:14:24 +01:00
commit 20272a7396
68 changed files with 529 additions and 348 deletions

View file

@ -24,34 +24,34 @@
#define MAPNIK_AGG_RENDERER_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/config.hpp> // for MAPNIK_DECL
#include <mapnik/feature_style_processor.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/map.hpp>
#include <mapnik/font_engine_freetype.hpp> // for face_manager, etc
#include <mapnik/noncopyable.hpp> // for noncopyable
#include <mapnik/rule.hpp> // for rule, symbolizers
#include <mapnik/box2d.hpp> // for box2d
#include <mapnik/pixel_position.hpp>
#include <mapnik/rule.hpp> // for all symbolizers
#include <mapnik/noncopyable.hpp>
#include <mapnik/color.hpp> // for color
#include <mapnik/ctrans.hpp> // for CoordTransform
#include <mapnik/image_compositing.hpp> // for composite_mode_e
// boost
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
// FIXME
// forward declare so that
// apps using mapnik do not
// need agg headers
namespace agg {
struct trans_affine;
}
namespace agg { struct trans_affine; }
namespace mapnik { class Map; }
namespace mapnik { class feature_impl; }
namespace mapnik { class feature_type_style; }
namespace mapnik { class label_collision_detector4; }
namespace mapnik { class layer; }
namespace mapnik { class marker; }
namespace mapnik { class proj_transform; }
namespace mapnik { struct rasterizer; }
struct pixel_position;
namespace mapnik {
class marker;
struct rasterizer;
template <typename T>
class MAPNIK_DECL agg_renderer : public feature_style_processor<agg_renderer<T> >,
private mapnik::noncopyable

View file

@ -24,7 +24,8 @@
#define MAPNIK_FILTER_FEATURESET_HPP
// mapnik
#include <mapnik/datasource.hpp>
#include <mapnik/datasource.hpp> // for featureset_ptr
#include <mapnik/feature.hpp>
namespace mapnik {

View file

@ -27,30 +27,32 @@
#include <mapnik/config.hpp>
#include <mapnik/feature_style_processor.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/map.hpp>
#include <mapnik/rule.hpp> // for all symbolizers
#include <mapnik/grid/grid.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/rule.hpp> // for rule, symbolizers
#include <mapnik/box2d.hpp> // for box2d
#include <mapnik/color.hpp> // for color
#include <mapnik/ctrans.hpp> // for CoordTransform
#include <mapnik/image_compositing.hpp> // for composite_mode_e
// boost
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
// FIXME
// forward declare so that
// apps using mapnik do not
// need agg headers
namespace agg {
struct trans_affine;
}
namespace agg { struct trans_affine; }
namespace mapnik { class Map; }
namespace mapnik { class feature_impl; }
namespace mapnik { class feature_type_style; }
namespace mapnik { class label_collision_detector4; }
namespace mapnik { class layer; }
namespace mapnik { class marker; }
namespace mapnik { class proj_transform; }
namespace mapnik { struct grid_rasterizer; }
struct pixel_position;
namespace mapnik {
class marker;
struct grid_rasterizer;
template <typename T>
class MAPNIK_DECL grid_renderer : public feature_style_processor<grid_renderer<T> >,
private mapnik::noncopyable

View file

@ -24,9 +24,10 @@
#define MAPNIK_MAP_HPP
// mapnik
#include <mapnik/color.hpp>
#include <mapnik/font_set.hpp>
#include <mapnik/enumeration.hpp>
#include <mapnik/feature_type_style.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/datasource.hpp> // for featureset_ptr
#include <mapnik/layer.hpp>
#include <mapnik/params.hpp>
#include <mapnik/ctrans.hpp>
@ -37,6 +38,7 @@
namespace mapnik
{
class feature_type_style;
class CoordTransform;
class MAPNIK_DECL Map

View file

@ -24,10 +24,8 @@
#define MAPNIK_PARAMS_HPP
// boost
#include <boost/variant.hpp>
#include <boost/variant/variant.hpp>
#include <boost/optional.hpp>
#include <boost/none.hpp>
#include <boost/lexical_cast.hpp>
// mapnik
#include <mapnik/value.hpp>
@ -42,67 +40,16 @@ typedef boost::variant<value_null,value_integer,value_double,std::string> value_
typedef std::pair<std::string, value_holder> parameter;
typedef std::map<std::string, value_holder> param_map;
template <typename T>
struct value_extractor_visitor : public boost::static_visitor<>
{
value_extractor_visitor(boost::optional<T> & var)
:var_(var) {}
void operator () (T val) const
{
var_ = val;
}
template <typename T1>
void operator () (T1 val) const
{
try
{
var_ = boost::lexical_cast<T>(val);
}
catch (boost::bad_lexical_cast & ) {}
}
boost::optional<T> & var_;
};
class parameters : public param_map
{
template <typename T>
struct converter
{
typedef boost::optional<T> return_type;
static return_type extract(parameters const& params,
std::string const& name,
boost::optional<T> const& default_opt_value)
{
boost::optional<T> result(default_opt_value);
parameters::const_iterator itr = params.find(name);
if (itr != params.end())
{
boost::apply_visitor(value_extractor_visitor<T>(result),itr->second);
}
return result;
}
};
public:
parameters() {}
parameters();
template <typename T>
boost::optional<T> get(std::string const& key) const
{
return converter<T>::extract(*this,key, boost::none);
}
boost::optional<T> get(std::string const& key) const;
template <typename T>
boost::optional<T> get(std::string const& key, T const& default_opt_value) const
{
return converter<T>::extract(*this,key,boost::optional<T>(default_opt_value));
}
boost::optional<T> get(std::string const& key, T const& default_opt_value) const;
};
}
#endif // MAPNIK_PARAMS_HPP

View file

@ -41,9 +41,6 @@
#include <mapnik/config.hpp> // MAPNIK_DECL
// boost
#include <boost/concept_check.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/variant.hpp>
// stl

View file

@ -23,37 +23,36 @@
#ifndef MAPNIK_SQL_UTILS_HPP
#define MAPNIK_SQL_UTILS_HPP
// mapnik
#include <mapnik/util/trim.hpp> // for trim
// boost
#include <boost/algorithm/string.hpp>
#include <boost/scoped_array.hpp>
#include "boost/algorithm/string/replace.hpp" // for ireplace_all, etc
// stl
#include <sstream>
#include <vector>
#include <string>
namespace mapnik { namespace sql_utils {
inline std::string unquote_double(std::string const& sql)
{
std::string table_name = sql;
boost::algorithm::trim_if(table_name,boost::algorithm::is_any_of("\""));
util::unquote_double(table_name);
return table_name;
}
inline std::string unquote(std::string const& sql)
{
std::string table_name = sql;
boost::algorithm::trim_if(table_name,boost::algorithm::is_any_of("\"\'"));
util::unquote(table_name);
return table_name;
}
inline void quote_attr(std::ostringstream& s, std::string const& field)
inline void quote_attr(std::ostringstream & s, std::string const& field)
{
if (boost::algorithm::icontains(field,".")) {
std::vector<std::string> parts;
boost::split(parts, field, boost::is_any_of("."));
s << ",\"" << parts[0] << "\".\"" << parts[1] << "\"";
}
else
{
s << ",\"" + field + "\"";
}
s << ",\"" << field << "\"";
}
inline std::string table_from_sql(std::string const& sql)
@ -78,120 +77,6 @@ namespace mapnik { namespace sql_utils {
}
return table_name;
}
inline std::string numeric2string(const char* buf)
{
int16_t ndigits = int2net(buf);
int16_t weight = int2net(buf+2);
int16_t sign = int2net(buf+4);
int16_t dscale = int2net(buf+6);
boost::scoped_array<int16_t> digits(new int16_t[ndigits]);
for (int n=0; n < ndigits ;++n)
{
digits[n] = int2net(buf+8+n*2);
}
std::ostringstream ss;
if (sign == 0x4000) ss << "-";
int i = std::max(weight,int16_t(0));
int d = 0;
// Each numeric "digit" is actually a value between 0000 and 9999 stored in a 16 bit field.
// For example, the number 1234567809990001 is stored as four digits: [1234] [5678] [999] [1].
// Note that the last two digits show that the leading 0's are lost when the number is split.
// We must be careful to re-insert these 0's when building the string.
while ( i >= 0)
{
if (i <= weight && d < ndigits)
{
// All digits after the first must be padded to make the field 4 characters long
if (d != 0)
{
#ifdef _WINDOWS
int dig = digits[d];
if (dig < 10)
{
ss << "000"; // 0000 - 0009
}
else if (dig < 100)
{
ss << "00"; // 0010 - 0099
}
else
{
ss << "0"; // 0100 - 0999;
}
#else
switch(digits[d])
{
case 0 ... 9:
ss << "000"; // 0000 - 0009
break;
case 10 ... 99:
ss << "00"; // 0010 - 0099
break;
case 100 ... 999:
ss << "0"; // 0100 - 0999
break;
}
#endif
}
ss << digits[d++];
}
else
{
if (d == 0)
ss << "0";
else
ss << "0000";
}
i--;
}
if (dscale > 0)
{
ss << '.';
// dscale counts the number of decimal digits following the point, not the numeric digits
while (dscale > 0)
{
int value;
if (i <= weight && d < ndigits)
value = digits[d++];
else
value = 0;
// Output up to 4 decimal digits for this value
if (dscale > 0) {
ss << (value / 1000);
value %= 1000;
dscale--;
}
if (dscale > 0) {
ss << (value / 100);
value %= 100;
dscale--;
}
if (dscale > 0) {
ss << (value / 10);
value %= 10;
dscale--;
}
if (dscale > 0) {
ss << value;
dscale--;
}
i--;
}
}
return ss.str();
}
}
}
}}
#endif // MAPNIK_SQL_UTILS_HPP

View file

@ -24,15 +24,37 @@
#define MAPNIK_SVG_RENDERER_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/feature_style_processor.hpp>
#include <mapnik/map.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/svg/output/svg_generator.hpp>
#include <mapnik/svg/output/svg_output_attributes.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/rule.hpp> // for rule, symbolizers
#include <mapnik/box2d.hpp> // for box2d
#include <mapnik/color.hpp> // for color
#include <mapnik/ctrans.hpp> // for CoordTransform
#include <mapnik/image_compositing.hpp> // for composite_mode_e
// boost
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
// stl
#include <string>
namespace agg { struct trans_affine; }
namespace mapnik { class Map; }
namespace mapnik { class feature_impl; }
namespace mapnik { class feature_type_style; }
namespace mapnik { class label_collision_detector4; }
namespace mapnik { class layer; }
namespace mapnik { class marker; }
namespace mapnik { class proj_transform; }
namespace mapnik { struct grid_rasterizer; }
struct pixel_position;
namespace mapnik
{
// parameterized with the type of output iterator it will use for output.

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/text/char_properties_ptr.hpp>
#include <mapnik/color.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/font_set.hpp>
#include <mapnik/enumeration.hpp>
#include <mapnik/expression.hpp>
@ -143,7 +144,7 @@ struct text_symbolizer_properties
/** Takes a feature and produces formated text as output.
* The output object has to be created by the caller and passed in for thread safety.
*/
void process(text_layout &output, Feature const& feature) const;
void process(text_layout &output, feature_impl const& feature) const;
/** Automatically create processing instructions for a single expression. */
void set_old_style_expression(expression_ptr expr);
/** Sets new format tree. */

View file

@ -25,7 +25,9 @@
// mapnik
#include <mapnik/config.hpp>
#ifdef MAPNIK_LOG
#include <mapnik/debug.hpp>
#endif
#include <mapnik/feature.hpp>
#include <mapnik/value.hpp>
#include <mapnik/transform_expression.hpp>
@ -225,7 +227,7 @@ struct transform_processor
}
};
typedef mapnik::transform_processor<Feature> transform_processor_type;
typedef mapnik::transform_processor<feature_impl> transform_processor_type;
} // namespace mapnik

View file

@ -24,13 +24,11 @@
#define CONTAINER_ADAPTER_HPP
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/util/path_iterator.hpp>
// boost
#include <boost/tuple/tuple.hpp>
#include <boost/spirit/include/karma.hpp>
#include <boost/spirit/home/support/container.hpp>
namespace boost { namespace spirit { namespace traits {

View file

@ -68,6 +68,29 @@ static inline std::string trim_copy(std::string s)
return ltrim(rtrim(s));
}
static inline bool not_double_quote(int ch)
{
if (ch == '"') return false;
return true;
}
static inline void unquote_double(std::string & s)
{
s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_double_quote));
s.erase(std::find_if(s.rbegin(), s.rend(), not_double_quote).base(), s.end());
}
static inline bool not_quoted(int ch)
{
if (ch == '"' || ch == '\'') return false;
return true;
}
static inline void unquote(std::string & s)
{
s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_quoted));
s.erase(std::find_if(s.rbegin(), s.rend(), not_quoted).base(), s.end());
}
}} // end of namespace mapnik

View file

@ -24,6 +24,7 @@
#define MAPNIK_VALUE_HPP
// mapnik
#include <mapnik/value_types.hpp>
#include <mapnik/global.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/util/conversions.hpp>
@ -69,54 +70,6 @@ inline void to_utf8(UnicodeString const& input, std::string & target)
}
}
struct value_null
{
template <typename T>
value_null operator+ (T const& other) const
{
boost::ignore_unused_variable_warning(other);
return *this;
}
template <typename T>
value_null operator- (T const& other) const
{
boost::ignore_unused_variable_warning(other);
return *this;
}
template <typename T>
value_null operator* (T const& other) const
{
boost::ignore_unused_variable_warning(other);
return *this;
}
template <typename T>
value_null operator/ (T const& other) const
{
boost::ignore_unused_variable_warning(other);
return *this;
}
template <typename T>
value_null operator% (T const& other) const
{
boost::ignore_unused_variable_warning(other);
return *this;
}
};
#ifdef BIGINT
typedef long long value_integer;
#else
typedef int value_integer;
#endif
typedef double value_double;
typedef UnicodeString value_unicode_string;
typedef bool value_bool;
typedef boost::variant<value_null,value_bool,value_integer,value_double,value_unicode_string> value_base;
namespace impl {
@ -798,11 +751,7 @@ struct to_int : public boost::static_visitor<value_integer>
value_integer operator() (std::string const& val) const
{
value_integer result;
#ifdef BIGINT
if (util::string2longlong(val,result))
#else
if (util::string2int(val,result))
#endif
return result;
return value_integer(0);
}
@ -912,7 +861,6 @@ public:
{
return boost::apply_visitor(impl::to_int(),base_);
}
};
inline const value operator+(value const& p1,value const& p2)

View file

@ -0,0 +1,88 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2012 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef MAPNIK_VALUE_TYPES_HPP
#define MAPNIK_VALUE_TYPES_HPP
// icu
#include <unicode/unistr.h> // for UnicodeString
// boost
//#include <boost/cstdint.hpp>
// stl
#include <iosfwd> // for ostream
namespace mapnik {
#ifdef BIGINT
//typedef boost::long_long_type value_integer;
typedef long long value_integer;
#else
typedef int value_integer;
#endif
typedef double value_double;
typedef UnicodeString value_unicode_string;
typedef bool value_bool;
struct value_null
{
template <typename T>
value_null operator+ (T const& /*other*/) const
{
return *this;
}
template <typename T>
value_null operator- (T const& /*other*/) const
{
return *this;
}
template <typename T>
value_null operator* (T const& /*other*/) const
{
return *this;
}
template <typename T>
value_null operator/ (T const& /*other*/) const
{
return *this;
}
template <typename T>
value_null operator% (T const& /*other*/) const
{
return *this;
}
};
inline std::ostream& operator<< (std::ostream & out,value_null const& v)
{
return out;
}
} // namespace mapnik
#endif // MAPNIK_VALUE_TYPES_HPP

View file

@ -31,6 +31,7 @@
#include <mapnik/image_filter_grammar.hpp>
#include <mapnik/image_filter.hpp>
#include <mapnik/css_color_grammar.hpp>
#include <mapnik/unicode.hpp>
// boost
#include <boost/format.hpp>

View file

@ -41,6 +41,7 @@
#include <mapnik/util/conversions.hpp>
#include <mapnik/boolean.hpp>
#include <mapnik/util/trim.hpp>
#include <mapnik/value.hpp>
// stl
#include <sstream>
@ -62,7 +63,7 @@ csv_datasource::csv_datasource(parameters const& params)
filename_(),
inline_string_(),
file_length_(0),
row_limit_(*params.get<int>("row_limit", 0)),
row_limit_(*params.get<mapnik::value_integer>("row_limit", 0)),
features_(),
escape_(*params.get<std::string>("escape", "")),
separator_(*params.get<std::string>("separator", "")),
@ -70,7 +71,7 @@ csv_datasource::csv_datasource(parameters const& params)
headers_(),
manual_headers_(mapnik::util::trim_copy(*params.get<std::string>("headers", ""))),
strict_(*params.get<mapnik::boolean>("strict", false)),
filesize_max_(*params.get<float>("filesize_max", 20.0)), // MB
filesize_max_(*params.get<double>("filesize_max", 20.0)), // MB
ctx_(boost::make_shared<mapnik::context_type>())
{
/* TODO:
@ -701,7 +702,7 @@ void csv_datasource::parse_csv(T & stream,
else
{
mapnik::value_integer int_val = 0;
if (mapnik::util::string2longlong(value,int_val))
if (mapnik::util::string2int(value,int_val))
{
matched = true;
feature->put(fld_name,int_val);

View file

@ -31,6 +31,7 @@
#include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/optional.hpp>
@ -64,7 +65,7 @@ private:
std::string filename_;
std::string inline_string_;
unsigned file_length_;
int row_limit_;
mapnik::value_integer row_limit_;
std::vector<mapnik::feature_ptr> features_;
std::string escape_;
std::string separator_;

View file

@ -28,6 +28,7 @@
#include <mapnik/boolean.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/timer.hpp>
#include <mapnik/value.hpp>
#include <gdal_version.h>

View file

@ -23,11 +23,15 @@
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/image_data.hpp>
#include <mapnik/raster.hpp>
#include <mapnik/ctrans.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp>
// boost
#include <boost/format.hpp>
#include <boost/make_shared.hpp>
#include "gdal_featureset.hpp"
#include <gdal_priv.h>
@ -35,7 +39,6 @@
using mapnik::query;
using mapnik::coord2d;
using mapnik::box2d;
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::CoordTransform;
using mapnik::geometry_type;

View file

@ -25,7 +25,6 @@
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/datasource.hpp>
// boost
#include <boost/variant.hpp>

View file

@ -36,7 +36,11 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
// mapnik
#include <mapnik/unicode.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/feature_kv_iterator.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/proj_transform.hpp>

View file

@ -31,6 +31,7 @@
#include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp>
#include <mapnik/unicode.hpp>
// boost
#include <boost/optional.hpp>

View file

@ -1,7 +1,7 @@
#ifndef GEOJSON_FEATURESET_HPP
#define GEOJSON_FEATURESET_HPP
#include <mapnik/datasource.hpp>
#include <mapnik/feature.hpp>
#include "geojson_datasource.hpp"
#include <vector>

View file

@ -34,6 +34,7 @@
#include <mapnik/boolean.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/timer.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/algorithm/string.hpp>

View file

@ -23,7 +23,6 @@
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/feature.hpp>
@ -34,9 +33,11 @@
#include "geos_featureset.hpp"
// boost
#include <boost/make_shared.hpp>
using mapnik::query;
using mapnik::box2d;
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::geometry_utils;
using mapnik::transcoder;

View file

@ -24,6 +24,7 @@
#define GEOS_FEATURESET_HPP
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/geom_util.hpp>

View file

@ -85,10 +85,10 @@ kismet_datasource::kismet_datasource(parameters const& params)
throw datasource_exception("Kismet Plugin: missing <host> parameter");
}
boost::optional<unsigned int> port = params.get<unsigned int>("port", 2501);
boost::optional<int> port = params.get<int>("port", 2501);
if (port)
{
port_ = *port;
port_ = static_cast<unsigned>(*port);
}
boost::optional<std::string> srs = params.get<std::string>("srs");

View file

@ -22,7 +22,6 @@
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/feature.hpp>
@ -33,7 +32,9 @@
#include "kismet_featureset.hpp"
using mapnik::Feature;
// boost
#include <boost/make_shared.hpp>
using mapnik::feature_ptr;
using mapnik::geometry_type;
using mapnik::geometry_utils;

View file

@ -24,6 +24,7 @@
#define KISMET_FEATURESET_HPP
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/wkb.hpp>

View file

@ -24,7 +24,6 @@
#define KISMET_TYPES_HPP
// mapnik
#include <mapnik/datasource.hpp>
#include <mapnik/params.hpp>
// boost

View file

@ -28,6 +28,7 @@
#include <mapnik/boolean.hpp>
#include <mapnik/sql_utils.hpp>
#include <mapnik/timer.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/algorithm/string.hpp>
@ -77,7 +78,7 @@ occi_datasource::occi_datasource(parameters const& params)
extent_initialized_(false),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding", "utf-8")),
use_wkb_(*params.get<mapnik::boolean>("use_wkb", false)),
row_limit_(*params.get<int>("row_limit", 0)),
row_limit_(*params.get<mapnik::value_integer>("row_limit", 0)),
row_prefetch_(*params.get<int>("row_prefetch", 100)),
pool_(0),
conn_(0)

View file

@ -31,6 +31,7 @@
#include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/optional.hpp>
@ -70,7 +71,7 @@ private:
mutable mapnik::box2d<double> extent_;
mapnik::layer_descriptor desc_;
bool use_wkb_;
int row_limit_;
mapnik::value_integer row_limit_;
int row_prefetch_;
oracle::occi::StatelessConnectionPool* pool_;
oracle::occi::Connection* conn_;

View file

@ -23,7 +23,6 @@
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/feature.hpp>
@ -37,7 +36,6 @@
using mapnik::query;
using mapnik::box2d;
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::geometry_type;
using mapnik::geometry_utils;

View file

@ -24,6 +24,7 @@
#define OCCI_FEATURESET_HPP
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/unicode.hpp>

View file

@ -139,7 +139,7 @@ void ogr_datasource::init(mapnik::parameters const& params)
// initialize layer
boost::optional<std::string> layer_by_name = params.get<std::string>("layer");
boost::optional<unsigned> layer_by_index = params.get<unsigned>("layer_by_index");
boost::optional<int> layer_by_index = params.get<int>("layer_by_index");
boost::optional<std::string> layer_by_sql = params.get<std::string>("layer_by_sql");
int passed_parameters = 0;

View file

@ -22,8 +22,8 @@
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/value.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/feature.hpp>
@ -38,7 +38,6 @@
using mapnik::query;
using mapnik::box2d;
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::geometry_utils;
using mapnik::transcoder;

View file

@ -24,6 +24,7 @@
#define OGR_FEATURESET_HPP
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/geom_util.hpp>

View file

@ -21,9 +21,9 @@
*****************************************************************************/
// mapnik
#include <mapnik/value.hpp>
#include <mapnik/global.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/feature.hpp>
@ -43,7 +43,6 @@
using mapnik::query;
using mapnik::box2d;
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::geometry_utils;
using mapnik::transcoder;

View file

@ -26,6 +26,7 @@
#include <set>
#include <vector>
#include <boost/scoped_ptr.hpp>
#include <mapnik/feature.hpp>
#include "ogr_featureset.hpp"
template <typename filterT>

View file

@ -23,12 +23,16 @@
// mapnik
#include <mapnik/geometry.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/unicode.hpp>
// boost
#include <boost/make_shared.hpp>
#include "osm_featureset.hpp"
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::geometry_type;
using mapnik::feature_factory;

View file

@ -31,6 +31,7 @@
#include <mapnik/sql_utils.hpp>
#include <mapnik/util/conversions.hpp>
#include <mapnik/timer.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/algorithm/string.hpp>
@ -62,7 +63,7 @@ postgis_datasource::postgis_datasource(parameters const& params)
geometry_table_(*params.get<std::string>("geometry_table", "")),
geometry_field_(*params.get<std::string>("geometry_field", "")),
key_field_(*params.get<std::string>("key_field", "")),
cursor_fetch_size_(*params.get<int>("cursor_size", 0)),
cursor_fetch_size_(*params.get<mapnik::value_integer>("cursor_size", 0)),
row_limit_(*params.get<int>("row_limit", 0)),
type_(datasource::Vector),
srid_(*params.get<int>("srid", 0)),

View file

@ -31,6 +31,8 @@
#include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/optional.hpp>
@ -72,7 +74,6 @@ private:
std::string sql_bbox(box2d<double> const& env) const;
std::string populate_tokens(std::string const& sql, double scale_denom, box2d<double> const& env, double pixel_width, double pixel_height) const;
std::string populate_tokens(std::string const& sql) const;
static std::string unquote(std::string const& sql);
boost::shared_ptr<IResultSet> get_resultset(boost::shared_ptr<Connection> const &conn, std::string const& sql) const;
static const std::string GEOMETRY_COLUMNS;
@ -87,8 +88,8 @@ private:
std::string geometry_table_;
const std::string geometry_field_;
std::string key_field_;
const int cursor_fetch_size_;
const int row_limit_;
mapnik::value_integer cursor_fetch_size_;
mapnik::value_integer row_limit_;
std::string geometryColumn_;
mapnik::datasource::datasource_t type_;
int srid_;

View file

@ -29,13 +29,16 @@
#include <mapnik/debug.hpp>
#include <mapnik/wkb.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/sql_utils.hpp>
#include <mapnik/value.hpp>
#include <mapnik/feature_factory.hpp>
#include <mapnik/util/conversions.hpp>
#include <mapnik/util/trim.hpp>
#include <mapnik/global.hpp> // for int2net
#include <boost/scoped_array.hpp>
// boost
#include <boost/spirit/include/qi.hpp>
#include <boost/cstdint.hpp> // for boost::int16_t
// stl
#include <sstream>
@ -60,6 +63,8 @@ postgis_featureset::postgis_featureset(boost::shared_ptr<IResultSet> const& rs,
{
}
std::string numeric2string(const char* buf);
feature_ptr postgis_featureset::next()
{
while (rs_->next())
@ -156,7 +161,7 @@ feature_ptr postgis_featureset::next()
{
float val;
float4net(val, buf);
feature->put(name, val);
feature->put(name, static_cast<double>(val));
break;
}
@ -186,7 +191,7 @@ feature_ptr postgis_featureset::next()
case 1700: //numeric
{
double val;
std::string str = mapnik::sql_utils::numeric2string(buf);
std::string str = numeric2string(buf);
if (mapnik::util::string2double(str, val))
{
feature->put(name, val);
@ -213,3 +218,115 @@ postgis_featureset::~postgis_featureset()
{
rs_->close();
}
std::string numeric2string(const char* buf)
{
boost::int16_t ndigits = int2net(buf);
boost::int16_t weight = int2net(buf+2);
boost::int16_t sign = int2net(buf+4);
boost::int16_t dscale = int2net(buf+6);
boost::scoped_array<boost::int16_t> digits(new boost::int16_t[ndigits]);
for (int n=0; n < ndigits ;++n)
{
digits[n] = int2net(buf+8+n*2);
}
std::ostringstream ss;
if (sign == 0x4000) ss << "-";
int i = std::max(weight,boost::int16_t(0));
int d = 0;
// Each numeric "digit" is actually a value between 0000 and 9999 stored in a 16 bit field.
// For example, the number 1234567809990001 is stored as four digits: [1234] [5678] [999] [1].
// Note that the last two digits show that the leading 0's are lost when the number is split.
// We must be careful to re-insert these 0's when building the string.
while ( i >= 0)
{
if (i <= weight && d < ndigits)
{
// All digits after the first must be padded to make the field 4 characters long
if (d != 0)
{
#ifdef _WINDOWS
int dig = digits[d];
if (dig < 10)
{
ss << "000"; // 0000 - 0009
}
else if (dig < 100)
{
ss << "00"; // 0010 - 0099
}
else
{
ss << "0"; // 0100 - 0999;
}
#else
switch(digits[d])
{
case 0 ... 9:
ss << "000"; // 0000 - 0009
break;
case 10 ... 99:
ss << "00"; // 0010 - 0099
break;
case 100 ... 999:
ss << "0"; // 0100 - 0999
break;
}
#endif
}
ss << digits[d++];
}
else
{
if (d == 0)
ss << "0";
else
ss << "0000";
}
i--;
}
if (dscale > 0)
{
ss << '.';
// dscale counts the number of decimal digits following the point, not the numeric digits
while (dscale > 0)
{
int value;
if (i <= weight && d < ndigits)
value = digits[d++];
else
value = 0;
// Output up to 4 decimal digits for this value
if (dscale > 0) {
ss << (value / 1000);
value %= 1000;
dscale--;
}
if (dscale > 0) {
ss << (value / 100);
value %= 100;
dscale--;
}
if (dscale > 0) {
ss << (value / 10);
value %= 10;
dscale--;
}
if (dscale > 0) {
ss << value;
dscale--;
}
i--;
}
}
return ss.str();
}

View file

@ -28,9 +28,9 @@
#include <mapnik/box2d.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/unicode.hpp>
// boost
#include <boost/scoped_ptr.hpp>
using mapnik::Featureset;

View file

@ -1,6 +1,9 @@
#ifndef PYTHON_FEATURESET_HPP
#define PYTHON_FEATURESET_HPP
// mapnik
#include <mapnik/feature.hpp>
// boost
#include <boost/python.hpp>
#include <boost/python/stl_iterator.hpp>
@ -8,7 +11,6 @@
// mapnik
#include <mapnik/datasource.hpp>
// extend the mapnik::Featureset defined in include/mapnik/datasource.hpp
class python_featureset : public mapnik::Featureset
{
public:

View file

@ -61,9 +61,9 @@ raster_datasource::raster_datasource(parameters const& params)
else
filename_ = *file;
multi_tiles_ = *params.get<bool>("multi", false);
tile_size_ = *params.get<unsigned>("tile_size", 256);
tile_stride_ = *params.get<unsigned>("tile_stride", 1);
multi_tiles_ = *params.get<mapnik::boolean>("multi", false);
tile_size_ = *params.get<int>("tile_size", 256);
tile_stride_ = *params.get<int>("tile_stride", 1);
format_ = *params.get<std::string>("format","tiff");
@ -91,8 +91,8 @@ raster_datasource::raster_datasource(parameters const& params)
if (multi_tiles_)
{
boost::optional<unsigned> x_width = params.get<unsigned>("x_width");
boost::optional<unsigned> y_width = params.get<unsigned>("y_width");
boost::optional<int> x_width = params.get<int>("x_width");
boost::optional<int> y_width = params.get<int>("y_width");
if (! x_width)
{

View file

@ -22,6 +22,8 @@
// mapnik
#include <mapnik/debug.hpp>
#include <mapnik/image_data.hpp>
#include <mapnik/raster.hpp>
#include <mapnik/ctrans.hpp>
#include <mapnik/image_reader.hpp>
#include <mapnik/image_util.hpp>
@ -29,12 +31,12 @@
// boost
#include <boost/algorithm/string/replace.hpp>
#include <boost/make_shared.hpp>
#include "raster_featureset.hpp"
using mapnik::query;
using mapnik::image_reader;
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::image_data_32;
using mapnik::raster;

View file

@ -27,6 +27,7 @@
#include "raster_info.hpp"
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/debug.hpp>
// stl

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/debug.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp>
// boost
@ -34,7 +35,6 @@
using mapnik::query;
using mapnik::coord2d;
using mapnik::box2d;
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::geometry_type;
using mapnik::query;

View file

@ -24,7 +24,7 @@
#define RASTERLITE_FEATURESET_HPP
// mapnik
#include <mapnik/datasource.hpp>
#include <mapnik/feature.hpp>
// boost
#include <boost/variant.hpp>

View file

@ -20,6 +20,7 @@
*
*****************************************************************************/
// mapnik
#include <mapnik/value.hpp>
#include <mapnik/global.hpp>
#include <mapnik/utils.hpp>
#include <mapnik/unicode.hpp>
@ -124,7 +125,7 @@ const field_descriptor& dbf_file::descriptor(int col) const
}
void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, Feature & f) const throw()
void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, mapnik::feature_impl & f) const throw()
{
using namespace boost::spirit;

View file

@ -26,6 +26,7 @@
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/unicode.hpp>
// boost
#include <boost/interprocess/streams/bufferstream.hpp>
@ -36,9 +37,6 @@
#include <cassert>
#include <fstream>
using mapnik::transcoder;
using mapnik::Feature;
struct field_descriptor
{
int index_;
@ -73,7 +71,7 @@ public:
field_descriptor const& descriptor(int col) const;
void move_to(int index);
std::string string_value(int col) const;
void add_attribute(int col, transcoder const& tr, Feature & f) const throw();
void add_attribute(int col, mapnik::transcoder const& tr, mapnik::feature_impl & f) const throw();
private:
void read_header();
int read_short();

View file

@ -35,10 +35,10 @@
#include <mapnik/debug.hpp>
#include <mapnik/global.hpp>
#include <mapnik/boolean.hpp>
#include <mapnik/sql_utils.hpp>
#include <mapnik/util/conversions.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/timer.hpp>
#include <mapnik/value.hpp>
// stl
#include <fstream>
@ -60,7 +60,7 @@ shape_datasource::shape_datasource(const parameters &params)
type_(datasource::Vector),
file_length_(0),
indexed_(false),
row_limit_(*params.get<int>("row_limit",0)),
row_limit_(*params.get<mapnik::value_integer>("row_limit",0)),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8"))
{
#ifdef MAPNIK_STATS

View file

@ -31,6 +31,7 @@
#include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/optional.hpp>

View file

@ -26,6 +26,10 @@
// mapnik
#include <mapnik/debug.hpp>
#include <mapnik/feature_factory.hpp>
#include <mapnik/unicode.hpp>
// boost
#include <boost/make_shared.hpp>
#include "shape_featureset.hpp"
#include "shape_utils.hpp"

View file

@ -25,7 +25,9 @@
//mapnik
#include <mapnik/geom_util.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/value.hpp>
#include "shape_io.hpp"
@ -60,7 +62,7 @@ private:
boost::scoped_ptr<transcoder> tr_;
long file_length_;
std::vector<int> attr_ids_;
const int row_limit_;
mapnik::value_integer row_limit_;
mutable int count_;
context_ptr ctx_;
};

View file

@ -30,6 +30,7 @@
// boost
#include <boost/algorithm/string.hpp>
#include <boost/interprocess/streams/bufferstream.hpp>
#include <boost/make_shared.hpp>
#include "shape_index_featureset.hpp"
#include "shape_utils.hpp"
@ -47,7 +48,7 @@ shape_index_featureset<filterT>::shape_index_featureset(filterT const& filter,
: filter_(filter),
ctx_(boost::make_shared<mapnik::context_type>()),
shape_(shape),
tr_(new transcoder(encoding)),
tr_(new mapnik::transcoder(encoding)),
row_limit_(row_limit),
count_(0),
feature_bbox_()

View file

@ -29,6 +29,9 @@
// mapnik
#include <mapnik/geom_util.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/scoped_ptr.hpp>
@ -59,11 +62,11 @@ private:
filterT filter_;
context_ptr ctx_;
shape_io & shape_;
boost::scoped_ptr<transcoder> tr_;
boost::scoped_ptr<mapnik::transcoder> tr_;
std::vector<std::streampos> offsets_;
std::vector<std::streampos>::iterator itr_;
std::vector<int> attr_ids_;
const int row_limit_;
mapnik::value_integer row_limit_;
mutable int count_;
mutable box2d<double> feature_bbox_;
};

View file

@ -29,7 +29,6 @@
// mapnik
#include <mapnik/datasource.hpp>
#include <mapnik/params.hpp>
#include <mapnik/sql_utils.hpp>
#include <mapnik/timer.hpp>
// boost

View file

@ -65,8 +65,8 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
geometry_field_(*params.get<std::string>("geometry_field", "")),
index_table_(*params.get<std::string>("index_table", "")),
key_field_(*params.get<std::string>("key_field", "")),
row_offset_(*params.get<int>("row_offset", 0)),
row_limit_(*params.get<int>("row_limit", 0)),
row_offset_(*params.get<mapnik::value_integer>("row_offset", 0)),
row_limit_(*params.get<mapnik::value_integer>("row_limit", 0)),
intersects_token_("!intersects!"),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding", "utf-8")),
format_(mapnik::wkbAuto)
@ -142,7 +142,7 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
// now actually create the connection and start executing setup sql
dataset_ = boost::make_shared<sqlite_connection>(dataset_name_);
boost::optional<unsigned> table_by_index = params.get<unsigned>("table_by_index");
boost::optional<int> table_by_index = params.get<int>("table_by_index");
int passed_parameters = 0;
passed_parameters += params.get<std::string>("table") ? 1 : 0;

View file

@ -32,6 +32,7 @@
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp>
#include <mapnik/wkb.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/optional.hpp>
@ -77,7 +78,7 @@ private:
std::string index_table_;
std::string key_field_;
int row_offset_;
int row_limit_;
mapnik::value_integer row_limit_;
// TODO - also add to postgis.input
const std::string intersects_token_;
mapnik::layer_descriptor desc_;

View file

@ -23,7 +23,6 @@
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/feature.hpp>
@ -38,7 +37,6 @@
using mapnik::query;
using mapnik::box2d;
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::geometry_utils;
using mapnik::transcoder;

View file

@ -24,7 +24,7 @@
#define MAPNIK_SQLITE_FEATURESET_HPP
// mapnik
#include <mapnik/datasource.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/wkb.hpp>

View file

@ -644,7 +644,6 @@ public:
std::string fld_type(rs->column_text(2));
sqlite_int64 fld_pk = rs->column_integer64(5);
std::transform(fld_type.begin(), fld_type.end(), fld_type.begin(), ::tolower);
// TODO - how to handle primary keys on multiple columns ?
if (key_field.empty() && ! found_pk && fld_pk != 0)
{

View file

@ -2,6 +2,9 @@
#include <mapnik/feature_factory.hpp>
#include <mapnik/geometry.hpp>
// boost
#include <boost/make_shared.hpp>
#include "hello_featureset.hpp"
hello_featureset::hello_featureset(mapnik::box2d<double> const& box, std::string const& encoding)

View file

@ -3,11 +3,12 @@
// mapnik
#include <mapnik/datasource.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/unicode.hpp>
// boost
#include <boost/scoped_ptr.hpp> // needed for wrapping the transcoder
// extend the mapnik::Featureset defined in include/mapnik/datasource.hpp
class hello_featureset : public mapnik::Featureset
{
public:

View file

@ -100,6 +100,7 @@ else: # unix, non-macos
source = Split(
"""
params.cpp
image_filter_types.cpp
miniz_png.cpp
color.cpp

109
src/params.cpp Normal file
View file

@ -0,0 +1,109 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2012 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
// mapnik
#include <mapnik/boolean.hpp>
#include <mapnik/params.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/none.hpp>
#include <boost/optional.hpp>
namespace mapnik {
namespace params_detail {
// TODO - rewrite to avoid usage of lexical_cast
template <typename T>
struct value_extractor_visitor : public boost::static_visitor<>
{
value_extractor_visitor(boost::optional<T> & var)
:var_(var) {}
void operator () (T val) const
{
var_ = val;
}
template <typename T1>
void operator () (T1 val) const
{
try
{
var_ = boost::lexical_cast<T>(val);
}
catch (boost::bad_lexical_cast & ) {}
}
boost::optional<T> & var_;
};
template <typename T>
struct converter
{
typedef boost::optional<T> return_type;
static return_type extract(parameters const& params,
std::string const& name,
boost::optional<T> const& default_opt_value)
{
boost::optional<T> result(default_opt_value);
parameters::const_iterator itr = params.find(name);
if (itr != params.end())
{
boost::apply_visitor(value_extractor_visitor<T>(result),itr->second);
}
return result;
}
};
} // end namespace params_detail
// parameters
parameters::parameters() {}
template <typename T>
boost::optional<T> parameters::get(std::string const& key) const
{
return params_detail::converter<T>::extract(*this,key, boost::none);
}
template <typename T>
boost::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));
}
#define compile_params_get(T) template boost::optional<T> parameters::get(std::string const& key) const; template boost::optional<T> parameters::get(std::string const& key, T const& default_opt_value) const
compile_params_get(std::string);
compile_params_get(value_double);
compile_params_get(int);
#ifdef BIGINT
compile_params_get(value_integer);
#endif
compile_params_get(mapnik::boolean);
}