From 496239e92832ba95750dfcf294b65c48aa4c39d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 5 Nov 2019 09:11:08 +0100 Subject: [PATCH 1/2] lazy replacement of auto_ptr with unique_ptr also add some std::move to please the compiler remove the c++98 flag in the main cmake script Testsuite (at least simply running ctest) works --- CMakeLists.txt | 5 - example/SFCGAL-building/main.cpp | 6 +- example/SFCGAL-export-osg/main.cpp | 6 +- example/SFCGAL-offset/main.cpp | 4 +- src/Envelope.cpp | 16 +- src/Envelope.h | 8 +- src/Geometry.cpp | 4 +- src/Geometry.h | 4 +- src/PolyhedralSurface.h | 2 +- src/PreparedGeometry.cpp | 4 +- src/PreparedGeometry.h | 6 +- src/TriangulatedSurface.cpp | 8 +- src/TriangulatedSurface.h | 2 +- src/algorithm/BoundaryVisitor.cpp | 10 +- src/algorithm/BoundaryVisitor.h | 2 +- src/algorithm/collect.cpp | 12 +- src/algorithm/collect.h | 6 +- src/algorithm/collectionExtract.cpp | 4 +- src/algorithm/collectionExtract.h | 2 +- src/algorithm/collectionHomogenize.cpp | 6 +- src/algorithm/collectionHomogenize.h | 2 +- src/algorithm/collectionToMulti.cpp | 4 +- src/algorithm/collectionToMulti.h | 2 +- src/algorithm/convexHull.cpp | 28 +-- src/algorithm/convexHull.h | 4 +- src/algorithm/difference.cpp | 8 +- src/algorithm/difference.h | 8 +- src/algorithm/extrude.cpp | 52 +++--- src/algorithm/extrude.h | 8 +- src/algorithm/intersection.cpp | 8 +- src/algorithm/intersection.h | 8 +- src/algorithm/intersects.cpp | 6 +- src/algorithm/isValid.cpp | 8 +- src/algorithm/minkowskiSum.cpp | 10 +- src/algorithm/minkowskiSum.h | 4 +- src/algorithm/offset.cpp | 8 +- src/algorithm/offset.h | 4 +- src/algorithm/straightSkeleton.cpp | 26 +-- src/algorithm/straightSkeleton.h | 10 +- src/algorithm/tesselate.cpp | 18 +- src/algorithm/tesselate.h | 4 +- src/algorithm/union.cpp | 12 +- src/algorithm/union.h | 8 +- src/algorithm/volume.cpp | 2 +- src/capi/sfcgal_c.cpp | 18 +- src/detail/GeometrySet.cpp | 10 +- src/detail/GeometrySet.h | 2 +- src/detail/generator/building.cpp | 20 +- src/detail/generator/building.h | 2 +- src/detail/generator/disc.cpp | 6 +- src/detail/generator/disc.h | 2 +- src/detail/generator/hoch.cpp | 6 +- src/detail/generator/hoch.h | 2 +- src/detail/generator/sierpinski.cpp | 4 +- src/detail/generator/sierpinski.h | 2 +- src/detail/io/Serialization.cpp | 8 +- src/detail/io/Serialization.h | 4 +- src/detail/io/WktReader.cpp | 42 ++--- src/detail/polygonSetToMultiPolygon.cpp | 4 +- src/detail/polygonSetToMultiPolygon.h | 2 +- .../ConstraintDelaunayTriangulation.cpp | 4 +- .../ConstraintDelaunayTriangulation.h | 2 +- src/io/ewkt.cpp | 19 +- src/io/ewkt.h | 6 +- src/io/wkt.cpp | 12 +- src/io/wkt.h | 6 +- test/bench/BenchArea.cpp | 4 +- test/bench/BenchMinkowski.cpp | 12 +- test/bench/BenchStraightSkeleton.cpp | 14 +- test/bench/BenchTriangulation.cpp | 12 +- test/bench/IntersectionPerfTest.cpp | 2 +- test/garden/main.cpp | 2 +- test/regress/convex_hull/main.cpp | 4 +- test/regress/polygon_triangulator/main.cpp | 2 +- test/regress/standalone/SFCGAL/AreaTest.cpp | 2 +- .../ConstraintDelaunayTriangulationTest.cpp | 2 +- .../standalone/SFCGAL/DistanceTest.cpp | 4 +- .../standalone/SFCGAL/IntersectionTest.cpp | 5 +- .../standalone/SFCGAL/IntersectsTest.cpp | 4 +- .../SFCGAL/StraightSkeletonTest.cpp | 4 +- .../SFCGAL/TriangulatePolygonTest.cpp | 2 +- test/regress/standalone/SFCGAL/WktTest.cpp | 2 +- test/unit/SFCGAL/EnvelopeTest.cpp | 4 +- test/unit/SFCGAL/GeometryVisitorTest.cpp | 2 +- test/unit/SFCGAL/LineStringTest.cpp | 8 +- test/unit/SFCGAL/PointTest.cpp | 6 +- test/unit/SFCGAL/PolygonTest.cpp | 8 +- test/unit/SFCGAL/SolidTest.cpp | 2 +- test/unit/SFCGAL/TriangleTest.cpp | 6 +- test/unit/SFCGAL/TriangulatedSurfaceTest.cpp | 12 +- .../algorithm/ApproximateMedialAxis.cpp | 28 +-- test/unit/SFCGAL/algorithm/AreaTest.cpp | 8 +- test/unit/SFCGAL/algorithm/BoundaryTest.cpp | 16 +- test/unit/SFCGAL/algorithm/ConnectedTest.cpp | 6 +- test/unit/SFCGAL/algorithm/ConvexHullTest.cpp | 18 +- .../SFCGAL/algorithm/CoversPointsTest.cpp | 16 +- test/unit/SFCGAL/algorithm/CoversTest.cpp | 4 +- test/unit/SFCGAL/algorithm/DifferenceTest.cpp | 174 +++++++++--------- test/unit/SFCGAL/algorithm/DistanceTest.cpp | 52 +++--- test/unit/SFCGAL/algorithm/ExtrudeTest.cpp | 16 +- test/unit/SFCGAL/algorithm/Force3DTest.cpp | 2 +- .../SFCGAL/algorithm/IntersectionTest.cpp | 10 +- test/unit/SFCGAL/algorithm/IntersectsTest.cpp | 4 +- test/unit/SFCGAL/algorithm/IsValidTest.cpp | 4 +- .../SFCGAL/algorithm/MinkowskiSumTest.cpp | 46 ++--- test/unit/SFCGAL/algorithm/NormalTest.cpp | 8 +- test/unit/SFCGAL/algorithm/OffsetTest.cpp | 38 ++-- test/unit/SFCGAL/algorithm/PlaneTest.cpp | 8 +- .../SFCGAL/algorithm/StraightSkeletonTest.cpp | 40 ++-- test/unit/SFCGAL/algorithm/TesselateTest.cpp | 20 +- test/unit/SFCGAL/algorithm/TranslateTest.cpp | 2 +- test/unit/SFCGAL/algorithm/UnionTest.cpp | 168 ++++++++--------- test/unit/SFCGAL/algorithm/VolumeTest.cpp | 6 +- test/unit/SFCGAL/capi/sfcgal_cTest.cpp | 10 +- test/unit/SFCGAL/io/SerializationTest.cpp | 32 ++-- test/unit/SFCGAL/io/WktReaderTest.cpp | 44 ++--- .../transform/ForceZOrderPointsTest.cpp | 2 +- test/unit/SFCGAL/transform/RoundTest.cpp | 4 +- .../SFCGAL/triangulate/Triangulate2DZTest.cpp | 12 +- 119 files changed, 736 insertions(+), 739 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bd10fac..57fc3143 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,11 +39,6 @@ if (CMAKE_CXX_COMPILER MATCHES ".*clang") set(CMAKE_COMPILER_IS_CLANGXX 1) endif () -#-- C++ version -------------------------------------------- -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) - add_definitions("-std=c++98") -endif() - #----------------------------------------------------------- # dependencies #----------------------------------------------------------- diff --git a/example/SFCGAL-building/main.cpp b/example/SFCGAL-building/main.cpp index 573112a4..96fb456e 100644 --- a/example/SFCGAL-building/main.cpp +++ b/example/SFCGAL-building/main.cpp @@ -89,12 +89,12 @@ std::vector< InputData > readInputFile( const std::string & filename ){ void processFile( const std::string & filename ){ std::vector< InputData > data = readInputFile(filename); - std::auto_ptr< GeometryCollection > result( new GeometryCollection() ); + std::unique_ptr< GeometryCollection > result( new GeometryCollection() ); std::cout << "#" << data.size() << std::endl; for ( size_t i = 0; i < data.size(); i++ ){ - std::auto_ptr< Geometry > g( io::readWkt( data[i].wkt ) ); - std::auto_ptr< Geometry > building( generator::building( *g, data[i].wallHeight, data[i].roofSlope ) ) ; + std::unique_ptr< Geometry > g( io::readWkt( data[i].wkt ) ); + std::unique_ptr< Geometry > building( generator::building( *g, data[i].wallHeight, data[i].roofSlope ) ) ; result->addGeometry( building.release() ); } diff --git a/example/SFCGAL-export-osg/main.cpp b/example/SFCGAL-export-osg/main.cpp index 52e380ee..f7380f05 100644 --- a/example/SFCGAL-export-osg/main.cpp +++ b/example/SFCGAL-export-osg/main.cpp @@ -40,7 +40,7 @@ using namespace SFCGAL ; int main(){ detail::io::OsgFactory factory ; - std::auto_ptr< Geometry > g( io::readWkt("MULTILINESTRING((-2.705287 -6.782348, -2.052957 -4.368728, -0.356900 -3.912097, 0.980376 -4.857975, 1.339158 -5.966935, 0.328047 -7.043280, -1.987724 -8.706720, -1.922491 -10.076613, -1.726792 -11.087724, 0.882527 -12.457616, 3.491846 -12.490233, 4.242025 -11.120341, 3.720161 -9.489516, 2.480735 -9.098118, -0.519982 -9.130735, -0.291667 -8.413172, 0.915143 -7.075896, 1.958871 -6.619265, 3.883244 -6.358333, 5.677151 -6.651882, 6.231631 -7.238978, 6.329480 -8.413172, 5.481452 -9.326434, 4.829122 -9.717832, 4.698656 -10.207079, 4.861738 -10.826792, 5.350986 -11.381272, 6.329480 -11.479122, 8.514785 -11.479122, 10.112993 -11.022491, 10.700090 -10.533244, 12.265681 -8.967652, 12.493996 -7.858692, 12.526613 -7.108513, 12.233065 -5.999552, 10.765323 -5.412455, 8.319086 -5.249373, 6.133781 -5.184140, 5.057437 -5.021057, 4.926971 -4.401344, 5.253136 -3.814247, 6.786111 -3.422849, 7.699373 -3.879480, 8.090771 -4.531810, 8.938799 -4.629659, 11.156720 -4.597043, 11.287186 -3.031452, 13.766039 -0.487366, 17.908333 -0.389516, 20.615502 -4.075179, 18.267115 -10.598477, 26.975717 -13.109946))") ); + std::unique_ptr< Geometry > g( io::readWkt("MULTILINESTRING((-2.705287 -6.782348, -2.052957 -4.368728, -0.356900 -3.912097, 0.980376 -4.857975, 1.339158 -5.966935, 0.328047 -7.043280, -1.987724 -8.706720, -1.922491 -10.076613, -1.726792 -11.087724, 0.882527 -12.457616, 3.491846 -12.490233, 4.242025 -11.120341, 3.720161 -9.489516, 2.480735 -9.098118, -0.519982 -9.130735, -0.291667 -8.413172, 0.915143 -7.075896, 1.958871 -6.619265, 3.883244 -6.358333, 5.677151 -6.651882, 6.231631 -7.238978, 6.329480 -8.413172, 5.481452 -9.326434, 4.829122 -9.717832, 4.698656 -10.207079, 4.861738 -10.826792, 5.350986 -11.381272, 6.329480 -11.479122, 8.514785 -11.479122, 10.112993 -11.022491, 10.700090 -10.533244, 12.265681 -8.967652, 12.493996 -7.858692, 12.526613 -7.108513, 12.233065 -5.999552, 10.765323 -5.412455, 8.319086 -5.249373, 6.133781 -5.184140, 5.057437 -5.021057, 4.926971 -4.401344, 5.253136 -3.814247, 6.786111 -3.422849, 7.699373 -3.879480, 8.090771 -4.531810, 8.938799 -4.629659, 11.156720 -4.597043, 11.287186 -3.031452, 13.766039 -0.487366, 17.908333 -0.389516, 20.615502 -4.075179, 18.267115 -10.598477, 26.975717 -13.109946))") ); osg::ref_ptr< osg::Group > root = new osg::Group ; @@ -56,10 +56,10 @@ int main(){ //buffer & extrude { double radius = 0.7 ; - std::auto_ptr< MultiPolygon > buffer( algorithm::offset( *g, radius ) ); + std::unique_ptr< MultiPolygon > buffer( algorithm::offset( *g, radius ) ); algorithm::translate( *buffer, Kernel::Vector_3( 0.0, 0.0, radius ) ); - std::auto_ptr< Geometry > extruded( algorithm::extrude(*buffer,3.0,3.0,3.0) ); + std::unique_ptr< Geometry > extruded( algorithm::extrude(*buffer,3.0,3.0,3.0) ); osg::Geometry * osgGeometry = factory.createGeometry( *extruded ); osg::Geode* geode = new osg::Geode; diff --git a/example/SFCGAL-offset/main.cpp b/example/SFCGAL-offset/main.cpp index 1eb3c7db..43a61a1a 100644 --- a/example/SFCGAL-offset/main.cpp +++ b/example/SFCGAL-offset/main.cpp @@ -25,10 +25,10 @@ using namespace SFCGAL ; int main(){ - std::auto_ptr< Geometry > g( io::readWkt("MULTIPOINT(0 0,5 6,3 2,7 1,4 1,3 5,2 9)") ); + std::unique_ptr< Geometry > g( io::readWkt("MULTIPOINT(0 0,5 6,3 2,7 1,4 1,3 5,2 9)") ); for ( size_t i = 1; i <= 50; i++ ){ - std::auto_ptr< Geometry > buffer( algorithm::offset( *g, 0.2*i ) ); + std::unique_ptr< Geometry > buffer( algorithm::offset( *g, 0.2*i ) ); std::cout << buffer->asText(5) << std::endl ; } diff --git a/src/Envelope.cpp b/src/Envelope.cpp index d9d88aeb..a87bbcbe 100644 --- a/src/Envelope.cpp +++ b/src/Envelope.cpp @@ -181,9 +181,9 @@ bool Envelope::overlaps( const Envelope& a, const Envelope& b ) /// /// /// -std::auto_ptr< LineString > Envelope::toRing() const +std::unique_ptr< LineString > Envelope::toRing() const { - std::auto_ptr< LineString > ring( new LineString() ) ; + std::unique_ptr< LineString > ring( new LineString() ) ; if ( isEmpty() ) { return ring ; @@ -201,18 +201,18 @@ std::auto_ptr< LineString > Envelope::toRing() const /// /// /// -std::auto_ptr< Polygon > Envelope::toPolygon() const +std::unique_ptr< Polygon > Envelope::toPolygon() const { - return std::auto_ptr< Polygon >( new Polygon( toRing().release() ) ) ; + return std::unique_ptr< Polygon >( new Polygon( toRing().release() ) ) ; } /// /// /// -std::auto_ptr< PolyhedralSurface > Envelope::toShell() const +std::unique_ptr< PolyhedralSurface > Envelope::toShell() const { - std::auto_ptr< PolyhedralSurface > shell( new PolyhedralSurface() ) ; + std::unique_ptr< PolyhedralSurface > shell( new PolyhedralSurface() ) ; if ( ! is3D() ) { return shell ; @@ -306,9 +306,9 @@ std::auto_ptr< PolyhedralSurface > Envelope::toShell() const /// /// /// -std::auto_ptr< Solid > Envelope::toSolid() const +std::unique_ptr< Solid > Envelope::toSolid() const { - return std::auto_ptr< Solid >( + return std::unique_ptr< Solid >( new Solid( toShell().release() ) ); } diff --git a/src/Envelope.h b/src/Envelope.h index 5a6c9c9c..48d876d5 100644 --- a/src/Envelope.h +++ b/src/Envelope.h @@ -186,23 +186,23 @@ class SFCGAL_API Envelope { * @brief convenience method to convert to 2D Polygon ring * @warning empty LineString for empty Envelope, may be X or Y collapsed */ - std::auto_ptr< LineString > toRing() const ; + std::unique_ptr< LineString > toRing() const ; /** * @brief convenience method to convert to 2D Polygon * @warning empty Polygon for empty Envelope, may be X or Y collapsed */ - std::auto_ptr< Polygon > toPolygon() const ; + std::unique_ptr< Polygon > toPolygon() const ; /** * @brief convenience method to convert to 3D Shell * @warning empty Solid for empty or non 3D Envelope, may be X, Y or Z collapsed */ - std::auto_ptr< PolyhedralSurface > toShell() const ; + std::unique_ptr< PolyhedralSurface > toShell() const ; /** * @brief convenience method to convert to 3D Solid * @warning empty Solid for empty or non 3D Envelope, may be X, Y or Z collapsed */ - std::auto_ptr< Solid > toSolid() const ; + std::unique_ptr< Solid > toSolid() const ; /* diff --git a/src/Geometry.cpp b/src/Geometry.cpp index 186c94e1..9df30869 100644 --- a/src/Geometry.cpp +++ b/src/Geometry.cpp @@ -83,11 +83,11 @@ Envelope Geometry::envelope() const /// /// /// -std::auto_ptr< Geometry > Geometry::boundary() const +std::unique_ptr< Geometry > Geometry::boundary() const { algorithm::BoundaryVisitor visitor ; accept( visitor ); - return std::auto_ptr< Geometry >( visitor.releaseBoundary() ) ; + return std::unique_ptr< Geometry >( visitor.releaseBoundary() ) ; } diff --git a/src/Geometry.h b/src/Geometry.h index 58935300..8241bb2b 100644 --- a/src/Geometry.h +++ b/src/Geometry.h @@ -186,13 +186,13 @@ class SFCGAL_API Geometry { * @todo In order to adapt to 3D, would be better to define an "Envelope type", * otherway would lead to Polygon and PolyhedralSurface */ - //std::auto_ptr< Geometry > envelope() const = 0 ; + //std::unique_ptr< Geometry > envelope() const = 0 ; Envelope envelope() const ; /** * @brief [OGC/SFA]Returns the boundary of the geometry */ - virtual std::auto_ptr< Geometry > boundary() const ; + virtual std::unique_ptr< Geometry > boundary() const ; /** * @brief Computes the distance to an other geometry diff --git a/src/PolyhedralSurface.h b/src/PolyhedralSurface.h index d8bd1656..57dd13a5 100644 --- a/src/PolyhedralSurface.h +++ b/src/PolyhedralSurface.h @@ -142,7 +142,7 @@ class SFCGAL_API PolyhedralSurface : public Surface { * Convert to CGAL::Polyhedron_3 */ template < typename K, typename Polyhedron > - std::auto_ptr toPolyhedron_3() const { + std::unique_ptr toPolyhedron_3() const { TriangulatedSurface tri; triangulate::triangulatePolygon3D( *this, tri ); return tri.toPolyhedron_3(); diff --git a/src/PreparedGeometry.cpp b/src/PreparedGeometry.cpp index 23e116a1..ebfcd807 100644 --- a/src/PreparedGeometry.cpp +++ b/src/PreparedGeometry.cpp @@ -28,8 +28,8 @@ PreparedGeometry::PreparedGeometry() : { } -PreparedGeometry::PreparedGeometry( std::auto_ptr geometry, srid_t srid ) : - _geometry( geometry ), +PreparedGeometry::PreparedGeometry( std::unique_ptr&& geometry, srid_t srid ) : + _geometry( geometry.release() ), _srid( srid ) { } diff --git a/src/PreparedGeometry.h b/src/PreparedGeometry.h index db42a613..64094f9a 100644 --- a/src/PreparedGeometry.h +++ b/src/PreparedGeometry.h @@ -41,7 +41,7 @@ typedef uint32_t srid_t; * A PreparedGeometry is a shell around a SFCGAL::Geometry. * It is used to store annex data, like SRID or cached computations * - * It is noncopyable since it stores a std::auto_ptr + * It is noncopyable since it stores a std::unique_ptr * */ class SFCGAL_API PreparedGeometry : public boost::noncopyable { @@ -55,7 +55,7 @@ class SFCGAL_API PreparedGeometry : public boost::noncopyable { * Constructor * @param geometry pointer to the underlying SFCGAL::Geometry. Takes ownership */ - PreparedGeometry( std::auto_ptr geometry, srid_t srid = 0 ); + PreparedGeometry( std::unique_ptr&& geometry, srid_t srid = 0 ); /** * Constructor @@ -131,7 +131,7 @@ class SFCGAL_API PreparedGeometry : public boost::noncopyable { protected: // Pointer to underlying Geometry - std::auto_ptr _geometry; + std::unique_ptr _geometry; // SRID of the geometry srid_t _srid; diff --git a/src/TriangulatedSurface.cpp b/src/TriangulatedSurface.cpp index 7aeb2b42..535619e5 100644 --- a/src/TriangulatedSurface.cpp +++ b/src/TriangulatedSurface.cpp @@ -289,7 +289,7 @@ struct Plane_from_facet { }; template < typename K, typename Polyhedron > -std::auto_ptr TriangulatedSurface::toPolyhedron_3() const +std::unique_ptr TriangulatedSurface::toPolyhedron_3() const { Polyhedron* poly = new Polyhedron(); Triangulated2Polyhedron converter( *this ); @@ -298,11 +298,11 @@ std::auto_ptr TriangulatedSurface::toPolyhedron_3() const // compute planes std::transform( poly->facets_begin(), poly->facets_end(), poly->planes_begin(), Plane_from_facet() ); - return std::auto_ptr( poly ); + return std::unique_ptr( poly ); } -template SFCGAL_API std::auto_ptr< detail::MarkedPolyhedron > TriangulatedSurface::toPolyhedron_3() const; -template SFCGAL_API std::auto_ptr< CGAL::Polyhedron_3 > TriangulatedSurface::toPolyhedron_3 >() const; +template SFCGAL_API std::unique_ptr< detail::MarkedPolyhedron > TriangulatedSurface::toPolyhedron_3() const; +template SFCGAL_API std::unique_ptr< CGAL::Polyhedron_3 > TriangulatedSurface::toPolyhedron_3 >() const; }//SFCGAL diff --git a/src/TriangulatedSurface.h b/src/TriangulatedSurface.h index 2d488f3f..a9888591 100644 --- a/src/TriangulatedSurface.h +++ b/src/TriangulatedSurface.h @@ -171,7 +171,7 @@ class SFCGAL_API TriangulatedSurface : public Surface { * @brief Converts a TriangulatedSurface to a CGAL::Polyhedron_3 */ template < typename K, typename Polyhedron > - std::auto_ptr toPolyhedron_3() const; + std::unique_ptr toPolyhedron_3() const; /** * Serializer diff --git a/src/algorithm/BoundaryVisitor.cpp b/src/algorithm/BoundaryVisitor.cpp index 078beac5..4c618c40 100644 --- a/src/algorithm/BoundaryVisitor.cpp +++ b/src/algorithm/BoundaryVisitor.cpp @@ -62,7 +62,7 @@ void BoundaryVisitor::visit( const LineString& g ) _boundary.reset() ; } else { - std::auto_ptr< MultiPoint > boundary( new MultiPoint ); + std::unique_ptr< MultiPoint > boundary( new MultiPoint ); boundary->addGeometry( g.startPoint() ); boundary->addGeometry( g.endPoint() ); _boundary.reset( boundary.release() ); @@ -83,7 +83,7 @@ void BoundaryVisitor::visit( const Polygon& g ) _boundary.reset( g.exteriorRing().clone() ); } else { - std::auto_ptr< MultiLineString > boundary( new MultiLineString ); + std::unique_ptr< MultiLineString > boundary( new MultiLineString ); for ( size_t i = 0; i < g.numRings(); i++ ) { boundary->addGeometry( g.ringN( i ) ); @@ -103,7 +103,7 @@ void BoundaryVisitor::visit( const Triangle& g ) return ; } - std::auto_ptr< LineString > boundary( new LineString ); + std::unique_ptr< LineString > boundary( new LineString ); for ( size_t i = 0; i < 4; i++ ) { boundary->addPoint( g.vertex( i ) ); @@ -255,7 +255,7 @@ void BoundaryVisitor::getBoundaryFromLineStrings( const graph::GeometryGraph& gr _boundary.reset( new Point( graph[ vertices[0] ].coordinate ) ); } else { - std::auto_ptr< MultiPoint > boundary( new MultiPoint ); + std::unique_ptr< MultiPoint > boundary( new MultiPoint ); for ( size_t i = 0; i < vertices.size(); i++ ) { boundary->addGeometry( new Point( graph[ vertices[i] ].coordinate ) ) ; @@ -292,7 +292,7 @@ void BoundaryVisitor::getBoundaryFromPolygons( const graph::GeometryGraph& g ) } else { //TODO merge Line Segments into LineString - std::auto_ptr< MultiLineString > boundary( new MultiLineString ); + std::unique_ptr< MultiLineString > boundary( new MultiLineString ); for ( size_t i = 0; i < boundaryEdges.size(); i++ ) { const edge_descriptor& edge = boundaryEdges[i] ; diff --git a/src/algorithm/BoundaryVisitor.h b/src/algorithm/BoundaryVisitor.h index 30dd4c79..97c3dd50 100644 --- a/src/algorithm/BoundaryVisitor.h +++ b/src/algorithm/BoundaryVisitor.h @@ -89,7 +89,7 @@ class SFCGAL_API BoundaryVisitor : public ConstGeometryVisitor { void getBoundaryFromPolygons( const graph::GeometryGraph& g ); private: - std::auto_ptr< Geometry > _boundary ; + std::unique_ptr< Geometry > _boundary ; }; diff --git a/src/algorithm/collect.cpp b/src/algorithm/collect.cpp index 764a3804..66a94d80 100644 --- a/src/algorithm/collect.cpp +++ b/src/algorithm/collect.cpp @@ -28,32 +28,32 @@ namespace SFCGAL { namespace algorithm { -std::auto_ptr collect( const Geometry& ga, const Geometry& gb ) +std::unique_ptr collect( const Geometry& ga, const Geometry& gb ) { if ( ga.geometryTypeId() == gb.geometryTypeId() ) { if ( ga.geometryTypeId() == TYPE_POINT ) { MultiPoint* mp = new MultiPoint; mp->addGeometry( ga ); mp->addGeometry( gb ); - return std::auto_ptr( mp ); + return std::unique_ptr( mp ); } else if ( ga.geometryTypeId() == TYPE_LINESTRING ) { MultiLineString* mls = new MultiLineString(); mls->addGeometry( ga ); mls->addGeometry( gb ); - return std::auto_ptr( mls ); + return std::unique_ptr( mls ); } else if ( ga.geometryTypeId() == TYPE_POLYGON ) { MultiPolygon* mp = new MultiPolygon(); mp->addGeometry( ga ); mp->addGeometry( gb ); - return std::auto_ptr( mp ); + return std::unique_ptr( mp ); } else if ( ga.geometryTypeId() == TYPE_SOLID ) { MultiSolid* mp = new MultiSolid(); mp->addGeometry( ga ); mp->addGeometry( gb ); - return std::auto_ptr( mp ); + return std::unique_ptr( mp ); } } @@ -61,7 +61,7 @@ std::auto_ptr collect( const Geometry& ga, const Geometry& gb ) GeometryCollection* coll = new GeometryCollection(); coll->addGeometry( ga ); coll->addGeometry( gb ); - return std::auto_ptr( coll ); + return std::unique_ptr( coll ); } } } diff --git a/src/algorithm/collect.h b/src/algorithm/collect.h index d428d68f..6197d192 100644 --- a/src/algorithm/collect.h +++ b/src/algorithm/collect.h @@ -32,14 +32,14 @@ namespace algorithm { * Returns an aggregate of ga and gb * @ingroup detail */ -SFCGAL_API std::auto_ptr collect( const Geometry& ga, const Geometry& gb ); +SFCGAL_API std::unique_ptr collect( const Geometry& ga, const Geometry& gb ); /** * Returns an aggregate of a list of geometries * @ingroup detail */ template -std::auto_ptr collect( GeometryIterator begin, GeometryIterator end ) +std::unique_ptr collect( GeometryIterator begin, GeometryIterator end ) { GeometryIterator it; // FIXME: optimize type. For instance, if all the given geometries are points, return a MultiPoint instead of a GeometryCollection @@ -49,7 +49,7 @@ std::auto_ptr collect( GeometryIterator begin, GeometryIterator end ) coll->addGeometry( *it ); } - return std::auto_ptr( coll ); + return std::unique_ptr( coll ); } } } diff --git a/src/algorithm/collectionExtract.cpp b/src/algorithm/collectionExtract.cpp index 1af81461..b0cad0ac 100644 --- a/src/algorithm/collectionExtract.cpp +++ b/src/algorithm/collectionExtract.cpp @@ -34,7 +34,7 @@ namespace algorithm { // Use of auto_ptr : // If nothing has to be built, g will be moved to the result without copy and new allocation. // Otherwise, a new geometry is built and the old one is deleted -std::auto_ptr collectionExtractPolygons( std::auto_ptr g ) +std::unique_ptr collectionExtractPolygons( std::unique_ptr g ) { if ( ! g->is() ) { // not a collection, nothing to do @@ -84,7 +84,7 @@ std::auto_ptr collectionExtractPolygons( std::auto_ptr g ) } } - return std::auto_ptr( ret_geo ); + return std::unique_ptr( ret_geo ); } } diff --git a/src/algorithm/collectionExtract.h b/src/algorithm/collectionExtract.h index 6fba9e8b..d107c4e1 100644 --- a/src/algorithm/collectionExtract.h +++ b/src/algorithm/collectionExtract.h @@ -35,7 +35,7 @@ namespace algorithm { * @warning Ownership is taken from the parameter * @ingroup detail */ -SFCGAL_API std::auto_ptr collectionExtractPolygons( std::auto_ptr coll ); +SFCGAL_API std::unique_ptr collectionExtractPolygons( std::unique_ptr coll ); } } diff --git a/src/algorithm/collectionHomogenize.cpp b/src/algorithm/collectionHomogenize.cpp index 8b5acd20..623a69ca 100644 --- a/src/algorithm/collectionHomogenize.cpp +++ b/src/algorithm/collectionHomogenize.cpp @@ -32,7 +32,7 @@ namespace algorithm { // Use of auto_ptr : // If nothing has to be built, g will be moved to the result without copy and new allocation. // Otherwise, a new geometry is built and the old one is deleted -std::auto_ptr collectionHomogenize( std::auto_ptr g ) +std::unique_ptr collectionHomogenize( std::unique_ptr g ) { // unknown type int common_type = 0; @@ -46,7 +46,7 @@ std::auto_ptr collectionHomogenize( std::auto_ptr g ) // test if it is a singleton if ( coll.numGeometries() == 1 ) { - return std::auto_ptr( coll.geometryN( 0 ).clone() ); + return std::unique_ptr( coll.geometryN( 0 ).clone() ); } for ( size_t i = 0; i < coll.numGeometries(); ++i ) { @@ -88,7 +88,7 @@ std::auto_ptr collectionHomogenize( std::auto_ptr g ) ret_geo->addGeometry( coll.geometryN( i ) ); } - return std::auto_ptr( ret_geo ); + return std::unique_ptr( ret_geo ); } } diff --git a/src/algorithm/collectionHomogenize.h b/src/algorithm/collectionHomogenize.h index 98517233..501a8c42 100644 --- a/src/algorithm/collectionHomogenize.h +++ b/src/algorithm/collectionHomogenize.h @@ -38,7 +38,7 @@ namespace algorithm { * @warning Ownership is taken from the parameter * @ingroup detail */ -SFCGAL_API std::auto_ptr collectionHomogenize( std::auto_ptr coll ); +SFCGAL_API std::unique_ptr collectionHomogenize( std::unique_ptr coll ); } } diff --git a/src/algorithm/collectionToMulti.cpp b/src/algorithm/collectionToMulti.cpp index c6273f67..99ebdb73 100644 --- a/src/algorithm/collectionToMulti.cpp +++ b/src/algorithm/collectionToMulti.cpp @@ -34,7 +34,7 @@ namespace algorithm { // Use of auto_ptr : // If nothing has to be built, g will be moved to the result without copy and new allocation. // Otherwise, a new geometry is built and the old one is deleted -std::auto_ptr collectionToMulti( std::auto_ptr g ) +std::unique_ptr collectionToMulti( std::unique_ptr g ) { if ( ! g->is() ) { // not a collection, nothing to do @@ -118,7 +118,7 @@ std::auto_ptr collectionToMulti( std::auto_ptr g ) } } - return std::auto_ptr( ret_geo ); + return std::unique_ptr( ret_geo ); } } diff --git a/src/algorithm/collectionToMulti.h b/src/algorithm/collectionToMulti.h index 53a4d746..27e1d6cf 100644 --- a/src/algorithm/collectionToMulti.h +++ b/src/algorithm/collectionToMulti.h @@ -35,7 +35,7 @@ namespace algorithm { * @warning Ownership is taken from the parameter * @ingroup */ -SFCGAL_API std::auto_ptr collectionToMulti( std::auto_ptr coll ); +SFCGAL_API std::unique_ptr collectionToMulti( std::unique_ptr coll ); } } diff --git a/src/algorithm/convexHull.cpp b/src/algorithm/convexHull.cpp index 22151f0d..c4651c93 100644 --- a/src/algorithm/convexHull.cpp +++ b/src/algorithm/convexHull.cpp @@ -52,12 +52,12 @@ typedef CGAL::Point_2< Kernel > Point_2; /// /// /// -std::auto_ptr convexHull( const Geometry& g ) +std::unique_ptr convexHull( const Geometry& g ) { using CGAL::object_cast ; if ( g.isEmpty() ) { - return std::auto_ptr( g.clone() ); + return std::unique_ptr( g.clone() ); } SFCGAL::detail::GetPointsVisitor getPointVisitor; @@ -66,7 +66,7 @@ std::auto_ptr convexHull( const Geometry& g ) // collect points if ( getPointVisitor.points.size() == 0 ) { - return std::auto_ptr( new GeometryCollection() ); + return std::unique_ptr( new GeometryCollection() ); } std::vector< Point_2 > points ; @@ -80,11 +80,11 @@ std::auto_ptr convexHull( const Geometry& g ) CGAL::convex_hull_2( points.begin(), points.end(), std::back_inserter( epoints ) ) ; if ( epoints.size() == 1 ) { - return std::auto_ptr( new Point( *epoints.begin() ) ); + return std::unique_ptr( new Point( *epoints.begin() ) ); } else if ( epoints.size() == 2 ) { std::list::const_iterator it = epoints.begin(); - return std::auto_ptr( new LineString( Point( *it++ ), Point( *it++ ) ) ); + return std::unique_ptr( new LineString( Point( *it++ ), Point( *it++ ) ) ); } // GEOS does not seem to return triangles else if ( epoints.size() == 3 ) { @@ -92,7 +92,7 @@ std::auto_ptr convexHull( const Geometry& g ) Point_2 p( *it++ ); Point_2 q( *it++ ); Point_2 r( *it++ ); - return std::auto_ptr( new Triangle( p, q, r ) ) ; + return std::unique_ptr( new Triangle( p, q, r ) ) ; } else if ( epoints.size() > 3 ) { Polygon* poly = new Polygon; @@ -103,7 +103,7 @@ std::auto_ptr convexHull( const Geometry& g ) // add back the first point to close the ring poly->exteriorRing().addPoint( *epoints.begin() ); - return std::auto_ptr( poly ); + return std::unique_ptr( poly ); } else { BOOST_THROW_EXCEPTION( Exception( "unexpected CGAL output type in CGAL::convex_hull_2" ) ); @@ -113,7 +113,7 @@ std::auto_ptr convexHull( const Geometry& g ) /// /// /// -std::auto_ptr convexHull3D( const Geometry& g ) +std::unique_ptr convexHull3D( const Geometry& g ) { using CGAL::object_cast ; @@ -138,23 +138,23 @@ std::auto_ptr convexHull3D( const Geometry& g ) CGAL::convex_hull_3( points.begin(), points.end(), hull ) ; if ( hull.empty() ) { - return std::auto_ptr( new GeometryCollection() ); + return std::unique_ptr( new GeometryCollection() ); } else if ( const Point_3* point = object_cast< Point_3 >( &hull ) ) { - return std::auto_ptr( new Point( *point ) ); + return std::unique_ptr( new Point( *point ) ); } else if ( const Segment_3* segment = object_cast< Segment_3 >( &hull ) ) { - return std::auto_ptr( new LineString( Point( segment->start() ), Point( segment->end() ) ) ); + return std::unique_ptr( new LineString( Point( segment->start() ), Point( segment->end() ) ) ); } else if ( const Triangle_3* triangle = object_cast< Triangle_3 >( &hull ) ) { - return std::auto_ptr( new Triangle( + return std::unique_ptr( new Triangle( Point( triangle->vertex( 0 ) ), Point( triangle->vertex( 1 ) ), Point( triangle->vertex( 2 ) ) ) ); } else if ( const Polyhedron_3* polyhedron = object_cast< Polyhedron_3 >( &hull ) ) { - std::auto_ptr< PolyhedralSurface > result( new PolyhedralSurface() ); + std::unique_ptr< PolyhedralSurface > result( new PolyhedralSurface() ); for ( Polyhedron_3::Facet_const_iterator it_facet = polyhedron->facets_begin(); it_facet != polyhedron->facets_end(); ++it_facet ) { @@ -172,7 +172,7 @@ std::auto_ptr convexHull3D( const Geometry& g ) result->addPolygon( Polygon( ring ) ); } - return std::auto_ptr( result.release() ); + return std::unique_ptr( result.release() ); } else { BOOST_THROW_EXCEPTION( Exception( "unexpected CGAL output type in CGAL::convex_hull_3" ) ); diff --git a/src/algorithm/convexHull.h b/src/algorithm/convexHull.h index 991e7e92..aa7c11b8 100644 --- a/src/algorithm/convexHull.h +++ b/src/algorithm/convexHull.h @@ -32,14 +32,14 @@ namespace algorithm { * Compute the 2D convex hull for a geometry * @ingroup public_api */ -SFCGAL_API std::auto_ptr convexHull( const Geometry& g ) ; +SFCGAL_API std::unique_ptr convexHull( const Geometry& g ) ; /** * Compute the 3D convex hull for a geometry * @todo improve to handle collinear points and coplanar points * @ingroup public_api */ -SFCGAL_API std::auto_ptr convexHull3D( const Geometry& g ) ; +SFCGAL_API std::unique_ptr convexHull3D( const Geometry& g ) ; }//algorithm diff --git a/src/algorithm/difference.cpp b/src/algorithm/difference.cpp index c4eab514..34410323 100644 --- a/src/algorithm/difference.cpp +++ b/src/algorithm/difference.cpp @@ -390,7 +390,7 @@ void difference( const GeometrySet& a, const GeometrySet& b, GeometryS template void difference<2>( const GeometrySet<2>& a, const GeometrySet<2>& b, GeometrySet<2>& ); template void difference<3>( const GeometrySet<3>& a, const GeometrySet<3>& b, GeometrySet<3>& ); -std::auto_ptr difference( const Geometry& ga, const Geometry& gb, NoValidityCheck ) +std::unique_ptr difference( const Geometry& ga, const Geometry& gb, NoValidityCheck ) { GeometrySet<2> gsa( ga ), gsb( gb ), output; algorithm::difference( gsa, gsb, output ); @@ -400,7 +400,7 @@ std::auto_ptr difference( const Geometry& ga, const Geometry& gb, NoVa return filtered.recompose(); } -std::auto_ptr difference( const Geometry& ga, const Geometry& gb ) +std::unique_ptr difference( const Geometry& ga, const Geometry& gb ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( ga ); SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( gb ); @@ -408,7 +408,7 @@ std::auto_ptr difference( const Geometry& ga, const Geometry& gb ) return difference( ga, gb, NoValidityCheck() ); } -std::auto_ptr difference3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ) +std::unique_ptr difference3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ) { GeometrySet<3> gsa( ga ), gsb( gb ), output; algorithm::difference( gsa, gsb, output ); @@ -419,7 +419,7 @@ std::auto_ptr difference3D( const Geometry& ga, const Geometry& gb, No return filtered.recompose(); } -std::auto_ptr difference3D( const Geometry& ga, const Geometry& gb ) +std::unique_ptr difference3D( const Geometry& ga, const Geometry& gb ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY_3D( ga ); SFCGAL_ASSERT_GEOMETRY_VALIDITY_3D( gb ); diff --git a/src/algorithm/difference.h b/src/algorithm/difference.h index 9e98461a..4eb826b5 100644 --- a/src/algorithm/difference.h +++ b/src/algorithm/difference.h @@ -40,7 +40,7 @@ struct NoValidityCheck; * @pre ga and gb are valid geometries * @ingroup public_api */ -SFCGAL_API std::auto_ptr difference( const Geometry& ga, const Geometry& gb ); +SFCGAL_API std::unique_ptr difference( const Geometry& ga, const Geometry& gb ); /** * Diffrence on 2D geometries. No validity check variant @@ -48,14 +48,14 @@ SFCGAL_API std::auto_ptr difference( const Geometry& ga, const Geometr * @ingroup detail * @warning No actual validity check is done. */ -SFCGAL_API std::auto_ptr difference( const Geometry& ga, const Geometry& gb,NoValidityCheck ); +SFCGAL_API std::unique_ptr difference( const Geometry& ga, const Geometry& gb,NoValidityCheck ); /** * Difference on 3D geometries. Assume z = 0 if needed * @pre ga and gb are valid geometries * @ingroup public_api */ -SFCGAL_API std::auto_ptr difference3D( const Geometry& ga, const Geometry& gb ); +SFCGAL_API std::unique_ptr difference3D( const Geometry& ga, const Geometry& gb ); /** * Difference on 3D geometries. Assume z = 0 if needed @@ -63,7 +63,7 @@ SFCGAL_API std::auto_ptr difference3D( const Geometry& ga, const Geome * @ingroup detail * @warning@ No actual validity check is done */ -SFCGAL_API std::auto_ptr difference3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ); +SFCGAL_API std::unique_ptr difference3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ); /** * @ingroup detail diff --git a/src/algorithm/extrude.cpp b/src/algorithm/extrude.cpp index c5cb7a70..dfbcca2a 100644 --- a/src/algorithm/extrude.cpp +++ b/src/algorithm/extrude.cpp @@ -95,14 +95,14 @@ LineString* extrude( const Point& g, const Kernel::Vector_3& v ) PolyhedralSurface* extrude( const LineString& g, const Kernel::Vector_3& v ) { - std::auto_ptr< PolyhedralSurface > polyhedralSurface( new PolyhedralSurface() ); + std::unique_ptr< PolyhedralSurface > polyhedralSurface( new PolyhedralSurface() ); if ( g.isEmpty() ) { return polyhedralSurface.release(); } for ( size_t i = 0; i < g.numPoints() - 1; i++ ) { - std::auto_ptr< LineString > ring( new LineString ) ; + std::unique_ptr< LineString > ring( new LineString ) ; Kernel::Point_3 a = g.pointN( i ).toPoint_3() ; Kernel::Point_3 b = g.pointN( i+1 ).toPoint_3() ; @@ -150,7 +150,7 @@ Solid* extrude( const Polygon& g, const Kernel::Vector_3& v ) // exterior ring and interior rings extruded for ( size_t i = 0; i < bottom.numRings(); i++ ) { - std::auto_ptr< PolyhedralSurface > boundaryExtruded( extrude( bottom.ringN( i ), v ) ); + std::unique_ptr< PolyhedralSurface > boundaryExtruded( extrude( bottom.ringN( i ), v ) ); for ( size_t j = 0; j < boundaryExtruded->numPolygons(); j++ ) { boundaryExtruded->polygonN( j ).reverse() ; @@ -175,7 +175,7 @@ Solid* extrude( const Triangle& g, const Kernel::Vector_3& v ) /// MultiLineString* extrude( const MultiPoint& g, const Kernel::Vector_3& v ) { - std::auto_ptr< MultiLineString > result( new MultiLineString() ); + std::unique_ptr< MultiLineString > result( new MultiLineString() ); if ( g.isEmpty() ) { return result.release(); @@ -194,14 +194,14 @@ MultiLineString* extrude( const MultiPoint& g, const Kernel::Vector_3& v ) /// PolyhedralSurface* extrude( const MultiLineString& g, const Kernel::Vector_3& v ) { - std::auto_ptr< PolyhedralSurface > result( new PolyhedralSurface() ); + std::unique_ptr< PolyhedralSurface > result( new PolyhedralSurface() ); if ( g.isEmpty() ) { return result.release(); } for ( size_t i = 0; i < g.numGeometries(); i++ ) { - std::auto_ptr< PolyhedralSurface > extruded( extrude( g.lineStringN( i ), v ) ); + std::unique_ptr< PolyhedralSurface > extruded( extrude( g.lineStringN( i ), v ) ); for ( size_t j = 0; j < extruded->numPolygons(); j++ ) { result->addPolygon( extruded->polygonN( j ) ); @@ -217,7 +217,7 @@ PolyhedralSurface* extrude( const MultiLineString& g, const Kernel::Vector_3& v /// MultiSolid* extrude( const MultiPolygon& g, const Kernel::Vector_3& v ) { - std::auto_ptr< MultiSolid > result( new MultiSolid() ); + std::unique_ptr< MultiSolid > result( new MultiSolid() ); if ( g.isEmpty() ) { return result.release(); @@ -236,7 +236,7 @@ MultiSolid* extrude( const MultiPolygon& g, const Kernel::Vector_3& v /// Solid* extrude( const TriangulatedSurface& g, const Kernel::Vector_3& v ) { - std::auto_ptr< Solid > result( new Solid() ); + std::unique_ptr< Solid > result( new Solid() ); if ( g.isEmpty() ) { return result.release(); @@ -256,12 +256,12 @@ Solid* extrude( const TriangulatedSurface& g, const Kernel::Vector_3& v ) } //boundary - std::auto_ptr< Geometry > boundary( g.boundary() ) ; + std::unique_ptr< Geometry > boundary( g.boundary() ) ; BOOST_ASSERT( boundary.get() != NULL ); // closed surface extruded if ( ! boundary->isEmpty() ) { - std::auto_ptr< Geometry > extrudedBoundary( extrude( *boundary, v ) ) ; + std::unique_ptr< Geometry > extrudedBoundary( extrude( *boundary, v ) ) ; BOOST_ASSERT( extrudedBoundary->is< PolyhedralSurface >() ); result->exteriorShell().addPolygons( extrudedBoundary->as< PolyhedralSurface >() ); } @@ -289,7 +289,7 @@ Solid* extrude( const PolyhedralSurface& g, const Kernel::Vector_3& v ) /// GeometryCollection* extrude( const GeometryCollection& g, const Kernel::Vector_3& v ) { - std::auto_ptr< GeometryCollection > result( new GeometryCollection() ) ; + std::unique_ptr< GeometryCollection > result( new GeometryCollection() ) ; if ( g.isEmpty() ) { return result.release(); @@ -307,38 +307,38 @@ GeometryCollection* extrude( const GeometryCollection& g, const Kernel::Vector /// /// /// -std::auto_ptr< Geometry > extrude( const Geometry& g, const Kernel::Vector_3& v ) +std::unique_ptr< Geometry > extrude( const Geometry& g, const Kernel::Vector_3& v ) { switch ( g.geometryTypeId() ) { case TYPE_POINT: - return std::auto_ptr< Geometry >( extrude( g.as< Point >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< Point >(), v ) ); case TYPE_LINESTRING: - return std::auto_ptr< Geometry >( extrude( g.as< LineString >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< LineString >(), v ) ); case TYPE_POLYGON: - return std::auto_ptr< Geometry >( extrude( g.as< Polygon >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< Polygon >(), v ) ); case TYPE_TRIANGLE: - return std::auto_ptr< Geometry >( extrude( g.as< Triangle >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< Triangle >(), v ) ); case TYPE_GEOMETRYCOLLECTION: - return std::auto_ptr< Geometry >( extrude( g.as< GeometryCollection >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< GeometryCollection >(), v ) ); case TYPE_MULTIPOINT: - return std::auto_ptr< Geometry >( extrude( g.as< MultiPoint >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< MultiPoint >(), v ) ); case TYPE_MULTILINESTRING: - return std::auto_ptr< Geometry >( extrude( g.as< MultiLineString >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< MultiLineString >(), v ) ); case TYPE_MULTIPOLYGON: - return std::auto_ptr< Geometry >( extrude( g.as< MultiPolygon >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< MultiPolygon >(), v ) ); case TYPE_TRIANGULATEDSURFACE: - return std::auto_ptr< Geometry >( extrude( g.as< TriangulatedSurface >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< TriangulatedSurface >(), v ) ); case TYPE_POLYHEDRALSURFACE: - return std::auto_ptr< Geometry >( extrude( g.as< PolyhedralSurface >(), v ) ); + return std::unique_ptr< Geometry >( extrude( g.as< PolyhedralSurface >(), v ) ); case TYPE_SOLID: case TYPE_MULTISOLID: @@ -355,20 +355,20 @@ std::auto_ptr< Geometry > extrude( const Geometry& g, const Kernel::Vector_3& v /// /// /// -std::auto_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, Kernel::FT dy, Kernel::FT dz, NoValidityCheck ) +std::unique_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, Kernel::FT dy, Kernel::FT dz, NoValidityCheck ) { return extrude( g, Kernel::Vector_3( dx,dy,dz ) ) ; } -std::auto_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, Kernel::FT dy, Kernel::FT dz ) +std::unique_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, Kernel::FT dy, Kernel::FT dz ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY( g ); - std::auto_ptr result( extrude( g, dx, dy, dz, NoValidityCheck() ) ); + std::unique_ptr result( extrude( g, dx, dy, dz, NoValidityCheck() ) ); propagateValidityFlag( *result, true ); return result; } -SFCGAL_API std::auto_ptr< Geometry > extrude( const Geometry& g, const double& dx, const double& dy, const double& dz ) +SFCGAL_API std::unique_ptr< Geometry > extrude( const Geometry& g, const double& dx, const double& dy, const double& dz ) { if ( !std::isfinite( dx ) || !std::isfinite( dy ) || !std::isfinite( dz ) ) { BOOST_THROW_EXCEPTION( NonFiniteValueException( "trying to extrude with non finite value in direction" ) ); diff --git a/src/algorithm/extrude.h b/src/algorithm/extrude.h index 2a857024..16dee833 100644 --- a/src/algorithm/extrude.h +++ b/src/algorithm/extrude.h @@ -35,7 +35,7 @@ struct NoValidityCheck; * @pre g is a valid geometry * @ingroup public_api */ -SFCGAL_API std::auto_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, Kernel::FT dy, Kernel::FT dz ) ; +SFCGAL_API std::unique_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, Kernel::FT dy, Kernel::FT dz ) ; /** * extrude a Geometry with a direction @@ -43,7 +43,7 @@ SFCGAL_API std::auto_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, * @ingroup detail * @warning No actual validity check is done. */ -SFCGAL_API std::auto_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, Kernel::FT dy, Kernel::FT dz, NoValidityCheck ) ; +SFCGAL_API std::unique_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, Kernel::FT dy, Kernel::FT dz, NoValidityCheck ) ; /** * extrude a Geometry with a direction @@ -52,7 +52,7 @@ SFCGAL_API std::auto_ptr< Geometry > extrude( const Geometry& g, Kernel::FT dx, * @ingroup detail * @warning No actual validity check is done. */ -SFCGAL_API std::auto_ptr< Geometry > extrude( const Geometry& g, const double& dx, const double& dy, const double& dz ); +SFCGAL_API std::unique_ptr< Geometry > extrude( const Geometry& g, const double& dx, const double& dy, const double& dz ); /** * @brief extrude a Geometry by a given vector @@ -60,7 +60,7 @@ SFCGAL_API std::auto_ptr< Geometry > extrude( const Geometry& g, const double& d * get output geometries with a clean topology) * @ingroup detail */ -SFCGAL_API std::auto_ptr< Geometry > extrude( const Geometry& g, const Kernel::Vector_3& v ) ; +SFCGAL_API std::unique_ptr< Geometry > extrude( const Geometry& g, const Kernel::Vector_3& v ) ; }//algorithm }//SFCGAL diff --git a/src/algorithm/intersection.cpp b/src/algorithm/intersection.cpp index 719945c3..f23e11dc 100644 --- a/src/algorithm/intersection.cpp +++ b/src/algorithm/intersection.cpp @@ -150,7 +150,7 @@ void intersection( const GeometrySet& a, const GeometrySet& b, Geometr template void intersection<2>( const GeometrySet<2>& a, const GeometrySet<2>& b, GeometrySet<2>& ); template void intersection<3>( const GeometrySet<3>& a, const GeometrySet<3>& b, GeometrySet<3>& ); -std::auto_ptr intersection( const Geometry& ga, const Geometry& gb, NoValidityCheck ) +std::unique_ptr intersection( const Geometry& ga, const Geometry& gb, NoValidityCheck ) { GeometrySet<2> gsa( ga ), gsb( gb ), output; algorithm::intersection( gsa, gsb, output ); @@ -160,7 +160,7 @@ std::auto_ptr intersection( const Geometry& ga, const Geometry& gb, No return filtered.recompose(); } -std::auto_ptr intersection( const Geometry& ga, const Geometry& gb ) +std::unique_ptr intersection( const Geometry& ga, const Geometry& gb ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( ga ); SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( gb ); @@ -168,7 +168,7 @@ std::auto_ptr intersection( const Geometry& ga, const Geometry& gb ) return intersection( ga, gb, NoValidityCheck() ); } -std::auto_ptr intersection3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ) +std::unique_ptr intersection3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ) { GeometrySet<3> gsa( ga ), gsb( gb ), output; algorithm::intersection( gsa, gsb, output ); @@ -179,7 +179,7 @@ std::auto_ptr intersection3D( const Geometry& ga, const Geometry& gb, return filtered.recompose(); } -std::auto_ptr intersection3D( const Geometry& ga, const Geometry& gb ) +std::unique_ptr intersection3D( const Geometry& ga, const Geometry& gb ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY_3D( ga ); SFCGAL_ASSERT_GEOMETRY_VALIDITY_3D( gb ); diff --git a/src/algorithm/intersection.h b/src/algorithm/intersection.h index 0b4dc0c7..83d679bf 100644 --- a/src/algorithm/intersection.h +++ b/src/algorithm/intersection.h @@ -40,7 +40,7 @@ struct NoValidityCheck; * @pre ga and gb are valid geometries * @ingroup public_api */ -SFCGAL_API std::auto_ptr intersection( const Geometry& ga, const Geometry& gb ); +SFCGAL_API std::unique_ptr intersection( const Geometry& ga, const Geometry& gb ); /** * Intersection on 2D geometries. No validity check variant @@ -48,14 +48,14 @@ SFCGAL_API std::auto_ptr intersection( const Geometry& ga, const Geome * @ingroup detail * @warning No actual validity check is done. */ -SFCGAL_API std::auto_ptr intersection( const Geometry& ga, const Geometry& gb,NoValidityCheck ); +SFCGAL_API std::unique_ptr intersection( const Geometry& ga, const Geometry& gb,NoValidityCheck ); /** * Intersection on 3D geometries. Assume z = 0 if needed * @pre ga and gb are valid geometries * @ingroup public_api */ -SFCGAL_API std::auto_ptr intersection3D( const Geometry& ga, const Geometry& gb ); +SFCGAL_API std::unique_ptr intersection3D( const Geometry& ga, const Geometry& gb ); /** * Intersection on 3D geometries. Assume z = 0 if needed @@ -63,7 +63,7 @@ SFCGAL_API std::auto_ptr intersection3D( const Geometry& ga, const Geo * @ingroup detail * @warning@ No actual validity check is done */ -SFCGAL_API std::auto_ptr intersection3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ); +SFCGAL_API std::unique_ptr intersection3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ); /** * @ingroup detail diff --git a/src/algorithm/intersects.cpp b/src/algorithm/intersects.cpp index 4836d0a4..dd678c71 100644 --- a/src/algorithm/intersects.cpp +++ b/src/algorithm/intersects.cpp @@ -452,7 +452,7 @@ bool selfIntersectsImpl( const LineString& line ) /** @todo find a way to avoid ugly copy/paste here, toPoint_d< Dim > can be used, * but I dont know what to do with Kernel::Segment_Dim and Kernel::Point_Dim */ - std::auto_ptr< Geometry > inter; // null if no intersection + std::unique_ptr< Geometry > inter; // null if no intersection if ( Dim == 2 ) { const CGAL::Segment_2< Kernel > s1( l.pointN( i ).toPoint_2(), l.pointN( i + 1 ).toPoint_2() ) ; @@ -515,7 +515,7 @@ bool selfIntersectsImpl( const PolyhedralSurface& s, const SurfaceGraph& graph ) for ( size_t pi=0; pi != numPolygons; ++pi ) { for ( size_t pj=pi+1; pj < numPolygons; ++pj ) { - std::auto_ptr< Geometry > inter = Dim == 3 + std::unique_ptr< Geometry > inter = Dim == 3 ? intersection3D( s.polygonN( pi ), s.polygonN( pj ) ) : intersection( s.polygonN( pi ), s.polygonN( pj ) ) ; @@ -564,7 +564,7 @@ bool selfIntersectsImpl( const TriangulatedSurface& tin, const SurfaceGraph& gra for ( size_t ti=0; ti != numTriangles; ++ti ) { for ( size_t tj=ti+1; tj < numTriangles; ++tj ) { - std::auto_ptr< Geometry > inter = Dim == 3 + std::unique_ptr< Geometry > inter = Dim == 3 ? intersection3D( tin.triangleN( ti ), tin.triangleN( tj ) ) : intersection( tin.triangleN( ti ), tin.triangleN( tj ) ) ; diff --git a/src/algorithm/isValid.cpp b/src/algorithm/isValid.cpp index 92a79db0..fce16ec7 100644 --- a/src/algorithm/isValid.cpp +++ b/src/algorithm/isValid.cpp @@ -84,7 +84,7 @@ void SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( const Geometry& g ) { using namespace SFCGAL; if ( (g).is3D() ) { - std::auto_ptr sfcgalAssertGeometryValidityClone( (g).clone() ); + std::unique_ptr sfcgalAssertGeometryValidityClone( (g).clone() ); algorithm::force2D( *sfcgalAssertGeometryValidityClone ); SFCGAL_ASSERT_GEOMETRY_VALIDITY_( (*sfcgalAssertGeometryValidityClone), "When converting to 2D - " ); } @@ -100,7 +100,7 @@ void SFCGAL_ASSERT_GEOMETRY_VALIDITY_3D( const Geometry& g ) { using namespace SFCGAL; if ( !(g).is3D() ) { - std::auto_ptr sfcgalAssertGeometryValidityClone( (g).clone() ); + std::unique_ptr sfcgalAssertGeometryValidityClone( (g).clone() ); algorithm::force3D( *sfcgalAssertGeometryValidityClone ); SFCGAL_ASSERT_GEOMETRY_VALIDITY_( (*sfcgalAssertGeometryValidityClone), "When converting to 3D - " ); } @@ -254,7 +254,7 @@ const Validity isValid( const Polygon& p, const double& toleranceAbs ) for ( size_t ri=0; ri < numRings; ++ri ) { // no need for numRings-1, the next loop won't be entered for the last ring for ( size_t rj=ri+1; rj < numRings; ++rj ) { - std::auto_ptr inter = p.is3D() + std::unique_ptr inter = p.is3D() ? intersection3D( p.ringN( ri ), p.ringN( rj ) ) : intersection( p.ringN( ri ), p.ringN( rj ) ); @@ -355,7 +355,7 @@ const Validity isValid( const MultiPolygon& mp, const double& toleranceAbs ) for ( size_t pi = 0; pi != numPolygons; ++pi ) { for ( size_t pj = pi+1; pj < numPolygons; ++pj ) { - std::auto_ptr< Geometry > inter = mp.is3D() + std::unique_ptr< Geometry > inter = mp.is3D() ? intersection3D( mp.polygonN( pi ), mp.polygonN( pj ) ) : intersection( mp.polygonN( pi ), mp.polygonN( pj ) ) ; diff --git a/src/algorithm/minkowskiSum.cpp b/src/algorithm/minkowskiSum.cpp index bf3fc7dd..37e4ae54 100644 --- a/src/algorithm/minkowskiSum.cpp +++ b/src/algorithm/minkowskiSum.cpp @@ -262,15 +262,15 @@ void minkowskiSumCollection( const Geometry& gA, const Polygon_2& gB, Polygon_se } -std::auto_ptr< Geometry > minkowskiSum( const Geometry& gA, const Polygon& gB, NoValidityCheck ) +std::unique_ptr< Geometry > minkowskiSum( const Geometry& gA, const Polygon& gB, NoValidityCheck ) { if ( gB.isEmpty() ) { - return std::auto_ptr< Geometry >( gA.clone() ); + return std::unique_ptr< Geometry >( gA.clone() ); } Polygon_set_2 polygonSet ; minkowskiSum( gA, gB.toPolygon_2(), polygonSet ) ; - return std::auto_ptr< Geometry >( detail::polygonSetToMultiPolygon( polygonSet ).release() ) ; + return std::unique_ptr< Geometry >( detail::polygonSetToMultiPolygon( polygonSet ).release() ) ; } //-- public interface implementation @@ -278,12 +278,12 @@ std::auto_ptr< Geometry > minkowskiSum( const Geometry& gA, const Polygon& gB, N /// /// /// -std::auto_ptr< Geometry > minkowskiSum( const Geometry& gA, const Polygon& gB ) +std::unique_ptr< Geometry > minkowskiSum( const Geometry& gA, const Polygon& gB ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( gA ); SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( gB ); - std::auto_ptr result( minkowskiSum( gA, gB, NoValidityCheck() ) ); + std::unique_ptr result( minkowskiSum( gA, gB, NoValidityCheck() ) ); propagateValidityFlag( *result, true ); return result; } diff --git a/src/algorithm/minkowskiSum.h b/src/algorithm/minkowskiSum.h index 62ab5d65..21eedd71 100644 --- a/src/algorithm/minkowskiSum.h +++ b/src/algorithm/minkowskiSum.h @@ -39,7 +39,7 @@ struct NoValidityCheck; * @pre gA and gB are valid geometries * @ingroup public_api */ -SFCGAL_API std::auto_ptr< Geometry > minkowskiSum( const Geometry& gA, const Polygon& gB ) ; +SFCGAL_API std::unique_ptr< Geometry > minkowskiSum( const Geometry& gA, const Polygon& gB ) ; /** * @brief 2D minkowski sum (p+q) @@ -51,7 +51,7 @@ SFCGAL_API std::auto_ptr< Geometry > minkowskiSum( const Geometry& gA, const Pol * @ingroup detail * @warning@ No actual validity check is done. */ -SFCGAL_API std::auto_ptr< Geometry > minkowskiSum( const Geometry& gA, const Polygon& gB, NoValidityCheck ) ; +SFCGAL_API std::unique_ptr< Geometry > minkowskiSum( const Geometry& gA, const Polygon& gB, NoValidityCheck ) ; } // namespace algorithm } // namespace SFCGAL diff --git a/src/algorithm/offset.cpp b/src/algorithm/offset.cpp index 2002e521..7bfedc09 100644 --- a/src/algorithm/offset.cpp +++ b/src/algorithm/offset.cpp @@ -147,12 +147,12 @@ Polygon_with_holes_2 approximate( const Offset_polygon_with_holes_2& polygon, co /** * @brief convert Offset_polygon_set_2 to MultiPolygon */ -std::auto_ptr< MultiPolygon > polygonSetToMultiPolygon( const Offset_polygon_set_2& polygonSet, const int& n ) +std::unique_ptr< MultiPolygon > polygonSetToMultiPolygon( const Offset_polygon_set_2& polygonSet, const int& n ) { std::list res; polygonSet.polygons_with_holes( std::back_inserter( res ) ) ; - std::auto_ptr< MultiPolygon > result( new MultiPolygon ); + std::unique_ptr< MultiPolygon > result( new MultiPolygon ); for ( std::list::const_iterator it = res.begin(); it != res.end(); ++it ) { result->addGeometry( new Polygon( approximate( *it, n ) ) ); @@ -341,7 +341,7 @@ void offset( const Geometry& g, const double& radius, Offset_polygon_set_2& poly /// /// /// -std::auto_ptr< MultiPolygon > offset( const Geometry& g, const double& r, NoValidityCheck ) +std::unique_ptr< MultiPolygon > offset( const Geometry& g, const double& r, NoValidityCheck ) { SFCGAL_OFFSET_ASSERT_FINITE_RADIUS( r ); Offset_polygon_set_2 polygonSet ; @@ -349,7 +349,7 @@ std::auto_ptr< MultiPolygon > offset( const Geometry& g, const double& r, NoVali return polygonSetToMultiPolygon( polygonSet, 8 ); } -std::auto_ptr< MultiPolygon > offset( const Geometry& g, const double& r ) +std::unique_ptr< MultiPolygon > offset( const Geometry& g, const double& r ) { SFCGAL_OFFSET_ASSERT_FINITE_RADIUS( r ); SFCGAL_ASSERT_GEOMETRY_VALIDITY( g ); diff --git a/src/algorithm/offset.h b/src/algorithm/offset.h index aac82f3c..26f2fd1b 100644 --- a/src/algorithm/offset.h +++ b/src/algorithm/offset.h @@ -41,7 +41,7 @@ struct NoValidityCheck; * @pre g is a valid Geometry * @ingroup public_api */ -SFCGAL_API std::auto_ptr< MultiPolygon > offset( const Geometry& g, const double& r ) ; +SFCGAL_API std::unique_ptr< MultiPolygon > offset( const Geometry& g, const double& r ) ; /** * @brief [experimental]compute polygon offset @@ -51,7 +51,7 @@ SFCGAL_API std::auto_ptr< MultiPolygon > offset( const Geometry& g, const double * @ingroup detail * @warning No actual validity check is done. */ -SFCGAL_API std::auto_ptr< MultiPolygon > offset( const Geometry& g, const double& r, NoValidityCheck ) ; +SFCGAL_API std::unique_ptr< MultiPolygon > offset( const Geometry& g, const double& r, NoValidityCheck ) ; }//namespace algorithm }//namespace SFCGAL diff --git a/src/algorithm/straightSkeleton.cpp b/src/algorithm/straightSkeleton.cpp index ac07c480..0604d4ae 100644 --- a/src/algorithm/straightSkeleton.cpp +++ b/src/algorithm/straightSkeleton.cpp @@ -169,7 +169,7 @@ void straightSkeletonToMedialAxis( if ( ang > maxTouchingAngle ) continue ; } - std::auto_ptr ls ( new LineString( + std::unique_ptr ls ( new LineString( Point( it->opposite()->vertex()->point() ), Point( it->vertex()->point() ) ) ); @@ -205,7 +205,7 @@ checkNoTouchingHoles( const Polygon& g ) for ( size_t ri=0; ri < numRings-1; ++ri ) { for ( size_t rj=ri+1; rj < numRings; ++rj ) { - std::auto_ptr inter = g.is3D() + std::unique_ptr inter = g.is3D() ? intersection3D( g.ringN( ri ), g.ringN( rj ) ) : intersection( g.ringN( ri ), g.ringN( rj ) ); @@ -229,7 +229,7 @@ preparePolygon( const Polygon& poly, Kernel::Vector_2& trans ) trans = Kernel::Vector_2(-env.xMin(), -env.yMin()); // @todo: avoid cloning ! - std::auto_ptr cloned ( poly.clone() ); + std::unique_ptr cloned ( poly.clone() ); algorithm::translate( *cloned, trans ); Polygon_with_holes_2 ret = cloned->toPolygon_with_holes_2(); trans = -trans; @@ -265,7 +265,7 @@ extractPolygons( const Geometry& g, std::vector< Polygon >& vect ) /// /// /// -std::auto_ptr< MultiLineString > straightSkeleton( const Geometry& g, bool autoOrientation, NoValidityCheck, bool innerOnly, bool outputDistanceInM ) +std::unique_ptr< MultiLineString > straightSkeleton( const Geometry& g, bool autoOrientation, NoValidityCheck, bool innerOnly, bool outputDistanceInM ) { switch ( g.geometryTypeId() ) { case TYPE_TRIANGLE: @@ -278,24 +278,24 @@ std::auto_ptr< MultiLineString > straightSkeleton( const Geometry& g, bool autoO return straightSkeleton( g.as< MultiPolygon >(), autoOrientation, innerOnly, outputDistanceInM ) ; default: - return std::auto_ptr< MultiLineString >( new MultiLineString ); + return std::unique_ptr< MultiLineString >( new MultiLineString ); } } -std::auto_ptr< MultiLineString > straightSkeleton( const Geometry& g, bool autoOrientation, bool innerOnly, bool outputDistanceInM ) +std::unique_ptr< MultiLineString > straightSkeleton( const Geometry& g, bool autoOrientation, bool innerOnly, bool outputDistanceInM ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( g ); - std::auto_ptr result( straightSkeleton( g, autoOrientation, NoValidityCheck(), innerOnly, outputDistanceInM ) ); + std::unique_ptr result( straightSkeleton( g, autoOrientation, NoValidityCheck(), innerOnly, outputDistanceInM ) ); propagateValidityFlag( *result, true ); return result; } /// /// /// -std::auto_ptr< MultiLineString > straightSkeleton( const Polygon& g, bool /*autoOrientation*/, bool innerOnly, bool outputDistanceInM ) +std::unique_ptr< MultiLineString > straightSkeleton( const Polygon& g, bool /*autoOrientation*/, bool innerOnly, bool outputDistanceInM ) { - std::auto_ptr< MultiLineString > result( new MultiLineString ); + std::unique_ptr< MultiLineString > result( new MultiLineString ); if ( g.isEmpty() ) { return result ; @@ -321,9 +321,9 @@ std::auto_ptr< MultiLineString > straightSkeleton( const Polygon& g, bool /*auto /// /// /// -std::auto_ptr< MultiLineString > straightSkeleton( const MultiPolygon& g, bool /*autoOrientation*/, bool innerOnly, bool outputDistanceInM ) +std::unique_ptr< MultiLineString > straightSkeleton( const MultiPolygon& g, bool /*autoOrientation*/, bool innerOnly, bool outputDistanceInM ) { - std::auto_ptr< MultiLineString > result( new MultiLineString ); + std::unique_ptr< MultiLineString > result( new MultiLineString ); for ( size_t i = 0; i < g.numGeometries(); i++ ) { Kernel::Vector_2 trans; @@ -343,11 +343,11 @@ std::auto_ptr< MultiLineString > straightSkeleton( const MultiPolygon& g, bool / return result ; } -std::auto_ptr< MultiLineString > approximateMedialAxis( const Geometry& g ) +std::unique_ptr< MultiLineString > approximateMedialAxis( const Geometry& g ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( g ); - std::auto_ptr< MultiLineString > mx( new MultiLineString ); + std::unique_ptr< MultiLineString > mx( new MultiLineString ); std::vector< Polygon > polys; extractPolygons( g, polys ); diff --git a/src/algorithm/straightSkeleton.h b/src/algorithm/straightSkeleton.h index 4bf1551a..f1b0a097 100644 --- a/src/algorithm/straightSkeleton.h +++ b/src/algorithm/straightSkeleton.h @@ -42,7 +42,7 @@ struct NoValidityCheck; * @ingroup public_api * @pre g is a valid geometry */ -SFCGAL_API std::auto_ptr< MultiLineString > approximateMedialAxis( const Geometry& g ); +SFCGAL_API std::unique_ptr< MultiLineString > approximateMedialAxis( const Geometry& g ); /** * @brief build a 2D straight skeleton for a Polygon @@ -53,7 +53,7 @@ SFCGAL_API std::auto_ptr< MultiLineString > approximateMedialAxis( const Geometr * @ingroup public_api * @pre g is a valid geometry */ -SFCGAL_API std::auto_ptr< MultiLineString > straightSkeleton( const Geometry& g, bool autoOrientation = true, bool innerOnly = false, bool outputDistanceInM = false ) ; +SFCGAL_API std::unique_ptr< MultiLineString > straightSkeleton( const Geometry& g, bool autoOrientation = true, bool innerOnly = false, bool outputDistanceInM = false ) ; /** * @brief build a 2D straight skeleton for a Polygon @@ -64,18 +64,18 @@ SFCGAL_API std::auto_ptr< MultiLineString > straightSkeleton( const Geometry& g, * @pre g is a valid geometry * @warning No actual validity check is done */ -SFCGAL_API std::auto_ptr< MultiLineString > straightSkeleton( const Geometry& g, bool autoOrientation, NoValidityCheck, bool innerOnly = false, bool outputDistanceInM = false ) ; +SFCGAL_API std::unique_ptr< MultiLineString > straightSkeleton( const Geometry& g, bool autoOrientation, NoValidityCheck, bool innerOnly = false, bool outputDistanceInM = false ) ; /** * @brief build a 2D straight skeleton for a Polygon * @ingroup detail */ -SFCGAL_API std::auto_ptr< MultiLineString > straightSkeleton( const Polygon& g, bool autoOrientation = true, bool innerOnly = false, bool outputDistanceInM = false ) ; +SFCGAL_API std::unique_ptr< MultiLineString > straightSkeleton( const Polygon& g, bool autoOrientation = true, bool innerOnly = false, bool outputDistanceInM = false ) ; /** * @brief build a 2D straight skeleton for a Polygon * @ingroup detail */ -SFCGAL_API std::auto_ptr< MultiLineString > straightSkeleton( const MultiPolygon& g, bool autoOrientation = true, bool innerOnly = false, bool outputDistanceInM = false ) ; +SFCGAL_API std::unique_ptr< MultiLineString > straightSkeleton( const MultiPolygon& g, bool autoOrientation = true, bool innerOnly = false, bool outputDistanceInM = false ) ; }//namespace algorithm }//namespace SFCGAL diff --git a/src/algorithm/tesselate.cpp b/src/algorithm/tesselate.cpp index 8269d167..4acc4f2f 100644 --- a/src/algorithm/tesselate.cpp +++ b/src/algorithm/tesselate.cpp @@ -31,7 +31,7 @@ namespace algorithm { /// /// /// -std::auto_ptr tesselate( const Geometry& g, NoValidityCheck ) +std::unique_ptr tesselate( const Geometry& g, NoValidityCheck ) { switch ( g.geometryTypeId() ) { case TYPE_POINT: @@ -39,17 +39,17 @@ std::auto_ptr tesselate( const Geometry& g, NoValidityCheck ) case TYPE_TRIANGLE: case TYPE_MULTIPOINT: case TYPE_MULTILINESTRING: - return std::auto_ptr( g.clone() ); + return std::unique_ptr( g.clone() ); case TYPE_POLYGON: case TYPE_POLYHEDRALSURFACE: { TriangulatedSurface* triSurf = new TriangulatedSurface(); triangulate::triangulatePolygon3D( g, *triSurf ); - return std::auto_ptr( triSurf ); + return std::unique_ptr( triSurf ); } case TYPE_SOLID: { - std::auto_ptr ret( new GeometryCollection ); + std::unique_ptr ret( new GeometryCollection ); for ( size_t i = 0; i < g.as().numShells(); ++i ) { const PolyhedralSurface& shellN = g.as().shellN( i ) ; @@ -59,30 +59,30 @@ std::auto_ptr tesselate( const Geometry& g, NoValidityCheck ) } } - return std::auto_ptr( ret.release() ); + return std::unique_ptr( ret.release() ); } // multipolygon and multisolid return a geometrycollection case TYPE_MULTIPOLYGON: case TYPE_MULTISOLID: case TYPE_GEOMETRYCOLLECTION: { - std::auto_ptr ret( new GeometryCollection ); + std::unique_ptr ret( new GeometryCollection ); for ( size_t i = 0; i < g.numGeometries(); ++i ) { ret->addGeometry( tesselate( g.geometryN( i ) ).release() ); } - return std::auto_ptr( ret.release() ); + return std::unique_ptr( ret.release() ); } default: break; } - return std::auto_ptr( g.clone() ); + return std::unique_ptr( g.clone() ); } -std::auto_ptr tesselate( const Geometry& g ) +std::unique_ptr tesselate( const Geometry& g ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY( g ); diff --git a/src/algorithm/tesselate.h b/src/algorithm/tesselate.h index 6636c86c..80413f4d 100644 --- a/src/algorithm/tesselate.h +++ b/src/algorithm/tesselate.h @@ -35,7 +35,7 @@ struct NoValidityCheck; * @pre g is a valid geometry * @ingroup public_api */ -SFCGAL_API std::auto_ptr tesselate( const Geometry& ); +SFCGAL_API std::unique_ptr tesselate( const Geometry& ); /** * Tesselate a geometry: this will triangulate surfaces (including polyhedral and solid's surfaces) and keep untouched @@ -44,7 +44,7 @@ SFCGAL_API std::auto_ptr tesselate( const Geometry& ); * @ingroup detail * @warning No actual validity check is done. */ -SFCGAL_API std::auto_ptr tesselate( const Geometry&, NoValidityCheck ); +SFCGAL_API std::unique_ptr tesselate( const Geometry&, NoValidityCheck ); }//algorithm }//SFCGAL diff --git a/src/algorithm/union.cpp b/src/algorithm/union.cpp index 47c83569..7e4b5341 100644 --- a/src/algorithm/union.cpp +++ b/src/algorithm/union.cpp @@ -933,7 +933,7 @@ void collectPrimitives( const typename HandledBox::Vector& boxes, detail::G } } -std::auto_ptr union_( const Geometry& ga, const Geometry& gb, NoValidityCheck ) +std::unique_ptr union_( const Geometry& ga, const Geometry& gb, NoValidityCheck ) { HandledBox<2>::Vector boxes; compute_bboxes( detail::GeometrySet<2>( ga ), std::back_inserter( boxes ) ); @@ -949,15 +949,15 @@ std::auto_ptr union_( const Geometry& ga, const Geometry& gb, NoValidi return output.recompose(); } -std::auto_ptr union_( const Geometry& ga, const Geometry& gb ) +std::unique_ptr union_( const Geometry& ga, const Geometry& gb ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( ga ); SFCGAL_ASSERT_GEOMETRY_VALIDITY_2D( gb ); - std::auto_ptr result( union_( ga, gb, NoValidityCheck() ) ); + std::unique_ptr result( union_( ga, gb, NoValidityCheck() ) ); return result; } -std::auto_ptr union3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ) +std::unique_ptr union3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ) { HandledBox<3>::Vector boxes; compute_bboxes( detail::GeometrySet<3>( ga ), std::back_inserter( boxes ) ); @@ -974,11 +974,11 @@ std::auto_ptr union3D( const Geometry& ga, const Geometry& gb, NoValid } -std::auto_ptr union3D( const Geometry& ga, const Geometry& gb ) +std::unique_ptr union3D( const Geometry& ga, const Geometry& gb ) { SFCGAL_ASSERT_GEOMETRY_VALIDITY_3D( ga ); SFCGAL_ASSERT_GEOMETRY_VALIDITY_3D( gb ); - std::auto_ptr result( union3D( ga, gb, NoValidityCheck() ) ); + std::unique_ptr result( union3D( ga, gb, NoValidityCheck() ) ); return result; } diff --git a/src/algorithm/union.h b/src/algorithm/union.h index 9bfb4197..aef37284 100644 --- a/src/algorithm/union.h +++ b/src/algorithm/union.h @@ -40,7 +40,7 @@ struct NoValidityCheck; * @pre ga and gb are valid geometries * @ingroup public_api */ -SFCGAL_API std::auto_ptr union_( const Geometry& ga, const Geometry& gb ); +SFCGAL_API std::unique_ptr union_( const Geometry& ga, const Geometry& gb ); /** * Union on 2D geometries. No validity check variant @@ -48,14 +48,14 @@ SFCGAL_API std::auto_ptr union_( const Geometry& ga, const Geometry& g * @ingroup detail * @warning No actual validity check is done. */ -SFCGAL_API std::auto_ptr union_( const Geometry& ga, const Geometry& gb,NoValidityCheck ); +SFCGAL_API std::unique_ptr union_( const Geometry& ga, const Geometry& gb,NoValidityCheck ); /** * Union on 3D geometries. Assume z = 0 if needed * @pre ga and gb are valid geometries * @ingroup public_api */ -SFCGAL_API std::auto_ptr union3D( const Geometry& ga, const Geometry& gb ); +SFCGAL_API std::unique_ptr union3D( const Geometry& ga, const Geometry& gb ); /** * Union on 3D geometries. Assume z = 0 if needed @@ -63,7 +63,7 @@ SFCGAL_API std::auto_ptr union3D( const Geometry& ga, const Geometry& * @ingroup detail * @warning@ No actual validity check is done */ -SFCGAL_API std::auto_ptr union3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ); +SFCGAL_API std::unique_ptr union3D( const Geometry& ga, const Geometry& gb, NoValidityCheck ); /** * @ingroup detail diff --git a/src/algorithm/volume.cpp b/src/algorithm/volume.cpp index c0510eb7..bfc80a87 100644 --- a/src/algorithm/volume.cpp +++ b/src/algorithm/volume.cpp @@ -35,7 +35,7 @@ const Kernel::FT volume( const Solid& solid, NoValidityCheck ) const size_t numShells = solid.numShells(); for ( size_t i=0; i t( tesselate( solid.shellN( i ), NoValidityCheck() ) ); + std::unique_ptr t( tesselate( solid.shellN( i ), NoValidityCheck() ) ); const TriangulatedSurface& tin = t->as(); const size_t numTriangles = tin.numTriangles(); diff --git a/src/capi/sfcgal_c.cpp b/src/capi/sfcgal_c.cpp index 8229ad07..b2b6ec9c 100644 --- a/src/capi/sfcgal_c.cpp +++ b/src/capi/sfcgal_c.cpp @@ -644,7 +644,7 @@ extern "C" void sfcgal_io_write_binary_prepared( const sfcgal_prepared_geometry_ extern "C" sfcgal_prepared_geometry_t* sfcgal_io_read_binary_prepared( const char* str, size_t len ) { std::string sstr( str, len ); - std::auto_ptr g; + std::unique_ptr g; try { g = SFCGAL::io::readBinaryPrepared( sstr ); @@ -660,7 +660,7 @@ extern "C" sfcgal_prepared_geometry_t* sfcgal_io_read_binary_prepared( const cha extern "C" sfcgal_prepared_geometry_t* sfcgal_io_read_ewkt( const char* str, size_t len ) { - std::auto_ptr g; + std::unique_ptr g; try { g = SFCGAL::io::readEwkt( str, len ); @@ -716,7 +716,7 @@ SFCGAL_GEOMETRY_FUNCTION_BINARY_MEASURE( distance_3d, SFCGAL::algorithm::distanc #define SFCGAL_GEOMETRY_FUNCTION_BINARY_CONSTRUCTION( name, sfcgal_function ) \ extern "C" sfcgal_geometry_t* sfcgal_geometry_##name( const sfcgal_geometry_t* ga, const sfcgal_geometry_t* gb ) \ { \ - std::auto_ptr result; \ + std::unique_ptr result; \ try \ { \ result = sfcgal_function( *(const SFCGAL::Geometry*)(ga), *(const SFCGAL::Geometry*)(gb) ); \ @@ -742,7 +742,7 @@ SFCGAL_GEOMETRY_FUNCTION_BINARY_CONSTRUCTION( union_3d, SFCGAL::algorithm::union #define SFCGAL_GEOMETRY_FUNCTION_UNARY_CONSTRUCTION( name, sfcgal_function ) \ extern "C" sfcgal_geometry_t* sfcgal_geometry_##name( const sfcgal_geometry_t* ga ) \ { \ - std::auto_ptr result; \ + std::unique_ptr result; \ try \ { \ result = sfcgal_function( *(const SFCGAL::Geometry*)(ga) ); \ @@ -929,9 +929,9 @@ extern "C" sfcgal_geometry_t* sfcgal_geometry_triangulate_2dz( const sfcgal_geom extern "C" sfcgal_geometry_t* sfcgal_geometry_extrude( const sfcgal_geometry_t* ga, double x, double y, double z ) { const SFCGAL::Geometry* g = reinterpret_cast( ga ); - std::auto_ptr gb( g->clone() ); + std::unique_ptr gb( g->clone() ); SFCGAL::transform::ForceZOrderPoints forceZ; - std::auto_ptr result; + std::unique_ptr result; try { gb->accept( forceZ ); @@ -979,7 +979,7 @@ extern "C" sfcgal_geometry_t* sfcgal_geometry_minkowski_sum( const sfcgal_geomet return 0; } - std::auto_ptr sum; + std::unique_ptr sum; try { sum = SFCGAL::algorithm::minkowskiSum( *g1, g2->as() ); @@ -998,7 +998,7 @@ extern "C" sfcgal_geometry_t* sfcgal_geometry_minkowski_sum( const sfcgal_geomet extern "C" sfcgal_geometry_t* sfcgal_geometry_offset_polygon( const sfcgal_geometry_t* ga, double offset ) { const SFCGAL::Geometry* g1 = reinterpret_cast( ga ); - std::auto_ptr mp; + std::unique_ptr mp; try { mp = SFCGAL::algorithm::offset( *g1, offset ); @@ -1028,7 +1028,7 @@ extern "C" int sfcgal_geometry_has_validity_flag( const sfcgal_geometry_t* geom extern "C" sfcgal_geometry_t* sfcgal_geometry_straight_skeleton_distance_in_m( const sfcgal_geometry_t* geom ) { const SFCGAL::Geometry* g1 = reinterpret_cast( geom ); - std::auto_ptr mls; + std::unique_ptr mls; try { mls = SFCGAL::algorithm::straightSkeleton( *g1, /*autoOrientation*/ true, /*innerOnly*/ false, /*outputDistanceInM*/ true ); diff --git a/src/detail/GeometrySet.cpp b/src/detail/GeometrySet.cpp index 078e7862..4352aa73 100644 --- a/src/detail/GeometrySet.cpp +++ b/src/detail/GeometrySet.cpp @@ -683,7 +683,7 @@ void recompose_surfaces( const GeometrySet<3>::SurfaceCollection& surfaces, std: } - std::auto_ptr tri( new TriangulatedSurface ); + std::unique_ptr tri( new TriangulatedSurface ); for ( GeometrySet<3>::SurfaceCollection::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it ) { tri->addTriangle( new Triangle( it->primitive() ) ); @@ -787,7 +787,7 @@ void recompose_volumes( const GeometrySet<3>::VolumeCollection& volumes, std::ve } template -std::auto_ptr GeometrySet::recompose() const +std::unique_ptr GeometrySet::recompose() const { std::vector geometries; @@ -797,11 +797,11 @@ std::auto_ptr GeometrySet::recompose() const recompose_volumes( _volumes, geometries, dim_t() ); if ( geometries.empty() ) { - return std::auto_ptr( new GeometryCollection ); + return std::unique_ptr( new GeometryCollection ); } if ( geometries.size() == 1 ) { - return std::auto_ptr( geometries[0] ); + return std::unique_ptr( geometries[0] ); } // else we have a mix of different types @@ -845,7 +845,7 @@ std::auto_ptr GeometrySet::recompose() const ret->addGeometry( geometries[i] ); } - return std::auto_ptr( ret ); + return std::unique_ptr( ret ); } void _collect_points( const CGAL::Polygon_with_holes_2& poly, GeometrySet<2>::PointCollection& points ) diff --git a/src/detail/GeometrySet.h b/src/detail/GeometrySet.h index 385bf332..fafbd0c4 100644 --- a/src/detail/GeometrySet.h +++ b/src/detail/GeometrySet.h @@ -323,7 +323,7 @@ class GeometrySet { /** * convert the set to a SFCGAL::Geometry */ - std::auto_ptr recompose() const; + std::unique_ptr recompose() const; /** * Filter (remove) primitives that are already covered by others diff --git a/src/detail/generator/building.cpp b/src/detail/generator/building.cpp index 2e9c6891..a4040310 100644 --- a/src/detail/generator/building.cpp +++ b/src/detail/generator/building.cpp @@ -44,7 +44,7 @@ typedef CGAL::Straight_skeleton_2 Straight_skeleton_2 ; /** * @brief Basic building generator relying on a straight skeleton */ -std::auto_ptr< Geometry > building( +std::unique_ptr< Geometry > building( const Polygon& g, const Kernel::FT& wallHeight, const Kernel::FT& roofSlope @@ -52,7 +52,7 @@ std::auto_ptr< Geometry > building( /** * @brief Basic building generator relying on a straight skeleton */ -std::auto_ptr< Geometry > building( +std::unique_ptr< Geometry > building( const MultiPolygon& g, const Kernel::FT& wallHeight, const Kernel::FT& roofSlope @@ -82,7 +82,7 @@ void _buildingWall( const Polygon_2& ring, const Kernel::FT& wallHeight, Polyhed /// /// /// -std::auto_ptr< Geometry > building( +std::unique_ptr< Geometry > building( const Polygon& g, const Kernel::FT& wallHeight, const Kernel::FT& roofSlope @@ -102,7 +102,7 @@ std::auto_ptr< Geometry > building( boost::shared_ptr< Straight_skeleton_2 > skeleton = CGAL::create_interior_straight_skeleton_2( polygon ) ; - std::auto_ptr< PolyhedralSurface > shell( new PolyhedralSurface ); + std::unique_ptr< PolyhedralSurface > shell( new PolyhedralSurface ); // bottom part { Polygon bottom( polygon ); @@ -149,32 +149,32 @@ std::auto_ptr< Geometry > building( } } - return std::auto_ptr< Geometry >( new Solid( shell.release() ) ); + return std::unique_ptr< Geometry >( new Solid( shell.release() ) ); } /// /// /// -std::auto_ptr< Geometry > building( +std::unique_ptr< Geometry > building( const MultiPolygon& g, const Kernel::FT& wallHeight, const Kernel::FT& roofSlope ) { - std::auto_ptr< MultiSolid > multiSolid( new MultiSolid ); + std::unique_ptr< MultiSolid > multiSolid( new MultiSolid ); for ( size_t i = 0; i < g.numGeometries(); i++ ) { multiSolid->addGeometry( building( g.polygonN( i ), wallHeight, roofSlope ).release() ); } - return std::auto_ptr< Geometry >( multiSolid.release() ); + return std::unique_ptr< Geometry >( multiSolid.release() ); } /// /// /// -std::auto_ptr< Geometry > building( +std::unique_ptr< Geometry > building( const Geometry& g, const Kernel::FT& wallHeight, const Kernel::FT& roofSlope @@ -191,7 +191,7 @@ std::auto_ptr< Geometry > building( BOOST_THROW_EXCEPTION( Exception( ( boost::format( "bad geometry type (%s) in generator::building" ) % g.geometryType() ).str() ) ); - return std::auto_ptr< Geometry >( new GeometryCollection() ); + return std::unique_ptr< Geometry >( new GeometryCollection() ); } } diff --git a/src/detail/generator/building.h b/src/detail/generator/building.h index 20c8b438..fb28dfb3 100644 --- a/src/detail/generator/building.h +++ b/src/detail/generator/building.h @@ -41,7 +41,7 @@ namespace generator { * @warning only supports Polygon and MultiPolygon * @todo unittest */ -SFCGAL_API std::auto_ptr< Geometry > building( +SFCGAL_API std::unique_ptr< Geometry > building( const Geometry& g, const Kernel::FT& wallHeight, const Kernel::FT& roofSlope diff --git a/src/detail/generator/disc.cpp b/src/detail/generator/disc.cpp index 8a5c00cb..ad97924b 100644 --- a/src/detail/generator/disc.cpp +++ b/src/detail/generator/disc.cpp @@ -37,7 +37,7 @@ namespace generator { /// /// /// -std::auto_ptr< Polygon > disc( +std::unique_ptr< Polygon > disc( const Point& center, const double& radius, const unsigned int& nQuadrantSegments @@ -45,7 +45,7 @@ std::auto_ptr< Polygon > disc( { BOOST_ASSERT( nQuadrantSegments > 1 ); - std::auto_ptr< LineString > exteriorRing( new LineString() ) ; + std::unique_ptr< LineString > exteriorRing( new LineString() ) ; double dTheta = M_PI_4 / nQuadrantSegments ; @@ -56,7 +56,7 @@ std::auto_ptr< Polygon > disc( exteriorRing->addPoint( exteriorRing->startPoint() ) ; - return std::auto_ptr< Polygon >( new Polygon( exteriorRing.release() ) ); + return std::unique_ptr< Polygon >( new Polygon( exteriorRing.release() ) ); } } // namespace generator diff --git a/src/detail/generator/disc.h b/src/detail/generator/disc.h index 851b6a9f..5552b2c4 100644 --- a/src/detail/generator/disc.h +++ b/src/detail/generator/disc.h @@ -37,7 +37,7 @@ namespace generator { * Generate a discrete circle * @todo unittest */ -SFCGAL_API std::auto_ptr< Polygon > disc( +SFCGAL_API std::unique_ptr< Polygon > disc( const Point& center, const double& radius, const unsigned int& nQuadrantSegments = 8U diff --git a/src/detail/generator/hoch.cpp b/src/detail/generator/hoch.cpp index 1ae9e236..e727a539 100644 --- a/src/detail/generator/hoch.cpp +++ b/src/detail/generator/hoch.cpp @@ -51,7 +51,7 @@ std::vector< Kernel::Vector_2 > _hoch( const std::vector< Kernel::Vector_2 >& po /// /// /// -std::auto_ptr< Polygon > hoch( const unsigned int& order ) +std::unique_ptr< Polygon > hoch( const unsigned int& order ) { std::vector< Kernel::Vector_2 > points ; points.push_back( Kernel::Vector_2( 1.0, sqrt( 3.0 ) ) ); @@ -63,8 +63,8 @@ std::auto_ptr< Polygon > hoch( const unsigned int& order ) points = _hoch( points ); } - std::auto_ptr< Polygon > result( new Polygon() ) ; - std::auto_ptr< LineString > ring( new LineString() ) ; + std::unique_ptr< Polygon > result( new Polygon() ) ; + std::unique_ptr< LineString > ring( new LineString() ) ; for ( std::vector< Kernel::Vector_2 >::const_iterator it = points.begin(); it != points.end(); ++it ) { ring->addPoint( new Point( it->x(), it->y() ) ) ; diff --git a/src/detail/generator/hoch.h b/src/detail/generator/hoch.h index 9846e0e2..da4c7807 100644 --- a/src/detail/generator/hoch.h +++ b/src/detail/generator/hoch.h @@ -36,7 +36,7 @@ namespace generator { * generate hoch snowflake * @todo unittest */ -SFCGAL_API std::auto_ptr< Polygon > hoch( const unsigned int& order ) ; +SFCGAL_API std::unique_ptr< Polygon > hoch( const unsigned int& order ) ; } // namespace generator } // namespace SFCGAL diff --git a/src/detail/generator/sierpinski.cpp b/src/detail/generator/sierpinski.cpp index 0b58c87e..a234ac26 100644 --- a/src/detail/generator/sierpinski.cpp +++ b/src/detail/generator/sierpinski.cpp @@ -52,7 +52,7 @@ std::vector< Kernel::Triangle_2 > _sierpinski( const std::vector< Kernel::Triang /// /// /// -std::auto_ptr< MultiPolygon > sierpinski( const unsigned int& order ) +std::unique_ptr< MultiPolygon > sierpinski( const unsigned int& order ) { std::vector< Kernel::Triangle_2 > triangles ; triangles.push_back( Kernel::Triangle_2( @@ -65,7 +65,7 @@ std::auto_ptr< MultiPolygon > sierpinski( const unsigned int& order ) triangles = _sierpinski( triangles ); } - std::auto_ptr< MultiPolygon > result( new MultiPolygon ) ; + std::unique_ptr< MultiPolygon > result( new MultiPolygon ) ; for ( size_t i = 0; i < triangles.size(); i++ ) { result->addGeometry( Triangle( triangles[i] ).toPolygon() ) ; diff --git a/src/detail/generator/sierpinski.h b/src/detail/generator/sierpinski.h index 6b1d4229..76df0a35 100644 --- a/src/detail/generator/sierpinski.h +++ b/src/detail/generator/sierpinski.h @@ -36,7 +36,7 @@ namespace generator { * generate hoch snowflake * @todo unittest */ -SFCGAL_API std::auto_ptr< MultiPolygon > sierpinski( const unsigned int& order ) ; +SFCGAL_API std::unique_ptr< MultiPolygon > sierpinski( const unsigned int& order ) ; } // namespace generator } // namespace SFCGAL diff --git a/src/detail/io/Serialization.cpp b/src/detail/io/Serialization.cpp index da4c3758..5f90ec7d 100644 --- a/src/detail/io/Serialization.cpp +++ b/src/detail/io/Serialization.cpp @@ -98,25 +98,25 @@ std::string writeBinaryPrepared( const PreparedGeometry& g ) /// /// /// -std::auto_ptr readBinaryGeometry( const std::string& str ) +std::unique_ptr readBinaryGeometry( const std::string& str ) { std::istringstream istr( str ); BinaryUnserializer iarc( istr ); Geometry* g; iarc >> g; - return std::auto_ptr( g ); + return std::unique_ptr( g ); } /// /// /// -std::auto_ptr readBinaryPrepared( const std::string& str ) +std::unique_ptr readBinaryPrepared( const std::string& str ) { std::istringstream istr( str ); BinaryUnserializer iarc( istr ); PreparedGeometry* pg; iarc >> pg; - return std::auto_ptr( pg ); + return std::unique_ptr( pg ); } } } diff --git a/src/detail/io/Serialization.h b/src/detail/io/Serialization.h index b92bf33a..24525e00 100644 --- a/src/detail/io/Serialization.h +++ b/src/detail/io/Serialization.h @@ -68,12 +68,12 @@ SFCGAL_API std::string writeBinaryPrepared( const SFCGAL::PreparedGeometry& ); /** * Read a Geometry from a binary representation */ -SFCGAL_API std::auto_ptr readBinaryGeometry( const std::string& ); +SFCGAL_API std::unique_ptr readBinaryGeometry( const std::string& ); /** * Read a PreparedGeometry from a binary representation */ -SFCGAL_API std::auto_ptr readBinaryPrepared( const std::string& ); +SFCGAL_API std::unique_ptr readBinaryPrepared( const std::string& ); } } diff --git a/src/detail/io/WktReader.cpp b/src/detail/io/WktReader.cpp index 6963ab6e..5cf0e067 100644 --- a/src/detail/io/WktReader.cpp +++ b/src/detail/io/WktReader.cpp @@ -79,73 +79,73 @@ Geometry* WktReader::readGeometry() switch ( geometryType ) { case TYPE_POINT : { - std::auto_ptr< Point > g( new Point() ); + std::unique_ptr< Point > g( new Point() ); readInnerPoint( *g ); return g.release() ; } case TYPE_LINESTRING: { - std::auto_ptr< LineString > g( new LineString() ); + std::unique_ptr< LineString > g( new LineString() ); readInnerLineString( *g ); return g.release() ; } case TYPE_TRIANGLE: { - std::auto_ptr< Triangle > g( new Triangle() ); + std::unique_ptr< Triangle > g( new Triangle() ); readInnerTriangle( *g ); return g.release() ; } case TYPE_POLYGON: { - std::auto_ptr< Polygon > g( new Polygon() ); + std::unique_ptr< Polygon > g( new Polygon() ); readInnerPolygon( *g ); return g.release() ; } case TYPE_MULTIPOINT : { - std::auto_ptr< MultiPoint > g( new MultiPoint() ); + std::unique_ptr< MultiPoint > g( new MultiPoint() ); readInnerMultiPoint( *g ); return g.release() ; } case TYPE_MULTILINESTRING : { - std::auto_ptr< MultiLineString > g( new MultiLineString() ); + std::unique_ptr< MultiLineString > g( new MultiLineString() ); readInnerMultiLineString( *g ); return g.release() ; } case TYPE_MULTIPOLYGON : { - std::auto_ptr< MultiPolygon > g( new MultiPolygon() ); + std::unique_ptr< MultiPolygon > g( new MultiPolygon() ); readInnerMultiPolygon( *g ); return g.release() ; } case TYPE_GEOMETRYCOLLECTION : { - std::auto_ptr< GeometryCollection > g( new GeometryCollection() ); + std::unique_ptr< GeometryCollection > g( new GeometryCollection() ); readInnerGeometryCollection( *g ); return g.release() ; } case TYPE_TRIANGULATEDSURFACE : { - std::auto_ptr< TriangulatedSurface > g( new TriangulatedSurface() ); + std::unique_ptr< TriangulatedSurface > g( new TriangulatedSurface() ); readInnerTriangulatedSurface( *g ); return g.release() ; } case TYPE_POLYHEDRALSURFACE : { - std::auto_ptr< PolyhedralSurface > g( new PolyhedralSurface() ); + std::unique_ptr< PolyhedralSurface > g( new PolyhedralSurface() ); readInnerPolyhedralSurface( *g ); return g.release() ; } case TYPE_SOLID : { - std::auto_ptr< Solid > g( new Solid() ); + std::unique_ptr< Solid > g( new Solid() ); readInnerSolid( *g ); return g.release() ; } case TYPE_MULTISOLID : { - std::auto_ptr< MultiSolid > g( new MultiSolid() ); + std::unique_ptr< MultiSolid > g( new MultiSolid() ); readInnerMultiSolid( *g ); return g.release() ; } @@ -240,7 +240,7 @@ void WktReader::readInnerLineString( LineString& g ) while ( ! _reader.eof() ) { - std::auto_ptr< Point > p( new Point() ) ; + std::unique_ptr< Point > p( new Point() ) ; if ( readPointCoordinate( *p ) ) { g.addPoint( p.release() ); @@ -285,7 +285,7 @@ void WktReader::readInnerPolygon( Polygon& g ) readInnerLineString( g.exteriorRing() ) ; } else { - std::auto_ptr< LineString > interiorRing( new LineString ); + std::unique_ptr< LineString > interiorRing( new LineString ); readInnerLineString( *interiorRing ) ; g.addRing( interiorRing.release() ) ; } @@ -364,7 +364,7 @@ void WktReader::readInnerMultiPoint( MultiPoint& g ) } while( ! _reader.eof() ) { - std::auto_ptr< Point > p( new Point() ); + std::unique_ptr< Point > p( new Point() ); if ( !_reader.imatch( "EMPTY" ) ) { // optional open/close parenthesis @@ -410,7 +410,7 @@ void WktReader::readInnerMultiLineString( MultiLineString& g ) while( ! _reader.eof() ) { - std::auto_ptr< LineString > lineString( new LineString() ); + std::unique_ptr< LineString > lineString( new LineString() ); readInnerLineString( *lineString ); if ( !lineString->isEmpty() ) g.addGeometry( lineString.release() ); @@ -440,7 +440,7 @@ void WktReader::readInnerMultiPolygon( MultiPolygon& g ) while( ! _reader.eof() ) { - std::auto_ptr< Polygon > polygon( new Polygon() ); + std::unique_ptr< Polygon > polygon( new Polygon() ); readInnerPolygon( *polygon ); if ( !polygon->isEmpty() ) g.addGeometry( polygon.release() ); @@ -500,7 +500,7 @@ void WktReader::readInnerTriangulatedSurface( TriangulatedSurface& g ) } while( ! _reader.eof() ) { - std::auto_ptr< Triangle > triangle( new Triangle() ) ; + std::unique_ptr< Triangle > triangle( new Triangle() ) ; readInnerTriangle( *triangle ); g.addTriangle( triangle.release() ) ; @@ -530,7 +530,7 @@ void WktReader::readInnerPolyhedralSurface( PolyhedralSurface& g ) } while( ! _reader.eof() ) { - std::auto_ptr< Polygon > polygon( new Polygon() ) ; + std::unique_ptr< Polygon > polygon( new Polygon() ) ; readInnerPolygon( *polygon ); g.addPolygon( polygon.release() ); @@ -565,7 +565,7 @@ void WktReader::readInnerSolid( Solid& g ) readInnerPolyhedralSurface( g.exteriorShell() ); } else { - std::auto_ptr< PolyhedralSurface > shell( new PolyhedralSurface ) ; + std::unique_ptr< PolyhedralSurface > shell( new PolyhedralSurface ) ; readInnerPolyhedralSurface( *shell ); g.addInteriorShell( shell.release() ); } @@ -597,7 +597,7 @@ void WktReader::readInnerMultiSolid( MultiSolid& g ) while( ! _reader.eof() ) { - std::auto_ptr< Solid > solid( new Solid() ); + std::unique_ptr< Solid > solid( new Solid() ); readInnerSolid( *solid ); if ( !solid->isEmpty() ) g.addGeometry( solid.release() ); diff --git a/src/detail/polygonSetToMultiPolygon.cpp b/src/detail/polygonSetToMultiPolygon.cpp index 318b0bff..1b52a56d 100644 --- a/src/detail/polygonSetToMultiPolygon.cpp +++ b/src/detail/polygonSetToMultiPolygon.cpp @@ -30,14 +30,14 @@ namespace detail { /// /// /// -std::auto_ptr< MultiPolygon > polygonSetToMultiPolygon( const CGAL::Polygon_set_2< Kernel >& polygonSet ) +std::unique_ptr< MultiPolygon > polygonSetToMultiPolygon( const CGAL::Polygon_set_2< Kernel >& polygonSet ) { typedef CGAL::Polygon_with_holes_2< Kernel > Polygon_with_holes_2 ; std::list res; polygonSet.polygons_with_holes( std::back_inserter( res ) ) ; - std::auto_ptr< MultiPolygon > result( new MultiPolygon ); + std::unique_ptr< MultiPolygon > result( new MultiPolygon ); for ( std::list::const_iterator it = res.begin(); it != res.end(); ++it ) { result->addGeometry( new Polygon( *it ) ); diff --git a/src/detail/polygonSetToMultiPolygon.h b/src/detail/polygonSetToMultiPolygon.h index 6d934361..3c14c429 100644 --- a/src/detail/polygonSetToMultiPolygon.h +++ b/src/detail/polygonSetToMultiPolygon.h @@ -33,7 +33,7 @@ namespace detail { * @brief convert a CGAL::Polygon_set_2 to a MultiPolygon * @todo unittest */ -SFCGAL_API std::auto_ptr< MultiPolygon > polygonSetToMultiPolygon( const CGAL::Polygon_set_2< Kernel >& polygonSet ) ; +SFCGAL_API std::unique_ptr< MultiPolygon > polygonSetToMultiPolygon( const CGAL::Polygon_set_2< Kernel >& polygonSet ) ; } // namespace detail } // namespace SFCGAL diff --git a/src/detail/triangulate/ConstraintDelaunayTriangulation.cpp b/src/detail/triangulate/ConstraintDelaunayTriangulation.cpp index b944dbd1..43302acc 100644 --- a/src/detail/triangulate/ConstraintDelaunayTriangulation.cpp +++ b/src/detail/triangulate/ConstraintDelaunayTriangulation.cpp @@ -154,9 +154,9 @@ void ConstraintDelaunayTriangulation::getTriangles( TriangulatedSurface& triangu /// /// /// -std::auto_ptr< TriangulatedSurface > ConstraintDelaunayTriangulation::getTriangulatedSurface() const +std::unique_ptr< TriangulatedSurface > ConstraintDelaunayTriangulation::getTriangulatedSurface() const { - std::auto_ptr< TriangulatedSurface > result( new TriangulatedSurface ); + std::unique_ptr< TriangulatedSurface > result( new TriangulatedSurface ); getTriangles( *result, false ); return result ; } diff --git a/src/detail/triangulate/ConstraintDelaunayTriangulation.h b/src/detail/triangulate/ConstraintDelaunayTriangulation.h index a3529cf6..e2f82107 100644 --- a/src/detail/triangulate/ConstraintDelaunayTriangulation.h +++ b/src/detail/triangulate/ConstraintDelaunayTriangulation.h @@ -145,7 +145,7 @@ class SFCGAL_API ConstraintDelaunayTriangulation { /** * get the resulting TriangulatedSurface */ - std::auto_ptr< TriangulatedSurface > getTriangulatedSurface() const ; + std::unique_ptr< TriangulatedSurface > getTriangulatedSurface() const ; /** * @brief get finite face iterator diff --git a/src/io/ewkt.cpp b/src/io/ewkt.cpp index a0642a18..e9367825 100644 --- a/src/io/ewkt.cpp +++ b/src/io/ewkt.cpp @@ -32,37 +32,38 @@ namespace io { /// /// /// -std::auto_ptr< PreparedGeometry > readEwkt( std::istream& s ) +std::unique_ptr< PreparedGeometry > readEwkt( std::istream& s ) { WktReader wktReader( s ); srid_t srid = wktReader.readSRID(); - std::auto_ptr< Geometry > g( wktReader.readGeometry() ); - return std::auto_ptr( new PreparedGeometry( g, srid ) ); + std::unique_ptr< Geometry > g( wktReader.readGeometry() ); + std::unique_ptr uptr( new PreparedGeometry( std::move(g), srid ) ); + return std::move(uptr); } /// /// /// -std::auto_ptr< PreparedGeometry > readEwkt( const std::string& s ) +std::unique_ptr< PreparedGeometry > readEwkt( const std::string& s ) { std::istringstream iss( s ); WktReader wktReader( iss ); srid_t srid = wktReader.readSRID(); - std::auto_ptr< Geometry > g( wktReader.readGeometry() ); - return std::auto_ptr( new PreparedGeometry( g, srid ) ); + std::unique_ptr< Geometry > g( wktReader.readGeometry() ); + return std::unique_ptr( new PreparedGeometry( std::move(g), srid ) ); } /// /// /// -std::auto_ptr< PreparedGeometry > readEwkt( const char* str, size_t len ) +std::unique_ptr< PreparedGeometry > readEwkt( const char* str, size_t len ) { CharArrayBuffer buf( str, str + len ); std::istream istr( &buf ); WktReader wktReader( istr ); srid_t srid = wktReader.readSRID(); - std::auto_ptr< Geometry > g( wktReader.readGeometry() ); - return std::auto_ptr( new PreparedGeometry( g, srid ) ); + std::unique_ptr< Geometry > g( wktReader.readGeometry() ); + return std::unique_ptr( new PreparedGeometry( std::move(g), srid ) ); } }//io diff --git a/src/io/ewkt.h b/src/io/ewkt.h index 5d96ca92..4eb547f4 100644 --- a/src/io/ewkt.h +++ b/src/io/ewkt.h @@ -37,15 +37,15 @@ namespace io { /** * Read a EWKT prepared geometry from an input stream */ -SFCGAL_API std::auto_ptr< PreparedGeometry > readEwkt( std::istream& s ) ; +SFCGAL_API std::unique_ptr< PreparedGeometry > readEwkt( std::istream& s ) ; /** * Read a EWKT geometry from a string */ -SFCGAL_API std::auto_ptr< PreparedGeometry > readEwkt( const std::string& s ) ; +SFCGAL_API std::unique_ptr< PreparedGeometry > readEwkt( const std::string& s ) ; /** * Read a EWKT geometry from a char* */ -SFCGAL_API std::auto_ptr< PreparedGeometry > readEwkt( const char*, size_t ); +SFCGAL_API std::unique_ptr< PreparedGeometry > readEwkt( const char*, size_t ); } } diff --git a/src/io/wkt.cpp b/src/io/wkt.cpp index 93c7f5bc..60075c96 100644 --- a/src/io/wkt.cpp +++ b/src/io/wkt.cpp @@ -33,20 +33,20 @@ namespace io { /// /// /// -std::auto_ptr< Geometry > readWkt( std::istream& s ) +std::unique_ptr< Geometry > readWkt( std::istream& s ) { WktReader wktReader( s ); - return std::auto_ptr< Geometry >( wktReader.readGeometry() ); + return std::unique_ptr< Geometry >( wktReader.readGeometry() ); } /// /// /// -std::auto_ptr< Geometry > readWkt( const std::string& s ) +std::unique_ptr< Geometry > readWkt( const std::string& s ) { std::istringstream iss( s ); WktReader wktReader( iss ); - std::auto_ptr< Geometry > geom( wktReader.readGeometry() ); + std::unique_ptr< Geometry > geom( wktReader.readGeometry() ); char extra; if ( iss >> extra ) { @@ -59,12 +59,12 @@ std::auto_ptr< Geometry > readWkt( const std::string& s ) /// /// /// -std::auto_ptr< Geometry > readWkt( const char* str, size_t len ) +std::unique_ptr< Geometry > readWkt( const char* str, size_t len ) { CharArrayBuffer buf( str, str + len ); std::istream istr( &buf ); WktReader wktReader( istr ); - std::auto_ptr< Geometry > geom( wktReader.readGeometry() ); + std::unique_ptr< Geometry > geom( wktReader.readGeometry() ); char extra; if ( istr >> extra ) { std::string remaining( str + int(istr.tellg()) - 1, str + len ); diff --git a/src/io/wkt.h b/src/io/wkt.h index 3391caaf..e7bcccff 100644 --- a/src/io/wkt.h +++ b/src/io/wkt.h @@ -36,15 +36,15 @@ namespace io { /** * Read a WKT geometry from an input stream */ -SFCGAL_API std::auto_ptr< Geometry > readWkt( std::istream& s ) ; +SFCGAL_API std::unique_ptr< Geometry > readWkt( std::istream& s ) ; /** * Read a WKT geometry from a string */ -SFCGAL_API std::auto_ptr< Geometry > readWkt( const std::string& s ) ; +SFCGAL_API std::unique_ptr< Geometry > readWkt( const std::string& s ) ; /** * Read a WKT geometry from a char* */ -SFCGAL_API std::auto_ptr< Geometry > readWkt( const char*, size_t ); +SFCGAL_API std::unique_ptr< Geometry > readWkt( const char*, size_t ); } } diff --git a/test/bench/BenchArea.cpp b/test/bench/BenchArea.cpp index b4cc7a06..94e84222 100644 --- a/test/bench/BenchArea.cpp +++ b/test/bench/BenchArea.cpp @@ -50,7 +50,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_BenchArea ) BOOST_AUTO_TEST_CASE( testAreaSierpinski ) { - std::auto_ptr< MultiPolygon > fractal( generator::sierpinski( 9 ) ) ; + std::unique_ptr< MultiPolygon > fractal( generator::sierpinski( 9 ) ) ; bench().start( "area sierpinski" ) ; @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE( testAreaSierpinski ) BOOST_AUTO_TEST_CASE( testAreaSierpinski3D ) { - std::auto_ptr< MultiPolygon > fractal( generator::sierpinski( 9 ) ) ; + std::unique_ptr< MultiPolygon > fractal( generator::sierpinski( 9 ) ) ; bench().start( "area sierpinski" ) ; diff --git a/test/bench/BenchMinkowski.cpp b/test/bench/BenchMinkowski.cpp index fc79f650..ea8b591f 100644 --- a/test/bench/BenchMinkowski.cpp +++ b/test/bench/BenchMinkowski.cpp @@ -46,13 +46,13 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_BenchMinkowskiSum ) BOOST_AUTO_TEST_CASE( testPolygonWithHoles ) { - std::auto_ptr< Geometry > gA( io::readWkt( "MULTIPOLYGON(((11.795461 32.713032,11.381695 35.857648,15.188336 38.091981,28.428825 38.257487,30.994170 33.788822,30.580405 29.816675,26.773764 22.617159,11.050683 18.562259,-0.534745 21.044851,-3.513855 26.837565,3.520155 26.506553,4.099426 24.685985,4.678698 22.782665,6.582018 21.541369,8.899104 21.458616,16.098620 21.706875,18.332952 25.016998,17.919187 27.499589,16.429632 27.830601,14.360805 26.175540,13.036756 24.520479,10.885177 23.527442,8.733597 23.527442,6.002747 24.603232,4.595945 26.506553,1.203069 27.830601,1.368575 30.892465,2.113353 34.202587,4.678698 36.519672,6.664771 36.188660,8.071573 34.699105,7.409549 32.630279,5.837240 31.968254,5.919993 30.064934,7.575055 28.740885,10.802424 27.582342,12.126473 27.913355,13.781534 28.740885,14.443558 29.816675,14.691818 31.306230,14.278052 33.126797,13.450522 34.119834,11.795461 32.713032),(21.477568 36.188660,15.684854 36.271413,14.609065 28.161614,15.022830 27.582342,20.401779 29.816675,29.339109 32.133760,21.477568 36.188660)))" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "MULTIPOLYGON(((11.795461 32.713032,11.381695 35.857648,15.188336 38.091981,28.428825 38.257487,30.994170 33.788822,30.580405 29.816675,26.773764 22.617159,11.050683 18.562259,-0.534745 21.044851,-3.513855 26.837565,3.520155 26.506553,4.099426 24.685985,4.678698 22.782665,6.582018 21.541369,8.899104 21.458616,16.098620 21.706875,18.332952 25.016998,17.919187 27.499589,16.429632 27.830601,14.360805 26.175540,13.036756 24.520479,10.885177 23.527442,8.733597 23.527442,6.002747 24.603232,4.595945 26.506553,1.203069 27.830601,1.368575 30.892465,2.113353 34.202587,4.678698 36.519672,6.664771 36.188660,8.071573 34.699105,7.409549 32.630279,5.837240 31.968254,5.919993 30.064934,7.575055 28.740885,10.802424 27.582342,12.126473 27.913355,13.781534 28.740885,14.443558 29.816675,14.691818 31.306230,14.278052 33.126797,13.450522 34.119834,11.795461 32.713032),(21.477568 36.188660,15.684854 36.271413,14.609065 28.161614,15.022830 27.582342,20.401779 29.816675,29.339109 32.133760,21.477568 36.188660)))" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); bench().start( "minkowski polygon with hole" ) ; for ( int i = 0; i < 1000; i++ ) { - std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); + std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); } bench().stop(); @@ -68,9 +68,9 @@ BOOST_AUTO_TEST_SUITE_END() //BOOST_AUTO_TEST_CASE( testTemp ){ -// std::auto_ptr< Geometry > gA( io::readWkt("MULTIPOLYGON(((11.795461 32.713032,11.381695 35.857648,15.188336 38.091981,28.428825 38.257487,30.994170 33.788822,30.580405 29.816675,26.773764 22.617159,11.050683 18.562259,-0.534745 21.044851,-3.513855 26.837565,3.520155 26.506553,4.099426 24.685985,4.678698 22.782665,6.582018 21.541369,8.899104 21.458616,16.098620 21.706875,18.332952 25.016998,17.919187 27.499589,16.429632 27.830601,14.360805 26.175540,13.036756 24.520479,10.885177 23.527442,8.733597 23.527442,6.002747 24.603232,4.595945 26.506553,1.203069 27.830601,1.368575 30.892465,2.113353 34.202587,4.678698 36.519672,6.664771 36.188660,8.071573 34.699105,7.409549 32.630279,5.837240 31.968254,5.919993 30.064934,7.575055 28.740885,10.802424 27.582342,12.126473 27.913355,13.781534 28.740885,14.443558 29.816675,14.691818 31.306230,14.278052 33.126797,13.450522 34.119834,11.795461 32.713032),(21.477568 36.188660,15.684854 36.271413,14.609065 28.161614,15.022830 27.582342,20.401779 29.816675,29.339109 32.133760,21.477568 36.188660)))") ); -// std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); +// std::unique_ptr< Geometry > gA( io::readWkt("MULTIPOLYGON(((11.795461 32.713032,11.381695 35.857648,15.188336 38.091981,28.428825 38.257487,30.994170 33.788822,30.580405 29.816675,26.773764 22.617159,11.050683 18.562259,-0.534745 21.044851,-3.513855 26.837565,3.520155 26.506553,4.099426 24.685985,4.678698 22.782665,6.582018 21.541369,8.899104 21.458616,16.098620 21.706875,18.332952 25.016998,17.919187 27.499589,16.429632 27.830601,14.360805 26.175540,13.036756 24.520479,10.885177 23.527442,8.733597 23.527442,6.002747 24.603232,4.595945 26.506553,1.203069 27.830601,1.368575 30.892465,2.113353 34.202587,4.678698 36.519672,6.664771 36.188660,8.071573 34.699105,7.409549 32.630279,5.837240 31.968254,5.919993 30.064934,7.575055 28.740885,10.802424 27.582342,12.126473 27.913355,13.781534 28.740885,14.443558 29.816675,14.691818 31.306230,14.278052 33.126797,13.450522 34.119834,11.795461 32.713032),(21.477568 36.188660,15.684854 36.271413,14.609065 28.161614,15.022830 27.582342,20.401779 29.816675,29.339109 32.133760,21.477568 36.188660)))") ); +// std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); // -// std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); +// std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); // std::cout << sum->asText(6) << std::endl ; //} diff --git a/test/bench/BenchStraightSkeleton.cpp b/test/bench/BenchStraightSkeleton.cpp index 35f2a0d7..282770d9 100644 --- a/test/bench/BenchStraightSkeleton.cpp +++ b/test/bench/BenchStraightSkeleton.cpp @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_BenchStraightSkeleton ) // See https://github.com/Oslandia/SFCGAL/issues/80 BOOST_AUTO_TEST_CASE( testPolygon80 ) { - std::auto_ptr< Geometry > g( io::readWkt( + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((1684000 5402672.31399816,1683946.034501 5402654.436405,1683891.240865 5402626.55208,1683828.852807 5402603.566759,1683763.966259 5402588.179891,1683710.005454 5402593.368835,1683643.321311 5402617.6139,1683558.455081 5402667.62372,1683479.657793 5402723.692308,1683393.274328 5402782.790279,1683344.780518 5402828.261023,1683302.347403 5402879.780536,1683275.07015 5402920.702207,1683275.07015 5402961.61388,1683285.674306 5403005.564933,1683312.951559 5403060.123828,1683325.081196 5403107.104265,1683319.0205 5403163.172853,1683291.735002 5403213.182673,1683214.454949 5403316.231698,1683131.097709 5403404.133806,1683071.999743 5403438.986712,1682985.616278 5403446.565169,1682940.462035 5403442.675961,1682880.415797 5403428.688808,1682817.343333 5403380.938527,1682774.09388 5403321.470632,1682729.94563 5403243.986403,1682692.10545 5403159.283644,1682682.878351 5403080.789622,1682680.67671 5403039.198087,1682654.257025 5402965.563076,1682628.876316 5402937.928701,1682608.979094 5402917.832791,1682537.124807 5402882.669948,1682377.221394 5402803.686025,1682327.432986 5402778.391174,1682247.745147 5402720.312996,1682225.349434 5402712.624561,1682183.51002 5402714.684141,1682145.917216 5402727.481536,1682113.964569 5402740.648856,1682089.985654 5402764.224058,1682069.700877 5402801.616447,1682051.708445 5402871.502221,1682004.624674 5402975.481057,1681970.354945 5403065.972638,1681952.560413 5403113.362991,1681928.037272 5403171.901076,1681920.830404 5403207.043923,1681928.936069 5403248.485488,1681963.684057 5403315.911763,1681985.700461 5403387.247243,1681982.097027 5403427.788991,1681972.696765 5403453.58374,1681959.998165 5403485.977147,1681917.119774 5403543.165506,1681871.734647 5403590.355901,1681801.356366 5403642.355317,1681698.275067 5403702.603053,1681626.709384 5403743.754677,1681565.82207 5403762.980764,1681486.530031 5403783.696547,1681395.528893 5403795.414162,1681308.13119 5403794.514345,1681281.134295 5403807.881624,1681309.029987 5403814.330312,1681347.777209 5403821.538844,1681443.280578 5403812.530678,1681535.188758 5403799.913246,1681627.995736 5403769.279482,1681693.294577 5403734.146633,1681743.478785 5403709.551639,1681819.010719 5403658.462038,1681882.981979 5403607.092494,1681939.746371 5403555.732948,1681968.582088 5403515.1912,1681992.008532 5403477.348903,1682001.920037 5403427.788991,1682003.725877 5403371.030544,1681981.181738 5403316.111723,1681950.564919 5403242.18677,1681946.961485 5403179.109609,1682053.819381 5402931.490011,1682074.706105 5402867.003137,1682087.000658 5402829.21083,1682109.882876 5402779.320985,1682132.47649 5402759.525014,1682162.573821 5402744.718028,1682197.659889 5402742.418496,1682230.057811 5402752.7164,1682274.948187 5402775.501762,1682361.422357 5402825.011685,1682456.810283 5402864.263695,1682563.989768 5402917.532852,1682603.784212 5402945.227215,1682636.380035 5402982.409647,1682648.855997 5403036.748586,1682663.269733 5403154.78456,1682694.397795 5403228.449566,1682727.240993 5403287.227602,1682756.07671 5403341.296596,1682792.11105 5403388.14706,1682830.858272 5403421.480275,1682900.37074 5403459.87246,1682942.762625 5403465.171382,1682975.012122 5403470.810234,1683049.26595 5403469.290543,1683114.432858 5403443.535786,1683203.842547 5403370.790593,1683279.613611 5403273.800335,1683328.107421 5403210.15329,1683356.901909 5403151.045321,1683353.875684 5403104.074882,1683331.141892 5403043.457221,1683309.925334 5402970.712028,1683311.44257 5402916.263111,1683346.297753 5402870.692386,1683408.43019 5402805.525651,1683487.235724 5402746.42768,1683575.128178 5402690.349095,1683641.804075 5402647.917731,1683706.970983 5402616.094209,1683741.826167 5402610.035442,1683781.26604 5402615.764276,1683816.261403 5402623.462709,1683915.838219 5402676.741864,1684000 5402711.41802501,1684020.618162 5402719.913077,1684068.00703 5402732.710472,1684222.971181 5402746.287709,1684311.424353 5402765.24385,1684450.572976 5402802.756215,1684578.837084 5402854.785624,1684651.433497 5402882.619959,1684708.305085 5402894.717496,1684763.964534 5402883.829712,1684819.632229 5402849.946609,1684837.781332 5402820.902521,1684835.357054 5402777.341388,1684817.207951 5402736.199762,1684749.451848 5402674.492322,1684704.676914 5402623.672666,1684682.899639 5402545.018676,1684682.899639 5402476.052714,1684692.58026 5402430.072073,1684739.771227 5402376.822912,1684837.781332 5402305.437442,1684921.270506 5402277.603108,1684981.770265 5402275.1836,1685015.652439 5402295.759412,1685031.38551 5402317.53498,1685032.589404 5402344.159561,1685010.812129 5402370.774143,1684991.450886 5402409.496261,1684989.026608 5402463.955177,1684972.089644 5402600.687345,1684985.398437 5402732.580499,1684986.610576 5402973.371486,1684959.984745 5403060.493753,1684920.058367 5403131.88922,1684881.335882 5403191.177153,1684863.186778 5403244.416316,1684864.398918 5403295.235972,1684898.281092 5403346.055628,1684949.10023 5403360.582671,1684989.991372 5403370.170719,1685072.524028 5403369.050947,1685162.065651 5403366.631439,1685254.023306 5403340.006859,1685345.989208 5403307.333509,1685395.596207 5403272.25065,1685445.211452 5403216.581982,1685470.616898 5403177.869861,1685479.085381 5403110.103655,1685482.045639 5403068.682086,1685463.360556 5403033.869172,1685454.883828 5402967.322718,1685471.829038 5402909.244539,1685532.328797 5402824.54178,1685646.071973 5402744.678036,1685708.996011 5402691.438873,1685723.508697 5402658.765523,1685736.825736 5402615.20439,1685746.506357 5402540.189659,1685759.81515 5402501.467541,1685788.857013 5402491.789511,1685819.10277 5402497.83828,1685850.568912 5402523.243109,1685873.558326 5402570.433503,1685896.54774 5402610.355377,1685964.303842 5402718.053456,1686003.026327 5402812.434245,1686041.748812 5402911.654049,1686076.843125 5402947.956659,1686111.929193 5402947.956659,1686147.023506 5402931.010109,1686182.109574 5402901.976019,1686202.682955 5402819.692767,1686214.779609 5402689.009367,1686209.939298 5402592.209071,1686193.002334 5402489.360005,1686178.481402 5402415.54503,1686177.269263 5402357.466852,1686222.044197 5402317.53498,1686324.894613 5402263.086063,1686418.064408 5402230.412713,1686484.616617 5402243.720005,1686519.710931 5402271.554339,1686541.488206 5402312.695965,1686559.637309 5402416.754784,1686598.359794 5402483.311237,1686663.699864 5402560.745475,1686704.838381 5402610.355377,1686724.199623 5402659.965279,1686748.401176 5402754.356066,1686777.44304 5402892.297989,1686816.165525 5402980.630009,1686864.560385 5403039.917941,1686942.005355 5403090.737597,1687020.654218 5403104.054886,1687121.088601 5403129.459715,1687190.056843 5403153.664788,1687232.440482 5403171.661125,1687258.83543 5403191.157157,1687296.032434 5403231.338978,1687323.334424 5403271.630776,1687350.331318 5403336.817508,1687355.138646 5403374.309876,1687354.940745 5403406.803263,1687349.539717 5403432.697992,1687329.213711 5403462.211984,1687315.904918 5403514.241394,1687305.012158 5403550.544005,1687302.868239 5403577.968422,1687302.58788 5403647.344301,1687337.682193 5403723.578784,1687378.82071 5403747.773859,1687485.299298 5403757.461887,1687540.966993 5403757.461887,1687609.935234 5403746.564105,1687666.509972 5403770.889154,1687709.800655 5403791.874882,1687749.595099 5403819.559247,1687766.993831 5403837.255645,1687789.191643 5403882.346467,1687788.993743 5403907.341379,1687781.30037 5403937.335274,1687766.103279 5403964.729698,1687735.915243 5403994.523634,1687698.231735 5404019.328585,1687665.635913 5404034.025593,1687635.645777 5404041.324108,1687597.558222 5404039.734431,1687563.065855 5404038.334716,1687503.176288 5404027.946831,1687339.207674 5403984.07576,1687303.42071 5403984.07576,1687268.425347 5403991.384273,1687241.733549 5404002.382034,1687194.897153 5404036.974993,1687157.386808 5404074.487357,1687138.025565 5404115.628983,1687142.865876 5404156.770609,1687175.535911 5404259.619674,1687225.14291 5404338.273664,1687369.140089 5404431.4447,1687438.108331 5404471.376572,1687479.246848 5404489.522878,1687531.888318 5404490.732632,1687547.802798 5404451.100699,1687563.304985 5404415.957852,1687535.508244 5404415.757893,1687520.517299 5404420.656896,1687488.020426 5404417.967443,1687440.631559 5404400.071086,1687393.242692 5404374.786232,1687306.15833 5404316.708054,1687273.859358 5404283.914729,1687256.559577 5404251.321363,1687221.861064 5404213.539054,1687212.254656 5404148.452302,1687219.956274 5404128.556352,1687250.14431 5404101.261907,1687282.731887 5404083.95543,1687317.8262 5404074.157425,1687360.317036 5404071.957872,1687385.31019 5404077.146816,1687462.697439 5404102.731608,1687512.683747 5404103.031547,1687550.169355 5404095.823015,1687628.084338 5404107.160707,1687687.743021 5404083.215581,1687762.219487 5404046.013153,1687805.402973 5404008.720744,1687854.358551 5403919.598884,1687851.934273 5403865.149967,1687851.934273 5403840.944894,1687834.997309 5403804.652281,1687819.264238 5403765.930163,1687790.271849 5403734.876484,1687732.987969 5403696.994195,1687695.593065 5403681.697309,1687658.099211 5403673.908894,1687625.610584 5403673.708935,1687580.621258 5403678.417976,1687512.939368 5403697.914008,1687467.950041 5403697.624067,1687447.953869 5403692.525105,1687410.558965 5403672.239234,1687393.259184 5403649.643833,1687380.956384 5403612.051485,1687380.420404 5403608.582191,1687367.92795 5403548.124497,1687370.352228 5403520.290163,1687389.738208 5403461.882051,1687404.737399 5403458.482743,1687417.229853 5403434.787566,1687417.518458 5403387.297233,1687430.316008 5403344.805882,1687430.711809 5403292.316566,1687420.9075 5403262.222691,1687406.106209 5403237.127799,1687366.311765 5403194.346507,1687339.01802 5403174.150618,1687244.33099 5403120.971443,1687211.941314 5403108.284025,1687167.042691 5403080.489683,1687108.860014 5403058.404178,1687067.366926 5403044.806946,1687056.465919 5403042.517412,1686997.664804 5403038.708187,1686939.581076 5403022.981388,1686857.304042 5402935.859122,1686793.176111 5402754.356066,1686775.018762 5402684.170352,1686745.985144 5402628.511682,1686720.571452 5402588.57981,1686652.807104 5402515.974588,1686611.668586 5402447.008626,1686585.051001 5402405.867,1686575.37038 5402357.466852,1686563.26548 5402299.388674,1686537.860034 5402250.988525,1686499.137549 5402218.315176,1686427.745029 5402205.007884,1686361.19282 5402213.476161,1686295.85275 5402249.768774,1686220.832058 5402293.329907,1686173.641091 5402324.793502,1686154.279849 5402369.564389,1686154.279849 5402424.013307,1686182.109574 5402528.082124,1686189.374162 5402658.755525,1686189.374162 5402799.126953,1686160.332299 5402897.137004,1686125.237985 5402923.751586,1686081.683436 5402923.751586,1686046.589123 5402881.400207,1686009.078777 5402770.082865,1685950.99505 5402647.867742,1685913.484704 5402586.160302,1685859.037394 5402499.048033,1685819.10277 5402477.262468,1685802.165806 5402472.423453,1685768.283632 5402472.423453,1685734.401458 5402491.789511,1685727.145115 5402524.452862,1685717.464493 5402605.52636,1685693.26294 5402678.131582,1685585.572214 5402755.56582,1685504.499073 5402820.912519,1685460.936277 5402880.200451,1685433.106553 5402935.859122,1685431.894414 5402993.947298,1685460.936277 5403084.698826,1685460.936277 5403142.777004,1685408.905 5403229.899271,1685337.51248 5403281.92868,1685229.821753 5403319.441045,1685108.822234 5403347.265381,1685005.971818 5403344.845874,1684916.430195 5403326.699567,1684889.804364 5403294.026218,1684899.484985 5403226.27001,1684946.675952 5403143.986758,1684981.770265 5403067.752275,1685003.54754 5402989.098285,1685019.280611 5402887.458974,1685015.652439 5402772.512371,1685007.175712 5402592.219069,1685019.280611 5402466.374684,1685031.38551 5402392.559709,1685042.270025 5402371.983897,1685054.374924 5402341.740053,1685054.374924 5402318.744734,1685045.906442 5402289.710643,1685007.183957 5402259.456802,1684949.10023 5402241.300497,1684875.291678 5402258.247048,1684795.430676 5402294.549659,1684711.941502 5402363.515621,1684667.166568 5402415.54503,1684650.229604 5402485.730744,1684663.538396 5402594.628578,1684697.420571 5402662.394785,1684771.229123 5402726.521732,1684808.739469 5402774.92188,1684812.36764 5402816.063506,1684780.909744 5402851.156363,1684740.97512 5402870.512423,1684690.155982 5402868.092915,1684630.868361 5402843.89784,1684517.61169 5402795.847621,1684435.32641 5402765.263846,1684290.578859 5402730.590904,1684228.067113 5402721.292796,1684133.289379 5402698.207495,1684030.810026 5402682.520688,1684000 5402672.31399816))" ) ); @@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE( testPolygon80 ) int iterations = 1; for ( int i = 0; i < iterations; i++ ) { - std::auto_ptr< Geometry > sum( algorithm::straightSkeleton( *g ) ); + std::unique_ptr< Geometry > sum( algorithm::straightSkeleton( *g ) ); } bench().stop(); @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE( testPolygon80 ) // See https://github.com/Oslandia/SFCGAL/issues/80 BOOST_AUTO_TEST_CASE( testMultiPolygon80 ) { - std::auto_ptr< Geometry > g( io::readWkt( + std::unique_ptr< Geometry > g( io::readWkt( "MULTIPOLYGON(((1684000 5402672.31399816,1683946.034501 5402654.436405,1683891.240865 5402626.55208,1683828.852807 5402603.566759,1683763.966259 5402588.179891,1683710.005454 5402593.368835,1683643.321311 5402617.6139,1683558.455081 5402667.62372,1683479.657793 5402723.692308,1683393.274328 5402782.790279,1683344.780518 5402828.261023,1683302.347403 5402879.780536,1683275.07015 5402920.702207,1683275.07015 5402961.61388,1683285.674306 5403005.564933,1683312.951559 5403060.123828,1683325.081196 5403107.104265,1683319.0205 5403163.172853,1683291.735002 5403213.182673,1683214.454949 5403316.231698,1683131.097709 5403404.133806,1683071.999743 5403438.986712,1682985.616278 5403446.565169,1682940.462035 5403442.675961,1682880.415797 5403428.688808,1682817.343333 5403380.938527,1682774.09388 5403321.470632,1682729.94563 5403243.986403,1682692.10545 5403159.283644,1682682.878351 5403080.789622,1682680.67671 5403039.198087,1682654.257025 5402965.563076,1682628.876316 5402937.928701,1682608.979094 5402917.832791,1682537.124807 5402882.669948,1682377.221394 5402803.686025,1682327.432986 5402778.391174,1682247.745147 5402720.312996,1682225.349434 5402712.624561,1682183.51002 5402714.684141,1682145.917216 5402727.481536,1682113.964569 5402740.648856,1682089.985654 5402764.224058,1682069.700877 5402801.616447,1682051.708445 5402871.502221,1682004.624674 5402975.481057,1681970.354945 5403065.972638,1681952.560413 5403113.362991,1681928.037272 5403171.901076,1681920.830404 5403207.043923,1681928.936069 5403248.485488,1681963.684057 5403315.911763,1681985.700461 5403387.247243,1681982.097027 5403427.788991,1681972.696765 5403453.58374,1681959.998165 5403485.977147,1681917.119774 5403543.165506,1681871.734647 5403590.355901,1681801.356366 5403642.355317,1681698.275067 5403702.603053,1681626.709384 5403743.754677,1681565.82207 5403762.980764,1681486.530031 5403783.696547,1681395.528893 5403795.414162,1681308.13119 5403794.514345,1681281.134295 5403807.881624,1681309.029987 5403814.330312,1681347.777209 5403821.538844,1681443.280578 5403812.530678,1681535.188758 5403799.913246,1681627.995736 5403769.279482,1681693.294577 5403734.146633,1681743.478785 5403709.551639,1681819.010719 5403658.462038,1681882.981979 5403607.092494,1681939.746371 5403555.732948,1681968.582088 5403515.1912,1681992.008532 5403477.348903,1682001.920037 5403427.788991,1682003.725877 5403371.030544,1681981.181738 5403316.111723,1681950.564919 5403242.18677,1681946.961485 5403179.109609,1682053.819381 5402931.490011,1682074.706105 5402867.003137,1682087.000658 5402829.21083,1682109.882876 5402779.320985,1682132.47649 5402759.525014,1682162.573821 5402744.718028,1682197.659889 5402742.418496,1682230.057811 5402752.7164,1682274.948187 5402775.501762,1682361.422357 5402825.011685,1682456.810283 5402864.263695,1682563.989768 5402917.532852,1682603.784212 5402945.227215,1682636.380035 5402982.409647,1682648.855997 5403036.748586,1682663.269733 5403154.78456,1682694.397795 5403228.449566,1682727.240993 5403287.227602,1682756.07671 5403341.296596,1682792.11105 5403388.14706,1682830.858272 5403421.480275,1682900.37074 5403459.87246,1682942.762625 5403465.171382,1682975.012122 5403470.810234,1683049.26595 5403469.290543,1683114.432858 5403443.535786,1683203.842547 5403370.790593,1683279.613611 5403273.800335,1683328.107421 5403210.15329,1683356.901909 5403151.045321,1683353.875684 5403104.074882,1683331.141892 5403043.457221,1683309.925334 5402970.712028,1683311.44257 5402916.263111,1683346.297753 5402870.692386,1683408.43019 5402805.525651,1683487.235724 5402746.42768,1683575.128178 5402690.349095,1683641.804075 5402647.917731,1683706.970983 5402616.094209,1683741.826167 5402610.035442,1683781.26604 5402615.764276,1683816.261403 5402623.462709,1683915.838219 5402676.741864,1684000 5402711.41802501,1684020.618162 5402719.913077,1684068.00703 5402732.710472,1684222.971181 5402746.287709,1684311.424353 5402765.24385,1684450.572976 5402802.756215,1684578.837084 5402854.785624,1684651.433497 5402882.619959,1684708.305085 5402894.717496,1684763.964534 5402883.829712,1684819.632229 5402849.946609,1684837.781332 5402820.902521,1684835.357054 5402777.341388,1684817.207951 5402736.199762,1684749.451848 5402674.492322,1684704.676914 5402623.672666,1684682.899639 5402545.018676,1684682.899639 5402476.052714,1684692.58026 5402430.072073,1684739.771227 5402376.822912,1684837.781332 5402305.437442,1684921.270506 5402277.603108,1684981.770265 5402275.1836,1685015.652439 5402295.759412,1685031.38551 5402317.53498,1685032.589404 5402344.159561,1685010.812129 5402370.774143,1684991.450886 5402409.496261,1684989.026608 5402463.955177,1684972.089644 5402600.687345,1684985.398437 5402732.580499,1684986.610576 5402973.371486,1684959.984745 5403060.493753,1684920.058367 5403131.88922,1684881.335882 5403191.177153,1684863.186778 5403244.416316,1684864.398918 5403295.235972,1684898.281092 5403346.055628,1684949.10023 5403360.582671,1684989.991372 5403370.170719,1685072.524028 5403369.050947,1685162.065651 5403366.631439,1685254.023306 5403340.006859,1685345.989208 5403307.333509,1685395.596207 5403272.25065,1685445.211452 5403216.581982,1685470.616898 5403177.869861,1685479.085381 5403110.103655,1685482.045639 5403068.682086,1685463.360556 5403033.869172,1685454.883828 5402967.322718,1685471.829038 5402909.244539,1685532.328797 5402824.54178,1685646.071973 5402744.678036,1685708.996011 5402691.438873,1685723.508697 5402658.765523,1685736.825736 5402615.20439,1685746.506357 5402540.189659,1685759.81515 5402501.467541,1685788.857013 5402491.789511,1685819.10277 5402497.83828,1685850.568912 5402523.243109,1685873.558326 5402570.433503,1685896.54774 5402610.355377,1685964.303842 5402718.053456,1686003.026327 5402812.434245,1686041.748812 5402911.654049,1686076.843125 5402947.956659,1686111.929193 5402947.956659,1686147.023506 5402931.010109,1686182.109574 5402901.976019,1686202.682955 5402819.692767,1686214.779609 5402689.009367,1686209.939298 5402592.209071,1686193.002334 5402489.360005,1686178.481402 5402415.54503,1686177.269263 5402357.466852,1686222.044197 5402317.53498,1686324.894613 5402263.086063,1686418.064408 5402230.412713,1686484.616617 5402243.720005,1686519.710931 5402271.554339,1686541.488206 5402312.695965,1686559.637309 5402416.754784,1686598.359794 5402483.311237,1686663.699864 5402560.745475,1686704.838381 5402610.355377,1686724.199623 5402659.965279,1686748.401176 5402754.356066,1686777.44304 5402892.297989,1686816.165525 5402980.630009,1686864.560385 5403039.917941,1686942.005355 5403090.737597,1687020.654218 5403104.054886,1687121.088601 5403129.459715,1687190.056843 5403153.664788,1687232.440482 5403171.661125,1687258.83543 5403191.157157,1687296.032434 5403231.338978,1687323.334424 5403271.630776,1687350.331318 5403336.817508,1687355.138646 5403374.309876,1687354.940745 5403406.803263,1687349.539717 5403432.697992,1687329.213711 5403462.211984,1687315.904918 5403514.241394,1687305.012158 5403550.544005,1687302.868239 5403577.968422,1687302.58788 5403647.344301,1687337.682193 5403723.578784,1687378.82071 5403747.773859,1687485.299298 5403757.461887,1687540.966993 5403757.461887,1687609.935234 5403746.564105,1687666.509972 5403770.889154,1687709.800655 5403791.874882,1687749.595099 5403819.559247,1687766.993831 5403837.255645,1687789.191643 5403882.346467,1687788.993743 5403907.341379,1687781.30037 5403937.335274,1687766.103279 5403964.729698,1687735.915243 5403994.523634,1687698.231735 5404019.328585,1687665.635913 5404034.025593,1687635.645777 5404041.324108,1687597.558222 5404039.734431,1687563.065855 5404038.334716,1687503.176288 5404027.946831,1687339.207674 5403984.07576,1687303.42071 5403984.07576,1687268.425347 5403991.384273,1687241.733549 5404002.382034,1687194.897153 5404036.974993,1687157.386808 5404074.487357,1687138.025565 5404115.628983,1687142.865876 5404156.770609,1687175.535911 5404259.619674,1687225.14291 5404338.273664,1687369.140089 5404431.4447,1687438.108331 5404471.376572,1687479.246848 5404489.522878,1687531.888318 5404490.732632,1687547.802798 5404451.100699,1687563.304985 5404415.957852,1687535.508244 5404415.757893,1687520.517299 5404420.656896,1687488.020426 5404417.967443,1687440.631559 5404400.071086,1687393.242692 5404374.786232,1687306.15833 5404316.708054,1687273.859358 5404283.914729,1687256.559577 5404251.321363,1687221.861064 5404213.539054,1687212.254656 5404148.452302,1687219.956274 5404128.556352,1687250.14431 5404101.261907,1687282.731887 5404083.95543,1687317.8262 5404074.157425,1687360.317036 5404071.957872,1687385.31019 5404077.146816,1687462.697439 5404102.731608,1687512.683747 5404103.031547,1687550.169355 5404095.823015,1687628.084338 5404107.160707,1687687.743021 5404083.215581,1687762.219487 5404046.013153,1687805.402973 5404008.720744,1687854.358551 5403919.598884,1687851.934273 5403865.149967,1687851.934273 5403840.944894,1687834.997309 5403804.652281,1687819.264238 5403765.930163,1687790.271849 5403734.876484,1687732.987969 5403696.994195,1687695.593065 5403681.697309,1687658.099211 5403673.908894,1687625.610584 5403673.708935,1687580.621258 5403678.417976,1687512.939368 5403697.914008,1687467.950041 5403697.624067,1687447.953869 5403692.525105,1687410.558965 5403672.239234,1687393.259184 5403649.643833,1687380.956384 5403612.051485,1687380.420404 5403608.582191,1687367.92795 5403548.124497,1687370.352228 5403520.290163,1687389.738208 5403461.882051,1687404.737399 5403458.482743,1687417.229853 5403434.787566,1687417.518458 5403387.297233,1687430.316008 5403344.805882,1687430.711809 5403292.316566,1687420.9075 5403262.222691,1687406.106209 5403237.127799,1687366.311765 5403194.346507,1687339.01802 5403174.150618,1687244.33099 5403120.971443,1687211.941314 5403108.284025,1687167.042691 5403080.489683,1687108.860014 5403058.404178,1687067.366926 5403044.806946,1687056.465919 5403042.517412,1686997.664804 5403038.708187,1686939.581076 5403022.981388,1686857.304042 5402935.859122,1686793.176111 5402754.356066,1686775.018762 5402684.170352,1686745.985144 5402628.511682,1686720.571452 5402588.57981,1686652.807104 5402515.974588,1686611.668586 5402447.008626,1686585.051001 5402405.867,1686575.37038 5402357.466852,1686563.26548 5402299.388674,1686537.860034 5402250.988525,1686499.137549 5402218.315176,1686427.745029 5402205.007884,1686361.19282 5402213.476161,1686295.85275 5402249.768774,1686220.832058 5402293.329907,1686173.641091 5402324.793502,1686154.279849 5402369.564389,1686154.279849 5402424.013307,1686182.109574 5402528.082124,1686189.374162 5402658.755525,1686189.374162 5402799.126953,1686160.332299 5402897.137004,1686125.237985 5402923.751586,1686081.683436 5402923.751586,1686046.589123 5402881.400207,1686009.078777 5402770.082865,1685950.99505 5402647.867742,1685913.484704 5402586.160302,1685859.037394 5402499.048033,1685819.10277 5402477.262468,1685802.165806 5402472.423453,1685768.283632 5402472.423453,1685734.401458 5402491.789511,1685727.145115 5402524.452862,1685717.464493 5402605.52636,1685693.26294 5402678.131582,1685585.572214 5402755.56582,1685504.499073 5402820.912519,1685460.936277 5402880.200451,1685433.106553 5402935.859122,1685431.894414 5402993.947298,1685460.936277 5403084.698826,1685460.936277 5403142.777004,1685408.905 5403229.899271,1685337.51248 5403281.92868,1685229.821753 5403319.441045,1685108.822234 5403347.265381,1685005.971818 5403344.845874,1684916.430195 5403326.699567,1684889.804364 5403294.026218,1684899.484985 5403226.27001,1684946.675952 5403143.986758,1684981.770265 5403067.752275,1685003.54754 5402989.098285,1685019.280611 5402887.458974,1685015.652439 5402772.512371,1685007.175712 5402592.219069,1685019.280611 5402466.374684,1685031.38551 5402392.559709,1685042.270025 5402371.983897,1685054.374924 5402341.740053,1685054.374924 5402318.744734,1685045.906442 5402289.710643,1685007.183957 5402259.456802,1684949.10023 5402241.300497,1684875.291678 5402258.247048,1684795.430676 5402294.549659,1684711.941502 5402363.515621,1684667.166568 5402415.54503,1684650.229604 5402485.730744,1684663.538396 5402594.628578,1684697.420571 5402662.394785,1684771.229123 5402726.521732,1684808.739469 5402774.92188,1684812.36764 5402816.063506,1684780.909744 5402851.156363,1684740.97512 5402870.512423,1684690.155982 5402868.092915,1684630.868361 5402843.89784,1684517.61169 5402795.847621,1684435.32641 5402765.263846,1684290.578859 5402730.590904,1684228.067113 5402721.292796,1684133.289379 5402698.207495,1684030.810026 5402682.520688,1684000 5402672.31399816)))" ) ); @@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE( testMultiPolygon80 ) int iterations = 1; for ( int i = 0; i < iterations; i++ ) { - std::auto_ptr< Geometry > sum( algorithm::straightSkeleton( *g ) ); + std::unique_ptr< Geometry > sum( algorithm::straightSkeleton( *g ) ); } bench().stop(); @@ -87,9 +87,9 @@ BOOST_AUTO_TEST_SUITE_END() //BOOST_AUTO_TEST_CASE( testTemp ){ -// std::auto_ptr< Geometry > gA( io::readWkt("MULTIPOLYGON(((11.795461 32.713032,11.381695 35.857648,15.188336 38.091981,28.428825 38.257487,30.994170 33.788822,30.580405 29.816675,26.773764 22.617159,11.050683 18.562259,-0.534745 21.044851,-3.513855 26.837565,3.520155 26.506553,4.099426 24.685985,4.678698 22.782665,6.582018 21.541369,8.899104 21.458616,16.098620 21.706875,18.332952 25.016998,17.919187 27.499589,16.429632 27.830601,14.360805 26.175540,13.036756 24.520479,10.885177 23.527442,8.733597 23.527442,6.002747 24.603232,4.595945 26.506553,1.203069 27.830601,1.368575 30.892465,2.113353 34.202587,4.678698 36.519672,6.664771 36.188660,8.071573 34.699105,7.409549 32.630279,5.837240 31.968254,5.919993 30.064934,7.575055 28.740885,10.802424 27.582342,12.126473 27.913355,13.781534 28.740885,14.443558 29.816675,14.691818 31.306230,14.278052 33.126797,13.450522 34.119834,11.795461 32.713032),(21.477568 36.188660,15.684854 36.271413,14.609065 28.161614,15.022830 27.582342,20.401779 29.816675,29.339109 32.133760,21.477568 36.188660)))") ); -// std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); +// std::unique_ptr< Geometry > gA( io::readWkt("MULTIPOLYGON(((11.795461 32.713032,11.381695 35.857648,15.188336 38.091981,28.428825 38.257487,30.994170 33.788822,30.580405 29.816675,26.773764 22.617159,11.050683 18.562259,-0.534745 21.044851,-3.513855 26.837565,3.520155 26.506553,4.099426 24.685985,4.678698 22.782665,6.582018 21.541369,8.899104 21.458616,16.098620 21.706875,18.332952 25.016998,17.919187 27.499589,16.429632 27.830601,14.360805 26.175540,13.036756 24.520479,10.885177 23.527442,8.733597 23.527442,6.002747 24.603232,4.595945 26.506553,1.203069 27.830601,1.368575 30.892465,2.113353 34.202587,4.678698 36.519672,6.664771 36.188660,8.071573 34.699105,7.409549 32.630279,5.837240 31.968254,5.919993 30.064934,7.575055 28.740885,10.802424 27.582342,12.126473 27.913355,13.781534 28.740885,14.443558 29.816675,14.691818 31.306230,14.278052 33.126797,13.450522 34.119834,11.795461 32.713032),(21.477568 36.188660,15.684854 36.271413,14.609065 28.161614,15.022830 27.582342,20.401779 29.816675,29.339109 32.133760,21.477568 36.188660)))") ); +// std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); // -// std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); +// std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); // std::cout << sum->asText(6) << std::endl ; //} diff --git a/test/bench/BenchTriangulation.cpp b/test/bench/BenchTriangulation.cpp index 98be31e6..2f95a5bc 100644 --- a/test/bench/BenchTriangulation.cpp +++ b/test/bench/BenchTriangulation.cpp @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE( testMultiPointTriangulation ) BOOST_AUTO_TEST_CASE( testPolygonTriangulationHoch ) { const int N = 7 ; - std::auto_ptr< Polygon > fractal( generator::hoch( N ) ); + std::unique_ptr< Polygon > fractal( generator::hoch( N ) ); BOOST_CHECK_EQUAL( fractal->exteriorRing().numPoints(), 49153U ); bench().start( boost::format( "triangulate hoch(%s)" ) % N ); @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE( testPolygonTriangulationHoch ) BOOST_AUTO_TEST_CASE( testPolygonTriangulationHoch_roundingSixDecimal ) { const int N = 7 ; - std::auto_ptr< Polygon > fractal( generator::hoch( N ) ); + std::unique_ptr< Polygon > fractal( generator::hoch( N ) ); BOOST_CHECK_EQUAL( fractal->exteriorRing().numPoints(), 49153U ); fractal->round( 100000 ) ; @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE( testPolygonTriangulationDisc ) { const int N = 20000 ; - std::auto_ptr< Polygon > disc( generator::disc( Point( 0.0,0.0 ), 1.0, 8U ) ); + std::unique_ptr< Polygon > disc( generator::disc( Point( 0.0,0.0 ), 1.0, 8U ) ); // std::cout << fractal->asText(5) << std::endl ; bench().start( boost::format( "triangulate disc x %s" ) % N ); @@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE( testMultiPointTriangulation2D ) BOOST_AUTO_TEST_CASE( testPolygonTriangulationHoch2D ) { const int N = 7 ; - std::auto_ptr< Polygon > fractal( generator::hoch( N ) ); + std::unique_ptr< Polygon > fractal( generator::hoch( N ) ); // std::cout << fractal->asText(5) << std::endl ; bench().start( boost::format( "triangulate2D hoch(%s)" ) % N ); @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE( testPolygonTriangulationDisc2D ) { const int N = 20000 ; - std::auto_ptr< Polygon > disc( generator::disc( Point( 0.0,0.0 ), 1.0, 8U ) ) ; + std::unique_ptr< Polygon > disc( generator::disc( Point( 0.0,0.0 ), 1.0, 8U ) ) ; // std::cout << fractal->asText(5) << std::endl ; bench().start( boost::format( "triangulate2D disc x %s" ) % N ) ; @@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE( testPolygonTriangulationDisc2D_roundingSixDecimal ) { const int N = 20000 ; - std::auto_ptr< Polygon > disc( generator::disc( Point( 0.0,0.0 ), 1.0, 8U ) ) ; + std::unique_ptr< Polygon > disc( generator::disc( Point( 0.0,0.0 ), 1.0, 8U ) ) ; disc->round( 100000 ) ; bench().start( boost::format( "triangulate2D disc x %s (round 6 six decimals)" ) % N ) ; diff --git a/test/bench/IntersectionPerfTest.cpp b/test/bench/IntersectionPerfTest.cpp index 8b580696..c718c2df 100644 --- a/test/bench/IntersectionPerfTest.cpp +++ b/test/bench/IntersectionPerfTest.cpp @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE( testIntersectionPerf ) mp.addGeometry( Point( x, y ) ); } - std::auto_ptr g( algorithm::convexHull( mp ) ); + std::unique_ptr g( algorithm::convexHull( mp ) ); polygons.push_back( g.release() ); } diff --git a/test/garden/main.cpp b/test/garden/main.cpp index c6b5baf2..1ff0fa45 100644 --- a/test/garden/main.cpp +++ b/test/garden/main.cpp @@ -112,7 +112,7 @@ int main( int argc, char* argv[] ) for ( std::vector< TestGeometry >::const_iterator tg=testGeom.begin(); tg!=testGeom.end(); ++tg ) { try { - std::auto_ptr< Geometry > g( io::readWkt( tg->wkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( tg->wkt ) ); testCollection.addGeometry( g.release() ); } catch ( WktParseException& ) { diff --git a/test/regress/convex_hull/main.cpp b/test/regress/convex_hull/main.cpp index e0ff89d9..678c3167 100644 --- a/test/regress/convex_hull/main.cpp +++ b/test/regress/convex_hull/main.cpp @@ -168,10 +168,10 @@ int main( int argc, char* argv[] ) bool failed = true ; - std::auto_ptr< Geometry > hull, hull3D ; + std::unique_ptr< Geometry > hull, hull3D ; try { - std::auto_ptr< Geometry > g; + std::unique_ptr< Geometry > g; g = io::readWkt( wkt ) ; hull = algorithm::convexHull( *g ) ; hull3D = algorithm::convexHull3D( *g ) ; diff --git a/test/regress/polygon_triangulator/main.cpp b/test/regress/polygon_triangulator/main.cpp index 425ee12f..f741b5d0 100644 --- a/test/regress/polygon_triangulator/main.cpp +++ b/test/regress/polygon_triangulator/main.cpp @@ -196,7 +196,7 @@ int main( int argc, char* argv[] ) TriangulatedSurface triangulatedSurface ; try { - std::auto_ptr< Geometry > g( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( wkt ) ); //io::vtk( *g, (boost::format("/tmp/polygon_%s.vtk") % id ).str() ); diff --git a/test/regress/standalone/SFCGAL/AreaTest.cpp b/test/regress/standalone/SFCGAL/AreaTest.cpp index 3753ad36..d2942f95 100644 --- a/test/regress/standalone/SFCGAL/AreaTest.cpp +++ b/test/regress/standalone/SFCGAL/AreaTest.cpp @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE( testComputeArea ) std::string inputWkt ; std::getline( iss, inputWkt ) ; - std::auto_ptr< Geometry > g( io::readWkt( inputWkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( inputWkt ) ); double area = algorithm::area3D( *g ) ; BOOST_TEST_MESSAGE( boost::format( "area( '%1%' ) = %2%" ) % inputWkt % area ); diff --git a/test/regress/standalone/SFCGAL/ConstraintDelaunayTriangulationTest.cpp b/test/regress/standalone/SFCGAL/ConstraintDelaunayTriangulationTest.cpp index ee91a761..56317b4a 100644 --- a/test/regress/standalone/SFCGAL/ConstraintDelaunayTriangulationTest.cpp +++ b/test/regress/standalone/SFCGAL/ConstraintDelaunayTriangulationTest.cpp @@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE( testTriangulateRGC ) BOOST_CHECK_EQUAL( triangulation.numVertices(), 36566U ); BOOST_CHECK_EQUAL( triangulation.numTriangles(), 73114U ); - std::auto_ptr< TriangulatedSurface > triangulatedSurface = triangulation.getTriangulatedSurface() ; + std::unique_ptr< TriangulatedSurface > triangulatedSurface = triangulation.getTriangulatedSurface() ; BOOST_CHECK_EQUAL( triangulatedSurface->numTriangles(), 73114U ); BOOST_CHECK_CLOSE( algorithm::area( *triangulatedSurface ), 818056610000.0, 0.1 ); } diff --git a/test/regress/standalone/SFCGAL/DistanceTest.cpp b/test/regress/standalone/SFCGAL/DistanceTest.cpp index fea4e6c3..3bd29bc8 100644 --- a/test/regress/standalone/SFCGAL/DistanceTest.cpp +++ b/test/regress/standalone/SFCGAL/DistanceTest.cpp @@ -106,8 +106,8 @@ BOOST_AUTO_TEST_CASE( testFileDistanceTest ) std::getline( iss, wktGB, '|' ) ; iss >> expectedDistance ; - std::auto_ptr< Geometry > gA( io::readWkt( wktGA ) ); - std::auto_ptr< Geometry > gB( io::readWkt( wktGB ) ); + std::unique_ptr< Geometry > gA( io::readWkt( wktGA ) ); + std::unique_ptr< Geometry > gB( io::readWkt( wktGB ) ); //if (43!=lineNo ) continue; //if (43==lineNo ) diff --git a/test/regress/standalone/SFCGAL/IntersectionTest.cpp b/test/regress/standalone/SFCGAL/IntersectionTest.cpp index 8a2149d2..58eae29d 100644 --- a/test/regress/standalone/SFCGAL/IntersectionTest.cpp +++ b/test/regress/standalone/SFCGAL/IntersectionTest.cpp @@ -19,6 +19,7 @@ */ #include #include +#include #include "../../../test_config.h" @@ -33,13 +34,13 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_IntersectionTest ) // https://trac.osgeo.org/postgis/ticket/4157 BOOST_AUTO_TEST_CASE( test_postgis_4157 ) { - std::auto_ptr< Geometry > g1( io::readWkt( "POLYGON Z ((" + std::unique_ptr< Geometry > g1( io::readWkt( "POLYGON Z ((" "122395.299 489126.697 8.61546664325712," "122389.298 489128.73 8.55588025324629," "122391.489 489135.198 8.5526708028059," "122397.49 489133.165 8.61225719281685," "122395.299 489126.697 8.61546664325712))" )); - std::auto_ptr< Geometry > g2( io::readWkt( "POLYHEDRALSURFACE Z (((" + std::unique_ptr< Geometry > g2( io::readWkt( "POLYHEDRALSURFACE Z (((" "122390.998245685 489133.068537491 0," "122391.003145022 489133.066423547 0," "122391.003145022 489133.066423547 10," diff --git a/test/regress/standalone/SFCGAL/IntersectsTest.cpp b/test/regress/standalone/SFCGAL/IntersectsTest.cpp index 68b2b0ca..e4d13f7d 100644 --- a/test/regress/standalone/SFCGAL/IntersectsTest.cpp +++ b/test/regress/standalone/SFCGAL/IntersectsTest.cpp @@ -97,8 +97,8 @@ BOOST_AUTO_TEST_CASE( testLimitsIntersects ) std::getline( ifs, wkt1 ); std::getline( ifs, wkt2 ); - std::auto_ptr< Geometry > g1( io::readWkt( wkt1 ) ); - std::auto_ptr< Geometry > g2( io::readWkt( wkt2 ) ); + std::unique_ptr< Geometry > g1( io::readWkt( wkt1 ) ); + std::unique_ptr< Geometry > g2( io::readWkt( wkt2 ) ); // check that a call to intersects() does not throw bool throws = false; diff --git a/test/regress/standalone/SFCGAL/StraightSkeletonTest.cpp b/test/regress/standalone/SFCGAL/StraightSkeletonTest.cpp index 0d1187d0..a848cf6d 100644 --- a/test/regress/standalone/SFCGAL/StraightSkeletonTest.cpp +++ b/test/regress/standalone/SFCGAL/StraightSkeletonTest.cpp @@ -80,7 +80,7 @@ namespace { continue; } - std::auto_ptr< Geometry > g; + std::unique_ptr< Geometry > g; try { g = io::readWkt( inputWkt ); } catch (const std::exception &e) { @@ -89,7 +89,7 @@ namespace { BOOST_CHECK_EQUAL("", ss.str()); continue; } - std::auto_ptr< MultiLineString > result; + std::unique_ptr< MultiLineString > result; try { result = algorithm::straightSkeleton( *g ) ; obtWkt = result->asText( 6 ); diff --git a/test/regress/standalone/SFCGAL/TriangulatePolygonTest.cpp b/test/regress/standalone/SFCGAL/TriangulatePolygonTest.cpp index 51c5a4f4..030558c5 100644 --- a/test/regress/standalone/SFCGAL/TriangulatePolygonTest.cpp +++ b/test/regress/standalone/SFCGAL/TriangulatePolygonTest.cpp @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE( testTriangulatePolygon ) /* * parse wkt */ - std::auto_ptr< Geometry > g( io::readWkt( inputWkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( inputWkt ) ); /* * check polygon diff --git a/test/regress/standalone/SFCGAL/WktTest.cpp b/test/regress/standalone/SFCGAL/WktTest.cpp index 2cfdaff1..866621ec 100644 --- a/test/regress/standalone/SFCGAL/WktTest.cpp +++ b/test/regress/standalone/SFCGAL/WktTest.cpp @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE( testReadWriter ) /* * parse wkt and check symmetry */ - std::auto_ptr< Geometry > g( io::readWkt( inputWkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( inputWkt ) ); std::string outputWkt = g->asText( 1 ); BOOST_CHECK_EQUAL( inputWkt, outputWkt ); } diff --git a/test/unit/SFCGAL/EnvelopeTest.cpp b/test/unit/SFCGAL/EnvelopeTest.cpp index 0be4aa32..219b2dc6 100644 --- a/test/unit/SFCGAL/EnvelopeTest.cpp +++ b/test/unit/SFCGAL/EnvelopeTest.cpp @@ -111,14 +111,14 @@ BOOST_AUTO_TEST_CASE( testExpandToInclude ) } -//std::auto_ptr< LineString > toRing() const ; +//std::unique_ptr< LineString > toRing() const ; BOOST_AUTO_TEST_CASE( testToRing ) { Envelope box( 0.0,1.0,2.0,3.0 ); BOOST_CHECK_EQUAL( box.toRing()->asText( 0 ), "LINESTRING(0 2,1 2,1 3,0 3,0 2)" ); } -//std::auto_ptr< Polygon > toPolygon() const ; +//std::unique_ptr< Polygon > toPolygon() const ; BOOST_AUTO_TEST_CASE( testToPolygon ) { Envelope box( 0.0,1.0,2.0,3.0,4.0,5.0 ); diff --git a/test/unit/SFCGAL/GeometryVisitorTest.cpp b/test/unit/SFCGAL/GeometryVisitorTest.cpp index 8b81ffb7..945e2b6e 100644 --- a/test/unit/SFCGAL/GeometryVisitorTest.cpp +++ b/test/unit/SFCGAL/GeometryVisitorTest.cpp @@ -96,7 +96,7 @@ class DemoVisitorGetType : public ConstGeometryVisitor { template < typename T > std::string getTypeWithVisitor() { - std::auto_ptr< Geometry > geometry( new T() ); + std::unique_ptr< Geometry > geometry( new T() ); DemoVisitorGetType visitor; geometry->accept( visitor ); return visitor.type ; diff --git a/test/unit/SFCGAL/LineStringTest.cpp b/test/unit/SFCGAL/LineStringTest.cpp index 420633dd..8eebca7d 100644 --- a/test/unit/SFCGAL/LineStringTest.cpp +++ b/test/unit/SFCGAL/LineStringTest.cpp @@ -240,7 +240,7 @@ BOOST_AUTO_TEST_CASE( testClone ) LineString g ; g.addPoint( Point( 0.0,0.0 ) ); g.addPoint( Point( 1.0,1.0 ) ); - std::auto_ptr< Geometry > copy( g.clone() ); + std::unique_ptr< Geometry > copy( g.clone() ); BOOST_REQUIRE( copy->is< LineString >() ); BOOST_CHECK_EQUAL( copy->as< LineString >().numPoints(), 2U ); } @@ -249,7 +249,7 @@ BOOST_AUTO_TEST_CASE( testClone ) BOOST_AUTO_TEST_CASE( testBoundary_empty ) { LineString g ; - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->isEmpty() ); BOOST_CHECK( boundary->is< GeometryCollection >() ); } @@ -260,7 +260,7 @@ BOOST_AUTO_TEST_CASE( testBoundary_3points ) g.addPoint( Point( 1.0,1.0 ) ); g.addPoint( Point( 2.0,2.0 ) ); - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( ! boundary->isEmpty() ); BOOST_REQUIRE( boundary->is< MultiPoint >() ); BOOST_CHECK_EQUAL( boundary->numGeometries(), 2U ); @@ -273,7 +273,7 @@ BOOST_AUTO_TEST_CASE( testBoundary_closed ) g.addPoint( Point( 2.0,2.0 ) ); g.addPoint( g.startPoint() ); - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->isEmpty() ); BOOST_CHECK( boundary->is< GeometryCollection >() ); } diff --git a/test/unit/SFCGAL/PointTest.cpp b/test/unit/SFCGAL/PointTest.cpp index d6b4eb16..6036e92c 100644 --- a/test/unit/SFCGAL/PointTest.cpp +++ b/test/unit/SFCGAL/PointTest.cpp @@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE( xyToVector_3 ) BOOST_AUTO_TEST_CASE( testClone ) { Point p( 3.0,4.0 ); - std::auto_ptr< Geometry > copy( p.clone() ); + std::unique_ptr< Geometry > copy( p.clone() ); BOOST_REQUIRE( copy->is< Point >() ); BOOST_CHECK_EQUAL( copy->as< Point >().x(), 3.0 ); BOOST_CHECK_EQUAL( copy->as< Point >().y(), 4.0 ); @@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE( testClone ) BOOST_AUTO_TEST_CASE( testBoundary ) { Point p( 3.0,4.0 ); - std::auto_ptr< Geometry > boundary( p.boundary() ); + std::unique_ptr< Geometry > boundary( p.boundary() ); BOOST_CHECK( boundary->isEmpty() ); BOOST_CHECK( boundary->is< GeometryCollection >() ); } @@ -266,7 +266,7 @@ BOOST_AUTO_TEST_CASE( isPoint ) //template < typename Derived > inline Derived & Geometry::as() BOOST_AUTO_TEST_CASE( asPoint ) { - std::auto_ptr< Geometry > g( new Point() ); + std::unique_ptr< Geometry > g( new Point() ); BOOST_CHECK( g->as< Point >().isEmpty() ); } diff --git a/test/unit/SFCGAL/PolygonTest.cpp b/test/unit/SFCGAL/PolygonTest.cpp index e0868c27..fab98b59 100644 --- a/test/unit/SFCGAL/PolygonTest.cpp +++ b/test/unit/SFCGAL/PolygonTest.cpp @@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE( testClone ) exteriorRing.addPoint( Point( 0.0,0.0 ) ); Polygon g( exteriorRing ); - std::auto_ptr< Polygon > copy( g.clone() ); + std::unique_ptr< Polygon > copy( g.clone() ); BOOST_CHECK( ! copy->isEmpty() ); BOOST_CHECK( ! copy->is3D() ); @@ -164,21 +164,21 @@ BOOST_AUTO_TEST_CASE( testClone ) //virtual Geometry* Geometry::boundary() const ; BOOST_AUTO_TEST_CASE( testBoundaryEmpty ) { - std::auto_ptr< Geometry > boundary( Polygon().boundary() ); + std::unique_ptr< Geometry > boundary( Polygon().boundary() ); BOOST_CHECK( boundary->isEmpty() ); BOOST_CHECK( boundary->is< GeometryCollection >() ); } BOOST_AUTO_TEST_CASE( testBoundaryWithoutHoles ) { std::string wkt( "POLYGON((0 0,0 1,1 1,0 0))" ) ; - std::auto_ptr< Geometry > boundary( io::readWkt( wkt )->boundary() ); + std::unique_ptr< Geometry > boundary( io::readWkt( wkt )->boundary() ); BOOST_CHECK( ! boundary->isEmpty() ); BOOST_CHECK_EQUAL( boundary->asText( 0 ), "LINESTRING(0 0,0 1,1 1,0 0)" ); } BOOST_AUTO_TEST_CASE( testBoundaryWithHoles ) { std::string wkt( "POLYGON((0 0,0 5,5 5,0 5,0 0),(1 1,2 1,2 2,1 1))" ) ; - std::auto_ptr< Geometry > boundary( io::readWkt( wkt )->boundary() ); + std::unique_ptr< Geometry > boundary( io::readWkt( wkt )->boundary() ); BOOST_CHECK( ! boundary->isEmpty() ); BOOST_CHECK_EQUAL( boundary->asText( 0 ), "MULTILINESTRING((0 0,0 5,5 5,0 5,0 0),(1 1,2 1,2 2,1 1))" ); } diff --git a/test/unit/SFCGAL/SolidTest.cpp b/test/unit/SFCGAL/SolidTest.cpp index b0c4a59e..e07ee348 100644 --- a/test/unit/SFCGAL/SolidTest.cpp +++ b/test/unit/SFCGAL/SolidTest.cpp @@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE( solidReadTest ) ")" ")"; - std::auto_ptr g( io::readWkt( gstr ) ); + std::unique_ptr g( io::readWkt( gstr ) ); BOOST_CHECK_EQUAL( g->as< Solid >().numShells(),2U ); } diff --git a/test/unit/SFCGAL/TriangleTest.cpp b/test/unit/SFCGAL/TriangleTest.cpp index a94e07ae..750a8e8e 100644 --- a/test/unit/SFCGAL/TriangleTest.cpp +++ b/test/unit/SFCGAL/TriangleTest.cpp @@ -107,7 +107,7 @@ BOOST_AUTO_TEST_CASE( testClone ) Triangle g( Kernel::Triangle_3( a,b,c ) ) ; - std::auto_ptr< Geometry > copy( g.clone() ); + std::unique_ptr< Geometry > copy( g.clone() ); BOOST_REQUIRE( copy->is< Triangle >() ); BOOST_CHECK_EQUAL( copy->asText( 0 ), "TRIANGLE((0 0 1,1 0 2,1 1 3,0 0 1))" ); } @@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE( testBoundary ) Triangle g( Kernel::Triangle_2( a,b,c ) ) ; - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK_EQUAL( boundary->asText( 0 ), "LINESTRING(0 0,1 0,1 1,0 0)" ); } @@ -233,7 +233,7 @@ BOOST_AUTO_TEST_CASE( isTriangle ) //template < typename Derived > inline Derived & Geometry::as() BOOST_AUTO_TEST_CASE( asTriangle ) { - std::auto_ptr< Geometry > g( new Triangle() ); + std::unique_ptr< Geometry > g( new Triangle() ); BOOST_CHECK( g->as< Triangle >().isEmpty() ); } diff --git a/test/unit/SFCGAL/TriangulatedSurfaceTest.cpp b/test/unit/SFCGAL/TriangulatedSurfaceTest.cpp index d41b078a..39440206 100644 --- a/test/unit/SFCGAL/TriangulatedSurfaceTest.cpp +++ b/test/unit/SFCGAL/TriangulatedSurfaceTest.cpp @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE( constructorWithTriangles ) //-- helpers -//template < typename K, typename Polyhedron > std::auto_ptr toPolyhedron_3() const; +//template < typename K, typename Polyhedron > std::unique_ptr toPolyhedron_3() const; // TODO @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE( testClone ) TriangulatedSurface g( triangles ) ; - std::auto_ptr< Geometry > copy( g.clone() ); + std::unique_ptr< Geometry > copy( g.clone() ); BOOST_REQUIRE( copy->is< TriangulatedSurface >() ); BOOST_CHECK_EQUAL( copy->as< TriangulatedSurface >().numTriangles(), 2U ); } @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE( testBoundary ) triangles.push_back( Triangle( Point( 0.0,0.0 ), Point( 1.0,1.0 ), Point( 0.0,1.0 ) ) ) ; TriangulatedSurface g( triangles ) ; - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); // TODO add algorithm::lineMerge and update BOOST_CHECK_EQUAL( boundary->asText( 0 ), "MULTILINESTRING((0 0,1 0),(1 0,1 1),(1 1,0 1),(0 1,0 0))" ); } @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE( testBoundaryClosed ) triangles.push_back( Triangle( c, a, d ) ) ; TriangulatedSurface g( triangles ) ; - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->isEmpty() ); } @@ -203,12 +203,12 @@ BOOST_AUTO_TEST_CASE( polyhedronConversionTest ) "((1 0 0,1 1 0,2 1 0,2 0 0,1 0 0)))"; // the following surface would generate an exception, since the two polygons have opposite orientations // "POLYHEDRALSURFACE(((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),((2 0 0,2 1 0,1 1 0,1 0 0,2 0 0)))"; - std::auto_ptr g( io::readWkt( gstr ) ); + std::unique_ptr g( io::readWkt( gstr ) ); TriangulatedSurface tri; triangulate::triangulatePolygon3D( *g, tri ); - std::auto_ptr > poly( tri.toPolyhedron_3 >() ); + std::unique_ptr > poly( tri.toPolyhedron_3 >() ); // we check the two squares share a common edge BOOST_CHECK_EQUAL( poly->size_of_facets(), 4U ); BOOST_CHECK_EQUAL( poly->size_of_vertices(), 6U ); diff --git a/test/unit/SFCGAL/algorithm/ApproximateMedialAxis.cpp b/test/unit/SFCGAL/algorithm/ApproximateMedialAxis.cpp index 5dead029..e5cf2ae0 100644 --- a/test/unit/SFCGAL/algorithm/ApproximateMedialAxis.cpp +++ b/test/unit/SFCGAL/algorithm/ApproximateMedialAxis.cpp @@ -45,22 +45,22 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_algorithm_ApproximateMedialAxisTest ) BOOST_AUTO_TEST_CASE( testTriangle45 ) { - std::auto_ptr< Geometry > g( io::readWkt( "TRIANGLE((1 1,2 1,2 2,1 1))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "TRIANGLE((1 1,2 1,2 2,1 1))" ) ); std::string expectedWKT( "MULTILINESTRING((1.0 1.0,1.7 1.3),(2.0 2.0,1.7 1.3))"); { - std::auto_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; + std::unique_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; BOOST_CHECK_EQUAL( result->asText( 1 ), expectedWKT ); } } BOOST_AUTO_TEST_CASE( testTriangle60 ) { - std::auto_ptr< Geometry > g( io::readWkt( "TRIANGLE((1 1,3 1,2 3,1 1))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "TRIANGLE((1 1,3 1,2 3,1 1))" ) ); std::string expectedWKT( "MULTILINESTRING EMPTY" ); { - std::auto_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; + std::unique_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; BOOST_CHECK_EQUAL( result->numGeometries(), 0U ); BOOST_CHECK_EQUAL( result->asText( 1 ), expectedWKT ); } @@ -68,22 +68,22 @@ BOOST_AUTO_TEST_CASE( testTriangle60 ) BOOST_AUTO_TEST_CASE( testPolygon ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((0 0,20 0,20 10,0 10,0 0))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((0 0,20 0,20 10,0 10,0 0))" ) ); std::string expectedWKT( "MULTILINESTRING((5 5,15 5))" ); { - std::auto_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; + std::unique_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; BOOST_CHECK_EQUAL( result->numGeometries(), 1U ); BOOST_CHECK_EQUAL( result->asText( 0 ), expectedWKT ); } } BOOST_AUTO_TEST_CASE( testPolygonWithHole ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4,4 4))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4,4 4))" ) ); std::string expectedWKT( "MULTILINESTRING((2 2,8 2),(2 2,2 8),(8 2,8 8),(2 8,8 8))" ); { - std::auto_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; + std::unique_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; BOOST_CHECK_EQUAL( result->numGeometries(), 4U ); BOOST_CHECK_EQUAL( result->asText( 0 ), expectedWKT ); } @@ -91,17 +91,17 @@ BOOST_AUTO_TEST_CASE( testPolygonWithHole ) BOOST_AUTO_TEST_CASE( testPolygonWithTouchingHoles ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0),(-0.5 -0.5,-0.5 0.5,-0.1 0.5,0.1 -0.5,-0.5 -0.5),(0.1 -0.5,0.1 0.5,0.5 0.5,0.5 -0.5,0.1 -0.5))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0),(-0.5 -0.5,-0.5 0.5,-0.1 0.5,0.1 -0.5,-0.5 -0.5),(0.1 -0.5,0.1 0.5,0.5 0.5,0.5 -0.5,0.1 -0.5))" ) ); // just for valgrind - BOOST_CHECK_THROW( std::auto_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ), NotImplementedException ) ; + BOOST_CHECK_THROW( std::unique_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ), NotImplementedException ) ; } BOOST_AUTO_TEST_CASE( testMultiPolygon ) { - std::auto_ptr< Geometry > g( io::readWkt( "MULTIPOLYGON(((3.000000 0.000000,2.875000 0.484123,2.750000 0.661438,2.625000 0.780625,2.500000 0.866025,2.375000 0.927025,2.250000 0.968246,2.125000 0.992157,2.000000 1.000000,1.875000 1.484123,1.750000 1.661438,1.625000 1.780625,1.500000 1.866025,1.375000 1.927025,1.250000 1.968246,1.125000 1.992157,1.000000 2.000000,0.750000 2.661438,0.500000 2.866025,0.250000 2.968246,0.000000 3.000000,-0.250000 2.968246,-0.500000 2.866025,-0.750000 2.661438,-1.000000 2.000000,-1.125000 1.992157,-1.250000 1.968246,-1.375000 1.927025,-1.500000 1.866025,-1.625000 1.780625,-1.750000 1.661438,-1.875000 1.484123,-2.000000 1.000000,-2.125000 0.992157,-2.250000 0.968246,-2.375000 0.927025,-2.500000 0.866025,-2.625000 0.780625,-2.750000 0.661438,-2.875000 0.484123,-3.000000 0.000000,-2.875000 -0.484123,-2.750000 -0.661438,-2.625000 -0.780625,-2.500000 -0.866025,-2.375000 -0.927025,-2.250000 -0.968246,-2.125000 -0.992157,-2.000000 -1.000000,-1.875000 -1.484123,-1.750000 -1.661438,-1.625000 -1.780625,-1.500000 -1.866025,-1.375000 -1.927025,-1.250000 -1.968246,-1.125000 -1.992157,-1.000000 -2.000000,-0.750000 -2.661438,-0.500000 -2.866025,-0.250000 -2.968246,0.000000 -3.000000,0.250000 -2.968246,0.500000 -2.866025,0.750000 -2.661438,1.000000 -2.000000,1.125000 -1.992157,1.250000 -1.968246,1.375000 -1.927025,1.500000 -1.866025,1.625000 -1.780625,1.750000 -1.661438,1.875000 -1.484123,2.000000 -1.000000,2.125000 -0.992157,2.250000 -0.968246,2.375000 -0.927025,2.500000 -0.866025,2.625000 -0.780625,2.750000 -0.661438,2.875000 -0.484123,3.000000 0.000000),(0.000000 1.000000,0.125000 0.515877,0.250000 0.338562,0.375000 0.219375,0.500000 0.133975,0.625000 0.072975,0.750000 0.031754,0.875000 0.007843,1.000000 0.000000,0.875000 -0.007843,0.750000 -0.031754,0.625000 -0.072975,0.500000 -0.133975,0.375000 -0.219375,0.250000 -0.338562,0.125000 -0.515877,0.000000 -1.000000,-0.125000 -0.515877,-0.250000 -0.338562,-0.375000 -0.219375,-0.500000 -0.133975,-0.625000 -0.072975,-0.750000 -0.031754,-0.875000 -0.007843,-1.000000 0.000000,-0.875000 0.007843,-0.750000 0.031754,-0.625000 0.072975,-0.500000 0.133975,-0.375000 0.219375,-0.250000 0.338562,-0.125000 0.515877,0.000000 1.000000)))" ) ); - std::auto_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; + std::unique_ptr< Geometry > g( io::readWkt( "MULTIPOLYGON(((3.000000 0.000000,2.875000 0.484123,2.750000 0.661438,2.625000 0.780625,2.500000 0.866025,2.375000 0.927025,2.250000 0.968246,2.125000 0.992157,2.000000 1.000000,1.875000 1.484123,1.750000 1.661438,1.625000 1.780625,1.500000 1.866025,1.375000 1.927025,1.250000 1.968246,1.125000 1.992157,1.000000 2.000000,0.750000 2.661438,0.500000 2.866025,0.250000 2.968246,0.000000 3.000000,-0.250000 2.968246,-0.500000 2.866025,-0.750000 2.661438,-1.000000 2.000000,-1.125000 1.992157,-1.250000 1.968246,-1.375000 1.927025,-1.500000 1.866025,-1.625000 1.780625,-1.750000 1.661438,-1.875000 1.484123,-2.000000 1.000000,-2.125000 0.992157,-2.250000 0.968246,-2.375000 0.927025,-2.500000 0.866025,-2.625000 0.780625,-2.750000 0.661438,-2.875000 0.484123,-3.000000 0.000000,-2.875000 -0.484123,-2.750000 -0.661438,-2.625000 -0.780625,-2.500000 -0.866025,-2.375000 -0.927025,-2.250000 -0.968246,-2.125000 -0.992157,-2.000000 -1.000000,-1.875000 -1.484123,-1.750000 -1.661438,-1.625000 -1.780625,-1.500000 -1.866025,-1.375000 -1.927025,-1.250000 -1.968246,-1.125000 -1.992157,-1.000000 -2.000000,-0.750000 -2.661438,-0.500000 -2.866025,-0.250000 -2.968246,0.000000 -3.000000,0.250000 -2.968246,0.500000 -2.866025,0.750000 -2.661438,1.000000 -2.000000,1.125000 -1.992157,1.250000 -1.968246,1.375000 -1.927025,1.500000 -1.866025,1.625000 -1.780625,1.750000 -1.661438,1.875000 -1.484123,2.000000 -1.000000,2.125000 -0.992157,2.250000 -0.968246,2.375000 -0.927025,2.500000 -0.866025,2.625000 -0.780625,2.750000 -0.661438,2.875000 -0.484123,3.000000 0.000000),(0.000000 1.000000,0.125000 0.515877,0.250000 0.338562,0.375000 0.219375,0.500000 0.133975,0.625000 0.072975,0.750000 0.031754,0.875000 0.007843,1.000000 0.000000,0.875000 -0.007843,0.750000 -0.031754,0.625000 -0.072975,0.500000 -0.133975,0.375000 -0.219375,0.250000 -0.338562,0.125000 -0.515877,0.000000 -1.000000,-0.125000 -0.515877,-0.250000 -0.338562,-0.375000 -0.219375,-0.500000 -0.133975,-0.625000 -0.072975,-0.750000 -0.031754,-0.875000 -0.007843,-1.000000 0.000000,-0.875000 0.007843,-0.750000 0.031754,-0.625000 0.072975,-0.500000 0.133975,-0.375000 0.219375,-0.250000 0.338562,-0.125000 0.515877,0.000000 1.000000)))" ) ); + std::unique_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ) ; BOOST_CHECK_EQUAL( result->numGeometries(), 108U ); } @@ -116,8 +116,8 @@ BOOST_AUTO_TEST_CASE( testInvalidTypes ) itE=wkt.end(); it != itE; ++it ) { - std::auto_ptr< Geometry > g( io::readWkt( *it ) ); - std::auto_ptr< MultiLineString > result( + std::unique_ptr< Geometry > g( io::readWkt( *it ) ); + std::unique_ptr< MultiLineString > result( algorithm::approximateMedialAxis( *g ) ); BOOST_CHECK_EQUAL( result->numGeometries(), 0U ); diff --git a/test/unit/SFCGAL/algorithm/AreaTest.cpp b/test/unit/SFCGAL/algorithm/AreaTest.cpp index d804b640..ca5e55f9 100644 --- a/test/unit/SFCGAL/algorithm/AreaTest.cpp +++ b/test/unit/SFCGAL/algorithm/AreaTest.cpp @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE( testEmpty2D3D ) for ( size_t i = 0; i < typeNames.size(); i++ ) { BOOST_TEST_MESSAGE( typeNames[i] ) ; - std::auto_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; + std::unique_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; BOOST_REQUIRE( g.get() != NULL ) ; BOOST_CHECK_EQUAL( algorithm::area( *g ), 0.0 ); BOOST_CHECK_EQUAL( algorithm::area3D( *g ), 0.0 ); @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE( testArea2D_Triangle ) BOOST_AUTO_TEST_CASE( testArea3D_Square1x1 ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((0.0 0.0 0.0,0.0 0.0 1.0,0.0 1.0 1.0,0.0 1.0 0.0,0.0 0.0 0.0))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((0.0 0.0 0.0,0.0 0.0 1.0,0.0 1.0 1.0,0.0 1.0 0.0,0.0 0.0 0.0))" ) ); BOOST_CHECK_EQUAL( g->asText( 1 ), "POLYGON((0.0 0.0 0.0,0.0 0.0 1.0,0.0 1.0 1.0,0.0 1.0 0.0,0.0 0.0 0.0))" ); BOOST_CHECK_CLOSE( algorithm::area3D( *g ), 1.0, 1e-10 ); } @@ -181,14 +181,14 @@ BOOST_AUTO_TEST_CASE( testArea3D_Square1x1 ) BOOST_AUTO_TEST_CASE( testArea3D_Square4X4 ) { std::string wkt( "POLYGON((0.0 0.0 0.0,0.0 0.0 4.0,0.0 4.0 4.0,0.0 4.0 0.0,0.0 0.0 0.0))" ); - std::auto_ptr< Geometry > g( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( wkt ) ); BOOST_CHECK_CLOSE( algorithm::area3D( *g ), 16.0, 1e-10 ); } BOOST_AUTO_TEST_CASE( testArea3D_Square4X4WithHole ) { std::string wkt( "POLYGON((0.0 0.0 0.0,0.0 0.0 4.0,0.0 4.0 4.0,0.0 4.0 0.0,0.0 0.0 0.0),(0.0 2.0 2.0,0.0 3.0 2.0,0.0 3.0 3.0,0.0 2.0 3.0,0.0 2.0 2.0))" ); - std::auto_ptr< Geometry > g( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( wkt ) ); BOOST_CHECK_CLOSE( algorithm::area3D( *g ), 15.0, 1e-10 ); } diff --git a/test/unit/SFCGAL/algorithm/BoundaryTest.cpp b/test/unit/SFCGAL/algorithm/BoundaryTest.cpp index fbc94bd1..a04c3ab3 100644 --- a/test/unit/SFCGAL/algorithm/BoundaryTest.cpp +++ b/test/unit/SFCGAL/algorithm/BoundaryTest.cpp @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_algorithm_BoundaryTest ) BOOST_AUTO_TEST_CASE( emptyPoint ) { Point g; - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->is< GeometryCollection >() ); BOOST_CHECK( boundary->isEmpty() ); @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE( emptyPoint ) BOOST_AUTO_TEST_CASE( pointXY ) { Point g( 2.0,3.0 ); - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->is< GeometryCollection >() ); BOOST_CHECK( boundary->isEmpty() ); @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE( pointXY ) BOOST_AUTO_TEST_CASE( emptyLineString ) { LineString g; - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->is< GeometryCollection >() ); BOOST_CHECK( boundary->isEmpty() ); @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE( lineStringSegment ) LineString g; g.addPoint( Point( 0.0,0.0 ) ); g.addPoint( Point( 1.0,1.0 ) ); - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->is< MultiPoint >() ); BOOST_CHECK_EQUAL( boundary->as< MultiPoint >().numGeometries(), 2U ); @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE( lineStringWithThreePoints ) g.addPoint( Point( 0.0,0.0 ) ); g.addPoint( Point( 1.0,1.0 ) ); g.addPoint( Point( 2.0,2.0 ) ); - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->is< MultiPoint >() ); BOOST_CHECK_EQUAL( boundary->as< MultiPoint >().numGeometries(), 2U ); @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE( lineStringClosed ) g.addPoint( Point( 2.0,2.0 ) ); g.addPoint( Point( 0.0,0.0 ) ); - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->isEmpty() ); BOOST_CHECK( boundary->is< GeometryCollection >() ); @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE( multiLineStringSimple ) g.addGeometry( LineString( Point( 1.0,1.0 ), Point( 1.0,2.0 ) ) ); - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( boundary->isEmpty() ); BOOST_CHECK( boundary->is< GeometryCollection >() ); @@ -161,7 +161,7 @@ BOOST_AUTO_TEST_CASE( multiPolygonSimple ) g.addGeometry( Polygon( ring ) ); } - std::auto_ptr< Geometry > boundary( g.boundary() ); + std::unique_ptr< Geometry > boundary( g.boundary() ); BOOST_CHECK( ! boundary->isEmpty() ); BOOST_CHECK( boundary->is< MultiLineString >() ); diff --git a/test/unit/SFCGAL/algorithm/ConnectedTest.cpp b/test/unit/SFCGAL/algorithm/ConnectedTest.cpp index 6f38687c..d4ca94cb 100644 --- a/test/unit/SFCGAL/algorithm/ConnectedTest.cpp +++ b/test/unit/SFCGAL/algorithm/ConnectedTest.cpp @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_algorithm_Connected ) BOOST_AUTO_TEST_CASE( allFine ) { - std::auto_ptr< Geometry > geom ( io::readWkt( + std::unique_ptr< Geometry > geom ( io::readWkt( "POLYHEDRALSURFACE(((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ @@ -57,7 +57,7 @@ BOOST_AUTO_TEST_CASE( allFine ) BOOST_AUTO_TEST_CASE( notConnected ) { - std::auto_ptr< Geometry > geom ( io::readWkt( + std::unique_ptr< Geometry > geom ( io::readWkt( "POLYHEDRALSURFACE(((0 0 -1, 0 1 -1, 1 1 -1, 1 0 -1, 0 0 -1)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE( notConnected ) BOOST_AUTO_TEST_CASE( notClosed ) { - std::auto_ptr< Geometry > geom ( io::readWkt( + std::unique_ptr< Geometry > geom ( io::readWkt( "POLYHEDRALSURFACE(((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ diff --git a/test/unit/SFCGAL/algorithm/ConvexHullTest.cpp b/test/unit/SFCGAL/algorithm/ConvexHullTest.cpp index 07412814..cc5239e5 100644 --- a/test/unit/SFCGAL/algorithm/ConvexHullTest.cpp +++ b/test/unit/SFCGAL/algorithm/ConvexHullTest.cpp @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull2D_Empty ) GeometryCollection collect; collect.addGeometry( Polygon() ); collect.addGeometry( Polygon() ); - std::auto_ptr< Geometry > hull( algorithm::convexHull( collect ) ); + std::unique_ptr< Geometry > hull( algorithm::convexHull( collect ) ); BOOST_CHECK( hull->isEmpty() ); } @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull2D_ColinearProduceLineString ) lineString.addPoint( Point( 1.0,1.0 ) ); lineString.addPoint( Point( 2.0,2.0 ) ); - std::auto_ptr< Geometry > hull( algorithm::convexHull( lineString ) ); + std::unique_ptr< Geometry > hull( algorithm::convexHull( lineString ) ); BOOST_REQUIRE( hull->is< LineString >() ); BOOST_CHECK_EQUAL( hull->as< LineString >().numPoints(), 2U ); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull2D_Triangle ) points.push_back( Point( 0.0,1.0 ) ); LineString lineString( points ) ; - std::auto_ptr< Geometry > hull( algorithm::convexHull( lineString ) ); + std::unique_ptr< Geometry > hull( algorithm::convexHull( lineString ) ); BOOST_CHECK( hull->is() ); } @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull2D_Polygon ) points.push_back( Point( 0.0,1.0 ) ); LineString lineString( points ) ; - std::auto_ptr< Geometry > hull( algorithm::convexHull( lineString ) ); + std::unique_ptr< Geometry > hull( algorithm::convexHull( lineString ) ); BOOST_CHECK( hull->is() ); } @@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull3D_Empty ) GeometryCollection collect; collect.addGeometry( Polygon() ); collect.addGeometry( Polygon() ); - std::auto_ptr< Geometry > hull( algorithm::convexHull3D( collect ) ); + std::unique_ptr< Geometry > hull( algorithm::convexHull3D( collect ) ); BOOST_CHECK( hull->isEmpty() ); } @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull3D_Empty ) BOOST_AUTO_TEST_CASE( testConvexHull3D_Point ) { Point p( 1.0,2.0,3.0 ); - std::auto_ptr< Geometry > hull( algorithm::convexHull3D( p ) ); + std::unique_ptr< Geometry > hull( algorithm::convexHull3D( p ) ); BOOST_CHECK( hull->is< Point >() ); BOOST_CHECK_EQUAL( hull->as< Point >().x(), 1.0 ) ; BOOST_CHECK_EQUAL( hull->as< Point >().y(), 2.0 ) ; @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull3D_LineStringCollinear ) points.push_back( Point( 3.0,3.0,3.0 ) ); LineString lineString( points ) ; - std::auto_ptr< Geometry > hull( algorithm::convexHull3D( lineString ) ); + std::unique_ptr< Geometry > hull( algorithm::convexHull3D( lineString ) ); BOOST_CHECK( hull->is< LineString >() ); } @@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull3D_LineStringCoplanar ) points.push_back( Point( 0.0,1.0,1.0 ) ); LineString lineString( points ) ; - std::auto_ptr< Geometry > hull( algorithm::convexHull3D( lineString ) ); + std::unique_ptr< Geometry > hull( algorithm::convexHull3D( lineString ) ); BOOST_CHECK( hull->is< PolyhedralSurface >() ); BOOST_CHECK_EQUAL( hull->as< PolyhedralSurface >().numPolygons(), 2U ); } @@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull3D_Tetrahedron ) points.push_back( Point( 0.0,0.0,1.0 ) ); LineString lineString( points ) ; - std::auto_ptr< Geometry > hull( algorithm::convexHull3D( lineString ) ); + std::unique_ptr< Geometry > hull( algorithm::convexHull3D( lineString ) ); BOOST_CHECK( hull->is< PolyhedralSurface >() ); BOOST_CHECK_EQUAL( hull->as< PolyhedralSurface >().numPolygons(), 4U ); diff --git a/test/unit/SFCGAL/algorithm/CoversPointsTest.cpp b/test/unit/SFCGAL/algorithm/CoversPointsTest.cpp index 0b589eec..6814f45e 100644 --- a/test/unit/SFCGAL/algorithm/CoversPointsTest.cpp +++ b/test/unit/SFCGAL/algorithm/CoversPointsTest.cpp @@ -57,8 +57,8 @@ BOOST_AUTO_TEST_CASE( testPointPointCoversPoints ) BOOST_AUTO_TEST_CASE( testPolygonPolygonCoversPoints ) { { - std::auto_ptr p1 = io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0))" ); - std::auto_ptr p2 = io::readWkt( "POLYGON((-0.5 -0.5,-0.5 0.5,0.5 0.5,0.5 -0.5,-0.5 -0.5))" ); + std::unique_ptr p1 = io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0))" ); + std::unique_ptr p2 = io::readWkt( "POLYGON((-0.5 -0.5,-0.5 0.5,0.5 0.5,0.5 -0.5,-0.5 -0.5))" ); BOOST_CHECK_EQUAL( algorithm::coversPoints( *p1, *p2 ), true ); BOOST_CHECK_EQUAL( algorithm::coversPoints3D( *p1, *p2 ), true ); @@ -66,9 +66,9 @@ BOOST_AUTO_TEST_CASE( testPolygonPolygonCoversPoints ) { // a square with a substracted triangle => concave shape - std::auto_ptr p1 = io::readWkt( "POLYGON((0.4 0,0 0,0 1,1 1,1 0,0.6 0,0.5 0.4,0.4 0))" ); + std::unique_ptr p1 = io::readWkt( "POLYGON((0.4 0,0 0,0 1,1 1,1 0,0.6 0,0.5 0.4,0.4 0))" ); // a smaller square - std::auto_ptr p2 = io::readWkt( "POLYGON((0.2 0.2,0.8 0.2,0.8 0.8,0.2 0.8,0.2 0.2))" ); + std::unique_ptr p2 = io::readWkt( "POLYGON((0.2 0.2,0.8 0.2,0.8 0.8,0.2 0.8,0.2 0.2))" ); // ST_covers would answer false BOOST_CHECK_EQUAL( algorithm::coversPoints( *p1, *p2 ), true ); @@ -80,15 +80,15 @@ BOOST_AUTO_TEST_CASE( testCollectionCoversPoints ) { #if 0 { - std::auto_ptr p1 = io::readWkt( "GEOMETRYCOLLECTION(LINESTRING(0 0 0,0 0 1),LINESTRING(0 0 0,0 1 0),LINESTRING(0 1 1,0 0 1),LINESTRING(0 1 1,0 1 0))" ); - std::auto_ptr p2 = io::readWkt( "TIN(((0 0.5 0.5,0 0 1,0 0 0,0 0.5 0.5)),((0 0 1,0 0.5 0.5,0 1 1,0 0 1)),((0 0.5 0.5,0 0 0,0 1 0,0 0.5 0.5)),((0 0.5 0.5,0 1 0,0 1 1,0 0.5 0.5)))" ); + std::unique_ptr p1 = io::readWkt( "GEOMETRYCOLLECTION(LINESTRING(0 0 0,0 0 1),LINESTRING(0 0 0,0 1 0),LINESTRING(0 1 1,0 0 1),LINESTRING(0 1 1,0 1 0))" ); + std::unique_ptr p2 = io::readWkt( "TIN(((0 0.5 0.5,0 0 1,0 0 0,0 0.5 0.5)),((0 0 1,0 0.5 0.5,0 1 1,0 0 1)),((0 0.5 0.5,0 0 0,0 1 0,0 0.5 0.5)),((0 0.5 0.5,0 1 0,0 1 1,0 0.5 0.5)))" ); std::cout << "p1 covers p2 ? " << algorithm::coversPoints3D( *p1, *p2 ) << std::endl; std::cout << "p2 covers p1 ? " << algorithm::coversPoints3D( *p2, *p1 ) << std::endl; } { - std::auto_ptr p1 = io::readWkt( "GEOMETRYCOLLECTION(TRIANGLE((1 1,0.5 0.5,0 1,1 1)),TRIANGLE((1 0,0.5 0.5,1 1,1 0)),TRIANGLE((0.5 0.5,0 0,0 1,0.5 0.5)))" ); - std::auto_ptr p2 = io::readWkt( "TRIANGLE((1 0, 0 0,0.5 0.5,1 0))" ); + std::unique_ptr p1 = io::readWkt( "GEOMETRYCOLLECTION(TRIANGLE((1 1,0.5 0.5,0 1,1 1)),TRIANGLE((1 0,0.5 0.5,1 1,1 0)),TRIANGLE((0.5 0.5,0 0,0 1,0.5 0.5)))" ); + std::unique_ptr p2 = io::readWkt( "TRIANGLE((1 0, 0 0,0.5 0.5,1 0))" ); std::cout << "p1 covers p2 ? " << algorithm::coversPoints3D( *p1, *p2 ) << std::endl; std::cout << "p2 covers p1 ? " << algorithm::coversPoints3D( *p2, *p1 ) << std::endl; } diff --git a/test/unit/SFCGAL/algorithm/CoversTest.cpp b/test/unit/SFCGAL/algorithm/CoversTest.cpp index 080c091e..279e682a 100644 --- a/test/unit/SFCGAL/algorithm/CoversTest.cpp +++ b/test/unit/SFCGAL/algorithm/CoversTest.cpp @@ -104,8 +104,8 @@ BOOST_AUTO_TEST_CASE( testFileCoversTest ) bool expected = ( trueOrFalse == "true" ) ? true : false ; - std::auto_ptr< Geometry > gA( io::readWkt( wktGA ) ); - std::auto_ptr< Geometry > gB( io::readWkt( wktGB ) ); + std::unique_ptr< Geometry > gA( io::readWkt( wktGA ) ); + std::unique_ptr< Geometry > gB( io::readWkt( wktGB ) ); try { if ( distanceDimension == "2" ) { diff --git a/test/unit/SFCGAL/algorithm/DifferenceTest.cpp b/test/unit/SFCGAL/algorithm/DifferenceTest.cpp index e095ccb1..b7b88966 100644 --- a/test/unit/SFCGAL/algorithm/DifferenceTest.cpp +++ b/test/unit/SFCGAL/algorithm/DifferenceTest.cpp @@ -48,8 +48,8 @@ BOOST_AUTO_TEST_CASE( testDifferenceXPoint ) std::vector typeNames; for ( size_t i = 0; i < typeNames.size(); ++i ) { - std::auto_ptr newGeo( tools::Registry::instance().newGeometryByTypeName( typeNames[i] ) ); - std::auto_ptr diffGeo = algorithm::difference( *newGeo, Point( 0, 0 ) ); + std::unique_ptr newGeo( tools::Registry::instance().newGeometryByTypeName( typeNames[i] ) ); + std::unique_ptr diffGeo = algorithm::difference( *newGeo, Point( 0, 0 ) ); BOOST_CHECK( *newGeo == *diffGeo ); } } @@ -63,51 +63,51 @@ BOOST_AUTO_TEST_CASE( testDifferenceXLineString ) // two linestrings with two segments overlapping { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); - std::auto_ptr ls2 = io::readWkt( "LINESTRING(0.5 0,0.7 0)" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); + std::unique_ptr ls2 = io::readWkt( "LINESTRING(0.5 0,0.7 0)" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "MULTILINESTRING((0 0,0.5 0),(0.7 0,1 0))" ) ); } // two linestrings with two opposite segments overlapping { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); - std::auto_ptr ls2 = io::readWkt( "LINESTRING(0.7 0,0.5 0)" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); + std::unique_ptr ls2 = io::readWkt( "LINESTRING(0.7 0,0.5 0)" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "MULTILINESTRING((0 0,0.5 0),(0.7 0,1 0))" ) ); } // two linestrings with two segments crossing { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(-1 0,1 0)" ); - std::auto_ptr ls2 = io::readWkt( "LINESTRING(0 -1,0 1)" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "LINESTRING(-1 0,1 0)" ); + std::unique_ptr ls2 = io::readWkt( "LINESTRING(0 -1,0 1)" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *ls1 ); } // two linestrings with two segments partly overlapping { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); - std::auto_ptr ls2 = io::readWkt( "LINESTRING(-1 0,0.7 0)" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); + std::unique_ptr ls2 = io::readWkt( "LINESTRING(-1 0,0.7 0)" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "LINESTRING(0.7 0,1 0)" ) ); } // two linestrings with a segment covering another one { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); - std::auto_ptr ls2 = io::readWkt( "LINESTRING(-1 0,2 0)" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); + std::unique_ptr ls2 = io::readWkt( "LINESTRING(-1 0,2 0)" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( diff->isEmpty() ); } // two linestrings that do not intersect { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); - std::auto_ptr ls2 = io::readWkt( "LINESTRING(0 1,1 1)" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0)" ); + std::unique_ptr ls2 = io::readWkt( "LINESTRING(0 1,1 1)" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *ls1 ); } // two linestrings with more than one segment { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0,1 1)" ); - std::auto_ptr ls2 = io::readWkt( "LINESTRING(0.3 0,1 0,1 0.4)" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "LINESTRING(0 0,1 0,1 1)" ); + std::unique_ptr ls2 = io::readWkt( "LINESTRING(0.3 0,1 0,1 0.4)" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "MULTILINESTRING((0 0,0.3 0),(1 0.4,1 1))" ) ); } @@ -116,10 +116,10 @@ BOOST_AUTO_TEST_CASE( testDifferenceXLineString ) std::vector typeNames; for ( size_t i = 0; i < typeNames.size(); ++i ) { - std::auto_ptr newGeo( tools::Registry::instance().newGeometryByTypeName( typeNames[i] ) ); + std::unique_ptr newGeo( tools::Registry::instance().newGeometryByTypeName( typeNames[i] ) ); if ( newGeo->dimension() > 1 ) { - std::auto_ptr diffGeo = algorithm::difference( *newGeo, Point( 0, 0 ) ); + std::unique_ptr diffGeo = algorithm::difference( *newGeo, Point( 0, 0 ) ); BOOST_CHECK( *newGeo == *diffGeo ); } } @@ -129,26 +129,26 @@ BOOST_AUTO_TEST_CASE( testDifferencePolygonPolygon2D ) { // two identical polygons { - std::auto_ptr ls1 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); - std::auto_ptr ls2 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); + std::unique_ptr ls2 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "GEOMETRYCOLLECTION EMPTY" ) ); } // two polygons, one of wich is invalid for CGAL but valid for SFS { - std::auto_ptr ls1 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); - std::auto_ptr ls2 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0.5 0.5,1 -0.5,-0.5 -0.5))" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); + std::unique_ptr ls2 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0.5 0.5,1 -0.5,-0.5 -0.5))" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "POLYGON((-0.5 -0.5,1 -0.5,0.5 0.5,-0.5 0.5,-0.5 -0.5))" ) ); BOOST_CHECK( algorithm::isValid( *diff ) ); } // two polygons the result has a hole touching the outer boundary { - std::auto_ptr ls1 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); - std::auto_ptr ls2 = io::readWkt( "POLYGON((-0.5 -0.5,1 -0.5,0.5 0.5,-0.5 0.5,-0.5 -0.5))" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); + std::unique_ptr ls2 = io::readWkt( "POLYGON((-0.5 -0.5,1 -0.5,0.5 0.5,-0.5 0.5,-0.5 -0.5))" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( algorithm::isValid( *diff ) ); BOOST_CHECK( *diff == *io::readWkt( "POLYGON((-1 -1,1 -1,1 -0.5,1 1,-1 1,-1 -1),(1 -0.5,-0.5 -0.5,-0.5 0.5,0.5 0.5,1 -0.5))" ) ); } @@ -159,40 +159,40 @@ BOOST_AUTO_TEST_CASE( testDifferenceVolumeVolume ) // two cubes { - std::auto_ptr ls1 = io::readWkt( + std::unique_ptr ls1 = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),\ ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))))" ); - std::auto_ptr ls2 = io::readWkt( + std::unique_ptr ls2 = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),\ ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "GEOMETRYCOLLECTION EMPTY" ) ); } // two cubes { - std::auto_ptr ls1 = io::readWkt( + std::unique_ptr ls1 = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),\ ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))))" ); - std::auto_ptr ls2 = io::readWkt( + std::unique_ptr ls2 = io::readWkt( "SOLID((((0 0 0.5, 0 1 0.5, 1 1 0.5, 1 0 0.5, 0 0 0.5)),\ ((0 0 0.5, 0 0 1, 0 1 1, 0 1 0.5, 0 0 0.5)),\ ((0 0 0.5, 1 0 0.5, 1 0 1, 0 0 1, 0 0 0.5)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ ((1 1 1, 1 0 1, 1 0 0.5, 1 1 0.5, 1 1 1)),\ ((1 1 1, 1 1 0.5, 0 1 0.5, 0 1 1, 1 1 1))))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( algorithm::volume( *diff ) == Kernel::FT( 0.5 ) ); } @@ -204,17 +204,17 @@ BOOST_AUTO_TEST_CASE( testDifferenceLinePolygon ) // segment - polygon in 2D { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(-10 0,10 0)" ); - std::auto_ptr ls2 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0 0,-0.5 -0.5),(0.5 0.5,0.5 -0.5,0 0,0.5 0.5))" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "LINESTRING(-10 0,10 0)" ); + std::unique_ptr ls2 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0 0,-0.5 -0.5),(0.5 0.5,0.5 -0.5,0 0,0.5 0.5))" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "MULTILINESTRING((-10 0,-1 0),(-0.5 0,0 0,0.5 0),(1 0,10 0))" ) ); } // segment - polygon in 2D, with sement lying on hole border { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(-10 0,10 0)" ); - std::auto_ptr ls2 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0 0,-0.5 -0.5),(0.5 0,0.5 -0.5,0 0,0.5 0))" ); - std::auto_ptr diff = algorithm::difference( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "LINESTRING(-10 0,10 0)" ); + std::unique_ptr ls2 = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0 0,-0.5 -0.5),(0.5 0,0.5 -0.5,0 0,0.5 0))" ); + std::unique_ptr diff = algorithm::difference( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "MULTILINESTRING((-10 0,-1 0),(-0.5 0,0 0),(1 0,10 0))" ) ); } @@ -224,15 +224,15 @@ BOOST_AUTO_TEST_CASE( testDifferencePoinLine ) { // point - segment in 3D { - std::auto_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.6)" ); - std::auto_ptr ls2 = io::readWkt( "LINESTRING(0 0 0,1 1 1)" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.6)" ); + std::unique_ptr ls2 = io::readWkt( "LINESTRING(0 0 0,1 1 1)" ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "POINT(0.5 0.5 0.6)" ) ); } { - std::auto_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.5)" ); - std::auto_ptr ls2 = io::readWkt( "LINESTRING(0 0 0,1 1 1)" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.5)" ); + std::unique_ptr ls2 = io::readWkt( "LINESTRING(0 0 0,1 1 1)" ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "GEOMETRYCOLLECTION EMPTY" ) ); } @@ -242,15 +242,15 @@ BOOST_AUTO_TEST_CASE( testDifferencePoinPolygon2D ) { // point - triangle in 3D { - std::auto_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.6)" ); - std::auto_ptr ls2 = io::readWkt( "POLYGON((0 0 0,1 1 1,1 0 1,0 0 0))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.6)" ); + std::unique_ptr ls2 = io::readWkt( "POLYGON((0 0 0,1 1 1,1 0 1,0 0 0))" ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "POINT(0.5 0.5 0.6)" ) ); } { - std::auto_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.5)" ); - std::auto_ptr ls2 = io::readWkt( "POLYGON((0 0 0,1 1 1,1 0 1,0 0 0))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.5)" ); + std::unique_ptr ls2 = io::readWkt( "POLYGON((0 0 0,1 1 1,1 0 1,0 0 0))" ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "GEOMETRYCOLLECTION EMPTY" ) ); } } @@ -260,27 +260,27 @@ BOOST_AUTO_TEST_CASE( testDifferencePoinVolume ) // point - volume { - std::auto_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.5)" ); - std::auto_ptr ls2 = io::readWkt( + std::unique_ptr ls1 = io::readWkt( "POINT(0.5 0.5 0.5)" ); + std::unique_ptr ls2 = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),\ ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "GEOMETRYCOLLECTION EMPTY" ) ); } { - std::auto_ptr ls1 = io::readWkt( "POINT(1.001 0.5 0.5)" ); - std::auto_ptr ls2 = io::readWkt( + std::unique_ptr ls1 = io::readWkt( "POINT(1.001 0.5 0.5)" ); + std::unique_ptr ls2 = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),\ ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "POINT(1.001 0.5 0.5)" ) ); } @@ -290,23 +290,23 @@ BOOST_AUTO_TEST_CASE( testDifferenceTriangleTriangle3D ) { // triangle - trangle in 3D don't share the same plane { - std::auto_ptr ls1 = io::readWkt( "TRIANGLE((0 0 0,0 1 1,1 0 0,0 0 0))" ); - std::auto_ptr ls2 = io::readWkt( "TRIANGLE((0 0 0,0 1 1.01,1 0 0,0 0 0))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "TRIANGLE((0 0 0,0 1 1,1 0 0,0 0 0))" ); + std::unique_ptr ls2 = io::readWkt( "TRIANGLE((0 0 0,0 1 1.01,1 0 0,0 0 0))" ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "TRIANGLE((0 0 0,0 1 1,1 0 0,0 0 0))" ) ); } // triangle - trangle in 3D don't intersect { - std::auto_ptr ls1 = io::readWkt( "TRIANGLE((0 0 0,0 1 1,1 0 0,0 0 0))" ); - std::auto_ptr ls2 = io::readWkt( "TRIANGLE((.6 .6 .6,1.6 1.6 1.6,1.6 .6 .6,.6 .6 .6))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "TRIANGLE((0 0 0,0 1 1,1 0 0,0 0 0))" ); + std::unique_ptr ls2 = io::readWkt( "TRIANGLE((.6 .6 .6,1.6 1.6 1.6,1.6 .6 .6,.6 .6 .6))" ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "TRIANGLE((0 0 0,0 1 1,1 0 0,0 0 0))" ) ); } // triangle - triangle in 3D do intersect { - std::auto_ptr ls1 = io::readWkt( "TRIANGLE((0 0 0,0 1 1,1 0 0,0 0 0))" ); - std::auto_ptr ls2 = io::readWkt( "TRIANGLE((.1 .1 .1,1.6 1.6 1.6,1.6 .6 .6,.1 .1 .1))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr ls1 = io::readWkt( "TRIANGLE((0 0 0,0 1 1,1 0 0,0 0 0))" ); + std::unique_ptr ls2 = io::readWkt( "TRIANGLE((.1 .1 .1,1.6 1.6 1.6,1.6 .6 .6,.1 .1 .1))" ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "TIN(((0 1 1,.5 .5 .5,.1 .1 .1,0 1 1)),((0 0 0,0 1 1,.1 .1 .1,0 0 0)),((.7 .3 .3,1 0 0,.1 .1 .1,.7 .3 .3)),((1 0 0,0 0 0,.1 .1 .1,1 0 0)))" ) ); } @@ -316,16 +316,16 @@ BOOST_AUTO_TEST_CASE( testDifferenceTriangleVolume ) { // triangle - volume in 3D { - std::auto_ptr ls1 = io::readWkt( "TRIANGLE((0 0 .5,10 0 .5,0 10 .5,0 0 .5))" ); - std::auto_ptr ls2 = io::readWkt( + std::unique_ptr ls1 = io::readWkt( "TRIANGLE((0 0 .5,10 0 .5,0 10 .5,0 0 .5))" ); + std::unique_ptr ls2 = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),\ ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); - std::auto_ptr ref = io::readWkt( "TIN(((0/1 10/1 1/2,9/20 1/1 1/2,1/2 1/1 1/2,0/1 10/1 1/2)),((0/1 10/1 1/2,1/2 1/1 1/2,18/19 1/1 1/2,0/1 10/1 1/2)),((0/1 10/1 1/2,0/1 1/1 1/2,9/20 1/1 1/2,0/1 10/1 1/2)),((1/1 0/1 1/2,10/1 0/1 1/2,1/1 1/2 1/2,1/1 0/1 1/2)),((1/1 1/1 1/2,0/1 10/1 1/2,18/19 1/1 1/2,1/1 1/1 1/2)),((10/1 0/1 1/2,0/1 10/1 1/2,1/1 1/1 1/2,10/1 0/1 1/2)),((1/1 1/2 1/2,10/1 0/1 1/2,1/1 1/1 1/2,1/1 1/2 1/2)))" ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr ref = io::readWkt( "TIN(((0/1 10/1 1/2,9/20 1/1 1/2,1/2 1/1 1/2,0/1 10/1 1/2)),((0/1 10/1 1/2,1/2 1/1 1/2,18/19 1/1 1/2,0/1 10/1 1/2)),((0/1 10/1 1/2,0/1 1/1 1/2,9/20 1/1 1/2,0/1 10/1 1/2)),((1/1 0/1 1/2,10/1 0/1 1/2,1/1 1/2 1/2,1/1 0/1 1/2)),((1/1 1/1 1/2,0/1 10/1 1/2,18/19 1/1 1/2,1/1 1/1 1/2)),((10/1 0/1 1/2,0/1 10/1 1/2,1/1 1/1 1/2,10/1 0/1 1/2)),((1/1 1/2 1/2,10/1 0/1 1/2,1/1 1/1 1/2,1/1 1/2 1/2)))" ); BOOST_CHECK( algorithm::covers( *diff, *ref ) && algorithm::covers( *ref, *diff ) ); } } @@ -334,15 +334,15 @@ BOOST_AUTO_TEST_CASE( testDifferenceLineVolume ) { // segment - volume in 3D { - std::auto_ptr ls1 = io::readWkt( "LINESTRING(-3 -3 .5,3 3 .5,1 1.1 .5,1 .1 .5,.1 .1 .5)" ); - std::auto_ptr ls2 = io::readWkt( + std::unique_ptr ls1 = io::readWkt( "LINESTRING(-3 -3 .5,3 3 .5,1 1.1 .5,1 .1 .5,.1 .1 .5)" ); + std::unique_ptr ls2 = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),\ ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); BOOST_CHECK( *diff == *io::readWkt( "MULTILINESTRING((-3 -3 .5,0 0 .5),(1 1 .5,3 3 .5,1 1.1 .5,1 1 .5))" ) ); } @@ -353,15 +353,15 @@ BOOST_AUTO_TEST_CASE( testDifferencePolygonVolume ) // polygon - volume crashing the algo in garden { - std::auto_ptr ls1 = io::readWkt( "POLYGON((1 -1 -1,1 1 -1,1 1 1,1 -1 1,1 -1 -1))" ); - std::auto_ptr ls2 = io::readWkt( + std::unique_ptr ls1 = io::readWkt( "POLYGON((1 -1 -1,1 1 -1,1 1 1,1 -1 1,1 -1 -1))" ); + std::unique_ptr ls2 = io::readWkt( "SOLID((((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),\ ((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),\ ((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)),\ ((1 1 1,0 1 1,0 0 1,1 0 1,1 1 1)),\ ((1 1 1,1 0 1,1 0 0,1 1 0,1 1 1)),\ ((1 1 1,1 1 0,0 1 0,0 1 1,1 1 1))))" ); - std::auto_ptr diff = algorithm::difference3D( *ls1, *ls2 ); + std::unique_ptr diff = algorithm::difference3D( *ls1, *ls2 ); } } @@ -371,7 +371,7 @@ BOOST_AUTO_TEST_CASE( testDifference3DDivideByZeroCrash ) // Correct behaviour is to throw an exception about the degenerate polygon in g1. // Incorrect behaviour is a divide by zero error { - std::auto_ptr g1 = io::readWkt("SOLID((((1 1 0.5,0.5 1 0.5,0.5 1.5 0.5,1 1 0.5)),\ + std::unique_ptr g1 = io::readWkt("SOLID((((1 1 0.5,0.5 1 0.5,0.5 1.5 0.5,1 1 0.5)),\ ((0.5 1 0.5,1 1 0.5,1 1 -1,0.5 1 0.5)),\ ((0.5 1.5 0.5,0.5 1 0.5,0.5 1 1,0.5 1.5 0.5)),\ ((1 1 0.5,0.5 1.5 0.5,1.5 1.5 0.5,1 1 0.5)),\ @@ -419,7 +419,7 @@ BOOST_AUTO_TEST_CASE( testDifference3DDivideByZeroCrash ) ((1 0.5 0.5,1 0.5 1,1 -1 1,1 0.5 0.5)),\ ((0 0.5 1,1 -1 1,0.5 0.5 1,0 0.5 1)),\ ((1 0.5 1,0.5 0.5 1,1 -1 1,1 0.5 1))))"); - std::auto_ptr g2 = io::readWkt("SOLID((((-0.5 1 1,-0.5 1 -0.5,-1 1 1,-0.5 1 1)),\ + std::unique_ptr g2 = io::readWkt("SOLID((((-0.5 1 1,-0.5 1 -0.5,-1 1 1,-0.5 1 1)),\ ((-0.5 1 -0.5,-0.5 1 1,-0.5 1.5 -0.5,-0.5 1 -0.5)),\ ((-1 1 1,-0.5 1 -0.5,-1 1 -1,-1 1 1)),\ ((-0.5 1 1,-1 1 1,-0.5 0.5 1,-0.5 1 1)),\ @@ -470,7 +470,7 @@ BOOST_AUTO_TEST_CASE( testDifference3DDivideByZeroCrash ) try { - std::auto_ptr diff = algorithm::difference3D( *g1, *g2, algorithm::NoValidityCheck() ); + std::unique_ptr diff = algorithm::difference3D( *g1, *g2, algorithm::NoValidityCheck() ); } catch(...) { @@ -478,7 +478,7 @@ BOOST_AUTO_TEST_CASE( testDifference3DDivideByZeroCrash ) try { - std::auto_ptr diff = algorithm::difference3D( *g2, *g1, algorithm::NoValidityCheck() ); + std::unique_ptr diff = algorithm::difference3D( *g2, *g1, algorithm::NoValidityCheck() ); } catch(...) { diff --git a/test/unit/SFCGAL/algorithm/DistanceTest.cpp b/test/unit/SFCGAL/algorithm/DistanceTest.cpp index ea26c40e..ab6b0b7a 100644 --- a/test/unit/SFCGAL/algorithm/DistanceTest.cpp +++ b/test/unit/SFCGAL/algorithm/DistanceTest.cpp @@ -68,8 +68,8 @@ BOOST_AUTO_TEST_CASE( testDistanceBetweenEmptyGeometriesIsDefined ) for ( size_t j = 0; j < geometryTypes.size(); j++ ) { BOOST_TEST_MESSAGE( boost::format( "distance(%s,%s)" ) % geometryTypes[i] % geometryTypes[j] ); - std::auto_ptr< Geometry > gA( registry.newGeometryByTypeName( geometryTypes[i] ) ); - std::auto_ptr< Geometry > gB( registry.newGeometryByTypeName( geometryTypes[j] ) ); + std::unique_ptr< Geometry > gA( registry.newGeometryByTypeName( geometryTypes[i] ) ); + std::unique_ptr< Geometry > gB( registry.newGeometryByTypeName( geometryTypes[j] ) ); double dAB ; BOOST_CHECK_NO_THROW( dAB = gA->distance( *gB ) ) ; @@ -90,8 +90,8 @@ BOOST_AUTO_TEST_CASE( testDistance3DBetweenEmptyGeometriesIsDefined ) for ( size_t j = 0; j < geometryTypes.size(); j++ ) { BOOST_TEST_MESSAGE( boost::format( "distance3D(%s,%s)" ) % geometryTypes[i] % geometryTypes[j] ); - std::auto_ptr< Geometry > gA( registry.newGeometryByTypeName( geometryTypes[i] ) ); - std::auto_ptr< Geometry > gB( registry.newGeometryByTypeName( geometryTypes[j] ) ); + std::unique_ptr< Geometry > gA( registry.newGeometryByTypeName( geometryTypes[i] ) ); + std::unique_ptr< Geometry > gB( registry.newGeometryByTypeName( geometryTypes[j] ) ); double dAB ; BOOST_CHECK_NO_THROW( dAB = gA->distance3D( *gB ) ) ; @@ -164,57 +164,57 @@ BOOST_AUTO_TEST_CASE( testDistancePointLineString_pointOutOfLineString ) //testPointPolygon BOOST_AUTO_TEST_CASE( testDistancePointPolygon_pointInPolygon ) { - std::auto_ptr< Geometry > gA( io::readWkt( "POINT(0.5 0.5)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,0.0 1.0,0.0 0.0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "POINT(0.5 0.5)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,0.0 1.0,0.0 0.0))" ) ); BOOST_CHECK_EQUAL( gA->distance( *gB ), 0.0 ); } BOOST_AUTO_TEST_CASE( testDistancePointPolygon_pointOutOfPolygon ) { - std::auto_ptr< Geometry > gA( io::readWkt( "POINT(0.0 1.0)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((0.0 0.0,2.0 2.0,2.0 0.0,0.0 0.0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "POINT(0.0 1.0)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((0.0 0.0,2.0 2.0,2.0 0.0,0.0 0.0))" ) ); BOOST_CHECK_EQUAL( gA->distance( *gB ), sqrt( 2.0 )/2.0 ); } // LineString / LineString 2D BOOST_AUTO_TEST_CASE( testDistanceLineStringLineString_zeroLengthSegments ) { - std::auto_ptr< Geometry > gA( io::readWkt( "LINESTRING(0.0 0.0,-1.0 -1.0)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "LINESTRING(3.0 4.0,4.0 5.0)" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "LINESTRING(0.0 0.0,-1.0 -1.0)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "LINESTRING(3.0 4.0,4.0 5.0)" ) ); BOOST_CHECK_EQUAL( gA->distance( *gB ), 5.0 ); } // LineString / LineString 3D BOOST_AUTO_TEST_CASE( testDistanceLineStringLineString3D_zeroLengthSegments ) { - std::auto_ptr< Geometry > gA( io::readWkt( "LINESTRING(0.0 0.0 0.0,-1.0 -1.0 -1.0)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "LINESTRING(0.0 3.0 4.0,0.0 4.0 5.0)" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "LINESTRING(0.0 0.0 0.0,-1.0 -1.0 -1.0)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "LINESTRING(0.0 3.0 4.0,0.0 4.0 5.0)" ) ); BOOST_CHECK_EQUAL( gA->distance3D( *gB ), 5.0 ); } // LineString / Triangle BOOST_AUTO_TEST_CASE( testDistance3DLineStringTriangle_lineStringInTriangle ) { - std::auto_ptr< Geometry > gA( io::readWkt( "LINESTRING(-1.0 0.0 1.0,1.0 0.0 1.0)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "TRIANGLE((-4.0 0.0 1.0,4.0 0.0 1.0,0.0 4.0 1.0,-4.0 0.0 1.0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "LINESTRING(-1.0 0.0 1.0,1.0 0.0 1.0)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "TRIANGLE((-4.0 0.0 1.0,4.0 0.0 1.0,0.0 4.0 1.0,-4.0 0.0 1.0))" ) ); BOOST_CHECK_EQUAL( gA->distance3D( *gB ), 0.0 ); } BOOST_AUTO_TEST_CASE( testDistance3DLineStringTriangle_lineStringStartPointIsNearest ) { - std::auto_ptr< Geometry > gA( io::readWkt( "LINESTRING(-1.0 0.0 2.0,1.0 0.0 3.0)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "TRIANGLE((-4.0 0.0 1.0,4.0 0.0 1.0,0.0 4.0 1.0,-4.0 0.0 1.0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "LINESTRING(-1.0 0.0 2.0,1.0 0.0 3.0)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "TRIANGLE((-4.0 0.0 1.0,4.0 0.0 1.0,0.0 4.0 1.0,-4.0 0.0 1.0))" ) ); BOOST_CHECK_EQUAL( gA->distance3D( *gB ), 1.0 ); } // Triangle / Triangle BOOST_AUTO_TEST_CASE( testDistance3DTriangleTriangle_contained ) { - std::auto_ptr< Geometry > gA( io::readWkt( "TRIANGLE((-3.0 0.0 1.0,3.0 0.0 1.0,0.0 3.0 1.0,-3.0 0.0 1.0))" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "TRIANGLE((-4.0 0.0 1.0,4.0 0.0 1.0,0.0 4.0 1.0,-4.0 0.0 1.0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "TRIANGLE((-3.0 0.0 1.0,3.0 0.0 1.0,0.0 3.0 1.0,-3.0 0.0 1.0))" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "TRIANGLE((-4.0 0.0 1.0,4.0 0.0 1.0,0.0 4.0 1.0,-4.0 0.0 1.0))" ) ); BOOST_CHECK_EQUAL( gA->distance3D( *gB ), 0.0 ); } BOOST_AUTO_TEST_CASE( testDistance3DTriangleTriangle_parallel ) { - std::auto_ptr< Geometry > gA( io::readWkt( "TRIANGLE((-3.0 0.0 1.0,3.0 0.0 1.0,0.0 3.0 1.0,-3.0 0.0 1.0))" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "TRIANGLE((-4.0 0.0 2.0,4.0 0.0 2.0,0.0 4.0 2.0,-4.0 0.0 2.0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "TRIANGLE((-3.0 0.0 1.0,3.0 0.0 1.0,0.0 3.0 1.0,-3.0 0.0 1.0))" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "TRIANGLE((-4.0 0.0 2.0,4.0 0.0 2.0,0.0 4.0 2.0,-4.0 0.0 2.0))" ) ); BOOST_CHECK_EQUAL( gA->distance3D( *gB ), 1.0 ); } @@ -222,23 +222,23 @@ BOOST_AUTO_TEST_CASE( testDistance3DTriangleTriangle_parallel ) BOOST_AUTO_TEST_CASE( testDistancePolygonPolygon_disjoint ) { - std::auto_ptr< Geometry > gA( io::readWkt( "POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,0.0 1.0,0.0 0.0))" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((2.0 0.0,3.0 0.0,3.0 1.0,2.0 1.0,2.0 0.0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,0.0 1.0,0.0 0.0))" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((2.0 0.0,3.0 0.0,3.0 1.0,2.0 1.0,2.0 0.0))" ) ); BOOST_CHECK_EQUAL( gA->distance( *gB ), 1.0 ); } BOOST_AUTO_TEST_CASE( testDistanceMultiPointMultiPoint_disjoint ) { - std::auto_ptr< Geometry > gA( io::readWkt( "MULTIPOINT((0.0 0.0),(1.0 0.0),(1.0 1.0),(0.0 1.0))" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "MULTIPOINT((8.0 8.0),(4.0 5.0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "MULTIPOINT((0.0 0.0),(1.0 0.0),(1.0 1.0),(0.0 1.0))" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "MULTIPOINT((8.0 8.0),(4.0 5.0))" ) ); BOOST_CHECK_EQUAL( gA->distance( *gB ), 5.0 ); } // Polygon / Solid BOOST_AUTO_TEST_CASE( testDistancePolygonSolid ) { - std::auto_ptr< Geometry > gA( io::readWkt( "POLYGON((1 -1 -1,1 1 -1,1 1 1,1 -1 1,1 -1 -1))" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "SOLID((((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)),((1 1 1,0 1 1,0 0 1,1 0 1,1 1 1)),((1 1 1,1 0 1,1 0 0,1 1 0,1 1 1)),((1 1 1,1 1 0,0 1 0,0 1 1,1 1 1))))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "POLYGON((1 -1 -1,1 1 -1,1 1 1,1 -1 1,1 -1 -1))" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "SOLID((((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)),((1 1 1,0 1 1,0 0 1,1 0 1,1 1 1)),((1 1 1,1 0 1,1 0 0,1 1 0,1 1 1)),((1 1 1,1 1 0,0 1 0,0 1 1,1 1 1))))" ) ); BOOST_CHECK_EQUAL( gA->distance3D( *gB ), 0 ); } diff --git a/test/unit/SFCGAL/algorithm/ExtrudeTest.cpp b/test/unit/SFCGAL/algorithm/ExtrudeTest.cpp index f5740772..813641a8 100644 --- a/test/unit/SFCGAL/algorithm/ExtrudeTest.cpp +++ b/test/unit/SFCGAL/algorithm/ExtrudeTest.cpp @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_algorithm_ExtrudeTest ) BOOST_AUTO_TEST_CASE( testExtrudePoint ) { Point g( 0.0,0.0,0.0 ); - std::auto_ptr< Geometry > ext( algorithm::extrude( g, 0.0, 0.0, 1.0 ) ); + std::unique_ptr< Geometry > ext( algorithm::extrude( g, 0.0, 0.0, 1.0 ) ); BOOST_CHECK( ext->is< LineString >() ); BOOST_CHECK( ext->as< LineString >().is3D() ); BOOST_CHECK_EQUAL( ext->asText( 1 ), "LINESTRING(0.0 0.0 0.0,0.0 0.0 1.0)" ); @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE( testExtrudeLineString ) Point( 0.0,0.0,0.0 ), Point( 1.0,0.0,0.0 ) ); - std::auto_ptr< Geometry > ext( algorithm::extrude( g, 0.0, 0.0, 1.0 ) ); + std::unique_ptr< Geometry > ext( algorithm::extrude( g, 0.0, 0.0, 1.0 ) ); BOOST_CHECK( ext->is< PolyhedralSurface >() ); BOOST_CHECK( ext->as< PolyhedralSurface >().is3D() ); BOOST_CHECK_EQUAL( ext->asText( 1 ), "POLYHEDRALSURFACE(((0.0 0.0 0.0,1.0 0.0 0.0,1.0 0.0 1.0,0.0 0.0 1.0,0.0 0.0 0.0)))" ); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE( testExtrudeSquare ) LineString exteriorRing( points ) ; Polygon g( exteriorRing ); - std::auto_ptr< Geometry > ext( algorithm::extrude( g, 0.0, 0.0, 1.0 ) ); + std::unique_ptr< Geometry > ext( algorithm::extrude( g, 0.0, 0.0, 1.0 ) ); BOOST_CHECK( ext->is< Solid >() ); BOOST_CHECK_EQUAL( ext->as< Solid >().numShells(), 1U ); BOOST_CHECK_EQUAL( ext->as< Solid >().exteriorShell().numPolygons(), 6U ); @@ -87,9 +87,9 @@ BOOST_AUTO_TEST_CASE( testExtrudeSquare ) BOOST_AUTO_TEST_CASE( testExtrudePolyhedral ) { - std::auto_ptr g = io::readWkt( "POLYHEDRALSURFACE(((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)))" ); + std::unique_ptr g = io::readWkt( "POLYHEDRALSURFACE(((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)))" ); - std::auto_ptr< Geometry > ext = algorithm::extrude( *g, 0.0, 0.0, 1.0 ); + std::unique_ptr< Geometry > ext = algorithm::extrude( *g, 0.0, 0.0, 1.0 ); BOOST_CHECK( ext->is< Solid >() ); BOOST_CHECK_EQUAL( ext->as< Solid >().numShells(), 1U ); } @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE( testExtrudeMultiPolygon ) mp.addGeometry( g1 ); mp.addGeometry( g2 ); - std::auto_ptr< Geometry > ext( algorithm::extrude( mp, 0.0, 0.0, 1.0 ) ); + std::unique_ptr< Geometry > ext( algorithm::extrude( mp, 0.0, 0.0, 1.0 ) ); BOOST_CHECK( ext->is< MultiSolid >() ); BOOST_CHECK_EQUAL( ext->as().numGeometries(), 2U ); } @@ -150,7 +150,7 @@ BOOST_AUTO_TEST_CASE( testExtrudeSquareWithHole ) } Polygon g( rings ); - std::auto_ptr< Geometry > ext( algorithm::extrude( g, 0.0, 0.0, 1.0 ) ); + std::unique_ptr< Geometry > ext( algorithm::extrude( g, 0.0, 0.0, 1.0 ) ); BOOST_CHECK( ext->is< Solid >() ); BOOST_CHECK_EQUAL( ext->as< Solid >().numShells(), 1U ); BOOST_CHECK_EQUAL( ext->as< Solid >().exteriorShell().numPolygons(), 10U ); @@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE( testExtrudeSquareWithHole ) //SELECT ST_AsText(ST_Extrude(ST_Extrude(ST_Extrude('POINT(0 0)', 1, 0, 0), 0, 1, 0), 0, 0, 1)); BOOST_AUTO_TEST_CASE( testChainingExtrude ) { - std::auto_ptr< Geometry > g( new Point( 0.0,0.0 ) ); + std::unique_ptr< Geometry > g( new Point( 0.0,0.0 ) ); g = algorithm::extrude( *g, 1.0, 0.0, 0.0 ) ; BOOST_CHECK_EQUAL( g->asText( 0 ), "LINESTRING(0 0 0,1 0 0)" ) ; g = algorithm::extrude( *g, 0.0, 1.0, 0.0 ) ; diff --git a/test/unit/SFCGAL/algorithm/Force3DTest.cpp b/test/unit/SFCGAL/algorithm/Force3DTest.cpp index e60d2e8e..94fd5e37 100644 --- a/test/unit/SFCGAL/algorithm/Force3DTest.cpp +++ b/test/unit/SFCGAL/algorithm/Force3DTest.cpp @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE( testIgnoreEmpty ) for ( size_t i = 0; i < typeNames.size(); i++ ) { BOOST_TEST_MESSAGE( typeNames[i] ) ; - std::auto_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; + std::unique_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; BOOST_REQUIRE( g.get() != NULL ) ; algorithm::force3D( *g ) ; BOOST_CHECK( g->isEmpty() ) ; diff --git a/test/unit/SFCGAL/algorithm/IntersectionTest.cpp b/test/unit/SFCGAL/algorithm/IntersectionTest.cpp index ca93d13e..4f535787 100644 --- a/test/unit/SFCGAL/algorithm/IntersectionTest.cpp +++ b/test/unit/SFCGAL/algorithm/IntersectionTest.cpp @@ -145,9 +145,9 @@ BOOST_AUTO_TEST_CASE( testFileIntersectionTest ) } } - std::auto_ptr< Geometry > gA( 0 ); - std::auto_ptr< Geometry > gB( 0 ); - std::auto_ptr< Geometry > gOut( 0 ); + std::unique_ptr< Geometry > gA; + std::unique_ptr< Geometry > gB; + std::unique_ptr< Geometry > gOut; std::getline( iss, wktGA, '|' ) ; @@ -219,11 +219,11 @@ BOOST_AUTO_TEST_CASE( testFileIntersectionTest ) try { if ( dimension == "2" ) { - std::auto_ptr result = algorithm::intersection( *gA,*gB ); + std::unique_ptr result = algorithm::intersection( *gA,*gB ); BOOST_CHECK_MESSAGE( *result == *gOut, numLine << ": intersection(" << gA->asText() << ", " << gB->asText() << ") is " << result->asText() << " and should be " << gOut->asText() ); } else if ( dimension == "3" ) { - std::auto_ptr result = algorithm::intersection3D( *gA,*gB ); + std::unique_ptr result = algorithm::intersection3D( *gA,*gB ); BOOST_CHECK_MESSAGE( *result == *gOut, numLine << ": intersection3D(" << gA->asText() << ", " << gB->asText() << ") is " << result->asText() << " and should be " << gOut->asText() ); } else { diff --git a/test/unit/SFCGAL/algorithm/IntersectsTest.cpp b/test/unit/SFCGAL/algorithm/IntersectsTest.cpp index 8687da2f..8840a416 100644 --- a/test/unit/SFCGAL/algorithm/IntersectsTest.cpp +++ b/test/unit/SFCGAL/algorithm/IntersectsTest.cpp @@ -85,8 +85,8 @@ BOOST_AUTO_TEST_CASE( testFileIntersectsTest ) bool expected = ( trueOrFalse == "true" ) ? true : false ; - std::auto_ptr< Geometry > gA( io::readWkt( wktGA ) ); - std::auto_ptr< Geometry > gB( io::readWkt( wktGB ) ); + std::unique_ptr< Geometry > gA( io::readWkt( wktGA ) ); + std::unique_ptr< Geometry > gB( io::readWkt( wktGB ) ); try { if ( distanceDimension == "2" ) { diff --git a/test/unit/SFCGAL/algorithm/IsValidTest.cpp b/test/unit/SFCGAL/algorithm/IsValidTest.cpp index 060594b3..a64cc703 100644 --- a/test/unit/SFCGAL/algorithm/IsValidTest.cpp +++ b/test/unit/SFCGAL/algorithm/IsValidTest.cpp @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE( geometryIsValid ) for ( std::size_t t=0; t g; + std::unique_ptr< Geometry > g; try { g = io::readWkt( tg.wkt ); @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE( geometryWithNan ) BOOST_AUTO_TEST_CASE( disconnectedTIN ) { - std::auto_ptr< Geometry > g( io::readWkt( "TIN(((0 0,1 0,0 1,0 0)),((2 0,3 0,2 1,2 0)))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "TIN(((0 0,1 0,0 1,0 0)),((2 0,3 0,2 1,2 0)))" ) ); Validity v = algorithm::isValid( *g ); BOOST_CHECK( !v ); } diff --git a/test/unit/SFCGAL/algorithm/MinkowskiSumTest.cpp b/test/unit/SFCGAL/algorithm/MinkowskiSumTest.cpp index e47306b9..6912ae2e 100644 --- a/test/unit/SFCGAL/algorithm/MinkowskiSumTest.cpp +++ b/test/unit/SFCGAL/algorithm/MinkowskiSumTest.cpp @@ -45,40 +45,40 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_algorithm_MinkowskiTest ) BOOST_AUTO_TEST_CASE( testEmpty ) { - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); tools::Registry& registry = tools::Registry::instance() ; std::vector< std::string > typeNames = tools::Registry::instance().getGeometryTypes(); for ( size_t i = 0; i < typeNames.size(); i++ ) { - std::auto_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; + std::unique_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; BOOST_CHECK( algorithm::minkowskiSum( *g, gB->as< Polygon >() )->isEmpty() ); } } BOOST_AUTO_TEST_CASE( testEmptyPoint ) { - std::auto_ptr< Geometry > gA( io::readWkt( "MULTIPOINT EMPTY" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "MULTIPOINT EMPTY" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); - std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); + std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); BOOST_CHECK_EQUAL( sum->asText( 0 ), "MULTIPOLYGON EMPTY" ); } BOOST_AUTO_TEST_CASE( testPoint ) { - std::auto_ptr< Geometry > gA( io::readWkt( "POINT(0 0)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "POINT(0 0)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); - std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); + std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); BOOST_CHECK_EQUAL( sum->asText( 0 ), "MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)))" ); } BOOST_AUTO_TEST_CASE( testLineString ) { - std::auto_ptr< Geometry > gA( io::readWkt( "LINESTRING(0 0,5 0)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "LINESTRING(0 0,5 0)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); - std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); + std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); BOOST_CHECK_EQUAL( sum->asText( 0 ), "MULTIPOLYGON(((5 1,0 1,-1 0,0 -1,5 -1,6 0,5 1)))" ); } /* @@ -86,10 +86,10 @@ BOOST_AUTO_TEST_CASE( testLineString ) */ BOOST_AUTO_TEST_CASE( testLineString2 ) { - std::auto_ptr< Geometry > gA( io::readWkt( "LINESTRING(0 0,5 0)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((0 0,1 -1,2 0,1 1,0 0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "LINESTRING(0 0,5 0)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((0 0,1 -1,2 0,1 1,0 0))" ) ); - std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); + std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); BOOST_CHECK_EQUAL( sum->asText( 0 ), "MULTIPOLYGON(((6 1,1 1,0 0,1 -1,6 -1,7 0,6 1)))" ); } @@ -97,21 +97,21 @@ BOOST_AUTO_TEST_CASE( testLineString2 ) BOOST_AUTO_TEST_CASE( testLineString3 ) { - std::auto_ptr< Geometry > gA( io::readWkt( "LINESTRING(5 5,0 5,5 0,0 0)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "LINESTRING(5 5,0 5,5 0,0 0)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); - std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); + std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); BOOST_CHECK_EQUAL( sum->asText( 0 ), "MULTIPOLYGON(((5 1,2 4,5 4,6 5,5 6,0 6,-1 5,0 4,3 1,0 1,-1 0,0 -1,5 -1,6 0,5 1)))" ); } BOOST_AUTO_TEST_CASE( testPolygonWithHole ) { std::string wkt = "POLYGON((11.966308 -10.211022,18.007885 1.872133,39.364158 2.434140,53.554839 -6.557975,43.438710 -22.856183,20.396416 -28.476254,5.643728 -25.525717,13.090323 -20.889158,32.479570 -21.310663,38.521147 -15.831093,46.248746 -9.087007,34.446595 -1.359409,22.784946 -14.988082,11.966308 -10.211022),(20.396416 -1.640412,15.900358 -7.260484,18.007885 -9.508513,22.644444 -9.368011,25.173477 -2.342921,20.396416 -1.640412),(41.050179 -0.797401,40.207168 -2.202419,47.934767 -6.557975,48.496774 -5.433961,41.050179 -0.797401))" ; - std::auto_ptr< Geometry > gA( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > gA( io::readWkt( wkt ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); - std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); + std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); BOOST_CHECK_EQUAL( sum->asText( 6 ), "MULTIPOLYGON(((53.554839 -5.557975,39.364158 3.434140,18.007885 2.872133,17.007885 1.872133,10.966308 -10.211022,11.966308 -11.211022,22.784946 -15.988082,23.784946 -14.988082,34.539099 -2.419977,44.939408 -9.229702,38.521147 -14.831093,32.479570 -20.310663,13.090323 -19.889158,5.643728 -24.525717,4.643728 -25.525717,5.643728 -26.525717,20.396416 -29.476254,43.438710 -23.856183,44.438710 -22.856183,54.554839 -6.557975,53.554839 -5.557975),(23.881857 -3.152977,21.997385 -8.387619,18.068659 -8.506671,16.900358 -7.260484,20.575363 -2.666728,23.881857 -3.152977)))" ); // reverse orientation @@ -122,10 +122,10 @@ BOOST_AUTO_TEST_CASE( testPolygonWithHole ) BOOST_AUTO_TEST_CASE( testMultiPoint ) { - std::auto_ptr< Geometry > gA( io::readWkt( "MULTIPOINT(0 0,5 5)" ) ); - std::auto_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "MULTIPOINT(0 0,5 5)" ) ); + std::unique_ptr< Geometry > gB( io::readWkt( "POLYGON((-1 0,0 -1,1 0,0 1,-1 0))" ) ); - std::auto_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); + std::unique_ptr< Geometry > sum( algorithm::minkowskiSum( *gA, gB->as< Polygon >() ) ); BOOST_CHECK_EQUAL( sum->asText( 0 ), "MULTIPOLYGON(((0 1,-1 0,0 -1,1 0,0 1)),((5 6,4 5,5 4,6 5,5 6)))" ); } diff --git a/test/unit/SFCGAL/algorithm/NormalTest.cpp b/test/unit/SFCGAL/algorithm/NormalTest.cpp index 663918a3..b72f68e8 100644 --- a/test/unit/SFCGAL/algorithm/NormalTest.cpp +++ b/test/unit/SFCGAL/algorithm/NormalTest.cpp @@ -58,12 +58,12 @@ BOOST_AUTO_TEST_CASE( testNormal1 ) BOOST_AUTO_TEST_CASE( testNormal2 ) { // a square ccw - std::auto_ptr gA( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); + std::unique_ptr gA( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); // a square cw oriented - std::auto_ptr gB( io::readWkt( "POLYGON((0 0,0 1,1 1,1 0,0 0))" ) ); + std::unique_ptr gB( io::readWkt( "POLYGON((0 0,0 1,1 1,1 0,0 0))" ) ); // a pseudo-square ccw oriented, with a concave part - std::auto_ptr gC( io::readWkt( "POLYGON((0 0,0.5 0.5,1 0,1 1,0 1,0 0))" ) ); + std::unique_ptr gC( io::readWkt( "POLYGON((0 0,0.5 0.5,1 0,1 1,0 1,0 0))" ) ); { CGAL::Vector_3 normal = algorithm::normal3D( gA->as() ); @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE( testNormal2 ) BOOST_AUTO_TEST_CASE( testNormal3 ) { - std::auto_ptr gA( io::readWkt( "POLYGON((0 1 0,0 1 1,1 1 1,1 1 0,0 1 0))" ) ); + std::unique_ptr gA( io::readWkt( "POLYGON((0 1 0,0 1 1,1 1 1,1 1 0,0 1 0))" ) ); // exact { CGAL::Vector_3 normal = algorithm::normal3D( gA->as(), true ); diff --git a/test/unit/SFCGAL/algorithm/OffsetTest.cpp b/test/unit/SFCGAL/algorithm/OffsetTest.cpp index 7d9aff5e..7fc5ece9 100644 --- a/test/unit/SFCGAL/algorithm/OffsetTest.cpp +++ b/test/unit/SFCGAL/algorithm/OffsetTest.cpp @@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE( testEmpty ) std::vector< std::string > typeNames = tools::Registry::instance().getGeometryTypes(); for ( size_t i = 0; i < typeNames.size(); i++ ) { - std::auto_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; + std::unique_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; BOOST_CHECK( algorithm::offset( *g, 1.0 )->isEmpty() ); } } @@ -58,17 +58,17 @@ BOOST_AUTO_TEST_CASE( testEmpty ) BOOST_AUTO_TEST_CASE( testSimple ) { - std::auto_ptr< Geometry > gA( io::readWkt( "POLYGON((0 0,10 0,10 10,0 10,0 0))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "POLYGON((0 0,10 0,10 10,0 10,0 0))" ) ); - std::auto_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; + std::unique_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; BOOST_CHECK_EQUAL( result->asText( 7 ), "MULTIPOLYGON(((-1.0000000 10.0000000,-1.0000000 0.0000000,-0.8750000 -0.4841229,-0.7500000 -0.6614378,-0.6250000 -0.7806247,-0.5000000 -0.8660254,-0.3750000 -0.9270248,-0.2500000 -0.9682458,-0.1250000 -0.9921567,0.0000000 -1.0000000,10.0000000 -1.0000000,10.1250000 -0.9921567,10.2500000 -0.9682458,10.3750000 -0.9270248,10.5000000 -0.8660254,10.6250000 -0.7806247,10.7500000 -0.6614378,10.8750000 -0.4841229,11.0000000 0.0000000,11.0000000 10.0000000,10.8750000 10.4841229,10.7500000 10.6614378,10.6250000 10.7806247,10.5000000 10.8660254,10.3750000 10.9270248,10.2500000 10.9682458,10.1250000 10.9921567,10.0000000 11.0000000,0.0000000 11.0000000,-0.1250000 10.9921567,-0.2500000 10.9682458,-0.3750000 10.9270248,-0.5000000 10.8660254,-0.6250000 10.7806247,-0.7500000 10.6614378,-0.8750000 10.4841229,-1.0000000 10.0000000)))" ) ; } BOOST_AUTO_TEST_CASE( testHoles ) { - std::auto_ptr< Geometry > gA( io::readWkt( "POLYGON((13.652901 8.978070,13.921068 13.219992,20.454603 13.268750,18.967492 11.001516,16.432091 11.220926,15.091253 13.024961,14.481782 11.976670,14.676813 10.708970,15.798240 9.392511,16.358954 9.416890,16.870910 10.075119,16.797774 10.952758,17.431624 11.001516,18.162990 10.099498,18.138611 8.368599,14.774328 9.416890,14.530540 8.929313,13.945447 8.441735,13.652901 8.978070))" ) ); + std::unique_ptr< Geometry > gA( io::readWkt( "POLYGON((13.652901 8.978070,13.921068 13.219992,20.454603 13.268750,18.967492 11.001516,16.432091 11.220926,15.091253 13.024961,14.481782 11.976670,14.676813 10.708970,15.798240 9.392511,16.358954 9.416890,16.870910 10.075119,16.797774 10.952758,17.431624 11.001516,18.162990 10.099498,18.138611 8.368599,14.774328 9.416890,14.530540 8.929313,13.945447 8.441735,13.652901 8.978070))" ) ); - std::auto_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; + std::unique_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; BOOST_REQUIRE( result->is< MultiPolygon >() ); // @todo works in Release, not in Debug... Something strange with holes? @@ -80,16 +80,16 @@ BOOST_AUTO_TEST_CASE( testHoles ) BOOST_AUTO_TEST_CASE( testPoint ) { - std::auto_ptr< Geometry > gA( io::readWkt( "POINT(1 1)" ) ); - std::auto_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; + std::unique_ptr< Geometry > gA( io::readWkt( "POINT(1 1)" ) ); + std::unique_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; BOOST_CHECK_EQUAL( result->asText( 2 ), "MULTIPOLYGON(((2.00 1.00,1.75 1.66,1.50 1.87,1.25 1.97,1.00 2.00,0.75 1.97,0.50 1.87,0.25 1.66,0.00 1.00,0.25 0.34,0.50 0.13,0.75 0.03,1.00 0.00,1.25 0.03,1.50 0.13,1.75 0.34,2.00 1.00)))" ); } BOOST_AUTO_TEST_CASE( testLineString ) { - std::auto_ptr< Geometry > gA( io::readWkt( "LINESTRING(13.652901 8.978070,13.921068 13.219992,20.454603 13.268750,18.967492 11.001516,16.432091 11.220926,15.091253 13.024961,14.481782 11.976670,14.676813 10.708970,15.798240 9.392511,16.358954 9.416890,16.870910 10.075119,16.797774 10.952758,17.431624 11.001516,18.162990 10.099498,18.138611 8.368599,14.774328 9.416890,14.530540 8.929313,13.945447 8.441735,13.652901 8.978070)" ) ); - std::auto_ptr< MultiPolygon > result( algorithm::offset( *gA, 0.5 ) ) ; + std::unique_ptr< Geometry > gA( io::readWkt( "LINESTRING(13.652901 8.978070,13.921068 13.219992,20.454603 13.268750,18.967492 11.001516,16.432091 11.220926,15.091253 13.024961,14.481782 11.976670,14.676813 10.708970,15.798240 9.392511,16.358954 9.416890,16.870910 10.075119,16.797774 10.952758,17.431624 11.001516,18.162990 10.099498,18.138611 8.368599,14.774328 9.416890,14.530540 8.929313,13.945447 8.441735,13.652901 8.978070)" ) ); + std::unique_ptr< MultiPolygon > result( algorithm::offset( *gA, 0.5 ) ) ; // BOOST_CHECK_EQUAL( result->asText(7), "MULTIPOLYGON(((20.9546030 13.2687500,20.8916366 13.5116525,20.8286702 13.6005236,20.7657038 13.6601785,20.7027374 13.7028345,20.6397710 13.7331989,20.5768046 13.7535869,20.5138382 13.7652288,20.4508718 13.7687361,17.1597259 13.7441753,13.9173367 13.7199781,13.8554277 13.7156646,13.7935186 13.7034495,13.7316095 13.6827073,13.6697004 13.6522123,13.6077914 13.6096813,13.5458823 13.5505002,13.4839732 13.4627844,13.4220642 13.2515382,13.2795207 10.9967608,13.1538971 9.0096161,13.1537726 9.0075805,13.1536481 9.0053931,13.1535236 9.0030140,13.1533991 9.0003820,13.1532746 8.9973940,13.1531500 8.9938489,13.1530255 8.9892281,13.1529010 8.9780700,13.1605309 8.8910546,13.1681608 8.8554856,13.1757907 8.8285182,13.1834206 8.8060580,13.1910505 8.7865130,13.1986804 8.7690637,13.2063103 8.7532218,13.2139402 8.7386679,13.2901713 8.5988927,13.5065036 8.2023008,13.6013817 8.0789416,13.6962597 8.0082541,13.7911377 7.9661421,13.8860157 7.9452796,13.9808937 7.9429931,14.0757717 7.9590182,14.1706498 7.9953229,14.2655278 8.0576148,14.3708002 8.1453365,14.8506349 8.5452046,14.8665248 8.5590236,14.8824146 8.5740888,14.8983045 8.5905664,14.9141943 8.6086740,14.9300842 8.6287062,14.9459740 8.6510783,14.9618639 8.6764104,14.9777537 8.7057064,15.0314338 8.8130668,16.8081412 8.2594549,17.9898675 7.8912361,18.0709543 7.8731976,18.1520410 7.8687794,18.2331277 7.8776137,18.3142145 7.9004501,18.3953012 7.9395184,18.4763879 7.9999437,18.5574747 8.0955546,18.6385614 8.3615562,18.6505813 9.2148186,18.6629404 10.0924576,18.6629466 10.0929123,18.6629528 10.0934008,18.6629590 10.0939320,18.6629652 10.0945196,18.6629714 10.0951866,18.6629776 10.0959777,18.6629838 10.0970088,18.6629900 10.0994980,18.6490372 10.2167929,18.6350845 10.2642002,18.6211317 10.2997633,18.6071789 10.3290545,18.5932262 10.3542466,18.5792734 10.3764603,18.5653206 10.3963651,18.5513679 10.4143990,18.4456305 10.5448084,18.9243838 10.5033778,18.9820333 10.5017275,19.0396828 10.5067550,19.0973323 10.5186687,19.1549818 10.5379995,19.2126312 10.5657331,19.2702807 10.6036228,19.3279302 10.6549842,19.3855797 10.7272849,19.7213263 11.2391580,20.8726915 12.9945202,20.8829305 13.0108051,20.8931694 13.0286260,20.9034083 13.0483554,20.9136473 13.0705623,20.9238862 13.0962006,20.9341251 13.1271219,20.9443641 13.1680817,20.9546030 13.2687500),(14.4933005 10.1533469,14.6995207 9.9112622,14.6529699 9.9019387,14.6064191 9.8878535,14.5598683 9.8685614,14.5133175 9.8433563,14.4667667 9.8111057,14.4202159 9.7698838,14.3736651 9.7160040,14.3271142 9.6404965,14.1767673 9.3398020,14.2471573 10.4532437,14.2532865 10.4432158,14.2594156 10.4336893,14.2655448 10.4246137,14.2716740 10.4159471,14.2778032 10.4076543,14.2839324 10.3997051,14.2900615 10.3920736,14.2961907 10.3847375,14.4933005 10.1533469),(16.3330313 10.5088578,16.3564315 10.2280600,16.1062333 9.9063813,16.0446992 9.9037077,16.0204939 9.9026545,15.2545447 10.8018136,15.1494276 10.9252117,15.0586554 11.5152302,15.0028310 11.8780880,15.0656050 11.9860593,15.1423368 12.1180381,16.0307937 10.9226635,16.0662176 10.8801377,16.1016414 10.8456886,16.1370653 10.8172432,16.1724892 10.7936007,16.2079130 10.7739985,16.2433369 10.7579229,16.2787607 10.7450165,16.3141846 10.7350268,16.3330313 10.5088578),(17.1671884 12.7442029,19.5241216 12.7617921,18.8851471 11.7876198,18.7131511 11.5253950,17.8521962 11.5999009,16.6992425 11.6996758,15.9297694 12.7349684,17.1671884 12.7442029),(17.3535812 10.3038685,17.6604872 9.9253511,17.6506763 9.2289018,17.6480888 9.0451535,17.1056283 9.2141811,16.8875736 9.2821256,17.2655882 9.7681514,17.2787535 9.7858722,17.2919187 9.8053938,17.3050839 9.8271411,17.3182491 9.8517634,17.3314143 9.8803480,17.3445796 9.9150030,17.3577448 9.9611370,17.3709100 10.0751190,17.3706941 10.0898101,17.3704782 10.0958931,17.3702624 10.1005593,17.3700465 10.1044917,17.3698306 10.1079552,17.3696147 10.1110853,17.3693989 10.1139629,17.3691830 10.1166403,17.3535812 10.3038685)))" ); //Check area BOOST_CHECK_CLOSE( algorithm::area( *result ), 29.2515, 1.0 ); @@ -97,8 +97,8 @@ BOOST_AUTO_TEST_CASE( testLineString ) BOOST_AUTO_TEST_CASE( testPolygonWithHoles ) { - std::auto_ptr< Geometry > gA( io::readWkt( "POLYGON((11.966308 -10.211022,18.007885 1.872133,39.364158 2.434140,53.554839 -6.557975,43.438710 -22.856183,20.396416 -28.476254,5.643728 -25.525717,13.090323 -20.889158,32.479570 -21.310663,38.521147 -15.831093,46.248746 -9.087007,34.446595 -1.359409,22.784946 -14.988082,11.966308 -10.211022),(20.396416 -1.640412,15.900358 -7.260484,18.007885 -9.508513,22.644444 -9.368011,25.173477 -2.342921,20.396416 -1.640412),(41.050179 -0.797401,40.207168 -2.202419,47.934767 -6.557975,48.496774 -5.433961,41.050179 -0.797401))" ) ); - std::auto_ptr< MultiPolygon > result( algorithm::offset( *gA, 0.5 ) ) ; + std::unique_ptr< Geometry > gA( io::readWkt( "POLYGON((11.966308 -10.211022,18.007885 1.872133,39.364158 2.434140,53.554839 -6.557975,43.438710 -22.856183,20.396416 -28.476254,5.643728 -25.525717,13.090323 -20.889158,32.479570 -21.310663,38.521147 -15.831093,46.248746 -9.087007,34.446595 -1.359409,22.784946 -14.988082,11.966308 -10.211022),(20.396416 -1.640412,15.900358 -7.260484,18.007885 -9.508513,22.644444 -9.368011,25.173477 -2.342921,20.396416 -1.640412),(41.050179 -0.797401,40.207168 -2.202419,47.934767 -6.557975,48.496774 -5.433961,41.050179 -0.797401))" ) ); + std::unique_ptr< MultiPolygon > result( algorithm::offset( *gA, 0.5 ) ) ; // @todo works in Release, not in Debug... Something strange with holes? //BOOST_CHECK_EQUAL(result->asText(), "MULTIPOLYGON(((3028360385708393/562949953421312 -3532689497542891/140737488355328,3011773017246331/562949953421312 -1767740319401211/70368744177664,2995185648784269/562949953421312 -3538735168852129/140737488355328,5957196560644415/1125899906842624 -885635926734687/35184372088832,5924021823720291/1125899906842624 -3547045526205937/140737488355328,5890847086796167/1125899906842624 -1776237153685471/70368744177664,1464418087468011/281474976710656 -7118564940832791/281474976710656,364031100809245/70368744177664 -892156430622343/35184372088832,1447830719005949/281474976710656 -1796212649524449/70368744177664,5847891174287959/1125899906842624 -7246337522204351/281474976710656,2952229736276061/562949953421312 -908684373322589/35184372088832,5961027770816285/1125899906842624 -3642778888469283/140737488355328,47012469289691/8796093022208 -114025703884643/4398046511104,6074164367344611/1125899906842624 -7306929440326075/281474976710656,3065366332804387/562949953421312 -3657008390538791/140737488355328,6187300963872937/1125899906842624 -7319255082343209/281474976710656,1560967315534275/281474976710656 -3661427529807983/140737488355328,4044410832301929/281474976710656 -3909771877196161/140737488355328,357092489940035/17592186044416 -2038339348858059/70368744177664,715137315710917/35184372088832 -8154664641645539/281474976710656,5728717212334113/281474976710656 -1019443289175517/35184372088832,2868167949490445/140737488355328 -1019501301714505/35184372088832,2871977292813833/140737488355328 -2039015268623291/70368744177664,2875786636137221/140737488355328 -2038924685863837/70368744177664,5759191958921219/281474976710656 -8154920204131587/281474976710656,1441702661391999/70368744177664 -4076859215539645/140737488355328,1443607333053693/70368744177664 -4076041132401399/140737488355328,4124457677447379/140737488355328 -3774274582775847/140737488355328,1532532312414221/35184372088832 -821271613867985/35184372088832,3067759237626369/70368744177664 -3283542150172497/140737488355328,383806731303037/8796093022208 -6563029166824747/281474976710656,3073148463222223/70368744177664 -6557913080183645/281474976710656,1537921538010075/35184372088832 -6551598303243473/281474976710656,3078537688818077/70368744177664 -3271939700952919/140737488355328,770308075404001/17592186044416 -3267217465268595/140737488355328,3083926914413931/70368744177664 -6522718912523963/281474976710656,1543310763605929/35184372088832 -3253831650909595/140737488355328,1627423549295689/35184372088832 -2711771472227055/140737488355328,1899240410453665/35184372088832 -3840251168849529/562949953421312,7598284220876781/140737488355328 -7662735592119657/1125899906842624,3799803399969451/70368744177664 -3821663758345067/562949953421312,118764521546891/2199023255552 -7621877342095167/1125899906842624,7602251958063145/140737488355328 -3798886152874089/562949953421312,3801787268562633/70368744177664 -7569985056110207/1125899906842624,1901224279046847/35184372088832 -7536521012352269/1125899906842624,7606219695249509/140737488355328 -7492254852128817/1125899906842624,3803771137155815/70368744177664 -3691811720788129/562949953421312,7603454299374331/140737488355328 -7194542331184431/1125899906842624,949920790554629/17592186044416 -1780063123697661/281474976710656,3797639174749867/70368744177664 -883259226368679/140737488355328,7591190374562435/140737488355328 -7022829590175691/1125899906842624,474193899976571/8796093022208 -3493463818415547/562949953421312,3791507212343919/70368744177664 -3478256199439985/562949953421312,7578926449750539/140737488355328 -3465238858842713/562949953421312,946854809351655/17592186044416 -215878235704859/35184372088832,888843660288911/17592186044416 -569436605777293/140737488355328,1394419417996963/35184372088832 804029475622255/281474976710656,5572738170160599/140737488355328 6477933794533037/2251799813685248,2783899334166673/70368744177664 6515605797025573/2251799813685248,2781429583253047/70368744177664 6546103931253125/2251799813685248,5557919664678841/140737488355328 3285015590788249/1125899906842624,1388245040712897/35184372088832 1646953464083803/562949953421312,346752541314021/8796093022208 6599745053018491/2251799813685248,5543101159197083/140737488355328 6606010991358149/2251799813685248,2769080828684915/70368744177664 51614892923215/17592186044416,1997906675328045/70368744177664 2978665338405763/1125899906842624,1266266617940965/70368744177664 1335294738140175/562949953421312,2524897179804049/140737488355328 2665644420170763/1125899906842624,314657640465771/17592186044416 2653862938285587/1125899906842624,5019250135296573/281474976710656 5269573376258579/2251799813685248,5003978023140811/281474976710656 5215162004938759/2251799813685248,4988705910985049/281474976710656 5141629971653071/2251799813685248,2486716899414643/140737488355328 78810939479743/35184372088832,1239540421668381/70368744177664 4911855402350817/2251799813685248,2471444787258881/140737488355328 589898310588529/281474976710656,1856178995772707/140737488355328 -935582431948529/140737488355328,1621168410962437/140737488355328 -2811207476072225/281474976710656,405059945792677/35184372088832 -703766943252719/70368744177664,1619311155378979/140737488355328 -88101919123843/8796093022208,6473530110348999/562949953421312 -5647743478572963/562949953421312,6469815599182083/562949953421312 -5658052605853291/562949953421312,6466101088015167/562949953421312 -2834939166027707/281474976710656,3231193288424125/281474976710656 -2842026402083069/281474976710656,3229336032840667/281474976710656 -1425679275736801/140737488355328,3227478777257209/281474976710656 -718536794910499/70368744177664,3237964905494173/281474976710656 -2927454063023811/281474976710656,6496902067462275/562949953421312 -5896123042034813/562949953421312,1629468580984051/140737488355328 -1481416340455219/140737488355328,1634711645102533/140737488355328 -2974381847490525/281474976710656,1639954709221015/140737488355328 -5967464990266985/562949953421312,6580791093357989/562949953421312 -2991411736662575/281474976710656,3300881674915959/281474976710656 -2997731537569245/281474976710656,3311367803152923/281474976710656 -1501446124617571/140737488355328,2724489330497645/140737488355328 -493346525637421/35184372088832,1589135921473041/70368744177664 -1086878775772863/70368744177664,6377016448265889/281474976710656 -4354725352994157/281474976710656,3198744605319807/140737488355328 -8717212281320445/562949953421312,3208980986506669/140737488355328 -8718866616362967/562949953421312,6438434735387063/281474976710656 -8714523162756849/562949953421312,1614726874440197/70368744177664 -8703888656897737/562949953421312,404961266258407/17592186044416 -135721204885481/8796093022208,6499853022508237/281474976710656 -8659635153660283/562949953421312,3260162892440981/140737488355328 -67347968157629/4398046511104,3547258472461965/140737488355328 -3639227363839613/281474976710656,1215289358062885/35184372088832 -284093325341281/140737488355328,3047410182890251/70368744177664 -4367395071093191/562949953421312,1598180599613823/35184372088832 -1286903614230609/140737488355328,2780663059477579/70368744177664 -4024971450789115/281474976710656,2687549805184669/70368744177664 -4350021453112993/281474976710656,5374973997463783/140737488355328 -4350241230170015/281474976710656,1343712096139557/35184372088832 -8700924124712407/562949953421312,5374722771652673/140737488355328 -8701367912610695/562949953421312,2687298579373559/70368744177664 -8701813837478525/562949953421312,5374471545841563/140737488355328 -8702261912938807/562949953421312,671793241617001/17592186044416 -8702712152797035/562949953421312,5374220320030453/140737488355328 -8703164571044669/562949953421312,2687047353562449/70368744177664 -4351809590931299/281474976710656,582917783571653/17592186044416 -705135161401155/35184372088832,2272294256681503/70368744177664 -1464123814792323/70368744177664,101183728333231/4398046511104 -2899840932584139/140737488355328,3687657146802913/281474976710656 -2869535508454603/140737488355328,7355952602553787/562949953421312 -5739193651996305/281474976710656,1834147727875437/140737488355328 -2869992609691077/140737488355328,1829307305112427/140737488355328 -5741457203098911/281474976710656,7297867529397669/562949953421312 -5743631671330411/281474976710656,3639252919172815/281474976710656 -359158938446617/17592186044416,3629572073646795/281474976710656 -1437560227466965/70368744177664,7239782456241551/562949953421312 -5754795153095311/281474976710656,902552595648689/70368744177664 -2880151818206675/140737488355328,4016516006338149/562949953421312 -844718186952545/35184372088832,3028360385708393/562949953421312 -3532689497542891/140737488355328),(408817578010145/8796093022208 -2682724776110247/562949953421312,3366855130504311/70368744177664 -395309996290287/70368744177664,1679087410278771/35184372088832 -825340995389983/140737488355328,1625998263599139/35184372088832 -1411298169994999/281474976710656,1439049553265513/35184372088832 -568329426454073/281474976710656,5800833692634477/140737488355328 -839088728978075/562949953421312,408817578010145/8796093022208 -2682724776110247/562949953421312),(3245366561247467/140737488355328 -2856916395619525/1125899906842624,3447504739790557/140737488355328 -386840753297585/140737488355328,809599447857921/35184372088832 -483846606191777/70368744177664,196058214955373/8796093022208 -2499088320953625/281474976710656,2848639514157999/140737488355328 -629140128733581/70368744177664,5127997789525703/281474976710656 -5067623122676177/562949953421312,1167992938984399/70368744177664 -1023691869936171/140737488355328,2330811895639755/140737488355328 -2036345911013337/281474976710656,2411464969609961/140737488355328 -229339184794687/35184372088832,2900259490773367/140737488355328 -612727014782355/281474976710656,3245366561247467/140737488355328 -2856916395619525/1125899906842624)))" ); @@ -109,29 +109,29 @@ BOOST_AUTO_TEST_CASE( testPolygonWithHoles ) BOOST_AUTO_TEST_CASE( testMultiPoint ) { - std::auto_ptr< Geometry > gA( io::readWkt( "MULTIPOINT(2 0,1 1,0 2,-1 1,-2 0,-1 -1,0 -2,1 -1)" ) ); - std::auto_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; + std::unique_ptr< Geometry > gA( io::readWkt( "MULTIPOINT(2 0,1 1,0 2,-1 1,-2 0,-1 -1,0 -2,1 -1)" ) ); + std::unique_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; BOOST_CHECK_EQUAL( result->asText( 7 ), "MULTIPOLYGON(((3.0000000 0.0000000,2.8750000 0.4841229,2.7500000 0.6614378,2.6250000 0.7806247,2.5000000 0.8660254,2.3750000 0.9270248,2.2500000 0.9682458,2.1250000 0.9921567,2.0000000 1.0000000,1.8750000 1.4841229,1.7500000 1.6614378,1.6250000 1.7806247,1.5000000 1.8660254,1.3750000 1.9270248,1.2500000 1.9682458,1.1250000 1.9921567,1.0000000 2.0000000,0.7500000 2.6614378,0.5000000 2.8660254,0.2500000 2.9682458,0.0000000 3.0000000,-0.2500000 2.9682458,-0.5000000 2.8660254,-0.7500000 2.6614378,-1.0000000 2.0000000,-1.1250000 1.9921567,-1.2500000 1.9682458,-1.3750000 1.9270248,-1.5000000 1.8660254,-1.6250000 1.7806247,-1.7500000 1.6614378,-1.8750000 1.4841229,-2.0000000 1.0000000,-2.1250000 0.9921567,-2.2500000 0.9682458,-2.3750000 0.9270248,-2.5000000 0.8660254,-2.6250000 0.7806247,-2.7500000 0.6614378,-2.8750000 0.4841229,-3.0000000 0.0000000,-2.8750000 -0.4841229,-2.7500000 -0.6614378,-2.6250000 -0.7806247,-2.5000000 -0.8660254,-2.3750000 -0.9270248,-2.2500000 -0.9682458,-2.1250000 -0.9921567,-2.0000000 -1.0000000,-1.8750000 -1.4841229,-1.7500000 -1.6614378,-1.6250000 -1.7806247,-1.5000000 -1.8660254,-1.3750000 -1.9270248,-1.2500000 -1.9682458,-1.1250000 -1.9921567,-1.0000000 -2.0000000,-0.7500000 -2.6614378,-0.5000000 -2.8660254,-0.2500000 -2.9682458,0.0000000 -3.0000000,0.2500000 -2.9682458,0.5000000 -2.8660254,0.7500000 -2.6614378,1.0000000 -2.0000000,1.1250000 -1.9921567,1.2500000 -1.9682458,1.3750000 -1.9270248,1.5000000 -1.8660254,1.6250000 -1.7806247,1.7500000 -1.6614378,1.8750000 -1.4841229,2.0000000 -1.0000000,2.1250000 -0.9921567,2.2500000 -0.9682458,2.3750000 -0.9270248,2.5000000 -0.8660254,2.6250000 -0.7806247,2.7500000 -0.6614378,2.8750000 -0.4841229,3.0000000 0.0000000),(0.0000000 1.0000000,0.1250000 0.5158771,0.2500000 0.3385622,0.3750000 0.2193753,0.5000000 0.1339746,0.6250000 0.0729752,0.7500000 0.0317542,0.8750000 0.0078433,1.0000000 0.0000000,0.8750000 -0.0078433,0.7500000 -0.0317542,0.6250000 -0.0729752,0.5000000 -0.1339746,0.3750000 -0.2193753,0.2500000 -0.3385622,0.1250000 -0.5158771,0.0000000 -1.0000000,-0.1250000 -0.5158771,-0.2500000 -0.3385622,-0.3750000 -0.2193753,-0.5000000 -0.1339746,-0.6250000 -0.0729752,-0.7500000 -0.0317542,-0.8750000 -0.0078433,-1.0000000 0.0000000,-0.8750000 0.0078433,-0.7500000 0.0317542,-0.6250000 0.0729752,-0.5000000 0.1339746,-0.3750000 0.2193753,-0.2500000 0.3385622,-0.1250000 0.5158771,0.0000000 1.0000000)))" ); } BOOST_AUTO_TEST_CASE( testMultiLineString ) { - std::auto_ptr< Geometry > gA( io::readWkt( "MULTILINESTRING((0.0 0.0,1.0 0.0),(2.0 2.0,3.0 2.0))" ) ); - std::auto_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; + std::unique_ptr< Geometry > gA( io::readWkt( "MULTILINESTRING((0.0 0.0,1.0 0.0),(2.0 2.0,3.0 2.0))" ) ); + std::unique_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; BOOST_CHECK_EQUAL( result->asText( 2 ), "MULTIPOLYGON(((2.00 0.00,1.88 0.48,1.75 0.66,1.62 0.78,1.50 0.87,1.38 0.93,1.25 0.97,1.12 0.99,1.00 1.00,0.00 1.00,-0.12 0.99,-0.25 0.97,-0.38 0.93,-0.50 0.87,-0.62 0.78,-0.75 0.66,-0.88 0.48,-1.00 0.00,-0.88 -0.48,-0.75 -0.66,-0.62 -0.78,-0.50 -0.87,-0.38 -0.93,-0.25 -0.97,-0.12 -0.99,0.00 -1.00,1.00 -1.00,1.12 -0.99,1.25 -0.97,1.38 -0.93,1.50 -0.87,1.62 -0.78,1.75 -0.66,1.88 -0.48,2.00 0.00)),((4.00 2.00,3.88 2.48,3.75 2.66,3.62 2.78,3.50 2.87,3.38 2.93,3.25 2.97,3.12 2.99,3.00 3.00,2.00 3.00,1.88 2.99,1.75 2.97,1.62 2.93,1.50 2.87,1.38 2.78,1.25 2.66,1.12 2.48,1.00 2.00,1.12 1.52,1.25 1.34,1.38 1.22,1.50 1.13,1.62 1.07,1.75 1.03,1.88 1.01,2.00 1.00,3.00 1.00,3.12 1.01,3.25 1.03,3.38 1.07,3.50 1.13,3.62 1.22,3.75 1.34,3.88 1.52,4.00 2.00)))" ); } BOOST_AUTO_TEST_CASE( testMultiPolygon ) { - std::auto_ptr< Geometry > gA( io::readWkt( "MULTIPOLYGON(((0 0,1 0,1 1,0 0)),((2 1,2 0,3 0,2 1)))" ) ); - std::auto_ptr< MultiPolygon > result( algorithm::offset( *gA, 1. ) ) ; + std::unique_ptr< Geometry > gA( io::readWkt( "MULTIPOLYGON(((0 0,1 0,1 1,0 0)),((2 1,2 0,3 0,2 1)))" ) ); + std::unique_ptr< MultiPolygon > result( algorithm::offset( *gA, 1. ) ) ; BOOST_CHECK_EQUAL( result->asText( 2 ), "MULTIPOLYGON(((-0.71 0.71,-0.74 0.67,-0.78 0.63,-0.82 0.58,-0.85 0.52,-0.89 0.46,-0.93 0.38,-0.96 0.27,-1.00 0.00,-0.88 -0.48,-0.75 -0.66,-0.62 -0.78,-0.50 -0.87,-0.38 -0.93,-0.25 -0.97,-0.12 -0.99,0.00 -1.00,1.00 -1.00,1.06 -1.00,1.12 -0.99,1.19 -0.98,1.25 -0.97,1.31 -0.95,1.38 -0.93,1.44 -0.90,1.50 -0.87,1.56 -0.90,1.62 -0.93,1.69 -0.95,1.75 -0.97,1.81 -0.98,1.88 -0.99,1.94 -1.00,2.00 -1.00,3.00 -1.00,3.12 -0.99,3.25 -0.97,3.38 -0.93,3.50 -0.87,3.62 -0.78,3.75 -0.66,3.88 -0.48,4.00 0.00,3.96 0.27,3.93 0.38,3.89 0.46,3.85 0.52,3.82 0.58,3.78 0.63,3.74 0.67,3.71 0.71,3.56 0.85,2.71 1.71,2.56 1.83,2.41 1.91,2.25 1.97,2.10 1.99,1.95 2.00,1.80 1.98,1.65 1.94,1.50 1.87,1.35 1.94,1.20 1.98,1.05 2.00,0.90 1.99,0.75 1.97,0.59 1.91,0.44 1.83,0.29 1.71,-0.56 0.85,-0.71 0.71)))" ); } BOOST_AUTO_TEST_CASE( testGeometryCollection ) { - std::auto_ptr< Geometry > gA( io::readWkt( "GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(1 1,2 2))" ) ); - std::auto_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; + std::unique_ptr< Geometry > gA( io::readWkt( "GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(1 1,2 2))" ) ); + std::unique_ptr< MultiPolygon > result( algorithm::offset( *gA, 1.0 ) ) ; BOOST_CHECK_EQUAL( result->asText( 2 ), "MULTIPOLYGON(((-0.00 1.00,-0.12 0.99,-0.25 0.97,-0.38 0.93,-0.50 0.87,-0.62 0.78,-0.75 0.66,-0.88 0.48,-1.00 0.00,-0.75 -0.66,-0.50 -0.87,-0.25 -0.97,0.00 -1.00,0.25 -0.97,0.50 -0.87,0.75 -0.66,1.00 0.00,1.09 0.00,1.18 0.02,1.27 0.04,1.35 0.06,1.44 0.10,1.53 0.15,1.62 0.21,1.71 0.29,1.85 0.44,2.71 1.29,2.74 1.33,2.78 1.37,2.82 1.42,2.85 1.48,2.89 1.54,2.93 1.62,2.96 1.73,3.00 2.00,2.79 2.62,2.57 2.82,2.36 2.93,2.15 2.99,1.93 3.00,1.72 2.96,1.51 2.87,1.29 2.71,0.44 1.85,0.29 1.71,0.26 1.67,0.22 1.63,0.18 1.58,0.15 1.52,0.11 1.46,0.07 1.38,0.04 1.27,-0.00 1.00)))" ); } diff --git a/test/unit/SFCGAL/algorithm/PlaneTest.cpp b/test/unit/SFCGAL/algorithm/PlaneTest.cpp index d1d08674..8ff48e8e 100644 --- a/test/unit/SFCGAL/algorithm/PlaneTest.cpp +++ b/test/unit/SFCGAL/algorithm/PlaneTest.cpp @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_algorithm_PlaneTest ) BOOST_AUTO_TEST_CASE( testPlane1 ) { - std::auto_ptr gA( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); + std::unique_ptr gA( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); CGAL::Plane_3 plane = algorithm::plane3D( gA->as() ); BOOST_CHECK_EQUAL( plane.a(), 0.0 ); @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE( testPlane ) for ( size_t t=0; t != numTest; ++t ) { //std::cout << "test = " << t << "\n"; - std::auto_ptr g( io::readWkt( test[t]._wkt ) ); + std::unique_ptr g( io::readWkt( test[t]._wkt ) ); const LineString* l = dynamic_cast( g.get() ); BOOST_CHECK_MESSAGE( algorithm::isPlane3D< Kernel >( *l, 1.e-9 ) == test[t]._isPlane, @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE( testPlane ) BOOST_AUTO_TEST_CASE( testPlane3DDivideByZeroCrash ) { - std::auto_ptr< Geometry > degenerate_polygon = io::readWkt("POLYGON((1 -1 -1,1 0.5 0.5,1 0.5 0.5,1 -1 -1))"); + std::unique_ptr< Geometry > degenerate_polygon = io::readWkt("POLYGON((1 -1 -1,1 0.5 0.5,1 0.5 0.5,1 -1 -1))"); BOOST_CHECK( degenerate_polygon->geometryTypeId() == TYPE_POLYGON ); // Should return degenerate plane without throwing @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE( testPlane3DDivideByZeroCrash ) auto div_by_zero_check = algorithm::plane3D< Kernel >( degenerate_polygon->as(), algorithm::Plane3DInexactUnsafe() ); } - std::auto_ptr< Geometry > ok_polygon = io::readWkt("POLYGON((1 0.5 0.5,1.5 1.5 0.5,1.5 0.5 0.5,1 0.5 0.5))"); + std::unique_ptr< Geometry > ok_polygon = io::readWkt("POLYGON((1 0.5 0.5,1.5 1.5 0.5,1.5 0.5 0.5,1 0.5 0.5))"); BOOST_CHECK( ok_polygon->geometryTypeId() == TYPE_POLYGON ); BOOST_CHECK( algorithm::hasPlane3D< Kernel >(ok_polygon->as()) ); diff --git a/test/unit/SFCGAL/algorithm/StraightSkeletonTest.cpp b/test/unit/SFCGAL/algorithm/StraightSkeletonTest.cpp index 66a42645..ade62d5b 100644 --- a/test/unit/SFCGAL/algorithm/StraightSkeletonTest.cpp +++ b/test/unit/SFCGAL/algorithm/StraightSkeletonTest.cpp @@ -45,18 +45,18 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_algorithm_StraightSkeletonTest ) BOOST_AUTO_TEST_CASE( testTriangle ) { - std::auto_ptr< Geometry > g( io::readWkt( "TRIANGLE((1 1,2 1,2 2,1 1))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "TRIANGLE((1 1,2 1,2 2,1 1))" ) ); std::string expectedWKT( "MULTILINESTRING((1.0 1.0,1.7 1.3),(2.0 1.0,1.7 1.3),(2.0 2.0,1.7 1.3))" ); { - std::auto_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; + std::unique_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; BOOST_CHECK_EQUAL( result->numGeometries(), 3U ); BOOST_CHECK_EQUAL( result->asText( 1 ), expectedWKT ); } // check orientation insensitive { g->as< Triangle >().reverse() ; - std::auto_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; + std::unique_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; BOOST_CHECK_EQUAL( result->numGeometries(), 3U ); BOOST_CHECK_EQUAL( result->asText( 1 ), expectedWKT ); } @@ -65,18 +65,18 @@ BOOST_AUTO_TEST_CASE( testTriangle ) BOOST_AUTO_TEST_CASE( testPolygon ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((1 1,11 1,11 11,1 11,1 1))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((1 1,11 1,11 11,1 11,1 1))" ) ); std::string expectedWKT( "MULTILINESTRING((1 1,6 6),(11 1,6 6),(11 11,6 6),(1 11,6 6))" ); { - std::auto_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; + std::unique_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; BOOST_CHECK_EQUAL( result->numGeometries(), 4U ); BOOST_CHECK_EQUAL( result->asText( 0 ), expectedWKT ); } // check orientation insensitive { g->as< Polygon >().exteriorRing().reverse() ; - std::auto_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; + std::unique_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; BOOST_CHECK_EQUAL( result->numGeometries(), 4U ); BOOST_CHECK_EQUAL( result->asText( 0 ), expectedWKT ); } @@ -84,10 +84,10 @@ BOOST_AUTO_TEST_CASE( testPolygon ) BOOST_AUTO_TEST_CASE( testPolygonWithHole ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0),(-0.5 -0.5,-0.5 0.5,0.5 0.5,-0.5 -0.5))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0),(-0.5 -0.5,-0.5 0.5,0.5 0.5,-0.5 -0.5))" ) ); std::string expectedWKT( "MULTILINESTRING((-1.00 -1.00,-0.75 -0.75),(1.00 -1.00,0.41 -0.41),(1.00 1.00,0.75 0.75),(-1.00 1.00,-0.75 0.75),(-0.50 -0.50,-0.65 -0.85),(-0.50 0.50,-0.75 0.75),(0.50 0.50,0.85 0.65),(-0.65 -0.85,0.41 -0.41),(-0.65 -0.85,-0.75 -0.75),(0.85 0.65,0.75 0.75),(0.85 0.65,0.41 -0.41),(-0.75 -0.75,-0.75 0.75),(0.75 0.75,-0.75 0.75))" ); { - std::auto_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; + std::unique_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; //BOOST_CHECK_EQUAL( result->numGeometries(), 4U ); BOOST_CHECK_EQUAL( result->asText( 2 ), expectedWKT ); } @@ -95,13 +95,13 @@ BOOST_AUTO_TEST_CASE( testPolygonWithHole ) BOOST_AUTO_TEST_CASE( testPolygonWithHoleTouchingShell ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0),(-0.5 -0.5,-0.5 0.5,0.5 0.5,1.0 -0.5,-0.5 -0.5))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0),(-0.5 -0.5,-0.5 0.5,0.5 0.5,1.0 -0.5,-0.5 -0.5))" ) ); BOOST_CHECK_THROW( algorithm::straightSkeleton( *g ), NotImplementedException ); } BOOST_AUTO_TEST_CASE( testPolygonWithTouchingHoles ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0),(-0.5 -0.5,-0.5 0.5,-0.1 0.5,0.1 -0.5,-0.5 -0.5),(0.1 -0.5,0.1 0.5,0.5 0.5,0.5 -0.5,0.1 -0.5))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((-1.0 -1.0,1.0 -1.0,1.0 1.0,-1.0 1.0,-1.0 -1.0),(-0.5 -0.5,-0.5 0.5,-0.1 0.5,0.1 -0.5,-0.5 -0.5),(0.1 -0.5,0.1 0.5,0.5 0.5,0.5 -0.5,0.1 -0.5))" ) ); BOOST_CHECK_THROW( algorithm::straightSkeleton( *g ), NotImplementedException ); @@ -109,8 +109,8 @@ BOOST_AUTO_TEST_CASE( testPolygonWithTouchingHoles ) BOOST_AUTO_TEST_CASE( testMultiPolygon ) { - std::auto_ptr< Geometry > g( io::readWkt( "MULTIPOLYGON(((3.000000 0.000000,2.875000 0.484123,2.750000 0.661438,2.625000 0.780625,2.500000 0.866025,2.375000 0.927025,2.250000 0.968246,2.125000 0.992157,2.000000 1.000000,1.875000 1.484123,1.750000 1.661438,1.625000 1.780625,1.500000 1.866025,1.375000 1.927025,1.250000 1.968246,1.125000 1.992157,1.000000 2.000000,0.750000 2.661438,0.500000 2.866025,0.250000 2.968246,0.000000 3.000000,-0.250000 2.968246,-0.500000 2.866025,-0.750000 2.661438,-1.000000 2.000000,-1.125000 1.992157,-1.250000 1.968246,-1.375000 1.927025,-1.500000 1.866025,-1.625000 1.780625,-1.750000 1.661438,-1.875000 1.484123,-2.000000 1.000000,-2.125000 0.992157,-2.250000 0.968246,-2.375000 0.927025,-2.500000 0.866025,-2.625000 0.780625,-2.750000 0.661438,-2.875000 0.484123,-3.000000 0.000000,-2.875000 -0.484123,-2.750000 -0.661438,-2.625000 -0.780625,-2.500000 -0.866025,-2.375000 -0.927025,-2.250000 -0.968246,-2.125000 -0.992157,-2.000000 -1.000000,-1.875000 -1.484123,-1.750000 -1.661438,-1.625000 -1.780625,-1.500000 -1.866025,-1.375000 -1.927025,-1.250000 -1.968246,-1.125000 -1.992157,-1.000000 -2.000000,-0.750000 -2.661438,-0.500000 -2.866025,-0.250000 -2.968246,0.000000 -3.000000,0.250000 -2.968246,0.500000 -2.866025,0.750000 -2.661438,1.000000 -2.000000,1.125000 -1.992157,1.250000 -1.968246,1.375000 -1.927025,1.500000 -1.866025,1.625000 -1.780625,1.750000 -1.661438,1.875000 -1.484123,2.000000 -1.000000,2.125000 -0.992157,2.250000 -0.968246,2.375000 -0.927025,2.500000 -0.866025,2.625000 -0.780625,2.750000 -0.661438,2.875000 -0.484123,3.000000 0.000000),(0.000000 1.000000,0.125000 0.515877,0.250000 0.338562,0.375000 0.219375,0.500000 0.133975,0.625000 0.072975,0.750000 0.031754,0.875000 0.007843,1.000000 0.000000,0.875000 -0.007843,0.750000 -0.031754,0.625000 -0.072975,0.500000 -0.133975,0.375000 -0.219375,0.250000 -0.338562,0.125000 -0.515877,0.000000 -1.000000,-0.125000 -0.515877,-0.250000 -0.338562,-0.375000 -0.219375,-0.500000 -0.133975,-0.625000 -0.072975,-0.750000 -0.031754,-0.875000 -0.007843,-1.000000 0.000000,-0.875000 0.007843,-0.750000 0.031754,-0.625000 0.072975,-0.500000 0.133975,-0.375000 0.219375,-0.250000 0.338562,-0.125000 0.515877,0.000000 1.000000)))" ) ); - std::auto_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; + std::unique_ptr< Geometry > g( io::readWkt( "MULTIPOLYGON(((3.000000 0.000000,2.875000 0.484123,2.750000 0.661438,2.625000 0.780625,2.500000 0.866025,2.375000 0.927025,2.250000 0.968246,2.125000 0.992157,2.000000 1.000000,1.875000 1.484123,1.750000 1.661438,1.625000 1.780625,1.500000 1.866025,1.375000 1.927025,1.250000 1.968246,1.125000 1.992157,1.000000 2.000000,0.750000 2.661438,0.500000 2.866025,0.250000 2.968246,0.000000 3.000000,-0.250000 2.968246,-0.500000 2.866025,-0.750000 2.661438,-1.000000 2.000000,-1.125000 1.992157,-1.250000 1.968246,-1.375000 1.927025,-1.500000 1.866025,-1.625000 1.780625,-1.750000 1.661438,-1.875000 1.484123,-2.000000 1.000000,-2.125000 0.992157,-2.250000 0.968246,-2.375000 0.927025,-2.500000 0.866025,-2.625000 0.780625,-2.750000 0.661438,-2.875000 0.484123,-3.000000 0.000000,-2.875000 -0.484123,-2.750000 -0.661438,-2.625000 -0.780625,-2.500000 -0.866025,-2.375000 -0.927025,-2.250000 -0.968246,-2.125000 -0.992157,-2.000000 -1.000000,-1.875000 -1.484123,-1.750000 -1.661438,-1.625000 -1.780625,-1.500000 -1.866025,-1.375000 -1.927025,-1.250000 -1.968246,-1.125000 -1.992157,-1.000000 -2.000000,-0.750000 -2.661438,-0.500000 -2.866025,-0.250000 -2.968246,0.000000 -3.000000,0.250000 -2.968246,0.500000 -2.866025,0.750000 -2.661438,1.000000 -2.000000,1.125000 -1.992157,1.250000 -1.968246,1.375000 -1.927025,1.500000 -1.866025,1.625000 -1.780625,1.750000 -1.661438,1.875000 -1.484123,2.000000 -1.000000,2.125000 -0.992157,2.250000 -0.968246,2.375000 -0.927025,2.500000 -0.866025,2.625000 -0.780625,2.750000 -0.661438,2.875000 -0.484123,3.000000 0.000000),(0.000000 1.000000,0.125000 0.515877,0.250000 0.338562,0.375000 0.219375,0.500000 0.133975,0.625000 0.072975,0.750000 0.031754,0.875000 0.007843,1.000000 0.000000,0.875000 -0.007843,0.750000 -0.031754,0.625000 -0.072975,0.500000 -0.133975,0.375000 -0.219375,0.250000 -0.338562,0.125000 -0.515877,0.000000 -1.000000,-0.125000 -0.515877,-0.250000 -0.338562,-0.375000 -0.219375,-0.500000 -0.133975,-0.625000 -0.072975,-0.750000 -0.031754,-0.875000 -0.007843,-1.000000 0.000000,-0.875000 0.007843,-0.750000 0.031754,-0.625000 0.072975,-0.500000 0.133975,-0.375000 0.219375,-0.250000 0.338562,-0.125000 0.515877,0.000000 1.000000)))" ) ); + std::unique_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ) ; BOOST_CHECK_EQUAL( result->numGeometries(), 220U ); } @@ -125,8 +125,8 @@ BOOST_AUTO_TEST_CASE( testInvalidTypes ) itE=wkt.end(); it != itE; ++it ) { - std::auto_ptr< Geometry > g( io::readWkt( *it ) ); - std::auto_ptr< MultiLineString > result( + std::unique_ptr< Geometry > g( io::readWkt( *it ) ); + std::unique_ptr< MultiLineString > result( algorithm::straightSkeleton( *g ) ); BOOST_CHECK_EQUAL( result->numGeometries(), 0U ); @@ -136,29 +136,29 @@ BOOST_AUTO_TEST_CASE( testInvalidTypes ) // See https://github.com/Oslandia/SFCGAL/issues/75 BOOST_AUTO_TEST_CASE( testPostgisIssue3107 ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((1347259.25 7184745.94,1347273.17 7184758.16,1347280.39 7184749.95,1347278.04 7184747.88,1347281.66 7184743.76,1347284.01 7184745.83,1347293.5 7184735.05,1347279.61 7184722.85,1347269.29 7184734.6,1347270.35 7184735.51,1347267.31 7184738.96,1347266.22 7184738.01,1347259.25 7184745.94),(1347267.31 7184738.96,1347269.31 7184736.7,1347272.57 7184739.55,1347270.56 7184741.83,1347267.31 7184738.96))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((1347259.25 7184745.94,1347273.17 7184758.16,1347280.39 7184749.95,1347278.04 7184747.88,1347281.66 7184743.76,1347284.01 7184745.83,1347293.5 7184735.05,1347279.61 7184722.85,1347269.29 7184734.6,1347270.35 7184735.51,1347267.31 7184738.96,1347266.22 7184738.01,1347259.25 7184745.94),(1347267.31 7184738.96,1347269.31 7184736.7,1347272.57 7184739.55,1347270.56 7184741.83,1347267.31 7184738.96))" ) ); BOOST_CHECK_THROW( algorithm::straightSkeleton( *g ), NotImplementedException ); } // See https://github.com/Oslandia/SFCGAL/issues/91 BOOST_AUTO_TEST_CASE( testMultiPolygonWithTouchingHoles ) { - std::auto_ptr< Geometry > g( io::readWkt( "MULTIPOLYGON(((1347259.25 7184745.94,1347273.17 7184758.16,1347280.39 7184749.95,1347278.04 7184747.88,1347281.66 7184743.76,1347284.01 7184745.83,1347293.5 7184735.05,1347279.61 7184722.85,1347269.29 7184734.6,1347270.35 7184735.51,1347267.31 7184738.96,1347266.22 7184738.01,1347259.25 7184745.94),(1347267.31 7184738.96,1347269.31 7184736.7,1347272.57 7184739.55,1347270.56 7184741.83,1347267.31 7184738.96)))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "MULTIPOLYGON(((1347259.25 7184745.94,1347273.17 7184758.16,1347280.39 7184749.95,1347278.04 7184747.88,1347281.66 7184743.76,1347284.01 7184745.83,1347293.5 7184735.05,1347279.61 7184722.85,1347269.29 7184734.6,1347270.35 7184735.51,1347267.31 7184738.96,1347266.22 7184738.01,1347259.25 7184745.94),(1347267.31 7184738.96,1347269.31 7184736.7,1347272.57 7184739.55,1347270.56 7184741.83,1347267.31 7184738.96)))" ) ); BOOST_CHECK_THROW( algorithm::straightSkeleton( *g ), NotImplementedException ); } BOOST_AUTO_TEST_CASE( testDistanceInM ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); - std::auto_ptr out( algorithm::straightSkeleton( *g, /* autoOrientation */ true, /* innerOnly */ false, /* outputDistanceInM */ true ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) ); + std::unique_ptr out( algorithm::straightSkeleton( *g, /* autoOrientation */ true, /* innerOnly */ false, /* outputDistanceInM */ true ) ); std::string expectedWKT( "MULTILINESTRING M((-0.0 -0.0 0.0,0.5 0.5 0.5),(1.0 -0.0 0.0,0.5 0.5 0.5),(1.0 1.0 0.0,0.5 0.5 0.5),(-0.0 1.0 0.0,0.5 0.5 0.5))" ); BOOST_CHECK_EQUAL( out->asText( 1 ), expectedWKT ); } BOOST_AUTO_TEST_CASE( testMultiEmptyEmpty ) { - std::auto_ptr< Geometry > g( io::readWkt( "MULTIPOLYGON(EMPTY,EMPTY)" ) ); - std::auto_ptr out( algorithm::straightSkeleton( *g ) ); + std::unique_ptr< Geometry > g( io::readWkt( "MULTIPOLYGON(EMPTY,EMPTY)" ) ); + std::unique_ptr out( algorithm::straightSkeleton( *g ) ); std::string expectedWKT( "MULTILINESTRING EMPTY" ); BOOST_CHECK_EQUAL( out->asText( 1 ), expectedWKT ); } diff --git a/test/unit/SFCGAL/algorithm/TesselateTest.cpp b/test/unit/SFCGAL/algorithm/TesselateTest.cpp index 2b514d09..dcc3cf83 100644 --- a/test/unit/SFCGAL/algorithm/TesselateTest.cpp +++ b/test/unit/SFCGAL/algorithm/TesselateTest.cpp @@ -51,9 +51,9 @@ BOOST_AUTO_TEST_CASE( testEmpty ) std::vector< std::string > geometryTypes = registry.getGeometryTypes() ; for ( size_t i = 0; i < geometryTypes.size(); i++ ) { - std::auto_ptr< Geometry > g( registry.newGeometryByTypeName( geometryTypes[i] ) ) ; + std::unique_ptr< Geometry > g( registry.newGeometryByTypeName( geometryTypes[i] ) ) ; BOOST_TEST_MESSAGE( boost::format( "tesselate(%s)" ) % g->asText() ); - std::auto_ptr< Geometry > result = algorithm::tesselate( *g ) ; + std::unique_ptr< Geometry > result = algorithm::tesselate( *g ) ; BOOST_CHECK( result->isEmpty() ); } } @@ -65,25 +65,25 @@ BOOST_AUTO_TEST_CASE( testEmpty ) BOOST_AUTO_TEST_CASE( testPoint ) { std::string wkt = "POINT(3.0 4.0)" ; - std::auto_ptr< Geometry > g( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( wkt ) ); BOOST_CHECK_EQUAL( algorithm::tesselate( *g )->asText( 1 ), wkt ); } BOOST_AUTO_TEST_CASE( testLineString ) { std::string wkt = "LINESTRING(0.0 0.0,1.0 1.0)" ; - std::auto_ptr< Geometry > g( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( wkt ) ); BOOST_CHECK_EQUAL( algorithm::tesselate( *g )->asText( 1 ), wkt ); } BOOST_AUTO_TEST_CASE( testMultiPoint ) { std::string wkt = "MULTIPOINT((3.0 4.0),(5.0 6.0))" ; - std::auto_ptr< Geometry > g( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( wkt ) ); BOOST_CHECK_EQUAL( algorithm::tesselate( *g )->asText( 1 ), wkt ); } BOOST_AUTO_TEST_CASE( testMultiLineString ) { std::string wkt = "MULTILINESTRING((0.0 0.0,1.0 1.0),(1.0 1.0,2.0 2.0))" ; - std::auto_ptr< Geometry > g( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > g( io::readWkt( wkt ) ); BOOST_CHECK_EQUAL( algorithm::tesselate( *g )->asText( 1 ), wkt ); } @@ -95,16 +95,16 @@ BOOST_AUTO_TEST_CASE( testPolygon ) { std::string wkt = "POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,0.0 1.0,0.0 0.0))" ; std::string wktOut = "TIN(((0.0 1.0,1.0 0.0,1.0 1.0,0.0 1.0)),((0.0 1.0,0.0 0.0,1.0 0.0,0.0 1.0)))" ; - std::auto_ptr< Geometry > g( io::readWkt( wkt ) ); - std::auto_ptr< Geometry > result( algorithm::tesselate( *g ) ); + std::unique_ptr< Geometry > g( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > result( algorithm::tesselate( *g ) ); BOOST_CHECK_EQUAL( result->asText( 1 ), wktOut ); } BOOST_AUTO_TEST_CASE( testMultiPolygon ) { std::string wkt = "MULTIPOLYGON(((0.0 0.0,1.0 0.0,1.0 1.0,0.0 1.0,0.0 0.0)),((2.0 0.0,3.0 0.0,3.0 1.0,2.0 1.0,2.0 0.0)))" ; std::string wktOut = "GEOMETRYCOLLECTION(TIN(((0.0 1.0,1.0 0.0,1.0 1.0,0.0 1.0)),((0.0 1.0,0.0 0.0,1.0 0.0,0.0 1.0))),TIN(((2.0 1.0,3.0 0.0,3.0 1.0,2.0 1.0)),((2.0 1.0,2.0 0.0,3.0 0.0,2.0 1.0))))" ; - std::auto_ptr< Geometry > g( io::readWkt( wkt ) ); - std::auto_ptr< Geometry > result( algorithm::tesselate( *g ) ); + std::unique_ptr< Geometry > g( io::readWkt( wkt ) ); + std::unique_ptr< Geometry > result( algorithm::tesselate( *g ) ); BOOST_CHECK_EQUAL( result->asText( 1 ), wktOut ); } diff --git a/test/unit/SFCGAL/algorithm/TranslateTest.cpp b/test/unit/SFCGAL/algorithm/TranslateTest.cpp index 40d1fa63..ba4e22c6 100644 --- a/test/unit/SFCGAL/algorithm/TranslateTest.cpp +++ b/test/unit/SFCGAL/algorithm/TranslateTest.cpp @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE( testEmpty ) for ( size_t i = 0; i < typeNames.size(); i++ ) { BOOST_TEST_MESSAGE( typeNames[i] ) ; - std::auto_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; + std::unique_ptr< Geometry > g( registry.newGeometryByTypeName( typeNames[i] ) ) ; BOOST_REQUIRE( g.get() != NULL ) ; algorithm::translate( *g, 1.0, 1.0, 1.0 ); BOOST_CHECK( g->isEmpty() ); diff --git a/test/unit/SFCGAL/algorithm/UnionTest.cpp b/test/unit/SFCGAL/algorithm/UnionTest.cpp index 6f29672c..9947aa48 100644 --- a/test/unit/SFCGAL/algorithm/UnionTest.cpp +++ b/test/unit/SFCGAL/algorithm/UnionTest.cpp @@ -53,18 +53,18 @@ BOOST_AUTO_TEST_CASE( Handle ) BOOST_AUTO_TEST_CASE( Handle1 ) { - std::auto_ptr a = io::readWkt( "POINT(0 1)" ); - std::auto_ptr b = io::readWkt( "POINT(0 1)" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "POINT(0 1)" ); + std::unique_ptr b = io::readWkt( "POINT(0 1)" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "POINT(0 1)" ) ); } BOOST_AUTO_TEST_CASE( Handle2 ) { - std::auto_ptr a = io::readWkt( "MULTIPOINT(0 1,0 1,0 1)" ); - std::auto_ptr b = io::readWkt( "POINT(0 1)" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "MULTIPOINT(0 1,0 1,0 1)" ); + std::unique_ptr b = io::readWkt( "POINT(0 1)" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "POINT(0 1)" ) ); } @@ -72,30 +72,30 @@ BOOST_AUTO_TEST_CASE( Handle2 ) BOOST_AUTO_TEST_CASE( PointPoint ) { { - std::auto_ptr a = io::readWkt( "POINT(0 1)" ); - std::auto_ptr b = io::readWkt( "POINT(0 1)" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "POINT(0 1)" ); + std::unique_ptr b = io::readWkt( "POINT(0 1)" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "POINT(0 1)" ) ); } { - std::auto_ptr a = io::readWkt( "POINT(0 0)" ); - std::auto_ptr b = io::readWkt( "POINT(0 1)" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "POINT(0 0)" ); + std::unique_ptr b = io::readWkt( "POINT(0 1)" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "MULTIPOINT(0 0,0 1)" ) ); } { - std::auto_ptr a = io::readWkt( "POINT(0 1 1)" ); - std::auto_ptr b = io::readWkt( "POINT(0 1 1)" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr a = io::readWkt( "POINT(0 1 1)" ); + std::unique_ptr b = io::readWkt( "POINT(0 1 1)" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "POINT(0 1 1)" ) ); } { - std::auto_ptr a = io::readWkt( "POINT(0 0 0)" ); - std::auto_ptr b = io::readWkt( "POINT(0 0 1)" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr a = io::readWkt( "POINT(0 0 0)" ); + std::unique_ptr b = io::readWkt( "POINT(0 0 1)" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "MULTIPOINT(0 0 0,0 0 1)" ) ); } @@ -104,16 +104,16 @@ BOOST_AUTO_TEST_CASE( PointPoint ) BOOST_AUTO_TEST_CASE( PointLine ) { { - std::auto_ptr a = io::readWkt( "POINT(.5 0)" ); - std::auto_ptr b = io::readWkt( "LINESTRING(-1 0,1 0)" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "POINT(.5 0)" ); + std::unique_ptr b = io::readWkt( "LINESTRING(-1 0,1 0)" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "LINESTRING(-1 0,.5 0,1 0)" ) ); } { - std::auto_ptr a = io::readWkt( "POINT(0 0 .5)" ); - std::auto_ptr b = io::readWkt( "LINESTRING(0 0 -1,0 0 1)" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr a = io::readWkt( "POINT(0 0 .5)" ); + std::unique_ptr b = io::readWkt( "LINESTRING(0 0 -1,0 0 1)" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "LINESTRING(0 0 -1,0 0 .5,0 0 1)" ) ); } @@ -122,16 +122,16 @@ BOOST_AUTO_TEST_CASE( PointLine ) BOOST_AUTO_TEST_CASE( LineLine ) { { - std::auto_ptr a = io::readWkt( "LINESTRING(-1 0,1 0)" ); - std::auto_ptr b = io::readWkt( "LINESTRING(-1 1,1 1)" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "LINESTRING(-1 0,1 0)" ); + std::unique_ptr b = io::readWkt( "LINESTRING(-1 1,1 1)" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "MULTILINESTRING((-1 0,1 0),(-1 1,1 1))" ) ); } { - std::auto_ptr a = io::readWkt( "LINESTRING(-1 0,1 0)" ); - std::auto_ptr b = io::readWkt( "LINESTRING(0 -1,0 1)" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "LINESTRING(-1 0,1 0)" ); + std::unique_ptr b = io::readWkt( "LINESTRING(0 -1,0 1)" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "MULTILINESTRING((-1 0,0 0),(0 0,1 0),(0 -1,0 0),(0 0,0 1))" ) ); } @@ -139,15 +139,15 @@ BOOST_AUTO_TEST_CASE( LineLine ) BOOST_AUTO_TEST_CASE( LineVolume ) { - std::auto_ptr a = io::readWkt( "LINESTRING(-1 -1 -1,2 2 2)" ); - std::auto_ptr b = io::readWkt( + std::unique_ptr a = io::readWkt( "LINESTRING(-1 -1 -1,2 2 2)" ); + std::unique_ptr b = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),\ ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))))" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr u = algorithm::union3D( *a, *b ); BOOST_CHECK( u->geometryTypeId() == TYPE_GEOMETRYCOLLECTION ); BOOST_CHECK( u->geometryN( 0 ).geometryTypeId() == TYPE_LINESTRING ); BOOST_CHECK( u->geometryN( 1 ).geometryTypeId() == TYPE_LINESTRING ); @@ -157,16 +157,16 @@ BOOST_AUTO_TEST_CASE( LineVolume ) BOOST_AUTO_TEST_CASE( PointSurface ) { { - std::auto_ptr a = io::readWkt( "TRIANGLE((0 0,0 1,1 0,0 0))" ); - std::auto_ptr b = io::readWkt( "POINT(.1 .1)" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "TRIANGLE((0 0,0 1,1 0,0 0))" ); + std::unique_ptr b = io::readWkt( "POINT(.1 .1)" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "TRIANGLE((0 0,0 1,1 0,0 0))" ) ); } { - std::auto_ptr a = io::readWkt( "TRIANGLE((0 0 1,0 1 1,1 0 1,0 0 1))" ); - std::auto_ptr b = io::readWkt( "POINT(.1 .1 1)" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr a = io::readWkt( "TRIANGLE((0 0 1,0 1 1,1 0 1,0 0 1))" ); + std::unique_ptr b = io::readWkt( "POINT(.1 .1 1)" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "TRIANGLE((0 0 1,0 1 1,1 0 1,0 0 1))" ) ); } @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE( PointSurface ) BOOST_AUTO_TEST_CASE( PointVolume ) { - std::auto_ptr a = io::readWkt( + std::unique_ptr a = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ @@ -182,13 +182,13 @@ BOOST_AUTO_TEST_CASE( PointVolume ) ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),\ ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))))" ); { - std::auto_ptr b = io::readWkt( "POINT(.1 .1 1)" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr b = io::readWkt( "POINT(.1 .1 1)" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); BOOST_CHECK( u->geometryTypeId() == TYPE_SOLID ); } { - std::auto_ptr b = io::readWkt( "POINT(-.1 .1 1)" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr b = io::readWkt( "POINT(-.1 .1 1)" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); BOOST_CHECK( u->geometryTypeId() == TYPE_GEOMETRYCOLLECTION ); } } @@ -196,9 +196,9 @@ BOOST_AUTO_TEST_CASE( PointVolume ) BOOST_AUTO_TEST_CASE( TriangleTriangle ) { { - std::auto_ptr a = io::readWkt( "TRIANGLE((0 0,1 0,0 1,0 0))" ); - std::auto_ptr b = io::readWkt( "TRIANGLE((0 0,1 0,0 1,0 0))" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "TRIANGLE((0 0,1 0,0 1,0 0))" ); + std::unique_ptr b = io::readWkt( "TRIANGLE((0 0,1 0,0 1,0 0))" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "TRIANGLE((0 0,0 1,1 0,0 0))" ) ); } @@ -207,16 +207,16 @@ BOOST_AUTO_TEST_CASE( TriangleTriangle ) BOOST_AUTO_TEST_CASE( PolygonPolygon1 ) { { - std::auto_ptr a = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); - std::auto_ptr b = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0.5 0.5,0.5 -0.5,-0.5 -0.5))" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); + std::unique_ptr b = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0.5 0.5,0.5 -0.5,-0.5 -0.5))" ); + std::unique_ptr u = algorithm::union_( *a, *b ); BOOST_CHECK( *u == *io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ) ); } { - std::auto_ptr a = io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ); - std::auto_ptr b = io::readWkt( "POLYGON((1 0,2 0,2 1,1 1,1 0))" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ); + std::unique_ptr b = io::readWkt( "POLYGON((1 0,2 0,2 1,1 1,1 0))" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( *u == *io::readWkt( "POLYGON((0 0,1 0,2 0,2 1,1 1,0 1,0 0))" ) ); } @@ -225,7 +225,7 @@ BOOST_AUTO_TEST_CASE( PolygonPolygon1 ) BOOST_AUTO_TEST_CASE( PolygonPolygon2 ) { { - std::auto_ptr base = io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ); + std::unique_ptr base = io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ); Polygon a( base->as() ); algorithm::translate( a, .75, 0, 0 ); //disjoined GeometryCollection b; @@ -233,7 +233,7 @@ BOOST_AUTO_TEST_CASE( PolygonPolygon2 ) b.addGeometry( base->as() ); algorithm::translate( b.geometryN( 1 ), 1.5, 0, 0 ); - std::auto_ptr u = algorithm::union_( a, b ); + std::unique_ptr u = algorithm::union_( a, b ); DEBUG_OUT << u->asText() << "\n"; DEBUG_OUT << "area " << algorithm::area3D( *u ) <<"\n"; BOOST_CHECK( u->geometryTypeId() == TYPE_POLYGON ); @@ -249,7 +249,7 @@ BOOST_AUTO_TEST_CASE( PolygonPolygon2 ) BOOST_AUTO_TEST_CASE( PolygonPolygon3 ) { - std::auto_ptr base = io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ); + std::unique_ptr base = io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ); GeometryCollection a; GeometryCollection b; @@ -263,7 +263,7 @@ BOOST_AUTO_TEST_CASE( PolygonPolygon3 ) } } - std::auto_ptr u = algorithm::union_( a, b ); + std::unique_ptr u = algorithm::union_( a, b ); DEBUG_OUT << "surface " << algorithm::area( *u ) << "\n"; BOOST_CHECK( std::abs( algorithm::area( *u ) - 25.56 ) < .01 ); //TriangulatedSurface ts; @@ -278,9 +278,9 @@ BOOST_AUTO_TEST_CASE( GardenFailures1 ) { // cgal precondition violation { - std::auto_ptr a = io::readWkt( "POLYGON((0 0,10 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))" ); - std::auto_ptr b = io::readWkt( "TRIANGLE((-1 -1,1 -1,-1 1,-1 -1))" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "POLYGON((0 0,10 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))" ); + std::unique_ptr b = io::readWkt( "TRIANGLE((-1 -1,1 -1,-1 1,-1 -1))" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; BOOST_CHECK( algorithm::area( *a ) + algorithm::area( *b ) == algorithm::area( *u ) ); } @@ -290,9 +290,9 @@ BOOST_AUTO_TEST_CASE( GardenFailures2 ) { // cgal assertion { - std::auto_ptr a = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-.5 -.5,-.5 .5,.5 .5,.5 -.5,-.5 -.5))" ); - std::auto_ptr b = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-.5 -.5,-.5 .5,.5 .5,.5 -.5,-.5 -.5))" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr a = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-.5 -.5,-.5 .5,.5 .5,.5 -.5,-.5 -.5))" ); + std::unique_ptr b = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-.5 -.5,-.5 .5,.5 .5,.5 -.5,-.5 -.5))" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; } } @@ -301,9 +301,9 @@ BOOST_AUTO_TEST_CASE( GardenFailures3 ) { // crash (valgrind err) with invalidated iterator after push_back { - std::auto_ptr a = io::readWkt( "LINESTRING(-1 -1,1 1)" ); - std::auto_ptr b = io::readWkt( "MULTILINESTRING((1/1 -1/1 -1/1,1/1 1/1 1/1),(1/1 1/1 1/1,1/1 1/1 -1/1))" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr a = io::readWkt( "LINESTRING(-1 -1,1 1)" ); + std::unique_ptr b = io::readWkt( "MULTILINESTRING((1/1 -1/1 -1/1,1/1 1/1 1/1),(1/1 1/1 1/1,1/1 1/1 -1/1))" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; } } @@ -312,9 +312,9 @@ BOOST_AUTO_TEST_CASE( GardenFailures4 ) { // infinite loop { - std::auto_ptr a = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); - std::auto_ptr b = io::readWkt( "POLYGON((0 0,10 0,10 0,10 10,0 10,0 0))" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr a = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); + std::unique_ptr b = io::readWkt( "POLYGON((0 0,10 0,10 0,10 10,0 10,0 0))" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; } } @@ -323,9 +323,9 @@ BOOST_AUTO_TEST_CASE( GardenFailures5 ) { // infinite loop { - std::auto_ptr a = io::readWkt( "MULTIPOLYGON(((-3 -1,-1 -1,-1 1,-3 1,-3 -1)),((1 -1,3 -1,3 1,1 1,1 -1)))" ); - std::auto_ptr b = io::readWkt( "MULTIPOLYGON(((-3 -1,-1 -1,-1 1,-3 1,-3 -1)),((1 -1,3 -1,3 1,1 1,1 -1)))" ); - std::auto_ptr u = algorithm::union_( *a, *b ); + std::unique_ptr a = io::readWkt( "MULTIPOLYGON(((-3 -1,-1 -1,-1 1,-3 1,-3 -1)),((1 -1,3 -1,3 1,1 1,1 -1)))" ); + std::unique_ptr b = io::readWkt( "MULTIPOLYGON(((-3 -1,-1 -1,-1 1,-3 1,-3 -1)),((1 -1,3 -1,3 1,1 1,1 -1)))" ); + std::unique_ptr u = algorithm::union_( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; } } @@ -334,24 +334,24 @@ BOOST_AUTO_TEST_CASE( GardenFailures6 ) { // segfault { - std::auto_ptr a = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); - std::auto_ptr b = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0.5 0.5,0.5 -0.5,-0.5 -0.5))" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr a = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1))" ); + std::unique_ptr b = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-0.5 -0.5,-0.5 0.5,0.5 0.5,0.5 -0.5,-0.5 -0.5))" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; } } BOOST_AUTO_TEST_CASE( GardenFailures7 ) { - std::auto_ptr a = io::readWkt( "LINESTRING(-1 -1,1 1)" ); - std::auto_ptr b = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-.5 -.5,-.5 .5,.5 .5,1 -.5,-.5 -.5))" ); - std::auto_ptr u = algorithm::union3D( *a, *b ); + std::unique_ptr a = io::readWkt( "LINESTRING(-1 -1,1 1)" ); + std::unique_ptr b = io::readWkt( "POLYGON((-1 -1,1 -1,1 1,-1 1,-1 -1),(-.5 -.5,-.5 .5,.5 .5,1 -.5,-.5 -.5))" ); + std::unique_ptr u = algorithm::union3D( *a, *b ); DEBUG_OUT << u->asText() <<"\n"; } BOOST_AUTO_TEST_CASE( VolumeVolume ) { - std::auto_ptr a = io::readWkt( + std::unique_ptr a = io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ @@ -361,21 +361,21 @@ BOOST_AUTO_TEST_CASE( VolumeVolume ) { Solid b = a->as(); algorithm::translate( b, 2, 0, 0 ); //disjoined - std::auto_ptr u = algorithm::union3D( *a, b ); + std::unique_ptr u = algorithm::union3D( *a, b ); BOOST_CHECK( u->geometryTypeId() == TYPE_MULTISOLID ); BOOST_CHECK( algorithm::volume( *u ) == 2 ); } { Solid b = a->as(); algorithm::translate( b, .5, 0, 0 ); - std::auto_ptr u = algorithm::union3D( *a, b ); + std::unique_ptr u = algorithm::union3D( *a, b ); BOOST_CHECK( u->geometryTypeId() == TYPE_SOLID ); BOOST_CHECK( algorithm::volume( *u ) == 1.5 ); } { Solid b = a->as(); algorithm::translate( b, 1, 0, 0 ); - std::auto_ptr u = algorithm::union3D( *a, b ); + std::unique_ptr u = algorithm::union3D( *a, b ); BOOST_CHECK( u->geometryTypeId() == TYPE_SOLID ); BOOST_CHECK( algorithm::volume( *u ) == 2 ); } @@ -383,7 +383,7 @@ BOOST_AUTO_TEST_CASE( VolumeVolume ) { Solid b = a->as(); algorithm::translate( b, 1, 1, 0 ); - std::auto_ptr u = algorithm::union3D( *a, b ); + std::unique_ptr u = algorithm::union3D( *a, b ); BOOST_CHECK( u->geometryTypeId() == TYPE_MULTISOLID ); BOOST_CHECK( algorithm::volume( *u ) == 2 ); } @@ -391,7 +391,7 @@ BOOST_AUTO_TEST_CASE( VolumeVolume ) { Solid b = a->as(); algorithm::translate( b, 1, 1, 1 ); // share a corner - std::auto_ptr u = algorithm::union3D( *a, b ); + std::unique_ptr u = algorithm::union3D( *a, b ); BOOST_CHECK( u->geometryTypeId() == TYPE_MULTISOLID ); BOOST_CHECK( algorithm::volume( *u ) == 2 ); } diff --git a/test/unit/SFCGAL/algorithm/VolumeTest.cpp b/test/unit/SFCGAL/algorithm/VolumeTest.cpp index fe600c8f..6feccca3 100644 --- a/test/unit/SFCGAL/algorithm/VolumeTest.cpp +++ b/test/unit/SFCGAL/algorithm/VolumeTest.cpp @@ -33,7 +33,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_algorithm_VolumeTest ) BOOST_AUTO_TEST_CASE( cubeVolume ) { - std::auto_ptr s = io::readWkt( "SOLID((((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),\ + std::unique_ptr s = io::readWkt( "SOLID((((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),\ ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),\ ((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)),\ ((1 0 0,1 1 0,1 1 1,1 0 1,1 0 0)),\ @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE( cubeVolume ) BOOST_AUTO_TEST_CASE( cubeWithHoleVolume ) { - std::auto_ptr s = io::readWkt( + std::unique_ptr s = io::readWkt( "SOLID((((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),\ ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),\ ((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)),\ @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE( cubeWithHoleVolume ) BOOST_AUTO_TEST_CASE( invertedCubeVolume ) { - std::auto_ptr s = io::readWkt( "SOLID((((0 0 0,0 1 0,0 1 1,0 0 1,0 0 0)),\ + std::unique_ptr s = io::readWkt( "SOLID((((0 0 0,0 1 0,0 1 1,0 0 1,0 0 0)),\ ((0 0 0,1 0 0,1 1 0,0 1 0,0 0 0)),\ ((0 0 0,0 0 1,1 0 1,1 0 0,0 0 0)),\ ((1 0 0,1 0 1,1 1 1,1 1 0,1 0 0)),\ diff --git a/test/unit/SFCGAL/capi/sfcgal_cTest.cpp b/test/unit/SFCGAL/capi/sfcgal_cTest.cpp index 594d2a08..1dfa3146 100644 --- a/test/unit/SFCGAL/capi/sfcgal_cTest.cpp +++ b/test/unit/SFCGAL/capi/sfcgal_cTest.cpp @@ -52,8 +52,8 @@ BOOST_AUTO_TEST_CASE( testErrorOnBadGeometryType ) { sfcgal_set_error_handlers( printf, on_error ); - std::auto_ptr l( io::readWkt( "LINESTRING(0 0, 0 1)" ) ); - std::auto_ptr p( io::readWkt( "POINT(0 2)" ) ); + std::unique_ptr l( io::readWkt( "LINESTRING(0 0, 0 1)" ) ); + std::unique_ptr p( io::readWkt( "POINT(0 2)" ) ); sfcgal_geometry_t* gl = l.get(); hasError = false; @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE( testStraightSkeletonPolygon ) { sfcgal_set_error_handlers( printf, on_error ); - std::auto_ptr g( io::readWkt( + std::unique_ptr g( io::readWkt( "POLYGON((0 0, 20 0, 20 10, 0 10, 0 0))" ) ); @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE( testStraightSkeletonMultiPolygon ) { sfcgal_set_error_handlers( printf, on_error ); - std::auto_ptr g( io::readWkt( + std::unique_ptr g( io::readWkt( "MULTIPOLYGON(((0 0, 20 0, 20 10, 0 10, 0 0)),((100 0,200 0,150 100,100 0)))" ) ); @@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE( testApproximateMedialAxis ) { sfcgal_set_error_handlers( printf, on_error ); - std::auto_ptr g( io::readWkt( + std::unique_ptr g( io::readWkt( "POLYGON((-42 9,-44 9,-42 8,-22 7,-22 21,1 22,-5 13,-5 12,-4 13,2 23,-23 22,-23 8,-42 9))" ) ); diff --git a/test/unit/SFCGAL/io/SerializationTest.cpp b/test/unit/SFCGAL/io/SerializationTest.cpp index 5be8ce58..bca05578 100644 --- a/test/unit/SFCGAL/io/SerializationTest.cpp +++ b/test/unit/SFCGAL/io/SerializationTest.cpp @@ -88,17 +88,17 @@ BOOST_AUTO_TEST_CASE( binaryTest ) BOOST_AUTO_TEST_CASE( geometryTest ) { - std::auto_ptr g1 = io::readWkt( "POINT( 3.4 4.5 5.6 )" ); - std::auto_ptr g2 = io::readWkt( "LINESTRING( 3.4 4.5 5.6, 5 6 8 )" ); - std::auto_ptr g3 = io::readWkt( "TRIANGLE(( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0))" ); - std::auto_ptr g4 = io::readWkt( "POLYGON(( 0 0 0, 1 1 1, 3.4 5.6 6.7,2 3 4, 0 0 0))" ); - std::auto_ptr g5 = io::readWkt( "TIN((( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0)), ((0 0 0,0 1 0,1 1 0,0 0 0)))" ); - std::auto_ptr g6 = io::readWkt( "POLYHEDRALSURFACE((( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0)), ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)))" ); - std::auto_ptr g7 = io::readWkt( "SOLID(((( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0)), ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0))))" ); - std::auto_ptr g8 = io::readWkt( "MULTIPOINT(( 3.4 4.5 5.6 ))" ); - std::auto_ptr g9 = io::readWkt( "MULTILINESTRING(( 3.4 4.5 5.6, 5 6 8 ))" ); - std::auto_ptr g10 = io::readWkt( "MULTIPOLYGON((( 0 0 0, 1 1 1, 3.4 5.6 6.7,2 3 4, 0 0 0)))" ); - std::auto_ptr g11 = io::readWkt( "MULTISOLID((((( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0)), ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)))))" ); + std::unique_ptr g1 = io::readWkt( "POINT( 3.4 4.5 5.6 )" ); + std::unique_ptr g2 = io::readWkt( "LINESTRING( 3.4 4.5 5.6, 5 6 8 )" ); + std::unique_ptr g3 = io::readWkt( "TRIANGLE(( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0))" ); + std::unique_ptr g4 = io::readWkt( "POLYGON(( 0 0 0, 1 1 1, 3.4 5.6 6.7,2 3 4, 0 0 0))" ); + std::unique_ptr g5 = io::readWkt( "TIN((( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0)), ((0 0 0,0 1 0,1 1 0,0 0 0)))" ); + std::unique_ptr g6 = io::readWkt( "POLYHEDRALSURFACE((( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0)), ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)))" ); + std::unique_ptr g7 = io::readWkt( "SOLID(((( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0)), ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0))))" ); + std::unique_ptr g8 = io::readWkt( "MULTIPOINT(( 3.4 4.5 5.6 ))" ); + std::unique_ptr g9 = io::readWkt( "MULTILINESTRING(( 3.4 4.5 5.6, 5 6 8 ))" ); + std::unique_ptr g10 = io::readWkt( "MULTIPOLYGON((( 0 0 0, 1 1 1, 3.4 5.6 6.7,2 3 4, 0 0 0)))" ); + std::unique_ptr g11 = io::readWkt( "MULTISOLID((((( 0 0 0, 3.4 5.6 6.7,2 3 4, 0 0 0)), ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)))))" ); BOOST_CHECK( io::readBinaryGeometry( io::writeBinaryGeometry( *g1 ) )->asText() == g1->asText() ); BOOST_CHECK( io::readBinaryGeometry( io::writeBinaryGeometry( *g2 ) )->asText() == g2->asText() ); @@ -116,13 +116,13 @@ BOOST_AUTO_TEST_CASE( geometryTest ) BOOST_AUTO_TEST_CASE( caseTest ) { - std::auto_ptr g1 = io::readWkt( "PoInT( 3.4 4.5 5.6 )" ); + std::unique_ptr g1 = io::readWkt( "PoInT( 3.4 4.5 5.6 )" ); BOOST_CHECK( io::readBinaryGeometry( io::writeBinaryGeometry( *g1 ) )->asText() == g1->asText() ); } BOOST_AUTO_TEST_CASE( extBinaryTest ) { - std::auto_ptr ng1 = io::readWkt( "POLYGON((9.70065196277574 -2.37991360574961,3.74221071600914 5.33515858836472,-4.30443822173402 -2.37991360574961,3.74221071600914 -12.1891073728912,9.70065196277574 -2.37991360574961))" ); + std::unique_ptr ng1 = io::readWkt( "POLYGON((9.70065196277574 -2.37991360574961,3.74221071600914 5.33515858836472,-4.30443822173402 -2.37991360574961,3.74221071600914 -12.1891073728912,9.70065196277574 -2.37991360574961))" ); SFCGAL::Geometry* mg1 = ng1.release(); SFCGAL::Geometry* ng2; @@ -142,9 +142,9 @@ BOOST_AUTO_TEST_CASE( extBinaryTest ) BOOST_AUTO_TEST_CASE( preparedGeometryTest ) { - std::auto_ptr g1 = io::readEwkt( "POINT( 3.4 4.5 5.6 )" ); - std::auto_ptr g2 = io::readEwkt( "srid=0;POINT( 3.4 4.5 5.6 )" ); - std::auto_ptr g3 = io::readEwkt( "srid=4326;POINT( 3.4 4.5 5.6 )" ); + std::unique_ptr g1 = io::readEwkt( "POINT( 3.4 4.5 5.6 )" ); + std::unique_ptr g2 = io::readEwkt( "srid=0;POINT( 3.4 4.5 5.6 )" ); + std::unique_ptr g3 = io::readEwkt( "srid=4326;POINT( 3.4 4.5 5.6 )" ); BOOST_CHECK( io::readBinaryPrepared( io::writeBinaryPrepared( *g1 ) )->asEWKT() == g1->asEWKT() ); BOOST_CHECK( io::readBinaryPrepared( io::writeBinaryPrepared( *g2 ) )->asEWKT() == g2->asEWKT() ); diff --git a/test/unit/SFCGAL/io/WktReaderTest.cpp b/test/unit/SFCGAL/io/WktReaderTest.cpp index cac47533..9a12f921 100644 --- a/test/unit/SFCGAL/io/WktReaderTest.cpp +++ b/test/unit/SFCGAL/io/WktReaderTest.cpp @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_io_WktReaderTest ) BOOST_AUTO_TEST_CASE( pointEmpty ) { - std::auto_ptr< Geometry > g( readWkt( "POINT EMPTY" ) ); + std::unique_ptr< Geometry > g( readWkt( "POINT EMPTY" ) ); BOOST_CHECK( g->is< Point >() ); BOOST_CHECK( g->isEmpty() ); } @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE( pointEmpty ) BOOST_AUTO_TEST_CASE( pointXY ) { - std::auto_ptr< Geometry > g( readWkt( "POINT(4.0 6.0)" ) ); + std::unique_ptr< Geometry > g( readWkt( "POINT(4.0 6.0)" ) ); BOOST_CHECK( g->is< Point >() ); BOOST_CHECK( ! g->isEmpty() ); @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE( pointXY ) BOOST_AUTO_TEST_CASE( pointXYZ_implicit ) { - std::auto_ptr< Geometry > g( readWkt( "POINT(4.0 5.0 6.0)" ) ); + std::unique_ptr< Geometry > g( readWkt( "POINT(4.0 5.0 6.0)" ) ); BOOST_CHECK( g->is< Point >() ); BOOST_CHECK( ! g->isEmpty() ); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE( pointXYZ_implicit ) BOOST_AUTO_TEST_CASE( pointXYZ_explicit ) { - std::auto_ptr< Geometry > g( readWkt( "POINT Z(4.0 5.0 6.0)" ) ); + std::unique_ptr< Geometry > g( readWkt( "POINT Z(4.0 5.0 6.0)" ) ); BOOST_CHECK( g->is< Point >() ); BOOST_CHECK( ! g->isEmpty() ); @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE( pointXYZ_explicit ) BOOST_AUTO_TEST_CASE( pointXYM_explicit ) { - std::auto_ptr< Geometry > g( readWkt( "POINT M(4.0 5.0 6.0)" ) ); + std::unique_ptr< Geometry > g( readWkt( "POINT M(4.0 5.0 6.0)" ) ); BOOST_CHECK( g->is< Point >() ); BOOST_CHECK( ! g->isEmpty() ); @@ -111,14 +111,14 @@ BOOST_AUTO_TEST_CASE( pointXYM_explicit ) BOOST_AUTO_TEST_CASE( lineStringEmpty ) { - std::auto_ptr< Geometry > g( readWkt( "LINESTRING EMPTY" ) ); + std::unique_ptr< Geometry > g( readWkt( "LINESTRING EMPTY" ) ); BOOST_CHECK( g->is< LineString >() ); BOOST_CHECK( g->isEmpty() ); } BOOST_AUTO_TEST_CASE( lineString_twoPoints ) { - std::auto_ptr< Geometry > g( readWkt( "LINESTRING(0.0 0.0,1.0 1.0)" ) ); + std::unique_ptr< Geometry > g( readWkt( "LINESTRING(0.0 0.0,1.0 1.0)" ) ); BOOST_CHECK( g->is< LineString >() ); BOOST_CHECK( ! g->isEmpty() ); BOOST_CHECK_EQUAL( g->as< LineString >().numPoints(), 2U ); @@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE( lineString_twoPoints ) BOOST_AUTO_TEST_CASE( lineString_twoPoints3D ) { - std::auto_ptr< Geometry > g( readWkt( "LINESTRING(0.0 0.0 0.0,1.0 1.0 1.0)" ) ); + std::unique_ptr< Geometry > g( readWkt( "LINESTRING(0.0 0.0 0.0,1.0 1.0 1.0)" ) ); BOOST_CHECK( g->is< LineString >() ); BOOST_CHECK( ! g->isEmpty() ); BOOST_REQUIRE_EQUAL( g->as< LineString >().numPoints(), 2U ); @@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE( lineString_twoPoints3D ) BOOST_AUTO_TEST_CASE( polygonEmpty ) { - std::auto_ptr< Geometry > g( readWkt( "POLYGON EMPTY" ) ); + std::unique_ptr< Geometry > g( readWkt( "POLYGON EMPTY" ) ); BOOST_CHECK( g->is< Polygon >() ); BOOST_CHECK( g->isEmpty() ); } @@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE( polygonEmpty ) // 4 points polygon (triangle) BOOST_AUTO_TEST_CASE( polygonWithFourPoints ) { - std::auto_ptr< Geometry > g( readWkt( "POLYGON((0 0,1 0,1 1,0 0))" ) ); + std::unique_ptr< Geometry > g( readWkt( "POLYGON((0 0,1 0,1 1,0 0))" ) ); BOOST_CHECK( g->is< Polygon >() ); BOOST_CHECK( ! g->isEmpty() ); BOOST_CHECK_EQUAL( g->as< Polygon >().exteriorRing().numPoints(), 4U ); @@ -161,14 +161,14 @@ BOOST_AUTO_TEST_CASE( polygonWithFourPoints ) BOOST_AUTO_TEST_CASE( multiPointEmpty ) { - std::auto_ptr< Geometry > g( readWkt( "MULTIPOINT EMPTY" ) ); + std::unique_ptr< Geometry > g( readWkt( "MULTIPOINT EMPTY" ) ); BOOST_CHECK( g->is< MultiPoint >() ); BOOST_CHECK( g->isEmpty() ); } BOOST_AUTO_TEST_CASE( multiPointEmpty2 ) { - std::auto_ptr< Geometry > g( readWkt( "MULTIPOINT(0 0,1 1,EMPTY)" ) ); + std::unique_ptr< Geometry > g( readWkt( "MULTIPOINT(0 0,1 1,EMPTY)" ) ); BOOST_CHECK( g->asText() == "MULTIPOINT((0/1 0/1),(1/1 1/1))" ); BOOST_CHECK( g->is< MultiPoint >() ); BOOST_CHECK( g->numGeometries() == 2 ); @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE( multiPointEmpty2 ) BOOST_AUTO_TEST_CASE( multiPointEmpty3 ) { - std::auto_ptr< Geometry > g( readWkt( "MULTIPOINT(EMPTY,EMPTY)" ) ); + std::unique_ptr< Geometry > g( readWkt( "MULTIPOINT(EMPTY,EMPTY)" ) ); BOOST_CHECK( g->asText() == "MULTIPOINT EMPTY" ); BOOST_CHECK( g->is< MultiPoint >() ); BOOST_CHECK( g->isEmpty() ); @@ -186,7 +186,7 @@ BOOST_AUTO_TEST_CASE( multiPointEmpty3 ) BOOST_AUTO_TEST_CASE( multiLineStringEmpty ) { - std::auto_ptr< Geometry > g( readWkt( "MULTILINESTRING EMPTY" ) ); + std::unique_ptr< Geometry > g( readWkt( "MULTILINESTRING EMPTY" ) ); BOOST_CHECK( g->is< MultiLineString >() ); BOOST_CHECK( g->isEmpty() ); } @@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE( multiLineStringEmpty ) BOOST_AUTO_TEST_CASE( multiPolygonEmpty ) { - std::auto_ptr< Geometry > g( readWkt( "MULTIPOLYGON EMPTY" ) ); + std::unique_ptr< Geometry > g( readWkt( "MULTIPOLYGON EMPTY" ) ); BOOST_CHECK( g->is< MultiPolygon >() ); BOOST_CHECK( g->isEmpty() ); } @@ -207,7 +207,7 @@ BOOST_AUTO_TEST_CASE( multiPolygonEmpty ) BOOST_AUTO_TEST_CASE( geometryCollectionEmpty ) { - std::auto_ptr< Geometry > g( readWkt( "GEOMETRYCOLLECTION EMPTY" ) ); + std::unique_ptr< Geometry > g( readWkt( "GEOMETRYCOLLECTION EMPTY" ) ); BOOST_CHECK( g->is< GeometryCollection >() ); BOOST_CHECK( g->isEmpty() ); } @@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE( geometryCollectionEmpty ) BOOST_AUTO_TEST_CASE( triangulatedSurface_Empty ) { - std::auto_ptr< Geometry > g( readWkt( "TIN EMPTY" ) ); + std::unique_ptr< Geometry > g( readWkt( "TIN EMPTY" ) ); BOOST_CHECK( g->is< TriangulatedSurface >() ); BOOST_CHECK( g->isEmpty() ); } @@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE( triangulatedSurface_fourTriangles ) "((0 0 0, 1 0 0, 0 0 1, 0 0 0))," "((1 0 0, 0 1 0, 0 0 1, 1 0 0))" ")"; - std::auto_ptr< Geometry > g( readWkt( wkt ) ); + std::unique_ptr< Geometry > g( readWkt( wkt ) ); BOOST_CHECK( g->is< TriangulatedSurface >() ); BOOST_CHECK( ! g->isEmpty() ); @@ -240,7 +240,7 @@ BOOST_AUTO_TEST_CASE( triangulatedSurface_fourTriangles ) BOOST_AUTO_TEST_CASE( wkt_exactTest ) { - std::auto_ptr< Geometry > g( readWkt( "LINESTRING(2/3 3/2,5/4 2/3)" ) ); + std::unique_ptr< Geometry > g( readWkt( "LINESTRING(2/3 3/2,5/4 2/3)" ) ); BOOST_CHECK( g->is< LineString >() ); BOOST_CHECK( ! g->isEmpty() ); BOOST_REQUIRE_EQUAL( g->as< LineString >().numPoints(), 2U ); @@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE( wkt_exactTest ) BOOST_AUTO_TEST_CASE( charArrayRead ) { char str[] = "LINESTRING(0.0 0.0,1.0 1.0)"; - std::auto_ptr< Geometry > g( readWkt( str, strlen( str ) ) ); + std::unique_ptr< Geometry > g( readWkt( str, strlen( str ) ) ); BOOST_CHECK( g->is< LineString >() ); BOOST_CHECK( ! g->isEmpty() ); BOOST_CHECK_EQUAL( g->as< LineString >().numPoints(), 2U ); @@ -272,7 +272,7 @@ BOOST_AUTO_TEST_CASE( wktExtraCharacters ) bool threw = false; try { - std::auto_ptr< Geometry > g( readWkt( "POINT(0 0)POINT(1 0)" ) ); + std::unique_ptr< Geometry > g( readWkt( "POINT(0 0)POINT(1 0)" ) ); } catch ( WktParseException& e ) { @@ -286,7 +286,7 @@ BOOST_AUTO_TEST_CASE( wktExtraCharacters ) try { char str[] = "POINT(0 0)POINT(1 0)"; - std::auto_ptr< Geometry > g( readWkt( str, strlen( str ) ) ); + std::unique_ptr< Geometry > g( readWkt( str, strlen( str ) ) ); } catch ( WktParseException& e ) { diff --git a/test/unit/SFCGAL/transform/ForceZOrderPointsTest.cpp b/test/unit/SFCGAL/transform/ForceZOrderPointsTest.cpp index da6866b1..779506e4 100644 --- a/test/unit/SFCGAL/transform/ForceZOrderPointsTest.cpp +++ b/test/unit/SFCGAL/transform/ForceZOrderPointsTest.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_transform_ForceZOrderPointsTest ) BOOST_AUTO_TEST_CASE( simple ) { - std::auto_ptr g1 = io::readWkt( "POLYGON((0 0,0 1,1 1,1 0,0 0))" ); + std::unique_ptr g1 = io::readWkt( "POLYGON((0 0,0 1,1 1,1 0,0 0))" ); const Polygon& p = g1->as(); BOOST_CHECK( ! p.isCounterClockWiseOriented() ); diff --git a/test/unit/SFCGAL/transform/RoundTest.cpp b/test/unit/SFCGAL/transform/RoundTest.cpp index b5a4aa12..cbd88c8e 100644 --- a/test/unit/SFCGAL/transform/RoundTest.cpp +++ b/test/unit/SFCGAL/transform/RoundTest.cpp @@ -40,14 +40,14 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_CoordinateTest ) BOOST_AUTO_TEST_CASE( testRoundPoint ) { - std::auto_ptr< Geometry > g( io::readWkt( "POINT(1.5 2.6 3.4)" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "POINT(1.5 2.6 3.4)" ) ); g->round(); BOOST_CHECK_EQUAL( g->asText(), "POINT(2/1 3/1 3/1)" ); } BOOST_AUTO_TEST_CASE( testRoundLineString ) { - std::auto_ptr< Geometry > g( io::readWkt( "LINESTRING(0.5 0.5,1.5 1.5)" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "LINESTRING(0.5 0.5,1.5 1.5)" ) ); g->round( 10 ); BOOST_CHECK_EQUAL( g->asText(), "LINESTRING(1/2 1/2,3/2 3/2)" ); } diff --git a/test/unit/SFCGAL/triangulate/Triangulate2DZTest.cpp b/test/unit/SFCGAL/triangulate/Triangulate2DZTest.cpp index 6eb1fe07..c726077f 100644 --- a/test/unit/SFCGAL/triangulate/Triangulate2DZTest.cpp +++ b/test/unit/SFCGAL/triangulate/Triangulate2DZTest.cpp @@ -31,7 +31,7 @@ BOOST_AUTO_TEST_SUITE( SFCGAL_triangulate_Triangulate2DZTest ) BOOST_AUTO_TEST_CASE( testPoint ) { - std::auto_ptr< Geometry > g( io::readWkt( "POINT(1.0 2.0 3.0)" ) ) ; + std::unique_ptr< Geometry > g( io::readWkt( "POINT(1.0 2.0 3.0)" ) ) ; ConstraintDelaunayTriangulation triangulation = triangulate2DZ( *g ); BOOST_CHECK_EQUAL( triangulation.numVertices(), 1U ); BOOST_CHECK_EQUAL( triangulation.numTriangles(), 0U ); @@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE( testPoint ) BOOST_AUTO_TEST_CASE( testLineString ) { - std::auto_ptr< Geometry > g( io::readWkt( "LINESTRING(0.0 0.0,1.0 0.0,1.0 1.0,2.0 1.0)" ) ) ; + std::unique_ptr< Geometry > g( io::readWkt( "LINESTRING(0.0 0.0,1.0 0.0,1.0 1.0,2.0 1.0)" ) ) ; ConstraintDelaunayTriangulation triangulation = triangulate2DZ( *g ); BOOST_CHECK_EQUAL( triangulation.numVertices(), 4U ); BOOST_CHECK_EQUAL( triangulation.numTriangles(), 2U ); @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE( testLineString ) BOOST_AUTO_TEST_CASE( testPolygonWithHole ) { - std::auto_ptr< Geometry > g( io::readWkt( "POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,0.0 1.0,0.0 0.0),(0.2 0.2,0.2 0.8,0.8 0.8,0.8 0.2,0.2 0.2))" ) ) ; + std::unique_ptr< Geometry > g( io::readWkt( "POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,0.0 1.0,0.0 0.0),(0.2 0.2,0.2 0.8,0.8 0.8,0.8 0.2,0.2 0.2))" ) ) ; ConstraintDelaunayTriangulation triangulation = triangulate2DZ( *g ); BOOST_CHECK_EQUAL( triangulation.numVertices(), 8U ); BOOST_CHECK_EQUAL( triangulation.numTriangles(), 10U ); @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE( testPolygonWithHole ) BOOST_AUTO_TEST_CASE( testMultiPoint ) { - std::auto_ptr< Geometry > g( io::readWkt( "MULTIPOINT((1.0 2.0 3.0),(2.0 3.0 6.0),(8.0 6.0 7.0),(2.0 1.0 6.0))" ) ) ; + std::unique_ptr< Geometry > g( io::readWkt( "MULTIPOINT((1.0 2.0 3.0),(2.0 3.0 6.0),(8.0 6.0 7.0),(2.0 1.0 6.0))" ) ) ; ConstraintDelaunayTriangulation triangulation = triangulate2DZ( *g ); BOOST_CHECK_EQUAL( triangulation.numVertices(), 4U ); BOOST_CHECK_EQUAL( triangulation.numTriangles(), 2U ); @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE( testMultiPoint ) //GeometryCollection BOOST_AUTO_TEST_CASE( testMultiPolygon ) { - std::auto_ptr< Geometry > g( io::readWkt( "GEOMETRYCOLLECTION(LINESTRING(-1.52451708766716 0.583952451708767,-1.5408618127786 0.361069836552749,-1.47251114413076 0.317979197622586,-1.30163447251114 0.398216939078752,-1.32095096582467 0.482912332838039,-1.08320950965825 0.598811292719168,-0.809806835066865 0.570579494799406,-0.517087667161962 0.662704309063893),POLYGON((-1.46508172362556 0.615156017830609,-1.35215453194651 0.806835066864785,-1.08320950965825 0.754829123328381,-1.10401188707281 0.630014858841011,-1.2407132243685 0.557206537890045,-1.46508172362556 0.615156017830609)),POLYGON((-1.2778603268945 0.316493313521545,-0.925705794947994 0.540861812778603,-0.557206537890045 0.37444279346211,-1.09806835066865 0.0267459138187223,-1.2927191679049 0.197622585438336,-1.2778603268945 0.316493313521545),(-0.922734026745914 0.448736998514116,-1.03566121842496 0.393759286775632,-1.0297176820208 0.329866270430907,-0.87369985141159 0.286775631500743,-0.739970282317979 0.332838038632987,-0.922734026745914 0.448736998514116),(-1.12778603268945 0.295690936106984,-1.21545319465082 0.280832095096583,-1.23476968796434 0.225854383358098,-1.14858841010401 0.184249628528975,-1.0520059435364 0.210995542347697,-1.12778603268945 0.295690936106984)),POINT(-1.22288261515602 0.438335809806835),POINT(-1.1887072808321 0.24962852897474),POINT(-1.09658246656761 0.526002971768202),POINT(-0.967310549777118 0.225854383358098),POINT(-0.936106983655275 0.472511144130758),POINT(-0.882615156017831 0.335809806835067),POINT(-0.821693907875186 0.607726597325409),POINT(-0.708766716196137 0.243684992570579),POINT(-0.643387815750372 0.471025260029718),POINT(-0.632986627043091 0.674591381872214),POINT(-0.476968796433878 0.242199108469539),POINT(-0.456166419019317 0.573551263001486),POINT(-0.349182763744428 0.386329866270431))" ) ); + std::unique_ptr< Geometry > g( io::readWkt( "GEOMETRYCOLLECTION(LINESTRING(-1.52451708766716 0.583952451708767,-1.5408618127786 0.361069836552749,-1.47251114413076 0.317979197622586,-1.30163447251114 0.398216939078752,-1.32095096582467 0.482912332838039,-1.08320950965825 0.598811292719168,-0.809806835066865 0.570579494799406,-0.517087667161962 0.662704309063893),POLYGON((-1.46508172362556 0.615156017830609,-1.35215453194651 0.806835066864785,-1.08320950965825 0.754829123328381,-1.10401188707281 0.630014858841011,-1.2407132243685 0.557206537890045,-1.46508172362556 0.615156017830609)),POLYGON((-1.2778603268945 0.316493313521545,-0.925705794947994 0.540861812778603,-0.557206537890045 0.37444279346211,-1.09806835066865 0.0267459138187223,-1.2927191679049 0.197622585438336,-1.2778603268945 0.316493313521545),(-0.922734026745914 0.448736998514116,-1.03566121842496 0.393759286775632,-1.0297176820208 0.329866270430907,-0.87369985141159 0.286775631500743,-0.739970282317979 0.332838038632987,-0.922734026745914 0.448736998514116),(-1.12778603268945 0.295690936106984,-1.21545319465082 0.280832095096583,-1.23476968796434 0.225854383358098,-1.14858841010401 0.184249628528975,-1.0520059435364 0.210995542347697,-1.12778603268945 0.295690936106984)),POINT(-1.22288261515602 0.438335809806835),POINT(-1.1887072808321 0.24962852897474),POINT(-1.09658246656761 0.526002971768202),POINT(-0.967310549777118 0.225854383358098),POINT(-0.936106983655275 0.472511144130758),POINT(-0.882615156017831 0.335809806835067),POINT(-0.821693907875186 0.607726597325409),POINT(-0.708766716196137 0.243684992570579),POINT(-0.643387815750372 0.471025260029718),POINT(-0.632986627043091 0.674591381872214),POINT(-0.476968796433878 0.242199108469539),POINT(-0.456166419019317 0.573551263001486),POINT(-0.349182763744428 0.386329866270431))" ) ); ConstraintDelaunayTriangulation triangulation = triangulate2DZ( *g ); BOOST_CHECK_EQUAL( triangulation.numVertices(), 41U ); BOOST_CHECK_EQUAL( triangulation.numTriangles(), 72U ); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE( testMultiPolygon ) BOOST_AUTO_TEST_CASE( testSolid ) { - std::auto_ptr< Geometry > g( io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ + std::unique_ptr< Geometry > g( io::readWkt( "SOLID((((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),\ ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),\ ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),\ ((1 1 1, 0 1 1, 0 0 1, 1 0 1, 1 1 1)),\ From 81b23615788f5a36ab0b1df4db37d73fc1616785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 5 Nov 2019 09:27:34 +0100 Subject: [PATCH 2/2] make it compatible with CGAL 5.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57fc3143..dfc9784d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ endif() # 4.3 minimal # 4.13 recommended -find_package( CGAL 4.3 COMPONENTS Core REQUIRED ) +find_package( CGAL COMPONENTS Core REQUIRED ) message( STATUS "CGAL ${CGAL_VERSION} found" ) include_directories( ${CMAKE_BINARY_DIR}/include )