Commit 0558df4e authored by Stéphane Albert's avatar Stéphane Albert

ENH: Fixed quicklook generation on 512x512 px2 best-fit and calculation of...

ENH: Fixed quicklook generation on 512x512 px2 best-fit and calculation of histogram on quicklook instead of image screen best-fist.
parent 3be0c3aa
......@@ -723,7 +723,7 @@ MainWindow
/*****************************************************************************/
void
MainWindow
::ImportImage(const QString& filename )
::ImportImage( const QString& filename )
{
//
// Background task.
......@@ -742,7 +742,6 @@ MainWindow
//
// Progress dialog.
TaskProgressDialog progress(
task,
this,
......@@ -755,27 +754,29 @@ MainWindow
progress.setCancelButton( NULL );
progress.setMinimumDuration( 0 );
if( progress.Exec() )
{
assert( CatalogueApplication::Instance() );
assert( CatalogueApplication::Instance()->GetModel()!=NULL );
assert(
CatalogueApplication::Instance()->GetModel()==
CatalogueApplication::Instance()->GetModel< DatabaseModel >()
);
//
// Result.
if( progress.Exec()!=QMessageBox::Accepted )
return;
assert( progress.GetObject< DatasetModel >()!=NULL );
assert( CatalogueApplication::Instance() );
assert( CatalogueApplication::Instance()->GetModel()!=NULL );
assert(
CatalogueApplication::Instance()->GetModel()==
CatalogueApplication::Instance()->GetModel< DatabaseModel >()
);
DatabaseModel* databaseModel =
CatalogueApplication::Instance()->GetModel< DatabaseModel >();
assert( databaseModel!=NULL );
assert( progress.GetObject< DatasetModel >()!=NULL );
databaseModel->SelectDatasetModel(
databaseModel->RegisterDatasetModel(
progress.GetObject< DatasetModel >()
)
);
}
DatabaseModel* databaseModel =
CatalogueApplication::Instance()->GetModel< DatabaseModel >();
assert( databaseModel!=NULL );
databaseModel->SelectDatasetModel(
databaseModel->RegisterDatasetModel(
progress.GetObject< DatasetModel >()
)
);
}
/*****************************************************************************/
......
......@@ -240,6 +240,13 @@ AbstractImageModel
// ID.
m_Id = buildContext->m_Id;
//
// QUICKLOOK.
//
// Build quicklook before histogram because histogram calculation is
// based on quicklook image.
newChildModel< QuicklookModel >( context );
//
// HISTOGRAM.
HistogramModel::BuildContext histogramContext(
......@@ -247,18 +254,9 @@ AbstractImageModel
buildContext->m_Histogram
);
#if 1
// WIP (crashes on reload because serialization methods are not
// fully implemented.
newChildModel< HistogramModel >( &histogramContext );
#else
// Temporay hack to solve segfault.
newChildModel< HistogramModel >();
#endif
//
// QUICKLOOK.
newChildModel< QuicklookModel >( context );
}
/*******************************************************************************/
......
......@@ -38,7 +38,7 @@
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdTextStream.h"
#include "mvdVectorImageModel.h"
#include "mvdQuicklookModel.h"
namespace mvd
{
......
......@@ -143,10 +143,10 @@ public:
// Public methods.
public:
/** Constructor */
/** \brief Constructor. */
HistogramModel( QObject* parent =NULL );
/** Destructor */
/** \brief Destructor. */
virtual ~HistogramModel();
/** */
......@@ -430,9 +430,13 @@ HistogramModel
qDebug() << tr( "%1: Generating histogram (M)..." )
.arg( QDateTime::currentDateTime().toString( Qt::ISODate ) );
TImageModel* imageModel =
qobject_cast< TImageModel* >( parent() );
AbstractImageModel* parentImageModel =
qobject_cast< AbstractImageModel* >( parent() );
assert( parentImageModel!=NULL );
TImageModel* imageModel = parentImageModel->GetQuicklookModel();
assert( imageModel!=NULL );
//
......
......@@ -126,7 +126,7 @@ QuicklookModel
}
// Source stored quicklook image-file.
// TODO: Remove hard-coded 512x512 px size.
// Best fit to 512x512 px² size.
SetFilename( quicklookFilename, 512, 512 );
// Initialize RgbaImageModel.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment