1.renamed null_filter -> all_filter

2.added none_filter
3.fixed some warnings in shapeindex util
This commit is contained in:
Artem Pavlenko 2005-07-06 20:52:06 +00:00
parent c7f9d1e568
commit 48775a5cd9
6 changed files with 33 additions and 14 deletions

View file

@ -40,7 +40,7 @@ namespace mapnik
template <typename FeatureT>
struct null_filter : public filter<FeatureT>
struct all_filter : public filter<FeatureT>
{
bool pass (const FeatureT&) const
@ -50,16 +50,36 @@ namespace mapnik
filter<FeatureT>* clone() const
{
return new null_filter<FeatureT>;
return new all_filter<FeatureT>;
}
std::string to_string() const
{
return "true";
}
void accept(filter_visitor<FeatureT>&) {}
virtual ~null_filter() {}
virtual ~all_filter() {}
};
template <typename FeatureT>
struct none_filter : public filter<FeatureT>
{
bool pass (const FeatureT&) const
{
return false;
}
filter<FeatureT>* clone() const
{
return new none_filter<FeatureT>;
}
std::string to_string() const
{
return "false";
}
void accept(filter_visitor<FeatureT>&) {}
virtual ~none_filter() {}
};
}
#endif //FILTER_HPP

View file

@ -45,7 +45,7 @@ namespace mapnik
else
{
cout << "failed at :" << info.stop << "\n";
return filter_ptr(new null_filter<FeatureT>());
return filter_ptr(new all_filter<FeatureT>());
}
}
};

View file

@ -41,12 +41,12 @@ namespace mapnik
std::numeric_limits<double>::min(),
std::numeric_limits<double>::max(),
std::numeric_limits<double>::max()),
filter_(new null_filter<Feature>)
filter_(new all_filter<Feature>)
{}
query(const Envelope<double>& bbox)
: bbox_(bbox),
filter_(new null_filter<Feature>)
filter_(new all_filter<Feature>)
{}
query(const Envelope<double>& bbox,const filter<Feature>& f)

View file

@ -29,7 +29,7 @@ namespace mapnik
{
typedef ref_ptr<symbolizer> symbolizer_ptr;
typedef std::vector<symbolizer_ptr> symbolizers;
template <typename FeatureT> class null_filter;
template <typename FeatureT> class all_filter;
template <typename FeatureT,template <typename> class Filter>
class rule
@ -54,7 +54,7 @@ namespace mapnik
min_scale_(0),
max_scale_(std::numeric_limits<double>::infinity()),
syms_(),
filter_(new null_filter<FeatureT>),
filter_(new all_filter<FeatureT>),
else_filter_(false) {}
rule(const std::string& name,const std::string& title)
@ -64,7 +64,7 @@ namespace mapnik
min_scale_(0),
max_scale_(std::numeric_limits<double>::infinity()),
syms_(),
filter_(new null_filter<FeatureT>),
filter_(new all_filter<FeatureT>),
else_filter_(false) {}
rule(const std::string& name,const std::string& title,
@ -74,7 +74,7 @@ namespace mapnik
min_scale_(min_scale_denominator),
max_scale_(max_scale_denominator),
syms_(),
filter_(new null_filter<FeatureT>),
filter_(new all_filter<FeatureT>),
else_filter_(false) {}
rule(const rule& rhs)

View file

@ -30,8 +30,8 @@ using namespace mapnik;
template <typename T>
struct quadtree_node
{
std::vector<T> data_;
Envelope<double> ext_;
std::vector<T> data_;
quadtree_node<T>* children_[4];
quadtree_node(const Envelope<double>& ext)
: ext_(ext),data_()

View file

@ -115,8 +115,7 @@ int main (int argc,char** argv)
continue;
}
int file_code=shp.read_xdr_integer();
assert(file_code==9994);
shp.read_xdr_integer(); //file_code == 9994
shp.skip(5*4);
int file_length=shp.read_xdr_integer();