mirror of https://github.com/CGAL/cgal
Move documentation to /include
This commit is contained in:
parent
ec1b4bb6e1
commit
3c833674fb
|
|
@ -1,40 +0,0 @@
|
||||||
|
|
||||||
namespace CGAL {
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
The class `Istream_iterator` is an input iterator adaptor for the
|
|
||||||
input stream class `Stream` and value type `T`. It is particularly
|
|
||||||
useful for classes that are similar but not compatible to `std::istream`.
|
|
||||||
|
|
||||||
\cgalModels `InputIterator`
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
template< typename T, typename Stream >
|
|
||||||
class Istream_iterator {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// \name Creation
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
/*!
|
|
||||||
creates an end-of-stream iterator.
|
|
||||||
This is a past-the-end iterator, and it is useful
|
|
||||||
when constructing a range.
|
|
||||||
*/
|
|
||||||
Istream_iterator();
|
|
||||||
|
|
||||||
/*!
|
|
||||||
creates an input iterator reading from `s`.
|
|
||||||
When `s` reaches end of stream,
|
|
||||||
this iterator will compare equal to an end-of-stream iterator
|
|
||||||
created using the default constructor.
|
|
||||||
*/
|
|
||||||
Istream_iterator( Stream& s);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
}; /* end Istream_iterator */
|
|
||||||
} /* end namespace CGAL */
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
namespace CGAL {
|
|
||||||
|
|
||||||
//! \ingroup IOstreamFunctions
|
|
||||||
///reads a file in .obj format.
|
|
||||||
///\tparam Points_3 a RandomAccessContainer of Point_3,
|
|
||||||
///\tparam Faces a RandomAccessContainer of RandomAccessContainer of std::size_t
|
|
||||||
/// \see IOStreamOBJ
|
|
||||||
template <class Points_3, class Faces>
|
|
||||||
bool
|
|
||||||
read_OBJ(std::istream& input, Points_3 &points, Faces &faces);
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
namespace CGAL{
|
|
||||||
/*!
|
|
||||||
* \ingroup IOstreamFunctions
|
|
||||||
* writes the content of `in` in `points` and `polygons`, in the OFF format.
|
|
||||||
* \see \ref IOStreamOFF
|
|
||||||
*/
|
|
||||||
template <class Point_3, class Polygon_3>
|
|
||||||
bool
|
|
||||||
read_OFF( std::istream& in,
|
|
||||||
std::vector< Point_3 >& points,
|
|
||||||
std::vector< Polygon_3 >& polygons,
|
|
||||||
bool /* verbose */ = false);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \ingroup IOstreamFunctions
|
|
||||||
* writes the content of `points` and `polygons` in `out`, in the OFF format.
|
|
||||||
* \see \ref IOStreamOFF
|
|
||||||
*/
|
|
||||||
template <class Point_3, class Polygon_3>
|
|
||||||
bool
|
|
||||||
write_OFF(std::ostream& out,
|
|
||||||
std::vector< Point_3 >& points,
|
|
||||||
std::vector< Polygon_3 >& polygons);
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
|
|
||||||
namespace CGAL {
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
The class `Ostream_iterator` is an output iterator adaptor for the
|
|
||||||
output stream class `Stream` and value type `T`.
|
|
||||||
|
|
||||||
|
|
||||||
\cgalModels `OutputIterator`
|
|
||||||
|
|
||||||
\cgalHeading{Implementation}
|
|
||||||
|
|
||||||
The `operator*()` in class `Ostream_iterator` uses a proxy class.
|
|
||||||
|
|
||||||
*/
|
|
||||||
template< typename T, typename Stream >
|
|
||||||
class Ostream_iterator {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// \name Creation
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
/*!
|
|
||||||
creates an output iterator writing to `s`.
|
|
||||||
*/
|
|
||||||
Ostream_iterator( Stream& s);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
}; /* end Ostream_iterator */
|
|
||||||
} /* end namespace CGAL */
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
|
|
||||||
namespace CGAL {
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
The class `Verbose_ostream` can be used as an output stream. The stream
|
|
||||||
output operator `<<` is defined for any type. The class
|
|
||||||
`Verbose_ostream` stores in an internal state a stream and whether the
|
|
||||||
output is active or not. If the state is active, the stream output
|
|
||||||
operator `<<` uses the internal stream to output its argument. If
|
|
||||||
the state is inactive, nothing happens.
|
|
||||||
|
|
||||||
\cgalHeading{Example}
|
|
||||||
|
|
||||||
The class `Verbose_ostream` can be conveniently used to implement for
|
|
||||||
example the `is_valid()` member function for triangulations or
|
|
||||||
other complex data structures.
|
|
||||||
|
|
||||||
\code{.cpp}
|
|
||||||
bool is_valid( bool verbose = false, int level = 0) {
|
|
||||||
Verbose_ostream verr( verbose);
|
|
||||||
verr << "Triangulation::is_valid( level = " << level << ')' << endl;
|
|
||||||
verr << " Number of vertices = " << size_of_vertices() << endl;
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
\endcode
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Verbose_ostream {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// \name Creation
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
/*!
|
|
||||||
creates an output stream with state set to
|
|
||||||
`active` that writes to the stream `out`.
|
|
||||||
*/
|
|
||||||
Verbose_ostream( bool active = false,
|
|
||||||
std::ostream& out = std::cerr);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
/// \name Operations
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
/*!
|
|
||||||
creates an output stream with state set to
|
|
||||||
`false` that writes to the stream `std::cerr`.
|
|
||||||
*/
|
|
||||||
template < class T >
|
|
||||||
Verbose_ostream& operator<<( const T& t);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
}; /* end Verbose_ostream */
|
|
||||||
} /* end namespace CGAL */
|
|
||||||
|
|
@ -1,196 +0,0 @@
|
||||||
namespace CGAL{
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `read_point_WKT()` fills a `Point` from a WKT stream. The first line starting with POINT
|
|
||||||
//! in the stream will be used.
|
|
||||||
//!
|
|
||||||
//! \tparam Point can be a `CGAL::Point_2` or `CGAL::Point_3`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//!
|
|
||||||
//! \see `CGAL::Point_2`
|
|
||||||
//! \see `CGAL::Point_3`
|
|
||||||
template<typename Point>
|
|
||||||
std::istream&
|
|
||||||
read_point_WKT( std::istream& in,
|
|
||||||
Point& point );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `read_multi_point_WKT()` overwrites the content of a `MultiPoint`
|
|
||||||
//! with the first line starting with MULTIPOINT in the stream.
|
|
||||||
//!
|
|
||||||
//! \tparam MultiPoint must be a model of `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`,
|
|
||||||
//! and have:
|
|
||||||
//! - a function `push_back()` that takes the same point type,
|
|
||||||
//! - a function `clear()`,
|
|
||||||
//! - a function `resize()` that takes an `size_type`
|
|
||||||
//! - an `operator[]()` that takes a `size_type`.
|
|
||||||
//!
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//! \see `CGAL::Point_2`
|
|
||||||
//! \see `CGAL::Point_3`
|
|
||||||
template<typename MultiPoint>
|
|
||||||
std::istream&
|
|
||||||
read_multi_point_WKT( std::istream& in,
|
|
||||||
MultiPoint& mp );
|
|
||||||
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `read_linestring_WKT()` fills a `Linestring` from a WKT stream.
|
|
||||||
//! The first line starting with LINESTRING in the stream will be used.
|
|
||||||
//!
|
|
||||||
//! \tparam Linestring must be a model of `RandomAccessRange` of `CGAL::Point_2`,
|
|
||||||
//! and have:
|
|
||||||
//! - a function `push_back()` that takes a `CGAL::Point_2`.
|
|
||||||
//! - a function `clear()`,
|
|
||||||
//! - a function `resize()` that takes an `size_type`
|
|
||||||
//! - an `operator[]()` that takes a `size_type`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//! \see `CGAL::Point_2`
|
|
||||||
template<typename LineString>
|
|
||||||
std::istream&
|
|
||||||
read_linestring_WKT( std::istream& in,
|
|
||||||
LineString& polyline );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `read_multi_linestring_WKT()` overwrites the content of a `MultiLineString`
|
|
||||||
//! with the first line starting with MULTILINESTRING in the stream.
|
|
||||||
//!
|
|
||||||
//! \tparam MultiLineString must be a model of `RandomAccessRange` of `Linestring`,
|
|
||||||
//! and have:
|
|
||||||
//! - a function `push_back()` that takes a `Linestring`,
|
|
||||||
//! - a function `clear()`,
|
|
||||||
//! - a function `resize()` that takes an `size_type`
|
|
||||||
//! - an `operator[]()` that takes a `size_type`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//!
|
|
||||||
//! \see `CGAL::Point_2`
|
|
||||||
template<typename MultiLineString>
|
|
||||||
std::istream&
|
|
||||||
read_multi_linestring_WKT( std::istream& in,
|
|
||||||
MultiLineString& mls );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `read_polygon_WKT()` fills `polygon` from a WKT stream.
|
|
||||||
//! The first line starting with POLYGON in the stream will be used.
|
|
||||||
//!
|
|
||||||
//! \tparam Polygon is a `CGAL::General_polygon_with_holes_2`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//!
|
|
||||||
//! \see `CGAL::General_polygon_with_holes_2`
|
|
||||||
template<typename Polygon>
|
|
||||||
std::istream&
|
|
||||||
read_polygon_WKT( std::istream& in,
|
|
||||||
Polygon& polygon );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `read_multi_polygon_WKT()` overwrites the content of a `MultiPolygon`
|
|
||||||
//! with the first line starting with MULTIPOLYGON in the stream.
|
|
||||||
//!
|
|
||||||
//! \tparam MultiPolygon must be a model of `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`,
|
|
||||||
//! and have:
|
|
||||||
//! - a function `push_back()` that takes a `CGAL::General_polygon_with_holes_2`,
|
|
||||||
//! - a function `clear()`,
|
|
||||||
//! - a function `resize()` that takes an `size_type`
|
|
||||||
//! - an `operator[]()` that takes a `size_type`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//! \see `CGAL::General_polygon_with_holes_2`
|
|
||||||
|
|
||||||
template<typename MultiPolygon>
|
|
||||||
std::istream&
|
|
||||||
read_multi_polygon_WKT( std::istream& in,
|
|
||||||
MultiPolygon& polygons );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `write_point_WKT()` writes `point` into a WKT stream.
|
|
||||||
//! \tparam Point is a `CGAL::Point_2`
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//! \see `CGAL::Point_2`
|
|
||||||
template<typename Point>
|
|
||||||
std::ostream&
|
|
||||||
write_point_WKT( std::ostream& out,
|
|
||||||
const Point& point );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `write_polygon_WKT()` writes `poly` into a WKT stream.
|
|
||||||
//! \tparam Polygon must be a `CGAL::General_polygon_with_holes_2`
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//! \see `CGAL::General_polygon_with_holes_2`
|
|
||||||
template<typename Polygon>
|
|
||||||
std::ostream&
|
|
||||||
write_polygon_WKT( std::ostream& out,
|
|
||||||
const Polygon& poly );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `write_linestring_WKT()` writes the content of `ls`
|
|
||||||
//! into a WKT stream.
|
|
||||||
//! \tparam LineString must be a `RandomAccessRange` of `CGAL::Point_2`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//!\see `CGAL::Point_2`
|
|
||||||
template<typename LineString>
|
|
||||||
std::ostream&
|
|
||||||
write_linestring_WKT( std::ostream& out,
|
|
||||||
LineString ls );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `write_multi_point_WKT()` writes the content of `mp`
|
|
||||||
//! into a WKT stream.
|
|
||||||
//! \tparam MultiPoint must be a `RandomAccessRange` of `CGAL::Point_2`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//!\see `CGAL::Point_2`
|
|
||||||
template<typename MultiPoint>
|
|
||||||
std::ostream&
|
|
||||||
write_multi_point_WKT( std::ostream& out,
|
|
||||||
MultiPoint& mp );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `write_multi_polygon_WKT()` writes the content of `polygons`
|
|
||||||
//! into a WKT stream.
|
|
||||||
//! \tparam MultiPolygon must be a `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//!\see `CGAL::General_polygon_with_holes_2`
|
|
||||||
template<typename MultiPolygon>
|
|
||||||
std::ostream&
|
|
||||||
write_multi_polygon_WKT( std::ostream& out,
|
|
||||||
MultiPolygon& polygons );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! \brief `write_multi_linestring_WKT()` writes the content of `mls`
|
|
||||||
//! into a WKT stream.
|
|
||||||
//! \tparam MultiLineString must be a `RandomAccessRange` of `LineString`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//! \see `CGAL::write_linestring_WKT()`
|
|
||||||
template<typename MultiLineString>
|
|
||||||
std::ostream&
|
|
||||||
write_multi_linestring_WKT( std::ostream& out,
|
|
||||||
MultiLineString& mls );
|
|
||||||
|
|
||||||
//! \ingroup PkgStreamSupportRef
|
|
||||||
//! reads the content of a WKT stream and fills
|
|
||||||
//! `points`, `polylines` and `polygons` with all the POINT, MULTIPOINT,
|
|
||||||
//! LINESTRING, MULTILINESTRING, POLYGON and MULTIPOLYGON it finds in `input`.
|
|
||||||
//! \tparam MultiPoint must be a model of `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`.
|
|
||||||
//! \tparam MultiLineString must be a `RandomAccessRange` of `Linestring`.
|
|
||||||
//! \tparam MultiPolygon must be a model of `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`.
|
|
||||||
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
|
||||||
//! \attention This function is only available with boost versions starting at 1.56.
|
|
||||||
//! \see `CGAL::read_linestring_WKT()`
|
|
||||||
template<typename MultiPoint,
|
|
||||||
typename MultiLineString,
|
|
||||||
typename MultiPolygon>
|
|
||||||
std::istream&
|
|
||||||
read_WKT( std::istream& input,
|
|
||||||
MultiPoint& points,
|
|
||||||
MultiLineString& polylines,
|
|
||||||
MultiPolygon& polygons);
|
|
||||||
}
|
|
||||||
|
|
@ -1,291 +0,0 @@
|
||||||
namespace CGAL {
|
|
||||||
|
|
||||||
|
|
||||||
namespace IO{
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
All classes in the \cgal `Kernel` provide input and output operators for
|
|
||||||
IOStreams. The basic task of such an operator is to produce a
|
|
||||||
representation of an object that can be written as a sequence of
|
|
||||||
characters on devices as a console, a file, or a pipe. The enum `Mode` distinguish between three different printing formats.
|
|
||||||
|
|
||||||
In `ASCII` mode, numbers
|
|
||||||
e.g. the coordinates of a point or
|
|
||||||
the coefficients of a line, are written
|
|
||||||
in a machine independent format.
|
|
||||||
In <span class="textsc">BINARY</span> mode, data are written
|
|
||||||
in a binary format, e.g. a double is represented
|
|
||||||
as a sequence of four byte. The format depends on the machine.
|
|
||||||
The mode <span class="textsc">PRETTY</span>
|
|
||||||
serves mainly for debugging as the type of the geometric
|
|
||||||
object is written, as well as the data defining the object. For example
|
|
||||||
for a point at the origin with %Cartesian double coordinates, the output
|
|
||||||
would be `PointC2(0.0, 0.0)`. At the moment \cgal does not
|
|
||||||
provide input operations for pretty printed data. By default a stream
|
|
||||||
is in <span class="textsc">Ascii</span> mode.
|
|
||||||
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
*/
|
|
||||||
enum Mode { ASCII = 0, BINARY, PRETTY };
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
returns the printing mode of the %IO stream `s`.
|
|
||||||
|
|
||||||
\sa `CGAL::IO::Mode`
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
IO::Mode get_mode(std::ios& s);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
sets the mode of the %IO stream `s` to be the `IO::ASCII` mode.
|
|
||||||
Returns the previous mode of `s`.
|
|
||||||
|
|
||||||
|
|
||||||
\sa `CGAL::IO::Mode`
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
*/
|
|
||||||
IO::Mode set_ascii_mode(std::ios& s);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
\sa `CGAL::IO::Mode`
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
|
|
||||||
sets the mode of the %IO stream `s` to be the `IO::BINARY` mode.
|
|
||||||
Returns the previous mode of `s`.
|
|
||||||
*/
|
|
||||||
IO::Mode set_binary_mode(std::ios& s);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
sets the printing mode of the %IO stream `s`.
|
|
||||||
|
|
||||||
\sa `CGAL::IO::Mode`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
*/
|
|
||||||
IO::Mode set_mode(std::ios& s, IO::Mode m);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
sets the mode of the %IO stream `s` to be the `IO::PRETTY` mode.
|
|
||||||
Returns the previous mode of `s`.
|
|
||||||
|
|
||||||
\sa `CGAL::IO::Mode`
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
|
|
||||||
*/
|
|
||||||
IO::Mode set_pretty_mode(std::ios& s);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
The definition of `Input_rep` is completely symmetric to `Output_rep`.
|
|
||||||
|
|
||||||
*/
|
|
||||||
template< typename T, typename F >
|
|
||||||
class Input_rep {
|
|
||||||
|
|
||||||
}; /* end Input_rep */
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
The purpose of `Output_rep` is to provide a way to control output formatting that works independently of the object's stream output operator.
|
|
||||||
|
|
||||||
If you dont specialize `Output_rep` for `T`, `T`'s stream output operator is called from within `Output_rep`, by default. If you want another behaviour for your type `T`, you have to provide a specialization for that type. Furthermore, you can provide specializations with a second template parameter (a formatting tag). The second template parameter defaults to `Null_tag` and means *default behaviour*.
|
|
||||||
|
|
||||||
Specializations of `Output_rep` should provide the following features:
|
|
||||||
|
|
||||||
\code{.cpp}
|
|
||||||
|
|
||||||
template< class F >
|
|
||||||
struct Output_rep< Some_type, F > {
|
|
||||||
static const bool is_specialized = true;
|
|
||||||
Output_rep( const Some_type& t );
|
|
||||||
std::ostream& operator()( std::ostream& out ) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
\endcode
|
|
||||||
|
|
||||||
You can also specialize for a formatting tag `F`.
|
|
||||||
|
|
||||||
The constant `is_specialized` can be tested by meta-programming tools to
|
|
||||||
verify that a given type can be used with `oformat()`. Its value has to be
|
|
||||||
`true` in a specialization of `Output_rep`. When there is no specialization
|
|
||||||
for a type, the class template `Output_rep` defines `is_specialized` to the
|
|
||||||
default value `false`.
|
|
||||||
|
|
||||||
*/
|
|
||||||
template< typename T, typename F >
|
|
||||||
class Output_rep {
|
|
||||||
}; /* end Output_rep */
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
checks if the %IO stream `s` is in `IO::ASCII` mode.
|
|
||||||
|
|
||||||
\sa `CGAL::IO::Mode`
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
*/
|
|
||||||
bool is_ascii(std::ios& s);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
checks if the %IO stream `s` is in `IO::BINARY` mode.
|
|
||||||
|
|
||||||
\sa `CGAL::IO::Mode`
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
*/
|
|
||||||
bool is_binary(std::ios& s);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
checks if the %IO stream `s` is in `IO::PRETTY` mode.
|
|
||||||
|
|
||||||
\sa `CGAL::IO::Mode`
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
|
|
||||||
*/
|
|
||||||
bool is_pretty(std::ios& s);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
Convenience function to construct an output representation (`Output_rep`) for type `T`.
|
|
||||||
|
|
||||||
Generic IO for type `T`.
|
|
||||||
*/
|
|
||||||
template <class T> Output_rep<T> oformat( const T& t);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
The definition of this function is completely symmetric to `oformat()`.
|
|
||||||
*/
|
|
||||||
template <class T> Input_rep<T> iformat( const T& t);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup PkgStreamSupportRef
|
|
||||||
|
|
||||||
Convenience function to construct an output representation (`Output_rep`) for type `T`.
|
|
||||||
|
|
||||||
Generic IO for type `T` with formatting tag.
|
|
||||||
*/
|
|
||||||
template <class T, typename F> Output_rep<T,F> oformat( const T& t, F );
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup IOstreamOperators
|
|
||||||
|
|
||||||
\brief Inserts object `c` in the stream `os`. Returns `os`.
|
|
||||||
|
|
||||||
\cgal defines output operators for classes that are derived
|
|
||||||
from the class `ostream`. This allows to write to ostreams
|
|
||||||
as `cout` or `cerr`, as well as to `std::ostringstream`
|
|
||||||
and `std::ofstream`.
|
|
||||||
The output operator is defined for all classes in the \cgal `Kernel` and for the class `Color` as well.
|
|
||||||
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
*/
|
|
||||||
ostream& operator<<(ostream& os, Class c);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup IOstreamOperators
|
|
||||||
|
|
||||||
\brief \cgal defines input operators for classes that are derived
|
|
||||||
from the class `istream`. This allows to read from istreams
|
|
||||||
as `std::cin`, as well as from `std::istringstream` and `std::ifstream`.
|
|
||||||
The input operator is defined for all classes in the \cgal `Kernel`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\sa `CGAL::set_mode()`
|
|
||||||
\sa `CGAL::set_ascii_mode()`
|
|
||||||
\sa `CGAL::set_binary_mode()`
|
|
||||||
\sa `CGAL::set_pretty_mode()`
|
|
||||||
\sa `CGAL::get_mode()`
|
|
||||||
\sa `CGAL::is_ascii()`
|
|
||||||
\sa `CGAL::is_binary()`
|
|
||||||
\sa `CGAL::is_pretty()`
|
|
||||||
*/
|
|
||||||
istream& operator>>(istream& is, Class c);
|
|
||||||
}
|
|
||||||
|
|
@ -6,5 +6,4 @@ EXAMPLE_PATH = ${CGAL_PACKAGE_DIR}/examples
|
||||||
EXTRACT_ALL = false
|
EXTRACT_ALL = false
|
||||||
HIDE_UNDOC_MEMBERS = true
|
HIDE_UNDOC_MEMBERS = true
|
||||||
HIDE_UNDOC_CLASSES = true
|
HIDE_UNDOC_CLASSES = true
|
||||||
INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/IO/Color.h
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,19 @@
|
||||||
#include <CGAL/IO/OBJ/File_writer_wavefront.h>
|
#include <CGAL/IO/OBJ/File_writer_wavefront.h>
|
||||||
#include <CGAL/IO/OBJ/OBJ_reader.h>
|
#include <CGAL/IO/OBJ/OBJ_reader.h>
|
||||||
|
|
||||||
|
namespace CGAL {
|
||||||
|
|
||||||
|
//! \ingroup IOstreamFunctions
|
||||||
|
//!
|
||||||
|
///reads a file in .obj format.
|
||||||
|
///
|
||||||
|
///\tparam Points_3 a RandomAccessContainer of Point_3,
|
||||||
|
///\tparam Faces a RandomAccessContainer of RandomAccessContainer of std::size_t
|
||||||
|
///
|
||||||
|
/// \see IOStreamOBJ
|
||||||
|
template <class Points_3, class Faces>
|
||||||
|
bool read_OBJ(std::istream& input, Points_3 &points, Faces &faces);
|
||||||
|
|
||||||
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_IO_OBJ_H
|
#endif // CGAL_IO_OBJ_H
|
||||||
|
|
|
||||||
|
|
@ -23,48 +23,13 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template <class Point_3, class Polygon_3>
|
/*!
|
||||||
bool read_OFF(std::istream& in,
|
* \ingroup IOstreamFunctions
|
||||||
std::vector< Point_3 >& points,
|
*
|
||||||
std::vector< Polygon_3 >& polygons,
|
* reads the content of `in` into `points` and `polygons`, in the COFF format.
|
||||||
bool /* verbose */ = false)
|
*
|
||||||
{
|
* \see \ref IOStreamOFF
|
||||||
CGAL::File_scanner_OFF scanner(in);
|
*/
|
||||||
|
|
||||||
points.resize(scanner.size_of_vertices());
|
|
||||||
polygons.resize(scanner.size_of_facets());
|
|
||||||
for(std::size_t i = 0; i < scanner.size_of_vertices(); ++i)
|
|
||||||
{
|
|
||||||
double x, y, z, w;
|
|
||||||
scanner.scan_vertex( x, y, z, w);
|
|
||||||
CGAL_assertion(w!=0);
|
|
||||||
IO::internal::fill_point( x/w, y/w, z/w, points[i] );
|
|
||||||
scanner.skip_to_next_vertex( i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!in)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for(std::size_t i = 0; i < scanner.size_of_facets(); ++i)
|
|
||||||
{
|
|
||||||
std::size_t no;
|
|
||||||
|
|
||||||
scanner.scan_facet( no, i);
|
|
||||||
IO::internal::resize(polygons[i], no);
|
|
||||||
for(std::size_t j = 0; j < no; ++j)
|
|
||||||
{
|
|
||||||
std::size_t id;
|
|
||||||
scanner.scan_facet_vertex_index(id, i);
|
|
||||||
if(id < scanner.size_of_vertices())
|
|
||||||
polygons[i][j] = id;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return in.good();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Point_3, class Polygon_3, class Color_rgb >
|
template <class Point_3, class Polygon_3, class Color_rgb >
|
||||||
bool read_OFF(std::istream& in,
|
bool read_OFF(std::istream& in,
|
||||||
std::vector< Point_3 >& points,
|
std::vector< Point_3 >& points,
|
||||||
|
|
@ -148,6 +113,62 @@ bool read_OFF(std::istream& in,
|
||||||
return in.good();
|
return in.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \ingroup IOstreamFunctions
|
||||||
|
*
|
||||||
|
* reads the content of `in` into `points` and `polygons`, in the OFF format.
|
||||||
|
*
|
||||||
|
* \see \ref IOStreamOFF
|
||||||
|
*/
|
||||||
|
template <class Point_3, class Polygon_3>
|
||||||
|
bool read_OFF(std::istream& in,
|
||||||
|
std::vector< Point_3 >& points,
|
||||||
|
std::vector< Polygon_3 >& polygons,
|
||||||
|
bool /* verbose */ = false)
|
||||||
|
{
|
||||||
|
CGAL::File_scanner_OFF scanner(in);
|
||||||
|
|
||||||
|
points.resize(scanner.size_of_vertices());
|
||||||
|
polygons.resize(scanner.size_of_facets());
|
||||||
|
for(std::size_t i = 0; i < scanner.size_of_vertices(); ++i)
|
||||||
|
{
|
||||||
|
double x, y, z, w;
|
||||||
|
scanner.scan_vertex( x, y, z, w);
|
||||||
|
CGAL_assertion(w!=0);
|
||||||
|
IO::internal::fill_point( x/w, y/w, z/w, points[i] );
|
||||||
|
scanner.skip_to_next_vertex( i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!in)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for(std::size_t i = 0; i < scanner.size_of_facets(); ++i)
|
||||||
|
{
|
||||||
|
std::size_t no;
|
||||||
|
|
||||||
|
scanner.scan_facet( no, i);
|
||||||
|
IO::internal::resize(polygons[i], no);
|
||||||
|
for(std::size_t j = 0; j < no; ++j)
|
||||||
|
{
|
||||||
|
std::size_t id;
|
||||||
|
scanner.scan_facet_vertex_index(id, i);
|
||||||
|
if(id < scanner.size_of_vertices())
|
||||||
|
polygons[i][j] = id;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return in.good();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \ingroup IOstreamFunctions
|
||||||
|
*
|
||||||
|
* writes the content of `points` and `polygons` in `out`, in the OFF format.
|
||||||
|
*
|
||||||
|
* \see \ref IOStreamOFF
|
||||||
|
*/
|
||||||
template <class Point_3, class Polygon_3>
|
template <class Point_3, class Polygon_3>
|
||||||
bool write_OFF(std::ostream& out,
|
bool write_OFF(std::ostream& out,
|
||||||
std::vector< Point_3 >& points,
|
std::vector< Point_3 >& points,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
#include <CGAL/circulator.h>
|
#include <CGAL/circulator.h>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
namespace Stream_support {
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
// This proxy is for the Ostream_iterator.
|
// This proxy is for the Ostream_iterator.
|
||||||
template <class T, class Stream>
|
template <class T, class Stream>
|
||||||
|
|
@ -27,7 +29,7 @@ class Ostream_proxy
|
||||||
{
|
{
|
||||||
Stream& stream;
|
Stream& stream;
|
||||||
public:
|
public:
|
||||||
Ostream_proxy( Stream& s) : stream(s) {}
|
Ostream_proxy(Stream& s) : stream(s) {}
|
||||||
Ostream_proxy<T, Stream>& operator=( const T& t)
|
Ostream_proxy<T, Stream>& operator=( const T& t)
|
||||||
{
|
{
|
||||||
stream << t;
|
stream << t;
|
||||||
|
|
@ -35,6 +37,21 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Stream_support
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup PkgStreamSupportRef
|
||||||
|
|
||||||
|
The class `Ostream_iterator` is an output iterator adaptor for the
|
||||||
|
output stream class `Stream` and value type `T`.
|
||||||
|
|
||||||
|
\cgalModels `OutputIterator`
|
||||||
|
|
||||||
|
\cgalHeading{Implementation}
|
||||||
|
|
||||||
|
The `operator*()` in class `Ostream_iterator` uses a proxy class.
|
||||||
|
*/
|
||||||
template <class T, class Stream>
|
template <class T, class Stream>
|
||||||
class Ostream_iterator
|
class Ostream_iterator
|
||||||
{
|
{
|
||||||
|
|
@ -48,12 +65,22 @@ public:
|
||||||
typedef const T* const_pointer;
|
typedef const T* const_pointer;
|
||||||
typedef std::ptrdiff_t difference_type;
|
typedef std::ptrdiff_t difference_type;
|
||||||
typedef std::output_iterator_tag iterator_category;
|
typedef std::output_iterator_tag iterator_category;
|
||||||
|
typedef Stream_support::internal::Ostream_proxy<T, Stream> Ostream_proxy;
|
||||||
|
|
||||||
|
/// \name Creation
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
/*!
|
||||||
|
creates an output iterator writing to `s`.
|
||||||
|
*/
|
||||||
Ostream_iterator(Stream& s) : stream(&s) {}
|
Ostream_iterator(Stream& s) : stream(&s) {}
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
Ostream_iterator<T,Stream>& operator++() { return *this;}
|
Ostream_iterator<T,Stream>& operator++() { return *this;}
|
||||||
Ostream_iterator<T,Stream> operator++(int) { return *this;}
|
Ostream_iterator<T,Stream> operator++(int) { return *this;}
|
||||||
Ostream_proxy<T, Stream> operator*() const { return Ostream_proxy<T,Stream>(*stream); }
|
|
||||||
|
Ostream_proxy operator*() const { return Ostream_proxy(*stream); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,10 @@
|
||||||
else TRY_TO_GENERATE_SIZED_LIST_PROPERTY("ushort", "uint16", boost::uint16_t, STD_INDEX_TYPE, T_INDEX_TYPE, INDEX_TYPE); \
|
else TRY_TO_GENERATE_SIZED_LIST_PROPERTY("ushort", "uint16", boost::uint16_t, STD_INDEX_TYPE, T_INDEX_TYPE, INDEX_TYPE); \
|
||||||
else TRY_TO_GENERATE_SIZED_LIST_PROPERTY("uint", "uint32", boost::uint32_t, STD_INDEX_TYPE, T_INDEX_TYPE, INDEX_TYPE)
|
else TRY_TO_GENERATE_SIZED_LIST_PROPERTY("uint", "uint32", boost::uint32_t, STD_INDEX_TYPE, T_INDEX_TYPE, INDEX_TYPE)
|
||||||
|
|
||||||
|
namespace CGAL {
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
|
|
||||||
namespace CGAL {
|
|
||||||
|
|
||||||
// PLY types:
|
// PLY types:
|
||||||
// name type number of bytes
|
// name type number of bytes
|
||||||
// ---------------------------------------
|
// ---------------------------------------
|
||||||
|
|
@ -132,6 +131,8 @@ make_ply_normal_writer(VectorMap normal_map)
|
||||||
PLY_property<typename Get_FT_from_map<VectorMap>::type>("nz"));
|
PLY_property<typename Get_FT_from_map<VectorMap>::type>("nz"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
namespace PLY {
|
namespace PLY {
|
||||||
|
|
|
||||||
|
|
@ -23,42 +23,85 @@ namespace CGAL {
|
||||||
|
|
||||||
#define CGAL__VERB(x) if (b) *o << x; return *this
|
#define CGAL__VERB(x) if (b) *o << x; return *this
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup PkgStreamSupportRef
|
||||||
|
|
||||||
|
The class `Verbose_ostream` can be used as an output stream. The stream
|
||||||
|
output operator `<<` is defined for any type. The class
|
||||||
|
`Verbose_ostream` stores in an internal state a stream and whether the
|
||||||
|
output is active or not. If the state is active, the stream output
|
||||||
|
operator `<<` uses the internal stream to output its argument. If
|
||||||
|
the state is inactive, nothing happens.
|
||||||
|
|
||||||
|
\cgalHeading{Example}
|
||||||
|
|
||||||
|
The class `Verbose_ostream` can be conveniently used to implement for
|
||||||
|
example the `is_valid()` member function for triangulations or
|
||||||
|
other complex data structures.
|
||||||
|
|
||||||
|
\code{.cpp}
|
||||||
|
bool is_valid( bool verbose = false, int level = 0) {
|
||||||
|
Verbose_ostream verr( verbose);
|
||||||
|
verr << "Triangulation::is_valid( level = " << level << ')' << endl;
|
||||||
|
verr << " Number of vertices = " << size_of_vertices() << endl;
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
class Verbose_ostream
|
class Verbose_ostream
|
||||||
{
|
{
|
||||||
bool b;
|
bool b;
|
||||||
std::ostream* o;
|
std::ostream* o;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Verbose_ostream( bool active = false, std::ostream& out = std::cerr)
|
|
||||||
|
/// \name Creation
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
/*!
|
||||||
|
creates an output stream with state set to `active` that writes to the stream `out`.
|
||||||
|
*/
|
||||||
|
Verbose_ostream(bool active = false, std::ostream& out = std::cerr)
|
||||||
: b(active), o(&out)
|
: b(active), o(&out)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
bool verbose() const { return b; }
|
bool verbose() const { return b; }
|
||||||
void set_verbose(bool active) { b = active; }
|
void set_verbose(bool active) { b = active; }
|
||||||
std::ostream& out() { return *o; }
|
std::ostream& out() { return *o; }
|
||||||
|
|
||||||
|
/// \name Operations
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
/*!
|
||||||
|
writes the object `t` into the stream `out`.
|
||||||
|
*/
|
||||||
template < class T >
|
template < class T >
|
||||||
Verbose_ostream& operator<<(const T& t) { CGAL__VERB(t); }
|
Verbose_ostream& operator<<(const T& t) { CGAL__VERB(t); }
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
Verbose_ostream& operator<<( std::ostream& (*f)(std::ostream&)) { CGAL__VERB(f); }
|
Verbose_ostream& operator<<( std::ostream& (*f)(std::ostream&)) { CGAL__VERB(f); }
|
||||||
Verbose_ostream& operator<<( std::ios& (*f)(std::ios&)) { CGAL__VERB(f); }
|
Verbose_ostream& operator<<( std::ios& (*f)(std::ios&)) { CGAL__VERB(f); }
|
||||||
|
|
||||||
Verbose_ostream& flush()
|
Verbose_ostream& flush()
|
||||||
{
|
{
|
||||||
if (b)
|
if(b)
|
||||||
o->flush();
|
o->flush();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Verbose_ostream& put(char c)
|
Verbose_ostream& put(char c)
|
||||||
{
|
{
|
||||||
if (b)
|
if(b)
|
||||||
o->put(c);
|
o->put(c);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Verbose_ostream& write(const char* s, int n)
|
Verbose_ostream& write(const char* s, int n)
|
||||||
{
|
{
|
||||||
if (b)
|
if(b)
|
||||||
o->write(s, n);
|
o->write(s, n);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,18 @@ void pop_back_if_equal_to_front(CGAL::Polygon_with_holes_2<K>& pwh)
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `read_point_WKT()` fills a `Point` from a WKT stream. The first line starting with POINT
|
||||||
|
//! in the stream will be used.
|
||||||
|
//!
|
||||||
|
//! \tparam Point can be a `CGAL::Point_2` or `CGAL::Point_3`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::Point_2`
|
||||||
|
//! \see `CGAL::Point_3`
|
||||||
template<typename Point>
|
template<typename Point>
|
||||||
bool read_point_WKT(std::istream& in,
|
bool read_point_WKT(std::istream& in,
|
||||||
Point& point)
|
Point& point)
|
||||||
|
|
@ -95,6 +107,23 @@ bool read_point_WKT(std::istream& in,
|
||||||
return in.good();
|
return in.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `read_multi_point_WKT()` overwrites the content of a `MultiPoint`
|
||||||
|
//! with the first line starting with MULTIPOINT in the stream.
|
||||||
|
//!
|
||||||
|
//! \tparam MultiPoint must be a model of `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`,
|
||||||
|
//! and have:
|
||||||
|
//! - a function `push_back()` that takes the same point type,
|
||||||
|
//! - a function `clear()`,
|
||||||
|
//! - a function `resize()` that takes an `size_type`
|
||||||
|
//! - an `operator[]()` that takes a `size_type`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::Point_2`
|
||||||
|
//! \see `CGAL::Point_3`
|
||||||
template<typename MultiPoint>
|
template<typename MultiPoint>
|
||||||
bool read_multi_point_WKT(std::istream& in,
|
bool read_multi_point_WKT(std::istream& in,
|
||||||
MultiPoint& mp)
|
MultiPoint& mp)
|
||||||
|
|
@ -126,6 +155,22 @@ bool read_multi_point_WKT(std::istream& in,
|
||||||
return in.good();
|
return in.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `read_linestring_WKT()` fills a `Linestring` from a WKT stream.
|
||||||
|
//! The first line starting with LINESTRING in the stream will be used.
|
||||||
|
//!
|
||||||
|
//! \tparam Linestring must be a model of `RandomAccessRange` of `CGAL::Point_2`,
|
||||||
|
//! and have:
|
||||||
|
//! - a function `push_back()` that takes a `CGAL::Point_2`.
|
||||||
|
//! - a function `clear()`,
|
||||||
|
//! - a function `resize()` that takes an `size_type`
|
||||||
|
//! - an `operator[]()` that takes a `size_type`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::Point_2`
|
||||||
template<typename LineString>
|
template<typename LineString>
|
||||||
bool read_linestring_WKT(std::istream& in,
|
bool read_linestring_WKT(std::istream& in,
|
||||||
LineString& polyline)
|
LineString& polyline)
|
||||||
|
|
@ -157,6 +202,22 @@ bool read_linestring_WKT(std::istream& in,
|
||||||
return in.good();
|
return in.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `read_multi_linestring_WKT()` overwrites the content of a `MultiLineString`
|
||||||
|
//! with the first line starting with MULTILINESTRING in the stream.
|
||||||
|
//!
|
||||||
|
//! \tparam MultiLineString must be a model of `RandomAccessRange` of `Linestring`,
|
||||||
|
//! and have:
|
||||||
|
//! - a function `push_back()` that takes a `Linestring`,
|
||||||
|
//! - a function `clear()`,
|
||||||
|
//! - a function `resize()` that takes an `size_type`
|
||||||
|
//! - an `operator[]()` that takes a `size_type`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::Point_2`
|
||||||
template<typename MultiLineString>
|
template<typename MultiLineString>
|
||||||
bool read_multi_linestring_WKT(std::istream& in,
|
bool read_multi_linestring_WKT(std::istream& in,
|
||||||
MultiLineString& mls)
|
MultiLineString& mls)
|
||||||
|
|
@ -201,6 +262,17 @@ bool read_multi_linestring_WKT(std::istream& in,
|
||||||
return in.good();
|
return in.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `read_polygon_WKT()` fills `polygon` from a WKT stream.
|
||||||
|
//! The first line starting with POLYGON in the stream will be used.
|
||||||
|
//!
|
||||||
|
//! \tparam Polygon is a `CGAL::General_polygon_with_holes_2`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::General_polygon_with_holes_2`
|
||||||
template<typename Polygon>
|
template<typename Polygon>
|
||||||
bool read_polygon_WKT(std::istream& in,
|
bool read_polygon_WKT(std::istream& in,
|
||||||
Polygon& polygon)
|
Polygon& polygon)
|
||||||
|
|
@ -237,6 +309,22 @@ bool read_polygon_WKT(std::istream& in,
|
||||||
return in.good();
|
return in.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `read_multi_polygon_WKT()` overwrites the content of a `MultiPolygon`
|
||||||
|
//! with the first line starting with MULTIPOLYGON in the stream.
|
||||||
|
//!
|
||||||
|
//! \tparam MultiPolygon must be a model of `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`,
|
||||||
|
//! and have:
|
||||||
|
//! - a function `push_back()` that takes a `CGAL::General_polygon_with_holes_2`,
|
||||||
|
//! - a function `clear()`,
|
||||||
|
//! - a function `resize()` that takes an `size_type`
|
||||||
|
//! - an `operator[]()` that takes a `size_type`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::General_polygon_with_holes_2`
|
||||||
template<typename MultiPolygon>
|
template<typename MultiPolygon>
|
||||||
bool read_multi_polygon_WKT(std::istream& in,
|
bool read_multi_polygon_WKT(std::istream& in,
|
||||||
MultiPolygon& polygons)
|
MultiPolygon& polygons)
|
||||||
|
|
@ -276,6 +364,16 @@ bool read_multi_polygon_WKT(std::istream& in,
|
||||||
return in.good();
|
return in.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `write_point_WKT()` writes `point` into a WKT stream.
|
||||||
|
//!
|
||||||
|
//! \tparam Point is a `CGAL::Point_2`
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::Point_2`
|
||||||
template<typename Point>
|
template<typename Point>
|
||||||
std::ostream& write_point_WKT(std::ostream& out,
|
std::ostream& write_point_WKT(std::ostream& out,
|
||||||
const Point& point)
|
const Point& point)
|
||||||
|
|
@ -290,6 +388,16 @@ std::ostream& write_point_WKT(std::ostream& out,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `write_polygon_WKT()` writes `poly` into a WKT stream.
|
||||||
|
//!
|
||||||
|
//! \tparam Polygon must be a `CGAL::General_polygon_with_holes_2`
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::General_polygon_with_holes_2`
|
||||||
template<typename Polygon>
|
template<typename Polygon>
|
||||||
std::ostream& write_polygon_WKT(std::ostream& out,
|
std::ostream& write_polygon_WKT(std::ostream& out,
|
||||||
const Polygon& poly)
|
const Polygon& poly)
|
||||||
|
|
@ -304,6 +412,16 @@ std::ostream& write_polygon_WKT(std::ostream& out,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `write_linestring_WKT()` writes the content of `ls` into a WKT stream.
|
||||||
|
//!
|
||||||
|
//! \tparam LineString must be a `RandomAccessRange` of `CGAL::Point_2`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//!\see `CGAL::Point_2`
|
||||||
template<typename LineString>
|
template<typename LineString>
|
||||||
std::ostream& write_linestring_WKT(std::ostream& out,
|
std::ostream& write_linestring_WKT(std::ostream& out,
|
||||||
LineString ls)
|
LineString ls)
|
||||||
|
|
@ -319,6 +437,16 @@ std::ostream& write_linestring_WKT(std::ostream& out,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `write_multi_point_WKT()` writes the content of `mp` into a WKT stream.
|
||||||
|
//!
|
||||||
|
//! \tparam MultiPoint must be a `RandomAccessRange` of `CGAL::Point_2`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//!\see `CGAL::Point_2`
|
||||||
template<typename MultiPoint>
|
template<typename MultiPoint>
|
||||||
std::ostream& write_multi_point_WKT(std::ostream& out,
|
std::ostream& write_multi_point_WKT(std::ostream& out,
|
||||||
MultiPoint& mp)
|
MultiPoint& mp)
|
||||||
|
|
@ -333,6 +461,16 @@ std::ostream& write_multi_point_WKT(std::ostream& out,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `write_multi_polygon_WKT()` writes the content of `polygons` into a WKT stream.
|
||||||
|
//!
|
||||||
|
//! \tparam MultiPolygon must be a `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//!\see `CGAL::General_polygon_with_holes_2`
|
||||||
template<typename MultiPolygon>
|
template<typename MultiPolygon>
|
||||||
std::ostream& write_multi_polygon_WKT(std::ostream& out,
|
std::ostream& write_multi_polygon_WKT(std::ostream& out,
|
||||||
MultiPolygon& polygons)
|
MultiPolygon& polygons)
|
||||||
|
|
@ -348,6 +486,16 @@ std::ostream& write_multi_polygon_WKT(std::ostream& out,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! \brief `write_multi_linestring_WKT()` writes the content of `mls` into a WKT stream.
|
||||||
|
//!
|
||||||
|
//! \tparam MultiLineString must be a `RandomAccessRange` of `LineString`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::write_linestring_WKT()`
|
||||||
template<typename MultiLineString>
|
template<typename MultiLineString>
|
||||||
std::ostream& write_multi_linestring_WKT(std::ostream& out,
|
std::ostream& write_multi_linestring_WKT(std::ostream& out,
|
||||||
MultiLineString& mls)
|
MultiLineString& mls)
|
||||||
|
|
@ -374,6 +522,20 @@ std::ostream& write_multi_linestring_WKT(std::ostream& out,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \ingroup PkgStreamSupportRef
|
||||||
|
//!
|
||||||
|
//! reads the content of a WKT stream and fills
|
||||||
|
//! `points`, `polylines` and `polygons` with all the POINT, MULTIPOINT,
|
||||||
|
//! LINESTRING, MULTILINESTRING, POLYGON and MULTIPOLYGON it finds in `input`.
|
||||||
|
//!
|
||||||
|
//! \tparam MultiPoint must be a model of `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`.
|
||||||
|
//! \tparam MultiLineString must be a `RandomAccessRange` of `Linestring`.
|
||||||
|
//! \tparam MultiPolygon must be a model of `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`.
|
||||||
|
//!
|
||||||
|
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
|
||||||
|
//! \attention This function is only available with boost versions starting at 1.56.
|
||||||
|
//!
|
||||||
|
//! \see `CGAL::read_linestring_WKT()`
|
||||||
template<typename MultiPoint,
|
template<typename MultiPoint,
|
||||||
typename MultiLineString,
|
typename MultiLineString,
|
||||||
typename MultiPolygon>
|
typename MultiPolygon>
|
||||||
|
|
@ -451,6 +613,8 @@ std::istream& read_WKT(std::istream& input,
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//end CGAL
|
}//end CGAL
|
||||||
#endif
|
|
||||||
#endif
|
#endif // BOOST VERSION CHECKS
|
||||||
|
#endif // CGAL_IO_WKT_H
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue