forked from osm2pgsql-dev/osm2pgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeom-boost-adaptor.hpp
More file actions
83 lines (72 loc) · 2.33 KB
/
geom-boost-adaptor.hpp
File metadata and controls
83 lines (72 loc) · 2.33 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef OSM2PGSQL_GEOM_BOOST_ADAPTOR_HPP
#define OSM2PGSQL_GEOM_BOOST_ADAPTOR_HPP
/**
* SPDX-License-Identifier: GPL-2.0-or-later
*
* This file is part of osm2pgsql (https://osm2pgsql.org/).
*
* Copyright (C) 2006-2025 by the osm2pgsql developer community.
* For a full list of authors see the git log.
*/
#include "geom.hpp"
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/register/linestring.hpp>
#include <boost/geometry/geometries/register/multi_linestring.hpp>
#include <boost/geometry/geometries/register/multi_point.hpp>
#include <boost/geometry/geometries/register/multi_polygon.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/ring.hpp>
BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(geom::point_t, double, cs::cartesian,
x, y, set_x, set_y)
BOOST_GEOMETRY_REGISTER_LINESTRING(geom::linestring_t)
BOOST_GEOMETRY_REGISTER_RING(geom::ring_t)
BOOST_GEOMETRY_REGISTER_MULTI_POINT(geom::multipoint_t)
BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(geom::multilinestring_t)
BOOST_GEOMETRY_REGISTER_MULTI_POLYGON(geom::multipolygon_t)
namespace boost::geometry::traits {
template <>
struct point_order<::geom::ring_t>
{
static const order_selector value = counterclockwise;
};
template <>
struct tag<::geom::polygon_t>
{
using type = polygon_tag;
};
template <>
struct ring_const_type<::geom::polygon_t>
{
using type = ::geom::ring_t const &;
};
template <>
struct ring_mutable_type<::geom::polygon_t>
{
using type = ::geom::ring_t &;
};
template <>
struct interior_const_type<::geom::polygon_t>
{
using type = std::vector<::geom::ring_t> const &;
};
template <>
struct interior_mutable_type<::geom::polygon_t>
{
using type = std::vector<::geom::ring_t> &;
};
template <>
struct exterior_ring<::geom::polygon_t>
{
// NOLINTNEXTLINE(google-runtime-references)
static auto &get(::geom::polygon_t &p) { return p.outer(); }
static auto const &get(::geom::polygon_t const &p) { return p.outer(); }
};
template <>
struct interior_rings<::geom::polygon_t>
{
// NOLINTNEXTLINE(google-runtime-references)
static auto &get(::geom::polygon_t &p) { return p.inners(); }
static auto const &get(::geom::polygon_t const &p) { return p.inners(); }
};
} // namespace boost::geometry::traits
#endif // OSM2PGSQL_GEOM_BOOST_ADAPTOR_HPP