Merge branch 'feature_impl' of github.com:mapnik/mapnik into feature_impl

This commit is contained in:
Artem Pavlenko 2012-01-19 16:12:11 -05:00
commit cc9db7c7d3
4 changed files with 16 additions and 12 deletions

View file

@ -55,7 +55,8 @@ ogr_featureset::ogr_featureset(OGRDataSource & dataset,
layerdef_(layer.GetLayerDefn()),
tr_(new transcoder(encoding)),
fidcolumn_(layer_.GetFIDColumn ()),
count_(0)
count_(0),
ctx_(boost::make_shared<mapnik::context>())
{
layer_.SetSpatialFilter (&extent);
}
@ -90,7 +91,7 @@ feature_ptr ogr_featureset::next()
// ogr feature ids start at 0, so add one to stay
// consistent with other mapnik datasources that start at 1
const int feature_id = ((*feat)->GetFID() + 1);
feature_ptr feature(feature_factory::create(feature_id));
feature_ptr feature(feature_factory::create(ctx_,feature_id));
OGRGeometry* geom = (*feat)->GetGeometryRef();
if (geom && ! geom->IsEmpty())
@ -117,13 +118,13 @@ feature_ptr ogr_featureset::next()
{
case OFTInteger:
{
boost::put(*feature, fld_name, (*feat)->GetFieldAsInteger(i));
feature->put( fld_name, (*feat)->GetFieldAsInteger(i));
break;
}
case OFTReal:
{
boost::put(*feature, fld_name, (*feat)->GetFieldAsDouble(i));
feature->put( fld_name, (*feat)->GetFieldAsDouble(i));
break;
}
@ -131,7 +132,7 @@ feature_ptr ogr_featureset::next()
case OFTWideString: // deprecated !
{
UnicodeString ustr = tr_->transcode((*feat)->GetFieldAsString(i));
boost::put(*feature, fld_name, ustr);
feature->put( fld_name, ustr);
break;
}
@ -151,7 +152,7 @@ feature_ptr ogr_featureset::next()
#ifdef MAPNIK_DEBUG
std::clog << "OGR Plugin: unhandled type_oid=" << type_oid << std::endl;
#endif
//boost::put(*feature,name,feat->GetFieldAsBinary (i, size));
//feature->put(name,feat->GetFieldAsBinary (i, size));
break;
}

View file

@ -59,6 +59,7 @@ private:
boost::scoped_ptr<mapnik::transcoder> tr_;
const char* fidcolumn_;
mutable int count_;
mapnik::context_ptr ctx_;
};
#endif // OGR_FEATURESET_HPP

View file

@ -62,7 +62,8 @@ ogr_index_featureset<filterT>::ogr_index_featureset(OGRDataSource & dataset,
layerdef_(layer.GetLayerDefn()),
filter_(filter),
tr_(new transcoder(encoding)),
fidcolumn_(layer_.GetFIDColumn())
fidcolumn_(layer_.GetFIDColumn()),
ctx_(boost::make_shared<mapnik::context>())
{
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::find(index_file.c_str(),true);
@ -101,7 +102,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
// ogr feature ids start at 0, so add one to stay
// consistent with other mapnik datasources that start at 1
int feature_id = ((*feat)->GetFID() + 1);
feature_ptr feature(feature_factory::create(feature_id));
feature_ptr feature(feature_factory::create(ctx_,feature_id));
OGRGeometry* geom=(*feat)->GetGeometryRef();
if (geom && !geom->IsEmpty())
@ -126,13 +127,13 @@ feature_ptr ogr_index_featureset<filterT>::next()
{
case OFTInteger:
{
boost::put(*feature,fld_name,(*feat)->GetFieldAsInteger (i));
feature->put(fld_name,(*feat)->GetFieldAsInteger (i));
break;
}
case OFTReal:
{
boost::put(*feature,fld_name,(*feat)->GetFieldAsDouble (i));
feature->put(fld_name,(*feat)->GetFieldAsDouble (i));
break;
}
@ -140,7 +141,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
case OFTWideString: // deprecated !
{
UnicodeString ustr = tr_->transcode((*feat)->GetFieldAsString (i));
boost::put(*feature,fld_name,ustr);
feature->put(fld_name,ustr);
break;
}
@ -160,7 +161,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
#ifdef MAPNIK_DEBUG
std::clog << "OGR Plugin: unhandled type_oid=" << type_oid << std::endl;
#endif
//boost::put(*feature,name,feat->GetFieldAsBinary (i, size));
//feature->put(name,feat->GetFieldAsBinary (i, size));
break;
}

View file

@ -52,6 +52,7 @@ private:
std::vector<int>::iterator itr_;
boost::scoped_ptr<mapnik::transcoder> tr_;
const char* fidcolumn_;
mapnik::context_ptr ctx_;
};
#endif // OGR_INDEX_FEATURESET_HPP