+ use std::size_t
+ re-implement envelope() method in terms of c++11
This commit is contained in:
artem@windows 2013-04-30 09:46:06 -07:00
parent 231e4ab907
commit 16c0b578bc

View file

@ -211,17 +211,17 @@ public:
geom_cont_.push_back(geom);
}
unsigned num_geometries() const
std::size_t num_geometries() const
{
return geom_cont_.size();
}
geometry_type const& get_geometry(unsigned index) const
geometry_type const& get_geometry(std::size_t index) const
{
return geom_cont_[index];
}
geometry_type& get_geometry(unsigned index)
geometry_type& get_geometry(std::size_t index)
{
return geom_cont_[index];
}
@ -230,11 +230,12 @@ public:
{
// TODO - cache this
box2d<double> result;
for (unsigned i=0;i<num_geometries();++i)
bool first = true;
for (auto const& geom : geom_cont_)
{
geometry_type const& geom = get_geometry(i);
if (i==0)
if (first)
{
first = false;
box2d<double> box = geom.envelope();
result.init(box.minx(),box.miny(),box.maxx(),box.maxy());
}