diff --git a/include/envelope.hpp b/include/envelope.hpp index 0e94099b1..05086e2c3 100644 --- a/include/envelope.hpp +++ b/include/envelope.hpp @@ -62,7 +62,15 @@ namespace mapnik bool operator==(const EnvelopeType &other) const; void re_center(T cx,T cy); void init(T x0,T y0,T x1,T y1); + std::string to_string() const; }; + + + template + inline std::string Envelope::to_string() const + { + return "envelope - TODO"; + } template inline std::basic_ostream& diff --git a/include/filter_factory.hpp b/include/filter_factory.hpp index fec3001a6..ef8910ad8 100644 --- a/include/filter_factory.hpp +++ b/include/filter_factory.hpp @@ -28,8 +28,7 @@ namespace mapnik class filter_factory { public: - filter_factory() {} - filter_ptr compile(string const& str) const + static filter_ptr compile(string const& str) { stack > > filters; stack > > exps; @@ -38,14 +37,12 @@ namespace mapnik parse_info<> info = parse(text,text+strlen(text),grammar,space_p); if (info.full && !filters.empty()) { - cout<<"success parsing filter expression:\n"; - cout<to_string()<<"\n"; return filters.top(); } else { - cout << "failed at :" << info.stop << "\n"; - return filter_ptr(new all_filter()); + cerr << "failed at :" << info.stop << "\n"; + return filter_ptr(new none_filter()); } } }; diff --git a/include/filter_parser.hpp b/include/filter_parser.hpp index a37e17713..9e3fde45a 100644 --- a/include/filter_parser.hpp +++ b/include/filter_parser.hpp @@ -38,7 +38,6 @@ using namespace boost::spirit; using std::string; -using std::cout; using std::cerr; using std::stack; @@ -87,7 +86,6 @@ namespace mapnik str.erase(idx,1); idx = str.find(quote); } - cout << "string(\""< >(new literal(str))); } stack > >& exprs_; @@ -153,9 +151,9 @@ namespace mapnik { filters_.push(ref_ptr >(new regex_filter(*exp,pattern))); } - catch (boost::regex_error& ex) + catch (...)//boost::regex_error& ex) { - cerr<::*width_p1)(double) = &Envelope::width; +double (Envelope::*width_p2)() const = &Envelope::width; + +void (Envelope::*height_p1)(double) = &Envelope::height; +double (Envelope::*height_p2)() const = &Envelope::height; + +void (Envelope::*expand_to_include_p1)(double,double) = &Envelope::expand_to_include; +void (Envelope::*expand_to_include_p2)(coord const& ) = &Envelope::expand_to_include; +void (Envelope::*expand_to_include_p3)(Envelope const& ) = &Envelope::expand_to_include; + +bool (Envelope::*contains_p1)(double,double) const = &Envelope::contains; +bool (Envelope::*contains_p2)(coord const&) const = &Envelope::contains; +bool (Envelope::*contains_p3)(Envelope const&) const = &Envelope::contains; + +bool (Envelope::*intersects_p1)(double,double) const = &Envelope::intersects; +bool (Envelope::*intersects_p2)(coord const&) const = &Envelope::intersects; +bool (Envelope::*intersects_p3)(Envelope const&) const = &Envelope::intersects; + + void export_envelope() { using namespace boost::python; @@ -45,6 +65,21 @@ void export_envelope() .add_property("maxx",&Envelope::maxx) .add_property("maxy",&Envelope::maxy) .def("center",&Envelope::center) + .def("center",&Envelope::re_center) + .def("width",width_p1) + .def("width",width_p2) + .def("height",height_p1) + .def("height",height_p2) + .def("expand_to_include",expand_to_include_p1) + .def("expand_to_include",expand_to_include_p2) + .def("expand_to_include",expand_to_include_p3) + .def("contains",contains_p1) + .def("contains",contains_p2) + .def("contains",contains_p3) + .def("intersects",intersects_p1) + .def("intersects",intersects_p2) + .def("intersects",intersects_p3) + .def(self == self) .def_pickle(envelope_pickle_suite()) ; } diff --git a/python/mapnik_filter.cpp b/python/mapnik_filter.cpp index ab1791744..748ea5251 100644 --- a/python/mapnik_filter.cpp +++ b/python/mapnik_filter.cpp @@ -32,8 +32,7 @@ namespace using namespace boost::python; filter_ptr create_filter(string const& filter_text) { - filter_factory factory; - return factory.compile(filter_text); + return filter_factory::compile(filter_text); } }