2014-05-06 15:39:53 -05:00
/////////////////////////////////////////////////////////////////////////////////
//
2014-09-24 00:14:52 -05:00
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
2014-05-06 15:39:53 -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.
//
/////////////////////////////////////////////////////////////////////////////////
# include "RimTernaryLegendConfig.h"
# include "RiaApplication.h"
2018-01-22 04:18:45 -06:00
# include "RiaColorTables.h"
2018-04-19 01:01:37 -05:00
# include "RiaPreferences.h"
2016-12-09 13:36:31 -06:00
2015-05-21 03:34:38 -05:00
# include "RimEclipseView.h"
2018-02-01 10:45:22 -06:00
# include "RimIntersectionCollection.h"
2016-12-09 13:36:31 -06:00
# include "RimViewLinker.h"
2014-05-06 15:39:53 -05:00
# include "RivTernarySaturationOverlayItem.h"
2014-08-11 01:10:07 -05:00
# include "RivTernaryScalarMapper.h"
2014-05-06 15:39:53 -05:00
2016-12-09 13:36:31 -06:00
# include "cafPdmUiPushButtonEditor.h"
# include "cafPdmUiTextEditor.h"
2014-05-06 16:29:41 -05:00
# include "cvfqtUtils.h"
2014-05-06 15:50:49 -05:00
2014-08-11 01:10:07 -05:00
# include <cmath>
2014-05-06 15:39:53 -05:00
CAF_PDM_SOURCE_INIT ( RimTernaryLegendConfig , " RimTernaryLegendConfig " ) ;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTernaryLegendConfig : : RimTernaryLegendConfig ( )
{
CAF_PDM_InitObject ( " Ternary Legend Definition " , " :/Legend.png " , " " , " " ) ;
2018-04-17 08:59:50 -05:00
CAF_PDM_InitField ( & m_showLegend , " ShowTernaryLegend " , true , " Show Ternary Legend " , " " , " " , " " ) ;
m_showLegend . uiCapability ( ) - > setUiHidden ( true ) ;
2014-05-06 15:39:53 -05:00
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 " , " " , " " , " " , " " ) ;
2017-11-16 05:43:05 -06:00
caf : : PdmUiPushButtonEditor : : configureEditorForField ( & applyLocalMinMax ) ;
2014-05-06 15:39:53 -05:00
applyLocalMinMax = false ;
CAF_PDM_InitFieldNoDefault ( & applyGlobalMinMax , " m_applyGlobalMinMax " , " " , " " , " " , " " ) ;
2017-11-16 05:43:05 -06:00
caf : : PdmUiPushButtonEditor : : configureEditorForField ( & applyGlobalMinMax ) ;
2014-05-06 15:39:53 -05:00
applyGlobalMinMax = false ;
CAF_PDM_InitFieldNoDefault ( & applyFullRangeMinMax , " m_applyFullRangeMinMax " , " " , " " , " " , " " ) ;
2017-11-16 05:43:05 -06:00
caf : : PdmUiPushButtonEditor : : configureEditorForField ( & applyFullRangeMinMax ) ;
2014-05-06 15:39:53 -05:00
applyFullRangeMinMax = false ;
CAF_PDM_InitFieldNoDefault ( & ternaryRangeSummary , " ternaryRangeSummary " , " Range summary " , " " , " " , " " ) ;
2015-08-05 06:27:36 -05:00
ternaryRangeSummary . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiTextEditor : : uiEditorTypeName ( ) ) ;
ternaryRangeSummary . uiCapability ( ) - > setUiLabelPosition ( caf : : PdmUiItemInfo : : TOP ) ;
2014-05-06 15:39:53 -05:00
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 ( & 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 ) ;
2018-01-22 04:18:45 -06:00
m_scalarMapper = new RivTernaryScalarMapper ( RiaColorTables : : undefinedCellColor ( ) ) ;
2014-08-11 01:10:07 -05:00
2014-05-06 15:39:53 -05:00
recreateLegend ( ) ;
updateLegend ( ) ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTernaryLegendConfig : : ~ RimTernaryLegendConfig ( )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig : : fieldChangedByUi ( const caf : : PdmFieldHandle * changedField , const QVariant & oldValue , const QVariant & newValue )
{
if ( changedField = = & applyLocalMinMax )
{
userDefinedMaxValueSoil = m_localAutoMax [ TERNARY_SOIL_IDX ] ;
userDefinedMinValueSoil = m_localAutoMin [ TERNARY_SOIL_IDX ] ;
userDefinedMaxValueSgas = m_localAutoMax [ TERNARY_SGAS_IDX ] ;
userDefinedMinValueSgas = m_localAutoMin [ TERNARY_SGAS_IDX ] ;
userDefinedMaxValueSwat = m_localAutoMax [ TERNARY_SWAT_IDX ] ;
userDefinedMinValueSwat = m_localAutoMin [ TERNARY_SWAT_IDX ] ;
applyLocalMinMax = false ;
}
else if ( changedField = = & applyGlobalMinMax )
{
userDefinedMaxValueSoil = m_globalAutoMax [ TERNARY_SOIL_IDX ] ;
userDefinedMinValueSoil = m_globalAutoMin [ TERNARY_SOIL_IDX ] ;
userDefinedMaxValueSgas = m_globalAutoMax [ TERNARY_SGAS_IDX ] ;
userDefinedMinValueSgas = m_globalAutoMin [ TERNARY_SGAS_IDX ] ;
userDefinedMaxValueSwat = m_globalAutoMax [ TERNARY_SWAT_IDX ] ;
userDefinedMinValueSwat = m_globalAutoMin [ TERNARY_SWAT_IDX ] ;
applyGlobalMinMax = false ;
}
else if ( changedField = = & applyFullRangeMinMax )
{
userDefinedMaxValueSoil = 1.0 ;
userDefinedMinValueSoil = 0.0 ;
userDefinedMaxValueSgas = 1.0 ;
userDefinedMinValueSgas = 0.0 ;
userDefinedMaxValueSwat = 1.0 ;
userDefinedMinValueSwat = 0.0 ;
applyFullRangeMinMax = false ;
}
updateLabelText ( ) ;
updateLegend ( ) ;
2018-02-01 10:45:22 -06:00
RimGridView * view = nullptr ;
2016-12-09 13:36:31 -06:00
this - > firstAncestorOrThisOfType ( view ) ;
if ( view )
{
RimViewLinker * viewLinker = view - > assosiatedViewLinker ( ) ;
if ( viewLinker )
{
viewLinker - > updateCellResult ( ) ;
}
2016-12-09 14:15:24 -06:00
view - > updateCurrentTimeStepAndRedraw ( ) ;
2018-02-01 10:45:22 -06:00
view - > crossSectionCollection ( ) - > scheduleCreateDisplayModelAndRedraw2dIntersectionViews ( ) ;
2016-12-09 13:36:31 -06:00
}
2014-05-06 15:39:53 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig : : updateLegend ( )
{
2014-05-06 16:29:41 -05:00
double soilLower = 0.0 ;
double soilUpper = 1.0 ;
double sgasLower = 0.0 ;
double sgasUpper = 1.0 ;
double swatLower = 0.0 ;
double swatUpper = 1.0 ;
ternaryRanges ( soilLower , soilUpper , sgasLower , sgasUpper , swatLower , swatUpper ) ;
2015-10-23 08:46:25 -05:00
m_scalarMapper - > setTernaryRanges ( soilLower , soilUpper , sgasLower , sgasUpper ) ;
2014-05-06 16:29:41 -05:00
cvf : : String soilRange ;
cvf : : String sgasRange ;
cvf : : String swatRange ;
int numberPrecision = 1 ;
{
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 ( swatLower , ' g ' , numberPrecision ) + " - " + QString : : number ( swatUpper , ' g ' , numberPrecision ) ;
swatRange = cvfqt : : Utils : : toString ( tmpString ) ;
}
if ( ! m_legend . isNull ( ) )
{
m_legend - > setRangeText ( soilRange , sgasRange , swatRange ) ;
2018-03-08 09:15:45 -06:00
RiaApplication * app = RiaApplication : : instance ( ) ;
RiaPreferences * preferences = app - > preferences ( ) ;
m_legend - > enableBackground ( preferences - > showLegendBackground ( ) ) ;
2014-05-06 16:29:41 -05:00
}
2014-05-06 15:39:53 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig : : setAutomaticRanges ( TernaryArrayIndex ternaryIndex , double globalMin , double globalMax , double localMin , double localMax )
{
double candidateGlobalAutoMin = roundToNumSignificantDigits ( globalMin , precision ) ;
double candidateGlobalAutoMax = roundToNumSignificantDigits ( globalMax , 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 ;
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
// the legend disappeared because of this, so workaround: recreate the legend when needed:
cvf : : Font * standardFont = RiaApplication : : instance ( ) - > standardFont ( ) ;
m_legend = new RivTernarySaturationOverlayItem ( standardFont ) ;
m_legend - > setLayout ( cvf : : OverlayItem : : VERTICAL , cvf : : OverlayItem : : BOTTOM_LEFT ) ;
updateLegend ( ) ;
}
2016-12-09 13:36:31 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig : : setUiValuesFromLegendConfig ( const RimTernaryLegendConfig * otherLegendConfig )
{
2016-12-09 14:16:43 -06:00
QString serializedObjectString = otherLegendConfig - > writeObjectToXmlString ( ) ;
this - > readObjectFromXmlString ( serializedObjectString , caf : : PdmDefaultObjectFactory : : instance ( ) ) ;
2018-02-01 10:45:22 -06:00
this - > updateLegend ( ) ;
2016-12-09 13:36:31 -06:00
}
2014-05-06 15:39:53 -05:00
//--------------------------------------------------------------------------------------------------
/// Rounding the double value to given number of significant digits
//--------------------------------------------------------------------------------------------------
double RimTernaryLegendConfig : : roundToNumSignificantDigits ( double domainValue , double numSignificantDigits )
{
double absDomainValue = cvf : : Math : : abs ( domainValue ) ;
if ( absDomainValue = = 0.0 )
{
return 0.0 ;
}
double logDecValue = log10 ( absDomainValue ) ;
logDecValue = cvf : : Math : : ceil ( logDecValue ) ;
double factor = pow ( 10.0 , numSignificantDigits - logDecValue ) ;
double tmp = domainValue * factor ;
double integerPart ;
double fraction = modf ( tmp , & integerPart ) ;
if ( cvf : : Math : : abs ( fraction ) > = 0.5 ) ( integerPart > = 0 ) ? integerPart + + : integerPart - - ;
double newDomainValue = integerPart / factor ;
return newDomainValue ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig : : defineUiOrdering ( QString uiConfigName , caf : : PdmUiOrdering & uiOrdering )
{
caf : : PdmUiOrdering * formatGr = uiOrdering . addNewGroup ( " Format " ) ;
formatGr - > add ( & precision ) ;
formatGr - > add ( & rangeMode ) ;
if ( rangeMode = = USER_DEFINED )
{
caf : : PdmUiOrdering * ternaryGroupContainer = uiOrdering . addNewGroup ( " Ternary " ) ;
{
caf : : PdmUiOrdering * ternaryGroup = ternaryGroupContainer - > addNewGroup ( " SGAS " ) ;
ternaryGroup - > add ( & userDefinedMinValueSgas ) ;
ternaryGroup - > add ( & userDefinedMaxValueSgas ) ;
}
{
caf : : PdmUiOrdering * ternaryGroup = ternaryGroupContainer - > addNewGroup ( " SWAT " ) ;
ternaryGroup - > add ( & userDefinedMinValueSwat ) ;
ternaryGroup - > add ( & userDefinedMaxValueSwat ) ;
}
2014-08-06 08:53:08 -05:00
{
caf : : PdmUiOrdering * ternaryGroup = ternaryGroupContainer - > addNewGroup ( " SOIL " ) ;
ternaryGroup - > add ( & userDefinedMinValueSoil ) ;
ternaryGroup - > add ( & userDefinedMaxValueSoil ) ;
}
2014-05-06 15:39:53 -05:00
ternaryGroupContainer - > add ( & applyLocalMinMax ) ;
ternaryGroupContainer - > add ( & applyGlobalMinMax ) ;
ternaryGroupContainer - > add ( & applyFullRangeMinMax ) ;
}
else
{
caf : : PdmUiOrdering * group = uiOrdering . addNewGroup ( " Summary " ) ;
group - > add ( & ternaryRangeSummary ) ;
}
2017-03-21 07:47:53 -05:00
uiOrdering . skipRemainingFields ( true ) ;
2014-05-06 15:39:53 -05:00
}
2018-02-01 10:45:22 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2018-04-17 08:59:50 -05:00
bool RimTernaryLegendConfig : : showLegend ( ) const
{
return m_showLegend ;
}
2018-02-01 10:45:22 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig : : setTitle ( const QString & title )
{
m_legend - > setTitle ( cvfqt : : Utils : : toString ( title ) ) ;
}
2014-05-06 15:39:53 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig : : defineEditorAttribute ( const caf : : PdmFieldHandle * field , QString uiConfigName , caf : : PdmUiEditorAttribute * attribute )
{
if ( & applyLocalMinMax = = field )
{
caf : : PdmUiPushButtonEditorAttribute * attrib = dynamic_cast < caf : : PdmUiPushButtonEditorAttribute * > ( attribute ) ;
if ( attrib )
{
attrib - > m_buttonText = " Apply local min/max values " ;
}
}
else if ( & applyGlobalMinMax = = field )
{
caf : : PdmUiPushButtonEditorAttribute * attrib = dynamic_cast < caf : : PdmUiPushButtonEditorAttribute * > ( attribute ) ;
if ( attrib )
{
attrib - > m_buttonText = " Apply global min/max values " ;
}
}
else if ( & applyFullRangeMinMax = = field )
{
caf : : PdmUiPushButtonEditorAttribute * attrib = dynamic_cast < caf : : PdmUiPushButtonEditorAttribute * > ( attribute ) ;
if ( attrib )
{
attrib - > m_buttonText = " Apply full range " ;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig : : ternaryRanges ( double & soilLower , double & soilUpper , double & sgasLower , double & sgasUpper , double & swatLower , double & swatUpper ) const
{
if ( rangeMode ( ) = = AUTOMATIC_CURRENT_TIMESTEP )
{
soilLower = m_localAutoMin [ TERNARY_SOIL_IDX ] ;
soilUpper = m_localAutoMax [ TERNARY_SOIL_IDX ] ;
sgasLower = m_localAutoMin [ TERNARY_SGAS_IDX ] ;
sgasUpper = m_localAutoMax [ TERNARY_SGAS_IDX ] ;
swatLower = m_localAutoMin [ TERNARY_SWAT_IDX ] ;
swatUpper = m_localAutoMax [ TERNARY_SWAT_IDX ] ;
}
else if ( rangeMode ( ) = = AUTOMATIC_ALLTIMESTEPS )
{
soilLower = m_globalAutoMin [ TERNARY_SOIL_IDX ] ;
soilUpper = m_globalAutoMax [ TERNARY_SOIL_IDX ] ;
sgasLower = m_globalAutoMin [ TERNARY_SGAS_IDX ] ;
sgasUpper = m_globalAutoMax [ TERNARY_SGAS_IDX ] ;
swatLower = m_globalAutoMin [ TERNARY_SWAT_IDX ] ;
swatUpper = m_globalAutoMax [ TERNARY_SWAT_IDX ] ;
}
else
{
soilLower = userDefinedMinValueSoil ;
soilUpper = userDefinedMaxValueSoil ;
sgasLower = userDefinedMinValueSgas ;
sgasUpper = userDefinedMaxValueSgas ;
swatLower = userDefinedMinValueSwat ;
swatUpper = userDefinedMaxValueSwat ;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig : : updateLabelText ( )
{
{
2015-08-05 06:27:36 -05:00
userDefinedMinValueSoil . uiCapability ( ) - > setUiName ( " Min " ) ;
userDefinedMaxValueSoil . uiCapability ( ) - > setUiName ( " Max " ) ;
2014-05-06 15:39:53 -05:00
if ( m_globalAutoMin [ TERNARY_SOIL_IDX ] ! = cvf : : UNDEFINED_DOUBLE )
{
2015-08-05 06:27:36 -05:00
userDefinedMinValueSoil . uiCapability ( ) - > setUiName ( QString ( " Min " ) + " ( " + QString : : number ( m_globalAutoMin [ TERNARY_SOIL_IDX ] , ' g ' , precision ) + " ) " ) ;
2014-05-06 15:39:53 -05:00
}
if ( m_globalAutoMax [ TERNARY_SOIL_IDX ] ! = cvf : : UNDEFINED_DOUBLE )
{
2015-08-05 06:27:36 -05:00
userDefinedMaxValueSoil . uiCapability ( ) - > setUiName ( QString ( " Max " ) + " ( " + QString : : number ( m_globalAutoMax [ TERNARY_SOIL_IDX ] , ' g ' , precision ) + " ) " ) ;
2014-05-06 15:39:53 -05:00
}
}
{
2015-08-05 06:27:36 -05:00
userDefinedMinValueSgas . uiCapability ( ) - > setUiName ( " Min " ) ;
userDefinedMaxValueSgas . uiCapability ( ) - > setUiName ( " Max " ) ;
2014-05-06 15:39:53 -05:00
if ( m_globalAutoMin [ TERNARY_SGAS_IDX ] ! = cvf : : UNDEFINED_DOUBLE )
{
2015-08-05 06:27:36 -05:00
userDefinedMinValueSgas . uiCapability ( ) - > setUiName ( QString ( " Min " ) + " ( " + QString : : number ( m_globalAutoMin [ TERNARY_SGAS_IDX ] , ' g ' , precision ) + " ) " ) ;
2014-05-06 15:39:53 -05:00
}
if ( m_globalAutoMax [ TERNARY_SGAS_IDX ] ! = cvf : : UNDEFINED_DOUBLE )
{
2015-08-05 06:27:36 -05:00
userDefinedMaxValueSgas . uiCapability ( ) - > setUiName ( QString ( " Max " ) + " ( " + QString : : number ( m_globalAutoMax [ TERNARY_SGAS_IDX ] , ' g ' , precision ) + " ) " ) ;
2014-05-06 15:39:53 -05:00
}
}
{
2015-08-05 06:27:36 -05:00
userDefinedMinValueSwat . uiCapability ( ) - > setUiName ( " Min " ) ;
userDefinedMaxValueSwat . uiCapability ( ) - > setUiName ( " Max " ) ;
2014-05-06 15:39:53 -05:00
if ( m_globalAutoMin [ TERNARY_SWAT_IDX ] ! = cvf : : UNDEFINED_DOUBLE )
{
2015-08-05 06:27:36 -05:00
userDefinedMinValueSwat . uiCapability ( ) - > setUiName ( QString ( " Min " ) + " ( " + QString : : number ( m_globalAutoMin [ TERNARY_SWAT_IDX ] , ' g ' , precision ) + " ) " ) ;
2014-05-06 15:39:53 -05:00
}
if ( m_globalAutoMax [ TERNARY_SWAT_IDX ] ! = cvf : : UNDEFINED_DOUBLE )
{
2015-08-05 06:27:36 -05:00
userDefinedMaxValueSwat . uiCapability ( ) - > setUiName ( QString ( " Max " ) + " ( " + QString : : number ( m_globalAutoMax [ TERNARY_SWAT_IDX ] , ' g ' , precision ) + " ) " ) ;
2014-05-06 15:39:53 -05:00
}
}
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 " ;
ternaryRangeSummary = tmpString ;
}
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 " ;
ternaryRangeSummary = tmpString ;
}
}
2014-08-11 01:10:07 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2018-02-01 10:45:22 -06:00
const RivTernaryScalarMapper * RimTernaryLegendConfig : : scalarMapper ( ) const
2014-08-11 01:10:07 -05:00
{
2015-10-23 08:46:25 -05:00
return m_scalarMapper . p ( ) ;
2014-08-11 01:10:07 -05:00
}
2018-04-18 03:32:51 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf : : TitledOverlayFrame * RimTernaryLegendConfig : : titledOverlayFrame ( ) const
{
return m_legend . p ( ) ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf : : TitledOverlayFrame * RimTernaryLegendConfig : : titledOverlayFrame ( )
{
return m_legend . p ( ) ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2018-04-06 08:30:51 -05:00
caf : : PdmFieldHandle * RimTernaryLegendConfig : : objectToggleField ( )
{
2018-04-17 08:59:50 -05:00
return & m_showLegend ;
2018-04-06 08:30:51 -05:00
}