Commit 6ff84331 authored by Ludovic Hussonnois's avatar Ludovic Hussonnois

MRG: Merge remote-tracking branch 'origin/monteverdi-bugfix' into release-6.0

parents b8a0214e a6bb2a95
......@@ -87,6 +87,7 @@ class KeymapDialog;
class LayerStackWidget;
class ShaderWidget;
class StatusBarWidget;
class ProjectionBarWidget;
namespace Ui
{
......@@ -279,6 +280,10 @@ private:
*/
void InitializeShaderToolBar();
/**
*/
void InitializeProjectionBarWidget();
/**
*/
void InitializeStatusBarWidgets();
......@@ -316,6 +321,10 @@ private:
*/
void ConnectStatusBar();
/**
*/
void ConnectProjectionBarWidget();
#if USE_PIXEL_DESCRIPTION
/**
......@@ -426,6 +435,10 @@ private:
*/
KeymapDialog * m_KeymapDialog;
/**
*/
ProjectionBarWidget * m_ProjectionBarWidget;
/**
*/
int m_GLSL140;
......
......@@ -85,6 +85,7 @@
#include "mvdQuicklookViewRenderer.h"
#include "mvdShaderWidget.h"
#include "mvdStatusBarWidget.h"
#include "mvdProjectionBarWidget.h"
//
#include "mvdApplication.h"
#include "mvdPreferencesDialog.h"
......@@ -142,6 +143,7 @@ MainWindow
m_ShaderWidget( NULL ),
m_FilenameDragAndDropEventFilter( NULL ),
m_KeymapDialog( NULL ),
m_ProjectionBarWidget( NULL ),
m_GLSL140( -2 ),
m_isGLSLAvailable( false ),
m_ForceNoGLSL( false )
......@@ -309,6 +311,8 @@ MainWindow
InitializeStatusBarWidgets();
InitializeProjectionBarWidget();
InitializeRenderToolBar();
InitializeShaderToolBar();
......@@ -412,6 +416,8 @@ MainWindow
ConnectStatusBar();
ConnectProjectionBarWidget();
//
// When everything is connected, install event-filter.
assert( m_ImageView!=NULL );
......@@ -624,6 +630,33 @@ MainWindow
);
}
/*****************************************************************************/
void
MainWindow
::ConnectProjectionBarWidget()
{
assert( m_ProjectionBarWidget!=NULL );
assert( m_ImageView!=NULL );
QObject::connect(
m_ImageView,
SIGNAL( ScaleChanged( double, double ) ),
// to:
m_ProjectionBarWidget,
SLOT( SetProjectionScale( double, double ) )
);
QObject::connect(
m_ProjectionBarWidget,
SIGNAL( ProjectionScaleChanged( double ) ),
// to:
m_ImageView->GetManipulator(),
SLOT( ZoomTo( double ) )
);
}
/*****************************************************************************/
#if USE_PIXEL_DESCRIPTION
......@@ -990,7 +1023,6 @@ MainWindow
{
m_UI->m_RenderToolBar->addSeparator();
{
m_UI->m_RenderToolBar->addWidget(
new QLabel( tr( "Proj" ) )
);
......@@ -1002,7 +1034,7 @@ MainWindow
assert( comboBox!=NULL );
comboBox->setObjectName( "referenceLayerComboBox" );
comboBox->setObjectName( REFERENCE_LAYER_COMBOBOX_NAME );
comboBox->setMinimumSize(
QSize(
#ifdef OTB_DEBUG
......@@ -1015,7 +1047,7 @@ MainWindow
);
m_UI->m_RenderToolBar->addWidget( comboBox );
}
m_UI->m_RenderToolBar->addWidget( m_ProjectionBarWidget );
}
/*****************************************************************************/
......@@ -1036,6 +1068,15 @@ MainWindow
}
}
/*****************************************************************************/
void
MainWindow
::InitializeProjectionBarWidget()
{
assert( m_ProjectionBarWidget==NULL );
m_ProjectionBarWidget = new ProjectionBarWidget( m_UI->m_ShaderToolBar );
}
/*****************************************************************************/
void
MainWindow
......
......@@ -600,11 +600,7 @@ VectorImageSettings
if( std::equal( m_GrayDynamicsParams.begin(),
m_GrayDynamicsParams.end(),
params.begin() ) )
{
assert( false );
return;
}
m_GrayDynamicsParams = params;
......
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef mvdProjectionBarWidget_h
#define mvdProjectionBarWidget_h
//
// Configuration include.
//// Included at first position before any other ones.
#include "ConfigureMonteverdi.h"
/*****************************************************************************/
/* INCLUDE SECTION */
#include <iostream>
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
#include <QtGui>
#include <qnamespace.h>
//
// System includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
#include "OTBMonteverdiGUIExport.h"
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdTypes.h"
/*****************************************************************************/
/* PRE-DECLARATION SECTION */
namespace mvd
{
//
// Internal classes pre-declaration.
namespace Ui
{
class ProjectionBarWidget;
};
/**
* \class ProjectionBarWidget
* \ingroup OTBMonteverdiGUI
* \brief ProjectionBarWidget widget class.
*
* This Widget allow to change the zoom level of the current selected projection.
*/
class OTBMonteverdiGUI_EXPORT ProjectionBarWidget : public QWidget
{
Q_OBJECT;
public:
/** \brief Constructor. */
explicit ProjectionBarWidget(QWidget *p = NULL, Qt::WindowFlags flags = Qt::Widget );
/** \brief Destructor. */
~ProjectionBarWidget() ITK_OVERRIDE;
public slots:
void SetProjectionScale(double scale_x, double scale_y);
private:
/**
* \brief uic generated.
*/
Ui::ProjectionBarWidget *m_UI;
/**
* emit a signal to change the scale if projectionScaleLineEdit is changed
* and if the input text is valid.
*/
void ChangeScale();
private slots:
/**
* When user edit the projection scale line
*/
void on_projectionScaleLineEdit_editingFinished();
/**
* When user press return
*/
void on_projectionScaleLineEdit_returnPressed();
signals:
/**
*/
void ProjectionScaleChanged( double );
};
} // end namespace mvd
#endif //mvdProjectionBarWidget_h
......@@ -50,6 +50,7 @@ set( OTBMonteverdiGUI_SRCS
mvdMultiResolutionPyramidWidget.cxx
#mvdMyWidget.cxx
mvdPixelDescriptionWidget.cxx
mvdProjectionBarWidget.cxx
mvdQuicklookViewManipulator.cxx
mvdQuicklookViewRenderer.cxx
mvdSearchableTreeWidget.cxx
......@@ -103,6 +104,7 @@ set( OTBMonteverdiGUI_HEADERS_MOC
../include/mvdMultiResolutionPyramidWidget.h
#mvdMyWidget.h
../include/mvdPixelDescriptionWidget.h
../include/mvdProjectionBarWidget.h
../include/mvdQuicklookViewManipulator.h
../include/mvdQuicklookViewRenderer.h
../include/mvdSearchableTreeWidget.h
......@@ -132,6 +134,7 @@ set( OTBMonteverdiGUI_FORMS
mvdMultiResolutionPyramidWidget.ui
#mvdMyWidget.ui
mvdPixelDescriptionWidget.ui
mvdProjectionBarWidget.ui
mvdSearchableTreeWidget.ui
mvdShaderWidget.ui
mvdStatusBarWidget.ui
......
......@@ -1587,7 +1587,8 @@ ImageViewWidget
//
// Apply dynamics to current layer.
AbstractLayerModel * layer = layerStack->GetCurrent();
assert( layer!=NULL );
if( layer==NULL )
return;
if( layer->inherits( VectorImageModel::staticMetaObject.className() ) )
{
......@@ -1689,7 +1690,8 @@ ImageViewWidget
assert( stackedLayerModel!=NULL );
AbstractLayerModel * layer = stackedLayerModel->GetCurrent();
assert( layer!=NULL );
if( layer==NULL )
return;
if( layer->inherits( VectorImageModel::staticMetaObject.className() ) )
{
......@@ -1778,7 +1780,8 @@ ImageViewWidget
assert( stackedLayerModel!=NULL );
AbstractLayerModel * layer = stackedLayerModel->GetCurrent();
assert( layer!=NULL );
if( layer==NULL )
return;
if( layer->inherits( VectorImageModel::staticMetaObject.className() ) )
{
......@@ -2012,6 +2015,9 @@ ImageViewWidget
StackedLayerModel * stackedLayerModel = m_Renderer->GetLayerStack();
assert( stackedLayerModel!=NULL );
if( !stackedLayerModel->HasCurrent() )
return;
AbstractLayerModel * layer = stackedLayerModel->GetCurrent();
assert( layer!=NULL );
......@@ -2071,7 +2077,8 @@ ImageViewWidget
assert( stackedLayerModel!=NULL );
AbstractLayerModel * layer = stackedLayerModel->GetCurrent();
assert( layer!=NULL );
if( layer==NULL )
return;
if( layer->inherits( VectorImageModel::staticMetaObject.className() ) )
{
......@@ -2283,7 +2290,8 @@ ImageViewWidget
assert( stackedLayerModel!=NULL );
AbstractLayerModel * layer = stackedLayerModel->GetCurrent();
assert( layer!=NULL );
if( layer==NULL )
return;
if( layer->inherits( VectorImageModel::staticMetaObject.className() ) )
{
......@@ -2352,8 +2360,11 @@ ImageViewWidget
assert( m_Manipulator!=NULL );
// Update the Manipulator reference projection.
// Then all view manipulation will use this projection reference.
m_Manipulator->SetWkt( image->GetProjectionRef() );
m_Manipulator->SetKeywordList( image->GetImageKeywordlist() );
m_Manipulator->SetNativeSpacing( imageModel->GetNativeSpacing() );
}
else
{
......
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "mvdProjectionBarWidget.h"
#include "ui_mvdProjectionBarWidget.h"
namespace mvd
{
ProjectionBarWidget::ProjectionBarWidget( QWidget* p, Qt::WindowFlags flags ) :
QWidget( p, flags )
, m_UI( new mvd::Ui::ProjectionBarWidget() )
{
m_UI->setupUi( this );
}
ProjectionBarWidget::~ProjectionBarWidget()
{
delete m_UI;
m_UI = NULL;
}
void ProjectionBarWidget::SetProjectionScale(double scale_x, double )
{
QString text = "1:1";
if( scale_x>1.0 )
text = QString( "%1:1" ).arg( scale_x );
else if( scale_x<1.0 )
text = QString( "1:%1" ).arg( 1.0 / scale_x );
m_UI->projectionScaleLineEdit->setText(text);
}
void ProjectionBarWidget::on_projectionScaleLineEdit_returnPressed()
{
ChangeScale();
}
void ProjectionBarWidget::on_projectionScaleLineEdit_editingFinished()
{
if(m_UI->projectionScaleLineEdit->isModified())
{
ChangeScale();
}
}
void ProjectionBarWidget::ChangeScale()
{
// Cancel if scale text is empty.
if( m_UI->projectionScaleLineEdit->text().isEmpty() )
return;
// Split scale text.
QStringList scale( m_UI->projectionScaleLineEdit->text().split( ':' ) );
if( scale.size()!=1 && scale.size()!=2 )
return;
// Convert scale numerator.
bool isOk = true;
double numerator = scale.front().toDouble( &isOk );
if( !isOk || numerator==0.0 )
return;
// Convert scale denominator.
double denominator = 1.0;
if( scale.size()>1 )
{
denominator = scale.back().toDouble( &isOk );
if( !isOk )
return;
}
// Emit scale changed.
emit ProjectionScaleChanged( numerator / denominator );
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>mvd::ProjectionBarWidget</class>
<widget class="QWidget" name="mvd::ProjectionBarWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>204</width>
<height>20</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="projectionScaleLabel">
<property name="maximumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="text">
<string comment="projection">Zoom Level</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="projectionScaleLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>20</height>
</size>
</property>
<property name="toolTip">
<string>Current zoom-level of view, relative to reference layer (projection and spacing).</string>
</property>
<property name="locale">
<locale language="C" country="AnyCountry"/>
</property>
<property name="text">
<string>1:1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="placeholderText">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -159,6 +159,10 @@ StatusBarWidget
assert( m_UI->pixelIndexLineEdit!=NULL );
m_UI->pixelRadiometryLabel->setText( text );
// mantis-1385 hide scaleLineEdit
m_UI->label_4->hide();
m_UI->scaleLineEdit->hide();
}
/*****************************************************************************/
......
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