+ 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); geom_cont_.push_back(geom);
} }
unsigned num_geometries() const std::size_t num_geometries() const
{ {
return geom_cont_.size(); 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]; return geom_cont_[index];
} }
geometry_type& get_geometry(unsigned index) geometry_type& get_geometry(std::size_t index)
{ {
return geom_cont_[index]; return geom_cont_[index];
} }
@ -230,22 +230,23 @@ public:
{ {
// TODO - cache this // TODO - cache this
box2d<double> result; 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)
{ {
box2d<double> box = geom.envelope(); first = false;
result.init(box.minx(),box.miny(),box.maxx(),box.maxy()); box2d<double> box = geom.envelope();
} result.init(box.minx(),box.miny(),box.maxx(),box.maxy());
else }
{ else
result.expand_to_include(geom.envelope()); {
} result.expand_to_include(geom.envelope());
} }
}
return result; return result;
} }
raster_ptr const& get_raster() const raster_ptr const& get_raster() const
{ {
return raster_; return raster_;