///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RimViewWindow.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPtrField.h" #include "cvfCollection.h" #include "RimWellRftAddress.h" #include "RimPlotCurve.h" #include #include #include #include #include class RimEclipseCase; class RimEclipseResultCase; class RimWellLogCurve; class RimWellLogFileChannel; class RimWellLogPlot; class RimWellPath; class RiuWellRftPlot; namespace cvf { class Color3f; } namespace caf { class PdmOptionItemInfo; } //================================================================================================== /// /// //================================================================================================== class RimWellRftPlot : public RimViewWindow { CAF_PDM_HEADER_INIT; static const char PRESSURE_DATA_NAME[]; static const char PLOT_NAME_QFORMAT_STRING[]; public: RimWellRftPlot(); virtual ~RimWellRftPlot(); void setDescription(const QString& description); QString description() const; virtual void loadDataAndUpdate() override; virtual QWidget* viewWidget() override; virtual void zoomAll() override; RimWellLogPlot* wellLogPlot() const; void setCurrentWellName(const QString& currWellName); QString currentWellName() const; static bool hasPressureData(RimWellLogFile* wellLogFile); static bool hasPressureData(RimWellLogFileChannel* channel); static bool hasPressureData(RimEclipseResultCase* gridCase); static const char* plotNameFormatString(); void applyInitialSelections(); protected: // Overridden PDM methods virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; } virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; virtual QImage snapshotWindowContent() override; virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; private: void addTimeStepToMap(std::map>& destMap, const std::pair>& timeStepToAdd); void addTimeStepsToMap(std::map>& destMap, const std::map>& timeStepsToAdd); void calculateValueOptionsForWells(QList& options); void calculateValueOptionsForTimeSteps(const QString& wellName, QList& options); void updateEditorsFromCurves(); void updateWidgetTitleWindowTitle(); void syncCurvesFromUiSelection(); std::vector wellPathsContainingPressure(const QString& wellName) const; std::vector getPressureChannelsFromWellPath(const RimWellPath* wellPath) const; RimEclipseCase* eclipseCaseFromCaseId(int caseId); RimWellPath* wellPathForObservedData(const QString& wellName, const QDateTime& date) const; std::vector> eclipseCasesForWell(const QString& wellName) const; std::vector gridCasesFromEclipseCases(const std::vector>& eclipseCasesTuple) const; std::vector rftCasesFromEclipseCases(const std::vector>& eclipseCasesTuple) const; std::map> timeStepsFromRftCase(RimEclipseResultCase* gridCase) const; std::map> timeStepsFromGridCase(const RimEclipseCase* gridCase) const; std::map> timeStepsFromWellPaths(const std::vector wellPaths) const; std::map> adjacentTimeSteps(const std::vector>>& allTimeSteps, const std::pair>& searchTimeStepPair); static bool mapContainsTimeStep(const std::map>& map, const QDateTime& timeStep); std::set> selectedCurveDefs() const; std::set> curveDefsFromCurves() const; std::pair curveDefFromCurve(const RimWellLogCurve* curve) const; void updateCurvesInPlot(const std::set>& allCurveDefs, const std::set>& curveDefsToAdd, const std::set& curvesToDelete); bool isOnlyGridSourcesSelected() const; bool isAnySourceAddressSelected(const std::set& addresses) const; // RimViewWindow overrides virtual QWidget* createViewWidget(QWidget* mainWindowParent) override; virtual void deleteViewWidget() override; void applyCurveAppearance(RimWellLogCurve* newCurve); void updateSelectedTimeStepsFromSelectedSources(); private: caf::PdmField m_showPlotTitle; caf::PdmField m_userName; caf::PdmField m_wellName; caf::PdmField m_branchIndex; caf::PdmField> m_selectedSources; caf::PdmField> m_selectedTimeSteps; QPointer m_wellLogPlotWidget; caf::PdmChildField m_wellLogPlot; std::map> m_timeStepsToAddresses; };