CGAL 6.1.2 - IO Streams: WKT I/O Functions

CGAL 6.1.2 - IO Streams

Loading...
Searching...
No Matches
Functions
WKT I/O Functions
Reference Manual » I/O Functions

##

I/O Functions for the Well-Known Text (WKT) File Format.

## Functions
template<typename Point >
bool | CGAL::IO::read_point_WKT (std::istream &in, Point &point)
| fills a `Point` from a WKT stream.
template<typename MultiPoint >
bool | CGAL::IO::read_multi_point_WKT (std::istream &in, MultiPoint &mp)
| overwrites the content of a `MultiPoint` with the first line starting with MULTIPOINT in the stream.
template<typename LineString >
bool | CGAL::IO::read_linestring_WKT (std::istream &in, LineString &polyline)
| fills a `Linestring` from a WKT stream.
template<typename MultiLineString >
bool | CGAL::IO::read_multi_linestring_WKT (std::istream &in, MultiLineString &mls)
| overwrites the content of a `MultiLineString` with the first line starting with MULTILINESTRING in the stream.
template<typename Polygon >
bool | CGAL::IO::read_polygon_WKT (std::istream &in, Polygon &polygon)
| fills `polygon` from a WKT stream.
template<typename MultiPolygon >
bool | CGAL::IO::read_multi_polygon_WKT (std::istream &in, MultiPolygon &polygons)
| overwrites the content of a `MultiPolygon` with the first line starting with MULTIPOLYGON in the stream.
template<typename Point >
std::ostream & | CGAL::IO::write_point_WKT (std::ostream &out, const Point &point)
| writes `point` into a WKT stream.
template<typename Polygon >
std::ostream & | CGAL::IO::write_polygon_WKT (std::ostream &out, const Polygon &poly)
| writes `poly` into a WKT stream.
template<typename LineString >
std::ostream & | CGAL::IO::write_linestring_WKT (std::ostream &out, LineString ls)
| writes the content of `ls` into a WKT stream.
template<typename MultiPoint >
std::ostream & | CGAL::IO::write_multi_point_WKT (std::ostream &out, MultiPoint &mp)
| writes the content of `mp` into a WKT stream.
template<typename MultiPolygon >
std::ostream & | CGAL::IO::write_multi_polygon_WKT (std::ostream &out, MultiPolygon &polygons)
| writes the content of `polygons` into a WKT stream.
template<typename MultiLineString >
std::ostream & | CGAL::IO::write_multi_linestring_WKT (std::ostream &out, MultiLineString &mls)
| writes the content of `mls` into a WKT stream.
template<typename MultiPoint , typename MultiLineString , typename MultiPolygon >
bool | CGAL::IO::read_WKT (std::istream &is, MultiPoint &points, MultiLineString &polylines, MultiPolygon &polygons)
| 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`.

## Function Documentation

## ◆ read_linestring_WKT()

template<typename LineString >

bool CGAL::IO::read_linestring_WKT | ( | std::istream & | in,
|  | LineString & | polyline
| ) |  |

`#include <CGAL/IO/WKT.h>`

fills a `Linestring` from a WKT stream.

The first line starting with LINESTRING in the stream will be used.

Template Parameters

  Linestring | must be a model of `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`, and have: a function `push_back()` that takes a point. a function `clear()`, a function `resize()` that takes a `size_type` an `operator[]()` that takes a `size_type`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::Point_2`
  `CGAL::Point_3`

Examples
  Stream_support/Linestring_WKT.cpp.

## ◆ read_multi_linestring_WKT()

template<typename MultiLineString >

bool CGAL::IO::read_multi_linestring_WKT | ( | std::istream & | in,
|  | MultiLineString & | mls
| ) |  |

`#include <CGAL/IO/WKT.h>`

overwrites the content of a `MultiLineString` with the first line starting with MULTILINESTRING in the stream.

Template Parameters

  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 a `size_type` an `operator[]()` that takes a `size_type`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

Examples
  Stream_support/Linestring_WKT.cpp.

## ◆ read_multi_point_WKT()

template<typename MultiPoint >

bool CGAL::IO::read_multi_point_WKT | ( | std::istream & | in,
|  | MultiPoint & | mp
| ) |  |

`#include <CGAL/IO/WKT.h>`

overwrites the content of a `MultiPoint` with the first line starting with MULTIPOINT in the stream.

Template Parameters

  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 a `size_type` an `operator[]()` that takes a `size_type`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::Point_2`
  `CGAL::Point_3`

Examples
  Stream_support/Point_WKT.cpp.

## ◆ read_multi_polygon_WKT()

template<typename MultiPolygon >

bool CGAL::IO::read_multi_polygon_WKT | ( | std::istream & | in,
|  | MultiPolygon & | polygons
| ) |  |

`#include <CGAL/IO/WKT.h>`

overwrites the content of a `MultiPolygon` with the first line starting with MULTIPOLYGON in the stream.

Template Parameters

  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 a `size_type` an `operator[]()` that takes a `size_type`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::General_polygon_with_holes_2`

Examples
  Stream_support/Polygon_WKT.cpp.

## ◆ read_point_WKT()

template<typename Point >

bool CGAL::IO::read_point_WKT | ( | std::istream & | in,
|  | Point & | point
| ) |  |

`#include <CGAL/IO/WKT.h>`

fills a `Point` from a WKT stream.

The first line starting with POINT in the stream will be used.

Template Parameters

  Point | can be a `CGAL::Point_2` or `CGAL::Point_3`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::Point_2`
  `CGAL::Point_3`

## ◆ read_polygon_WKT()

template<typename Polygon >

bool CGAL::IO::read_polygon_WKT | ( | std::istream & | in,
|  | Polygon & | polygon
| ) |  |

`#include <CGAL/IO/WKT.h>`

fills `polygon` from a WKT stream.

The first line starting with POLYGON in the stream will be used.

Template Parameters

  Polygon | is a `CGAL::General_polygon_with_holes_2`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::General_polygon_with_holes_2`

Examples
  Stream_support/Polygon_WKT.cpp.

## ◆ read_WKT()

template<typename MultiPoint , typename MultiLineString , typename MultiPolygon >

bool CGAL::IO::read_WKT | ( | std::istream & | is,
|  | MultiPoint & | points,
|  | MultiLineString & | polylines,
|  | MultiPolygon & | polygons
| ) |  |

`#include <CGAL/IO/WKT.h>`

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`.

Template Parameters

  MultiPoint | must be a model of `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`.
  MultiLineString | must be a `RandomAccessRange` of `Linestring`.
  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.

See also
  `CGAL::IO::read_linestring_WKT()`

## ◆ write_linestring_WKT()

template<typename LineString >

std::ostream & CGAL::IO::write_linestring_WKT | ( | std::ostream & | out,
|  | LineString | ls
| ) |  |

`#include <CGAL/IO/WKT.h>`

writes the content of `ls` into a WKT stream.

Template Parameters

  LineString | must be a `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::Point_2`
  `CGAL::Point_3`

## ◆ write_multi_linestring_WKT()

template<typename MultiLineString >

std::ostream & CGAL::IO::write_multi_linestring_WKT | ( | std::ostream & | out,
|  | MultiLineString & | mls
| ) |  |

`#include <CGAL/IO/WKT.h>`

writes the content of `mls` into a WKT stream.

Template Parameters

  MultiLineString | must be a `RandomAccessRange` of `LineString`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::IO::write_linestring_WKT()`

## ◆ write_multi_point_WKT()

template<typename MultiPoint >

std::ostream & CGAL::IO::write_multi_point_WKT | ( | std::ostream & | out,
|  | MultiPoint & | mp
| ) |  |

`#include <CGAL/IO/WKT.h>`

writes the content of `mp` into a WKT stream.

Template Parameters

  MultiPoint | must be a `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::Point_2`
  `CGAL::Point_2`

## ◆ write_multi_polygon_WKT()

template<typename MultiPolygon >

std::ostream & CGAL::IO::write_multi_polygon_WKT | ( | std::ostream & | out,
|  | MultiPolygon & | polygons
| ) |  |

`#include <CGAL/IO/WKT.h>`

writes the content of `polygons` into a WKT stream.

Template Parameters

  MultiPolygon | must be a `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`.

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::General_polygon_with_holes_2`

Examples
  Stream_support/Polygon_WKT.cpp.

## ◆ write_point_WKT()

template<typename Point >

std::ostream & CGAL::IO::write_point_WKT | ( | std::ostream & | out,
|  | const Point & | point
| ) |  |

`#include <CGAL/IO/WKT.h>`

writes `point` into a WKT stream.

Template Parameters

  Point | is a `CGAL::Point_2` or `CGAL::Point_3`

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::Point_2`
  `CGAL::Point_3`

## ◆ write_polygon_WKT()

template<typename Polygon >

std::ostream & CGAL::IO::write_polygon_WKT | ( | std::ostream & | out,
|  | const Polygon & | poly
| ) |  |

`#include <CGAL/IO/WKT.h>`

writes `poly` into a WKT stream.

Template Parameters

  Polygon | must be a `CGAL::General_polygon_with_holes_2`

Attention
  Only Cartesian Kernels with double or float as `FT` are supported.

See also
  `CGAL::General_polygon_with_holes_2`