Merge pull request #4396 from janetournois/Polyedron_demo-fix_image_io-jtournois

ImageIO and Polyhedron demo - Add error message when `io_image_plugin` can't save
This commit is contained in:
Sebastien Loriot 2019-12-20 09:46:07 +01:00 committed by GitHub
commit 230850220e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -497,14 +497,19 @@ void _openWriteImage(_image* im, const char *name)
#endif
im->openMode = OM_GZ;
}
#if CGAL_USE_GZFWRITE
else
else
{
#if CGAL_USE_GZFWRITE
im->fd = (_ImageIO_file) gzopen(name, "wb");
im->openMode = OM_FILE;
}
#endif// CGAL_USE_GZFWRITE
#else
fprintf(stderr, "_openWriteImage: error: zlib version 1.2.9 or later\n"
"is required to save in non-compressed files\n");
return;
#endif// CGAL_USE_GZFWRITE
}
#else //CGAL_USE_ZLIB
{
im->fd = (_ImageIO_file) fopen(name, "wb");
im->openMode = OM_FILE;

View File

@ -2130,10 +2130,13 @@ void MainWindow::save(QString filename, QList<CGAL::Three::Scene_item*>& to_save
}
}
if(!saved)
{
QMessageBox::warning(this,
tr("Cannot save"),
tr("The selected object %1 was not saved. (Maybe a wrong extension ?)")
.arg(to_save.front()->name()));
to_save.pop_front();
}
}
void MainWindow::on_actionSaveSnapshot_triggered()

View File

@ -292,7 +292,8 @@ public:
point_image p_im = *im_item->image()->image();
bool ok = _writeImage(&p_im, fileinfo.filePath().toUtf8()) == 0;
items.pop_front();
if(ok)
items.pop_front();
return ok;
}
QString name() const override{ return "segmented images"; }