make is_simple and is_valid work typed geometries directly

This commit is contained in:
artemp 2015-03-31 13:05:55 +02:00
parent 7cbabd9b46
commit 7775089a24
2 changed files with 54 additions and 8 deletions

View file

@ -54,16 +54,37 @@ struct geometry_is_simple
return true;
}
template <typename T>
result_type operator() (T const& geom) const
result_type operator() (point const& pt) const
{
return boost::geometry::is_simple(geom);
return boost::geometry::is_simple(pt);
}
result_type operator() (line_string const& line) const
{
return boost::geometry::is_simple(line);
}
result_type operator() (polygon const& poly) const
{
return boost::geometry::is_simple(poly);
}
result_type operator() (multi_point const& multi_pt) const
{
return boost::geometry::is_simple(multi_pt);
}
result_type operator() (multi_line_string const& multi_line) const
{
return boost::geometry::is_simple(multi_line);
}
result_type operator() (multi_polygon const& multi_poly) const
{
return boost::geometry::is_simple(multi_poly);
}
};
}
inline bool is_simple(mapnik::geometry::geometry const& geom)
template <typename T>
inline bool is_simple(T const& geom)
{
return detail::geometry_is_simple() (geom);
}

View file

@ -54,16 +54,41 @@ struct geometry_is_valid
return true;
}
template <typename T>
result_type operator() (T const& geom) const
result_type operator() (point const& pt) const
{
return boost::geometry::is_valid(geom);
return boost::geometry::is_valid(pt);
}
result_type operator() (line_string const& line) const
{
return boost::geometry::is_valid(line);
}
result_type operator() (polygon const& poly) const
{
return boost::geometry::is_valid(poly);
}
result_type operator() (multi_point const& multi_pt) const
{
return boost::geometry::is_valid(multi_pt);
}
result_type operator() (multi_line_string const& multi_line) const
{
return boost::geometry::is_valid(multi_line);
}
result_type operator() (multi_polygon const& multi_poly) const
{
return boost::geometry::is_valid(multi_poly);
}
};
}
inline bool is_valid(mapnik::geometry::geometry const& geom)
template <typename T>
inline bool is_valid(T const& geom)
{
return detail::geometry_is_valid() (geom);
}