From c8ba832acb74c4d113b9dcc52dacfabc8f7ea28e Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 19 Jan 2012 12:55:07 -0500 Subject: [PATCH] update the ogr plugin to use new feature_impl --- plugins/input/ogr/ogr_featureset.cpp | 13 +++++++------ plugins/input/ogr/ogr_featureset.hpp | 1 + plugins/input/ogr/ogr_index_featureset.cpp | 13 +++++++------ plugins/input/ogr/ogr_index_featureset.hpp | 1 + 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/plugins/input/ogr/ogr_featureset.cpp b/plugins/input/ogr/ogr_featureset.cpp index 2e916a4bb..41a1275a8 100644 --- a/plugins/input/ogr/ogr_featureset.cpp +++ b/plugins/input/ogr/ogr_featureset.cpp @@ -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()) { 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; } diff --git a/plugins/input/ogr/ogr_featureset.hpp b/plugins/input/ogr/ogr_featureset.hpp index 7e30a1ab1..4a5c247fc 100644 --- a/plugins/input/ogr/ogr_featureset.hpp +++ b/plugins/input/ogr/ogr_featureset.hpp @@ -59,6 +59,7 @@ private: boost::scoped_ptr tr_; const char* fidcolumn_; mutable int count_; + mapnik::context_ptr ctx_; }; #endif // OGR_FEATURESET_HPP diff --git a/plugins/input/ogr/ogr_index_featureset.cpp b/plugins/input/ogr/ogr_index_featureset.cpp index 399a0aa65..b00d2dfa1 100644 --- a/plugins/input/ogr/ogr_index_featureset.cpp +++ b/plugins/input/ogr/ogr_index_featureset.cpp @@ -62,7 +62,8 @@ ogr_index_featureset::ogr_index_featureset(OGRDataSource & dataset, layerdef_(layer.GetLayerDefn()), filter_(filter), tr_(new transcoder(encoding)), - fidcolumn_(layer_.GetFIDColumn()) + fidcolumn_(layer_.GetFIDColumn()), + ctx_(boost::make_shared()) { boost::optional memory = mapnik::mapped_memory_cache::find(index_file.c_str(),true); @@ -101,7 +102,7 @@ feature_ptr ogr_index_featureset::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::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::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::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; } diff --git a/plugins/input/ogr/ogr_index_featureset.hpp b/plugins/input/ogr/ogr_index_featureset.hpp index 1d76f914b..ee011302f 100644 --- a/plugins/input/ogr/ogr_index_featureset.hpp +++ b/plugins/input/ogr/ogr_index_featureset.hpp @@ -52,6 +52,7 @@ private: std::vector::iterator itr_; boost::scoped_ptr tr_; const char* fidcolumn_; + mapnik::context_ptr ctx_; }; #endif // OGR_INDEX_FEATURESET_HPP