mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2331 Refactor the viewer-view communication to pave way for 2dIntersection Views
This commit is contained in:
@@ -43,6 +43,7 @@ ${CEE_CURRENT_LIST_DIR}RiuTofAccumulatedPhaseFractionsPlot.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuToolTipMenu.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuTreeViewEventFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuViewer.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuViewerToViewInterface.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuViewerCommands.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuWellLogPlot.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuWellLogTrack.h
|
||||
|
||||
@@ -186,9 +186,10 @@ RiuViewer::~RiuViewer()
|
||||
{
|
||||
m_rimView->handleMdiWindowClosed();
|
||||
|
||||
m_rimView->cameraPosition = m_mainCamera->viewMatrix();
|
||||
m_rimView->cameraPointOfInterest = pointOfInterest();
|
||||
m_rimView->setCameraPosition(m_mainCamera->viewMatrix());
|
||||
m_rimView->setCameraPointOfInterest( pointOfInterest());
|
||||
}
|
||||
|
||||
delete m_infoLabel;
|
||||
delete m_animationProgress;
|
||||
delete m_histogramWidget;
|
||||
@@ -297,7 +298,7 @@ void RiuViewer::slotSetCurrentFrame(int frameIndex)
|
||||
RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker();
|
||||
if (viewLinker)
|
||||
{
|
||||
viewLinker->updateTimeStep(m_rimView, frameIndex);
|
||||
viewLinker->updateTimeStep(dynamic_cast<Rim3dView*>(m_rimView.p()), frameIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,17 +322,11 @@ void RiuViewer::setPointOfInterest(cvf::Vec3d poi)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::setOwnerReservoirView(Rim3dView * owner)
|
||||
void RiuViewer::setOwnerReservoirView(RiuViewerToViewInterface * owner)
|
||||
{
|
||||
m_rimView = owner;
|
||||
m_viewerCommands->setOwnerView(owner);
|
||||
|
||||
cvf::String xLabel;
|
||||
cvf::String yLabel;
|
||||
cvf::String zLabel;
|
||||
|
||||
m_rimView->axisLabels(&xLabel, &yLabel, &zLabel);
|
||||
setAxisLabels(xLabel, yLabel, zLabel);
|
||||
m_viewerCommands->setOwnerView(dynamic_cast<Rim3dView*>(owner));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -367,7 +362,7 @@ void RiuViewer::paintOverlayItems(QPainter* painter)
|
||||
|
||||
if (showAnimBar && m_showAnimProgress)
|
||||
{
|
||||
QString stepName = m_rimView->ownerCase()->timeStepName(currentFrameIndex());
|
||||
QString stepName = m_rimView->timeStepName(currentFrameIndex());
|
||||
m_animationProgress->setFormat("Time Step: %v/%m " + stepName);
|
||||
m_animationProgress->setMinimum(0);
|
||||
m_animationProgress->setMaximum(static_cast<int>(frameCount()) - 1);
|
||||
@@ -468,6 +463,19 @@ void RiuViewer::setHistogramPercentiles(double pmin, double pmax, double mean)
|
||||
m_histogramWidget->setMean(mean);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::showGridBox(bool enable)
|
||||
{
|
||||
this->removeStaticModel(m_gridBoxGenerator->model());
|
||||
|
||||
if (enable)
|
||||
{
|
||||
this->addStaticModelOnce(m_gridBoxGenerator->model());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -622,7 +630,7 @@ void RiuViewer::navigationPolicyUpdate()
|
||||
RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker();
|
||||
if (viewLinker)
|
||||
{
|
||||
viewLinker->updateCamera(m_rimView);
|
||||
viewLinker->updateCamera(dynamic_cast<Rim3dView*>(m_rimView.p()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -645,7 +653,20 @@ void RiuViewer::setCurrentFrame(int frameIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dView* RiuViewer::ownerReservoirView()
|
||||
void RiuViewer::showAxisCross(bool enable)
|
||||
{
|
||||
m_mainRendering->removeOverlayItem(m_axisCross.p());
|
||||
|
||||
if (enable)
|
||||
{
|
||||
m_mainRendering->addOverlayItem(m_axisCross.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuViewerToViewInterface* RiuViewer::ownerReservoirView()
|
||||
{
|
||||
return m_rimView;
|
||||
}
|
||||
@@ -655,7 +676,7 @@ Rim3dView* RiuViewer::ownerReservoirView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow* RiuViewer::ownerViewWindow() const
|
||||
{
|
||||
return m_rimView;
|
||||
return dynamic_cast<RimViewWindow*>( m_rimView.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -719,7 +740,7 @@ void RiuViewer::mouseMoveEvent(QMouseEvent* mouseEvent)
|
||||
cvf::ref<caf::DisplayCoordTransform> trans = m_rimView->displayCoordTransform();
|
||||
cvf::Vec3d domainCoord = trans->transformToDomainCoord(displayCoord);
|
||||
|
||||
viewLinker->updateCursorPosition(m_rimView, domainCoord);
|
||||
viewLinker->updateCursorPosition(dynamic_cast<Rim3dView*>(m_rimView.p()) , domainCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -735,43 +756,24 @@ void RiuViewer::leaveEvent(QEvent *)
|
||||
if (m_rimView && m_rimView->assosiatedViewLinker())
|
||||
{
|
||||
RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker();
|
||||
viewLinker->updateCursorPosition(m_rimView, cvf::Vec3d::UNDEFINED);
|
||||
viewLinker->updateCursorPosition(dynamic_cast<Rim3dView*>(m_rimView.p()), cvf::Vec3d::UNDEFINED);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::updateGridBoxData()
|
||||
void RiuViewer::updateGridBoxData(double scaleZ,
|
||||
const cvf::Vec3d& displayModelOffset,
|
||||
const cvf::Color3f& backgroundColor,
|
||||
const cvf::BoundingBox& domainCoordBoundingBox)
|
||||
{
|
||||
if (ownerReservoirView() && ownerReservoirView()->ownerCase())
|
||||
{
|
||||
Rim3dView* rimView = ownerReservoirView();
|
||||
RimCase* rimCase = rimView->ownerCase();
|
||||
m_gridBoxGenerator->setScaleZ(scaleZ);
|
||||
m_gridBoxGenerator->setDisplayModelOffset(displayModelOffset);
|
||||
m_gridBoxGenerator->updateFromBackgroundColor(backgroundColor);
|
||||
m_gridBoxGenerator->setGridBoxDomainCoordBoundingBox(domainCoordBoundingBox);
|
||||
|
||||
m_gridBoxGenerator->setScaleZ(rimView->scaleZ);
|
||||
m_gridBoxGenerator->setDisplayModelOffset(rimCase->displayModelOffset());
|
||||
m_gridBoxGenerator->updateFromBackgroundColor(rimView->backgroundColor);
|
||||
|
||||
if (rimView->showActiveCellsOnly())
|
||||
{
|
||||
m_gridBoxGenerator->setGridBoxDomainCoordBoundingBox(rimCase->activeCellsBoundingBox());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gridBoxGenerator->setGridBoxDomainCoordBoundingBox(rimCase->allCellsBoundingBox());
|
||||
}
|
||||
|
||||
m_gridBoxGenerator->createGridBoxParts();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Model* RiuViewer::gridBoxModel() const
|
||||
{
|
||||
return m_gridBoxGenerator->model();
|
||||
m_gridBoxGenerator->createGridBoxParts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -907,7 +909,7 @@ cvf::Color3f RiuViewer::computeContrastColor() const
|
||||
|
||||
if (m_rimView.notNull())
|
||||
{
|
||||
contrastColor = RiaColorTools::constrastColor(m_rimView->backgroundColor);
|
||||
contrastColor = RiaColorTools::constrastColor(m_rimView->backgroundColor());
|
||||
}
|
||||
|
||||
return contrastColor;
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiuViewerToViewInterface.h"
|
||||
#include "cafViewer.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmInterfacePointer.h"
|
||||
|
||||
#include "cafMouseState.h"
|
||||
#include "cvfStructGrid.h"
|
||||
@@ -46,6 +48,7 @@ namespace cvf
|
||||
class OverlayItem;
|
||||
class Part;
|
||||
class OverlayAxisCross;
|
||||
class BoundingBox;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@@ -64,8 +67,8 @@ public:
|
||||
void setDefaultView();
|
||||
cvf::Vec3d pointOfInterest();
|
||||
void setPointOfInterest(cvf::Vec3d poi);
|
||||
void setOwnerReservoirView(Rim3dView * owner);
|
||||
Rim3dView* ownerReservoirView();
|
||||
void setOwnerReservoirView(RiuViewerToViewInterface * owner);
|
||||
RiuViewerToViewInterface* ownerReservoirView();
|
||||
RimViewWindow* ownerViewWindow() const override;
|
||||
void setEnableMask(unsigned int mask);
|
||||
|
||||
@@ -75,8 +78,11 @@ public:
|
||||
void setHistogram(double min, double max, const std::vector<size_t>& histogram);
|
||||
void setHistogramPercentiles(double pmin, double pmax, double mean);
|
||||
|
||||
void updateGridBoxData();
|
||||
cvf::Model* gridBoxModel() const;
|
||||
void showGridBox(bool enable);
|
||||
void updateGridBoxData(double scaleZ,
|
||||
const cvf::Vec3d& displayModelOffset,
|
||||
const cvf::Color3f& backgroundColor,
|
||||
const cvf::BoundingBox& domainCoordBoundingBox);
|
||||
|
||||
void updateAnnotationItems();
|
||||
|
||||
@@ -91,6 +97,7 @@ public:
|
||||
|
||||
void setCurrentFrame(int frameIndex);
|
||||
|
||||
void showAxisCross(bool enable);
|
||||
void setAxisLabels(const cvf::String& xLabel, const cvf::String& yLabel, const cvf::String& zLabel);
|
||||
|
||||
cvf::Vec3d lastPickPositionInDomainCoords() const;
|
||||
@@ -141,7 +148,7 @@ private:
|
||||
cvf::ref<cvf::OverlayAxisCross> m_axisCross;
|
||||
cvf::Collection<cvf::OverlayItem> m_visibleLegends;
|
||||
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
caf::PdmInterfacePointer<RiuViewerToViewInterface> m_rimView;
|
||||
QPoint m_lastMousePressPosition;
|
||||
|
||||
RiuViewerCommands* m_viewerCommands;
|
||||
|
||||
64
ApplicationCode/UserInterface/RiuViewerToViewInterface.h
Normal file
64
ApplicationCode/UserInterface/RiuViewerToViewInterface.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- 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 "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfColor3.h"
|
||||
#include "cvfMatrix4.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimCase;
|
||||
class RimViewLinker;
|
||||
struct RimMdiWindowGeometry;
|
||||
class RimViewController;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObjectHandle;
|
||||
class DisplayCoordTransform;
|
||||
}
|
||||
|
||||
|
||||
class RiuViewerToViewInterface
|
||||
{
|
||||
public:
|
||||
virtual caf::PdmObjectHandle* implementingPdmObject() = 0;
|
||||
|
||||
virtual void handleMdiWindowClosed() = 0;
|
||||
virtual void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry) = 0;
|
||||
|
||||
virtual void setCameraPosition(const cvf::Mat4d & cameraPosition) = 0;
|
||||
virtual void setCameraPointOfInterest(const cvf::Vec3d& cameraPointOfInterest) = 0;
|
||||
|
||||
virtual cvf::Color3f backgroundColor() const = 0;
|
||||
virtual void selectOverlayInfoConfig() = 0;
|
||||
|
||||
virtual RimViewLinker* assosiatedViewLinker() const = 0;
|
||||
virtual RimViewController* viewController() const = 0;
|
||||
|
||||
virtual QString timeStepName( int ) const = 0;
|
||||
virtual cvf::ref<caf::DisplayCoordTransform> displayCoordTransform() const = 0;
|
||||
|
||||
virtual void setCurrentTimeStepAndUpdate(int frameIndex) = 0;
|
||||
virtual void updateCurrentTimeStepAndRedraw() = 0;
|
||||
virtual void endAnimation() = 0;
|
||||
};
|
||||
Reference in New Issue
Block a user