Merge branch 'feature_impl' of github.com:mapnik/mapnik into feature_impl
This commit is contained in:
commit
cc9db7c7d3
4 changed files with 16 additions and 12 deletions
|
@ -55,7 +55,8 @@ ogr_featureset::ogr_featureset(OGRDataSource & dataset,
|
||||||
layerdef_(layer.GetLayerDefn()),
|
layerdef_(layer.GetLayerDefn()),
|
||||||
tr_(new transcoder(encoding)),
|
tr_(new transcoder(encoding)),
|
||||||
fidcolumn_(layer_.GetFIDColumn ()),
|
fidcolumn_(layer_.GetFIDColumn ()),
|
||||||
count_(0)
|
count_(0),
|
||||||
|
ctx_(boost::make_shared<mapnik::context>())
|
||||||
{
|
{
|
||||||
layer_.SetSpatialFilter (&extent);
|
layer_.SetSpatialFilter (&extent);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +91,7 @@ feature_ptr ogr_featureset::next()
|
||||||
// ogr feature ids start at 0, so add one to stay
|
// ogr feature ids start at 0, so add one to stay
|
||||||
// consistent with other mapnik datasources that start at 1
|
// consistent with other mapnik datasources that start at 1
|
||||||
const int feature_id = ((*feat)->GetFID() + 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();
|
OGRGeometry* geom = (*feat)->GetGeometryRef();
|
||||||
if (geom && ! geom->IsEmpty())
|
if (geom && ! geom->IsEmpty())
|
||||||
|
@ -117,13 +118,13 @@ feature_ptr ogr_featureset::next()
|
||||||
{
|
{
|
||||||
case OFTInteger:
|
case OFTInteger:
|
||||||
{
|
{
|
||||||
boost::put(*feature, fld_name, (*feat)->GetFieldAsInteger(i));
|
feature->put( fld_name, (*feat)->GetFieldAsInteger(i));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OFTReal:
|
case OFTReal:
|
||||||
{
|
{
|
||||||
boost::put(*feature, fld_name, (*feat)->GetFieldAsDouble(i));
|
feature->put( fld_name, (*feat)->GetFieldAsDouble(i));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +132,7 @@ feature_ptr ogr_featureset::next()
|
||||||
case OFTWideString: // deprecated !
|
case OFTWideString: // deprecated !
|
||||||
{
|
{
|
||||||
UnicodeString ustr = tr_->transcode((*feat)->GetFieldAsString(i));
|
UnicodeString ustr = tr_->transcode((*feat)->GetFieldAsString(i));
|
||||||
boost::put(*feature, fld_name, ustr);
|
feature->put( fld_name, ustr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +152,7 @@ feature_ptr ogr_featureset::next()
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
std::clog << "OGR Plugin: unhandled type_oid=" << type_oid << std::endl;
|
std::clog << "OGR Plugin: unhandled type_oid=" << type_oid << std::endl;
|
||||||
#endif
|
#endif
|
||||||
//boost::put(*feature,name,feat->GetFieldAsBinary (i, size));
|
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ private:
|
||||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||||
const char* fidcolumn_;
|
const char* fidcolumn_;
|
||||||
mutable int count_;
|
mutable int count_;
|
||||||
|
mapnik::context_ptr ctx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OGR_FEATURESET_HPP
|
#endif // OGR_FEATURESET_HPP
|
||||||
|
|
|
@ -62,7 +62,8 @@ ogr_index_featureset<filterT>::ogr_index_featureset(OGRDataSource & dataset,
|
||||||
layerdef_(layer.GetLayerDefn()),
|
layerdef_(layer.GetLayerDefn()),
|
||||||
filter_(filter),
|
filter_(filter),
|
||||||
tr_(new transcoder(encoding)),
|
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);
|
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
|
// ogr feature ids start at 0, so add one to stay
|
||||||
// consistent with other mapnik datasources that start at 1
|
// consistent with other mapnik datasources that start at 1
|
||||||
int feature_id = ((*feat)->GetFID() + 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();
|
OGRGeometry* geom=(*feat)->GetGeometryRef();
|
||||||
if (geom && !geom->IsEmpty())
|
if (geom && !geom->IsEmpty())
|
||||||
|
@ -126,13 +127,13 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
{
|
{
|
||||||
case OFTInteger:
|
case OFTInteger:
|
||||||
{
|
{
|
||||||
boost::put(*feature,fld_name,(*feat)->GetFieldAsInteger (i));
|
feature->put(fld_name,(*feat)->GetFieldAsInteger (i));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OFTReal:
|
case OFTReal:
|
||||||
{
|
{
|
||||||
boost::put(*feature,fld_name,(*feat)->GetFieldAsDouble (i));
|
feature->put(fld_name,(*feat)->GetFieldAsDouble (i));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +141,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
case OFTWideString: // deprecated !
|
case OFTWideString: // deprecated !
|
||||||
{
|
{
|
||||||
UnicodeString ustr = tr_->transcode((*feat)->GetFieldAsString (i));
|
UnicodeString ustr = tr_->transcode((*feat)->GetFieldAsString (i));
|
||||||
boost::put(*feature,fld_name,ustr);
|
feature->put(fld_name,ustr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +161,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
std::clog << "OGR Plugin: unhandled type_oid=" << type_oid << std::endl;
|
std::clog << "OGR Plugin: unhandled type_oid=" << type_oid << std::endl;
|
||||||
#endif
|
#endif
|
||||||
//boost::put(*feature,name,feat->GetFieldAsBinary (i, size));
|
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ private:
|
||||||
std::vector<int>::iterator itr_;
|
std::vector<int>::iterator itr_;
|
||||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||||
const char* fidcolumn_;
|
const char* fidcolumn_;
|
||||||
|
mapnik::context_ptr ctx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OGR_INDEX_FEATURESET_HPP
|
#endif // OGR_INDEX_FEATURESET_HPP
|
||||||
|
|
Loading…
Reference in a new issue