2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-23 08:04:57 -05:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2012-05-18 02:45:23 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2012-05-18 02:45:23 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2012-05-18 02:45:23 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
2018-04-18 03:32:51 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RimLegendConfig.h"
|
2020-12-07 02:30:09 -06:00
|
|
|
#include "RimLegendConfigChangeType.h"
|
2018-04-18 03:32:51 -05:00
|
|
|
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "cvfArray.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "cvfObject.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2020-05-22 02:01:08 -05:00
|
|
|
#include "cafPdmPtrField.h"
|
2020-12-07 02:30:09 -06:00
|
|
|
#include "cafSignal.h"
|
2020-05-22 02:01:08 -05:00
|
|
|
|
2017-02-15 08:21:13 -06:00
|
|
|
#include <tuple>
|
|
|
|
|
2013-05-06 03:55:00 -05:00
|
|
|
namespace cvf
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
class ScalarMapperContinuousLog;
|
|
|
|
class ScalarMapperContinuousLinear;
|
|
|
|
class OverlayItem;
|
|
|
|
class ScalarMapperDiscreteLinear;
|
|
|
|
class ScalarMapperDiscreteLog;
|
|
|
|
class ScalarMapper;
|
|
|
|
class String;
|
|
|
|
} // namespace cvf
|
2016-08-02 03:25:55 -05:00
|
|
|
|
|
|
|
namespace caf
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
class TitledOverlayFrame;
|
|
|
|
class CategoryLegend;
|
|
|
|
class CategoryMapper;
|
|
|
|
class OverlayScalarMapperLegend;
|
|
|
|
} // namespace caf
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2018-01-09 03:11:28 -06:00
|
|
|
class Rim3dView;
|
2018-05-04 06:06:48 -05:00
|
|
|
class RimEnsembleCurveSet;
|
2019-12-18 05:25:19 -06:00
|
|
|
class RiuAbstractLegendFrame;
|
2020-05-22 02:01:08 -05:00
|
|
|
class RimColorLegend;
|
2013-05-06 03:55:00 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//==================================================================================================
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
|
|
|
///
|
2012-05-18 02:45:23 -05:00
|
|
|
//==================================================================================================
|
2018-04-18 03:32:51 -05:00
|
|
|
class RimRegularLegendConfig : public RimLegendConfig
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2020-12-04 06:21:19 -06:00
|
|
|
public:
|
2020-12-07 02:30:09 -06:00
|
|
|
caf::Signal<RimLegendConfigChangeType> changed;
|
2020-12-04 06:21:19 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
public:
|
2018-04-18 03:10:39 -05:00
|
|
|
RimRegularLegendConfig();
|
2018-10-18 12:45:57 -05:00
|
|
|
~RimRegularLegendConfig() override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmField<QString> resultVariableName; // Used internally to describe the variable this legend setup is used for
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2020-08-14 03:41:01 -05:00
|
|
|
enum class ColorRangesType
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
NORMAL,
|
|
|
|
OPPOSITE_NORMAL,
|
|
|
|
WHITE_PINK,
|
|
|
|
PINK_WHITE,
|
|
|
|
WHITE_BLACK,
|
2013-09-25 08:43:06 -05:00
|
|
|
BLACK_WHITE,
|
|
|
|
BLUE_WHITE_RED,
|
2016-08-02 03:25:55 -05:00
|
|
|
RED_WHITE_BLUE,
|
2016-10-13 05:13:32 -05:00
|
|
|
CATEGORY,
|
2017-02-20 05:26:36 -06:00
|
|
|
ANGULAR,
|
2020-07-27 07:43:33 -05:00
|
|
|
RAINBOW,
|
2018-05-04 06:06:48 -05:00
|
|
|
STIMPLAN,
|
|
|
|
|
|
|
|
GREEN_RED,
|
|
|
|
BLUE_MAGENTA,
|
|
|
|
RED_LIGHT_DARK,
|
|
|
|
GREEN_LIGHT_DARK,
|
2020-05-22 02:01:08 -05:00
|
|
|
BLUE_LIGHT_DARK,
|
2020-05-28 01:11:37 -05:00
|
|
|
|
|
|
|
CORRELATION,
|
|
|
|
|
2020-05-22 02:01:08 -05:00
|
|
|
UNDEFINED
|
2012-05-18 02:45:23 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef caf::AppEnum<ColorRangesType> ColorRangeEnum;
|
|
|
|
|
2020-08-14 03:41:01 -05:00
|
|
|
enum class MappingType
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
LINEAR_DISCRETE,
|
|
|
|
LINEAR_CONTINUOUS,
|
2012-10-02 03:17:52 -05:00
|
|
|
LOG10_CONTINUOUS,
|
2016-08-02 03:25:55 -05:00
|
|
|
LOG10_DISCRETE,
|
|
|
|
CATEGORY_INTEGER
|
2012-05-18 02:45:23 -05:00
|
|
|
};
|
2020-08-14 03:41:01 -05:00
|
|
|
enum class NumberFormatType
|
2019-09-06 03:40:57 -05:00
|
|
|
{
|
|
|
|
AUTO,
|
|
|
|
SCIENTIFIC,
|
|
|
|
FIXED
|
|
|
|
};
|
2012-05-18 02:45:23 -05:00
|
|
|
typedef caf::AppEnum<MappingType> MappingEnum;
|
2020-09-03 12:00:46 -05:00
|
|
|
|
|
|
|
enum class CategoryColorModeType
|
|
|
|
{
|
|
|
|
INTERPOLATE,
|
2020-09-08 02:29:13 -05:00
|
|
|
EXCLUSIVELY_COLORS
|
2020-09-03 12:00:46 -05:00
|
|
|
};
|
|
|
|
typedef caf::AppEnum<CategoryColorModeType> CategoryColorModeEnum;
|
|
|
|
|
2020-09-14 14:47:48 -05:00
|
|
|
void onRecreateLegend() override;
|
2016-09-06 07:03:02 -05:00
|
|
|
|
2020-05-22 02:01:08 -05:00
|
|
|
void setColorLegend( RimColorLegend* colorLegend );
|
|
|
|
RimColorLegend* colorLegend() const;
|
2020-02-12 04:13:38 -06:00
|
|
|
void setMappingMode( MappingType mappingType );
|
|
|
|
MappingType mappingMode() { return m_mappingMode(); }
|
|
|
|
void setTickNumberFormat( NumberFormatType numberFormat );
|
2020-11-18 07:01:54 -06:00
|
|
|
void resetUserDefinedValues();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
void disableAllTimeStepsRange( bool doDisable );
|
|
|
|
|
|
|
|
void setAutomaticRanges( double globalMin, double globalMax, double localMin, double localMax );
|
|
|
|
void setClosestToZeroValues( double globalPosClosestToZero,
|
|
|
|
double globalNegClosestToZero,
|
|
|
|
double localPosClosestToZero,
|
|
|
|
double localNegClosestToZero );
|
2019-03-04 08:35:48 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void setIntegerCategories( const std::vector<int>& categories );
|
|
|
|
void setNamedCategories( const std::vector<QString>& categoryNames );
|
|
|
|
void setCategoryItems( const std::vector<std::tuple<QString, int, cvf::Color3ub>>& categories );
|
|
|
|
QString categoryNameFromCategoryValue( double categoryResultValue ) const;
|
|
|
|
double categoryValueFromCategoryName( const QString& categoryName ) const;
|
2016-08-02 03:25:55 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void setTitle( const QString& title );
|
2018-02-01 10:45:22 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void setUiValuesFromLegendConfig( const RimRegularLegendConfig* otherLegendConfig );
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2020-02-12 04:13:38 -06:00
|
|
|
cvf::ScalarMapper* scalarMapper() { return m_currentScalarMapper.p(); }
|
|
|
|
const cvf::ScalarMapper* scalarMapper() const { return m_currentScalarMapper.p(); }
|
2019-12-02 08:26:24 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool showLegend() const;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
const caf::TitledOverlayFrame* titledOverlayFrame() const override;
|
|
|
|
caf::TitledOverlayFrame* titledOverlayFrame() override;
|
2019-12-18 05:25:19 -06:00
|
|
|
RiuAbstractLegendFrame* makeLegendFrame();
|
2018-04-18 03:32:51 -05:00
|
|
|
|
2020-11-18 07:01:54 -06:00
|
|
|
void setRangeMode( RangeModeType rangeMode );
|
|
|
|
RangeModeType rangeMode() const;
|
|
|
|
|
2019-09-10 08:21:58 -05:00
|
|
|
static cvf::Color3ubArray colorArrayFromColorType( ColorRangesType colorType );
|
2020-05-22 02:01:08 -05:00
|
|
|
static RimColorLegend* mapToColorLegend( ColorRangesType colorType );
|
2018-11-05 09:13:33 -06:00
|
|
|
|
2020-11-18 07:01:54 -06:00
|
|
|
static double computeTenExponentCeil( double value );
|
|
|
|
static double computeTenExponentFloor( double value );
|
|
|
|
|
2020-05-09 04:23:58 -05:00
|
|
|
void updateFonts() override;
|
|
|
|
|
2020-11-30 09:06:44 -06:00
|
|
|
QString valueToText( double value ) const;
|
|
|
|
static QString valueToText( double value, NumberFormatType numberFormat, int precision );
|
|
|
|
|
2018-04-19 01:01:37 -05:00
|
|
|
private:
|
2020-02-12 04:43:15 -06:00
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
2020-12-07 02:30:09 -06:00
|
|
|
void sendChangedSignal( const caf::PdmFieldHandle* changedField );
|
2019-09-06 03:40:57 -05:00
|
|
|
void initAfterRead() override;
|
|
|
|
caf::PdmFieldHandle* objectToggleField() override;
|
2020-11-18 07:01:54 -06:00
|
|
|
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
|
|
|
QString uiConfigName,
|
|
|
|
caf::PdmUiEditorAttribute* attribute ) override;
|
2017-02-17 02:28:46 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
|
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
|
|
bool* useOptionsOnly ) override;
|
2016-08-02 03:25:55 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void updateLegend();
|
|
|
|
void updateFieldVisibility();
|
|
|
|
double roundToNumSignificantDigits( double value, double precision );
|
2013-09-26 03:44:20 -05:00
|
|
|
|
2020-06-30 10:10:51 -05:00
|
|
|
void updateCategoryItems();
|
2020-09-03 12:00:46 -05:00
|
|
|
void configureCategoryMapper();
|
2020-06-30 10:10:51 -05:00
|
|
|
|
2016-12-09 13:36:31 -06:00
|
|
|
friend class RimViewLinker;
|
2013-09-26 03:44:20 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
private:
|
2012-10-02 03:17:52 -05:00
|
|
|
cvf::ref<cvf::ScalarMapperDiscreteLinear> m_linDiscreteScalarMapper;
|
2013-02-26 05:45:41 -06:00
|
|
|
cvf::ref<cvf::ScalarMapperDiscreteLog> m_logDiscreteScalarMapper;
|
2012-05-18 02:45:23 -05:00
|
|
|
cvf::ref<cvf::ScalarMapperContinuousLog> m_logSmoothScalarMapper;
|
|
|
|
cvf::ref<cvf::ScalarMapperContinuousLinear> m_linSmoothScalarMapper;
|
2012-10-02 03:17:52 -05:00
|
|
|
cvf::ref<cvf::ScalarMapper> m_currentScalarMapper;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
cvf::ref<caf::OverlayScalarMapperLegend> m_scalarMapperLegend;
|
|
|
|
|
|
|
|
cvf::ref<caf::CategoryMapper> m_categoryMapper;
|
|
|
|
cvf::ref<caf::CategoryLegend> m_categoryLegend;
|
|
|
|
|
|
|
|
double m_globalAutoMax;
|
|
|
|
double m_globalAutoMin;
|
|
|
|
double m_localAutoMax;
|
|
|
|
double m_localAutoMin;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
double m_globalAutoPosClosestToZero;
|
|
|
|
double m_globalAutoNegClosestToZero;
|
|
|
|
double m_localAutoPosClosestToZero;
|
|
|
|
double m_localAutoNegClosestToZero;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool m_isAllTimeStepsRangeDisabled;
|
2013-06-03 06:08:11 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<int> m_categories;
|
|
|
|
std::vector<cvf::String> m_categoryNames;
|
|
|
|
cvf::Color3ubArray m_categoryColors;
|
2016-08-02 03:25:55 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
// Fields
|
2020-09-03 12:00:46 -05:00
|
|
|
caf::PdmField<bool> m_showLegend;
|
|
|
|
caf::PdmField<int> m_numLevels;
|
|
|
|
caf::PdmField<int> m_precision;
|
|
|
|
caf::PdmField<caf::AppEnum<NumberFormatType>> m_tickNumberFormat;
|
|
|
|
caf::PdmField<RangeModeEnum> m_rangeMode;
|
|
|
|
caf::PdmField<double> m_userDefinedMaxValue;
|
|
|
|
caf::PdmField<double> m_userDefinedMinValue;
|
|
|
|
caf::PdmField<caf::AppEnum<ColorRangesType>> m_colorRangeMode_OBSOLETE;
|
|
|
|
caf::PdmField<caf::AppEnum<MappingType>> m_mappingMode;
|
|
|
|
caf::PdmField<caf::AppEnum<CategoryColorModeType>> m_categoryColorMode;
|
2020-11-18 07:01:54 -06:00
|
|
|
caf::PdmField<bool> m_resetUserDefinedValuesButton;
|
2020-09-03 12:00:46 -05:00
|
|
|
|
|
|
|
caf::PdmPtrField<RimColorLegend*> m_colorLegend;
|
2020-09-07 11:18:31 -05:00
|
|
|
caf::PdmField<bool> m_selectColorLegendButton;
|
2019-12-18 05:25:19 -06:00
|
|
|
|
2020-11-18 07:01:54 -06:00
|
|
|
bool m_resetUserDefinedValues;
|
|
|
|
|
2019-12-18 05:25:19 -06:00
|
|
|
QString m_title;
|
|
|
|
int m_significantDigitsInData;
|
2012-05-18 02:45:23 -05:00
|
|
|
};
|