///////////////////////////////////////////////////////////////////////////////// // // 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 "cafPdmObject.h" #include "cafPdmField.h" #include "cafPdmChildArrayField.h" #include "cafPdmPtrField.h" #include #include #include #include class RigWellPath; class RimCase; class RimWellPathAttributeCollection; class RimWellFlowRateCurve; class RimWellLogCurve; class RimWellPath; class RiuPlotAnnotationTool; class RiuWellPathComponentPlotItem; class RiuWellLogTrack; class RigEclipseWellLogExtractor; class RimWellLogPlotCollection; class RigGeoMechWellLogExtractor; class RigResultAccessor; class RigFemResultAddress; class QwtPlotCurve; struct CurveSamplingPointData { std::vector data; std::vector md; std::vector tvd; }; //================================================================================================== /// /// //================================================================================================== class RimWellLogTrack : public caf::PdmObject { CAF_PDM_HEADER_INIT; public: RimWellLogTrack(); ~RimWellLogTrack() override; enum TrajectoryType { WELL_PATH, SIMULATION_WELL }; enum FormationSource { CASE, WELL_PICK_FILTER }; enum WidthScaleFactor { EXTRA_NARROW_TRACK = 2, NARROW_TRACK = 3, NORMAL_TRACK = 4, WIDE_TRACK = 6, EXTRA_WIDE_TRACK = 10 }; void setDescription(const QString& description); bool isVisible(); void addCurve(RimWellLogCurve* curve); void insertCurve(RimWellLogCurve* curve, size_t index); void takeOutCurve(RimWellLogCurve* curve); void deleteAllCurves(); size_t curveIndex(RimWellLogCurve* curve); size_t curveCount() { return curves.size(); } void setXAxisTitle(const QString& text); QString depthPlotTitle() const; int widthScaleFactor() const; void setWidthScaleFactor(WidthScaleFactor scaleFactor); void setFormationWellPath(RimWellPath* wellPath); RimWellPath* formationWellPath() const; void setFormationSimWellName(const QString& simWellName); void setFormationBranchIndex(int branchIndex); void setFormationCase(RimCase* rimCase); void setFormationTrajectoryType(TrajectoryType trajectoryType); RimCase* formationNamesCase() const; void recreateViewer(); void detachAllCurves(); void reattachAllCurves(); void loadDataAndUpdate(bool updateParentPlotAndToolbars = false); 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); void availableDepthRange(double* minimumDepth, double* maximumDepth); void updateParentPlotZoom(); void calculateXZoomRangeAndUpdateQwt(); void applyXZoomFromVisibleRange(); void calculateXZoomRange(); void updateEditors(); void setVisibleXRange(double minValue, double maxValue); void setTickIntervals(double majorTickInterval, double minorTickInterval); void setXAxisGridVisibility(RimWellLogPlot::AxisGridVisibility gridLines); void setShowFormations(bool on); bool showFormations() const; void setShowFormationLabels(bool on); bool showWellPathAttributes() const; void setShowWellPathAttributes(bool on); void setWellPathAttributesSource(RimWellPath* wellPath); RimWellPath* wellPathAttributeSource() const; RiuWellLogTrack* viewer(); RimWellLogCurve* curveDefinitionFromCurve(const QwtPlotCurve* curve) const; void setLogarithmicScale(bool enable); std::map> visibleStackedCurves(); QString description(); std::vector curvesVector(); void uiOrderingForRftPltFormations(caf::PdmUiOrdering& uiOrdering); void uiOrderingForXAxisSettings(caf::PdmUiOrdering& uiOrdering); void setFormationsForCaseWithSimWellOnly(bool caseWithSimWellOnly); void updateAxisAndGridTickIntervals(); void updateAllLegendItems(); private: void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void updateParentPlotLayout(); QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; caf::PdmFieldHandle* objectToggleField() override; caf::PdmFieldHandle* userDescriptionField() override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void computeAndSetXRangeMinForLogarithmicScale(); static void simWellOptionItems(QList* options, RimCase* eclCase); static RigEclipseWellLogExtractor* createSimWellExtractor(RimWellLogPlotCollection* wellLogCollection, RimCase* rimCase, const QString& simWellName, int branchIndex, bool useBranchDetection); static CurveSamplingPointData curveSamplingPointData(RigEclipseWellLogExtractor* extractor, RigResultAccessor* resultAccessor); static CurveSamplingPointData curveSamplingPointData(RigGeoMechWellLogExtractor* extractor, const RigFemResultAddress& resultAddress); static void findFormationNamesToPlot(const CurveSamplingPointData& curveData, const std::vector& formationNamesVector, RimWellLogPlot::DepthTypeEnum depthType, std::vector* formationNamesToPlot, std::vector>* yValues); static std::vector formationNamesVector(RimCase* rimCase); void setFormationFieldsUiReadOnly(bool readOnly = true); void updateFormationNamesOnPlot(); void updateWellPathAttributesOnPlot(); void removeFormationNames(); void updateAxisScaleEngine(); bool isFirstVisibleTrackInPlot() const; std::pair adjustXRange(double minValue, double maxValue, double tickInterval); void updateWellPathAttributesCollection(); private: QString m_xAxisTitle; caf::PdmField m_show; caf::PdmField m_userName; caf::PdmChildArrayField curves; caf::PdmField m_visibleXRangeMin; caf::PdmField m_visibleXRangeMax; 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_showFormations; caf::PdmField m_showFormationLabels; 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_widthScaleFactor; 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; std::vector> m_wellPathAttributePlotObjects; bool m_formationsForCaseWithSimWellOnly; QPointer m_wellLogTrackPlotWidget; std::unique_ptr m_annotationTool; };