///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RimWellLogPlot.h" #include "RigWellPathFormations.h" #include "RiuPlotAnnotationTool.h" #include "RimPlot.h" #include "RimRegularLegendConfig.h" #include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPtrField.h" #include "qwt_plot.h" #include #include #include #include class RigWellPath; class RimCase; class RimWellPathAttributeCollection; class RimWellFlowRateCurve; class RimWellLogCurve; class RimWellPath; class RimDepthTrackPlot; class RiuWellPathComponentPlotItem; class RiuWellLogTrack; class RigEclipseWellLogExtractor; class RimWellLogPlotCollection; class RigGeoMechWellLogExtractor; class RigResultAccessor; class RigFemResultAddress; class RigWellLogExtractor; class RimEclipseResultDefinition; class RimColorLegend; class QwtPlotCurve; struct CurveSamplingPointData { std::vector data; std::vector md; std::vector tvd; double rkbDiff; }; //================================================================================================== /// /// //================================================================================================== class RimWellLogTrack : public RimPlot { CAF_PDM_HEADER_INIT; public: enum TrajectoryType { WELL_PATH, SIMULATION_WELL }; enum FormationSource { CASE, WELL_PICK_FILTER }; using RegionAnnotationTypeEnum = caf::AppEnum; using RegionAnnotationDisplayEnum = caf::AppEnum; public: RimWellLogTrack(); ~RimWellLogTrack() override; QWidget* viewWidget() override; RiuQwtPlotWidget* viewer() override; QImage snapshotWindowContent() override; void zoomAll() override; QString description() const override; void setDescription( const QString& description ); void addCurve( RimWellLogCurve* curve ); void insertCurve( RimWellLogCurve* curve, size_t index ); void removeCurve( RimWellLogCurve* curve ); void deleteAllCurves(); size_t curveIndex( RimWellLogCurve* curve ); size_t curveCount() { return m_curves.size(); } void setXAxisTitle( const QString& text ); QString yAxisTitle() const; void setFormationWellPath( RimWellPath* wellPath ); RimWellPath* formationWellPath() const; void setFormationSimWellName( const QString& simWellName ); QString formationSimWellName() const; void setFormationBranchDetection( bool branchDetection ); bool formationBranchDetection() const; void setFormationBranchIndex( int branchIndex ); int formationBranchIndex() const; void setFormationCase( RimCase* rimCase ); RimCase* formationNamesCase() const; void setFormationTrajectoryType( TrajectoryType trajectoryType ); TrajectoryType formationTrajectoryType() const; void setRegionPropertyResultType( RiaDefines::ResultCatType resultCatType, const QString& resultVariable ); void detachAllCurves() override; void reattachAllCurves() override; void setAndUpdateWellPathFormationNamesData( RimCase* rimCase, RimWellPath* wellPath ); void setAndUpdateSimWellFormationNamesAndBranchData( RimCase* rimCase, const QString& simWellName, int branchIndex, bool useBranchDetection ); void setAndUpdateSimWellFormationNamesData( RimCase* rimCase, const QString& simWellName ); void setAutoScaleXEnabled( bool enabled ) override; void setAutoScaleYEnabled( bool enabled ) override; void setAutoScaleXIfNecessary(); void availableXAxisRange( double* minX, double* maxX ); void availableDepthRange( double* minimumDepth, double* maximumDepth ); void visibleXAxisRange( double* minX, double* maxX ); void visibleDepthRange( double* minimumDepth, double* maximumDepth ); void setVisibleXRange( double minValue, double maxValue ); void setVisibleYRange( double minValue, double maxValue ); void updateZoomInQwt() override; void updateZoomFromQwt() override; void updateParentPlotZoom(); void updateEditors(); void setTickIntervals( double majorTickInterval, double minorTickInterval ); void setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines ); void setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType annotationType ); void setAnnotationDisplay( RiuPlotAnnotationTool::RegionDisplay annotationDisplay ); void setAnnotationTransparency( int percent ); void setColorShadingLegend( RimColorLegend* colorLegend ); RiuPlotAnnotationTool::RegionAnnotationType annotationType() const; RiuPlotAnnotationTool::RegionDisplay annotationDisplay() const; bool showFormations() const; void setShowRegionLabels( bool on ); bool showWellPathAttributes() const; void setShowWellPathAttributes( bool on ); void setShowWellPathAttributesInLegend( bool on ); void setShowWellPathCompletionsInLegend( bool on ); void setShowBothSidesOfWell( bool on ); void setWellPathAttributesSource( RimWellPath* wellPath ); void setOverburdenHeight( double overburdenHeight ); void setUnderburdenHeight( double underburdenHeight ); RimWellPath* wellPathAttributeSource() const; caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; void setLogarithmicScale( bool enable ); bool isLogarithmicScale() const; std::map> visibleStackedCurves(); std::vector curves() const; std::vector visibleCurves() const; void uiOrderingForRftPltFormations( caf::PdmUiOrdering& uiOrdering ); void uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering ); void setFormationsForCaseWithSimWellOnly( bool caseWithSimWellOnly ); void updateXAxisAndGridTickIntervals(); void updateLegend() override; QString asciiDataForPlotExport() const override; void onAxisSelected( int axis, bool toggle ) override; void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) override; void updateAxes() override; static CurveSamplingPointData curveSamplingPointData( RigEclipseWellLogExtractor* extractor, RigResultAccessor* resultAccessor ); static CurveSamplingPointData curveSamplingPointData( RigGeoMechWellLogExtractor* extractor, const RigFemResultAddress& resultAddress ); static void findRegionNamesToPlot( const CurveSamplingPointData& curveData, const std::vector& formationNamesVector, RimWellLogPlot::DepthTypeEnum depthType, std::vector* formationNamesToPlot, std::vector>* yValues ); static std::vector formationNamesVector( RimCase* rimCase ); void updateStackedCurveData(); static void addOverburden( std::vector& namesVector, CurveSamplingPointData& curveData, double height ); static void addUnderburden( std::vector& namesVector, CurveSamplingPointData& curveData, double height ); protected: // RimViewWindow overrides void deleteViewWidget() override; void onLoadDataAndUpdate() override; private: RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; void cleanupBeforeClose(); void detachAllPlotItems(); void calculateXZoomRange(); void calculateYZoomRange(); void updateXZoom(); void updateYZoom(); int axisFontSize() const; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void curveDataChanged( const caf::SignalEmitter* emitter ); void curveVisibilityChanged( const caf::SignalEmitter* emitter, bool visible ); void curveAppearanceChanged( const caf::SignalEmitter* emitter ); void curveStackingChanged( const caf::SignalEmitter* emitter, bool stacked ); QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void initAfterRead() override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; caf::PdmFieldHandle* userDescriptionField() override; void computeAndSetXRangeMinForLogarithmicScale(); static void simWellOptionItems( QList* options, RimCase* eclCase ); static RigEclipseWellLogExtractor* createSimWellExtractor( RimWellLogPlotCollection* wellLogCollection, RimCase* rimCase, const QString& simWellName, int branchIndex, bool useBranchDetection ); void setFormationFieldsUiReadOnly( bool readOnly = true ); void updateRegionAnnotationsOnPlot(); void updateFormationNamesOnPlot(); void updateResultPropertyNamesOnPlot(); void updateCurveDataRegionsOnPlot(); void updateWellPathAttributesOnPlot(); void removeRegionAnnotations(); void updateAxisScaleEngine(); std::pair adjustXRange( double minValue, double maxValue, double tickInterval ); void updateWellPathAttributesCollection(); RimDepthTrackPlot* parentWellLogPlot() const; void handleWheelEvent( QWheelEvent* event ) override; void doUpdateLayout() override; std::vector> waterAndRockRegions( RiaDefines::DepthTypeEnum depthType, const RigGeoMechWellLogExtractor* extractor ) const; void connectCurveSignals( RimWellLogCurve* curve ); private: QString m_xAxisTitle; caf::PdmField m_description; caf::PdmChildArrayField m_curves; caf::PdmField m_visibleXRangeMin; caf::PdmField m_visibleXRangeMax; caf::PdmField m_visibleDepthRangeMin; caf::PdmField m_visibleDepthRangeMax; caf::PdmField m_isAutoScaleXEnabled; caf::PdmField m_isLogarithmicScaleEnabled; caf::PdmField m_xAxisGridVisibility; caf::PdmField m_explicitTickIntervals; caf::PdmField m_majorTickInterval; caf::PdmField m_minorTickInterval; caf::PdmField m_axisFontSize; caf::PdmField m_regionAnnotationType; caf::PdmField m_regionAnnotationDisplay; caf::PdmPtrField m_colorShadingLegend; caf::PdmField m_colorShadingTransparency; caf::PdmField m_showRegionLabels; caf::PdmField> m_formationSource; caf::PdmPtrField m_formationCase; caf::PdmField> m_formationTrajectoryType; caf::PdmPtrField m_formationWellPathForSourceCase; caf::PdmPtrField m_formationWellPathForSourceWellPath; caf::PdmField m_formationSimWellName; caf::PdmField m_formationBranchIndex; caf::PdmField> m_formationLevel; caf::PdmField m_showformationFluids; caf::PdmField m_formationBranchDetection; caf::PdmField m_showWellPathAttributes; caf::PdmField m_showWellPathCompletions; caf::PdmField m_showWellPathComponentsBothSides; caf::PdmField m_showWellPathComponentLabels; caf::PdmField m_wellPathAttributesInLegend; caf::PdmField m_wellPathCompletionsInLegend; caf::PdmPtrField m_wellPathComponentSource; caf::PdmPtrField m_wellPathAttributeCollection; caf::PdmChildField m_resultDefinition; caf::PdmField m_overburdenHeight; caf::PdmField m_underburdenHeight; caf::PdmField m_showFormations_OBSOLETE; caf::PdmField m_show_OBSOLETE; caf::PdmField m_colorShadingPalette_OBSOLETE; std::vector> m_wellPathAttributePlotObjects; bool m_formationsForCaseWithSimWellOnly; QPointer m_plotWidget; std::unique_ptr m_annotationTool; double m_availableXRangeMin; double m_availableXRangeMax; double m_availableDepthRangeMin; double m_availableDepthRangeMax; };