From 4ff5fc787b1cd37b4bba370bdc3b3dee03940433 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 16 Oct 2014 16:43:16 +0200 Subject: [PATCH 1/2] [core] Use bare_type in closure and point_order. --- include/boost/geometry/core/closure.hpp | 7 ++++++- include/boost/geometry/core/point_order.hpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/boost/geometry/core/closure.hpp b/include/boost/geometry/core/closure.hpp index b61e352e9..b69dcda14 100644 --- a/include/boost/geometry/core/closure.hpp +++ b/include/boost/geometry/core/closure.hpp @@ -4,6 +4,11 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014 Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -186,7 +191,7 @@ struct closure static const closure_selector value = core_dispatch::closure < typename tag::type, - typename boost::remove_const::type + typename util::bare_type::type >::value; }; diff --git a/include/boost/geometry/core/point_order.hpp b/include/boost/geometry/core/point_order.hpp index 501dda777..d43adbd03 100644 --- a/include/boost/geometry/core/point_order.hpp +++ b/include/boost/geometry/core/point_order.hpp @@ -4,6 +4,11 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014 Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -173,7 +178,7 @@ struct point_order static const order_selector value = core_dispatch::point_order < typename tag::type, - typename boost::remove_const::type + typename util::bare_type::type >::value; }; From c3aa7fdb12679fb2810d97a3d710151e8e41e161 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 16 Oct 2014 16:44:10 +0200 Subject: [PATCH 2/2] [test][core] Test pointers and references in point_type, tag, closure and point_order. --- test/core/point_type.cpp | 14 ++++++++++++++ test/core/ring.cpp | 25 +++++++++++++++++++++++++ test/core/tag.cpp | 15 +++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/test/core/point_type.cpp b/test/core/point_type.cpp index 3178bcb91..1d6446dc6 100644 --- a/test/core/point_type.cpp +++ b/test/core/point_type.cpp @@ -3,6 +3,11 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014 Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -10,6 +15,7 @@ #include +#include #include @@ -38,6 +44,9 @@ void test_geometry() { BOOST_CHECK_EQUAL(typeid(typename bg::point_type::type).name(), typeid(Expected).name()); + + static const bool is_same = boost::is_same::type, Expected>::value; + BOOST_CHECK(is_same); } template @@ -45,7 +54,12 @@ void test_all() { test_geometry(); test_geometry

(); + test_geometry(); + test_geometry(); + test_geometry(); + test_geometry(); test_geometry , P>(); + test_geometry *&, P>(); test_geometry , P>(); test_geometry , P>(); test_geometry , P>(); diff --git a/test/core/ring.cpp b/test/core/ring.cpp index f2c3ac4cb..cf7ee5d7e 100644 --- a/test/core/ring.cpp +++ b/test/core/ring.cpp @@ -5,6 +5,11 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014 Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -30,6 +35,15 @@ #include +template +void test_order_closure(bg::order_selector expected_order, bg::closure_selector exptected_closure) +{ + bg::order_selector order = bg::point_order::value; + bg::closure_selector closure = bg::closure::value; + + BOOST_CHECK_EQUAL(order, expected_order); + BOOST_CHECK_EQUAL(closure, exptected_closure); +} template @@ -64,6 +78,17 @@ void test_all() test_ring

("POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))", 5, 1, 5); test_ring

("POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,2 2,2 1,1 1),(1 1,1 2,2 2,1 1))", 5, 2, 4); test_ring

("POLYGON((0 0,0 3,3 3,3 0,0 0))", 5, 0, 0); + + test_order_closure< bg::model::polygon >(bg::clockwise, bg::closed); + test_order_closure< bg::model::polygon >(bg::clockwise, bg::open); + test_order_closure< bg::model::polygon >(bg::counterclockwise, bg::closed); + test_order_closure< bg::model::polygon >(bg::counterclockwise, bg::open); + + test_order_closure< bg::model::polygon

*>(bg::clockwise, bg::closed); + test_order_closure< bg::model::polygon

&>(bg::clockwise, bg::closed); + test_order_closure< bg::model::polygon

const>(bg::clockwise, bg::closed); + test_order_closure< bg::model::polygon

*&>(bg::clockwise, bg::closed); + test_order_closure< const bg::model::polygon

*>(bg::clockwise, bg::closed); } diff --git a/test/core/tag.cpp b/test/core/tag.cpp index d3bbc4bc3..f67c58d4b 100644 --- a/test/core/tag.cpp +++ b/test/core/tag.cpp @@ -3,6 +3,11 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014 Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -10,6 +15,8 @@ #include +#include + #include #include @@ -34,6 +41,9 @@ void test_geometry() { BOOST_CHECK_EQUAL(typeid(typename bg::tag::type).name(), typeid(Expected).name()); + + static const bool is_same = boost::is_same::type, Expected>::value; + BOOST_CHECK(is_same); } template @@ -41,7 +51,12 @@ void test_all() { test_geometry(); test_geometry

(); + test_geometry(); + test_geometry(); + test_geometry(); + test_geometry(); test_geometry , bg::linestring_tag>(); + test_geometry *&, bg::linestring_tag>(); test_geometry , bg::ring_tag>(); test_geometry , bg::polygon_tag>(); test_geometry , bg::box_tag>();