fixed test for eof in featuresets

This commit is contained in:
Artem Pavlenko 2005-10-26 21:37:13 +00:00
parent d9973561ad
commit fc015c3a10
2 changed files with 12 additions and 4 deletions

View file

@ -94,9 +94,16 @@ feature_ptr shape_featureset<filterT>::next()
while (!filter_.pass(shape_.current_extent())) while (!filter_.pass(shape_.current_extent()))
{ {
unsigned reclen=shape_.reclength_; unsigned reclen=shape_.reclength_;
shape_.move_to(long(shape_.shp().pos()) + 2 * reclen - 36); if (!shape_.shp().is_eof())
if ((long)shape_.shp().pos() >= file_length_ * 2) {
long pos = shape_.shp().pos();
shape_.move_to(pos + 2 * reclen - 36);
}
else
{
return feature_ptr(0); return feature_ptr(0);
}
} }
switch (type) switch (type)

View file

@ -19,6 +19,7 @@
//$Id: shape_index_featureset.cc 36 2005-04-05 14:32:18Z pavlenko $ //$Id: shape_index_featureset.cc 36 2005-04-05 14:32:18Z pavlenko $
#include "shape_index_featureset.hpp" #include "shape_index_featureset.hpp"
#include "feature_factory.hpp"
template <typename filterT> template <typename filterT>
shape_index_featureset<filterT>::shape_index_featureset(const filterT& filter, shape_index_featureset<filterT>::shape_index_featureset(const filterT& filter,
@ -66,7 +67,7 @@ feature_ptr shape_index_featureset<filterT>::next()
int pos=*itr_++; int pos=*itr_++;
shape_.move_to(pos); shape_.move_to(pos);
int type=shape_.type(); int type=shape_.type();
feature_ptr feature(new Feature(shape_.id_)); feature_ptr feature(feature_factory::create(shape_.id_));
if (type==shape_io::shape_point) if (type==shape_io::shape_point)
{ {