/Src/Dependencies/Boost/libs/geometry/doc/src/examples/geometries/register/multi_point.cpp

http://hadesmem.googlecode.com/ · C++ · 46 lines · 15 code · 12 blank · 19 comment · 0 complexity · deabd12f78f20c383fb980d37380c20a MD5 · raw file

  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // QuickBook Example
  3. // Copyright (c) 2011 Barend Gehrels, Amsterdam, the Netherlands.
  4. // Use, modification and distribution is subject to the Boost Software License,
  5. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //[register_multi_point
  8. //` Show the use of the macro BOOST_GEOMETRY_REGISTER_MULTI_POINT
  9. #include <iostream>
  10. #include <boost/geometry.hpp>
  11. #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
  12. #include <boost/geometry/multi/geometries/register/multi_point.hpp>
  13. typedef boost::tuple<float, float> point_type;
  14. BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
  15. BOOST_GEOMETRY_REGISTER_MULTI_POINT(std::deque< ::point_type >)
  16. int main()
  17. {
  18. // Normal usage of std::
  19. std::deque<point_type> multi_point;
  20. multi_point.push_back(point_type(1, 1));
  21. multi_point.push_back(point_type(3, 2));
  22. // Usage of Boost.Geometry
  23. std::cout << "WKT: " << boost::geometry::wkt(multi_point) << std::endl;
  24. return 0;
  25. }
  26. //]
  27. //[register_multi_point_output
  28. /*`
  29. Output:
  30. [pre
  31. WKT: MULTIPOINT((1 1),(3 2))
  32. ]
  33. */
  34. //]