diff --git a/include/mapnik/geometry.hpp b/include/mapnik/geometry.hpp index 8b0eac123..d2dcc5843 100644 --- a/include/mapnik/geometry.hpp +++ b/include/mapnik/geometry.hpp @@ -20,7 +20,6 @@ * *****************************************************************************/ - //$Id: geometry.hpp 39 2005-04-10 20:39:53Z pavlenko $ #ifndef GEOMETRY_HPP @@ -81,8 +80,8 @@ namespace mapnik { virtual void rewind(unsigned) const=0; virtual void set_capacity(size_t size)=0; virtual ~geometry() {} - }; - + }; + template class point : public geometry { @@ -137,19 +136,19 @@ namespace mapnik { }; template class Container=vertex_vector2> - class polygon : public geometry + class polygon //: public geometry { - typedef geometry geometry_base; - typedef typename geometry::vertex_type vertex_type; - typedef typename geometry_base::value_type value_type; - typedef Container container_type; + typedef T vertex_type; + typedef typename vertex_type::type value_type; + typedef Container container_type; + private: container_type cont_; mutable unsigned itr_; public: polygon() - : geometry_base(), - itr_(0) + : //geometry_base(), + itr_(0) {} int type() const @@ -157,36 +156,55 @@ namespace mapnik { return Polygon; } - void label_position(double *x, double *y) const - { - unsigned size = cont_.size(); - if (size < 3) + box2d envelope() const + { + box2d result; + double x,y; + rewind(0); + for (unsigned i=0;i class Container=vertex_vector2> @@ -350,13 +368,15 @@ namespace mapnik { virtual ~line_string() {} }; - typedef point point_impl; - typedef line_string line_string_impl; - typedef polygon polygon_impl; +//typedef point point_impl; +//typedef line_string line_string_impl; +typedef polygon point_impl; +typedef polygon line_string_impl; +typedef polygon polygon_impl; - typedef geometry geometry2d; - typedef boost::shared_ptr geometry_ptr; - typedef boost::ptr_vector geometry_containter; +typedef polygon_impl geometry2d; +typedef boost::shared_ptr geometry_ptr; +typedef boost::ptr_vector geometry_containter; } #endif //GEOMETRY_HPP diff --git a/src/wkb.cpp b/src/wkb.cpp index dcefbbc23..296048439 100644 --- a/src/wkb.cpp +++ b/src/wkb.cpp @@ -203,7 +203,7 @@ namespace mapnik void read_point(Feature & feature) { - geometry2d * pt = new point; + geometry2d * pt = new geometry2d;//new point; double x = read_double(); double y = read_double(); pt->move_to(x,y); @@ -222,7 +222,7 @@ namespace mapnik void read_multipoint_2(Feature & feature) { - geometry2d * pt = new point; + geometry2d * pt = new geometry2d;//point; int num_points = read_integer(); for (int i=0;i; + geometry2d * line = new geometry2d;//line_string; int num_points=read_integer(); CoordinateArray ar(num_points); read_coords(ar); @@ -261,7 +261,7 @@ namespace mapnik void read_multilinestring_2(Feature & feature) { - geometry2d * line = new line_string; + geometry2d * line = new geometry2d;//line_string; int num_lines=read_integer(); unsigned capacity = 0; for (int i=0;i