Navigation Menu

Skip to content

Commit

Permalink
shape.input: remove set_id() method as it's no longer required ref #1020
Browse files Browse the repository at this point in the history
  • Loading branch information
artemp committed Oct 20, 2015
1 parent 5de3a37 commit ab2d86c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
4 changes: 1 addition & 3 deletions include/mapnik/feature.hpp
Expand Up @@ -110,8 +110,6 @@ class MAPNIK_DECL feature_impl : private util::noncopyable

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)
{
Expand Down Expand Up @@ -259,7 +257,7 @@ class MAPNIK_DECL feature_impl : private util::noncopyable
}

private:
mapnik::value_integer id_;
const mapnik::value_integer id_;
context_ptr ctx_;
cont_type data_;
geometry::geometry<double> geom_;
Expand Down
7 changes: 3 additions & 4 deletions plugins/input/shape/shape_featureset.cpp
Expand Up @@ -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);
Expand All @@ -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:
Expand Down Expand Up @@ -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_);
Expand Down
11 changes: 4 additions & 7 deletions plugins/input/shape/shape_index_featureset.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 (...)
Expand Down
1 change: 1 addition & 0 deletions plugins/input/shape/shape_io.hpp
Expand Up @@ -75,6 +75,7 @@ struct shape_io : mapnik::util::noncopyable
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);
Expand Down

0 comments on commit ab2d86c

Please sign in to comment.