summaryrefslogtreecommitdiff
path: root/boost/geometry/geometries/polygon.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/geometries/polygon.hpp')
-rw-r--r--boost/geometry/geometries/polygon.hpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/boost/geometry/geometries/polygon.hpp b/boost/geometry/geometries/polygon.hpp
index ec8d1ec38f..5f2e87a11d 100644
--- a/boost/geometry/geometries/polygon.hpp
+++ b/boost/geometry/geometries/polygon.hpp
@@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -26,6 +27,13 @@
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/ring.hpp>
+#ifdef BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST
+#include <boost/config.hpp>
+#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#include <initializer_list>
+#endif
+#endif
+
namespace boost { namespace geometry
{
@@ -83,6 +91,46 @@ public:
inline ring_type& outer() { return m_outer; }
inline inner_container_type & inners() { return m_inners; }
+#ifdef BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST
+
+ /// \constructor_default{polygon}
+ inline polygon()
+ : m_outer()
+ , m_inners()
+ {}
+
+#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+ /// \constructor_initializer_list{polygon}
+ inline polygon(std::initializer_list<ring_type> l)
+ : m_outer(l.size() > 0 ? *l.begin() : ring_type())
+ , m_inners(l.size() > 0 ? l.begin() + 1 : l.begin(), l.end())
+ {}
+
+// Commented out for now in order to support Boost.Assign
+// Without this assignment operator first the object should be created
+// from initializer list, then it shoudl be moved.
+//// Without this workaround in MSVC the assignment operator is ambiguous
+//#ifndef BOOST_MSVC
+// /// \assignment_initializer_list{polygon}
+// inline polygon & operator=(std::initializer_list<ring_type> l)
+// {
+// if ( l.size() > 0 )
+// {
+// m_outer = *l.begin();
+// m_inners.assign(l.begin() + 1, l.end());
+// }
+// else
+// {
+// m_outer.clear();
+// m_inners.clear();
+// }
+// return *this;
+// }
+//#endif
+
+#endif
+#endif
+
/// Utility method, clears outer and inner rings
inline void clear()
{