annotate DEPENDENCIES/generic/include/boost/geometry/geometries/point_xy.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
Chris@16 2
Chris@16 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Chris@16 4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Chris@16 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Chris@16 6
Chris@16 7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
Chris@16 8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
Chris@16 9
Chris@16 10 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 12 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 13
Chris@16 14 #ifndef BOOST_GEOMETRY_GEOMETRIES_POINT_XY_HPP
Chris@16 15 #define BOOST_GEOMETRY_GEOMETRIES_POINT_XY_HPP
Chris@16 16
Chris@16 17 #include <cstddef>
Chris@16 18
Chris@16 19 #include <boost/mpl/int.hpp>
Chris@16 20
Chris@16 21 #include <boost/geometry/core/cs.hpp>
Chris@16 22 #include <boost/geometry/geometries/point.hpp>
Chris@16 23
Chris@16 24 namespace boost { namespace geometry
Chris@16 25 {
Chris@16 26
Chris@16 27 namespace model { namespace d2
Chris@16 28 {
Chris@16 29
Chris@16 30 /*!
Chris@16 31 \brief 2D point in Cartesian coordinate system
Chris@16 32 \tparam CoordinateType numeric type, for example, double, float, int
Chris@16 33 \tparam CoordinateSystem coordinate system, defaults to cs::cartesian
Chris@16 34
Chris@16 35 \qbk{before.synopsis,
Chris@16 36 [heading Model of]
Chris@16 37 [link geometry.reference.concepts.concept_point Point Concept]
Chris@16 38 }
Chris@16 39
Chris@16 40 \qbk{[include reference/geometries/point_assign_warning.qbk]}
Chris@16 41
Chris@16 42 */
Chris@16 43 template<typename CoordinateType, typename CoordinateSystem = cs::cartesian>
Chris@16 44 class point_xy : public model::point<CoordinateType, 2, CoordinateSystem>
Chris@16 45 {
Chris@16 46 public:
Chris@16 47
Chris@16 48 /// Default constructor, does not initialize anything
Chris@16 49 inline point_xy()
Chris@16 50 : model::point<CoordinateType, 2, CoordinateSystem>()
Chris@16 51 {}
Chris@16 52
Chris@16 53 /// Constructor with x/y values
Chris@16 54 inline point_xy(CoordinateType const& x, CoordinateType const& y)
Chris@16 55 : model::point<CoordinateType, 2, CoordinateSystem>(x, y)
Chris@16 56 {}
Chris@16 57
Chris@16 58 /// Get x-value
Chris@16 59 inline CoordinateType const& x() const
Chris@16 60 { return this->template get<0>(); }
Chris@16 61
Chris@16 62 /// Get y-value
Chris@16 63 inline CoordinateType const& y() const
Chris@16 64 { return this->template get<1>(); }
Chris@16 65
Chris@16 66 /// Set x-value
Chris@16 67 inline void x(CoordinateType const& v)
Chris@16 68 { this->template set<0>(v); }
Chris@16 69
Chris@16 70 /// Set y-value
Chris@16 71 inline void y(CoordinateType const& v)
Chris@16 72 { this->template set<1>(v); }
Chris@16 73 };
Chris@16 74
Chris@16 75
Chris@16 76 }} // namespace model::d2
Chris@16 77
Chris@16 78
Chris@16 79 // Adapt the point_xy to the concept
Chris@16 80 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@16 81 namespace traits
Chris@16 82 {
Chris@16 83
Chris@16 84 template <typename CoordinateType, typename CoordinateSystem>
Chris@16 85 struct tag<model::d2::point_xy<CoordinateType, CoordinateSystem> >
Chris@16 86 {
Chris@16 87 typedef point_tag type;
Chris@16 88 };
Chris@16 89
Chris@16 90 template<typename CoordinateType, typename CoordinateSystem>
Chris@16 91 struct coordinate_type<model::d2::point_xy<CoordinateType, CoordinateSystem> >
Chris@16 92 {
Chris@16 93 typedef CoordinateType type;
Chris@16 94 };
Chris@16 95
Chris@16 96 template<typename CoordinateType, typename CoordinateSystem>
Chris@16 97 struct coordinate_system<model::d2::point_xy<CoordinateType, CoordinateSystem> >
Chris@16 98 {
Chris@16 99 typedef CoordinateSystem type;
Chris@16 100 };
Chris@16 101
Chris@16 102 template<typename CoordinateType, typename CoordinateSystem>
Chris@16 103 struct dimension<model::d2::point_xy<CoordinateType, CoordinateSystem> >
Chris@16 104 : boost::mpl::int_<2>
Chris@16 105 {};
Chris@16 106
Chris@16 107 template<typename CoordinateType, typename CoordinateSystem, std::size_t Dimension>
Chris@16 108 struct access<model::d2::point_xy<CoordinateType, CoordinateSystem>, Dimension >
Chris@16 109 {
Chris@16 110 static inline CoordinateType get(
Chris@16 111 model::d2::point_xy<CoordinateType, CoordinateSystem> const& p)
Chris@16 112 {
Chris@16 113 return p.template get<Dimension>();
Chris@16 114 }
Chris@16 115
Chris@16 116 static inline void set(model::d2::point_xy<CoordinateType, CoordinateSystem>& p,
Chris@16 117 CoordinateType const& value)
Chris@16 118 {
Chris@16 119 p.template set<Dimension>(value);
Chris@16 120 }
Chris@16 121 };
Chris@16 122
Chris@16 123 } // namespace traits
Chris@16 124 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@16 125
Chris@16 126 }} // namespace boost::geometry
Chris@16 127
Chris@16 128 #endif // BOOST_GEOMETRY_GEOMETRIES_POINT_XY_HPP