geometry_envelope - add missing linear_ring
This commit is contained in:
parent
bd21e452d1
commit
e0c756ee8d
2 changed files with 16 additions and 9 deletions
|
@ -41,7 +41,7 @@ struct geometry_envelope
|
|||
{
|
||||
return mapnik::util::apply_visitor(*this, geom);
|
||||
}
|
||||
|
||||
|
||||
void operator() (mapnik::geometry::geometry_empty const&) const {}
|
||||
|
||||
template <typename T>
|
||||
|
@ -60,30 +60,36 @@ struct geometry_envelope
|
|||
bool first = true;
|
||||
for (auto const& pt : line)
|
||||
{
|
||||
if (first && !bbox.valid())
|
||||
if (first && !bbox.valid())
|
||||
{
|
||||
bbox.init(pt.x, pt.y, pt.x, pt.y);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
bbox.expand_to_include(pt.x, pt.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (mapnik::geometry::linear_ring<T> const& ring) const
|
||||
{
|
||||
(*this)(static_cast<mapnik::geometry::line_string<T> const&>(ring));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void operator() (mapnik::geometry::polygon<T> const& poly) const
|
||||
{
|
||||
bool first = true;
|
||||
for (auto const& pt : poly.exterior_ring)
|
||||
{
|
||||
if (first && !bbox.valid())
|
||||
if (first && !bbox.valid())
|
||||
{
|
||||
bbox.init(pt.x, pt.y, pt.x, pt.y);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
bbox.expand_to_include(pt.x, pt.y);
|
||||
}
|
||||
|
@ -96,12 +102,12 @@ struct geometry_envelope
|
|||
bool first = true;
|
||||
for (auto const& pt : multi_point)
|
||||
{
|
||||
if (first && !bbox.valid())
|
||||
if (first && !bbox.valid())
|
||||
{
|
||||
bbox.init(pt.x, pt.y, pt.x, pt.y);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
bbox.expand_to_include(pt.x, pt.y);
|
||||
}
|
||||
|
@ -140,7 +146,7 @@ struct geometry_envelope
|
|||
|
||||
template <typename T>
|
||||
mapnik::box2d<double> envelope(T const& geom)
|
||||
{
|
||||
{
|
||||
box2d<double> bbox;
|
||||
detail::geometry_envelope op(bbox);
|
||||
op(geom);
|
||||
|
@ -149,4 +155,3 @@ mapnik::box2d<double> envelope(T const& geom)
|
|||
|
||||
} // end ns geometry
|
||||
} // end ns mapnik
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ template MAPNIK_DECL mapnik::box2d<double> envelope(mapnik::base_symbolizer_help
|
|||
template MAPNIK_DECL mapnik::box2d<double> envelope(geometry_empty const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(point<double> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(line_string<double> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(linear_ring<double> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(polygon<double> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(multi_point<double> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(multi_line_string<double> const& geom);
|
||||
|
@ -40,6 +41,7 @@ template MAPNIK_DECL mapnik::box2d<double> envelope(geometry_collection<double>
|
|||
template MAPNIK_DECL mapnik::box2d<double> envelope(geometry<std::int64_t> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(point<std::int64_t> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(line_string<std::int64_t> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(linear_ring<std::int64_t> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(polygon<std::int64_t> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(multi_point<std::int64_t> const& geom);
|
||||
template MAPNIK_DECL mapnik::box2d<double> envelope(multi_line_string<std::int64_t> const& geom);
|
||||
|
|
Loading…
Reference in a new issue