From 48775a5cd999e924bb769ff0ac0a4a22688440f3 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Wed, 6 Jul 2005 20:52:06 +0000 Subject: [PATCH] 1.renamed null_filter -> all_filter 2.added none_filter 3.fixed some warnings in shapeindex util --- include/filter.hpp | 28 ++++++++++++++++++++++++---- include/filter_factory.hpp | 2 +- include/query.hpp | 4 ++-- include/rule.hpp | 8 ++++---- util/shapeindex/quadtree.hpp | 2 +- util/shapeindex/shapeindex.cpp | 3 +-- 6 files changed, 33 insertions(+), 14 deletions(-) diff --git a/include/filter.hpp b/include/filter.hpp index 108c49929..53396bf24 100644 --- a/include/filter.hpp +++ b/include/filter.hpp @@ -40,7 +40,7 @@ namespace mapnik template - struct null_filter : public filter + struct all_filter : public filter { bool pass (const FeatureT&) const @@ -50,16 +50,36 @@ namespace mapnik filter* clone() const { - return new null_filter; + return new all_filter; } std::string to_string() const { return "true"; } void accept(filter_visitor&) {} - virtual ~null_filter() {} + virtual ~all_filter() {} + }; + + template + struct none_filter : public filter + { + + bool pass (const FeatureT&) const + { + return false; + } + + filter* clone() const + { + return new none_filter; + } + std::string to_string() const + { + return "false"; + } + void accept(filter_visitor&) {} + virtual ~none_filter() {} }; - } #endif //FILTER_HPP diff --git a/include/filter_factory.hpp b/include/filter_factory.hpp index cd0c09a6d..fec3001a6 100644 --- a/include/filter_factory.hpp +++ b/include/filter_factory.hpp @@ -45,7 +45,7 @@ namespace mapnik else { cout << "failed at :" << info.stop << "\n"; - return filter_ptr(new null_filter()); + return filter_ptr(new all_filter()); } } }; diff --git a/include/query.hpp b/include/query.hpp index e458e9172..3cabfaa8a 100644 --- a/include/query.hpp +++ b/include/query.hpp @@ -41,12 +41,12 @@ namespace mapnik std::numeric_limits::min(), std::numeric_limits::max(), std::numeric_limits::max()), - filter_(new null_filter) + filter_(new all_filter) {} query(const Envelope& bbox) : bbox_(bbox), - filter_(new null_filter) + filter_(new all_filter) {} query(const Envelope& bbox,const filter& f) diff --git a/include/rule.hpp b/include/rule.hpp index 77741b75d..085006fdb 100644 --- a/include/rule.hpp +++ b/include/rule.hpp @@ -29,7 +29,7 @@ namespace mapnik { typedef ref_ptr symbolizer_ptr; typedef std::vector symbolizers; - template class null_filter; + template class all_filter; template class Filter> class rule @@ -54,7 +54,7 @@ namespace mapnik min_scale_(0), max_scale_(std::numeric_limits::infinity()), syms_(), - filter_(new null_filter), + filter_(new all_filter), 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::infinity()), syms_(), - filter_(new null_filter), + filter_(new all_filter), 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), + filter_(new all_filter), else_filter_(false) {} rule(const rule& rhs) diff --git a/util/shapeindex/quadtree.hpp b/util/shapeindex/quadtree.hpp index c0d2261a2..6a18e2322 100644 --- a/util/shapeindex/quadtree.hpp +++ b/util/shapeindex/quadtree.hpp @@ -30,8 +30,8 @@ using namespace mapnik; template struct quadtree_node { - std::vector data_; Envelope ext_; + std::vector data_; quadtree_node* children_[4]; quadtree_node(const Envelope& ext) : ext_(ext),data_() diff --git a/util/shapeindex/shapeindex.cpp b/util/shapeindex/shapeindex.cpp index 71e9f3b61..a7727ca5f 100644 --- a/util/shapeindex/shapeindex.cpp +++ b/util/shapeindex/shapeindex.cpp @@ -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();