1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 // QuickBook Example 3 4 // Copyright (c) 2015, Oracle and/or its affiliates 5 6 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle 7 8 // Licensed under the Boost Software License version 1.0. 9 // http://www.boost.org/users/license.html 10 11 //[is_empty 12 //` Check if a geometry is the empty set 13 14 #include <iostream> 15 16 #include <boost/geometry.hpp> 17 #include <boost/geometry/geometries/point_xy.hpp> 18 19 main()20int main() 21 { 22 boost::geometry::model::multi_linestring 23 < 24 boost::geometry::model::linestring 25 < 26 boost::geometry::model::d2::point_xy<double> 27 > 28 > mls; 29 boost::geometry::read_wkt("MULTILINESTRING((0 0,0 10,10 0),(1 1,8 1,1 8))", mls); 30 std::cout << "Is empty? " << (boost::geometry::is_empty(mls) ? "yes" : "no") << std::endl; 31 boost::geometry::clear(mls); 32 std::cout << "Is empty (after clearing)? " << (boost::geometry::is_empty(mls) ? "yes" : "no") << std::endl; 33 return 0; 34 } 35 36 //] 37 38 39 //[is_empty_output 40 /*` 41 Output: 42 [pre 43 Is empty? no 44 Is empty (after clearing)? yes 45 ] 46 */ 47 //] 48