MVD2

From OTBWiki
Revision as of 18:28, 3 November 2016 by Gpasero (Talk | contribs) (Translation workflow process)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The goal of this project is to develop a new version of the Monteverdi software. Il will not be an upgrade of Monteverdi 1.x, but a complete redesign of it.

Monteverdi 1.x was a great success. It was a great tool to expose the OrfeoToolbox remote sensing functionalities for users not familiar with development or C++, but this tool has some lacks and using it is not always straightforward for the users.

For the developer’s point of view, the great number of modules developed makes Monteverdi hard to maintain. Also, using FLTK for the GUI part puts some limitations in the development process. In addition, Monteverdi 1.x does not allow using the applications plugins already available.

It is time to move on to a new Monteverdi.


What's new

Thanks to the user feedbacks, the new Monteverdi version will use a database to store several information. It will allow considering all the user products as a collection of images and vectors, avoiding opening them via a browser each time the image is loaded.

Most of the information stored in the Database will be extracted from the image metadata. Informations used for the rendering (histogram boundaries, channels order) will be persisted.

When the software is launched, a control panel will show the collection of the user. The user can add an image/directory to be added to the collection if not already persisted. All the necessary files (such as Quicklook, or a pyramid for multi-resolution visualization) will be persisted too.

The developement of the GUI will be done using the Qt framework

Documentation and HMI (Human-Machine Interaction) localization

The objective are to find best way to provide:

  • a high-quality documentation with support a multiple language.
  • a HMI which support language localization

and promote contribution to the documentation with user friendly tools and workflow.

Some usefull links to find the new documentation tools:

Mv² — Monteverdi2 Viewer

Keyboard and mouse shortcut mappings

Overall
Overall keymap
Key Action
CTRL+ O : Open file(s)
CTRL+ Q : Quit application
Histogram view
Histogram-View keymap
Key Action
Left-button horizontal-drag : Read histogram values (Intensity at cursor position, bin [min, Max[ and value for RGB bands)
Middle-button vertical-drag : Scale histogram view
Right-button horizontal-drag : Shift histogram-view towards lo/high
Wheel : Scale histogram-view
Image view
Image-View keymap
Key Action
ALT+ wheel : Adjust effect brush size
SHIFT+ ALT+ wheel : Adjust effect parameter value
wheel : Rotate layers
CTRL+ wheel : Zoom in/out
CTRL+ALT+ wheel : Shift dynamics range towards low/high
SHIFT+ CTRL+ALT+ wheel : Scale dynamics range around it's mean value.
META+ wheel : Adjust translucency
SHIFT+ META+ wheel : Adjust gamma correction
Key Action
+ : Zoom in
- : Zoom out
1 : Zoom to full resolution (1:1)
2 : Zoom to selected layer extent
3 : Zoom to all layers extent
A : Apply selected layer settings to All layers
P : Use selected layer Projection as reference projection
Q : Apply 2% Quantiles to viewed area of selected image layer
SHIFT+ Q : Apply 2% Quantiles to full area of selected image layer
Key Action
C : Switch to Chessboard effect
D : Switch to local Dynamics or local contrast effect
G : Switch to Gradient effect
H : Switch to Horizontal swipe effect
N : Switch to No effect
S : Switch to Spectral angle effect
T : Switch to local Translucency effect
V : Switch to Vertical swipe effect

Software design

Tools

Software is designed in UML (http://en.wikipedia.org/wiki/Unified_Modeling_Language) using the Java-based modelling tool ArgoUML from Tigris (http://argouml.tigris.org).

ArgoUML is availaible as free download but, for ease of use, can be be launched directly from the its homepage (http://argouml.tigris.org) or by clicking on this link: http://argouml-downloads.tigris.org/jws/argouml-latest-stable.jnlp .

Model

The UML model is accessible via the Monteverdi2 Mercurial repository (http://hg.orfeo-toolbox.org/Monteverdi2/). Please, load ./Monteverdi2/Documentation/Design/MVD2.zargo.

Cute Qt practices

Tips & tricks

Object-Oriented Programming

  • Always declare destructors as virtual in derived-classes.
Reason: derived-classes destructors are not virtual by default as opposed to member functions.
  • Declare non-public scoped members (methods and attributes) in private scope by default.
  • Promote private -scoped members (methods and attributes) to protected scope only when needed in derived-classes.
  • Promote private or protected -scoped members (methods and attributes) to public scope only when needed.
N.B.: Attributes should generally be declared in private scope and accessed via protected or public scope.
  • Declare virtual methods in protected scope and declare an inline calling wrapper in public:
class MyAbstractClass : public MyBaseClass
{
public:
  MyClass();
  virtual ~MyClass();
  inline bool fooAlgorithm()
  {
  // ...
  virtualFoo1();
  // ...
  virtualFoo2();
  }

protected:
  virtual bool virtualFoo1() =0;
  virtual bool virtualFoo2() const =0;

private:
};

class MyConcreteClass : public MyAbstractClass
{
public:
  MyConcreteClass();
  virtual ~MyConcreteClass();

protected:
  bool virtualFoo1();
  bool virtualFoo2() const;

private:
};

Allocation

  • Do not mix up QObject (parent-children) allocation system with ITK (smart-pointer) allocation system!
Reason: QObject instances (allocated using standard C++ operator ::new() or ::new[]()), especially widgets, are linked together using a parent-children tree hierarchy. When a QObject instance is deallocated (using the standard C++ operator ::delete() or ::delete[]()), its (virtual) destructor automatically deallocates its linked children.
  • Do link QObject child instances to their parent parent instance using the QObject(QObject* parent=0) constructor by passing a non NULL parent as argument.
  • TODO: Write shallow-copy mecanism information.
  • TODO: Write private-implementation pattern informaion.

Internationalization

Translation workflow process
  • Testing shell script [OBSOLETE]:
#!/bin/sh
#
# Setup test
cd
SOMEWHERE=test
mkdir $SOMEWHERE
#
# Go somewhere
cd $SOMEWHERE
#
# Create source tree.
mkdir ./src
cd ./src
git clone https://git.orfeo-toolbox.org/otb.git
#
# Return to $SOMEWHERE
cd ..
#
# Create install tree.
mkdir -p ./install/OTB
#
# Create build tree.
mkdir -p ./build/OTB
#
# Configure OTB and build Monteverdi modules (need opengl,glew, qt, qwt...) build to merge source code strings into .ts translation files.
# /!\ 'make clean' WILL DELETE ALL ../../src/Monteverdi2/i18n/*.ts FILES!
cd ./build/Monteverdi2
cmake -DCMAKE_INSTALL_PREFIX:STRING=$HOME/$SOMEWHERE/install/OTB -DOTB_I18N_MERGE_TS:BOOL=ON ../../src/Monteverdi2
cat CMakeCache.txt | grep -e CMAKE_INSTALL_PREFIX -e OTB_I18N_MERGE_TS
#
# Uncomment line below to delete .ts translation files and regenerate them from scratch (thus loosing all translations).
ls -l ../../src/OTB/i18n/
#make clean
ls -l ../../src/OTB/i18n/
#
# Compile source code and merge .ts files.
make
ls -l ../../src/OTB/i18n/
less ../../src/OTB/i18n/fr_FR.ts
#
# Configure Monteverdi2 build for normal development & translation production.
# /!\ MERGE_TS:BOOL=OFF is the default value if CMakeCache.txt has not previously set it to ON.
cmake -DCMAKE_INSTALL_PREFIX:STRING=$HOME/$SOMEWHERE/install/Monteverdi2 -DMERGE_TS:BOOL=OFF ../../src/Monteverdi2
cat CMakeCache.txt | grep -e CMAKE_INSTALL_PREFIX -e MERGE_TS
#
# Edit .ts file(s) and translate application.
linguist ../../src/Monteverdi2/i18n/fr_FR.ts
#
# Build – application and .qm binary translation file(s) & and install
make && make install
#
# Testing install
cd ../../install/Monteverdi2
env LD_LIBRARY_PATH="./lib/otb" LANG="en_US.UTF-8" ./bin/monteverdi2
env LD_LIBRARY_PATH="./lib/otb" LANG="fr_FR.UTF-8" ./bin/monteverdi2
User-Interface files
  • Remind setting the locale property of user-interface root component to POSIX i.e. language: C; country: QLocale::AnyCountry when designing user-interface components (.ui files).
Reason: This informs the Qt library that components texts are written in english and will be translated by the program.
  • /!\ Reming to prefix objectName() of root widget of .ui file with "mvd::" to notice Qt library of the namespace context where the component will be included into the source code.
Reason: This is necessary for the Qt lupdate tool (which generates .ts translation files) to correctly manage C++ namespaces.
Source code strings
Examples:
  1. Basic string: tr("My string to translate")
  2. Basic parametrized string tr("My '%1' string to translate").arg("parametrized")
  3. Basic string with context: tr("My string to translate", "Context of 'My string to translate' usefull for the translator).
  4. Plural string with context: tr("My plural %n string(s) to translate", "Context of 'My plural %n string to translate usefull for the translator'", count)
  5. Keyboard accelerators: tr("Ctrl-Q", "Quit")
  • Use QString("L%1").arg(numeric) to format numerical argument using system locale setting.
Source code comments
  • /!\ Provide class information to Qt lupdate tool when implementing classes, especially classes nested in namespaces (see mvdMyClass.h and mvdMyClass.cxx skelleton files in Tips & tricks section):
/*
     TRANSLATOR MyNamespace::MyClass

     Necessary for lupdate to be aware of C++ namespaces.

     Context information of class for human translator.
 */
  • Providing context information to the translator:
//: Context information for translator.
/*: Context information for translator.
Links to relevant Qt docmentation