Commit c67f3829 authored by Stéphane Albert's avatar Stéphane Albert

ENH: Packaged namespace mvd::core.

parent 2b4656d6
......@@ -62,7 +62,7 @@ namespace mvd
/*******************************************************************************/
Application
::Application( int& argc, char** argv ) :
I18nApplication( argc, argv )
core::I18nApplication( argc, argv )
{
InitializeCore();
}
......
......@@ -68,7 +68,7 @@ namespace mvd
*
*/
class Monteverdi2_EXPORT Application
: public I18nApplication
: public core::I18nApplication
{
/*-[ QOBJECT SECTION ]-----------------------------------------------------*/
......
......@@ -89,13 +89,13 @@ Application
}
/*****************************************************************************/
DatasetModel*
core::DatasetModel*
Application::LoadDatasetModel( const QString& imageFilename,
int width,
int height )
{
// New model.
DatasetModel* model = new DatasetModel();
core::DatasetModel* model = new core::DatasetModel();
// Retrive path and name.
QString path;
......@@ -111,9 +111,9 @@ Application::LoadDatasetModel( const QString& imageFilename,
try
{
// try if the filename is valid
VectorImageModel::EnsureValidImage(imageFilename);
core::VectorImageModel::EnsureValidImage(imageFilename);
// Build model (relink to cached data).
DatasetModel::BuildContext context( path, name, width, height );
core::DatasetModel::BuildContext context( path, name, width, height );
model->BuildModel( &context );
// Load image if DatasetModel is empty.
......@@ -142,7 +142,7 @@ Application::LoadDatasetModel( const QString& imageFilename,
/*******************************************************************************/
Application
::Application( int& argc, char** argv ) :
I18nApplication( argc, argv ),
core::I18nApplication( argc, argv ),
m_Model( NULL )
{
InitializeCore();
......@@ -164,7 +164,7 @@ Application
/*******************************************************************************/
void
Application
::SetModel( AbstractModel* model )
::SetModel( core::AbstractModel* model )
{
emit AboutToChangeSelectedModel( model );
......
......@@ -58,10 +58,14 @@ namespace
namespace mvd
{
namespace core
{
//
// Class declaration.
class AbstractModel;
class DatasetModel;
}
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
......@@ -70,7 +74,7 @@ class DatasetModel;
*
*/
class Monteverdi2_EXPORT Application
: public I18nApplication
: public core::I18nApplication
{
/*-[ QOBJECT SECTION ]-----------------------------------------------------*/
......@@ -101,11 +105,11 @@ public:
/**
*/
inline const AbstractModel* GetModel() const;
inline const core::AbstractModel* GetModel() const;
/**
*/
inline AbstractModel* GetModel();
inline core::AbstractModel* GetModel();
/**
*/
......@@ -161,7 +165,7 @@ public:
/**
*/
static
DatasetModel* LoadDatasetModel( const QString& imageFilename,
core::DatasetModel* LoadDatasetModel( const QString& imageFilename,
int width,
int height );
......@@ -171,7 +175,7 @@ public slots:
*/
// Method could be inline but it's better not new/delete in inline
// methods (heap and memory-alignment contexts).
void SetModel( AbstractModel* model );
void SetModel( core::AbstractModel* model );
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
......@@ -180,11 +184,11 @@ public slots:
signals:
/**
*/
void AboutToChangeSelectedModel( const AbstractModel* );
void AboutToChangeSelectedModel( const core::AbstractModel* );
/**
*/
void SelectedModelChanged( AbstractModel* );
void SelectedModelChanged( core::AbstractModel* );
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
......@@ -215,7 +219,7 @@ private:
/**
*/
AbstractModel* m_Model;
core::AbstractModel* m_Model;
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
......@@ -236,7 +240,7 @@ Application*
Application
::Instance()
{
return I18nApplication::Instance< Application >();
return core::I18nApplication::Instance< Application >();
}
/*****************************************************************************/
......@@ -245,12 +249,12 @@ const Application*
Application
::ConstInstance()
{
return I18nApplication::ConstInstance< Application >();
return core::I18nApplication::ConstInstance< Application >();
}
/*****************************************************************************/
inline
const AbstractModel*
const core::AbstractModel*
Application
::GetModel() const
{
......@@ -259,7 +263,7 @@ Application
/*****************************************************************************/
inline
AbstractModel*
core::AbstractModel*
Application
::GetModel()
{
......
......@@ -66,7 +66,7 @@ ImageLoader
try
{
DatasetModel* model = Application::LoadDatasetModel(
core::DatasetModel* model = Application::LoadDatasetModel(
m_Filename, m_Width, m_Height );
// We can only push to another thread,
......
......@@ -51,9 +51,12 @@ namespace
namespace mvd
{
namespace core
{
//
// Internal class pre-declaration.
class AbstractModel;
}
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
......@@ -80,7 +83,7 @@ public slots:
signals:
/** \brief Triggered after model is ready */
void ModelLoaded( AbstractModel* );
void ModelLoaded( core::AbstractModel* );
/** \brief Triggered when processing is finished */
void Finished();
......
......@@ -180,8 +180,17 @@ MainWindow
// Connect centralWidget manipulator to Ql renderer when viewportRegionChanged
QObject::connect(
m_ImageViewManipulator, SIGNAL( ViewportRegionRepresentationChanged(const PointType&, const PointType&) ),
m_QLModelRenderer, SLOT( OnViewportRegionRepresentationChanged(const PointType&, const PointType&) )
m_ImageViewManipulator,
SIGNAL(
ViewportRegionRepresentationChanged( const core::PointType&,
const core::PointType& )
),
// to:
m_QLModelRenderer,
SLOT(
OnViewportRegionRepresentationChanged( const core::PointType&,
const core::PointType& )
)
);
// Connect ql mousePressEventpressed to centralWidget manipulator
......@@ -199,15 +208,15 @@ MainWindow
// Connect Appllication and MainWindow when selected model is about
// to change.
QObject::connect(
qApp, SIGNAL( AboutToChangeSelectedModel( const AbstractModel* ) ),
this, SLOT( OnAboutToChangeSelectedModel( const AbstractModel* ) )
qApp, SIGNAL( AboutToChangeSelectedModel( const core::AbstractModel* ) ),
this, SLOT( OnAboutToChangeSelectedModel( const core::AbstractModel* ) )
);
// Connect Application and MainWindow when selected model has been
// changed.
QObject::connect(
qApp, SIGNAL( SelectedModelChanged( AbstractModel* ) ),
this, SLOT( OnSelectedModelChanged( AbstractModel* ) )
qApp, SIGNAL( SelectedModelChanged( core::AbstractModel* ) ),
this, SLOT( OnSelectedModelChanged( core::AbstractModel* ) )
);
// Show the progress dialog when a new image is loaded
......@@ -389,10 +398,10 @@ MainWindow::closeEvent( QCloseEvent* event )
// Ensure that there is no model or that the existing model is a
// DatasetModel.
assert( Application::ConstInstance()->GetModel()==
Application::ConstInstance()->GetModel< DatasetModel >() );
Application::ConstInstance()->GetModel< core::DatasetModel >() );
// Get model.
DatasetModel* model =
Application::Instance()->GetModel< DatasetModel >();
core::DatasetModel* model =
Application::Instance()->GetModel< core::DatasetModel >();
if( model==NULL || !model->IsModified() )
return;
......@@ -537,7 +546,7 @@ MainWindow
/*****************************************************************************/
void
MainWindow
::OnAboutToChangeSelectedModel( const AbstractModel* )
::OnAboutToChangeSelectedModel( const core::AbstractModel* )
{
//
// COLOR SETUP.
......@@ -558,8 +567,8 @@ MainWindow
const Application* app = Application::ConstInstance();
assert( app!=NULL );
const DatasetModel* datasetModel =
qobject_cast< const DatasetModel* >( app->GetModel() );
const core::DatasetModel* datasetModel =
qobject_cast< const core::DatasetModel* >( app->GetModel() );
// It is Ok there is no previously selected model (e.g. at
// application startup.
......@@ -570,8 +579,8 @@ MainWindow
assert( datasetModel->HasSelectedImageModel() );
const VectorImageModel* vectorImageModel =
qobject_cast< const VectorImageModel* >(
const core::VectorImageModel* vectorImageModel =
qobject_cast< const core::VectorImageModel* >(
datasetModel->GetSelectedImageModel()
);
......@@ -604,10 +613,10 @@ MainWindow
// disconnect the vectorimage model spacing change (when zooming)
QObject::disconnect(
vectorImageModel,
SIGNAL( SpacingChanged(const SpacingType&) ),
SIGNAL( SpacingChanged(const core::SpacingType&) ),
// to:
centralWidget(),
SLOT( OnSpacingChanged(const SpacingType&) )
SLOT( OnSpacingChanged(const core::SpacingType&) )
);
// disconnect signal used to update the ql widget
......@@ -702,18 +711,18 @@ MainWindow
/*****************************************************************************/
void
MainWindow
::OnSelectedModelChanged( AbstractModel* model )
::OnSelectedModelChanged( core::AbstractModel* model )
{
if( model==NULL )
return;
DatasetModel* datasetModel = qobject_cast< DatasetModel* >( model );
core::DatasetModel* datasetModel = qobject_cast< core::DatasetModel* >( model );
assert( datasetModel!=NULL );
assert( datasetModel->HasSelectedImageModel() );
VectorImageModel* vectorImageModel =
qobject_cast< VectorImageModel* >(
core::VectorImageModel* vectorImageModel =
qobject_cast< core::VectorImageModel* >(
datasetModel->GetSelectedImageModel()
);
......@@ -726,7 +735,13 @@ MainWindow
m_TitleLoader->moveToThread(thread);
// At thread startup, trigger the processing function
QObject::connect(thread, SIGNAL(started()), m_TitleLoader, SLOT(LoadTitle()));
QObject::connect(
thread,
SIGNAL( started() ),
// to:
m_TitleLoader,
SLOT( LoadTitle() )
);
// On Successfull title composition, update with the window title
QObject::connect(m_TitleLoader,
......@@ -785,10 +800,10 @@ MainWindow
// connect the vectorimage model spacing change (when zooming)
QObject::connect(
vectorImageModel,
SIGNAL( SpacingChanged(const SpacingType&) ),
SIGNAL( SpacingChanged(const core::SpacingType&) ),
// to:
centralWidget(),
SLOT( OnSpacingChanged(const SpacingType&) )
SLOT( OnSpacingChanged(const core::SpacingType&) )
);
// signal used to update the ql widget
......@@ -946,7 +961,7 @@ MainWindow
connect(thread, SIGNAL(started()), loader, SLOT(OpenImage()));
// On successfull image loading, notify ourself, passing the created AbstractModel instance
connect(loader, SIGNAL(ModelLoaded(AbstractModel*)), this, SLOT(OnModelLoaded(AbstractModel*)));
connect(loader, SIGNAL(ModelLoaded(core::AbstractModel*)), this, SLOT(OnModelLoaded(core::AbstractModel*)));
// On error, notify ourself
connect(loader, SIGNAL(Error(QString)), this, SLOT(OnOpenImageError(QString)));
......@@ -974,7 +989,7 @@ MainWindow
/*****************************************************************************/
void
MainWindow
::OnModelLoaded( AbstractModel* model )
::OnModelLoaded( core::AbstractModel* model )
{
try
{
......
......@@ -60,9 +60,14 @@ namespace
namespace mvd
{
namespace core
{
//
// Internal class pre-declaration.
class AbstractModel;
}
class AbstractModelController;
class ImageViewManipulator;
class QuicklookViewManipulator;
......@@ -189,7 +194,7 @@ private:
*
* \param model The model to assign to the controller.
*/
inline void SetControllerModel( QDockWidget* dock, AbstractModel* model );
inline void SetControllerModel( QDockWidget* dock, core::AbstractModel* model );
/** Write settings into a settings file*/
void WriteDsPathSettings(QString dsPath);
......@@ -287,13 +292,13 @@ private slots:
void OnColorDynamicsVisibilityChanged ( bool );
/** */
void OnAboutToChangeSelectedModel( const AbstractModel* );
void OnAboutToChangeSelectedModel( const core::AbstractModel* );
/** */
void OnModelLoaded( AbstractModel* );
void OnModelLoaded( core::AbstractModel* );
/** */
void OnSelectedModelChanged( AbstractModel* );
void OnSelectedModelChanged( core::AbstractModel* );
/** */
void OnUserCoordinatesEditingFinished();
......@@ -399,7 +404,7 @@ MainWindow
inline
void
MainWindow
::SetControllerModel( QDockWidget* dock, AbstractModel* model )
::SetControllerModel( QDockWidget* dock, core::AbstractModel* model )
{
assert( dock );
......
......@@ -89,7 +89,7 @@ ApplicationsBrowser
}
/*******************************************************************************/
StringVector
core::StringVector
ApplicationsBrowser
::GetAvailableApplications()
{
......@@ -103,7 +103,7 @@ ApplicationsBrowser
//
// get available application in search path
StringVector appList = otb::Wrapper::ApplicationRegistry::GetAvailableApplications();
core::StringVector appList = otb::Wrapper::ApplicationRegistry::GetAvailableApplications();
//
// some verbosity
......@@ -115,7 +115,7 @@ ApplicationsBrowser
else
{
std::cout << "--- Available modules :" << std::endl;
for (StringVector::const_iterator it = appList.begin(); it != appList.end(); ++it)
for (core::StringVector::const_iterator it = appList.begin(); it != appList.end(); ++it)
{
std::cout << "\t" << *it << std::endl;
}
......@@ -125,13 +125,13 @@ ApplicationsBrowser
}
/*******************************************************************************/
StringVector
core::StringVector
ApplicationsBrowser
::GetApplicationTags( const std::string& appName )
{
//
// output vector
StringVector vtags;
core::StringVector vtags;
//
// instantiate the application using the factory
......@@ -155,7 +155,7 @@ ApplicationsBrowser
{
//
// get all the applications in the search path
StringVector vapp = GetAvailableApplications();
core::StringVector vapp = GetAvailableApplications();
//
// Fill the map as following
......@@ -167,15 +167,15 @@ ApplicationsBrowser
while ( it != vapp.end() )
{
// get tags of current app
StringVector ctags = GetApplicationTags( *it );
core::StringVector ctags = GetApplicationTags( *it );
// key will be the tag (easier for tree origanisation in )
StringVector::const_iterator itTag = ctags.begin();
core::StringVector::const_iterator itTag = ctags.begin();
while ( itTag != ctags.end() )
{
// search for this tag in the output container
ApplicationsTagContainer::iterator pos = outputContainer.find( *itTag );
core::ApplicationsTagContainer::iterator pos = outputContainer.find( *itTag );
if ( pos != outputContainer.end() ) // key found
{
//
......@@ -186,7 +186,7 @@ ApplicationsBrowser
{
//
// if tag not found in the container, add it
std::pair< std::string, StringVector > currentAppTags;
std::pair< std::string, core::StringVector > currentAppTags;
currentAppTags.first = *itTag;
currentAppTags.second.push_back( *it );
outputContainer.insert( currentAppTags );
......
......@@ -108,10 +108,10 @@ public:
void SetAutoLoadPath(const std::string & itk_auto_load_path);
/** get available applications in the search path */
StringVector GetAvailableApplications();
core::StringVector GetAvailableApplications();
/** return the list applications <->tags */
StringVector GetApplicationTags(const std::string& appName);
core::StringVector GetApplicationTags(const std::string& appName);
/** return std::map storing tag/apps association for all the
* applications in the search path
......@@ -130,7 +130,7 @@ public slots:
//
// Signals.
signals:
void AvailableApplicationsTagsChanged(const ApplicationsTagContainer &);
void AvailableApplicationsTagsChanged(const core::ApplicationsTagContainer &);
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
......
......@@ -42,8 +42,12 @@
namespace mvd
{
namespace core
{
/*
TRANSLATOR mvd::AbstractImageModel
TRANSLATOR mvd::core::AbstractImageModel
Necessary for lupdate to be aware of C++ namespaces.
......@@ -64,16 +68,16 @@ namespace
*/
const char*
ENHANCED_BAND_NAMES[ 10 ] = {
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "Red" ),
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "Green" ),
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "Blue" ),
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "Yellow" ),
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "RedEdge" ),
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "Coastal" ),
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "NIR" ),
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "NIR1" ),
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "NIR2" ),
QT_TRANSLATE_NOOP( "mvd::AbstractImageModel", "PAN" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "Red" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "Green" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "Blue" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "Yellow" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "RedEdge" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "Coastal" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "NIR" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "NIR1" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "NIR2" ),
QT_TRANSLATE_NOOP( "mvd::core::AbstractImageModel", "PAN" ),
};
} // end of anonymous namespace.
......@@ -246,4 +250,6 @@ AbstractImageModel
/* SLOTS */
/*******************************************************************************/
} // end namespace 'core'
} // end namespace 'mvd'
......@@ -60,6 +60,12 @@ namespace
namespace mvd
{
//
// Internal classes pre-declaration.
namespace core
{
//
// Internal classes pre-declaration.
class HistogramModel;
......@@ -209,7 +215,7 @@ public slots:
// Signals.
signals:
/** */
void SpacingChanged( const SpacingType& );
void SpacingChanged( const core::SpacingType& );
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
......@@ -274,6 +280,8 @@ private:
private slots:
};
} // end namespace 'core'
} // end namespace 'mvd'
/*****************************************************************************/
......@@ -292,6 +300,9 @@ private slots:
namespace mvd
{
namespace core
{
/*****************************************************************************/
int
AbstractImageModel
......@@ -413,6 +424,8 @@ AbstractImageModel
return ToImageBase()->GetOrigin();
}
} // end namespace 'core'
} // end namespace 'mvd'
#endif // __mvdAbstractImageModel_h
......@@ -41,8 +41,12 @@
namespace mvd
{
namespace core
{
/*
TRANSLATOR mvd::AbstractModel
TRANSLATOR mvd::core::AbstractModel
Necessary for lupdate to be aware of C++ namespaces.
......@@ -87,4 +91,6 @@ AbstractModel
/*******************************************************************************/
} // end namespace 'core'
} // end namespace 'mvd'
......@@ -62,6 +62,10 @@ namespace mvd
//
// Internal classes pre-declaration.
namespace core
{
//
// Internal classes pre-declaration.
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
......@@ -152,6 +156,8 @@ private:
private slots:
};
} // end namespace 'core'.
} // end namespace 'mvd'.
/*****************************************************************************/
......@@ -160,6 +166,9 @@ private slots:
namespace mvd
{
namespace core
{
/*****************************************************************************/
template< typename TModel >
const TModel*
......@@ -222,6 +231,8 @@ AbstractModel
virtual_BuildModel( context );
}
} // end namespace 'core'
} // end namespace 'mvd'
#endif // __mvdAbstractModel_h
......@@ -40,8 +40,12 @@
namespace mvd
{
namespace core
{
/*
TRANSLATOR mvd::Algorithm
TRANSLATOR mvd::core::Algorithm
Necessary for lupdate to be aware of C++ namespaces.
......@@ -50,4 +54,6 @@ namespace mvd
/*******************************************************************************/
} // end namespace 'core'
} // end namespace 'mvd'
......@@ -64,6 +64,14 @@ namespace mvd
{
//
// Internal classes pre-declaration.
namespace core
{
//
// Internal classes pre-declaration.
} // end of namespace 'core'.
} // end of namespace 'mvd'.
......@@ -142,6 +150,10 @@ ToVariableLengthVector( itk::FixedArray< T1, N >& a,
namespace mvd
{
namespace core
{
/**
* Convert a StringVector object to a QStringList object.
*
......@@ -193,12 +205,18 @@ inline
std::string
ToStdString( const QString& str );
} // end namespace 'core'.