+ template on geometry/path concept

This commit is contained in:
artemp 2012-10-04 12:15:51 +01:00
parent 8674e463a6
commit eaf6049909

View file

@ -117,7 +117,8 @@ namespace mapnik { namespace util {
typedef boost::shared_ptr<wkb_buffer> wkb_buffer_ptr; typedef boost::shared_ptr<wkb_buffer> wkb_buffer_ptr;
wkb_buffer_ptr to_point_wkb( geometry_type const& g, wkbByteOrder byte_order) template<typename GeometryType>
wkb_buffer_ptr to_point_wkb( GeometryType const& g, wkbByteOrder byte_order)
{ {
assert(g.size() == 1); assert(g.size() == 1);
std::size_t size = 1 + 4 + 8*2 ; // byteOrder + wkbType + Point std::size_t size = 1 + 4 + 8*2 ; // byteOrder + wkbType + Point
@ -135,7 +136,8 @@ namespace mapnik { namespace util {
return wkb; return wkb;
} }
wkb_buffer_ptr to_line_string_wkb( geometry_type const& g, wkbByteOrder byte_order) template<typename GeometryType>
wkb_buffer_ptr to_line_string_wkb( GeometryType const& g, wkbByteOrder byte_order)
{ {
unsigned num_points = g.size(); unsigned num_points = g.size();
assert(num_points > 1); assert(num_points > 1);
@ -158,7 +160,8 @@ namespace mapnik { namespace util {
return wkb; return wkb;
} }
wkb_buffer_ptr to_polygon_wkb( geometry_type const& g, wkbByteOrder byte_order) template<typename GeometryType>
wkb_buffer_ptr to_polygon_wkb( GeometryType const& g, wkbByteOrder byte_order)
{ {
unsigned num_points = g.size(); unsigned num_points = g.size();
assert(num_points > 1); assert(num_points > 1);
@ -207,7 +210,8 @@ namespace mapnik { namespace util {
return wkb; return wkb;
} }
wkb_buffer_ptr to_wkb(geometry_type const& g, wkbByteOrder byte_order ) template<typename GeometryType>
wkb_buffer_ptr to_wkb(GeometryType const& g, wkbByteOrder byte_order )
{ {
wkb_buffer_ptr wkb; wkb_buffer_ptr wkb;
@ -272,8 +276,6 @@ namespace mapnik { namespace util {
return wkb_buffer_ptr(); return wkb_buffer_ptr();
} }
}} }}
#endif // MAPNIK_GEOMETRY_TO_WKB_HPP #endif // MAPNIK_GEOMETRY_TO_WKB_HPP