Merge branch 'feature_impl' of github.com:mapnik/mapnik into feature_impl
This commit is contained in:
commit
9bb9a34323
4 changed files with 14 additions and 12 deletions
|
@ -46,7 +46,8 @@ osm_featureset<filterT>::osm_featureset(const filterT& filter,
|
||||||
tr_(new transcoder(encoding)),
|
tr_(new transcoder(encoding)),
|
||||||
feature_id_(1),
|
feature_id_(1),
|
||||||
dataset_ (dataset),
|
dataset_ (dataset),
|
||||||
attribute_names_ (attribute_names)
|
attribute_names_ (attribute_names),
|
||||||
|
ctx_(boost::make_shared<mapnik::context>())
|
||||||
{
|
{
|
||||||
dataset_->rewind();
|
dataset_->rewind();
|
||||||
}
|
}
|
||||||
|
@ -62,7 +63,7 @@ feature_ptr osm_featureset<filterT>::next()
|
||||||
{
|
{
|
||||||
if (dataset_->current_item_is_node())
|
if (dataset_->current_item_is_node())
|
||||||
{
|
{
|
||||||
feature = feature_factory::create(feature_id_);
|
feature = feature_factory::create(ctx_,feature_id_);
|
||||||
++feature_id_;
|
++feature_id_;
|
||||||
double lat = static_cast<osm_node*>(cur_item)->lat;
|
double lat = static_cast<osm_node*>(cur_item)->lat;
|
||||||
double lon = static_cast<osm_node*>(cur_item)->lon;
|
double lon = static_cast<osm_node*>(cur_item)->lon;
|
||||||
|
@ -90,7 +91,7 @@ feature_ptr osm_featureset<filterT>::next()
|
||||||
{
|
{
|
||||||
if (static_cast<osm_way*>(cur_item)->nodes.size())
|
if (static_cast<osm_way*>(cur_item)->nodes.size())
|
||||||
{
|
{
|
||||||
feature = feature_factory::create(feature_id_);
|
feature = feature_factory::create(ctx_,feature_id_);
|
||||||
++feature_id_;
|
++feature_id_;
|
||||||
geometry_type* geom;
|
geometry_type* geom;
|
||||||
if (static_cast<osm_way*>(cur_item)->is_polygon())
|
if (static_cast<osm_way*>(cur_item)->is_polygon())
|
||||||
|
@ -131,7 +132,7 @@ feature_ptr osm_featureset<filterT>::next()
|
||||||
// only add if in the specified set of attribute names
|
// only add if in the specified set of attribute names
|
||||||
if (attribute_names_.find(i->first) != attribute_names_.end())
|
if (attribute_names_.find(i->first) != attribute_names_.end())
|
||||||
{
|
{
|
||||||
(*feature)[i->first] = tr_->transcode(i->second.c_str());
|
feature->put(i->first,tr_->transcode(i->second.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -63,6 +63,7 @@ private:
|
||||||
mutable int feature_id_;
|
mutable int feature_id_;
|
||||||
osm_dataset *dataset_;
|
osm_dataset *dataset_;
|
||||||
std::set<std::string> attribute_names_;
|
std::set<std::string> attribute_names_;
|
||||||
|
mapnik::context_ptr ctx_;
|
||||||
// no copying
|
// no copying
|
||||||
osm_featureset(const osm_featureset&);
|
osm_featureset(const osm_featureset&);
|
||||||
const osm_featureset& operator=(const osm_featureset&);
|
const osm_featureset& operator=(const osm_featureset&);
|
||||||
|
|
|
@ -51,7 +51,8 @@ sqlite_featureset::sqlite_featureset(boost::shared_ptr<sqlite_resultset> rs,
|
||||||
: rs_(rs),
|
: rs_(rs),
|
||||||
tr_(new transcoder(encoding)),
|
tr_(new transcoder(encoding)),
|
||||||
format_(format),
|
format_(format),
|
||||||
using_subquery_(using_subquery)
|
using_subquery_(using_subquery),
|
||||||
|
ctx_(boost::make_shared<mapnik::context>())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,9 +71,7 @@ feature_ptr sqlite_featureset::next()
|
||||||
return feature_ptr();
|
return feature_ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
int feature_id = rs_->column_integer(1);
|
feature_ptr feature(feature_factory::create(ctx_,rs_->column_integer(1)));
|
||||||
|
|
||||||
feature_ptr feature(feature_factory::create(feature_id));
|
|
||||||
geometry_utils::from_wkb(feature->paths(), data, size, format_);
|
geometry_utils::from_wkb(feature->paths(), data, size, format_);
|
||||||
|
|
||||||
for (int i = 2; i < rs_->column_count(); ++i)
|
for (int i = 2; i < rs_->column_count(); ++i)
|
||||||
|
@ -95,13 +94,13 @@ feature_ptr sqlite_featureset::next()
|
||||||
{
|
{
|
||||||
case SQLITE_INTEGER:
|
case SQLITE_INTEGER:
|
||||||
{
|
{
|
||||||
boost::put(*feature, fld_name_str, rs_->column_integer(i));
|
feature->put(fld_name_str, rs_->column_integer(i));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SQLITE_FLOAT:
|
case SQLITE_FLOAT:
|
||||||
{
|
{
|
||||||
boost::put(*feature, fld_name_str, rs_->column_double(i));
|
feature->put(fld_name_str, rs_->column_double(i));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,13 +109,13 @@ feature_ptr sqlite_featureset::next()
|
||||||
int text_size;
|
int text_size;
|
||||||
const char * data = rs_->column_text(i, text_size);
|
const char * data = rs_->column_text(i, text_size);
|
||||||
UnicodeString ustr = tr_->transcode(data, text_size);
|
UnicodeString ustr = tr_->transcode(data, text_size);
|
||||||
boost::put(*feature, fld_name_str, ustr);
|
feature->put(fld_name_str, ustr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SQLITE_NULL:
|
case SQLITE_NULL:
|
||||||
{
|
{
|
||||||
boost::put(*feature, fld_name_str, mapnik::value_null());
|
feature->put(fld_name_str, mapnik::value_null());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ private:
|
||||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||||
mapnik::wkbFormat format_;
|
mapnik::wkbFormat format_;
|
||||||
bool using_subquery_;
|
bool using_subquery_;
|
||||||
|
mapnik::context_ptr ctx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAPNIK_SQLITE_FEATURESET_HPP
|
#endif // MAPNIK_SQLITE_FEATURESET_HPP
|
||||||
|
|
Loading…
Reference in a new issue