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