///////////////////////////////////////////////////////////////////////////////// // // 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 "RifEclipseSummaryAddress.h" #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPtrArrayField.h" #include "cafPdmPtrField.h" #include #define OBSERVED_DATA_AVALUE_POSTFIX "_OBSDATA" class RimSummaryCase; class RimSummaryCaseCollection; class RimSummaryCurveAutoName; class RimSummaryPlot; class RiaSummaryCurveDefinition; class RiaCurveSetDefinition; class SummaryIdentifierAndField; using SummarySource = caf::PdmObject; //================================================================================================== /// /// //================================================================================================== class RiuSummaryCurveDefSelection : public caf::PdmObject { CAF_PDM_HEADER_INIT; public: RiuSummaryCurveDefSelection(); ~RiuSummaryCurveDefSelection() override; void setSelectedCurveDefinitions(const std::vector& curveDefinitions); std::vector allCurveDefinitionsFromSelection() const; std::vector allCurveSetDefinitionsFromSelections() const; std::vector selection() const; void setMultiSelectionMode(bool multiSelectionMode); void hideEnsembles(bool hide); void hideSummaryCases(bool hide); void setFieldChangedHandler(const std::function& handlerFunc); void setDefaultSelection(const std::vector& defaultCases); private: void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; std::set findPossibleSummaryAddresses(const std::vector &selectedSources, const SummaryIdentifierAndField *identifierAndField); std::set findPossibleSummaryAddressesFromSelectedCases(const SummaryIdentifierAndField *identifierAndField); std::set findPossibleSummaryAddressesFromSelectedObservedData(const SummaryIdentifierAndField *identifierAndField); std::set findPossibleSummaryAddressesFromCalculated(); std::vector buildControllingFieldList(const SummaryIdentifierAndField *identifierAndField) const; SummaryIdentifierAndField* lookupIdentifierAndFieldFromFieldHandle(const caf::PdmFieldHandle* pdmFieldHandle) const; SummaryIdentifierAndField* lookupControllingField(const SummaryIdentifierAndField *dependentField) const; bool isAddressCompatibleWithControllingFieldSelection(const RifEclipseSummaryAddress &address, const std::vector& identifierAndFieldList) const; std::set buildAddressListFromSelections() const; void buildAddressListForCategoryRecursively(RifEclipseSummaryAddress::SummaryVarCategory category, std::vector::const_iterator identifierAndFieldItr, std::vector>& identifierPath, std::set& addressSet) const; void resetAllFields(); bool isObservedData(const RimSummaryCase *sumCase) const; std::vector selectedSummarySources() const; static RimSummaryCase* calculatedSummaryCase(); private: caf::PdmPtrArrayField m_selectedSources; caf::PdmField>> m_selectedSummaryCategories; caf::PdmField> m_currentSummaryCategory; std::map> m_identifierFieldsMap; bool m_multiSelectionMode; bool m_hideEnsembles; bool m_hideSummaryCases; std::function m_toggleChangedHandler; size_t m_prevCurveCount; size_t m_prevCurveSetCount; };