2015-04-29 03:50:25 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
//
|
|
|
|
// 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
|
2018-04-04 15:34:41 -05:00
|
|
|
|
2018-01-11 05:59:52 -06:00
|
|
|
#include "RiuViewerToViewInterface.h"
|
2018-01-11 08:44:22 -06:00
|
|
|
#include "RimViewWindow.h"
|
2015-04-29 03:50:25 -05:00
|
|
|
|
2018-04-04 15:34:41 -05:00
|
|
|
#include "RivCellSetEnum.h"
|
|
|
|
|
2015-07-31 11:58:23 -05:00
|
|
|
#include "cafAppEnum.h"
|
2015-04-29 15:19:49 -05:00
|
|
|
#include "cafPdmField.h"
|
2018-04-04 15:34:41 -05:00
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
2015-04-29 15:19:49 -05:00
|
|
|
#include "cafPdmFieldCvfColor.h"
|
|
|
|
#include "cafPdmFieldCvfMat4d.h"
|
2016-08-16 07:34:37 -05:00
|
|
|
#include "cafPdmFieldCvfVec3d.h"
|
2015-07-31 11:58:23 -05:00
|
|
|
|
2015-09-14 09:14:44 -05:00
|
|
|
#include "cvfBase.h"
|
2015-11-16 04:30:03 -06:00
|
|
|
#include "cvfCollection.h"
|
2015-09-14 09:14:44 -05:00
|
|
|
#include "cvfObject.h"
|
|
|
|
|
2015-07-31 11:58:23 -05:00
|
|
|
#include <QPointer>
|
|
|
|
|
2015-05-20 05:29:01 -05:00
|
|
|
class RimCase;
|
2018-04-18 03:32:51 -05:00
|
|
|
class RimLegendConfig;
|
2017-06-21 08:39:59 -05:00
|
|
|
class RimWellPathCollection;
|
2018-04-18 03:32:51 -05:00
|
|
|
class RiuViewer;
|
2018-02-05 07:11:23 -06:00
|
|
|
class RivWellPathsPartMgr;
|
2015-04-29 15:19:49 -05:00
|
|
|
|
2015-05-13 15:42:11 -05:00
|
|
|
namespace cvf
|
|
|
|
{
|
2015-06-11 06:44:21 -05:00
|
|
|
class BoundingBox;
|
2015-06-22 02:09:33 -05:00
|
|
|
class ModelBasicList;
|
2015-08-25 05:40:55 -05:00
|
|
|
class Scene;
|
2015-11-09 12:05:00 -06:00
|
|
|
class String;
|
2015-05-13 15:42:11 -05:00
|
|
|
class Transform;
|
2015-11-16 04:30:03 -06:00
|
|
|
class Part;
|
2015-05-13 15:42:11 -05:00
|
|
|
}
|
|
|
|
|
2016-09-29 04:43:47 -05:00
|
|
|
namespace caf
|
|
|
|
{
|
|
|
|
class DisplayCoordTransform;
|
|
|
|
}
|
2018-01-25 10:37:22 -06:00
|
|
|
|
|
|
|
|
|
|
|
enum PartRenderMaskEnum
|
|
|
|
{
|
2018-04-04 15:34:41 -05:00
|
|
|
surfaceBit = 1,
|
|
|
|
meshSurfaceBit = 2,
|
|
|
|
faultBit = 4,
|
|
|
|
meshFaultBit = 8,
|
|
|
|
intersectionCellFaceBit = 16,
|
|
|
|
intersectionCellMeshBit = 32,
|
|
|
|
intersectionFaultMeshBit = 64
|
2018-01-25 10:37:22 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-29 03:50:25 -05:00
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
2018-01-11 05:59:52 -06:00
|
|
|
class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface
|
2015-04-29 03:50:25 -05:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
2018-01-09 03:11:28 -06:00
|
|
|
Rim3dView(void);
|
2018-10-18 12:45:57 -05:00
|
|
|
~Rim3dView(void) override;
|
2015-04-29 03:50:25 -05:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
// Public fields:
|
2015-04-29 15:19:49 -05:00
|
|
|
|
2015-05-08 03:38:10 -05:00
|
|
|
caf::PdmField<double> scaleZ;
|
2015-12-04 17:56:14 -06:00
|
|
|
caf::PdmField<bool> isPerspectiveView;
|
2015-05-08 03:38:10 -05:00
|
|
|
caf::PdmField<int> maximumFrameRate;
|
2015-06-09 09:18:11 -05:00
|
|
|
caf::PdmField<bool> hasUserRequestedAnimation;
|
2015-04-29 15:19:49 -05:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
// Draw style
|
2015-08-27 06:44:27 -05:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
enum MeshModeType { FULL_MESH, FAULTS_MESH, NO_MESH };
|
|
|
|
enum SurfaceModeType { SURFACE, FAULTS, NO_SURFACE };
|
2015-09-01 15:11:39 -05:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
caf::PdmField< caf::AppEnum< MeshModeType > > meshMode;
|
|
|
|
caf::PdmField< caf::AppEnum< SurfaceModeType > > surfaceMode;
|
2015-09-01 15:11:39 -05:00
|
|
|
|
2018-09-12 03:04:15 -05:00
|
|
|
RiuViewer* viewer() const;
|
2015-05-08 07:13:26 -05:00
|
|
|
|
2018-09-24 15:15:34 -05:00
|
|
|
void setName(const QString& name);
|
|
|
|
QString name() const;
|
2015-05-08 07:13:26 -05:00
|
|
|
void setMeshOnlyDrawstyle();
|
|
|
|
void setMeshSurfDrawstyle();
|
|
|
|
void setSurfOnlyDrawstyle();
|
|
|
|
void setFaultMeshSurfDrawstyle();
|
|
|
|
void setSurfaceDrawstyle();
|
2018-10-31 03:39:27 -05:00
|
|
|
void setBackgroundColor(const cvf::Color3f& newBackgroundColor);
|
2018-10-31 06:13:04 -05:00
|
|
|
void setShowGridBox(bool showGridBox);
|
2015-06-17 08:04:55 -05:00
|
|
|
|
|
|
|
void disableLighting(bool disable);
|
|
|
|
bool isLightingDisabled() const;
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-04-04 15:34:41 -05:00
|
|
|
virtual bool isGridVisualizationMode() const = 0;
|
2015-05-08 07:13:26 -05:00
|
|
|
|
2015-09-03 06:06:00 -05:00
|
|
|
void setScaleZAndUpdate(double scaleZ);
|
2018-01-11 08:44:22 -06:00
|
|
|
virtual bool showActiveCellsOnly();
|
|
|
|
virtual bool isUsingFormationNames() const = 0;
|
|
|
|
|
2018-10-18 12:45:57 -05:00
|
|
|
QImage snapshotWindowContent() override;
|
|
|
|
void zoomAll() override;
|
2018-01-11 08:44:22 -06:00
|
|
|
void forceShowWindowOn();
|
2015-09-03 06:06:00 -05:00
|
|
|
|
2015-04-29 15:19:49 -05:00
|
|
|
// Animation
|
2016-12-14 03:35:28 -06:00
|
|
|
int currentTimeStep() const { return m_currentTimeStep;}
|
2017-03-02 09:10:18 -06:00
|
|
|
void setCurrentTimeStep(int frameIdx);
|
2018-01-11 08:44:22 -06:00
|
|
|
void setCurrentTimeStepAndUpdate(int frameIdx) override;
|
2018-01-25 10:37:22 -06:00
|
|
|
virtual bool isTimeStepDependentDataVisible() const = 0;
|
2015-04-29 15:19:49 -05:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
// Updating
|
|
|
|
void updateCurrentTimeStepAndRedraw() override;
|
2015-06-18 12:22:24 -05:00
|
|
|
virtual void scheduleGeometryRegen(RivCellSetEnum geometryType) = 0;
|
2015-05-08 03:38:10 -05:00
|
|
|
void scheduleCreateDisplayModelAndRedraw();
|
|
|
|
void createDisplayModelAndRedraw();
|
2015-11-19 04:41:16 -06:00
|
|
|
void createHighlightAndGridBoxDisplayModelWithRedraw();
|
2018-01-11 08:44:22 -06:00
|
|
|
void updateGridBoxData();
|
2018-04-09 06:13:20 -05:00
|
|
|
void updateAnnotationItems();
|
2015-09-15 07:30:52 -05:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
bool isMasterView() const;
|
2018-01-11 05:59:52 -06:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform() const override;
|
2018-01-11 05:59:52 -06:00
|
|
|
|
2017-06-25 03:36:15 -05:00
|
|
|
virtual RimCase* ownerCase() const = 0;
|
2018-04-18 03:32:51 -05:00
|
|
|
virtual std::vector<RimLegendConfig*> legendConfigs() const = 0;
|
2017-11-15 13:45:56 -06:00
|
|
|
|
2015-04-29 15:19:49 -05:00
|
|
|
protected:
|
2018-03-13 10:16:41 -05:00
|
|
|
static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName);
|
|
|
|
|
2018-01-25 10:37:22 -06:00
|
|
|
virtual void setDefaultView();
|
2018-01-29 04:24:53 -06:00
|
|
|
void disableGridBoxField();
|
|
|
|
void disablePerspectiveProjectionField();
|
2018-10-23 09:32:40 -05:00
|
|
|
void enablePerspectiveProjectionField();
|
2018-05-18 14:38:49 -05:00
|
|
|
cvf::Mat4d cameraPosition() const;
|
|
|
|
cvf::Vec3d cameraPointOfInterest() const;
|
|
|
|
|
2015-06-22 02:09:33 -05:00
|
|
|
|
2018-01-31 09:37:43 -06:00
|
|
|
RimWellPathCollection* wellPathCollection() const;
|
2018-09-03 07:52:00 -05:00
|
|
|
bool hasVisibleTimeStepDependent3dWellLogCurves() const;
|
|
|
|
void addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
|
2017-06-19 15:15:28 -05:00
|
|
|
const cvf::BoundingBox& wellPathClipBoundingBox);
|
2015-05-08 03:38:10 -05:00
|
|
|
|
2017-06-19 15:53:19 -05:00
|
|
|
void addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
|
|
|
|
const cvf::BoundingBox& wellPathClipBoundingBox);
|
|
|
|
|
2015-11-19 04:41:16 -06:00
|
|
|
void createHighlightAndGridBoxDisplayModel();
|
2015-11-16 07:08:17 -06:00
|
|
|
|
2018-04-06 04:52:29 -05:00
|
|
|
// Implementation of RiuViewerToViewInterface
|
2018-10-31 03:39:27 -05:00
|
|
|
cvf::Color3f backgroundColor() const override { return m_backgroundColor(); }
|
2018-04-09 04:51:30 -05:00
|
|
|
void applyBackgroundColor();
|
2018-04-06 04:52:29 -05:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
// Abstract methods to implement in subclasses
|
|
|
|
|
|
|
|
virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) = 0;
|
|
|
|
|
|
|
|
virtual void createDisplayModel() = 0;
|
2015-11-16 04:30:03 -06:00
|
|
|
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) = 0;
|
|
|
|
|
2018-01-25 10:37:22 -06:00
|
|
|
virtual void updateDisplayModelVisibility();
|
2015-05-08 03:38:10 -05:00
|
|
|
virtual void clampCurrentTimestep() = 0;
|
|
|
|
|
|
|
|
virtual void updateCurrentTimeStep() = 0;
|
2018-01-15 07:52:22 -06:00
|
|
|
virtual void onTimeStepChanged() = 0;
|
2015-05-08 03:38:10 -05:00
|
|
|
virtual void updateStaticCellColors() = 0;
|
|
|
|
|
2015-05-13 15:42:11 -05:00
|
|
|
virtual void updateScaleTransform() = 0;
|
|
|
|
virtual cvf::Transform* scaleTransform() = 0;
|
|
|
|
|
2015-05-08 03:38:10 -05:00
|
|
|
virtual void resetLegendsInViewer() = 0;
|
2018-01-11 08:44:22 -06:00
|
|
|
|
|
|
|
protected: // Fields
|
2018-01-16 01:44:15 -06:00
|
|
|
caf::PdmField<int> m_currentTimeStep;
|
2015-05-08 07:13:26 -05:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
protected:
|
2018-01-16 01:44:15 -06:00
|
|
|
QPointer<RiuViewer> m_viewer;
|
2018-01-11 08:44:22 -06:00
|
|
|
|
2018-01-16 01:44:15 -06:00
|
|
|
cvf::ref<cvf::ModelBasicList> m_wellPathPipeVizModel;
|
|
|
|
cvf::ref<cvf::ModelBasicList> m_crossSectionVizModel;
|
|
|
|
cvf::ref<cvf::ModelBasicList> m_highlightVizModel;
|
2015-11-19 04:41:16 -06:00
|
|
|
|
2018-02-05 07:11:23 -06:00
|
|
|
cvf::ref<RivWellPathsPartMgr> m_wellPathsPartManager;
|
|
|
|
|
2015-09-25 04:01:41 -05:00
|
|
|
private:
|
2018-01-12 04:31:01 -06:00
|
|
|
// Overridden PdmObject methods:
|
|
|
|
|
2018-10-18 12:45:57 -05:00
|
|
|
void setupBeforeSave() override;
|
2018-01-12 04:31:01 -06:00
|
|
|
protected:
|
2018-10-31 04:36:04 -05:00
|
|
|
caf::PdmFieldHandle* userDescriptionField() override { return &m_name; }
|
|
|
|
caf::PdmFieldHandle* backgroundColorField() { return &m_backgroundColor; }
|
|
|
|
|
2018-10-18 12:45:57 -05:00
|
|
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
|
|
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
2018-10-23 09:32:40 -05:00
|
|
|
virtual void updateViewWidgetAfterCreation() override;
|
|
|
|
|
2018-01-12 04:31:01 -06:00
|
|
|
private:
|
|
|
|
// Overridden ViewWindow methods:
|
|
|
|
|
2018-10-18 12:45:57 -05:00
|
|
|
QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
|
|
|
void updateMdiWindowTitle() override;
|
|
|
|
void deleteViewWidget() override;
|
|
|
|
QWidget* viewWidget() override;
|
2018-01-12 04:31:01 -06:00
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
// Implementation of RiuViewerToViewInterface
|
2018-10-18 12:45:57 -05:00
|
|
|
void setCameraPosition(const cvf::Mat4d& cameraPosition) override { m_cameraPosition = cameraPosition; }
|
|
|
|
void setCameraPointOfInterest(const cvf::Vec3d& cameraPointOfInterest) override { m_cameraPointOfInterest = cameraPointOfInterest;}
|
|
|
|
QString timeStepName(int frameIdx) const override;
|
|
|
|
void endAnimation() override;
|
|
|
|
caf::PdmObjectHandle* implementingPdmObject() override { return this; }
|
|
|
|
void handleMdiWindowClosed() override;
|
|
|
|
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry) override;
|
2016-12-14 03:35:28 -06:00
|
|
|
|
2015-05-08 07:13:26 -05:00
|
|
|
private:
|
2018-09-24 15:15:34 -05:00
|
|
|
caf::PdmField<QString> m_name;
|
2015-06-17 08:04:55 -05:00
|
|
|
caf::PdmField<bool> m_disableLighting;
|
2018-01-11 05:59:52 -06:00
|
|
|
caf::PdmField<cvf::Mat4d> m_cameraPosition;
|
|
|
|
caf::PdmField<cvf::Vec3d> m_cameraPointOfInterest;
|
|
|
|
caf::PdmField< cvf::Color3f > m_backgroundColor;
|
2018-01-25 10:37:22 -06:00
|
|
|
caf::PdmField<bool> m_showGridBox;
|
2018-01-11 05:59:52 -06:00
|
|
|
|
2015-04-29 03:50:25 -05:00
|
|
|
};
|