2015-04-29 03:50:25 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-04-29 03:50:25 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-04-29 03:50:25 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2015-04-29 03:50:25 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
2018-04-04 15:34:41 -05:00
|
|
|
|
2019-04-10 05:49:20 -05:00
|
|
|
#include "RiaDefines.h"
|
2018-12-14 06:41:35 -06:00
|
|
|
#include "RimNameConfig.h"
|
2018-01-11 08:44:22 -06:00
|
|
|
#include "RimViewWindow.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RiuViewerToViewInterface.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"
|
2019-10-11 02:47:30 -05:00
|
|
|
#include "cafPdmPtrField.h"
|
2018-04-04 15:34:41 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "cafPdmFieldCvfColor.h"
|
2015-04-29 15:19:49 -05:00
|
|
|
#include "cafPdmFieldCvfMat4d.h"
|
2016-08-16 07:34:37 -05:00
|
|
|
#include "cafPdmFieldCvfVec3d.h"
|
2015-07-31 11:58:23 -05:00
|
|
|
|
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-11-23 06:33:59 -06:00
|
|
|
class RivAnnotationsPartMgr;
|
2018-12-19 07:41:17 -06:00
|
|
|
class RivMeasurementPartMgr;
|
2019-09-06 03:40:57 -05:00
|
|
|
class RivWellPathsPartMgr;
|
2018-12-14 06:41:35 -06:00
|
|
|
class RimViewNameConfig;
|
2015-04-29 15:19:49 -05:00
|
|
|
|
2015-05-13 15:42:11 -05:00
|
|
|
namespace cvf
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
class BoundingBox;
|
|
|
|
class ModelBasicList;
|
|
|
|
class Scene;
|
|
|
|
class String;
|
|
|
|
class Transform;
|
|
|
|
class Part;
|
|
|
|
} // namespace cvf
|
2015-05-13 15:42:11 -05:00
|
|
|
|
2016-09-29 04:43:47 -05:00
|
|
|
namespace caf
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
class DisplayCoordTransform;
|
2016-09-29 04:43:47 -05:00
|
|
|
}
|
2018-01-25 10:37:22 -06:00
|
|
|
|
|
|
|
enum PartRenderMaskEnum
|
|
|
|
{
|
2019-09-06 03:40:57 -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
|
|
|
//==================================================================================================
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
|
|
|
///
|
2015-04-29 03:50:25 -05:00
|
|
|
//==================================================================================================
|
2018-12-14 06:41:35 -06:00
|
|
|
class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public RimNameConfigHolderInterface
|
2015-04-29 03:50:25 -05:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2015-04-29 03:50:25 -05:00
|
|
|
public:
|
2019-09-06 03:40:57 -05:00
|
|
|
Rim3dView( void );
|
|
|
|
~Rim3dView( void ) override;
|
2015-04-29 03:50:25 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
// Public fields:
|
2015-04-29 15:19:49 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmField<double> scaleZ;
|
|
|
|
caf::PdmField<bool> isPerspectiveView;
|
|
|
|
caf::PdmField<int> maximumFrameRate;
|
|
|
|
caf::PdmField<bool> hasUserRequestedAnimation;
|
2015-04-29 15:19:49 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
// Draw style
|
2015-08-27 06:44:27 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
enum SurfaceModeType
|
|
|
|
{
|
|
|
|
SURFACE,
|
|
|
|
FAULTS,
|
|
|
|
NO_SURFACE
|
|
|
|
};
|
2015-09-01 15:11:39 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmField<caf::AppEnum<RiaDefines::MeshModeType>> meshMode;
|
|
|
|
caf::PdmField<caf::AppEnum<SurfaceModeType>> surfaceMode;
|
2015-09-01 15:11:39 -05:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
virtual RimCase* ownerCase() const = 0;
|
|
|
|
RiuViewer* viewer() const;
|
2015-05-08 07:13:26 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void setName( const QString& name );
|
|
|
|
QString name() const;
|
2019-10-15 07:28:15 -05:00
|
|
|
QString autoName() const;
|
2019-07-15 04:43:22 -05:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
void setMeshOnlyDrawstyle();
|
|
|
|
void setMeshSurfDrawstyle();
|
|
|
|
void setSurfOnlyDrawstyle();
|
|
|
|
void setFaultMeshSurfDrawstyle();
|
|
|
|
void setSurfaceDrawstyle();
|
|
|
|
void setShowGridBox( bool showGridBox );
|
|
|
|
virtual bool isShowingActiveCellsOnly();
|
|
|
|
virtual bool isGridVisualizationMode() const = 0;
|
2015-06-17 08:04:55 -05:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
void setBackgroundColor( const cvf::Color3f& newBackgroundColor );
|
|
|
|
cvf::Color3f backgroundColor() const override; // Implementation of RiuViewerToViewInterface
|
|
|
|
void applyBackgroundColorAndFontChanges();
|
|
|
|
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
|
|
|
|
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
|
|
|
int oldFontSize,
|
|
|
|
int fontSize,
|
|
|
|
bool forceChange = false ) override;
|
2019-04-10 05:49:20 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void disableLighting( bool disable );
|
|
|
|
bool isLightingDisabled() const;
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
virtual bool isUsingFormationNames() const = 0;
|
|
|
|
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform() const override;
|
|
|
|
virtual std::vector<RimLegendConfig*> legendConfigs() const = 0;
|
2018-01-11 08:44:22 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
QImage snapshotWindowContent() override;
|
|
|
|
void zoomAll() override;
|
|
|
|
void forceShowWindowOn();
|
2015-09-03 06:06:00 -05:00
|
|
|
|
2015-04-29 15:19:49 -05:00
|
|
|
// Animation
|
2019-11-08 03:39:40 -06:00
|
|
|
int currentTimeStep() const;
|
|
|
|
void setCurrentTimeStep( int frameIdx );
|
|
|
|
void setCurrentTimeStepAndUpdate( int frameIdx ) override;
|
|
|
|
bool isTimeStepDependentDataVisibleInThisOrComparisonView() const;
|
|
|
|
size_t timeStepCount();
|
|
|
|
QString timeStepName( int frameIdx ) const override;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
// Updating
|
|
|
|
void scheduleCreateDisplayModelAndRedraw();
|
2019-11-01 08:57:07 -05:00
|
|
|
virtual void scheduleGeometryRegen( RivCellSetEnum geometryType ) = 0;
|
2019-10-15 07:28:15 -05:00
|
|
|
|
|
|
|
void createDisplayModelAndRedraw();
|
2019-11-01 04:13:32 -05:00
|
|
|
void updateDisplayModelForCurrentTimeStepAndRedraw();
|
|
|
|
void createHighlightAndGridBoxDisplayModelAndRedraw();
|
|
|
|
void createMeasurementDisplayModelAndRedraw();
|
2019-10-15 07:28:15 -05:00
|
|
|
void updateGridBoxData();
|
|
|
|
void updateAnnotationItems();
|
2019-11-01 08:57:07 -05:00
|
|
|
|
|
|
|
void setScaleZAndUpdate( double scaleZ );
|
2019-10-15 07:28:15 -05:00
|
|
|
void updateScaling();
|
|
|
|
void updateZScaleLabel();
|
2019-11-01 08:57:07 -05:00
|
|
|
bool isScaleZEditable();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
bool isMasterView() const;
|
|
|
|
Rim3dView* activeComparisonView() const;
|
|
|
|
void setComparisonView( Rim3dView* compView );
|
2019-10-22 06:39:18 -05:00
|
|
|
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2015-04-29 15:19:49 -05:00
|
|
|
protected:
|
2019-09-06 03:40:57 -05:00
|
|
|
static void removeModelByName( cvf::Scene* scene, const cvf::String& modelName );
|
2018-03-13 10:16:41 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
virtual void setDefaultView();
|
|
|
|
cvf::Mat4d cameraPosition() const;
|
|
|
|
cvf::Vec3d cameraPointOfInterest() const;
|
|
|
|
RimViewNameConfig* nameConfig() const;
|
2015-06-22 02:09:33 -05:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
void disableGridBoxField();
|
|
|
|
void disablePerspectiveProjectionField();
|
|
|
|
void updateDisplayModelVisibility();
|
|
|
|
|
|
|
|
bool hasVisibleTimeStepDependent3dWellLogCurves() const;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
RimWellPathCollection* wellPathCollection() const;
|
2015-05-08 03:38:10 -05:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
void addWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList,
|
|
|
|
const cvf::BoundingBox& wellPathClipBoundingBox );
|
2019-09-06 03:40:57 -05:00
|
|
|
void addDynamicWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList,
|
|
|
|
const cvf::BoundingBox& wellPathClipBoundingBox );
|
2019-10-31 09:32:30 -05:00
|
|
|
void addAnnotationsToModel( cvf::ModelBasicList* annotationsModel );
|
|
|
|
void addMeasurementToModel( cvf::ModelBasicList* measureModel );
|
2018-11-23 06:33:59 -06:00
|
|
|
|
2019-10-11 02:47:30 -05:00
|
|
|
// Override viewer
|
|
|
|
|
|
|
|
RiuViewer* nativeOrOverrideViewer() const;
|
|
|
|
bool isUsingOverrideViewer() const;
|
2015-11-16 07:08:17 -06:00
|
|
|
|
2019-11-06 07:53:21 -06:00
|
|
|
void hideComparisonViewField();
|
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
// Abstract methods to implement in subclasses
|
|
|
|
|
2019-11-08 03:39:40 -06:00
|
|
|
virtual void onCreateDisplayModel() = 0;
|
|
|
|
virtual void onUpdateDisplayModelForCurrentTimeStep() = 0;
|
|
|
|
virtual void onUpdateDisplayModelVisibility(){};
|
|
|
|
virtual void onClampCurrentTimestep() = 0;
|
|
|
|
virtual size_t onTimeStepCountRequested() = 0;
|
|
|
|
|
2019-11-01 04:13:32 -05:00
|
|
|
virtual void onClearReservoirCellVisibilitiesIfNeccessary(){};
|
2019-11-01 08:57:07 -05:00
|
|
|
virtual bool isTimeStepDependentDataVisible() const = 0;
|
2019-11-01 04:13:32 -05:00
|
|
|
virtual void defineAxisLabels( cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel ) = 0;
|
2019-11-01 08:57:07 -05:00
|
|
|
virtual void onCreatePartCollectionFromSelection( cvf::Collection<cvf::Part>* parts ) = 0;
|
|
|
|
virtual void onUpdateStaticCellColors() = 0;
|
|
|
|
virtual void onResetLegendsInViewer() = 0;
|
|
|
|
virtual void onUpdateLegends() = 0;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2019-10-31 09:32:30 -05:00
|
|
|
virtual void onUpdateScaleTransform() = 0;
|
|
|
|
virtual cvf::Transform* scaleTransform() = 0;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2019-10-31 10:37:16 -05:00
|
|
|
protected:
|
2018-01-12 04:31:01 -06:00
|
|
|
// Overridden PdmObject methods:
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
2019-10-31 10:37:16 -05:00
|
|
|
caf::PdmFieldHandle* backgroundColorField();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue ) override;
|
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
2018-12-13 06:20:49 -06:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
|
|
bool* useOptionsOnly ) override;
|
|
|
|
|
|
|
|
void initAfterRead() override;
|
2019-10-31 10:37:16 -05:00
|
|
|
void setupBeforeSave() override;
|
|
|
|
|
2018-01-12 04:31:01 -06:00
|
|
|
// Overridden ViewWindow methods:
|
2019-11-01 08:57:07 -05:00
|
|
|
void updateViewWidgetAfterCreation() override;
|
|
|
|
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Timestep Field. Children clamps this differently
|
|
|
|
caf::PdmField<int> m_currentTimeStep;
|
|
|
|
|
|
|
|
// 3D display model data
|
|
|
|
cvf::ref<cvf::ModelBasicList> m_wellPathPipeVizModel;
|
|
|
|
cvf::ref<cvf::ModelBasicList> m_crossSectionVizModel;
|
|
|
|
cvf::ref<RivWellPathsPartMgr> m_wellPathsPartManager;
|
2018-01-12 04:31:01 -06:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
private:
|
2019-09-06 03:40:57 -05:00
|
|
|
void updateMdiWindowTitle() override;
|
|
|
|
void deleteViewWidget() override;
|
|
|
|
QWidget* viewWidget() override;
|
2018-01-12 04:31:01 -06:00
|
|
|
|
2019-10-31 10:37:16 -05:00
|
|
|
// Implementation of RimNameConfigHolderInterface
|
|
|
|
void performAutoNameUpdate() override final;
|
|
|
|
|
2018-01-11 08:44:22 -06:00
|
|
|
// Implementation of RiuViewerToViewInterface
|
2019-10-11 02:47:30 -05:00
|
|
|
|
2019-11-01 08:57:07 -05:00
|
|
|
void setCameraPosition( const cvf::Mat4d& cameraPosition ) override;
|
2019-10-31 09:32:30 -05:00
|
|
|
void setCameraPointOfInterest( const cvf::Vec3d& cameraPointOfInterest ) override;
|
2019-10-11 02:47:30 -05:00
|
|
|
|
2019-11-08 03:39:40 -06:00
|
|
|
void endAnimation() override;
|
2019-10-11 02:47:30 -05:00
|
|
|
|
2019-10-31 09:32:30 -05:00
|
|
|
caf::PdmObjectHandle* implementingPdmObject() override;
|
2019-10-11 02:47:30 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void handleMdiWindowClosed() override;
|
|
|
|
void setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) override;
|
2019-10-11 02:47:30 -05:00
|
|
|
|
|
|
|
// Pure private methods
|
|
|
|
|
|
|
|
void createHighlightAndGridBoxDisplayModel();
|
2019-09-06 03:40:57 -05:00
|
|
|
void appendAnnotationsToModel();
|
|
|
|
void appendMeasurementToModel();
|
2016-12-14 03:35:28 -06:00
|
|
|
|
2019-10-11 02:47:30 -05:00
|
|
|
// Pure private methods : Override viewer and comparison view
|
|
|
|
|
2019-11-04 04:34:34 -06:00
|
|
|
void setOverrideViewer( RiuViewer* overrideViewer );
|
2019-10-11 07:34:59 -05:00
|
|
|
Rim3dView* prepareComparisonView();
|
|
|
|
void restoreComparisonView();
|
2019-10-11 02:47:30 -05:00
|
|
|
|
2015-05-08 07:13:26 -05:00
|
|
|
private:
|
2019-10-11 02:47:30 -05:00
|
|
|
QPointer<RiuViewer> m_viewer;
|
|
|
|
QPointer<RiuViewer> m_overrideViewer;
|
2019-11-01 08:57:07 -05:00
|
|
|
bool m_isCallingUpdateDisplayModelForCurrentTimestepAndRedraw; // To avoid infinite recursion if comparison views are pointing to each other.
|
|
|
|
|
|
|
|
// Fields
|
2019-10-11 02:47:30 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmField<QString> m_name_OBSOLETE;
|
|
|
|
caf::PdmChildField<RimViewNameConfig*> m_nameConfig;
|
|
|
|
caf::PdmField<bool> m_disableLighting;
|
|
|
|
caf::PdmField<cvf::Mat4d> m_cameraPosition;
|
|
|
|
caf::PdmField<cvf::Vec3d> m_cameraPointOfInterest;
|
|
|
|
caf::PdmField<cvf::Color3f> m_backgroundColor;
|
|
|
|
caf::PdmField<bool> m_showGridBox;
|
|
|
|
caf::PdmField<bool> m_showZScaleLabel;
|
2019-10-11 02:47:30 -05:00
|
|
|
caf::PdmPtrField<Rim3dView*> m_comparisonView;
|
2019-11-01 08:57:07 -05:00
|
|
|
|
|
|
|
// 3D display model data
|
|
|
|
cvf::ref<cvf::ModelBasicList> m_highlightVizModel;
|
|
|
|
cvf::ref<RivAnnotationsPartMgr> m_annotationsPartManager;
|
|
|
|
cvf::ref<RivMeasurementPartMgr> m_measurementPartManager;
|
2015-04-29 03:50:25 -05:00
|
|
|
};
|