From 873e23f7307029b6e8ee50321dde9680d15ed772 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Mon, 16 Jan 2012 17:55:44 -0500 Subject: [PATCH] feature_impl update --- plugins/input/gdal/gdal_featureset.cpp | 18 ++++++++++-------- plugins/input/gdal/gdal_featureset.hpp | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/plugins/input/gdal/gdal_featureset.cpp b/plugins/input/gdal/gdal_featureset.cpp index 09c2b10c8..218faf158 100644 --- a/plugins/input/gdal/gdal_featureset.cpp +++ b/plugins/input/gdal/gdal_featureset.cpp @@ -66,6 +66,8 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset, filter_factor_(filter_factor), first_(true) { + ctx_ = boost::make_shared(); + ctx_->push("NODATA"); } gdal_featureset::~gdal_featureset() @@ -106,14 +108,14 @@ feature_ptr gdal_featureset::next() feature_ptr gdal_featureset::get_feature(mapnik::query const& q) { - feature_ptr feature(feature_factory::create(1)); - + feature_ptr feature = feature_factory::create(ctx_,1); + GDALRasterBand * red = 0; GDALRasterBand * green = 0; GDALRasterBand * blue = 0; GDALRasterBand * alpha = 0; GDALRasterBand * grey = 0; - + /* double tr[6]; dataset_.GetGeoTransform(tr); @@ -244,10 +246,10 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) imageData, image.width(), image.height(), GDT_Float32, 0, 0); - feature->set_raster(mapnik::raster_ptr(boost::make_shared(intersect,image))); + feature->set_raster(boost::make_shared(intersect,image)); if (hasNoData) { - feature->props()["NODATA"] = nodata; + feature->put("NODATA",nodata); } } else // working with all bands @@ -487,12 +489,12 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt) if (! hasNoData || value != nodata) { - // construct feature - feature_ptr feature(new Feature(1)); + // construct feature + feature_ptr feature = feature_factory::create(ctx_,1); geometry_type * point = new geometry_type(mapnik::Point); point->move_to(pt.x, pt.y); feature->add_geometry(point); - (*feature)["value"] = value; + feature->put("value",value); return feature; } } diff --git a/plugins/input/gdal/gdal_featureset.hpp b/plugins/input/gdal/gdal_featureset.hpp index 5dc08ac8a..d4a2e9db8 100644 --- a/plugins/input/gdal/gdal_featureset.hpp +++ b/plugins/input/gdal/gdal_featureset.hpp @@ -24,6 +24,7 @@ #define GDAL_FEATURESET_HPP // mapnik +#include #include // boost @@ -56,6 +57,7 @@ private: void get_overview_meta(GDALRasterBand * band); #endif GDALDataset & dataset_; + mapnik::context_ptr ctx_; int band_; gdal_query gquery_; mapnik::box2d raster_extent_;