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
|
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.
|
|
|
|
//
|
|
|
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "cvfBase.h"
|
|
|
|
#include "cvfObject.h"
|
|
|
|
#include "cvfArray.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
#include "cafPdmField.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
|
|
|
|
namespace cvf
|
|
|
|
{
|
|
|
|
class ScalarMapperContinuousLog;
|
|
|
|
class ScalarMapperContinuousLinear;
|
2016-08-01 15:27:03 -05:00
|
|
|
class OverlayItem;
|
2013-05-06 03:55:00 -05:00
|
|
|
class OverlayScalarMapperLegend;
|
|
|
|
class ScalarMapperDiscreteLinear;
|
|
|
|
class ScalarMapperDiscreteLog;
|
|
|
|
class ScalarMapper;
|
2016-08-02 03:25:55 -05:00
|
|
|
class String;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace caf
|
|
|
|
{
|
|
|
|
class CategoryLegend;
|
|
|
|
class CategoryMapper;
|
2013-05-06 03:55:00 -05:00
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2015-04-29 15:19:49 -05:00
|
|
|
class RimView;
|
2013-05-06 03:55:00 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
class RimLegendConfig: public caf::PdmObject
|
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
|
|
RimLegendConfig();
|
|
|
|
virtual ~RimLegendConfig();
|
|
|
|
|
2015-04-29 15:19:49 -05:00
|
|
|
void setReservoirView(RimView* ownerReservoirView) {m_reservoirView = ownerReservoirView; }
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
caf::PdmField<QString> resultVariableName; // Used internally to describe the variable this legend setup is used for
|
|
|
|
|
2014-04-25 09:32:06 -05:00
|
|
|
enum RangeModeType
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
AUTOMATIC_ALLTIMESTEPS,
|
|
|
|
AUTOMATIC_CURRENT_TIMESTEP,
|
|
|
|
USER_DEFINED
|
|
|
|
};
|
2014-04-25 09:32:06 -05:00
|
|
|
|
|
|
|
typedef caf::AppEnum<RangeModeType> RangeModeEnum;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
enum ColorRangesType
|
|
|
|
{
|
|
|
|
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,
|
|
|
|
CATEGORY
|
2012-05-18 02:45:23 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef caf::AppEnum<ColorRangesType> ColorRangeEnum;
|
|
|
|
|
|
|
|
enum MappingType
|
|
|
|
{
|
|
|
|
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
|
|
|
};
|
2013-04-30 07:48:53 -05:00
|
|
|
enum NumberFormatType { AUTO, SCIENTIFIC, FIXED};
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
typedef caf::AppEnum<MappingType> MappingEnum;
|
|
|
|
void recreateLegend();
|
|
|
|
void setColorRangeMode(ColorRangesType colorMode);
|
|
|
|
void setAutomaticRanges(double globalMin, double globalMax, double localMin, double localMax);
|
2013-06-03 06:08:11 -05:00
|
|
|
void setClosestToZeroValues(double globalPosClosestToZero, double globalNegClosestToZero, double localPosClosestToZero, double localNegClosestToZero);
|
2016-08-02 03:25:55 -05:00
|
|
|
void setCategories(const std::set<int>& globalCategories, const std::set<int>& localCategories);
|
|
|
|
|
|
|
|
void setTitle(const cvf::String& title);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
cvf::ScalarMapper* scalarMapper() { return m_currentScalarMapper.p(); }
|
2016-08-01 15:27:03 -05:00
|
|
|
cvf::OverlayItem* legend();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2014-04-14 01:04:09 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
protected:
|
|
|
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
|
|
|
virtual void initAfterRead();
|
2013-09-26 03:44:20 -05:00
|
|
|
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
|
2016-08-02 03:25:55 -05:00
|
|
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
private:
|
2013-09-30 06:29:29 -05:00
|
|
|
void updateLegend();
|
2012-05-18 02:45:23 -05:00
|
|
|
void updateFieldVisibility();
|
|
|
|
cvf::ref<cvf::Color3ubArray> interpolateColorArray(const cvf::Color3ubArray& colorArray, cvf::uint targetColorCount);
|
2013-09-25 18:05:09 -05:00
|
|
|
double roundToNumSignificantDigits(double value, double precision);
|
2013-09-26 03:44:20 -05:00
|
|
|
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
private:
|
2015-04-29 15:19:49 -05:00
|
|
|
caf::PdmPointer<RimView> m_reservoirView;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
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
|
|
|
|
2016-08-01 15:27:03 -05:00
|
|
|
cvf::ref<cvf::OverlayScalarMapperLegend> m_scalarMapperLegend;
|
2016-08-02 03:25:55 -05:00
|
|
|
|
|
|
|
cvf::ref<caf::CategoryMapper> m_categoryMapper;
|
|
|
|
cvf::ref<caf::CategoryLegend> m_categoryLegend;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
double m_globalAutoMax;
|
|
|
|
double m_globalAutoMin;
|
|
|
|
double m_localAutoMax;
|
|
|
|
double m_localAutoMin;
|
|
|
|
|
2013-06-03 06:08:11 -05:00
|
|
|
double m_globalAutoPosClosestToZero;
|
|
|
|
double m_globalAutoNegClosestToZero;
|
|
|
|
double m_localAutoPosClosestToZero;
|
|
|
|
double m_localAutoNegClosestToZero;
|
|
|
|
|
2016-08-02 03:25:55 -05:00
|
|
|
cvf::IntArray m_globalCategories;
|
|
|
|
cvf::IntArray m_localCategories;
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
// Fields
|
|
|
|
caf::PdmField<int> m_numLevels;
|
|
|
|
caf::PdmField<int> m_precision;
|
2013-04-30 07:48:53 -05:00
|
|
|
caf::PdmField<caf::AppEnum<NumberFormatType> > m_tickNumberFormat;
|
2014-04-25 09:32:06 -05:00
|
|
|
caf::PdmField<RangeModeEnum> m_rangeMode;
|
2012-05-18 02:45:23 -05:00
|
|
|
caf::PdmField<double> m_userDefinedMaxValue;
|
|
|
|
caf::PdmField<double> m_userDefinedMinValue;
|
|
|
|
caf::PdmField<caf::AppEnum<ColorRangesType> > m_colorRangeMode;
|
|
|
|
caf::PdmField<caf::AppEnum<MappingType> > m_mappingMode;
|
|
|
|
};
|