Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
273
Issues
273
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
a010dd26
Commit
a010dd26
authored
Nov 15, 2012
by
Stéphane Albert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: Open file dialog.
parent
a0b6a5a9
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
357 additions
and
108 deletions
+357
-108
CMakeLists.txt
CMakeLists.txt
+9
-14
Code/Application/main.cxx
Code/Application/main.cxx
+5
-8
Code/Application/mvdApplication.cxx
Code/Application/mvdApplication.cxx
+15
-4
Code/Application/mvdApplication.h
Code/Application/mvdApplication.h
+7
-6
Code/Application/mvdImageModel.cxx
Code/Application/mvdImageModel.cxx
+50
-0
Code/Application/mvdImageModel.h
Code/Application/mvdImageModel.h
+71
-0
Code/Application/mvdMainWindow.cxx
Code/Application/mvdMainWindow.cxx
+81
-26
Code/Application/mvdMainWindow.h
Code/Application/mvdMainWindow.h
+17
-26
Code/Common/CMakeLists.txt
Code/Common/CMakeLists.txt
+2
-1
Code/Common/mvdMyClass.cxx
Code/Common/mvdMyClass.cxx
+10
-3
Code/Common/mvdMyClass.h
Code/Common/mvdMyClass.h
+4
-8
Code/Common/otbQGLImageWidget.cxx
Code/Common/otbQGLImageWidget.cxx
+40
-7
Code/Common/otbQGLImageWidget.h
Code/Common/otbQGLImageWidget.h
+37
-5
ConfigureMonteverdi2.h.in
ConfigureMonteverdi2.h.in
+9
-0
No files found.
CMakeLists.txt
View file @
a010dd26
...
...
@@ -2,6 +2,8 @@ PROJECT(Monteverdi2)
cmake_minimum_required
(
VERSION 2.6
)
#----------------------------------------------------------------------------
# ensure WIN32 definition
if
(
WIN32
)
add_definitions
(
-DWIN32
)
endif
(
WIN32
)
...
...
@@ -27,12 +29,6 @@ if(WIN32)
add_definitions
(
-DNOMINMAX -DOSSIM_STATIC
)
endif
(
WIN32
)
#----------------------------------------------------------------------------
# ensure WIN32 definition
if
(
WIN32
)
add_definitions
(
-DWIN32
)
endif
(
WIN32
)
#----------------------------------------------------------------------------
# Link to the Orfeo ToolBox
find_package
(
OTB PATHS /usr/lib/otb
)
...
...
@@ -47,13 +43,13 @@ endif(OTB_FOUND)
#----------------------------------------------------------------------------
# Qt4 settings
find_package
(
Qt4 REQUIRED QtCore QtGui
)
include
(
${
QT_USE_FILE
}
)
add_definitions
(
${
QT_DEFINITIONS
}
)
# Add binary dir to build paths in order to include Qt4 wrapped files.
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
# Choose Qt4 libraries.
# setup Qt environement
set
(
QT_USE_QTCORE TRUE
)
set
(
QT_USE_QTGUI TRUE
)
set
(
QT_USE_QTOPENGL TRUE
)
include
(
${
QT_USE_FILE
}
)
#----------------------------------------------------------------------------
# Include OTB CMake modules path.
...
...
@@ -80,8 +76,8 @@ endif(Mercurial_FOUND)
#----------------------------------------------------------------------------
# Configure files with settings for use by the build.
#
configure_file(${Monteverdi2_SOURCE_DIR}/ConfigureMonteverdi2.h.in
#
${Monteverdi2_BINARY_DIR}/ConfigureMonteverdi2.h)
configure_file
(
${
Monteverdi2_SOURCE_DIR
}
/ConfigureMonteverdi2.h.in
${
Monteverdi2_BINARY_DIR
}
/ConfigureMonteverdi2.h
)
#----------------------------------------------------------------------------
#Build shared libraries for monteverdi
...
...
@@ -108,7 +104,6 @@ set(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard.")
#----------------------------------------------------------------------------
# Include directories
set
(
Monteverdi2_INCLUDE_DIRS
${
OTB_INCLUDE_DIRS
}
${
Monteverdi2_SOURCE_DIR
}
/Code/
${
Monteverdi2_SOURCE_DIR
}
/Code/Common
${
Monteverdi2_SOURCE_DIR
}
/Code/Application
...
...
Code/Application/main.cxx
View file @
a010dd26
...
...
@@ -16,11 +16,13 @@
=========================================================================*/
/*******************************************************************************/
//#include "ConfigureMonteverdi.h"
//
// System includes (sorted by alphabetic order)
#include <cstdlib>
//
#include <cstdlib>
//
// Qt includes (sorted by alphabetic order)
...
...
@@ -28,15 +30,10 @@
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdApplication.h"
#include "mvdMainWindow.h"
//
// Main functions definitions.
//
//
// MAIN
//
...
...
@@ -47,10 +44,10 @@ main( int argc, char* argv[] )
mvd
::
MainWindow
main_window
;
main_window
.
show
();
return
application
.
exec
();
}
//
// Main function
implementation
.
// Main function
s implementations
.
//
Code/Application/mvdApplication.cxx
View file @
a010dd26
...
...
@@ -24,7 +24,7 @@
//
// Qt includes (sorted by alphabetic order)
#include <Q
Application
>
#include <Q
tGui
>
//
// OTB includes (sorted by alphabetic order)
...
...
@@ -39,6 +39,7 @@
namespace
mvd
{
/*****************************************************************************/
Application
::
Application
(
int
&
argc
,
char
**
argv
)
:
QApplication
(
argc
,
argv
)
...
...
@@ -47,17 +48,25 @@ Application
this
,
SIGNAL
(
aboutToQuit
()
),
this
,
SLOT
(
OnAboutToQuit
()
)
);
InitializeUI
();
}
/*****************************************************************************/
Application
::~
Application
()
{
}
//
// SLOTS
//
/*****************************************************************************/
void
Application
::
InitializeUI
()
{
}
/*****************************************************************************/
/* SLOTS */
/*****************************************************************************/
void
Application
::
OnAboutToQuit
()
...
...
@@ -65,4 +74,6 @@ Application
qDebug
(
">DEBUG< mvd::Application::OnAboutToQuit()"
);
}
/*****************************************************************************/
}
// end namespace 'mvd'
Code/Application/mvdApplication.h
View file @
a010dd26
...
...
@@ -61,17 +61,18 @@ public:
//
protected:
//
//
private:
void
InitializeUI
();
//
// SLOTS
private
slots
:
/**
*
*/
*
*/
void
OnAboutToQuit
();
//
//
private:
};
}
// end namespace 'mvd'
...
...
Code/Application/mvdImageModel.cxx
0 → 100644
View file @
a010dd26
/*=========================================================================
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 "mvdMyClass.h"
//
// System includes (sorted by alphabetic order)
//
// Qt includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
namespace
mvd
{
MyClass
::
MyClass
()
{
}
MyClass
::~
MyClass
()
{
}
/*******************************************************************************/
/* SLOTS */
/*******************************************************************************/
}
// end namespace 'mvd'
Code/Application/mvdImageModel.h
0 → 100644
View file @
a010dd26
/*=========================================================================
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.
=========================================================================*/
#ifndef __mvdMyClass_h
#define __mvdMyClass_h
//
// System includes (sorted by alphabetic order)
//
// Qt includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
//
// Class pre-declaration.
namespace
{
}
namespace
mvd
{
/** \class MyClass
*
*/
class
MyClass
{
//
//
public:
/** Constructor */
MyClass
();
/** Destructor */
virtual
~
MyClass
();
//
//
protected:
//
//
private:
//
// SLOTS
};
}
// end namespace 'mvd'
#endif // __mvdMyClass_h
Code/Application/mvdMainWindow.cxx
View file @
a010dd26
...
...
@@ -25,17 +25,24 @@
//
// Qt includes (sorted by alphabetic order)
#include <QFileDialog>
//
// ITK includes (sorted by alphabetic order)
#include "itkRGBAPixel.h"
//
// OTB includes (sorted by alphabetic order)
#include "otbImage.h"
#include "otbImageFileReader.h"
//
// Monteverdi includes (sorted by alphabetic order)
//#include "DockWidget.h"
namespace
mvd
{
/*****************************************************************************/
MainWindow
::
MainWindow
(
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
:
QMainWindow
(
parent
,
flags
),
...
...
@@ -43,47 +50,95 @@ MainWindow
{
m_UI
->
setupUi
(
this
);
/*
QDockWidget* dock_widget = new DockWidget( tr( "Dock Widget" ), this );
Initialize
();
}
/*****************************************************************************/
MainWindow
::~
MainWindow
()
{
}
/*****************************************************************************/
void
MainWindow
::
Initialize
()
{
/*
QDockWidget* dock_widget = new DockWidget( tr( "Dock Widget" ), this );
dock_widget->setAllowedAreas(
Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea
);
// dockWidget->setWidget( dockWidgetContents );
);
dockWidget->setWidget( dockWidgetContents );
addDockWidget( Qt::LeftDockWidgetArea, dock_widget );
*/
// TODO : uncomment to use the otbQGLImageWiget
// glWidget = new otb::QGLImageWidget();
// QHBoxLayout *mainLayout = new QHBoxLayout;
// mainLayout->addWidget(m_QGLWidget);
// setLayout(mainLayout);
// setWindowTitle(tr("OTB QGL Window"));
*/
// Set the GLImageWidget as the centralWidget in MainWindow.
setCentralWidget
(
new
otb
::
QGLImageWidget
(
this
)
);
// Connect Quit action of main menu to QApplication's quit() slot.
QObject
::
connect
(
m_UI
->
action_Quit
,
SIGNAL
(
activated
()
),
qApp
,
SLOT
(
quit
()
)
);
}
MainWindow
::~
MainWindow
()
{
);
}
/*******************************************************************************/
/* SLOTS */
/*******************************************************************************/
/*****************************************************************************/
/* SLOTS */
/*****************************************************************************/
void
MainWindow
::
on_action_Open_activated
()
{
qDebug
(
">DEBUG< mvd::MainWindow::on_action_Open_activated()."
);
QString
filename
(
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Open file..."
)
)
);
if
(
filename
.
isNull
()
)
{
return
;
}
//
// TODO: Move piece of code below to ImageModel.
// image reader
typedef
itk
::
RGBAPixel
<
unsigned
char
>
PixelType
;
typedef
otb
::
Image
<
PixelType
,
2
>
ImageType
;
typedef
ImageType
::
RegionType
RegionType
;
typedef
otb
::
ImageFileReader
<
ImageType
>
ReaderType
;
otb
::
QGLImageWidget
*
widget
=
GetGLImageWidget
();
ReaderType
::
Pointer
reader
(
ReaderType
::
New
()
);
reader
->
SetFileName
(
filename
.
toLatin1
().
data
()
);
reader
->
UpdateOutputInformation
();
ImageType
::
Pointer
image
(
reader
->
GetOutput
()
);
RegionType
region
(
image
->
GetLargestPossibleRegion
()
);
if
(
widget
->
width
()
<
image
->
GetLargestPossibleRegion
().
GetSize
(
0
)
)
{
region
.
SetSize
(
0
,
widget
->
width
()
);
}
if
(
widget
->
height
()
<
image
->
GetLargestPossibleRegion
().
GetSize
(
1
)
)
{
region
.
SetSize
(
1
,
widget
->
height
()
);
}
image
->
SetRequestedRegion
(
region
);
image
->
Update
();
widget
->
SetIsotropicZoom
(
1
);
widget
->
ReadBuffer
(
image
,
region
);
// main_window.resize( region.GetSize()[0], region.GetSize()[1] );
}
/*****************************************************************************/
}
// end namespace 'mvd'
Code/Application/mvdMainWindow.h
View file @
a010dd26
...
...
@@ -24,11 +24,11 @@
//
// Qt includes (sorted by alphabetic order)
#include <Q
MainWindow
>
#include <Q
tGui
>
//
// OTB includes (sorted by alphabetic order)
//
#include "otbQGLImageWidget.h"
#include "otbQGLImageWidget.h"
//
// Monteverdi includes (sorted by alphabetic order)
...
...
@@ -40,13 +40,6 @@ namespace Ui
class
MainWindow
;
}
// namespace otb
// {
// class QGLImageWidget;
// };
namespace
mvd
{
/** \class MainWindow
...
...
@@ -57,35 +50,33 @@ class MainWindow
{
Q_OBJECT
;
//
//
public:
/** Constructor */
/** Constructor */
MainWindow
(
QWidget
*
Parent
=
0
,
Qt
::
WindowFlags
flags
=
0
);
/** Destructor */
/** Destructor */
virtual
~
MainWindow
();
// /** Method to get the instance*/
// otb::QGLImageWidget* GetGLImageWidget()
// {
// return m_QGLWidget;
// }
/** Method to get the instance*/
inline
otb
::
QGLImageWidget
*
GetGLImageWidget
()
{
return
dynamic_cast
<
::
otb
::
QGLImageWidget
*
>
(
centralWidget
()
);
}
/** Method to get the instance*/
inline
const
otb
::
QGLImageWidget
*
GetGLImageWidget
()
const
{
return
const_cast
<
const
MainWindow
*
>
(
this
)
->
GetGLImageWidget
();
}
//
//
protected:
//
//
private:
Ui
::
MainWindow
*
m_UI
;
void
Initialize
()
;
//otb::QGLImageWidget * m_QGLWidget
;
Ui
::
MainWindow
*
m_UI
;
//
// SLOTS
private
slots
:
void
on_action_Open_activated
();
};
...
...
Code/Common/CMakeLists.txt
View file @
a010dd26
...
...
@@ -20,7 +20,8 @@ add_library(Monteverdi2_Common
)
#############################################################################
target_link_libraries
(
Monteverdi2_Common OTBIO OTBVisualization
target_link_libraries
(
Monteverdi2_Common
OTBIO OTBVisualization
${
QT_LIBRARIES
}
)
...
...
Code/Common/mvdMyClass.cxx
View file @
a010dd26
...
...
@@ -24,6 +24,9 @@
//
// Qt includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
...
...
@@ -33,18 +36,22 @@
namespace
mvd
{
/*****************************************************************************/
MyClass
::
MyClass
()
{
}
/*****************************************************************************/
MyClass
::~
MyClass
()
{
}
/*******************************************************************************/
/* SLOTS */
/*******************************************************************************/
/*****************************************************************************/
/* SLOTS */
/*****************************************************************************/
/*****************************************************************************/
}
// end namespace 'mvd'
Code/Common/mvdMyClass.h
View file @
a010dd26
...
...
@@ -25,6 +25,9 @@
//
// Qt includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
...
...
@@ -44,8 +47,6 @@ namespace mvd
*/
class
MyClass
{
//
//
public:
/** Constructor */
...
...
@@ -54,16 +55,11 @@ public:
/** Destructor */
virtual
~
MyClass
();
//
//
protected:
//
//
private:
//
// SLOTS
//private slots:
};
}
// end namespace 'mvd'
...
...
Code/Common/otbQGLImageWidget.cxx
View file @
a010dd26
/*=========================================================================
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 "otbQGLImageWidget.h"
//
// System includes (sorted by alphabetic order)
//
// Qt includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
#include "itkImageRegionConstIteratorWithIndex.h"
//
// Monteverdi includes (sorted by alphabetic order)
namespace
otb
{