diff --git a/example/c05_custom_point_pointer_example.cpp b/example/c05_custom_point_pointer_example.cpp index 96bc22e49..d8059fe04 100644 --- a/example/c05_custom_point_pointer_example.cpp +++ b/example/c05_custom_point_pointer_example.cpp @@ -35,42 +35,42 @@ struct my_point namespace boost { namespace geometry { namespace traits { -template<> struct tag +template<> struct tag { typedef point_tag type; }; -template<> struct coordinate_type +template<> struct coordinate_type { typedef double type; }; -template<> struct coordinate_system +template<> struct coordinate_system { typedef cs::cartesian type; }; -template<> struct dimension : boost::mpl::int_<2> {}; +template<> struct dimension : boost::mpl::int_<2> {}; template<> -struct access +struct access { - static double get(my_point const* p) + static double get(my_point const& p) { - return p->x; + return p.x; } - static void set(my_point* p, double const& value) + static void set(my_point& p, double const& value) { - p->x = value; + p.x = value; } }; template<> -struct access +struct access { - static double get(my_point const* p) + static double get(my_point const& p) { - return p->y; + return p.y; } - static void set(my_point* p, double const& value) + static void set(my_point& p, double const& value) { - p->y = value; + p.y = value; } }; diff --git a/example/c07_custom_ring_pointer_example.cpp b/example/c07_custom_ring_pointer_example.cpp index 812dff21a..9126e04bc 100644 --- a/example/c07_custom_ring_pointer_example.cpp +++ b/example/c07_custom_ring_pointer_example.cpp @@ -14,7 +14,9 @@ #include -#include +#include +#include +#include #include BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(std::vector) @@ -32,42 +34,42 @@ struct my_point namespace boost { namespace geometry { namespace traits { -template<> struct tag +template<> struct tag { typedef point_tag type; }; -template<> struct coordinate_type +template<> struct coordinate_type { typedef double type; }; -template<> struct coordinate_system +template<> struct coordinate_system { typedef cs::cartesian type; }; -template<> struct dimension : boost::mpl::int_<2> {}; +template<> struct dimension : boost::mpl::int_<2> {}; template<> -struct access +struct access { - static double get(my_point const* p) + static double get(my_point const& p) { - return p->x; + return p.x; } - static void set(my_point* p, double const& value) + static void set(my_point& p, double const& value) { - p->x = value; + p.x = value; } }; template<> -struct access +struct access { - static double get(my_point const* p) + static double get(my_point const& p) { - return p->y; + return p.y; } - static void set(my_point* p, double const& value) + static void set(my_point& p, double const& value) { - p->y = value; + p.y = value; } }; @@ -101,30 +103,33 @@ int main() //std::vector unioned; //boost::geometry::union(a, b, unioned); - /* This once worked, using pointers, but has to be fixed or deprecated - typedef boost::geometry::model::ring > ring_2d; - std::vector unioned; - std::vector intersected; + // BEGIN TODO + // This compiles (and once worked) using pointers, but has to be fixed or deprecated + // The problem is now the cart_intersect/side where a temporary point is generated + //typedef boost::geometry::model::ring > ring_2d; + //std::vector unioned; + //std::vector intersected; - boost::geometry::intersection(a, b, intersected); - boost::geometry::union_(a, b, unioned); + //boost::geometry::intersection(a, b, intersected); + //boost::geometry::union_(a, b, unioned); - double ai = 0, au = 0; - BOOST_FOREACH(ring_2d const& ring, intersected) - { - ai += boost::geometry::area(ring); - } - BOOST_FOREACH(ring_2d const& ring, unioned) - { - au += boost::geometry::area(ring); - } + //double ai = 0, au = 0; + //BOOST_FOREACH(ring_2d const& ring, intersected) + //{ + // ai += boost::geometry::area(ring); + //} + //BOOST_FOREACH(ring_2d const& ring, unioned) + //{ + // au += boost::geometry::area(ring); + //} + + //std::cout << "a: " << aa << std::endl; + //std::cout << "b: " << ab << std::endl; + //std::cout << "a & b: " << ai << std::endl; + //std::cout << "a | b: " << au << std::endl; + //std::cout << "a + b - (a & b): " << (aa + ab - ai) << std::endl; + // END TODO - std::cout << "a: " << aa << std::endl; - std::cout << "b: " << ab << std::endl; - std::cout << "a & b: " << ai << std::endl; - std::cout << "a | b: " << au << std::endl; - std::cout << "a + b - (a & b): " << (aa + ab - ai) << std::endl; - */ // free BOOST_FOREACH(my_point* p, a)