Merge branch 'master' into geometry-refactor

This commit is contained in:
artemp 2016-07-26 12:16:39 +02:00
commit b0d9467224
20 changed files with 152 additions and 101 deletions

View file

@ -45,6 +45,12 @@ matrix:
env: JOBS=4 MASON_PUBLISH=true _CXX="ccache clang++ -Qunused-arguments"
before_install:
# workaround travis rvm bug
# http://superuser.com/questions/1044130/why-am-i-having-how-can-i-fix-this-error-shell-session-update-command-not-f
- |
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
rvm get head || true
fi
- if [[ ${_CXX:-false} != false ]]; then export CXX=${_CXX}; fi
- if [[ ${_CC:-false} != false ]]; then export CC=${_CC}; fi
- source scripts/travis-common.sh

2
deps/mapbox/variant vendored

@ -1 +1 @@
Subproject commit c511b2f34d966c09e02a1b833db33a9a1f9b2196
Subproject commit 388376ac9f0102feba2d2122873b08e15a66a879

View file

@ -52,10 +52,18 @@
#define PROJ_ENVELOPE_POINTS 20
#ifndef BOOST_MPL_LIMIT_VECTOR_SIZE
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_VECTOR_SIZE 30
#ifndef BOOST_MPL_LIMIT_VECTOR_SIZE
#define BOOST_MPL_LIMIT_VECTOR_SIZE 30
#else
#warning "WARNING: BOOST_MPL_LIMIT_VECTOR_SIZE is already defined. Ensure config.hpp is included before any Boost headers"
#warning "WARNING: BOOST_MPL_LIMIT_VECTOR_SIZE is already defined. Ensure config.hpp is included before any Boost headers"
#endif
#ifndef BOOST_MPL_LIMIT_LIST_SIZE
#define BOOST_MPL_LIMIT_LIST_SIZE 30
#else
#warning "WARNING: BOOST_MPL_LIMIT_LIST_SIZE is already defined. Ensure config.hpp is included before any Boost headers"
#endif
#endif // MAPNIK_CONFIG_HPP

View file

@ -65,11 +65,7 @@ struct geometry : geometry_base<T>
geometry()
: geometry_base<T>() {} // empty
template <typename G>
geometry(G && geom)
: geometry_base<T>(std::forward<G>(geom)) {}
using geometry_base<T>::geometry_base;
};

View file

@ -43,6 +43,7 @@ using rgba_hash_table = std::unordered_map<unsigned int, unsigned char>;
// stl
#include <vector>
#include <tuple>
#define U2RED(x) ((x)&0xff)
#define U2GREEN(x) (((x)>>8)&0xff)
@ -53,7 +54,8 @@ namespace mapnik {
struct rgba;
struct MAPNIK_DECL rgb {
struct MAPNIK_DECL rgb
{
std::uint8_t r;
std::uint8_t g;
std::uint8_t b;
@ -92,7 +94,7 @@ struct MAPNIK_DECL rgba
b(U2BLUE(c)),
a(U2ALPHA(c)) {}
inline bool operator==(const rgba& y) const
inline bool operator==(rgba const& y) const
{
return r == y.r && g == y.g && b == y.b && a == y.a;
}
@ -103,18 +105,27 @@ struct MAPNIK_DECL rgba
bool operator() (const rgba& x, const rgba& y) const;
};
inline bool operator<(rgba const& y) const
{
return std::tie(r, g, b, a) < std::tie(y.r, y.g, y.b, y.a);
}
};
class MAPNIK_DECL rgba_palette : private util::noncopyable {
class MAPNIK_DECL rgba_palette : private util::noncopyable
{
public:
enum palette_type { PALETTE_RGBA = 0, PALETTE_RGB = 1, PALETTE_ACT = 2 };
explicit rgba_palette(std::string const& pal, palette_type type = PALETTE_RGBA);
rgba_palette();
const std::vector<rgb>& palette() const;
const std::vector<unsigned>& alphaTable() const;
inline std::vector<rgb> const& palette() const { return rgb_pal_;}
inline std::vector<unsigned> const& alpha_table() const { return alpha_pal_;}
inline std::vector<rgb>& palette() { return rgb_pal_;}
inline std::vector<unsigned>& alpha_table() { return alpha_pal_;}
unsigned char quantize(unsigned c) const;

View file

@ -51,6 +51,10 @@ struct value_holder : value_holder_base
value_holder()
: value_holder_base() {}
// C-string -> std::string
value_holder(char const* str)
: value_holder(std::string(str)) {}
// perfect forwarding
template <typename T>
value_holder(T && obj)

View file

@ -39,7 +39,7 @@ extern "C"
{
#include <png.h>
}
#include <set>
#pragma GCC diagnostic pop
#define MAX_OCTREE_LEVELS 4
@ -515,19 +515,19 @@ void save_as_png8_oct(T1 & file,
}
//transparency values per palette index
std::vector<unsigned> alphaTable;
//alphaTable.resize(palette.size());//allow semitransparency also in almost opaque range
std::vector<unsigned> alpha_table;
//alpha_table.resize(palette.size());//allow semitransparency also in almost opaque range
if (opts.trans_mode != 0)
{
alphaTable.resize(palette.size() - cols[TRANSPARENCY_LEVELS-1]);
alpha_table.resize(palette.size() - cols[TRANSPARENCY_LEVELS-1]);
}
if (palette.size() > 16 )
{
// >16 && <=256 colors -> write 8-bit color depth
image_gray8 reduced_image(width,height);
reduce_8(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alphaTable);
save_as_png(file,palette,reduced_image,width,height,8,alphaTable,opts);
reduce_8(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alpha_table);
save_as_png(file,palette,reduced_image,width,height,8,alpha_table,opts);
}
else if (palette.size() == 1)
{
@ -535,13 +535,13 @@ void save_as_png8_oct(T1 & file,
unsigned image_width = ((width + 15) >> 3) & ~1U; // 1-bit image, round up to 16-bit boundary
unsigned image_height = height;
image_gray8 reduced_image(image_width,image_height);
reduce_1(image,reduced_image,trees, limits, alphaTable);
reduce_1(image,reduced_image,trees, limits, alpha_table);
if (meanAlpha<255 && cols[0]==0)
{
alphaTable.resize(1);
alphaTable[0] = meanAlpha;
alpha_table.resize(1);
alpha_table[0] = meanAlpha;
}
save_as_png(file,palette,reduced_image,width,height,1,alphaTable,opts);
save_as_png(file,palette,reduced_image,width,height,1,alpha_table,opts);
}
else
{
@ -549,8 +549,8 @@ void save_as_png8_oct(T1 & file,
unsigned image_width = ((width + 7) >> 1) & ~3U; // 4-bit image, round up to 32-bit boundary
unsigned image_height = height;
image_gray8 reduced_image(image_width,image_height);
reduce_4(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alphaTable);
save_as_png(file,palette,reduced_image,width,height,4,alphaTable,opts);
reduce_4(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alpha_table);
save_as_png(file,palette,reduced_image,width,height,4,alpha_table,opts);
}
}
@ -560,7 +560,7 @@ void save_as_png8(T1 & file,
T2 const& image,
T3 const & tree,
std::vector<mapnik::rgb> const& palette,
std::vector<unsigned> const& alphaTable,
std::vector<unsigned> const& alpha_table,
png_options const& opts)
{
unsigned width = image.width();
@ -579,7 +579,7 @@ void save_as_png8(T1 & file,
row_out[x] = tree.quantize(row[x]);
}
}
save_as_png(file, palette, reduced_image, width, height, 8, alphaTable, opts);
save_as_png(file, palette, reduced_image, width, height, 8, alpha_table, opts);
}
else if (palette.size() == 1)
{
@ -588,7 +588,7 @@ void save_as_png8(T1 & file,
unsigned image_height = height;
image_gray8 reduced_image(image_width, image_height);
reduced_image.set(0);
save_as_png(file, palette, reduced_image, width, height, 1, alphaTable, opts);
save_as_png(file, palette, reduced_image, width, height, 1, alpha_table, opts);
}
else
{
@ -612,7 +612,7 @@ void save_as_png8(T1 & file,
row_out[x>>1] |= index;
}
}
save_as_png(file, palette, reduced_image, width, height, 4, alphaTable, opts);
save_as_png(file, palette, reduced_image, width, height, 4, alpha_table, opts);
}
}
@ -623,6 +623,7 @@ void save_as_png8_hex(T1 & file,
{
unsigned width = image.width();
unsigned height = image.height();
if (width + height > 3) // at least 3 pixels (hextree implementation requirement)
{
// structure for color quantization
@ -647,20 +648,44 @@ void save_as_png8_hex(T1 & file,
}
//transparency values per palette index
std::vector<mapnik::rgba> pal;
tree.create_palette(pal);
std::vector<mapnik::rgba> rgba_palette;
tree.create_palette(rgba_palette);
auto size = rgba_palette.size();
std::vector<mapnik::rgb> palette;
std::vector<unsigned> alphaTable;
for (unsigned i=0; i<pal.size(); ++i)
std::vector<unsigned> alpha_table;
palette.reserve(size);
alpha_table.reserve(size);
for (auto const& c : rgba_palette)
{
palette.push_back(rgb(pal[i].r, pal[i].g, pal[i].b));
alphaTable.push_back(pal[i].a);
palette.emplace_back(c.r, c.g, c.b);
alpha_table.push_back(c.a);
}
save_as_png8<T1, T2, hextree<mapnik::rgba> >(file, image, tree, palette, alphaTable, opts);
save_as_png8<T1, T2, hextree<mapnik::rgba> >(file, image, tree, palette, alpha_table, opts);
}
else
{
throw std::runtime_error("Can't quantize images with less than 3 pixels");
std::set<mapnik::rgba> colors;
for (unsigned y = 0; y < height; ++y)
{
typename T2::pixel_type const * row = image.get_row(y);
for (unsigned x = 0; x < width; ++x)
{
unsigned val = row[x];
colors.emplace(U2RED(val), U2GREEN(val), U2BLUE(val), U2ALPHA(val));
}
}
std::string str;
for (auto c : colors)
{
str.push_back(c.r);
str.push_back(c.g);
str.push_back(c.b);
str.push_back(c.a);
}
rgba_palette pal(str, rgba_palette::PALETTE_RGBA);
save_as_png8<T1, T2, rgba_palette>(file, image, pal, pal.palette(), pal.alpha_table(), opts);
}
}
@ -670,7 +695,7 @@ void save_as_png8_pal(T1 & file,
rgba_palette const& pal,
png_options const& opts)
{
save_as_png8<T1, T2, rgba_palette>(file, image, pal, pal.palette(), pal.alphaTable(), opts);
save_as_png8<T1, T2, rgba_palette>(file, image, pal, pal.palette(), pal.alpha_table(), opts);
}
}

View file

@ -101,7 +101,7 @@ struct strict_value : value_base_type
strict_value() = default;
strict_value(const char* val)
: value_base_type(val) {}
: value_base_type(std::string(val)) {}
template <typename T>
strict_value(T const& obj)

View file

@ -51,13 +51,13 @@ public:
// unary visitor interface
// const
template <typename F, typename V>
auto VARIANT_INLINE static apply_visitor(F && f, V const& v) -> decltype(V::visit(v, f))
auto VARIANT_INLINE static apply_visitor(F && f, V const& v) -> decltype(V::visit(v, std::forward<F>(f)))
{
return V::visit(v, std::forward<F>(f));
}
// non-const
template <typename F, typename V>
auto VARIANT_INLINE static apply_visitor(F && f, V & v) -> decltype(V::visit(v, f))
auto VARIANT_INLINE static apply_visitor(F && f, V & v) -> decltype(V::visit(v, std::forward<F>(f)))
{
return V::visit(v, std::forward<F>(f));
}
@ -65,14 +65,14 @@ auto VARIANT_INLINE static apply_visitor(F && f, V & v) -> decltype(V::visit(v,
// binary visitor interface
// const
template <typename F, typename V>
auto VARIANT_INLINE static apply_visitor(F && f, V const& v0, V const& v1) -> decltype(V::binary_visit(v0, v1, f))
auto VARIANT_INLINE static apply_visitor(F && f, V const& v0, V const& v1) -> decltype(V::binary_visit(v0, v1, std::forward<F>(f)))
{
return V::binary_visit(v0, v1, std::forward<F>(f));
}
// non-const
template <typename F, typename V>
auto VARIANT_INLINE static apply_visitor(F && f, V & v0, V & v1) -> decltype(V::binary_visit(v0, v1, f))
auto VARIANT_INLINE static apply_visitor(F && f, V & v0, V & v1) -> decltype(V::binary_visit(v0, v1, std::forward<F>(f)))
{
return V::binary_visit(v0, v1, std::forward<F>(f));
}

View file

@ -55,7 +55,7 @@ struct do_xml_attribute_cast
{
static inline boost::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());
throw std::runtime_error(err_msg);
}
@ -74,6 +74,19 @@ struct do_xml_attribute_cast<mapnik::boolean_type>
}
};
// specialization for mapnik::value_bool
template <>
struct do_xml_attribute_cast<mapnik::value_bool>
{
static inline boost::optional<mapnik::value_bool> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source)
{
bool result;
if (mapnik::util::string2bool(source, result))
return boost::optional<mapnik::value_bool>(result);
return boost::optional<mapnik::value_bool>();
}
};
// specialization for int
template <>
struct do_xml_attribute_cast<int>

View file

@ -479,7 +479,7 @@ postgis_datasource::postgis_datasource(parameters const& params)
// Finally, add unique metadata to layer descriptor
mapnik::parameters & extra_params = desc_.get_extra_parameters();
// explicitly make copies of values due to https://github.com/mapnik/mapnik/issues/2651
extra_params["srid"] = srid_;
extra_params["srid"] = mapnik::value_integer(srid_);
if (!key_field_.empty())
{
extra_params["key_field"] = key_field_;

View file

@ -117,7 +117,7 @@ datasource_ptr datasource_cache::create(parameters const& params)
#endif
create_ds create_datasource = reinterpret_cast<create_ds>(itr->second->get_symbol("create"));
if (! create_datasource)
if (!create_datasource)
{
throw std::runtime_error(std::string("Cannot load symbols: ") +
itr->second->get_error());

View file

@ -191,7 +191,20 @@ struct composite_visitor
dy_(dy) {}
template <typename T>
void operator() (T & dst) const;
void operator() (T & dst) const
{
throw std::runtime_error("Error: Composite with " + std::string(typeid(dst).name()) + " is not supported");
}
void operator()(image_rgba8 & dst) const
{
composite(dst, util::get<image_rgba8>(src_), mode_, opacity_, dx_, dy_);
}
void operator() (image_gray32f & dst) const
{
composite(dst, util::get<image_gray32f>(src_), mode_, opacity_, dx_, dy_);
}
private:
image_any const& src_;
@ -199,26 +212,9 @@ struct composite_visitor
float opacity_;
int dx_;
int dy_;
};
template <typename T>
void composite_visitor::operator() (T & dst) const
{
throw std::runtime_error("Error: Composite with " + std::string(typeid(dst).name()) + " is not supported");
}
template <>
void composite_visitor::operator()<image_rgba8> (image_rgba8 & dst) const
{
composite(dst, util::get<image_rgba8>(src_), mode_, opacity_, dx_, dy_);
}
template <>
void composite_visitor::operator()<image_gray32f> (image_gray32f & dst) const
{
composite(dst, util::get<image_gray32f>(src_), mode_, opacity_, dx_, dy_);
}
} // end ns
template <>

View file

@ -200,7 +200,7 @@ void map_parser::parse_map(Map & map, xml_node const& node, std::string const& b
{
map.set_background(*bgcolor);
}
optional<std::string> image_filename = map_node.get_opt_attr<std::string>("background-image");
if (image_filename)
{
@ -891,7 +891,7 @@ void map_parser::parse_symbolizer_base(symbolizer_base &sym, xml_node const& nod
{
set_symbolizer_property<symbolizer_base,double>(sym, keys::simplify_tolerance, node);
set_symbolizer_property<symbolizer_base,double>(sym, keys::smooth, node);
set_symbolizer_property<symbolizer_base,boolean_type>(sym, keys::clip, node);
set_symbolizer_property<symbolizer_base,value_bool>(sym, keys::clip, node);
set_symbolizer_property<symbolizer_base,composite_mode_e>(sym, keys::comp_op, node);
set_symbolizer_property<symbolizer_base,transform_type>(sym, keys::geometry_transform, node);
set_symbolizer_property<symbolizer_base,simplify_algorithm_e>(sym, keys::simplify_algorithm, node);
@ -907,8 +907,8 @@ void map_parser::parse_point_symbolizer(rule & rule, xml_node const & node)
point_symbolizer sym;
parse_symbolizer_base(sym, node);
set_symbolizer_property<symbolizer_base,double>(sym, keys::opacity, node);
set_symbolizer_property<symbolizer_base,boolean_type>(sym, keys::allow_overlap, node);
set_symbolizer_property<symbolizer_base,boolean_type>(sym, keys::ignore_placement, node);
set_symbolizer_property<symbolizer_base,value_bool>(sym, keys::allow_overlap, node);
set_symbolizer_property<symbolizer_base,value_bool>(sym, keys::ignore_placement, node);
set_symbolizer_property<symbolizer_base,point_placement_enum>(sym, keys::point_placement_type, node);
set_symbolizer_property<symbolizer_base,transform_type>(sym, keys::image_transform, node);
if (file && !file->empty())
@ -1011,9 +1011,9 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& node)
set_symbolizer_property<symbolizer_base,double>(sym, keys::offset, node);
set_symbolizer_property<symbolizer_base,double>(sym, keys::width, node);
set_symbolizer_property<symbolizer_base,double>(sym, keys::height, node);
set_symbolizer_property<symbolizer_base,boolean_type>(sym, keys::allow_overlap, node);
set_symbolizer_property<symbolizer_base,boolean_type>(sym, keys::avoid_edges, node);
set_symbolizer_property<symbolizer_base,boolean_type>(sym, keys::ignore_placement, node);
set_symbolizer_property<symbolizer_base,value_bool>(sym, keys::allow_overlap, node);
set_symbolizer_property<symbolizer_base,value_bool>(sym, keys::avoid_edges, node);
set_symbolizer_property<symbolizer_base,value_bool>(sym, keys::ignore_placement, node);
set_symbolizer_property<symbolizer_base,color>(sym, keys::fill, node);
set_symbolizer_property<symbolizer_base,transform_type>(sym, keys::image_transform, node);
set_symbolizer_property<symbolizer_base,marker_placement_enum>(sym, keys::markers_placement_type, node);
@ -1172,7 +1172,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& node)
set_symbolizer_property<symbolizer_base,double>(sym, keys::shield_dx, node);
set_symbolizer_property<symbolizer_base,double>(sym, keys::shield_dy, node);
set_symbolizer_property<symbolizer_base,double>(sym, keys::opacity, node);
set_symbolizer_property<symbolizer_base,mapnik::boolean_type>(sym, keys::unlock_image, node);
set_symbolizer_property<symbolizer_base,value_bool>(sym, keys::unlock_image, node);
std::string file = node.get_attr<std::string>("file");
if (file.empty())
@ -1343,7 +1343,7 @@ void map_parser::parse_raster_symbolizer(rule & rule, xml_node const & node)
// premultiplied status of image
optional<mapnik::boolean_type> premultiplied = node.get_opt_attr<mapnik::boolean_type>("premultiplied");
if (premultiplied) put(raster_sym, keys::premultiplied, *premultiplied);
if (premultiplied) put(raster_sym, keys::premultiplied, bool(*premultiplied));
bool found_colorizer = false;
for ( auto const& css : node)

View file

@ -65,16 +65,6 @@ rgba_palette::rgba_palette()
#endif
}
const std::vector<rgb>& rgba_palette::palette() const
{
return rgb_pal_;
}
const std::vector<unsigned>& rgba_palette::alphaTable() const
{
return alpha_pal_;
}
bool rgba_palette::valid() const
{
return colors_ > 0;

View file

@ -75,9 +75,9 @@ node_ptr layout_node::from_xml(xml_node const& xml, fontset_map const& fontsets)
if (xml.has_attribute("text-ratio")) set_property_from_xml<double>(n->text_ratio, "text-ratio", xml);
if (xml.has_attribute("wrap-width")) set_property_from_xml<double>(n->wrap_width, "wrap-width", xml);
if (xml.has_attribute("wrap-character")) set_property_from_xml<std::string>(n->wrap_char, "wrap-character", xml);
if (xml.has_attribute("wrap-before")) set_property_from_xml<mapnik::boolean_type>(n->wrap_before, "wrap-before", xml);
if (xml.has_attribute("repeat-wrap-character")) set_property_from_xml<mapnik::boolean_type>(n->repeat_wrap_char, "repeat-wrap-character", xml);
if (xml.has_attribute("rotate-displacement")) set_property_from_xml<mapnik::boolean_type>(n->rotate_displacement, "rotate-displacement", xml);
if (xml.has_attribute("wrap-before")) set_property_from_xml<mapnik::value_bool>(n->wrap_before, "wrap-before", xml);
if (xml.has_attribute("repeat-wrap-character")) set_property_from_xml<mapnik::value_bool>(n->repeat_wrap_char, "repeat-wrap-character", xml);
if (xml.has_attribute("rotate-displacement")) set_property_from_xml<mapnik::value_bool>(n->rotate_displacement, "rotate-displacement", xml);
if (xml.has_attribute("orientation")) set_property_from_xml<double>(n->orientation, "orientation", xml);
if (xml.has_attribute("horizontal-alignment")) set_property_from_xml<horizontal_alignment_e>(n->halign, "horizontal-alignment", xml);
if (xml.has_attribute("vertical-alignment")) set_property_from_xml<vertical_alignment_e>(n->valign, "vertical-alignment", xml);

View file

@ -103,9 +103,9 @@ void text_symbolizer_properties::text_properties_from_xml(xml_node const& node)
set_property_from_xml<value_double>(expressions.label_position_tolerance, "label-position-tolerance", node);
set_property_from_xml<value_double>(expressions.minimum_padding, "minimum-padding", node);
set_property_from_xml<value_double>(expressions.minimum_path_length, "minimum-path-length", node);
set_property_from_xml<boolean_type>(expressions.avoid_edges, "avoid-edges", node);
set_property_from_xml<boolean_type>(expressions.allow_overlap, "allow-overlap", node);
set_property_from_xml<boolean_type>(expressions.largest_bbox_only, "largest-bbox-only", node);
set_property_from_xml<value_bool>(expressions.avoid_edges, "avoid-edges", node);
set_property_from_xml<value_bool>(expressions.allow_overlap, "allow-overlap", node);
set_property_from_xml<value_bool>(expressions.largest_bbox_only, "largest-bbox-only", node);
set_property_from_xml<value_double>(expressions.max_char_angle_delta, "max-char-angle-delta", node);
set_property_from_xml<text_upright_e>(expressions.upright, "upright", node);
}
@ -215,9 +215,9 @@ void text_layout_properties::from_xml(xml_node const &node, fontset_map const& f
set_property_from_xml<double>(text_ratio, "text-ratio", node);
set_property_from_xml<double>(wrap_width, "wrap-width", node);
set_property_from_xml<std::string>(wrap_char, "wrap-character", node);
set_property_from_xml<boolean_type>(wrap_before, "wrap-before", node);
set_property_from_xml<boolean_type>(repeat_wrap_char, "repeat-wrap-character", node);
set_property_from_xml<boolean_type>(rotate_displacement, "rotate-displacement", node);
set_property_from_xml<value_bool>(wrap_before, "wrap-before", node);
set_property_from_xml<value_bool>(repeat_wrap_char, "repeat-wrap-character", node);
set_property_from_xml<value_bool>(rotate_displacement, "rotate-displacement", node);
set_property_from_xml<double>(orientation, "orientation", node);
set_property_from_xml<vertical_alignment_e>(valign, "vertical-alignment", node);
set_property_from_xml<horizontal_alignment_e>(halign, "horizontal-alignment", node);

View file

@ -673,7 +673,7 @@ struct convert<std::string>
std::string operator()(value_null const&) const
{
return std::string("null");
return std::string("");
}
};
@ -708,7 +708,7 @@ struct to_unicode_impl
value_unicode_string operator()(value_null const&) const
{
return value_unicode_string("null");
return value_unicode_string("");
}
};

View file

@ -69,6 +69,7 @@ DEFINE_NAME_TRAIT( double, "double")
DEFINE_NAME_TRAIT( float, "float")
DEFINE_NAME_TRAIT( unsigned, "unsigned")
DEFINE_NAME_TRAIT( int, "int")
DEFINE_NAME_TRAIT( bool, "bool")
DEFINE_NAME_TRAIT( boolean_type, "boolean_type")
#ifdef BIGINT
DEFINE_NAME_TRAIT( mapnik::value_integer, "long long" )
@ -411,6 +412,7 @@ std::string xml_node::line_to_string() const
#define compile_get_value(T) template T xml_node::get_value<T>() const
compile_get_opt_attr(boolean_type);
compile_get_opt_attr(mapnik::value_bool);
compile_get_opt_attr(std::string);
compile_get_opt_attr(int);
compile_get_opt_attr(unsigned);

View file

@ -352,23 +352,23 @@ void pgsql2sqlite(Connection conn,
break;
}
case 23:
output_rec.push_back(sqlite::value_type(int4net(buf)));
output_rec.emplace_back(int4net(buf));
break;
case 21:
output_rec.push_back(sqlite::value_type(int2net(buf)));
output_rec.emplace_back(int(int2net(buf)));
break;
case 700:
{
float val;
float4net(val,buf);
output_rec.push_back(sqlite::value_type(val));
output_rec.emplace_back(double(val));
break;
}
case 701:
{
double val;
float8net(val,buf);
output_rec.push_back(sqlite::value_type(val));
output_rec.emplace_back(val);
break;
}
case 1700:
@ -377,7 +377,7 @@ void pgsql2sqlite(Connection conn,
double val;
if (mapnik::util::string2double(str,val))
{
output_rec.push_back(sqlite::value_type(val));
output_rec.emplace_back(val);
}
break;
}