mirror of https://github.com/CGAL/cgal
The example can also read in a polygon with 3D points
This commit is contained in:
parent
4510260e36
commit
a95bfa77c8
|
|
@ -1,15 +1,17 @@
|
||||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||||
|
#include <CGAL/Projection_traits_xy_3.h>
|
||||||
#include <CGAL/IO/WKT.h>
|
#include <CGAL/IO/WKT.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||||
|
typedef CGAL::Projection_traits_xy_3<K> Kernel;
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
typedef CGAL::Point_2<Kernel> Point;
|
typedef Kernel::Point_2 Point;
|
||||||
typedef std::vector<Point> MultiPoint;
|
typedef std::vector<Point> MultiPoint;
|
||||||
|
|
||||||
typedef std::vector<Point> LineString;
|
typedef std::vector<Point> LineString;
|
||||||
|
|
@ -23,6 +25,7 @@ int main(int argc, char* argv[])
|
||||||
MultiPoint points;
|
MultiPoint points;
|
||||||
MultiLineString polylines;
|
MultiLineString polylines;
|
||||||
MultiPolygon polygons;
|
MultiPolygon polygons;
|
||||||
|
|
||||||
CGAL::IO::read_WKT(is, points,polylines,polygons);
|
CGAL::IO::read_WKT(is, points,polylines,polygons);
|
||||||
|
|
||||||
for(Point p : points)
|
for(Point p : points)
|
||||||
|
|
@ -30,8 +33,9 @@ int main(int argc, char* argv[])
|
||||||
for(LineString ls : polylines)
|
for(LineString ls : polylines)
|
||||||
for(Point p : ls)
|
for(Point p : ls)
|
||||||
std::cout<<p<<std::endl;
|
std::cout<<p<<std::endl;
|
||||||
for(Polygon p : polygons)
|
for(Polygon p : polygons){
|
||||||
std::cout<<p<<std::endl;
|
std::cout<<p<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue