CGAL 6.2 - IO Streams: Stream_support/Linestring_WKT.cpp

CGAL 6.2 - IO Streams

Loading...
Searching...
No Matches
Stream_support/Linestring_WKT.cpp
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/IO/WKT.h>
#include <iostream>
#include <fstream>
#include <vector>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
int main(int argc, char* argv[])
{
typedef CGAL::Point_2<Kernel> Point;
typedef std::vector<Point> LineString;
typedef std::vector<LineString> MultiLineString;
LineString ls;
{
std::ifstream is((argc>1)?argv[1]:"data/linestring.wkt");
CGAL::IO::read_linestring_WKT(is, ls);
is.close();
}
for(Point p : ls)
std::cout<<p<<std::endl;
ls.clear();
MultiLineString mls;
{
std::ifstream is((argc>2)?argv[2]:"data/multilinestring.wkt");
CGAL::IO::read_multi_linestring_WKT(is, mls);
is.close();
}
for(LineString l : mls)
{
for(const Point& p : l)
std::cout<<p<<std::endl;
}
return 0;
}
CGAL::Exact_predicates_exact_constructions_kernel
CGAL::Point_2
CGAL::IO::read_linestring_WKT
bool read_linestring_WKT(std::istream &in, LineString &polyline)
fills a Linestring from a WKT stream.
Definition: WKT.h:170
CGAL::IO::read_multi_linestring_WKT
bool read_multi_linestring_WKT(std::istream &in, MultiLineString &mls)
overwrites the content of a MultiLineString with the first line starting with MULTILINESTRING in the ...
Definition: WKT.h:205
Kernel