]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/pretty_print_geometry.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / pretty_print_geometry.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Tests
3
4 // Copyright (c) 2014, Oracle and/or its affiliates.
5
6 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
7
8 // Licensed under the Boost Software License version 1.0.
9 // http://www.boost.org/users/license.html
10
11 #ifndef BOOST_GEOMETRY_TEST_PRETTY_PRINT_GEOMETRY_HPP
12 #define BOOST_GEOMETRY_TEST_PRETTY_PRINT_GEOMETRY_HPP
13
14 #include <iostream>
15
16 #include <boost/geometry/core/tag.hpp>
17 #include <boost/geometry/core/tags.hpp>
18
19 #include <boost/geometry/io/dsv/write.hpp>
20 #include <boost/geometry/io/wkt/write.hpp>
21
22
23 template
24 <
25 typename Geometry,
26 typename Tag = typename boost::geometry::tag<Geometry>::type
27 >
28 struct pretty_print_geometry
29 {
30 static inline std::ostream&
31 apply(std::ostream& os, Geometry const& geometry)
32 {
33 os << boost::geometry::wkt(geometry);
34 return os;
35 }
36 };
37
38 template <typename Box>
39 struct pretty_print_geometry<Box, boost::geometry::box_tag>
40 {
41 static inline std::ostream&
42 apply(std::ostream& os, Box const& box)
43 {
44 return os << "BOX" << boost::geometry::dsv(box);
45 }
46 };
47
48 template <typename Segment>
49 struct pretty_print_geometry<Segment, boost::geometry::segment_tag>
50 {
51 static inline std::ostream&
52 apply(std::ostream& os, Segment const& segment)
53 {
54 return os << "SEGMENT" << boost::geometry::dsv(segment);
55 }
56 };
57
58 template <typename Ring>
59 struct pretty_print_geometry<Ring, boost::geometry::ring_tag>
60 {
61 static inline std::ostream&
62 apply(std::ostream& os, Ring const& ring)
63 {
64 return os << "RING" << boost::geometry::dsv(ring);
65 }
66 };
67
68
69 #endif // BOOST_GEOMETRY_TEST_PRETTY_PRINT_GEOMETRY_HPP