mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-17 01:54:42 +00:00
better load/save raster management
This commit is contained in:
parent
d7fd47abbe
commit
3fd2941c09
@ -181,7 +181,7 @@ void reloadMesh(
|
||||
loadMesh(filename, ioPlugin, prePar, meshList, masks, cb);
|
||||
}
|
||||
|
||||
void loadRaster(const QString& filename, MeshDocument& md, vcg::CallBackPos* cb)
|
||||
void loadRaster(const QString& filename, RasterModel& rm, vcg::CallBackPos* cb)
|
||||
{
|
||||
QFileInfo fi(filename);
|
||||
QString extension = fi.suffix();
|
||||
@ -193,14 +193,7 @@ void loadRaster(const QString& filename, MeshDocument& md, vcg::CallBackPos* cb)
|
||||
"Raster " + filename + " cannot be opened. Your MeshLab version "
|
||||
"has not plugin to read " + extension + " file format.");
|
||||
|
||||
RasterModel *rm = md.addNewRaster();
|
||||
try {
|
||||
ioPlugin->openRaster(extension, filename, *rm, cb);
|
||||
}
|
||||
catch(const MLException& e){
|
||||
md.delRaster(rm);
|
||||
throw e;
|
||||
}
|
||||
ioPlugin->openRaster(extension, filename, rm, cb);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ void reloadMesh(
|
||||
|
||||
void loadRaster(
|
||||
const QString& filename,
|
||||
MeshDocument& md,
|
||||
RasterModel& rm,
|
||||
vcg::CallBackPos *cb);
|
||||
|
||||
}
|
||||
|
||||
@ -2125,11 +2125,12 @@ bool MainWindow::importRaster(const QString& fileImg)
|
||||
allFileTime.start();
|
||||
|
||||
for(const QString& fileName : fileNameList) {
|
||||
|
||||
RasterModel *rm = nullptr;
|
||||
try {
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
meshlab::loadRaster(fileName, *meshDoc(), QCallBack);
|
||||
rm = meshDoc()->addNewRaster();
|
||||
meshlab::loadRaster(fileName, *rm, QCallBack);
|
||||
GLA()->Logf(0, "Opened raster %s in %i msec", qUtf8Printable(fileName), t.elapsed());
|
||||
GLA()->resetTrackBall();
|
||||
GLA()->fov = meshDoc()->rm()->shot.GetFovFromFocal();
|
||||
@ -2140,6 +2141,7 @@ bool MainWindow::importRaster(const QString& fileImg)
|
||||
GLA()->Logf(0,"All files opened in %i msec",allFileTime.elapsed());
|
||||
}
|
||||
catch(const MLException& e){
|
||||
meshDoc()->delRaster(rm);
|
||||
QMessageBox::warning(
|
||||
this,
|
||||
tr("Opening Failure"),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user