mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#792 Added Window zoom and Zoom All
This commit is contained in:
parent
2715310782
commit
b8615f0ebc
@ -9,13 +9,14 @@ set (SOURCE_GROUP_HEADER_FILES
|
|||||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.h
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.h
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.h
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicViewZoomAllFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicViewZoomAllFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
@ -0,0 +1,93 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- Statoil ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RicViewZoomAllFeature.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimView.h"
|
||||||
|
#include "RimViewWindow.h"
|
||||||
|
#include "RimWellLogPlot.h"
|
||||||
|
|
||||||
|
#include "RiuMainPlotWindow.h"
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
#include "RiuSummaryQwtPlot.h"
|
||||||
|
#include "RiuWellLogPlot.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QMdiSubWindow>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicViewZoomAllFeature, "RicViewZoomAllFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicViewZoomAllFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicViewZoomAllFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
QWidget* topLevelWidget = RiaApplication::activeWindow();
|
||||||
|
|
||||||
|
if (dynamic_cast<RiuMainWindow*>(topLevelWidget))
|
||||||
|
{
|
||||||
|
RimViewWindow* viewWindow = RiaApplication::instance()->activeReservoirView();
|
||||||
|
viewWindow->zoomAll();
|
||||||
|
}
|
||||||
|
else if (dynamic_cast<RiuMainPlotWindow*>(topLevelWidget))
|
||||||
|
{
|
||||||
|
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget);
|
||||||
|
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||||
|
if (subwindows.size() > 0)
|
||||||
|
{
|
||||||
|
RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast<RiuSummaryQwtPlot*>(subwindows.back()->widget());
|
||||||
|
if (summaryQwtPlot)
|
||||||
|
{
|
||||||
|
RimViewWindow* viewWindow = summaryQwtPlot->ownerPlotDefinition();
|
||||||
|
|
||||||
|
viewWindow->zoomAll();
|
||||||
|
summaryQwtPlot->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subwindows.back()->widget());
|
||||||
|
if (wellLogPlot)
|
||||||
|
{
|
||||||
|
RimViewWindow* viewWindow = wellLogPlot->ownerPlotDefinition();
|
||||||
|
viewWindow->zoomAll();
|
||||||
|
wellLogPlot->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicViewZoomAllFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setText("Zoom All");
|
||||||
|
actionToSetup->setIcon(QIcon(":/ZoomAll16x16.png"));
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- Statoil ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicViewZoomAllFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
virtual bool isCommandEnabled();
|
||||||
|
virtual void onActionTriggered( bool isChecked );
|
||||||
|
virtual void setupActionLook(QAction* actionToSetup);
|
||||||
|
};
|
@ -272,6 +272,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
{
|
{
|
||||||
commandIds << "RicNewSummaryCurveFeature";
|
commandIds << "RicNewSummaryCurveFeature";
|
||||||
commandIds << "RicNewSummaryCurveFilterFeature";
|
commandIds << "RicNewSummaryCurveFilterFeature";
|
||||||
|
commandIds << "RicViewZoomAllFeature";
|
||||||
|
|
||||||
commandIds << "RicDeleteItemFeature";
|
commandIds << "RicDeleteItemFeature";
|
||||||
}
|
}
|
||||||
|
@ -320,8 +320,10 @@ QString RimSummaryCurve::createCurveAutoName()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryCurve::zoomAllParentPlot()
|
void RimSummaryCurve::zoomAllParentPlot()
|
||||||
{
|
{
|
||||||
// Todo
|
RimSummaryPlot* plot = nullptr;
|
||||||
|
firstAnchestorOrThisOfType(plot);
|
||||||
|
|
||||||
|
plot->zoomAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -139,6 +139,17 @@ QWidget* RimSummaryPlot::viewer()
|
|||||||
return m_qwtPlot;
|
return m_qwtPlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::zoomAll()
|
||||||
|
{
|
||||||
|
if (m_qwtPlot)
|
||||||
|
{
|
||||||
|
m_qwtPlot->zoomAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -57,6 +57,9 @@ public:
|
|||||||
|
|
||||||
QWidget* viewer();
|
QWidget* viewer();
|
||||||
|
|
||||||
|
|
||||||
|
virtual void zoomAll() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
||||||
|
@ -906,3 +906,14 @@ void RimView::selectOverlayInfoConfig()
|
|||||||
RiuMainWindow::instance()->selectAsCurrentItem(m_overlayInfoConfig);
|
RiuMainWindow::instance()->selectAsCurrentItem(m_overlayInfoConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimView::zoomAll()
|
||||||
|
{
|
||||||
|
if (m_viewer)
|
||||||
|
{
|
||||||
|
m_viewer->zoomAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -152,6 +152,9 @@ public:
|
|||||||
|
|
||||||
void selectOverlayInfoConfig();
|
void selectOverlayInfoConfig();
|
||||||
|
|
||||||
|
|
||||||
|
virtual void zoomAll() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void loadDataAndUpdate() = 0;
|
virtual void loadDataAndUpdate() = 0;
|
||||||
virtual RimCase* ownerCase() = 0;
|
virtual RimCase* ownerCase() = 0;
|
||||||
|
@ -44,7 +44,8 @@ public:
|
|||||||
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
||||||
RimMdiWindowGeometry mdiWindowGeometry();
|
RimMdiWindowGeometry mdiWindowGeometry();
|
||||||
|
|
||||||
virtual QImage snapshotWindowContent() = 0;
|
virtual QImage snapshotWindowContent() = 0;
|
||||||
|
virtual void zoomAll() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setViewWidget(QWidget* viewWidget);
|
void setViewWidget(QWidget* viewWidget);
|
||||||
|
@ -370,6 +370,17 @@ bool RimWellLogPlot::hasAvailableDepthRange() const
|
|||||||
return m_minAvailableDepth < HUGE_VAL && m_maxAvailableDepth > -HUGE_VAL;
|
return m_minAvailableDepth < HUGE_VAL && m_maxAvailableDepth > -HUGE_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogPlot::zoomAll()
|
||||||
|
{
|
||||||
|
m_isAutoScaleDepthEnabled = true;
|
||||||
|
m_isAutoScaleDepthEnabled.uiCapability()->updateConnectedEditors();
|
||||||
|
|
||||||
|
updateDepthZoom();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
TRUE_VERTICAL_DEPTH
|
TRUE_VERTICAL_DEPTH
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RimWellLogPlot();
|
RimWellLogPlot();
|
||||||
virtual ~RimWellLogPlot();
|
virtual ~RimWellLogPlot();
|
||||||
@ -84,6 +85,8 @@ public:
|
|||||||
void availableDepthRange(double* minimumDepth, double* maximumDepth) const;
|
void availableDepthRange(double* minimumDepth, double* maximumDepth) const;
|
||||||
bool hasAvailableDepthRange() const;
|
bool hasAvailableDepthRange() const;
|
||||||
|
|
||||||
|
virtual void zoomAll() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
|
@ -178,6 +178,12 @@ void RiuMainPlotWindow::createToolBars()
|
|||||||
toolbar->addAction(cmdFeatureMgr->action("RicSnapshotViewToClipboardFeature"));
|
toolbar->addAction(cmdFeatureMgr->action("RicSnapshotViewToClipboardFeature"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Snapshots
|
||||||
|
QToolBar* toolbar = addToolBar(tr("View"));
|
||||||
|
toolbar->setObjectName(toolbar->windowTitle());
|
||||||
|
toolbar->addAction(cmdFeatureMgr->action("RicViewZoomAllFeature"));
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QToolBar* toolbar = addToolBar(tr("Window Management"));
|
QToolBar* toolbar = addToolBar(tr("Window Management"));
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "qwt_plot_curve.h"
|
#include "qwt_plot_curve.h"
|
||||||
#include "qwt_plot_grid.h"
|
#include "qwt_plot_grid.h"
|
||||||
#include "qwt_plot_layout.h"
|
#include "qwt_plot_layout.h"
|
||||||
|
#include "qwt_plot_panner.h"
|
||||||
|
#include "qwt_plot_zoomer.h"
|
||||||
#include "qwt_scale_engine.h"
|
#include "qwt_scale_engine.h"
|
||||||
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
@ -48,6 +50,17 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot(RimSummaryPlot* plotDefinition, QWidget* pa
|
|||||||
m_grid->attach(this);
|
m_grid->attach(this);
|
||||||
|
|
||||||
setDefaults();
|
setDefaults();
|
||||||
|
|
||||||
|
// LeftButton for the zooming
|
||||||
|
zoomer = new QwtPlotZoomer(canvas());
|
||||||
|
zoomer->setRubberBandPen(QColor(Qt::black));
|
||||||
|
zoomer->setTrackerMode(QwtPicker::AlwaysOff);
|
||||||
|
zoomer->setTrackerPen(QColor(Qt::black));
|
||||||
|
zoomer->initMousePattern(1);
|
||||||
|
|
||||||
|
// MidButton for the panning
|
||||||
|
QwtPlotPanner* panner = new QwtPlotPanner(canvas());
|
||||||
|
panner->setMouseButton(Qt::MidButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -82,6 +95,17 @@ void RiuSummaryQwtPlot::setYAxisTitle(const QString& title)
|
|||||||
setAxisTitle(QwtPlot::yLeft, axisTitleY);
|
setAxisTitle(QwtPlot::yLeft, axisTitleY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuSummaryQwtPlot::zoomAll()
|
||||||
|
{
|
||||||
|
setAxisAutoScale(yLeft, true);
|
||||||
|
setAxisAutoScale(xBottom, true);
|
||||||
|
|
||||||
|
zoomer->setZoomBase(true);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -21,8 +21,11 @@
|
|||||||
#include "qwt_plot.h"
|
#include "qwt_plot.h"
|
||||||
#include "cafPdmPointer.h"
|
#include "cafPdmPointer.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
class QwtPlotGrid;
|
class QwtPlotGrid;
|
||||||
|
class QwtPlotZoomer;
|
||||||
|
|
||||||
class RimSummaryPlot;
|
class RimSummaryPlot;
|
||||||
|
|
||||||
@ -39,6 +42,7 @@ public:
|
|||||||
|
|
||||||
RimSummaryPlot* ownerPlotDefinition();
|
RimSummaryPlot* ownerPlotDefinition();
|
||||||
void setYAxisTitle(const QString& title);
|
void setYAxisTitle(const QString& title);
|
||||||
|
void zoomAll();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventFilter(QObject* watched, QEvent* event);
|
virtual bool eventFilter(QObject* watched, QEvent* event);
|
||||||
@ -50,6 +54,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
QwtPlotGrid* m_grid;
|
QwtPlotGrid* m_grid;
|
||||||
caf::PdmPointer<RimSummaryPlot> m_plotDefinition;
|
caf::PdmPointer<RimSummaryPlot> m_plotDefinition;
|
||||||
|
QPointer<QwtPlotZoomer> zoomer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user