]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/geometry/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / geometry / test / robustness / overlay / areal_areal / test_overlay_p_q.hpp
index 57813450f621e8c7b6c08c9c2406fa3c82cb06ca..af0ec826462a2847ca376e0a77840596e33f8fb0 100644 (file)
@@ -1,7 +1,12 @@
 // Boost.Geometry (aka GGL, Generic Geometry Library)
 // Robustness Test
-//
-// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
+
+// Copyright (c) 2009-2021 Barend Gehrels, Amsterdam, the Netherlands.
+
+// This file was modified by Oracle on 2021.
+// Modifications copyright (c) 2021, 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)
@@ -14,8 +19,6 @@
 #include <sstream>
 #include <iomanip>
 
-#include <boost/typeof/typeof.hpp>
-
 #include <geometry_test_common.hpp>
 
 // For mixing int/float
 
 struct p_q_settings
 {
-    bool svg;
-    bool also_difference;
-    bool validity;
-    bool wkt;
-    bool verify_area;
-    double tolerance;
-
-    p_q_settings()
-        : svg(false)
-        , also_difference(false)
-        , validity(false)
-        , wkt(false)
-        , verify_area(false)
-        , tolerance(1.0e-3) // since rescaling to integer the tolerance should be less. Was originally 1.0e-6
-    {}
+    bool svg{false};
+    bool also_difference{false};
+    bool validity{false};
+    bool wkt{false};
+    bool verify_area{false};
+    double tolerance{1.0e-3};
+    bool verbose{false};
+
+    // NOTE: since rescaling to integer the tolerance is less.
+    // Was originally 1.0e-6 TODO: restore
 };
 
 template <typename Geometry>
@@ -206,6 +204,7 @@ static bool test_overlay_p_q(std::string const& caseid,
     }
 
     bool svg = settings.svg;
+    bool wkt = settings.wkt;
 
     if (wrong || settings.wkt)
     {
@@ -213,53 +212,66 @@ static bool test_overlay_p_q(std::string const& caseid,
         {
             result = false;
             svg = true;
+            wkt = true;
         }
-        bg::unique(out_i);
-        bg::unique(out_u);
-
-        std::cout
-            << "type: " << string_from_type<CalculationType>::name()
-            << " id: " << caseid
-            << " area i: " << area_i
-            << " area u: " << area_u
-            << " area p: " << area_p
-            << " area q: " << area_q
-            << " sum: " << sum;
 
-        if (settings.also_difference)
+        if (settings.verbose)
         {
             std::cout
-                << " area d1: " << area_d1
-                << " area d2: " << area_d2;
+                << "type: " << string_from_type<CalculationType>::name()
+                << " id: " << caseid
+                << " area i: " << area_i
+                << " area u: " << area_u
+                << " area p: " << area_p
+                << " area q: " << area_q
+                << " sum: " << sum;
+
+            if (settings.also_difference)
+            {
+                std::cout
+                        << " area d1: " << area_d1
+                        << " area d2: " << area_d2;
+            }
+            std::cout
+                    << std::endl
+                    << std::setprecision(9)
+                    << " p: " << bg::wkt(p) << std::endl
+                    << " q: " << bg::wkt(q) << std::endl
+                    << " i: " << bg::wkt(out_i) << std::endl
+                    << " u: " << bg::wkt(out_u) << std::endl;
         }
-        std::cout
-            << std::endl
-            << std::setprecision(9)
-            << " p: " << bg::wkt(p) << std::endl
-            << " q: " << bg::wkt(q) << std::endl
-            << " i: " << bg::wkt(out_i) << std::endl
-            << " u: " << bg::wkt(out_u) << std::endl
-            ;
-
     }
 
-    if(svg)
+    std::string filename;
     {
-        std::ostringstream filename;
-        filename << "overlay_" << caseid << "_"
+        std::ostringstream out;
+        out << "overlay_" << caseid << "_"
             << string_from_type<coordinate_type>::name();
         if (!std::is_same<coordinate_type, CalculationType>::value)
         {
-            filename << string_from_type<CalculationType>::name();
+            out << string_from_type<CalculationType>::name();
         }
-
-        filename
+        out
 #if defined(BOOST_GEOMETRY_USE_RESCALING)
-            << "_rescaled"
+             << "_rescaled"
 #endif
-            << ".svg";
+             << ".";
+        filename = out.str();
+    }
+
+    if (wkt)
+    {
+        std::ofstream stream(filename + "wkt");
+        // Stream input WKT's
+        stream << bg::wkt(p) << std::endl;
+        stream << bg::wkt(q) << std::endl;
+        // If you need the output WKT, then stream out_i and out_u
+    }
 
-        std::ofstream svg(filename.str().c_str());
+
+    if (svg)
+    {
+        std::ofstream svg(filename + "svg");
 
         bg::svg_mapper<point_type> mapper(svg, 500, 500);
 
@@ -274,12 +286,12 @@ static bool test_overlay_p_q(std::string const& caseid,
 
         if (settings.also_difference)
         {
-            for (BOOST_AUTO(it, out_d1.begin()); it != out_d1.end(); ++it)
+            for (auto it = out_d1.begin(); it != out_d1.end(); ++it)
             {
                 mapper.map(*it,
                     "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
             }
-            for (BOOST_AUTO(it, out_d2.begin()); it != out_d2.end(); ++it)
+            for (auto it = out_d2.begin(); it != out_d2.end(); ++it)
             {
                 mapper.map(*it,
                     "opacity:0.8;fill:none;stroke:rgb(255,0,255);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");