Disable WKT for boost < 1.56

This commit is contained in:
Maxime Gimeno 2018-11-07 11:58:50 +01:00
parent 76c8c1f69f
commit 080f63b1b8
36 changed files with 232 additions and 26 deletions

View File

@ -6,8 +6,9 @@
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
#include <CGAL/point_generators_2.h>
// Qt headers
@ -251,7 +252,9 @@ MainWindow::on_actionLoadPoints_triggered()
tr("Open Points file"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wktk *.WKT);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
open(fileName);
@ -270,7 +273,9 @@ MainWindow::open(QString fileName)
std::ifstream ifs(qPrintable(fileName));
if(fileName.endsWith(".wkt",Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
CGAL::read_multi_point_WKT(ifs, points);
#endif
}
else
{

View File

@ -6,7 +6,9 @@
#include <CGAL/Apollonius_graph_hierarchy_2.h>
#include <CGAL/Apollonius_graph_filtered_traits_2.h>
#include <CGAL/point_generators_2.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
#include <boost/random/linear_congruential.hpp>
#include <boost/random/uniform_real.hpp>
@ -217,7 +219,9 @@ MainWindow::on_actionLoadPoints_triggered()
tr("Open Points file"),
".",
tr("CGAL files (*.wpts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
open(fileName);
@ -236,12 +240,14 @@ MainWindow::open(QString fileName)
std::vector<Apollonius_site_2> points;
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<K::Point_3> point_3_s;
CGAL::read_multi_point_WKT(ifs, point_3_s);
BOOST_FOREACH(const K::Point_3& point_3, point_3_s)
{
points.push_back(Apollonius_site_2(K::Point_2(point_3.x(), point_3.y()), point_3.z()));
}
#endif
} else{
K::Weighted_point_2 p;
while(ifs >> p) {
@ -263,12 +269,15 @@ MainWindow::on_actionSavePoints_triggered()
tr("Save points"),
".reg.cgal",
tr("Weighted Points (*.wpts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files(*.wkt *.WKT);;"
#endif
"All (*)"));
if(! fileName.isEmpty()){
std::ofstream ofs(qPrintable(fileName));
if(fileName.endsWith(".wkt",Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<K::Point_3> points;
for(Apollonius::Sites_iterator
vit = ag.sites_begin(),
@ -280,6 +289,7 @@ MainWindow::on_actionSavePoints_triggered()
vit->weight()));
}
CGAL::write_multi_point_WKT(ofs, points);
#endif
}
else
for(Apollonius::Sites_iterator

View File

@ -13,7 +13,9 @@
#include <CGAL/Polygon_2.h>
#include <CGAL/min_quadrilateral_2.h>
#include <CGAL/rectangular_p_center_2.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
// Qt headers
#include <QtGui>
@ -475,7 +477,9 @@ MainWindow::on_actionLoadPoints_triggered()
tr("Open Points file"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.WKT *.wkt);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
open(fileName);
@ -491,12 +495,14 @@ MainWindow::open(QString fileName)
std::ifstream ifs(qPrintable(fileName));
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
CGAL::read_multi_point_WKT(ifs, points);
BOOST_FOREACH(K::Point_2 p, points)
{
mc.insert(p);
me.insert(p);
}
#endif
}
else
{
@ -524,19 +530,23 @@ MainWindow::on_actionSavePoints_triggered()
tr("Save points"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.WKT *.wkt);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
std::ofstream ofs(qPrintable(fileName));
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<K::Point_2> out_pts;
out_pts.reserve(std::distance(mc.points_begin(),
mc.points_end()));
for(Min_circle::Point_iterator pit = mc.points_begin();
pit != mc.points_end(); ++pit)
out_pts.push_back(*pit);
CGAL::write_multi_point_WKT(ofs, out_pts);
CGAL::write_multi_point_WKT(ofs, out_pts);
#endif
}
else
{

View File

@ -9,7 +9,9 @@
#include <CGAL/intersections.h>
#include <CGAL/Circular_kernel_2.h>
#include <CGAL/Object.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
// Qt headers
#include <QtGui>
@ -213,7 +215,10 @@ MainWindow::on_actionLoadLineAndCircularArcs_triggered()
tr("Open Line and Circular Arc File"),
".",
tr("Edge files (*.arc)\n"
"WKT files (*.wkt *.WKT)\n"));
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT)\n"
#endif
));
if(! fileName.isEmpty()){
open(fileName);
this->addToRecentFiles(fileName);
@ -230,6 +235,7 @@ MainWindow::open(QString fileName)
double x,y;
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
//read pairs as Line_arc_2 and triplets as circular_arc_2
do
{
@ -272,6 +278,7 @@ MainWindow::open(QString fileName)
}
}while(ifs.good() && !ifs.eof());
ifs.close();
#endif
}
else
{

View File

@ -31,7 +31,9 @@
#include <QActionGroup>
#include <QFileDialog>
#include <QInputDialog>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
#include <fstream>
@ -280,7 +282,9 @@ MainWindow::on_actionLoadPoints_triggered()
tr("Open Points file"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
open(fileName);
@ -298,7 +302,9 @@ MainWindow::open(QString fileName)
std::ifstream ifs(qPrintable(fileName));
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
CGAL::read_multi_point_WKT(ifs, m_sites);
#endif
}
else
{
@ -323,13 +329,17 @@ MainWindow::on_actionSavePoints_triggered()
tr("Save points"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()) {
std::ofstream ofs(qPrintable(fileName));
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
if(fileName.endsWith(".wkt", Qt::CaseInsensitive)){
#if BOOST_VERSION >= 105600
CGAL::write_multi_point_WKT(ofs, m_sites);
else
#endif
}else
for(Points::iterator it = m_sites.begin();
it != m_sites.end(); ++it)
{

View File

@ -6,7 +6,9 @@
#include <CGAL/Periodic_2_Delaunay_triangulation_2.h>
#include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h>
#include <CGAL/point_generators_2.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
// Qt headers
#include <QtGui>
@ -351,7 +353,9 @@ MainWindow::on_actionLoadPoints_triggered()
tr("Open Points file"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
open(fileName);
@ -370,7 +374,9 @@ MainWindow::open(QString fileName)
std::vector<Point_2> points;
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
CGAL::read_multi_point_WKT(ifs, points);
#endif
}
else
{
@ -396,12 +402,15 @@ MainWindow::on_actionSavePoints_triggered()
tr("Save points"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
std::ofstream ofs(qPrintable(fileName));
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<Point_2> points;
points.reserve(std::distance(triang.unique_vertices_begin(),
triang.unique_vertices_end()));
@ -413,6 +422,7 @@ MainWindow::on_actionSavePoints_triggered()
points.push_back(vit->point());
}
CGAL::write_multi_point_WKT(ofs, points);
#endif
}
else
{

View File

@ -11,7 +11,9 @@
#include <CGAL/linear_least_squares_fitting_2.h>
#include <CGAL/extremal_polygon_2.h>
#include <CGAL/minkowski_sum_2.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
// Qt headers
#include <QtGui>
@ -230,7 +232,9 @@ MainWindow::on_actionLoadPolygon_triggered()
".",
tr( "Polyline files (*.polygons.cgal);;"
"WSL files (*.wsl);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All file (*)"));
if(! fileName.isEmpty()){
open(fileName);
@ -245,10 +249,12 @@ MainWindow::open(QString fileName)
poly.clear();
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
CGAL::Polygon_with_holes_2<K> P;
CGAL::read_polygon_WKT(ifs, P);
poly = Polygon2(P.outer_boundary().begin(),
P.outer_boundary().end());
#endif
}
else
{
@ -268,16 +274,20 @@ MainWindow::on_actionSavePolygon_triggered()
tr("Save Polygon"),
".",
tr( "Polyline files (*.polygons.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All file (*)"));
if(! fileName.isEmpty()){
std::ofstream ofs(qPrintable(fileName));
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
CGAL::Polygon_2<K> P(poly.begin(),
poly.end());
CGAL::Polygon_with_holes_2<K> Pwh(P);
CGAL::write_polygon_WKT(ofs, Pwh);
#endif
}
else
ofs << poly;

View File

@ -24,7 +24,9 @@
#include <CGAL/Qt/GraphicsViewPolylineInput.h>
#include <CGAL/Qt/SegmentDelaunayGraphGraphicsItem.h>
#include <CGAL/Constraints_loader.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
//#include <CGAL/Qt/Converter.h>
// the two base classes
@ -245,8 +247,10 @@ MainWindow::open(QString fileName)
loadEdgConstraints(fileName);
this->addToRecentFiles(fileName);
} else if(fileName.endsWith(".wkt", Qt::CaseInsensitive)){
#if BOOST_VERSION >= 105600
loadWKTConstraints(fileName);
this->addToRecentFiles(fileName);
#endif
}
}
}
@ -259,7 +263,10 @@ MainWindow::on_actionLoadSegments_triggered()
".",
tr("Edge files (*.edg);;"
"Polyline files (*.polygons.cgal);;"
"WKT files (*.wkt *.WKT)"));
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT)"
#endif
));
open(fileName);
}
@ -333,8 +340,13 @@ MainWindow::loadEdgConstraints(QString fileName)
}
void
MainWindow::loadWKTConstraints(QString fileName)
MainWindow::loadWKTConstraints(QString
#if BOOST_VERSION >= 105600
fileName
#endif
)
{
#if BOOST_VERSION >= 105600
typedef CGAL::Polygon_with_holes_2<K> Polygon;
typedef std::vector<K::Point_2> LineString;
@ -401,6 +413,7 @@ MainWindow::loadWKTConstraints(QString fileName)
}while(ifs.good() && !ifs.eof());
Q_EMIT( changed());
actionRecenter->trigger();
#endif
}
void

View File

@ -22,7 +22,9 @@
#include <CGAL/Qt/GraphicsViewPolylineInput.h>
#include <CGAL/Qt/SegmentDelaunayGraphLinfGraphicsItem.h>
#include <CGAL/Constraints_loader.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
//#include <CGAL/Qt/Converter.h>
// the two base classes
@ -269,8 +271,10 @@ MainWindow::open(QString fileName)
loadSitesInput(fileName);
this->addToRecentFiles(fileName);
} else if(fileName.endsWith(".wkt", Qt::CaseInsensitive)){
#if BOOST_VERSION >= 105600
loadWKT(fileName);
this->addToRecentFiles(fileName);
#endif
}
}
}
@ -288,7 +292,9 @@ MainWindow::on_actionLoadSegments_triggered()
"Pts files (*.pts);;"
"Edge files (*.edg);;"
"Polylines files (*.polygons.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.WKT *.wkt)"
#endif
));
open(fileName);
}
@ -383,8 +389,13 @@ MainWindow::loadPoints(QString fileName)
}
void
MainWindow::loadWKT(QString fileName)
MainWindow::loadWKT(QString
#if BOOST_VERSION >= 105600
fileName
#endif
)
{
#if BOOST_VERSION >= 105600
std::ifstream ifs(qPrintable(fileName));
//Points
do
@ -469,6 +480,7 @@ MainWindow::loadWKT(QString fileName)
Q_EMIT( changed());
actionRecenter->trigger();
#endif
}
void

View File

@ -18,7 +18,9 @@
#include <CGAL/Qt/SegmentsGraphicsItem.h>
#include <CGAL/Qt/PolylinesGraphicsItem.h>
#include <CGAL/Qt/GraphicsViewPolylineInput.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
// for viewportsBbox
#include <CGAL/Qt/utility.h>
@ -248,7 +250,9 @@ MainWindow::on_actionLoadSegments_triggered()
tr("Open segment file"),
".",
tr("Edge files (*.edg);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
open(fileName);
@ -264,6 +268,7 @@ MainWindow::open(QString fileName)
std::ifstream ifs(qPrintable(fileName));
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<std::vector<Point_2> > mls;
CGAL::read_multi_linestring_WKT(ifs, mls);
BOOST_FOREACH(const std::vector<Point_2>& ls, mls)
@ -273,6 +278,7 @@ MainWindow::open(QString fileName)
Segment_2 seg(ls[0], ls[1]);
input.push_back(seg);
}
#endif
}
else {
std::copy(std::istream_iterator<Segment_2>(ifs),
@ -296,13 +302,16 @@ MainWindow::on_actionSaveSegments_triggered()
tr("Save points"),
".",
tr("Edge files (*.edg);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
std::ofstream ofs(qPrintable(fileName));
ofs.precision(12);
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<std::vector<Point_2> >mls;
BOOST_FOREACH(const Segment_2& seg, input)
{
@ -313,6 +322,7 @@ MainWindow::on_actionSaveSegments_triggered()
}
CGAL::write_multi_linestring_WKT(ofs, mls);
}
#endif
else
std::copy(input.begin(), input.end(), std::ostream_iterator<Segment_2>(ofs, "\n"));
}

View File

@ -15,7 +15,9 @@
// GraphicsView items and event filters (input classes)
#include <CGAL/Qt/PointsInKdTreeGraphicsItem.h>
#include <CGAL/Qt/utility.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
// the two base classes
#include "ui_Spatial_searching_2.h"
@ -245,7 +247,9 @@ MainWindow::on_actionLoadPoints_triggered()
tr("Open Points file"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
open(fileName);
@ -265,7 +269,9 @@ MainWindow::open(QString fileName)
std::vector<K::Point_2> points;
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
CGAL::read_multi_point_WKT(ifs, points);
#endif
}
else{
while(ifs >> p) {

View File

@ -20,7 +20,9 @@
// for viewportsBbox
#include <CGAL/Qt/utility.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
// the two base classes
#include "ui_Stream_lines_2.h"
#include <CGAL/Qt/DemosMainWindow.h>
@ -164,10 +166,15 @@ MainWindow::generate()
void
MainWindow::on_actionLoadPoints_triggered()
{
#if BOOST_VERSION >= 105600
#endif
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open grid file"),
".",
tr("WKT files (*.wkt *.WKT)"));
"."
#if BOOST_VERSION >= 105600
,tr("WKT files (*.wkt *.WKT)")
#endif
);
if(! fileName.isEmpty()){
open(fileName);
}
@ -186,6 +193,7 @@ MainWindow::open(QString fileName)
iXSize = iYSize = 512;
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<std::vector<Point_2> > mp;
int size= -1;
do
@ -207,6 +215,10 @@ MainWindow::open(QString fileName)
{
regular_grid->set_field(i, j, Vector(mp[j][i].x(), mp[j][i].y()));
}
#else
QApplication::restoreOverrideCursor();
return;
#endif
}
else{
unsigned int x_samples, y_samples;
@ -235,7 +247,7 @@ MainWindow::open(QString fileName)
void
MainWindow::on_actionSavePoints_triggered()
{
#if BOOST_VERSION >= 105600
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save points"),
".",
@ -257,7 +269,7 @@ MainWindow::on_actionSavePoints_triggered()
}
ofs.close();
}
#endif
}

View File

@ -22,7 +22,9 @@
#include <CGAL/Random.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/Timer.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
// Qt headers
#include <QtGui>
@ -523,7 +525,9 @@ MainWindow::open(QString fileName)
} else if(fileName.endsWith(".poly")){
loadPolyConstraints(fileName);
} else if(fileName.endsWith(".wkt")){
#if BOOST_VERSION >= 105600
loadWKT(fileName);
#endif
}
this->addToRecentFiles(fileName);
}
@ -541,14 +545,21 @@ MainWindow::on_actionLoadConstraints_triggered()
"Polyline files (*.polygons.cgal);;"
"Poly files (*.poly);;"
"CGAL files (*.cpts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.WKT *.wkt);;"
#endif
"All (*)"));
open(fileName);
}
void
MainWindow::loadWKT(QString filename)
MainWindow::loadWKT(QString
#if BOOST_VERSION >= 105600
filename
#endif
)
{
#if BOOST_VERSION >= 105600
//Polygons todo : make it multipolygons
std::ifstream ifs(qPrintable(filename));
do
@ -636,6 +647,7 @@ MainWindow::loadWKT(QString filename)
discoverComponents(cdt, m_seeds);
Q_EMIT( changed());
actionRecenter->trigger();
#endif
}
void

View File

@ -21,7 +21,9 @@
#include "TriangulationPointInputAndConflictZone.h"
#include <CGAL/Qt/TriangulationGraphicsItem.h>
#include <CGAL/Qt/VoronoiGraphicsItem.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
// for viewportsBbox
#include <CGAL/Qt/utility.h>
@ -318,7 +320,9 @@ MainWindow::on_actionLoadPoints_triggered()
tr("Open Points file"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.WKT *.wkt);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
open(fileName);
@ -337,7 +341,9 @@ MainWindow::open(QString fileName)
std::vector<K::Point_2> points;
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
CGAL::read_multi_point_WKT(ifs, points);
#endif
}
else
while(ifs >> p) {
@ -362,12 +368,15 @@ MainWindow::on_actionSavePoints_triggered()
tr("Save points"),
".",
tr("CGAL files (*.pts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.WKT *.wkt);;"
#endif
"All files (*)"));
if(! fileName.isEmpty()){
std::ofstream ofs(qPrintable(fileName));
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<K::Point_2> points;
points.reserve(dt.number_of_vertices());
for(Delaunay::Finite_vertices_iterator
@ -378,6 +387,7 @@ MainWindow::on_actionSavePoints_triggered()
points.push_back(vit->point());
}
CGAL::write_multi_point_WKT(ofs, points);
#endif
}
else
for(Delaunay::Finite_vertices_iterator

View File

@ -3,7 +3,9 @@
// CGAL headers
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Regular_triangulation_2.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
#include <CGAL/point_generators_2.h>
// Qt headers
@ -243,7 +245,9 @@ MainWindow::on_actionLoadPoints_triggered()
tr("Open Points file"),
".",
tr("Weighted Points (*.wpts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All (*)"));
if(! fileName.isEmpty()){
@ -251,12 +255,14 @@ MainWindow::on_actionLoadPoints_triggered()
std::vector<Weighted_point_2> points;
if(fileName.endsWith(".wkt",Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<K::Point_3> points_3;
CGAL::read_multi_point_WKT(ifs, points_3);
BOOST_FOREACH(const K::Point_3& p, points_3)
{
points.push_back(Weighted_point_2(K::Point_2(p.x(), p.y()), p.z()));
}
#endif
}
else
{
@ -280,12 +286,15 @@ MainWindow::on_actionSavePoints_triggered()
tr("Save points"),
".reg.cgal",
tr("Weighted Points (*.wpts.cgal);;"
#if BOOST_VERSION >= 105600
"WKT files (*.wkt *.WKT);;"
#endif
"All (*)"));
if(! fileName.isEmpty()){
std::ofstream ofs(qPrintable(fileName));
if(fileName.endsWith(".wkt",Qt::CaseInsensitive))
{
#if BOOST_VERSION >= 105600
std::vector<K::Point_3> points_3;
for(Regular::Finite_vertices_iterator
vit = dt.finite_vertices_begin(),
@ -297,6 +306,7 @@ MainWindow::on_actionSavePoints_triggered()
vit->point().weight()));
}
CGAL::write_multi_point_WKT(ofs, points_3);
#endif
}
else
{

View File

@ -9,7 +9,9 @@
#include <CGAL/assertions_behaviour.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Timer.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
//#define CGAL_TESTING_POLYLINE_SIMPLIFICATION
//#define CGAL_POLYLINE_SIMPLIFICATION_TRACE_LEVEL 15
@ -341,8 +343,10 @@ MainWindow::open(QString fileName)
this->addToRecentFiles(fileName);
}
else if(fileName.endsWith(".wkt")){
#if BOOST_VERSION >= 105600
loadWKT(fileName);
this->addToRecentFiles(fileName);
#endif
}
}
}
@ -352,8 +356,10 @@ MainWindow::on_actionLoadConstraints_triggered()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Constraint File"),
"../data",
tr("Polylines (*.osm *.wkt);;")
"../data"
#if BOOST_VERSION >= 105600
,tr("Polylines (*.osm *.wkt);;")
#endif
);
open(fileName);
}
@ -370,8 +376,13 @@ std::string trim_right ( std::string str )
return std::string("") ;
}
void MainWindow::loadWKT(QString fileName)
void MainWindow::loadWKT(QString
#if BOOST_VERSION >= 105600
fileName
#endif
)
{
#if BOOST_VERSION >= 105600
typedef std::vector<Point_2> MultiPoint;
typedef std::vector<Point_2> LineString;
@ -409,6 +420,7 @@ void MainWindow::loadWKT(QString fileName)
Q_EMIT( changed());
actionRecenter->trigger();
#endif
}

View File

@ -6,7 +6,9 @@
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
#include <CGAL/Polyline_simplification_2/simplify.h>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#endif
namespace PS = CGAL::Polyline_simplification_2;
@ -51,6 +53,7 @@ void print(const CT& ct, Constraint_id cid)
int main(int argc, char* argv[])
{
std::ifstream ifs( (argc==1)?"data/polygon.wkt":argv[1]);
#if BOOST_VERSION >= 105600
const bool remove_points = false;
CT ct;
Polygon_with_holes_2 P;
@ -69,7 +72,9 @@ int main(int argc, char* argv[])
PS::simplify(ct, cid, Cost(), Stop(0.5), remove_points);
ct.remove_points_without_corresponding_vertex(cid);
print(ct, cid);
#else
ifs.close();
#endif
return 0;
}

View File

@ -1,3 +1,4 @@
#if BOOST_VERSION >= 105600
#include <iostream>
#include <fstream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -54,5 +55,6 @@ int main(int argc, char* argv[])
}
return 0;
}
#endif

View File

@ -1,3 +1,4 @@
#if BOOST_VERSION >= 105600
#include <iostream>
#include <fstream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -27,5 +28,6 @@ int main(int argc, char* argv[])
return 0;
}
#endif

View File

@ -1,3 +1,4 @@
#if BOOST_VERSION >= 105600
#include <iostream>
#include <fstream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -29,5 +30,4 @@ int main(int argc, char* argv[])
}
return 0;
}
#endif

View File

@ -296,6 +296,7 @@ istream& operator>>(istream& is, Class c);
//!
//! \tparam Point can be a `CGAL::Point_2` or `CGAL::Point_3`.
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//!
//! \see `CGAL::Point_2`
//! \see `CGAL::Point_3`
@ -316,7 +317,7 @@ read_point_WKT( std::istream& in,
//! - an `operator[]()` that takes a `size_type`.
//!
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//!
//! \attention This function is only available with boost versions starting at 1.56.
//! \see `CGAL::Point_2`
//! \see `CGAL::Point_3`
template<typename MultiPoint>
@ -336,6 +337,7 @@ read_multi_point_WKT( std::istream& in,
//! - a function `resize()` that takes an `size_type`
//! - an `operator[]()` that takes a `size_type`.
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//! \see `CGAL::Point_2`
template<typename LineString>
std::istream&
@ -353,6 +355,7 @@ read_linestring_WKT( std::istream& in,
//! - a function `resize()` that takes an `size_type`
//! - an `operator[]()` that takes a `size_type`.
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//!
//! \see `CGAL::Point_2`
template<typename MultiLineString>
@ -366,6 +369,7 @@ read_multi_linestring_WKT( std::istream& in,
//!
//! \tparam Polygon is a `CGAL::General_polygon_with_holes_2`.
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//!
//! \see `CGAL::General_polygon_with_holes_2`
template<typename Polygon>
@ -384,6 +388,7 @@ read_polygon_WKT( std::istream& in,
//! - a function `resize()` that takes an `size_type`
//! - an `operator[]()` that takes a `size_type`.
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//! \see `CGAL::General_polygon_with_holes_2`
template<typename MultiPolygon>
@ -395,6 +400,7 @@ read_multi_polygon_WKT( std::istream& in,
//! \brief `write_point_WKT()` writes `point` into a WKT stream.
//! \tparam Point is a `CGAL::Point_2`
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//! \see `CGAL::Point_2`
template<typename Point>
std::ostream&
@ -405,6 +411,7 @@ write_point_WKT( std::ostream& out,
//! \brief `write_polygon_WKT()` writes `poly` into a WKT stream.
//! \tparam Polygon must be a `CGAL::General_polygon_with_holes_2`
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//! \see `CGAL::General_polygon_with_holes_2`
template<typename Polygon>
std::ostream&
@ -416,6 +423,7 @@ write_polygon_WKT( std::ostream& out,
//! into a WKT stream.
//! \tparam LineString must be a `RandomAccessRange` of `CGAL::Point_2`.
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//!\see `CGAL::Point_2`
template<typename LineString>
std::ostream&
@ -427,6 +435,7 @@ write_linestring_WKT( std::ostream& out,
//! into a WKT stream.
//! \tparam MultiPoint must be a `RandomAccessRange` of `CGAL::Point_2`.
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//!\see `CGAL::Point_2`
template<typename MultiPoint>
std::ostream&
@ -438,6 +447,7 @@ write_multi_point_WKT( std::ostream& out,
//! into a WKT stream.
//! \tparam MultiPolygon must be a `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`.
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//!\see `CGAL::General_polygon_with_holes_2`
template<typename MultiPolygon>
std::ostream&
@ -449,6 +459,7 @@ write_multi_polygon_WKT( std::ostream& out,
//! into a WKT stream.
//! \tparam MultiLineString must be a `RandomAccessRange` of `LineString`.
//! \attention Only Cartesian Kernels with double or float as `FT` are supported.
//! \attention This function is only available with boost versions starting at 1.56.
//! \see `CGAL::write_linestring_WKT()`
template<typename MultiLineString>
std::ostream&
@ -463,6 +474,7 @@ write_multi_linestring_WKT( std::ostream& out,
//! \tparam MultiLineString must be a `RandomAccessRange` of `Linestring`.
//! \tparam 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.
//! \attention This function is only available with boost versions starting at 1.56.
//! \see `CGAL::read_linestring_WKT()`
template<typename MultiPoint,
typename MultiLineString,

View File

@ -1,3 +1,4 @@
#if BOOST_VERSION >= 105600
#include <iostream>
#include <fstream>
@ -39,3 +40,4 @@ int main(int argc, char* argv[])
}
}
#endif

View File

@ -1,3 +1,4 @@
#if BOOST_VERSION >= 105600
#include <iostream>
#include <fstream>
@ -29,3 +30,4 @@ int main(int argc, char* argv[])
}
is.close();
}
#endif

View File

@ -1,3 +1,4 @@
#if BOOST_VERSION >= 105600
#include <iostream>
#include <fstream>
@ -44,3 +45,4 @@ int main(int argc, char* argv[])
}
return 0;
}
#endif

View File

@ -1,3 +1,4 @@
#if BOOST_VERSION >= 105600
#include <iostream>
#include <fstream>
@ -42,3 +43,4 @@ int main(int argc, char* argv[])
}
return 0;
}
#endif

View File

@ -20,12 +20,12 @@
#ifndef CGAL_IO_WKT_H
#define CGAL_IO_WKT_H
#if BOOST_VERSION >= 105600
#include <iostream>
#include <sstream>
#include <string>
#include <boost/geometry/multi/multi.hpp>
#include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/foreach.hpp>
@ -395,3 +395,4 @@ read_WKT( std::istream& input,
}
}//end CGAL
#endif
#endif

View File

@ -17,6 +17,7 @@
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Maxime Gimeno
#if BOOST_VERSION >= 105600
#ifndef CGAL_IO_TRAITS_LINESTRING_H
#define CGAL_IO_TRAITS_LINESTRING_H
@ -35,3 +36,4 @@ template< typename R> struct tag<CGAL::internal::Geometry_container<R, linestrin
}}} //end namespaces
#endif // TRAITS_LINESTRING_H
#endif

View File

@ -20,7 +20,7 @@
#ifndef CGAL_IO_TRAITS_MULTILINESTRING_H
#define CGAL_IO_TRAITS_MULTILINESTRING_H
#if BOOST_VERSION >= 105600
#include <CGAL/internal/Geometry_container.h>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/wkt/read.hpp>
@ -37,3 +37,4 @@ struct tag<CGAL::internal::Geometry_container<R, multi_linestring_tag> >
}//end geometry
}//end boost
#endif // TRAITS_MULTILINESTRING_H
#endif

View File

@ -20,6 +20,7 @@
#ifndef CGAL_IO_TRAITS_MULTIPOINT_H
#define CGAL_IO_TRAITS_MULTIPOINT_H
#if BOOST_VERSION >= 105600
#include <CGAL/internal/Geometry_container.h>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/wkt/read.hpp>
@ -36,3 +37,4 @@ struct tag<CGAL::internal::Geometry_container<R, multi_point_tag > >
}//end geometry
}//end boost
#endif // TRAITS_MULTIPOINT_H
#endif

View File

@ -20,6 +20,7 @@
#ifndef CGAL_IO_TRAITS_MULTIPOLYGON_H
#define CGAL_IO_TRAITS_MULTIPOLYGON_H
#if BOOST_VERSION >= 105600
#include <CGAL/internal/Geometry_container.h>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/wkt/read.hpp>
@ -38,4 +39,5 @@ struct tag<CGAL::internal::Geometry_container<R, multi_polygon_tag> >
}//end boost
#endif
#endif

View File

@ -20,7 +20,7 @@
#ifndef CGAL_IO_TRAITS_POINT_H
#define CGAL_IO_TRAITS_POINT_H
#if BOOST_VERSION >= 105600
#include <CGAL/number_utils.h>
#include <CGAL/Point_2.h>
#include <boost/geometry/io/wkt/write.hpp>
@ -74,3 +74,4 @@ struct access<CGAL::Point_2<K> , 1>
}}}//end namespaces
#endif
#endif

View File

@ -20,7 +20,7 @@
#ifndef CGAL_IO_TRAITS_POINT_3_H
#define CGAL_IO_TRAITS_POINT_3_H
#if BOOST_VERSION >= 105600
#include <CGAL/number_utils.h>
#include <CGAL/Point_3.h>
#include <boost/geometry/io/wkt/write.hpp>
@ -88,3 +88,4 @@ struct access<CGAL::Point_3<K> , 2>
}}}//end namespaces
#endif
#endif

View File

@ -20,6 +20,7 @@
#ifndef CGAL_IO_TRAITS_POLYGON_H
#define CGAL_IO_TRAITS_POLYGON_H
#if BOOST_VERSION >= 105600
#include <CGAL/Polygon_2.h>
#include <CGAL/Polygon_with_holes_2.h>
#include <CGAL/Point_2.h>
@ -91,3 +92,4 @@ struct range_value<CGAL::Polygon_2<K> >
}//end boost
#endif
#endif

View File

@ -20,6 +20,7 @@
#ifndef GEOMETRY_CONTAINER_H
#define GEOMETRY_CONTAINER_H
#if BOOST_VERSION >= 105600
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/wkt/read.hpp>
#include <boost/shared_ptr.hpp>
@ -123,3 +124,4 @@ struct range_mutable_iterator<CGAL::internal::Geometry_container<T, TAG> >
}//end boost
#endif // GEOMETRY_CONTAINER_H
#endif

View File

@ -1,6 +1,6 @@
#include <iostream>
#include <fstream>
#if BOOST_VERSION >= 105600
#include <CGAL/IO/WKT.h>
#include <CGAL/Simple_cartesian.h>
@ -67,3 +67,5 @@ int main()
std::cout<<"WKT reading test passed."<<std::endl;
return 0;
}
#endif

View File

@ -1,3 +1,4 @@
#if BOOST_VERSION >= 105600
#include <iostream>
#include <fstream>
@ -201,3 +202,4 @@ int main()
std::cout<<"WKT writing test passed."<<std::endl;
return 0;
}
#endif