Vanetza
Loading...
Searching...
No Matches
boost_geometry.hpp
1
#
pragma
once
2
#
include
<
vanetza
/
security
/
v3
/
asn1_types
.
hpp
>
3
#
include
<
boost
/
geometry
/
core
/
closure
.
hpp
>
4
#
include
<
boost
/
geometry
/
core
/
cs
.
hpp
>
5
#
include
<
boost
/
geometry
/
geometries
/
point
.
hpp
>
6
#
include
<
boost
/
iterator
/
iterator_facade
.
hpp
>
7
8
namespace
vanetza
9
{
10
11
// forward declaration
12
struct
PositionFix
;
13
14
namespace
security
15
{
16
namespace
v3
17
{
18
19
/**
20
* TwoDLocationModel is a Boost.Geometry point model representing a 2D geographic location.
21
*/
22
using
TwoDLocationModel = boost::geometry::model::point<
double
, 2, boost::geometry::cs::geographic<boost::geometry::degree>>;
23
24
/**
25
* \brief Create a TwoDLocationModel from an ASN.1 TwoDLocation.
26
*
27
* \param location The ASN.1 TwoDLocation_t structure to convert.
28
* \return A TwoDLocationModel representing the geographic location.
29
*/
30
TwoDLocationModel make_model(
const
asn1::TwoDLocation& location);
31
TwoDLocationModel make_model(
const
PositionFix
&);
32
33
/**
34
* TwoDLocationIterator allows traversal of ASN.1 PolygonalRegion providing TwoDLocationModel objects.
35
*/
36
class
TwoDLocationIterator
:
37
public
boost
::
iterator_facade
<
TwoDLocationIterator
,
38
TwoDLocationModel
,
39
boost
::
random_access_traversal_tag
,
40
TwoDLocationModel
>
41
{
42
public
:
43
TwoDLocationIterator() =
default
;
44
explicit
TwoDLocationIterator(
const
asn1::PolygonalRegion& region, std::size_t index);
45
46
private
:
47
friend
class
boost::iterator_core_access;
48
49
void
increment();
50
void
decrement();
51
void
advance(std::size_t n);
52
std::ptrdiff_t distance_to(
const
TwoDLocationIterator
& other)
const
;
53
bool
equal(
const
TwoDLocationIterator
& other)
const
;
54
TwoDLocationModel dereference()
const
;
55
56
const
asn1::PolygonalRegion* m_region =
nullptr
;
57
std::size_t m_index = 0;
58
};
59
60
/**
61
* \brief Adapt ASN.1 PolygonalRegion to a Boost.Geometry ring.
62
*/
63
class
PolygonalRegionRingAdapter
64
{
65
public
:
66
using
iterator =
TwoDLocationIterator
;
67
using
const_iterator =
TwoDLocationIterator
;
68
69
PolygonalRegionRingAdapter(
const
asn1::PolygonalRegion& region);
70
iterator begin()
const
;
71
iterator end()
const
;
72
std::size_t size()
const
;
73
74
private
:
75
const
asn1::PolygonalRegion& m_region;
76
};
77
78
}
// namespace v3
79
}
// namespace security
80
}
// namespace vanetza
81
82
namespace
boost
83
{
84
namespace
geometry
85
{
86
namespace
traits
87
{
88
89
template
<>
struct
tag<vanetza::security::v3::PolygonalRegionRingAdapter> {
using
type = ring_tag; };
90
template
<>
struct
closure
<vanetza::security::v3::
PolygonalRegionRingAdapter
> {
static
const
closure_selector value = open; };
91
92
}
// namespace traits
93
}
// namespace gemoetry
94
}
// namespace boost
vanetza::security::v3::PolygonalRegionRingAdapter
Adapt ASN.1 PolygonalRegion to a Boost.Geometry ring.
Definition
boost_geometry.hpp:64
vanetza::security::v3::TwoDLocationIterator
Definition
boost_geometry.hpp:41
boost::geometry::traits::closure< vanetza::security::v3::PolygonalRegionRingAdapter >
Definition
boost_geometry.hpp:90
vanetza::PositionFix
Definition
position_fix.hpp:16
vanetza
security
v3
boost_geometry.hpp
Generated on
for Vanetza by
1.16.1