mirror of https://github.com/CGAL/cgal
Make a working IO for Apolonius_graph Demo
This commit is contained in:
parent
80eaf9a8dd
commit
ad115d9628
|
|
@ -214,7 +214,9 @@ MainWindow::on_actionLoadPoints_triggered()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open Points file"),
|
tr("Open Points file"),
|
||||||
".");
|
".",
|
||||||
|
tr("CGAL files (*.wpts.cgal);;"
|
||||||
|
"All files (*)"));
|
||||||
if(! fileName.isEmpty()){
|
if(! fileName.isEmpty()){
|
||||||
open(fileName);
|
open(fileName);
|
||||||
}
|
}
|
||||||
|
|
@ -224,43 +226,42 @@ MainWindow::on_actionLoadPoints_triggered()
|
||||||
void
|
void
|
||||||
MainWindow::open(QString fileName)
|
MainWindow::open(QString fileName)
|
||||||
{
|
{
|
||||||
// wait cursor
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
if(! fileName.isEmpty()){
|
||||||
std::ifstream ifs(qPrintable(fileName));
|
std::ifstream ifs(qPrintable(fileName));
|
||||||
|
|
||||||
K::Point_2 p;
|
K::Weighted_point_2 p;
|
||||||
std::vector<K::Point_2> points;
|
std::vector<Apollonius_site_2> points;
|
||||||
while(ifs >> p) {
|
while(ifs >> p) {
|
||||||
points.push_back(p);
|
points.push_back(Apollonius_site_2(p.point(),p.weight()));
|
||||||
}
|
}
|
||||||
// ag.insert(points.begin(), points.end());
|
ag.insert(points.begin(), points.end());
|
||||||
|
|
||||||
// default cursor
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
this->addToRecentFiles(fileName);
|
this->addToRecentFiles(fileName);
|
||||||
actionRecenter->trigger();
|
actionRecenter->trigger();
|
||||||
Q_EMIT( changed());
|
Q_EMIT( changed());
|
||||||
|
}
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::on_actionSavePoints_triggered()
|
MainWindow::on_actionSavePoints_triggered()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this,
|
QString fileName = QFileDialog::getSaveFileName(this,
|
||||||
tr("Save points"),
|
tr("Save points"),
|
||||||
".");
|
".reg.cgal",
|
||||||
|
tr("Weighted Points (*.wpts.cgal);;"
|
||||||
|
"All (*)"));
|
||||||
if(! fileName.isEmpty()){
|
if(! fileName.isEmpty()){
|
||||||
std::ofstream ofs(qPrintable(fileName));
|
std::ofstream ofs(qPrintable(fileName));
|
||||||
for(Delaunay::Finite_vertices_iterator
|
for(Apollonius::Sites_iterator
|
||||||
vit = ag.finite_vertices_begin(),
|
vit = ag.sites_begin(),
|
||||||
end = ag.finite_vertices_end();
|
end = ag.sites_end();
|
||||||
vit!= end; ++vit)
|
vit!= end; ++vit)
|
||||||
{
|
{
|
||||||
ofs << vit->point() << std::endl;
|
ofs << vit->point()<<" "<<vit->weight()<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue