-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make read_WKT() work with Multipolygon_with_holes
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
Polygon_repair/examples/Polygon_repair/polygons2multipolygon.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
#include <deque> | ||
|
||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> | ||
#include <CGAL/Polygon_repair/repair.h> | ||
#include <CGAL/IO/WKT.h> | ||
|
||
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; | ||
using Point_2 = Kernel::Point_2; | ||
using Polygon_2 = CGAL::Polygon_2<Kernel>; | ||
using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2<Kernel>; | ||
using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2<Kernel>; | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
std::ifstream in((argc > 1) ? argv[1] : CGAL::data_file_path("wkt/norway-polygons.wkt")); | ||
|
||
typedef std::vector<Point_2> MultiPoint; | ||
typedef std::vector<Point_2> LineString; | ||
typedef std::deque<LineString> MultiLineString; | ||
|
||
MultiPoint points; | ||
MultiLineString polylines; | ||
Multipolygon_with_holes_2 polygons; | ||
CGAL::IO::read_WKT(in, points,polylines,polygons); | ||
|
||
Multipolygon_with_holes_2 mp = CGAL::Polygon_repair::repair(polygons); | ||
CGAL::IO::write_multi_polygon_WKT(std::cout, mp); | ||
|
||
return 0; | ||
} |