summaryrefslogtreecommitdiff
path: root/boost/geometry/geometries/box.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/geometries/box.hpp')
-rw-r--r--boost/geometry/geometries/box.hpp89
1 files changed, 73 insertions, 16 deletions
diff --git a/boost/geometry/geometries/box.hpp b/boost/geometry/geometries/box.hpp
index a2e3d4fd79..97a4ba06da 100644
--- a/boost/geometry/geometries/box.hpp
+++ b/boost/geometry/geometries/box.hpp
@@ -17,10 +17,14 @@
#include <cstddef>
#include <boost/concept/assert.hpp>
+#include <boost/config.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
+#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
+#include <boost/geometry/core/assert.hpp>
+#endif
namespace boost { namespace geometry
@@ -29,18 +33,21 @@ namespace boost { namespace geometry
namespace model
{
-
/*!
- \brief Class box: defines a box made of two describing points
- \ingroup geometries
- \details Box is always described by a min_corner() and a max_corner() point. If another
- rectangle is used, use linear_ring or polygon.
- \note Boxes are for selections and for calculating the envelope of geometries. Not all algorithms
- are implemented for box. Boxes are also used in Spatial Indexes.
- \tparam Point point type. The box takes a point type as template parameter.
- The point type can be any point type.
- It can be 2D but can also be 3D or more dimensional.
- The box can also take a latlong point type as template parameter.
+\brief Class box: defines a box made of two describing points
+\ingroup geometries
+\details Box is always described by a min_corner() and a max_corner() point. If another
+ rectangle is used, use linear_ring or polygon.
+\note Boxes are for selections and for calculating the envelope of geometries. Not all algorithms
+are implemented for box. Boxes are also used in Spatial Indexes.
+\tparam Point point type. The box takes a point type as template parameter.
+The point type can be any point type.
+It can be 2D but can also be 3D or more dimensional.
+The box can also take a latlong point type as template parameter.
+
+\qbk{[include reference/geometries/box.qbk]}
+\qbk{before.synopsis, [heading Model of]}
+\qbk{before.synopsis, [link geometry.reference.concepts.concept_box Box Concept]}
*/
template<typename Point>
@@ -50,7 +57,25 @@ class box
public:
- inline box() {}
+#if !defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
+#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
+ /// \constructor_default_no_init
+ box() = default;
+#else
+ /// \constructor_default_no_init
+ inline box()
+ {}
+#endif
+#else // defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
+ inline box()
+ {
+ m_created = 1;
+ }
+ ~box()
+ {
+ m_created = 0;
+ }
+#endif
/*!
\brief Constructor taking the minimum corner point and the maximum corner point
@@ -59,18 +84,50 @@ public:
{
geometry::convert(min_corner, m_min_corner);
geometry::convert(max_corner, m_max_corner);
+
+#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
+ m_created = 1;
+#endif
}
- inline Point const& min_corner() const { return m_min_corner; }
- inline Point const& max_corner() const { return m_max_corner; }
+ inline Point const& min_corner() const
+ {
+#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
+ BOOST_GEOMETRY_ASSERT(m_created == 1);
+#endif
+ return m_min_corner;
+ }
+ inline Point const& max_corner() const
+ {
+#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
+ BOOST_GEOMETRY_ASSERT(m_created == 1);
+#endif
+ return m_max_corner;
+ }
- inline Point& min_corner() { return m_min_corner; }
- inline Point& max_corner() { return m_max_corner; }
+ inline Point& min_corner()
+ {
+#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
+ BOOST_GEOMETRY_ASSERT(m_created == 1);
+#endif
+ return m_min_corner;
+ }
+ inline Point& max_corner()
+ {
+#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
+ BOOST_GEOMETRY_ASSERT(m_created == 1);
+#endif
+ return m_max_corner;
+ }
private:
Point m_min_corner;
Point m_max_corner;
+
+#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
+ int m_created;
+#endif
};