[test][geometry] replace instances of "num_point() == 0" by "is_empty()";

replace instances of "num_points() > 0" by "! is_empty()";
This commit is contained in:
Menelaos Karavelas 2015-06-03 17:18:55 +03:00
parent 45d27e9878
commit 2de36a37df
3 changed files with 18 additions and 4 deletions

View File

@ -1,7 +1,13 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015.
// Modifications copyright (c) 2015 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, 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)
@ -20,6 +26,7 @@
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/is_empty.hpp>
#include <boost/geometry/algorithms/length.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
@ -79,7 +86,7 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
++it, ++index)
{
// Skip the empty polygon created above to avoid the empty_input_exception
if (bg::num_points(*it) > 0)
if (! bg::is_empty(*it))
{
area_inserted += bg::area(*it);
}

View File

@ -7,6 +7,7 @@
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, 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
@ -21,6 +22,7 @@
#include <boost/geometry/algorithms/convex_hull.hpp>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/is_empty.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/algorithms/perimeter.hpp>
@ -181,7 +183,7 @@ void test_empty_input()
> hull;
bg::convex_hull(geometry, hull);
BOOST_CHECK_MESSAGE(bg::num_points(hull) == 0, "Output convex hull should be empty" );
BOOST_CHECK_MESSAGE(bg::is_empty(hull), "Output convex hull should be empty" );
}

View File

@ -3,6 +3,11 @@
// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015.
// Modifications copyright (c) 2015 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, 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)
@ -60,7 +65,7 @@ void create_svg(std::string const& filename
bg::buffer(box, box, 1.0);
mapper.add(box);
if (bg::num_points(buffer) > 0)
if (! bg::is_empty(buffer))
{
bg::envelope(buffer, box);
bg::buffer(box, box, 1.0);