File indexing completed on 2025-01-18 09:35:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef BOOST_GEOMETRY_GEOMETRIES_POINT_XY_HPP
0019 #define BOOST_GEOMETRY_GEOMETRIES_POINT_XY_HPP
0020
0021 #include <cstddef>
0022 #include <type_traits>
0023
0024 #include <boost/geometry/core/cs.hpp>
0025 #include <boost/geometry/geometries/point.hpp>
0026
0027 namespace boost { namespace geometry
0028 {
0029
0030 namespace model { namespace d2
0031 {
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 template<typename CoordinateType, typename CoordinateSystem = cs::cartesian>
0048 class point_xy : public model::point<CoordinateType, 2, CoordinateSystem>
0049 {
0050 public:
0051
0052 constexpr point_xy() = default;
0053
0054
0055 constexpr point_xy(CoordinateType const& x, CoordinateType const& y)
0056 : model::point<CoordinateType, 2, CoordinateSystem>(x, y)
0057 {}
0058
0059
0060 constexpr CoordinateType const& x() const
0061 { return this->template get<0>(); }
0062
0063
0064 constexpr CoordinateType const& y() const
0065 { return this->template get<1>(); }
0066
0067
0068 void x(CoordinateType const& v)
0069 { this->template set<0>(v); }
0070
0071
0072 void y(CoordinateType const& v)
0073 { this->template set<1>(v); }
0074 };
0075
0076
0077 }}
0078
0079
0080
0081 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0082 namespace traits
0083 {
0084
0085 template <typename CoordinateType, typename CoordinateSystem>
0086 struct tag<model::d2::point_xy<CoordinateType, CoordinateSystem> >
0087 {
0088 typedef point_tag type;
0089 };
0090
0091 template<typename CoordinateType, typename CoordinateSystem>
0092 struct coordinate_type<model::d2::point_xy<CoordinateType, CoordinateSystem> >
0093 {
0094 typedef CoordinateType type;
0095 };
0096
0097 template<typename CoordinateType, typename CoordinateSystem>
0098 struct coordinate_system<model::d2::point_xy<CoordinateType, CoordinateSystem> >
0099 {
0100 typedef CoordinateSystem type;
0101 };
0102
0103 template<typename CoordinateType, typename CoordinateSystem>
0104 struct dimension<model::d2::point_xy<CoordinateType, CoordinateSystem> >
0105 : std::integral_constant<std::size_t, 2>
0106 {};
0107
0108 template<typename CoordinateType, typename CoordinateSystem, std::size_t Dimension>
0109 struct access<model::d2::point_xy<CoordinateType, CoordinateSystem>, Dimension >
0110 {
0111 static constexpr CoordinateType get(
0112 model::d2::point_xy<CoordinateType, CoordinateSystem> const& p)
0113 {
0114 return p.template get<Dimension>();
0115 }
0116
0117 static void set(model::d2::point_xy<CoordinateType, CoordinateSystem>& p,
0118 CoordinateType const& value)
0119 {
0120 p.template set<Dimension>(value);
0121 }
0122 };
0123
0124 template<typename CoordinateType, typename CoordinateSystem>
0125 struct make<model::d2::point_xy<CoordinateType, CoordinateSystem> >
0126 {
0127 typedef model::d2::point_xy<CoordinateType, CoordinateSystem> point_type;
0128
0129 static const bool is_specialized = true;
0130
0131 static constexpr point_type apply(CoordinateType const& x,
0132 CoordinateType const& y)
0133 {
0134 return point_type(x, y);
0135 }
0136 };
0137
0138
0139 }
0140 #endif
0141
0142 }}
0143
0144 #endif