mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -2,25 +2,25 @@
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
@@ -37,70 +37,80 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimTernaryLegendConfig, "RimTernaryLegendConfig");
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimTernaryLegendConfig, "RimTernaryLegendConfig" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTernaryLegendConfig::RimTernaryLegendConfig()
|
||||
RimTernaryLegendConfig::RimTernaryLegendConfig()
|
||||
{
|
||||
CAF_PDM_InitObject("Ternary Color Legend", ":/Legend.png", "", "");
|
||||
CAF_PDM_InitField(&m_showLegend, "ShowTernaryLegend", true, "Show Ternary Legend", "", "", "");
|
||||
m_showLegend.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitField(&precision, "Precision", 2, "Significant digits", "", "The number of significant digits displayed in the legend numbers","");
|
||||
CAF_PDM_InitField(&rangeMode, "RangeType", RangeModeEnum(USER_DEFINED), "Range type", "", "Switches between automatic and user defined range on the legend", "");
|
||||
CAF_PDM_InitObject( "Ternary Color Legend", ":/Legend.png", "", "" );
|
||||
CAF_PDM_InitField( &m_showLegend, "ShowTernaryLegend", true, "Show Ternary Legend", "", "", "" );
|
||||
m_showLegend.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitField( &precision,
|
||||
"Precision",
|
||||
2,
|
||||
"Significant digits",
|
||||
"",
|
||||
"The number of significant digits displayed in the legend numbers",
|
||||
"" );
|
||||
CAF_PDM_InitField( &rangeMode,
|
||||
"RangeType",
|
||||
RangeModeEnum( USER_DEFINED ),
|
||||
"Range type",
|
||||
"",
|
||||
"Switches between automatic and user defined range on the legend",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&applyLocalMinMax, "m_applyLocalMinMax", "", "", "", "");
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField(&applyLocalMinMax);
|
||||
CAF_PDM_InitFieldNoDefault( &applyLocalMinMax, "m_applyLocalMinMax", "", "", "", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &applyLocalMinMax );
|
||||
applyLocalMinMax = false;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&applyGlobalMinMax, "m_applyGlobalMinMax", "", "", "", "");
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField(&applyGlobalMinMax);
|
||||
CAF_PDM_InitFieldNoDefault( &applyGlobalMinMax, "m_applyGlobalMinMax", "", "", "", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &applyGlobalMinMax );
|
||||
applyGlobalMinMax = false;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&applyFullRangeMinMax, "m_applyFullRangeMinMax", "", "", "", "");
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField(&applyFullRangeMinMax);
|
||||
CAF_PDM_InitFieldNoDefault( &applyFullRangeMinMax, "m_applyFullRangeMinMax", "", "", "", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &applyFullRangeMinMax );
|
||||
applyFullRangeMinMax = false;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&ternaryRangeSummary, "ternaryRangeSummary", "Range summary", "", "", "");
|
||||
ternaryRangeSummary.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
|
||||
ternaryRangeSummary.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||
CAF_PDM_InitFieldNoDefault( &ternaryRangeSummary, "ternaryRangeSummary", "Range summary", "", "", "" );
|
||||
ternaryRangeSummary.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() );
|
||||
ternaryRangeSummary.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
|
||||
CAF_PDM_InitField(&userDefinedMaxValueSoil, "UserDefinedMaxSoil", 1.0, "Max", "", "Min value of the legend", "");
|
||||
CAF_PDM_InitField(&userDefinedMinValueSoil, "UserDefinedMinSoil", 0.0, "Min", "", "Max value of the legend", "");
|
||||
CAF_PDM_InitField( &userDefinedMaxValueSoil, "UserDefinedMaxSoil", 1.0, "Max", "", "Min value of the legend", "" );
|
||||
CAF_PDM_InitField( &userDefinedMinValueSoil, "UserDefinedMinSoil", 0.0, "Min", "", "Max value of the legend", "" );
|
||||
|
||||
CAF_PDM_InitField(&userDefinedMaxValueSgas, "UserDefinedMaxSgas", 1.0, "Max", "", "Min value of the legend", "");
|
||||
CAF_PDM_InitField(&userDefinedMinValueSgas, "UserDefinedMinSgas", 0.0, "Min", "", "Max value of the legend", "");
|
||||
CAF_PDM_InitField( &userDefinedMaxValueSgas, "UserDefinedMaxSgas", 1.0, "Max", "", "Min value of the legend", "" );
|
||||
CAF_PDM_InitField( &userDefinedMinValueSgas, "UserDefinedMinSgas", 0.0, "Min", "", "Max value of the legend", "" );
|
||||
|
||||
CAF_PDM_InitField(&userDefinedMaxValueSwat, "UserDefinedMaxSwat", 1.0, "Max", "", "Min value of the legend", "");
|
||||
CAF_PDM_InitField(&userDefinedMinValueSwat, "UserDefinedMinSwat", 0.0, "Min", "", "Max value of the legend", "");
|
||||
CAF_PDM_InitField( &userDefinedMaxValueSwat, "UserDefinedMaxSwat", 1.0, "Max", "", "Min value of the legend", "" );
|
||||
CAF_PDM_InitField( &userDefinedMinValueSwat, "UserDefinedMinSwat", 0.0, "Min", "", "Max value of the legend", "" );
|
||||
|
||||
m_globalAutoMin.resize(3, 0.0);
|
||||
m_globalAutoMax.resize(3, 1.0);
|
||||
m_localAutoMin.resize(3, 0.0);
|
||||
m_localAutoMax.resize(3, 1.0);
|
||||
m_globalAutoMin.resize( 3, 0.0 );
|
||||
m_globalAutoMax.resize( 3, 1.0 );
|
||||
m_localAutoMin.resize( 3, 0.0 );
|
||||
m_localAutoMax.resize( 3, 1.0 );
|
||||
|
||||
m_scalarMapper = new RivTernaryScalarMapper(RiaColorTables::undefinedCellColor());
|
||||
m_scalarMapper = new RivTernaryScalarMapper( RiaColorTables::undefinedCellColor() );
|
||||
|
||||
recreateLegend();
|
||||
updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTernaryLegendConfig::~RimTernaryLegendConfig()
|
||||
{
|
||||
}
|
||||
RimTernaryLegendConfig::~RimTernaryLegendConfig() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimTernaryLegendConfig::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if (changedField == &applyLocalMinMax)
|
||||
if ( changedField == &applyLocalMinMax )
|
||||
{
|
||||
userDefinedMaxValueSoil = m_localAutoMax[TERNARY_SOIL_IDX];
|
||||
userDefinedMinValueSoil = m_localAutoMin[TERNARY_SOIL_IDX];
|
||||
@@ -108,10 +118,10 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
||||
userDefinedMinValueSgas = m_localAutoMin[TERNARY_SGAS_IDX];
|
||||
userDefinedMaxValueSwat = m_localAutoMax[TERNARY_SWAT_IDX];
|
||||
userDefinedMinValueSwat = m_localAutoMin[TERNARY_SWAT_IDX];
|
||||
|
||||
|
||||
applyLocalMinMax = false;
|
||||
}
|
||||
else if (changedField == &applyGlobalMinMax)
|
||||
else if ( changedField == &applyGlobalMinMax )
|
||||
{
|
||||
userDefinedMaxValueSoil = m_globalAutoMax[TERNARY_SOIL_IDX];
|
||||
userDefinedMinValueSoil = m_globalAutoMin[TERNARY_SOIL_IDX];
|
||||
@@ -122,7 +132,7 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
||||
|
||||
applyGlobalMinMax = false;
|
||||
}
|
||||
else if (changedField == &applyFullRangeMinMax)
|
||||
else if ( changedField == &applyFullRangeMinMax )
|
||||
{
|
||||
userDefinedMaxValueSoil = 1.0;
|
||||
userDefinedMinValueSoil = 0.0;
|
||||
@@ -138,23 +148,23 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
||||
updateLegend();
|
||||
|
||||
RimGridView* view = nullptr;
|
||||
this->firstAncestorOrThisOfType(view);
|
||||
this->firstAncestorOrThisOfType( view );
|
||||
|
||||
if (view)
|
||||
if ( view )
|
||||
{
|
||||
RimViewLinker* viewLinker = view->assosiatedViewLinker();
|
||||
if (viewLinker)
|
||||
if ( viewLinker )
|
||||
{
|
||||
viewLinker->updateCellResult();
|
||||
}
|
||||
|
||||
|
||||
view->updateCurrentTimeStepAndRedraw();
|
||||
view->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::updateLegend()
|
||||
{
|
||||
@@ -165,8 +175,8 @@ void RimTernaryLegendConfig::updateLegend()
|
||||
double swatLower = 0.0;
|
||||
double swatUpper = 1.0;
|
||||
|
||||
ternaryRanges(soilLower, soilUpper, sgasLower, sgasUpper, swatLower, swatUpper);
|
||||
m_scalarMapper->setTernaryRanges(soilLower, soilUpper, sgasLower, sgasUpper);
|
||||
ternaryRanges( soilLower, soilUpper, sgasLower, sgasUpper, swatLower, swatUpper );
|
||||
m_scalarMapper->setTernaryRanges( soilLower, soilUpper, sgasLower, sgasUpper );
|
||||
|
||||
cvf::String soilRange;
|
||||
cvf::String sgasRange;
|
||||
@@ -174,96 +184,100 @@ void RimTernaryLegendConfig::updateLegend()
|
||||
|
||||
int numberPrecision = 1;
|
||||
{
|
||||
QString tmpString = QString::number(soilLower, 'g', numberPrecision) + " - " + QString::number(soilUpper, 'g', numberPrecision);
|
||||
soilRange = cvfqt::Utils::toString(tmpString);
|
||||
QString tmpString = QString::number( soilLower, 'g', numberPrecision ) + " - " +
|
||||
QString::number( soilUpper, 'g', numberPrecision );
|
||||
soilRange = cvfqt::Utils::toString( tmpString );
|
||||
}
|
||||
|
||||
{
|
||||
QString tmpString = QString::number(sgasLower, 'g', numberPrecision) + " - " + QString::number(sgasUpper, 'g', numberPrecision);
|
||||
sgasRange = cvfqt::Utils::toString(tmpString);
|
||||
QString tmpString = QString::number( sgasLower, 'g', numberPrecision ) + " - " +
|
||||
QString::number( sgasUpper, 'g', numberPrecision );
|
||||
sgasRange = cvfqt::Utils::toString( tmpString );
|
||||
}
|
||||
|
||||
{
|
||||
QString tmpString = QString::number(swatLower, 'g', numberPrecision) + " - " + QString::number(swatUpper, 'g', numberPrecision);
|
||||
swatRange = cvfqt::Utils::toString(tmpString);
|
||||
QString tmpString = QString::number( swatLower, 'g', numberPrecision ) + " - " +
|
||||
QString::number( swatUpper, 'g', numberPrecision );
|
||||
swatRange = cvfqt::Utils::toString( tmpString );
|
||||
}
|
||||
|
||||
if (!m_legend.isNull())
|
||||
if ( !m_legend.isNull() )
|
||||
{
|
||||
m_legend->setRangeText(soilRange, sgasRange, swatRange);
|
||||
m_legend->setRangeText( soilRange, sgasRange, swatRange );
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaPreferences* preferences = app->preferences();
|
||||
m_legend->enableBackground(preferences->showLegendBackground());
|
||||
m_legend->enableBackground( preferences->showLegendBackground() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::setAutomaticRanges(TernaryArrayIndex ternaryIndex, double globalMin, double globalMax, double localMin, double localMax)
|
||||
void RimTernaryLegendConfig::setAutomaticRanges(
|
||||
TernaryArrayIndex ternaryIndex, double globalMin, double globalMax, double localMin, double localMax )
|
||||
{
|
||||
double candidateGlobalAutoMin = roundToNumSignificantDigits(globalMin, precision);
|
||||
double candidateGlobalAutoMax = roundToNumSignificantDigits(globalMax, precision);
|
||||
double candidateGlobalAutoMin = roundToNumSignificantDigits( globalMin, precision );
|
||||
double candidateGlobalAutoMax = roundToNumSignificantDigits( globalMax, precision );
|
||||
|
||||
double candidateLocalAutoMin = roundToNumSignificantDigits(localMin, precision);
|
||||
double candidateLocalAutoMax = roundToNumSignificantDigits(localMax, precision);
|
||||
double candidateLocalAutoMin = roundToNumSignificantDigits( localMin, precision );
|
||||
double candidateLocalAutoMax = roundToNumSignificantDigits( localMax, precision );
|
||||
|
||||
m_globalAutoMin[ternaryIndex] = candidateGlobalAutoMin;
|
||||
m_globalAutoMax[ternaryIndex] = candidateGlobalAutoMax;
|
||||
m_localAutoMin[ternaryIndex] = candidateLocalAutoMin;
|
||||
m_localAutoMax[ternaryIndex] = candidateLocalAutoMax;
|
||||
m_localAutoMin[ternaryIndex] = candidateLocalAutoMin;
|
||||
m_localAutoMax[ternaryIndex] = candidateLocalAutoMax;
|
||||
|
||||
updateLabelText();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::recreateLegend()
|
||||
{
|
||||
// Due to possible visualization bug, we need to recreate the legend if the last viewer
|
||||
// has been removed, (and thus the opengl resources has been deleted) The text in
|
||||
// Due to possible visualization bug, we need to recreate the legend if the last viewer
|
||||
// has been removed, (and thus the opengl resources has been deleted) The text in
|
||||
// the legend disappeared because of this, so workaround: recreate the legend when needed:
|
||||
|
||||
cvf::Font* standardFont = RiaApplication::instance()->defaultSceneFont();
|
||||
m_legend = new RivTernarySaturationOverlayItem(standardFont);
|
||||
m_legend->setLayout(cvf::OverlayItem::VERTICAL, cvf::OverlayItem::BOTTOM_LEFT);
|
||||
m_legend = new RivTernarySaturationOverlayItem( standardFont );
|
||||
m_legend->setLayout( cvf::OverlayItem::VERTICAL, cvf::OverlayItem::BOTTOM_LEFT );
|
||||
|
||||
updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig)
|
||||
void RimTernaryLegendConfig::setUiValuesFromLegendConfig( const RimTernaryLegendConfig* otherLegendConfig )
|
||||
{
|
||||
QString serializedObjectString = otherLegendConfig->writeObjectToXmlString();
|
||||
this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance());
|
||||
this->readObjectFromXmlString( serializedObjectString, caf::PdmDefaultObjectFactory::instance() );
|
||||
this->updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Rounding the double value to given number of significant digits
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimTernaryLegendConfig::roundToNumSignificantDigits(double domainValue, double numSignificantDigits)
|
||||
double RimTernaryLegendConfig::roundToNumSignificantDigits( double domainValue, double numSignificantDigits )
|
||||
{
|
||||
double absDomainValue = cvf::Math::abs(domainValue);
|
||||
if (absDomainValue == 0.0)
|
||||
double absDomainValue = cvf::Math::abs( domainValue );
|
||||
if ( absDomainValue == 0.0 )
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double logDecValue = log10(absDomainValue);
|
||||
logDecValue = cvf::Math::ceil(logDecValue);
|
||||
double logDecValue = log10( absDomainValue );
|
||||
logDecValue = cvf::Math::ceil( logDecValue );
|
||||
|
||||
double factor = pow(10.0, numSignificantDigits - logDecValue);
|
||||
double factor = pow( 10.0, numSignificantDigits - logDecValue );
|
||||
|
||||
double tmp = domainValue * factor;
|
||||
double integerPart;
|
||||
double fraction = modf(tmp, &integerPart);
|
||||
double fraction = modf( tmp, &integerPart );
|
||||
|
||||
if (cvf::Math::abs(fraction)>= 0.5) (integerPart >= 0) ? integerPart++: integerPart-- ;
|
||||
if ( cvf::Math::abs( fraction ) >= 0.5 ) ( integerPart >= 0 ) ? integerPart++ : integerPart--;
|
||||
|
||||
double newDomainValue = integerPart / factor;
|
||||
|
||||
@@ -271,50 +285,50 @@ double RimTernaryLegendConfig::roundToNumSignificantDigits(double domainValue, d
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimTernaryLegendConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiOrdering* formatGr = uiOrdering.addNewGroup("Format");
|
||||
formatGr->add(&precision);
|
||||
formatGr->add(&rangeMode);
|
||||
caf::PdmUiOrdering* formatGr = uiOrdering.addNewGroup( "Format" );
|
||||
formatGr->add( &precision );
|
||||
formatGr->add( &rangeMode );
|
||||
|
||||
if (rangeMode == USER_DEFINED)
|
||||
if ( rangeMode == USER_DEFINED )
|
||||
{
|
||||
caf::PdmUiOrdering* ternaryGroupContainer = uiOrdering.addNewGroup("Ternary ");
|
||||
caf::PdmUiOrdering* ternaryGroupContainer = uiOrdering.addNewGroup( "Ternary " );
|
||||
{
|
||||
caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup("SGAS");
|
||||
ternaryGroup->add(&userDefinedMinValueSgas);
|
||||
ternaryGroup->add(&userDefinedMaxValueSgas);
|
||||
caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup( "SGAS" );
|
||||
ternaryGroup->add( &userDefinedMinValueSgas );
|
||||
ternaryGroup->add( &userDefinedMaxValueSgas );
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup("SWAT");
|
||||
ternaryGroup->add(&userDefinedMinValueSwat);
|
||||
ternaryGroup->add(&userDefinedMaxValueSwat);
|
||||
caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup( "SWAT" );
|
||||
ternaryGroup->add( &userDefinedMinValueSwat );
|
||||
ternaryGroup->add( &userDefinedMaxValueSwat );
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup("SOIL");
|
||||
ternaryGroup->add(&userDefinedMinValueSoil);
|
||||
ternaryGroup->add(&userDefinedMaxValueSoil);
|
||||
caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup( "SOIL" );
|
||||
ternaryGroup->add( &userDefinedMinValueSoil );
|
||||
ternaryGroup->add( &userDefinedMaxValueSoil );
|
||||
}
|
||||
|
||||
ternaryGroupContainer->add(&applyLocalMinMax);
|
||||
ternaryGroupContainer->add(&applyGlobalMinMax);
|
||||
ternaryGroupContainer->add(&applyFullRangeMinMax);
|
||||
ternaryGroupContainer->add( &applyLocalMinMax );
|
||||
ternaryGroupContainer->add( &applyGlobalMinMax );
|
||||
ternaryGroupContainer->add( &applyFullRangeMinMax );
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::PdmUiOrdering* group = uiOrdering.addNewGroup("Summary");
|
||||
group->add(&ternaryRangeSummary);
|
||||
caf::PdmUiOrdering* group = uiOrdering.addNewGroup( "Summary" );
|
||||
group->add( &ternaryRangeSummary );
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimTernaryLegendConfig::showLegend() const
|
||||
{
|
||||
@@ -322,38 +336,40 @@ bool RimTernaryLegendConfig::showLegend() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::setTitle(const QString& title)
|
||||
void RimTernaryLegendConfig::setTitle( const QString& title )
|
||||
{
|
||||
m_legend->setTitle(cvfqt::Utils::toString(title));
|
||||
m_legend->setTitle( cvfqt::Utils::toString( title ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
void RimTernaryLegendConfig::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if (&applyLocalMinMax == field)
|
||||
if ( &applyLocalMinMax == field )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
if (attrib)
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Apply local min/max values";
|
||||
}
|
||||
}
|
||||
else if (&applyGlobalMinMax == field)
|
||||
else if ( &applyGlobalMinMax == field )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
if (attrib)
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Apply global min/max values";
|
||||
}
|
||||
}
|
||||
else if (&applyFullRangeMinMax == field)
|
||||
else if ( &applyFullRangeMinMax == field )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
if (attrib)
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Apply full range";
|
||||
}
|
||||
@@ -361,11 +377,12 @@ void RimTernaryLegendConfig::defineEditorAttribute(const caf::PdmFieldHandle* fi
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::ternaryRanges(double& soilLower, double& soilUpper, double& sgasLower, double& sgasUpper, double& swatLower, double& swatUpper) const
|
||||
void RimTernaryLegendConfig::ternaryRanges(
|
||||
double& soilLower, double& soilUpper, double& sgasLower, double& sgasUpper, double& swatLower, double& swatUpper ) const
|
||||
{
|
||||
if (rangeMode() == AUTOMATIC_CURRENT_TIMESTEP)
|
||||
if ( rangeMode() == AUTOMATIC_CURRENT_TIMESTEP )
|
||||
{
|
||||
soilLower = m_localAutoMin[TERNARY_SOIL_IDX];
|
||||
soilUpper = m_localAutoMax[TERNARY_SOIL_IDX];
|
||||
@@ -374,7 +391,7 @@ void RimTernaryLegendConfig::ternaryRanges(double& soilLower, double& soilUpper,
|
||||
swatLower = m_localAutoMin[TERNARY_SWAT_IDX];
|
||||
swatUpper = m_localAutoMax[TERNARY_SWAT_IDX];
|
||||
}
|
||||
else if (rangeMode() == AUTOMATIC_ALLTIMESTEPS)
|
||||
else if ( rangeMode() == AUTOMATIC_ALLTIMESTEPS )
|
||||
{
|
||||
soilLower = m_globalAutoMin[TERNARY_SOIL_IDX];
|
||||
soilUpper = m_globalAutoMax[TERNARY_SOIL_IDX];
|
||||
@@ -395,77 +412,89 @@ void RimTernaryLegendConfig::ternaryRanges(double& soilLower, double& soilUpper,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::updateLabelText()
|
||||
{
|
||||
{
|
||||
userDefinedMinValueSoil.uiCapability()->setUiName("Min");
|
||||
userDefinedMaxValueSoil.uiCapability()->setUiName("Max");
|
||||
userDefinedMinValueSoil.uiCapability()->setUiName( "Min" );
|
||||
userDefinedMaxValueSoil.uiCapability()->setUiName( "Max" );
|
||||
|
||||
if (m_globalAutoMin[TERNARY_SOIL_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
if ( m_globalAutoMin[TERNARY_SOIL_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
{
|
||||
userDefinedMinValueSoil.uiCapability()->setUiName(QString("Min ") + "(" + QString::number(m_globalAutoMin[TERNARY_SOIL_IDX], 'g', precision) + ")");
|
||||
userDefinedMinValueSoil.uiCapability()->setUiName(
|
||||
QString( "Min " ) + "(" + QString::number( m_globalAutoMin[TERNARY_SOIL_IDX], 'g', precision ) + ")" );
|
||||
}
|
||||
|
||||
if (m_globalAutoMax[TERNARY_SOIL_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
if ( m_globalAutoMax[TERNARY_SOIL_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
{
|
||||
userDefinedMaxValueSoil.uiCapability()->setUiName(QString("Max ") + "(" + QString::number(m_globalAutoMax[TERNARY_SOIL_IDX], 'g', precision) + ")");
|
||||
userDefinedMaxValueSoil.uiCapability()->setUiName(
|
||||
QString( "Max " ) + "(" + QString::number( m_globalAutoMax[TERNARY_SOIL_IDX], 'g', precision ) + ")" );
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
userDefinedMinValueSgas.uiCapability()->setUiName("Min");
|
||||
userDefinedMaxValueSgas.uiCapability()->setUiName("Max");
|
||||
userDefinedMinValueSgas.uiCapability()->setUiName( "Min" );
|
||||
userDefinedMaxValueSgas.uiCapability()->setUiName( "Max" );
|
||||
|
||||
if (m_globalAutoMin[TERNARY_SGAS_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
if ( m_globalAutoMin[TERNARY_SGAS_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
{
|
||||
userDefinedMinValueSgas.uiCapability()->setUiName(QString("Min ") + "(" + QString::number(m_globalAutoMin[TERNARY_SGAS_IDX], 'g', precision) + ")");
|
||||
userDefinedMinValueSgas.uiCapability()->setUiName(
|
||||
QString( "Min " ) + "(" + QString::number( m_globalAutoMin[TERNARY_SGAS_IDX], 'g', precision ) + ")" );
|
||||
}
|
||||
|
||||
if (m_globalAutoMax[TERNARY_SGAS_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
if ( m_globalAutoMax[TERNARY_SGAS_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
{
|
||||
userDefinedMaxValueSgas.uiCapability()->setUiName(QString("Max ") + "(" + QString::number(m_globalAutoMax[TERNARY_SGAS_IDX], 'g', precision) + ")");
|
||||
userDefinedMaxValueSgas.uiCapability()->setUiName(
|
||||
QString( "Max " ) + "(" + QString::number( m_globalAutoMax[TERNARY_SGAS_IDX], 'g', precision ) + ")" );
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
userDefinedMinValueSwat.uiCapability()->setUiName("Min");
|
||||
userDefinedMaxValueSwat.uiCapability()->setUiName("Max");
|
||||
userDefinedMinValueSwat.uiCapability()->setUiName( "Min" );
|
||||
userDefinedMaxValueSwat.uiCapability()->setUiName( "Max" );
|
||||
|
||||
if (m_globalAutoMin[TERNARY_SWAT_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
if ( m_globalAutoMin[TERNARY_SWAT_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
{
|
||||
userDefinedMinValueSwat.uiCapability()->setUiName(QString("Min ") + "(" + QString::number(m_globalAutoMin[TERNARY_SWAT_IDX], 'g', precision) + ")");
|
||||
userDefinedMinValueSwat.uiCapability()->setUiName(
|
||||
QString( "Min " ) + "(" + QString::number( m_globalAutoMin[TERNARY_SWAT_IDX], 'g', precision ) + ")" );
|
||||
}
|
||||
|
||||
if (m_globalAutoMax[TERNARY_SWAT_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
if ( m_globalAutoMax[TERNARY_SWAT_IDX] != cvf::UNDEFINED_DOUBLE )
|
||||
{
|
||||
userDefinedMaxValueSwat.uiCapability()->setUiName(QString("Max ") + "(" + QString::number(m_globalAutoMax[TERNARY_SWAT_IDX], 'g', precision) + ")");
|
||||
userDefinedMaxValueSwat.uiCapability()->setUiName(
|
||||
QString( "Max " ) + "(" + QString::number( m_globalAutoMax[TERNARY_SWAT_IDX], 'g', precision ) + ")" );
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeMode == AUTOMATIC_ALLTIMESTEPS)
|
||||
if ( rangeMode == AUTOMATIC_ALLTIMESTEPS )
|
||||
{
|
||||
QString tmpString;
|
||||
tmpString = QString("SOIL : ") + QString::number(m_globalAutoMin[TERNARY_SOIL_IDX], 'g', precision) + " - " + QString::number(m_globalAutoMax[TERNARY_SOIL_IDX], 'g', precision) + "\n";
|
||||
tmpString += QString("SGAS : ") + QString::number(m_globalAutoMin[TERNARY_SGAS_IDX], 'g', precision) + " - " + QString::number(m_globalAutoMax[TERNARY_SGAS_IDX], 'g', precision) + "\n";
|
||||
tmpString += QString("SWAT : ") + QString::number(m_globalAutoMin[TERNARY_SWAT_IDX], 'g', precision) + " - " + QString::number(m_globalAutoMax[TERNARY_SWAT_IDX], 'g', precision) + "\n";
|
||||
tmpString = QString( "SOIL : " ) + QString::number( m_globalAutoMin[TERNARY_SOIL_IDX], 'g', precision ) +
|
||||
" - " + QString::number( m_globalAutoMax[TERNARY_SOIL_IDX], 'g', precision ) + "\n";
|
||||
tmpString += QString( "SGAS : " ) + QString::number( m_globalAutoMin[TERNARY_SGAS_IDX], 'g', precision ) +
|
||||
" - " + QString::number( m_globalAutoMax[TERNARY_SGAS_IDX], 'g', precision ) + "\n";
|
||||
tmpString += QString( "SWAT : " ) + QString::number( m_globalAutoMin[TERNARY_SWAT_IDX], 'g', precision ) +
|
||||
" - " + QString::number( m_globalAutoMax[TERNARY_SWAT_IDX], 'g', precision ) + "\n";
|
||||
|
||||
ternaryRangeSummary = tmpString;
|
||||
}
|
||||
else if (rangeMode == AUTOMATIC_CURRENT_TIMESTEP)
|
||||
else if ( rangeMode == AUTOMATIC_CURRENT_TIMESTEP )
|
||||
{
|
||||
QString tmpString;
|
||||
tmpString = QString("SOIL : ") + QString::number(m_localAutoMin[TERNARY_SOIL_IDX], 'g', precision) + " - " + QString::number(m_localAutoMax[TERNARY_SOIL_IDX], 'g', precision) + "\n";
|
||||
tmpString += QString("SGAS : ") + QString::number(m_localAutoMin[TERNARY_SGAS_IDX], 'g', precision) + " - " + QString::number(m_localAutoMax[TERNARY_SGAS_IDX], 'g', precision) + "\n";
|
||||
tmpString += QString("SWAT : ") + QString::number(m_localAutoMin[TERNARY_SWAT_IDX], 'g', precision) + " - " + QString::number(m_localAutoMax[TERNARY_SWAT_IDX], 'g', precision) + "\n";
|
||||
tmpString = QString( "SOIL : " ) + QString::number( m_localAutoMin[TERNARY_SOIL_IDX], 'g', precision ) + " - " +
|
||||
QString::number( m_localAutoMax[TERNARY_SOIL_IDX], 'g', precision ) + "\n";
|
||||
tmpString += QString( "SGAS : " ) + QString::number( m_localAutoMin[TERNARY_SGAS_IDX], 'g', precision ) +
|
||||
" - " + QString::number( m_localAutoMax[TERNARY_SGAS_IDX], 'g', precision ) + "\n";
|
||||
tmpString += QString( "SWAT : " ) + QString::number( m_localAutoMin[TERNARY_SWAT_IDX], 'g', precision ) +
|
||||
" - " + QString::number( m_localAutoMax[TERNARY_SWAT_IDX], 'g', precision ) + "\n";
|
||||
|
||||
ternaryRangeSummary = tmpString;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RivTernaryScalarMapper* RimTernaryLegendConfig::scalarMapper() const
|
||||
{
|
||||
@@ -473,7 +502,7 @@ const RivTernaryScalarMapper* RimTernaryLegendConfig::scalarMapper() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::TitledOverlayFrame* RimTernaryLegendConfig::titledOverlayFrame() const
|
||||
{
|
||||
@@ -481,7 +510,7 @@ const caf::TitledOverlayFrame* RimTernaryLegendConfig::titledOverlayFrame() cons
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::TitledOverlayFrame* RimTernaryLegendConfig::titledOverlayFrame()
|
||||
{
|
||||
@@ -489,7 +518,7 @@ caf::TitledOverlayFrame* RimTernaryLegendConfig::titledOverlayFrame()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimTernaryLegendConfig::objectToggleField()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user