mirror of https://github.com/CGAL/cgal
Allow to load a .cgal file (result of the operator<< of a CDT)
This commit is contained in:
parent
85dfc17bf2
commit
c6b789ca60
|
|
@ -234,6 +234,8 @@ public slots:
|
||||||
|
|
||||||
void on_actionLoadConstraints_triggered();
|
void on_actionLoadConstraints_triggered();
|
||||||
|
|
||||||
|
void loadFile(QString);
|
||||||
|
|
||||||
void loadPolygonConstraints(QString);
|
void loadPolygonConstraints(QString);
|
||||||
|
|
||||||
void loadEdgConstraints(QString);
|
void loadEdgConstraints(QString);
|
||||||
|
|
@ -423,7 +425,10 @@ void
|
||||||
MainWindow::open(QString fileName)
|
MainWindow::open(QString fileName)
|
||||||
{
|
{
|
||||||
if(! fileName.isEmpty()){
|
if(! fileName.isEmpty()){
|
||||||
if(fileName.endsWith(".plg")){
|
if(fileName.endsWith(".cgal")){
|
||||||
|
loadFile(fileName);
|
||||||
|
this->addToRecentFiles(fileName);
|
||||||
|
} else if(fileName.endsWith(".plg")){
|
||||||
loadPolygonConstraints(fileName);
|
loadPolygonConstraints(fileName);
|
||||||
this->addToRecentFiles(fileName);
|
this->addToRecentFiles(fileName);
|
||||||
} else if(fileName.endsWith(".edg")){
|
} else if(fileName.endsWith(".edg")){
|
||||||
|
|
@ -444,6 +449,18 @@ MainWindow::on_actionLoadConstraints_triggered()
|
||||||
open(fileName);
|
open(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWindow::loadFile(QString fileName)
|
||||||
|
{
|
||||||
|
std::ifstream ifs(qPrintable(fileName));
|
||||||
|
ifs >> cdt;
|
||||||
|
if(!ifs) abort();
|
||||||
|
initializeID(cdt);
|
||||||
|
discoverComponents(cdt);
|
||||||
|
emit(changed());
|
||||||
|
actionRecenter->trigger();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::loadPolygonConstraints(QString fileName)
|
MainWindow::loadPolygonConstraints(QString fileName)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue