/usr/include/mapnik/geometry.hpp is in libmapnik-dev 3.0.12+ds-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | /*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2015 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef MAPNIK_GEOMETRY_HPP
#define MAPNIK_GEOMETRY_HPP
#include <mapnik/util/variant.hpp>
#include <vector>
#include <type_traits>
#include <cstddef>
namespace mapnik { namespace geometry {
template <typename T>
struct point
{
using coord_type = T;
point() {}
point(T x_, T y_)
: x(x_), y(y_)
{}
coord_type x;
coord_type y;
};
template <typename T>
bool operator==(point<T> const& lhs, point<T> const& rhs)
{
return lhs.x == rhs.x && lhs.y == rhs.y;
}
template <typename T>
bool operator!=(point<T> const& lhs, point<T> const& rhs)
{
return !(lhs == rhs);
}
template <typename T>
struct line_string : std::vector<point<T> >
{
using coord_type = T;
line_string() = default;
explicit line_string(std::size_t size)
: std::vector<point<T> >(size) {}
inline std::size_t num_points() const { return std::vector<point<T>>::size(); }
inline void add_coord(T x, T y) { std::vector<point<T>>::template emplace_back(x,y);}
};
template <typename T>
struct linear_ring : line_string<T>
{
using coord_type = T;
linear_ring() = default;
explicit linear_ring(std::size_t size)
: line_string<T>(size) {}
linear_ring(line_string<T> && other)
: line_string<T>(std::move(other)) {}
linear_ring(line_string<T> const& other)
: line_string<T>(other) {}
};
template <typename T>
using rings_container = std::vector<linear_ring<T>>;
template <typename T, template <typename> class InteriorRings = rings_container>
struct polygon
{
using coord_type = T;
using rings_container = InteriorRings<T>;
linear_ring<T> exterior_ring;
rings_container interior_rings;
inline void set_exterior_ring(linear_ring<T> && ring)
{
exterior_ring = std::move(ring);
}
inline void add_hole(linear_ring<T> && ring)
{
interior_rings.emplace_back(std::move(ring));
}
inline bool empty() const { return exterior_ring.empty(); }
inline std::size_t num_rings() const
{
return 1 + interior_rings.size();
}
};
template <typename T>
struct multi_point : line_string<T>
{
using coord_type = T;
};
template <typename T>
struct multi_line_string : std::vector<line_string<T>>
{
using coord_type = T;
};
template <typename T>
struct multi_polygon : std::vector<polygon<T>>
{
using coord_type = T;
};
template <typename T>
struct geometry_collection;
struct geometry_empty {};
template <typename T>
using geometry_base = mapnik::util::variant<geometry_empty,
point<T>,
line_string<T>,
polygon<T>,
multi_point<T>,
multi_line_string<T>,
multi_polygon<T>,
geometry_collection<T> >;
template <typename T>
struct geometry : geometry_base<T>
{
using coord_type = T;
#if __cpp_inheriting_constructors >= 200802
using geometry_base<T>::geometry_base;
#else
geometry() = default;
template <typename G>
geometry(G && geom)
: geometry_base<T>(std::forward<G>(geom)) {}
#endif
};
template <typename T>
struct geometry_collection : std::vector<geometry<T>>
{
using coord_type = T;
};
}}
#endif //MAPNIK_GEOMETRY_HPP
|