move Polygon_with_holes_2 in the Polygon package

with the agreement from TAU
This commit is contained in:
Sébastien Loriot 2016-10-03 15:31:10 +02:00
parent 04f4c9bc06
commit befe820313
8 changed files with 220 additions and 278 deletions

View File

@ -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 <class Polygon>
std::istream& operator>>(std::istream& in, CGAL::General_polygon_with_holes_2<Polygon>& 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 <class Polygon>
std::ostream& operator<<(std::ostream& out, CGAL::General_polygon_with_holes_2<Polygon>& P);
} /* end namespace CGAL */

View File

@ -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<Kernel,Container>`. 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 <class Kernel, Class Container>
std::istream& operator>>(std::istream& in, CGAL::Polygon_with_holes_2<Kernel, Container>& 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 <class Polygon>
std::ostream& operator<<(std::ostream& out, CGAL::Polygon_with_holes_2<Kernel, Polygon>& P);
} /* end namespace CGAL */

View File

@ -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<General_polygon>`
\cgalHasModel `CGAL::Polygon_with_holes_2<Kernel,Container>`
\cgalHasModel `CGAL::Gps_circle_segment_traits_2<Kernel>::%Polygon_with_holes_2`
\cgalHasModel `CGAL::Gps_traits_2<ArrTraits,GeneralPolygon>::%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 <class InputIterator>
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 */

View File

@ -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<Kernel,Container>`
- `CGAL::Polygon_set_2<Kernel,Container,Dcel>`
- `CGAL::General_polygon_set_2<Traits,Dcel>`
- `CGAL::General_polygon_2<ArrTraits>`
@ -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`
*/

View File

@ -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<General_polygon>`
\cgalHasModel `CGAL::Polygon_with_holes_2<Kernel,Container>`
*/
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 <class InputIterator>
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 */

View File

@ -33,9 +33,11 @@ The assertion flags for the polygons and polygon operations use
## Concepts ##
- `PolygonTraits_2`
- `GeneralPolygonWithHoles_2`
## Classes ##
- `CGAL::Polygon_2<PolygonTraits_2, Container>`
- `CGAL::Polygon_with_holes_2<PolygonTraits_2,Container>`
## Global Functions ##
- `CGAL::area_2()`

View File

@ -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.
@ -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 Polygon_>
class General_polygon_with_holes_2
{
public:
typedef General_polygon_with_holes_2<Polygon_> Self;
typedef Polygon_ Polygon_2;
typedef typename Self::Polygon_2 General_polygon_2;
/// \name Definition
/// @{
typedef Polygon_ General_polygon_2;
/// @}
typedef std::list<Polygon_> Holes_container;
typedef typename Holes_container::iterator Hole_iterator;
@ -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 <class Polygon_>
std::ostream
&operator<<(std::ostream &os, const General_polygon_with_holes_2<Polygon_>& p)
@ -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 <class Polygon_>
std::istream &operator>>(std::istream &is, General_polygon_with_holes_2<Polygon_>& p)
{

View File

@ -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.
@ -28,6 +32,18 @@
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<Kernel,Container>`. The latter is used to
represents the outer boundary and the boundary of the holes (if any exist).
\cgalModels `GeneralPolygonWithHoles_2`
*/
template <class Kernel,
class Containter = std::vector<typename Kernel::Point_2> >
class Polygon_with_holes_2 :
@ -71,6 +87,24 @@ public:
// 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 <class Kernel_, class Container_>
std::ostream& operator<<(std::ostream &os,
const Polygon_with_holes_2<Kernel_, Container_>& 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 <class Kernel_, class Container_>
std::istream &operator>>(std::istream &is,
Polygon_with_holes_2<Kernel_, Container_>& p)