Merge remote-tracking branch 'origin/feature_impl' into feature_impl

This commit is contained in:
Artem Pavlenko 2012-01-17 17:41:12 -05:00 committed by Artem Pavlenko
commit f3e99b63ad
8 changed files with 37 additions and 30 deletions

View file

@ -64,9 +64,9 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset,
dy_(dy),
nbands_(nbands),
filter_factor_(filter_factor),
first_(true)
first_(true),
ctx_(boost::make_shared<mapnik::context>())
{
ctx_ = boost::make_shared<mapnik::context>();
ctx_->push("NODATA");
}

View file

@ -60,8 +60,10 @@ geos_featureset::geos_featureset(GEOSGeometry* geometry,
identifier_(identifier),
field_(field),
field_name_(field_name),
already_rendered_(false)
already_rendered_(false),
ctx_(boost::make_shared<mapnik::context>())
{
ctx_->push(field_name);
}
geos_featureset::~geos_featureset()
@ -114,14 +116,14 @@ feature_ptr geos_featureset::next()
geos_wkb_ptr wkb(geometry_);
if (wkb.is_valid())
{
feature_ptr feature(feature_factory::create(identifier_));
feature_ptr feature(feature_factory::create(ctx_,identifier_));
geometry_utils::from_wkb(feature->paths(),
wkb.data(),
wkb.size());
if (field_ != "")
{
boost::put(*feature, field_name_, tr_->transcode(field_.c_str()));
feature->put(field_name_, tr_->transcode(field_.c_str()));
}
return feature;

View file

@ -56,6 +56,7 @@ private:
std::string field_;
std::string field_name_;
bool already_rendered_;
mapnik::context_ptr ctx_;
geos_featureset(const geos_featureset&);
const geos_featureset& operator=(const geos_featureset&);

View file

@ -40,15 +40,17 @@ using mapnik::geometry_utils;
using mapnik::transcoder;
using mapnik::feature_factory;
kismet_featureset::kismet_featureset(const std::list<kismet_network_data>& knd_list,
kismet_featureset::kismet_featureset(std::list<kismet_network_data> const& knd_list,
std::string const& srs,
std::string const& encoding)
: knd_list_(knd_list),
tr_(new transcoder(encoding)),
feature_id_(1),
knd_list_it(knd_list_.begin()),
source_(srs)
source_(srs),
ctx_(boost::make_shared<mapnik::context>())
{
ctx_->push("internet_access");
}
kismet_featureset::~kismet_featureset()
@ -76,14 +78,14 @@ feature_ptr kismet_featureset::next()
value = "wlan_crypted";
}
feature_ptr feature(feature_factory::create(feature_id_));
feature_ptr feature(feature_factory::create(ctx_,feature_id_));
++feature_id_;
geometry_type* pt = new geometry_type(mapnik::Point);
pt->move_to(knd.bestlon(), knd.bestlat());
feature->add_geometry(pt);
boost::put(*feature, key, tr_->transcode(value.c_str()));
feature->put(key, tr_->transcode(value.c_str()));
++knd_list_it;

View file

@ -40,19 +40,20 @@
class kismet_featureset : public mapnik::Featureset
{
public:
kismet_featureset(const std::list<kismet_network_data>& knd_list,
kismet_featureset(std::list<kismet_network_data> const& knd_list,
std::string const& srs,
std::string const& encoding);
virtual ~kismet_featureset();
mapnik::feature_ptr next();
private:
const std::list<kismet_network_data>& knd_list_;
std::list<kismet_network_data> const& knd_list_;
boost::scoped_ptr<mapnik::transcoder> tr_;
mapnik::wkbFormat format_;
int feature_id_;
std::list<kismet_network_data>::const_iterator knd_list_it;
mapnik::projection source_;
mapnik::context_ptr ctx_;
};
#endif // KISMET_FEATURESET_HPP

View file

@ -492,10 +492,11 @@ featureset_ptr occi_datasource::features(query const& q) const
std::set<std::string> const& props = q.property_names();
std::set<std::string>::const_iterator pos = props.begin();
std::set<std::string>::const_iterator end = props.end();
while (pos != end)
mapnik::context_ptr ctx = boost::make_shared<mapnik::context>();
for ( ;pos != end;++pos)
{
s << ", " << *pos;
++pos;
ctx->push(*pos);
}
s << " FROM ";
@ -557,11 +558,11 @@ featureset_ptr occi_datasource::features(query const& q) const
return boost::make_shared<occi_featureset>(pool_,
conn_,
ctx,
s.str(),
desc_.get_encoding(),
use_connection_pool_,
row_prefetch_,
props.size());
row_prefetch_);
}
featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
@ -572,12 +573,12 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
s << "SELECT " << geometry_field_;
std::vector<attribute_descriptor>::const_iterator itr = desc_.get_descriptors().begin();
std::vector<attribute_descriptor>::const_iterator end = desc_.get_descriptors().end();
unsigned size = 0;
mapnik::context_ptr ctx = boost::make_shared<mapnik::context>();
while (itr != end)
{
s << ", " << itr->get_name();
ctx->push(itr->get_name());
++itr;
++size;
}
s << " FROM ";
@ -638,9 +639,9 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
return boost::make_shared<occi_featureset>(pool_,
conn_,
ctx,
s.str(),
desc_.get_encoding(),
use_connection_pool_,
row_prefetch_,
size);
row_prefetch_);
}

View file

@ -57,14 +57,14 @@ using oracle::occi::Blob;
occi_featureset::occi_featureset(StatelessConnectionPool* pool,
Connection* conn,
mapnik::context_ptr const& ctx,
std::string const& sqlstring,
std::string const& encoding,
bool use_connection_pool,
unsigned prefetch_rows,
unsigned num_attrs)
unsigned prefetch_rows)
: tr_(new transcoder(encoding)),
num_attrs_(num_attrs),
feature_id_(1)
feature_id_(1),
ctx_(ctx)
{
if (use_connection_pool)
{
@ -93,7 +93,7 @@ feature_ptr occi_featureset::next()
{
if (rs_ && rs_->next())
{
feature_ptr feature(feature_factory::create(feature_id_));
feature_ptr feature(feature_factory::create(ctx_,feature_id_));
++feature_id_;
boost::scoped_ptr<SDOGeometry> geom(dynamic_cast<SDOGeometry*>(rs_->getObject(1)));
@ -125,7 +125,7 @@ feature_ptr occi_featureset::next()
case oracle::occi::OCCIINT:
case oracle::occi::OCCIUNSIGNED_INT:
case oracle::occi::OCCIROWID:
boost::put(*feature,fld_name,rs_->getInt (i + 1));
feature->put(fld_name,rs_->getInt (i + 1));
break;
case oracle::occi::OCCIFLOAT:
case oracle::occi::OCCIBFLOAT:
@ -133,7 +133,7 @@ feature_ptr occi_featureset::next()
case oracle::occi::OCCIBDOUBLE:
case oracle::occi::OCCINUMBER:
case oracle::occi::OCCI_SQLT_NUM:
boost::put(*feature,fld_name,rs_->getDouble (i + 1));
feature->put(fld_name,rs_->getDouble (i + 1));
break;
case oracle::occi::OCCICHAR:
case oracle::occi::OCCISTRING:
@ -147,7 +147,7 @@ feature_ptr occi_featureset::next()
case oracle::occi::OCCI_SQLT_VNU:
case oracle::occi::OCCI_SQLT_VBI:
case oracle::occi::OCCI_SQLT_VST:
boost::put(*feature,fld_name,(UnicodeString) tr_->transcode (rs_->getString (i + 1).c_str()));
feature->put(fld_name,(UnicodeString) tr_->transcode (rs_->getString (i + 1).c_str()));
break;
case oracle::occi::OCCIDATE:
case oracle::occi::OCCITIMESTAMP:

View file

@ -40,11 +40,11 @@ class occi_featureset : public mapnik::Featureset
public:
occi_featureset(oracle::occi::StatelessConnectionPool* pool,
oracle::occi::Connection* conn,
mapnik::context_ptr const& ctx,
std::string const& sqlstring,
std::string const& encoding,
bool use_connection_pool,
unsigned prefetch_rows,
unsigned num_attrs);
unsigned prefetch_rows);
virtual ~occi_featureset();
mapnik::feature_ptr next();
@ -68,8 +68,8 @@ private:
oracle::occi::ResultSet* rs_;
boost::scoped_ptr<mapnik::transcoder> tr_;
const char* fidcolumn_;
unsigned num_attrs_;
mutable int feature_id_;
mapnik::context_ptr ctx_;
};
#endif // OCCI_FEATURESET_HPP