Commit ea990457 authored by Otmane Lahlou's avatar Otmane Lahlou

ADD: class in charge of generating appliation mvd2 mainWindow title

parent f4ace00b
......@@ -29,6 +29,7 @@ set( Common_SOURCES
mvdTypes.cxx
mvdVectorImageModel.cxx
mvdApplicationsToolBox.cxx
mvdMainWindowTitleLoader.cxx
mvdApplicationsBrowser.cxx
)
......@@ -58,6 +59,7 @@ set( Common_HEADERS_MOC
mvdStatusBarWidget.h
mvdVectorImageModel.h
mvdApplicationsToolBox.h
mvdMainWindowTitleLoader.h
mvdApplicationsBrowser.h
)
......
/*=========================================================================
Program: Monteverdi2
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mvdMainWindowTitleLoader.h"
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
//
// System includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdVectorImageModel.h"
namespace mvd
{
MainWindowTitleLoader
::MainWindowTitleLoader(VectorImageModel* model):
m_Model(model)
{
}
void
MainWindowTitleLoader
::LoadTitle()
{
// This method is executed in a separate thread
std::ostringstream oss;
oss<<PROJECT_NAME<<" - "<<otb::System::GetShortFileName(ToStdString(m_Model->GetFilename()));
oss<<" ("<<m_Model->GetNbComponents()<<tr(" bands, ").toLatin1().constData();
oss<<m_Model->GetNativeLargestRegion().GetSize()[0];
oss<<"x"<<m_Model->GetNativeLargestRegion().GetSize()[1]<<tr(" pixels)").toLatin1().constData();
emit TitleLoaded(FromStdString(oss.str()) );
// add the placename to the title if any
std::string placename = m_Model->GetCenterPixelPlaceName();
if (!placename.empty())
{
oss <<" - " <<ToStdString( tr("Location") )<< " : " << placename;
emit TitleLoaded(FromStdString(oss.str()) );
}
emit Finished();
}
} // end namespace 'mvd'
/*=========================================================================
Program: Monteverdi2
Language: C++
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See Copyright.txt for details.
Monteverdi2 is distributed under the CeCILL licence version 2. See
Licence_CeCILL_V2-en.txt or
http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt for more details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __mvdMainWindowTitleLoader_h
#define __mvdMainWindowTitleLoader_h
//
// Configuration include.
//// Included at first position before any other ones.
#include "ConfigureMonteverdi2.h"
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
#include <QtCore>
//
// System includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
//
// External classes pre-declaration.
namespace
{
}
namespace mvd
{
//
// Internal class pre-declaration.
class VectorImageModel;
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
/**
* \class MainWindowTitleLoader
*
* \brief Imports an image into a Monteverdi2 dataset
*
* This class is used to deport the dataset creation
* in a separate thread
*/
class MainWindowTitleLoader : public QObject
{
Q_OBJECT;
public:
/** \brief Constructor */
MainWindowTitleLoader(VectorImageModel* model);
public slots:
/** \brief Trigger the dataset creation */
void LoadTitle();
signals:
/** \brief Triggered after model is ready */
void TitleLoaded( const QString& );
/** \brief Triggered when processing is finished */
void Finished();
private:
VectorImageModel* m_Model;
};
} // end namespace 'mvd'
#endif // __mvdImageModel_h
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