///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) Statoil ASA // Copyright (C) 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 "cvfBase.h" #include "cvfObject.h" #include "cafAppEnum.h" #include "cafPdmField.h" #include "cafPdmObject.h" class RimEclipseView; class RivTernarySaturationOverlayItem; class RivTernaryScalarMapper; namespace cvf { class OverlayItem; } //================================================================================================== /// /// //================================================================================================== class RimTernaryLegendConfig : public caf::PdmObject { CAF_PDM_HEADER_INIT; public: enum TernaryArrayIndex { TERNARY_SOIL_IDX = 0, TERNARY_SGAS_IDX, TERNARY_SWAT_IDX }; enum RangeModeType { AUTOMATIC_ALLTIMESTEPS, AUTOMATIC_CURRENT_TIMESTEP, USER_DEFINED }; typedef caf::AppEnum RangeModeEnum; public: RimTernaryLegendConfig(); virtual ~RimTernaryLegendConfig(); void setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig); void setAutomaticRanges(TernaryArrayIndex ternaryIndex, double globalMin, double globalMax, double localMin, double localMax); void ternaryRanges(double& soilLower, double& soilUpper, double& sgasLower, double& sgasUpper, double& swatLower, double& swatUpper) const; void recreateLegend(); const RivTernarySaturationOverlayItem* legend() const; RivTernarySaturationOverlayItem* legend(); void setTitle(const QString& title); const RivTernaryScalarMapper* scalarMapper() const; protected: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute); private: void updateLegend(); void updateLabelText(); double roundToNumSignificantDigits(double value, double precision); private: caf::PdmField precision; caf::PdmField rangeMode; caf::PdmField userDefinedMaxValueSoil; caf::PdmField userDefinedMinValueSoil; caf::PdmField userDefinedMaxValueSgas; caf::PdmField userDefinedMinValueSgas; caf::PdmField userDefinedMaxValueSwat; caf::PdmField userDefinedMinValueSwat; caf::PdmField applyLocalMinMax; caf::PdmField applyGlobalMinMax; caf::PdmField applyFullRangeMinMax; caf::PdmField ternaryRangeSummary; std::vector m_globalAutoMax; std::vector m_globalAutoMin; std::vector m_localAutoMax; std::vector m_localAutoMin; cvf::ref m_legend; cvf::ref m_scalarMapper; };