///////////////////////////////////////////////////////////////////////////////// // // 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 "cafPdmObject.h" #include "cafPdmField.h" #include class QDateTime; class RimEclipseResultCase; class RimGeoMechCase; //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- class RimTimeStepFilter : public caf::PdmObject { CAF_PDM_HEADER_INIT; public: enum TimeStepFilterTypeEnum { TS_ALL, TS_INTERVAL_DAYS, TS_INTERVAL_WEEKS, TS_INTERVAL_MONTHS, TS_INTERVAL_QUARTERS, TS_INTERVAL_YEARS }; public: RimTimeStepFilter(); void clearFilteredTimeSteps(); void setTimeStepsFromFile(const std::vector& timeSteps); void setTimeStepsFromFile(const std::vector>& timeSteps); std::vector filteredTimeSteps() const; bool updateFilteredTimeStepsFromUi(); private: std::vector> allTimeSteps() const; std::vector filteredTimeStepIndicesFromUi() const; void updateFieldVisibility(); RimEclipseResultCase* parentEclipseResultCase() const; RimGeoMechCase* parentGeoMechCase() const; // PDM overrides void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; private: caf::PdmField< caf::AppEnum< TimeStepFilterTypeEnum > > m_filterType; caf::PdmField< std::vector > m_filteredTimeSteps; caf::PdmField< std::vector > m_filteredTimeStepsUi; caf::PdmField m_firstTimeStep; caf::PdmField m_lastTimeStep; caf::PdmField m_interval; caf::PdmField m_applyReloadOfCase; caf::PdmField m_dateFormat; caf::PdmField> m_timeStepNamesFromFile; };