io.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  6. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_GEOMETRY_IO_HPP
  11. #define BOOST_GEOMETRY_IO_HPP
  12. #include <boost/geometry/io/wkt/read.hpp>
  13. #include <boost/geometry/io/wkt/write.hpp>
  14. namespace boost { namespace geometry
  15. {
  16. struct format_wkt {};
  17. struct format_wkb {}; // TODO
  18. struct format_dsv {}; // TODO
  19. #ifndef DOXYGEN_NO_DISPATCH
  20. namespace dispatch
  21. {
  22. template <typename Tag, typename Geometry>
  23. struct read
  24. {
  25. };
  26. template <typename Geometry>
  27. struct read<format_wkt, Geometry>
  28. {
  29. static inline void apply(Geometry& geometry, std::string const& wkt)
  30. {
  31. read_wkt<typename tag<Geometry>::type, Geometry>::apply(wkt, geometry);
  32. }
  33. };
  34. } // namespace dispatch
  35. #endif // DOXYGEN_NO_DISPATCH
  36. template <typename Format, typename Geometry>
  37. inline void read(Geometry& geometry, std::string const& wkt)
  38. {
  39. geometry::concepts::check<Geometry>();
  40. dispatch::read<Format, Geometry>::apply(geometry, wkt);
  41. }
  42. // TODO: wriite
  43. }} // namespace boost::geometry
  44. #endif // BOOST_GEOMETRY_IO_HPP