CGAL 6.0 - IO Streams
Loading...
Searching...
No Matches
Stream_support/Polygon_WKT.cpp
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/IO/WKT.h>
#include <CGAL/Multipolygon_with_holes_2.h>
#include <iostream>
#include <fstream>
#include <deque>
int main(int argc, char* argv[])
{
typedef std::deque<Polygon> MultiPolygon;
typedef CGAL::Multipolygon_with_holes_2<Kernel> Multipolygon_with_holes_2;
{
std::ifstream is((argc>1)?argv[1]:"data/polygons.wkt");
std::list<Polygon> polys;
do
{
Polygon p;
if(!p.outer_boundary().is_empty())
polys.push_back(p);
}while(is.good() && !is.eof());
for(Polygon p : polys)
std::cout<<p<<std::endl;
}
{
std::ifstream is((argc>2)?argv[2]:"data/multipolygon.wkt");
MultiPolygon mp;
for(Polygon p : mp)
std::cout<<p<<std::endl;
}
{
std::ifstream is((argc>2)?argv[2]:"data/multipolygon.wkt");
Multipolygon_with_holes_2 mp;
std::cout << mp << std::endl;
std::cout << std::endl;
}
return 0;
}
bool read_polygon_WKT(std::istream &in, Polygon &polygon)
fills polygon from a WKT stream.
Definition: WKT.h:266
std::ostream & write_multi_polygon_WKT(std::ostream &out, MultiPolygon &polygons)
writes the content of polygons into a WKT stream.
Definition: WKT.h:450
bool 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...
Definition: WKT.h:313