diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_with_holes_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_with_holes_2.h deleted file mode 100644 index 0e51813e776..00000000000 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_with_holes_2.h +++ /dev/null @@ -1,71 +0,0 @@ - -namespace CGAL { - -/*! -\ingroup PkgBooleanSetOperations2 - -\cgalModels `GeneralPolygonWithHoles_2` - -*/ -template< typename Polygon > -class General_polygon_with_holes_2 { -public: - -/// \name Definition -/// The class `General_polygon_with_holes_2` models the concept -/// `GeneralPolygonWithHoles_2`. It represents a general polygon with -/// holes. It is parameterized with a type `Polygon` used to define -/// the exposed type `General_polygon_2`. This type represents the -/// outer boundary of the general polygon and the outer boundaries of -/// each hole. -/// @{ - -/*! - -*/ -typedef Polygon General_polygon_2; - -/// @} - -}; /* end General_polygon_with_holes_2 */ - -/*! -This operator imports a General_polygon_with_holes_2 from the input stream `in`. - -An ASCII and a binary format exist. The stream detects the format -automatically and can read both. - -The format consists of the number of curves of the outer boundary -followed by the curves themselves in counterclockwise order, followed -by the number of holes, and for each hole, the number of curves on its -outer boundary is followed by the curves themselves in clockwise -order. - -\relates General_polygon_with_holes_2 -*/ -template -std::istream& operator>>(std::istream& in, CGAL::General_polygon_with_holes_2& P); - - -/*! -This operator exports a General_polygon_with_holes_2 to the output stream `out`. - -An ASCII and a binary format exist. The format can be selected with -the \cgal modifiers for streams, `set_ascii_mode(0` and `set_binary_mode()` -respectively. The modifier `set_pretty_mode()` can be used to allow for (a -few) structuring comments in the output. Otherwise, the output would -be free of comments. The default for writing is ASCII without -comments. - -The number of curves of the outer boundary is exported followed by the -curves themselves in counterclockwise order. Then, the number of holes -is exported, and for each hole, the number of curves on its outer -boundary is exported followed by the curves themselves in clockwise -order. - -\relates General_polygon_with_holes_2 -*/ -template -std::ostream& operator<<(std::ostream& out, CGAL::General_polygon_with_holes_2& P); - -} /* end namespace CGAL */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Polygon_with_holes_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Polygon_with_holes_2.h deleted file mode 100644 index 473a24a18a9..00000000000 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Polygon_with_holes_2.h +++ /dev/null @@ -1,62 +0,0 @@ - -namespace CGAL { - -/*! -\ingroup PkgBooleanSetOperations2 - -The class `Polygon_with_holes_2` models the concept `GeneralPolygonWithHoles_2`. -It represents a linear polygon with holes. It is parameterized with two -types (`Kernel` and `Container`) that are used to instantiate -the type `Polygon_2`. The latter is used to -represents the outer boundary and the boundary of the holes (if any exist). - -\cgalModels `GeneralPolygonWithHoles_2` - -*/ -template< typename Kernel, typename Container > -class Polygon_with_holes_2 { -public: - -/// @} - -}; /* end Polygon_with_holes_2 */ - -/*! -This operator imports a polygon with holes from the input stream `in`. - -An ASCII and a binary format exist. The stream detects the format -automatically and can read both. - -The format consists of the number of points of the outer boundary followed -by the points themselves in counterclockwise order, followed by the number of holes, -and for each hole, the number of points of the outer boundary is followed -by the points themselves in clockwise order. - -\relates Polygon_with_holes_2 -*/ -template -std::istream& operator>>(std::istream& in, CGAL::Polygon_with_holes_2& P); - - -/*! -This operator exports a polygon with holes to the output stream `out`. - -An ASCII and a binary format exist. The format can be selected with -the \cgal modifiers for streams, `set_ascii_mode()` and `set_binary_mode()` -respectively. The modifier `set_pretty_mode()` can be used to allow for (a -few) structuring comments in the output. Otherwise, the output would -be free of comments. The default for writing is ASCII without -comments. - -The number of points of the outer boundary is exported followed by the -points themselves in counterclockwise order. Then, the number of holes -is exported, and for each hole, the number of points on its outer -boundary is exported followed by the points themselves in clockwise -order. - -\relates Polygon_with_holes_2 -*/ -template -std::ostream& operator<<(std::ostream& out, CGAL::Polygon_with_holes_2& P); - -} /* end namespace CGAL */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonWithHoles_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonWithHoles_2.h deleted file mode 100644 index 6a6b00fc845..00000000000 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonWithHoles_2.h +++ /dev/null @@ -1,110 +0,0 @@ - -/*! -\ingroup PkgBooleanSetOperations2Concepts -\cgalConcept - -\cgalRefines `GpsTraitsGeneralPolygonWithHoles_2` - -A model of this concept represents a general polygon with holes. The -concept requires the ability to access the general polygon that -represents the outer boundary and the general polygons that represent -the holes. - -\cgalHasModel `CGAL::General_polygon_with_holes_2` -\cgalHasModel `CGAL::Polygon_with_holes_2` -\cgalHasModel `CGAL::Gps_circle_segment_traits_2::%Polygon_with_holes_2` -\cgalHasModel `CGAL::Gps_traits_2::%Polygon_with_holes_2` - -*/ - -class GeneralPolygonWithHoles_2 { -public: - -/// \name Types -/// @{ - -/*! -the general-polygon type used to -represent the outer boundary and each hole. Must model the `GeneralPolygon_2` concept. -*/ -typedef unspecified_type General_polygon_2; - -/*! -a bidirectional iterator -over the polygonal holes. Its value type is -`General_polygon_2`. -*/ -typedef unspecified_type Hole_const_iterator; - -/// @} - -/// \name Creation -/// @{ - -/*! -default constructor. -*/ -GeneralPolygonWithHoles_2(); - -/*! -copy constructor. -*/ -GeneralPolygonWithHoles_2(GeneralPolygonWithHoles_2 other); - -/*! -assignment operator. -*/ -GeneralPolygonWithHoles_2 operator=(other); - -/*! -constructs a general polygon with holes that has no holes using a given general polygon `outer` as the outer boundary. -*/ -GeneralPolygonWithHoles_2(General_polygon_2 & outer); - -/*! -constructs a general polygon with holes using a given general polygon -`outer` as the outer boundary and a given range of holes. If `outer` -is an empty general polygon, then an unbounded polygon with holes will be -created. The holes must be contained inside the outer boundary, and the -polygons representing the holes must be simple and pairwise disjoint, except -perhaps at the vertices. -*/ -template -GeneralPolygonWithHoles_2(General_polygon_2 & outer, -InputIterator begin, InputIterator end); - -/// @} - -/// \name Predicates -/// @{ - -/*! -returns `true` if the outer boundary is empty, and `false` -otherwise. -*/ -bool is_unbounded(); - -/// @} - -/// \name Access Functions -/// @{ - -/*! -returns the general polygon that represents the outer boundary. Note that this polygon is not necessarily a valid (simple) general polygon because it may be relatively simple. -*/ -const General_polygon_2 & outer_boundary() const; - -/*! -returns the begin iterator of the holes. -*/ -Hole_const_iterator holes_begin() const; - -/*! -returns the past-the-end iterator of the holes. -*/ -Hole_const_iterator holes_end() const; - -/// @} - -}; /* end GeneralPolygonWithHoles_2 */ - diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt b/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt index 04628f3aa0e..c9570ed6982 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt @@ -37,7 +37,6 @@ containment predicates. - `GpsTraitsGeneralPolygon_2` - `GpsTraitsGeneralPolygonWithHoles_2` - `GeneralPolygon_2` -- `GeneralPolygonWithHoles_2` - `ArrangementDirectionalXMonotoneTraits_2` - `GeneralPolygonSetTraits_2` - `GeneralPolygonSetDcel` @@ -45,7 +44,6 @@ containment predicates. - `GeneralPolygonSetDcelHalfedge` ## Classes ## -- `CGAL::Polygon_with_holes_2` - `CGAL::Polygon_set_2` - `CGAL::General_polygon_set_2` - `CGAL::General_polygon_2` @@ -64,8 +62,5 @@ containment predicates. - \link boolean_symmetric_difference `CGAL::symmetric_difference()` \endlink - \link boolean_oriented_side `CGAL::oriented_side()` \endlink - \link boolean_connect_holes `CGAL::connect_holes()` \endlink -- `operator<<()` for `CGAL::Polygon_with_holes_2`, `CGAL::General_polygon_2` and `CGAL::General_polygon_with_holes_2` -- `operator>>()` for `CGAL::Polygon_with_holes_2`, `CGAL::General_polygon_2` and `CGAL::General_polygon_with_holes_2` - */ diff --git a/Polygon/doc/Polygon/Concepts/GeneralPolygonWithHoles_2.h b/Polygon/doc/Polygon/Concepts/GeneralPolygonWithHoles_2.h new file mode 100644 index 00000000000..6291a2bb62b --- /dev/null +++ b/Polygon/doc/Polygon/Concepts/GeneralPolygonWithHoles_2.h @@ -0,0 +1,90 @@ + +/*! +\ingroup PkgPolygon2Concepts +\cgalConcept + +\cgalRefines `DefaultConstructible` +\cgalRefines `CopyConstructible` +\cgalRefines `Assignable` + + +A model of this concept represents a general polygon with holes. The +concept requires the ability to access the general polygon that +represents the outer boundary and the general polygons that represent +the holes. + +\cgalHasModel `CGAL::General_polygon_with_holes_2` +\cgalHasModel `CGAL::Polygon_with_holes_2` + +*/ + +class GeneralPolygonWithHoles_2 { +public: + +/// \name Types +/// @{ + +/*! +the general-polygon type used to represent the outer boundary and each hole. +*/ +typedef unspecified_type General_polygon_2; + +/*! +a bidirectional iterator +over the polygonal holes. Its value type is +`General_polygon_2`. +*/ +typedef unspecified_type Hole_const_iterator; + +/// @} + +/// \name Creation +/// @{ + +/*! +constructs a general polygon with holes using a given general polygon +`outer` as the outer boundary and a given range of holes. If `outer` +is an empty general polygon, then an unbounded polygon with holes will be +created. The holes must be contained inside the outer boundary, and the +polygons representing the holes must be simple and pairwise disjoint, except +perhaps at the vertices. +*/ +template +GeneralPolygonWithHoles_2(General_polygon_2 & outer, +InputIterator begin, InputIterator end); + +/// @} + +/// \name Predicates +/// @{ + +/*! +returns `true` if the outer boundary is empty, and `false` +otherwise. +*/ +bool is_unbounded(); + +/// @} + +/// \name Access Functions +/// @{ + +/*! +returns the general polygon that represents the outer boundary. Note that this polygon is not necessarily a valid (simple) general polygon because it may be relatively simple. +*/ +const General_polygon_2 & outer_boundary() const; + +/*! +returns the begin iterator of the holes. +*/ +Hole_const_iterator holes_begin() const; + +/*! +returns the past-the-end iterator of the holes. +*/ +Hole_const_iterator holes_end() const; + +/// @} + +}; /* end GeneralPolygonWithHoles_2 */ + diff --git a/Polygon/doc/Polygon/PackageDescription.txt b/Polygon/doc/Polygon/PackageDescription.txt index 058d913b32a..bc26a7e109c 100644 --- a/Polygon/doc/Polygon/PackageDescription.txt +++ b/Polygon/doc/Polygon/PackageDescription.txt @@ -33,9 +33,11 @@ The assertion flags for the polygons and polygon operations use ## Concepts ## - `PolygonTraits_2` +- `GeneralPolygonWithHoles_2` ## Classes ## - `CGAL::Polygon_2` +- `CGAL::Polygon_with_holes_2` ## Global Functions ## - `CGAL::area_2()` diff --git a/Boolean_set_operations_2/include/CGAL/General_polygon_with_holes_2.h b/Polygon/include/CGAL/General_polygon_with_holes_2.h similarity index 63% rename from Boolean_set_operations_2/include/CGAL/General_polygon_with_holes_2.h rename to Polygon/include/CGAL/General_polygon_with_holes_2.h index 82d9cf4cf71..e22667a12bd 100644 --- a/Boolean_set_operations_2/include/CGAL/General_polygon_with_holes_2.h +++ b/Polygon/include/CGAL/General_polygon_with_holes_2.h @@ -1,10 +1,14 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). -// All rights reserved. +// Copyright (c) 2005 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // -// This file is part of CGAL (www.cgal.org). -// You can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. @@ -14,7 +18,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Baruch Zukerman @@ -27,14 +31,30 @@ namespace CGAL { +/*! +\ingroup PkgPolygon2 + +The class `General_polygon_with_holes_2` models the concept +`GeneralPolygonWithHoles_2`. It represents a general polygon with +holes. It is parameterized with a type `Polygon` used to define +the exposed type `General_polygon_2`. This type represents the +outer boundary of the general polygon and the outer boundaries of +each hole. + +\cgalModels `GeneralPolygonWithHoles_2` + +*/ template class General_polygon_with_holes_2 { - public: - typedef General_polygon_with_holes_2 Self; - typedef Polygon_ Polygon_2; - typedef typename Self::Polygon_2 General_polygon_2; + +/// \name Definition + +/// @{ + typedef Polygon_ General_polygon_2; +/// @} + typedef std::list Holes_container; typedef typename Holes_container::iterator Hole_iterator; @@ -46,7 +66,7 @@ public: {} - explicit General_polygon_with_holes_2(const General_polygon_2& pgn_boundary) + explicit General_polygon_with_holes_2(const General_polygon_2& pgn_boundary) : m_pgn(pgn_boundary) {} @@ -136,7 +156,24 @@ protected: //-----------------------------------------------------------------------// // operator<< //-----------------------------------------------------------------------// +/*! +This operator exports a General_polygon_with_holes_2 to the output stream `out`. +An ASCII and a binary format exist. The format can be selected with +the \cgal modifiers for streams, `set_ascii_mode(0` and `set_binary_mode()` +respectively. The modifier `set_pretty_mode()` can be used to allow for (a +few) structuring comments in the output. Otherwise, the output would +be free of comments. The default for writing is ASCII without +comments. + +The number of curves of the outer boundary is exported followed by the +curves themselves in counterclockwise order. Then, the number of holes +is exported, and for each hole, the number of curves on its outer +boundary is exported followed by the curves themselves in clockwise +order. + +\relates General_polygon_with_holes_2 +*/ template std::ostream &operator<<(std::ostream &os, const General_polygon_with_holes_2& p) @@ -157,7 +194,7 @@ std::ostream os << *hit; } return os; - + default: os << "General_polygon_with_holes_2( " << std::endl; @@ -173,6 +210,20 @@ std::ostream // operator>> //-----------------------------------------------------------------------// +/*! +This operator imports a General_polygon_with_holes_2 from the input stream `in`. + +An ASCII and a binary format exist. The stream detects the format +automatically and can read both. + +The format consists of the number of curves of the outer boundary +followed by the curves themselves in counterclockwise order, followed +by the number of holes, and for each hole, the number of curves on its +outer boundary is followed by the curves themselves in clockwise +order. + +\relates General_polygon_with_holes_2 +*/ template std::istream &operator>>(std::istream &is, General_polygon_with_holes_2& p) { @@ -181,16 +232,16 @@ std::istream &operator>>(std::istream &is, General_polygon_with_holes_2> n_holes; - if (is) + if (is) { Polygon_ pgn_hole; - for (unsigned int i=0; i> pgn_hole; p.add_hole(pgn_hole); } } - + return is; } diff --git a/Boolean_set_operations_2/include/CGAL/Polygon_with_holes_2.h b/Polygon/include/CGAL/Polygon_with_holes_2.h similarity index 71% rename from Boolean_set_operations_2/include/CGAL/Polygon_with_holes_2.h rename to Polygon/include/CGAL/Polygon_with_holes_2.h index 64a9f2b69d9..42d8eee11af 100644 --- a/Boolean_set_operations_2/include/CGAL/Polygon_with_holes_2.h +++ b/Polygon/include/CGAL/Polygon_with_holes_2.h @@ -1,10 +1,14 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). -// All rights reserved. +// Copyright (c) 2005 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // -// This file is part of CGAL (www.cgal.org). -// You can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. @@ -14,7 +18,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Baruch Zukerman @@ -28,9 +32,21 @@ namespace CGAL { +/*! +\ingroup PkgPolygon2 + +The class `Polygon_with_holes_2` models the concept `GeneralPolygonWithHoles_2`. +It represents a linear polygon with holes. It is parameterized with two +types (`Kernel` and `Container`) that are used to instantiate +the type `Polygon_2`. The latter is used to +represents the outer boundary and the boundary of the holes (if any exist). + +\cgalModels `GeneralPolygonWithHoles_2` + +*/ template > -class Polygon_with_holes_2 : +class Polygon_with_holes_2 : public General_polygon_with_holes_2 > { public: @@ -41,17 +57,17 @@ public: typedef typename Base::Size Size; /*! Default constructor. */ - Polygon_with_holes_2 () : + Polygon_with_holes_2 () : Base() {} /*! Constructor from the base class. */ - Polygon_with_holes_2 (const Base& base) : + Polygon_with_holes_2 (const Base& base) : Base (base) {} /*! Constructor from a polygon. */ - explicit Polygon_with_holes_2 (const Polygon_2& pgn_boundary) : + explicit Polygon_with_holes_2 (const Polygon_2& pgn_boundary) : Base (pgn_boundary) {} @@ -59,18 +75,36 @@ public: template Polygon_with_holes_2 (const Polygon_2& pgn_boundary, HolesInputIterator h_begin, - HolesInputIterator h_end) : + HolesInputIterator h_end) : Base (pgn_boundary, h_begin, h_end) {} /*! Obtain the bounding box of the polygon with holes */ - Bbox_2 bbox() const { return this->outer_boundary().bbox(); } + Bbox_2 bbox() const { return this->outer_boundary().bbox(); } }; //-----------------------------------------------------------------------// // operator<< //-----------------------------------------------------------------------// +/*! +This operator exports a polygon with holes to the output stream `out`. + +An ASCII and a binary format exist. The format can be selected with +the \cgal modifiers for streams, `set_ascii_mode()` and `set_binary_mode()` +respectively. The modifier `set_pretty_mode()` can be used to allow for (a +few) structuring comments in the output. Otherwise, the output would +be free of comments. The default for writing is ASCII without +comments. + +The number of points of the outer boundary is exported followed by the +points themselves in counterclockwise order. Then, the number of holes +is exported, and for each hole, the number of points on its outer +boundary is exported followed by the points themselves in clockwise +order. + +\relates Polygon_with_holes_2 +*/ template std::ostream& operator<<(std::ostream &os, const Polygon_with_holes_2& p) @@ -117,6 +151,19 @@ std::ostream& operator<<(std::ostream &os, // operator>> //-----------------------------------------------------------------------// +/*! +This operator imports a polygon with holes from the input stream `in`. + +An ASCII and a binary format exist. The stream detects the format +automatically and can read both. + +The format consists of the number of points of the outer boundary followed +by the points themselves in counterclockwise order, followed by the number of holes, +and for each hole, the number of points of the outer boundary is followed +by the points themselves in clockwise order. + +\relates Polygon_with_holes_2 +*/ template std::istream &operator>>(std::istream &is, Polygon_with_holes_2& p) @@ -148,7 +195,7 @@ template bool operator==(const Polygon_with_holes_2& p1, const Polygon_with_holes_2& p2) { - typedef typename + typedef typename Polygon_with_holes_2::Hole_const_iterator HCI; typedef CGAL::Polygon_2 Polygon_2; if(&p1 == &p2)