1// Boost.Geometry
2// Unit Test
3
4// Copyright (c) 2022 Barend Gehrels, Amsterdam, the Netherlands.
5
6// Use, modification and distribution is subject to the Boost Software License,
7// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9
10#ifndef BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CONST_POINT_HPP
11#define BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CONST_POINT_HPP
12
13#include <boost/geometry/geometries/register/point.hpp>
14#include <deque>
15#include <vector>
16
17class const_point
18{
19public:
20 const_point(double x0, double y0) : x(x0), y(y0) {}
21
22 double GetX() const { return x; }
23 double GetY() const { return y; }
24private:
25 double x{0}, y{0};
26};
27
28BOOST_GEOMETRY_REGISTER_POINT_2D_CONST(const_point, double, boost::geometry::cs::cartesian, GetX(), GetY());
29
30using ring_of_const_point = std::vector<const_point>;
31
32// Register a vector of const_pos as a non-const-ring with const points
33namespace boost { namespace geometry { namespace traits {
34 template<> struct tag<ring_of_const_point> { typedef ring_tag type; };
35
36}}}
37
38using linestring_of_const_point = std::deque<const_point>;
39
40// Register a vector of const_pos as a non-const-ring with const points
41namespace boost { namespace geometry { namespace traits {
42 template<> struct tag<linestring_of_const_point> { typedef linestring_tag type; };
43
44}}}
45
46#endif
47

source code of boost/libs/geometry/test/test_geometries/const_point.hpp