This commit is contained in:
parent
5de3a3776d
commit
ab2d86c617
4 changed files with 9 additions and 14 deletions
|
@ -110,8 +110,6 @@ public:
|
|||
|
||||
inline mapnik::value_integer id() const { return id_;}
|
||||
|
||||
inline void set_id(mapnik::value_integer id) { id_ = id;}
|
||||
|
||||
template <typename T>
|
||||
inline void put(context_type::key_type const& key, T const& val)
|
||||
{
|
||||
|
@ -259,7 +257,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
mapnik::value_integer id_;
|
||||
const mapnik::value_integer id_;
|
||||
context_ptr ctx_;
|
||||
cont_type data_;
|
||||
geometry::geometry<double> geom_;
|
||||
|
|
|
@ -69,7 +69,8 @@ feature_ptr shape_featureset<filterT>::next()
|
|||
{
|
||||
int offset = shape_.shx().read_xdr_integer();
|
||||
int record_length = shape_.shx().read_xdr_integer();
|
||||
shape_.move_to(2*offset);
|
||||
shape_.move_to(2 * offset);
|
||||
mapnik::value_integer feature_id = shape_.id();
|
||||
assert(record_length == shape_.reclength_);
|
||||
shape_file::record_type record(record_length * 2);
|
||||
shape_.shp().read_record(record);
|
||||
|
@ -78,7 +79,7 @@ feature_ptr shape_featureset<filterT>::next()
|
|||
// skip null shapes
|
||||
if (type == shape_io::shape_null) continue;
|
||||
|
||||
feature_ptr feature(feature_factory::create(ctx_, shape_.id_));
|
||||
feature_ptr feature(feature_factory::create(ctx_, feature_id));
|
||||
switch (type)
|
||||
{
|
||||
case shape_io::shape_point:
|
||||
|
@ -133,8 +134,6 @@ feature_ptr shape_featureset<filterT>::next()
|
|||
return feature_ptr();
|
||||
}
|
||||
|
||||
// FIXME: https://github.com/mapnik/mapnik/issues/1020
|
||||
feature->set_id(shape_.id_);
|
||||
if (attr_ids_.size())
|
||||
{
|
||||
shape_.dbf().move_to(shape_.id_);
|
||||
|
|
|
@ -85,10 +85,11 @@ feature_ptr shape_index_featureset<filterT>::next()
|
|||
while ( itr_ != offsets_.end())
|
||||
{
|
||||
shape_ptr_->move_to(*itr_++);
|
||||
mapnik::value_integer feature_id = shape_ptr_->id();
|
||||
shape_file::record_type record(shape_ptr_->reclength_ * 2);
|
||||
shape_ptr_->shp().read_record(record);
|
||||
int type = record.read_ndr_integer();
|
||||
feature_ptr feature(feature_factory::create(ctx_,shape_ptr_->id_));
|
||||
feature_ptr feature(feature_factory::create(ctx_, feature_id));
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -141,18 +142,14 @@ feature_ptr shape_index_featureset<filterT>::next()
|
|||
return feature_ptr();
|
||||
}
|
||||
|
||||
// FIXME: https://github.com/mapnik/mapnik/issues/1020
|
||||
feature->set_id(shape_ptr_->id_);
|
||||
if (attr_ids_.size())
|
||||
{
|
||||
shape_ptr_->dbf().move_to(shape_ptr_->id_);
|
||||
std::vector<int>::const_iterator itr = attr_ids_.begin();
|
||||
std::vector<int>::const_iterator end = attr_ids_.end();
|
||||
try
|
||||
{
|
||||
for (; itr!=end; ++itr)
|
||||
for (auto id : attr_ids_)
|
||||
{
|
||||
shape_ptr_->dbf().add_attribute(*itr, *tr_, *feature);
|
||||
shape_ptr_->dbf().add_attribute(id, *tr_, *feature);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
|
|
|
@ -75,6 +75,7 @@ public:
|
|||
return (index_ && index_->is_open());
|
||||
}
|
||||
|
||||
inline int id() const { return id_;}
|
||||
void move_to(std::streampos pos);
|
||||
static void read_bbox(shape_file::record_type & record, mapnik::box2d<double> & bbox);
|
||||
static mapnik::geometry::geometry<double> read_polyline(shape_file::record_type & record);
|
||||
|
|
Loading…
Reference in a new issue