///////////////////////////////////////////////////////////////////////////////// // // 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 "RimWellLogPlot.h" #include "RifDataSourceForRftPltQMetaType.h" #include "cafSelectionChangedReceiver.h" #include "RiuPlotCurveSymbol.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPointer.h" #include "cafPdmPtrField.h" #include #include #include #include #include #include class RimEclipseCase; class RimEclipseResultCase; class RimRegularLegendConfig; class RimWellLogCurve; class RimWellLogChannel; class RimWellPath; class RimWellPathCollection; class RiuWellRftPlot; class RigEclipseCaseData; class RiaRftPltCurveDefinition; class RifDataSourceForRftPlt; class RifEclipseRftAddress; class RiuDraggableOverlayFrame; class RimDataSourceForRftPlt; class RimSummaryCase; class RiuPlotCurve; class RiuPlotItem; class RimWellRftEnsembleCurveSet; namespace cvf { class Color3f; } namespace caf { class PdmOptionItemInfo; } //================================================================================================== /// /// //================================================================================================== class RimWellRftPlot : public RimWellLogPlot, public caf::SelectionChangedReceiver { CAF_PDM_HEADER_INIT; static const std::set PRESSURE_DATA_NAMES; static const char PLOT_NAME_QFORMAT_STRING[]; public: RimWellRftPlot(); ~RimWellRftPlot() override; const QString& simWellOrWellPathName() const; void setSimWellOrWellPathName( const QString& currWellName ); int branchIndex() const; // The monostate is used to indicate that no data source is selected std::variant dataSource() const; static const char* plotNameFormatString(); void deleteCurvesAssosicatedWithObservedData( const RimObservedFmuRftData* observedFmuRftData ); bool showErrorBarsForObservedData() const; void onLegendDefinitionChanged(); RimWellRftEnsembleCurveSet* findEnsembleCurveSet( RimSummaryEnsemble* ensemble ) const; void rebuildCurves(); void initializeDataSources( RimWellRftPlot* source ); std::vector selectedTimeSteps() const; void setSelectedTimeSteps( const std::vector& timeSteps ); // Called by owning composite plots before the underlying QwtPlot is destroyed // so that legend curve raw pointers are cleaned up before QwtPlot auto-deletes them. void cleanupLegendCurves(); std::vector selectedEnsembles() const; void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override; private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; QList calculateValueOptionsForSources() const; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void onLoadDataAndUpdate() override; void setupBeforeSave() override; void initAfterRead() override; bool useUndoRedoForFieldChanged() override; void deleteViewWidget() override; std::map findWellSources(); void updateEditorsFromPreviousSelection(); void setSelectedSourcesFromCurves(); void syncCurvesFromUiSelection(); void assignWellPathToExtractionCurves(); void syncSourcesIoFieldFromGuiField(); RimObservedFmuRftData* findObservedFmuData( const QString& wellPathName, const QDateTime& timeStep ) const; std::set selectedCurveDefs() const; std::set curveDefsFromCurves() const; void setOrInitializeDataSources( const std::vector& sourcesToSelect ); void updateCurvesInPlot( const std::set& allCurveDefs, const std::set& curveDefsToAdd, const std::set& curvesToDelete ); std::vector selectedSourcesExpanded() const; // RimViewWindow overrides void applyCurveAppearance( RimWellLogCurve* curve ); void applyCurveColor( RimWellLogCurve* curve ); void onSelectionManagerSelectionChanged( const std::set& changedSelectionLevels ) override; RimWellRftEnsembleCurveSet* selectedEnsembleCurveSet() const; void onLegendItemClicked( std::shared_ptr plotItem, bool toggle, int sampleIndex ); RimSummaryCase* findClosestRealization( const QPoint& canvasPos ); void highlightSelectedRealization(); void updateFormationsOnPlot() const; QString associatedSimWellName() const; static RiuPlotCurveSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address ); static RiuPlotCurveSymbol::LabelPosition statisticsLabelPosFromAddress( const RifEclipseRftAddress& address ); cvf::Color3f findCurveColor( RimWellLogCurve* curve ); void defineCurveColorsAndSymbols( const std::set& allCurveDefs ); void createEnsembleCurveSets(); void detachAndDeleteLegendCurves(); private: friend class RimWellRftEnsembleCurveSet; caf::PdmField m_wellPathNameOrSimWellName; caf::PdmField m_branchIndex; caf::PdmField m_branchDetection; caf::PdmField m_showStatisticsCurves; caf::PdmField m_showEnsembleCurves; caf::PdmField m_showErrorInObservedData; caf::PdmField> m_selectedSources; caf::PdmChildArrayField m_selectedSourcesForIo; caf::PdmField> m_selectedTimeSteps; caf::PdmChildArrayField m_ensembleCurveSets; caf::PdmPtrField m_ensembleCurveSetEclipseCase; std::map> m_ensembleLegendFrames; std::map m_dataSourceColors; std::map m_timeStepSymbols; bool m_isOnLoad; std::vector m_legendPlotCurves; std::map m_legendCurveToEnsembleCurveSet; QMetaObject::Connection m_legendClickedConnection; RimWellRftEnsembleCurveSet* m_highlightedCurveSet = nullptr; caf::PdmPointer m_selectedRealization; caf::PdmChildField m_wellLogPlot_OBSOLETE; bool m_isInitialized = false; };