more auto_ptr usage to avoid bare geometry pointers
This commit is contained in:
parent
b1e9aa2140
commit
c9e3248cec
4 changed files with 11 additions and 14 deletions
|
@ -449,9 +449,9 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
|
|||
{
|
||||
// construct feature
|
||||
feature_ptr feature = feature_factory::create(ctx_,1);
|
||||
geometry_type * point = new geometry_type(mapnik::Point);
|
||||
std::auto_ptr<geometry_type> point(new geometry_type(mapnik::Point));
|
||||
point->move_to(pt.x, pt.y);
|
||||
feature->add_geometry(point);
|
||||
feature->add_geometry(point.release());
|
||||
feature->put_new("value",value);
|
||||
if (raster_has_nodata)
|
||||
{
|
||||
|
|
|
@ -259,7 +259,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
|
|||
SDOPointType* sdopoint = geom->getSdo_point();
|
||||
if (sdopoint && ! sdopoint->isNull())
|
||||
{
|
||||
geometry_type* point = new geometry_type(mapnik::Point);
|
||||
std::auto_ptr<geometry_type> point(new geometry_type(mapnik::Point));
|
||||
point->move_to(sdopoint->getX(), sdopoint->getY());
|
||||
feature->add_geometry(point);
|
||||
}
|
||||
|
|
|
@ -65,9 +65,9 @@ feature_ptr osm_featureset<filterT>::next()
|
|||
feature = feature_factory::create(ctx_, cur_item->id);
|
||||
double lat = static_cast<osm_node*>(cur_item)->lat;
|
||||
double lon = static_cast<osm_node*>(cur_item)->lon;
|
||||
geometry_type* point = new geometry_type(mapnik::Point);
|
||||
std::auto_ptr<geometry_type> point(new geometry_type(mapnik::Point));
|
||||
point->move_to(lon, lat);
|
||||
feature->add_geometry(point);
|
||||
feature->add_geometry(point.release());
|
||||
}
|
||||
else if (dataset_->current_item_is_way())
|
||||
{
|
||||
|
@ -83,15 +83,12 @@ feature_ptr osm_featureset<filterT>::next()
|
|||
|
||||
if (!cur_item) return feature_ptr();
|
||||
feature = feature_factory::create(ctx_, cur_item->id);
|
||||
geometry_type* geom;
|
||||
mapnik::eGeomType geom_type = mapnik::LineString;
|
||||
if (static_cast<osm_way*>(cur_item)->is_polygon())
|
||||
{
|
||||
geom = new geometry_type(mapnik::Polygon);
|
||||
}
|
||||
else
|
||||
{
|
||||
geom = new geometry_type(mapnik::LineString);
|
||||
geom_type = mapnik::Polygon;
|
||||
}
|
||||
std::auto_ptr<geometry_type> geom(new geometry_type(geom_type));
|
||||
|
||||
geom->move_to(static_cast<osm_way*>(cur_item)->nodes[0]->lon,
|
||||
static_cast<osm_way*>(cur_item)->nodes[0]->lat);
|
||||
|
@ -103,7 +100,7 @@ feature_ptr osm_featureset<filterT>::next()
|
|||
geom->line_to(static_cast<osm_way*>(cur_item)->nodes[count]->lon,
|
||||
static_cast<osm_way*>(cur_item)->nodes[count]->lat);
|
||||
}
|
||||
feature->add_geometry(geom);
|
||||
feature->add_geometry(geom.release());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -43,9 +43,9 @@ int main(int argc, char** argv)
|
|||
mapnik::transcoder tr("utf-8");
|
||||
mapnik::value_unicode_string ustr = tr.transcode("hello world!");
|
||||
feature->put("name",ustr);
|
||||
mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point);
|
||||
std::auto_ptr<mapnik::geometry_type> pt(new mapnik::geometry_type(mapnik::Point));
|
||||
pt->move_to(128,128);
|
||||
feature->add_geometry(pt);
|
||||
feature->add_geometry(pt.release());
|
||||
boost::shared_ptr<mapnik::memory_datasource> ds = boost::make_shared<mapnik::memory_datasource>();
|
||||
ds->push(feature);
|
||||
mapnik::Map m(256,256);
|
||||
|
|
Loading…
Add table
Reference in a new issue