#1053 Disabled the All Timesteps option in Legend range selection

This commit is contained in:
Jacob Støren 2017-01-03 14:58:34 +01:00
parent 5f6468898b
commit 5aed8ea939
3 changed files with 31 additions and 3 deletions

View File

@ -1024,6 +1024,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
CVF_ASSERT(resultColors->legendConfig());
resultColors->legendConfig()->disableAllTimeStepsRange(true);
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
@ -1033,8 +1034,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
}
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable()));
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + QString::fromStdString( resultColors->flowDiagResAddress().uiText())));
}
else
{
@ -1061,6 +1061,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
CVF_ASSERT(resultColors->legendConfig());
resultColors->legendConfig()->disableAllTimeStepsRange(false);
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);

View File

@ -113,7 +113,8 @@ RimLegendConfig::RimLegendConfig()
m_globalAutoPosClosestToZero(0),
m_globalAutoNegClosestToZero(0),
m_localAutoPosClosestToZero(0),
m_localAutoNegClosestToZero(0)
m_localAutoNegClosestToZero(0),
m_isAllTimeStepsRangeDisabled(false)
{
CAF_PDM_InitObject("Legend Definition", ":/Legend.png", "", "");
CAF_PDM_InitField(&m_numLevels, "NumberOfLevels", 8, "Number of levels", "", "A hint on how many tick marks you whish.","");
@ -488,6 +489,21 @@ void RimLegendConfig::updateLegend()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimLegendConfig::disableAllTimeStepsRange(bool doDisable)
{
// If we enable AllTimesteps, and we have used current timestep, then "restore" the default
if (m_isAllTimeStepsRangeDisabled && !doDisable && m_rangeMode == AUTOMATIC_CURRENT_TIMESTEP) m_rangeMode = AUTOMATIC_ALLTIMESTEPS;
m_isAllTimeStepsRangeDisabled = doDisable;
if (doDisable && m_rangeMode == AUTOMATIC_ALLTIMESTEPS) m_rangeMode = AUTOMATIC_CURRENT_TIMESTEP;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -890,6 +906,14 @@ QList<caf::PdmOptionItemInfo> RimLegendConfig::calculateValueOptions(const caf::
optionList.push_back(caf::PdmOptionItemInfo(ColorRangeEnum::uiText(colType), colType));
}
}
else if (fieldNeedingOptions == &m_rangeMode)
{
if (!m_isAllTimeStepsRangeDisabled) {
optionList.push_back(caf::PdmOptionItemInfo(RangeModeEnum::uiText(RimLegendConfig::AUTOMATIC_ALLTIMESTEPS), RimLegendConfig::AUTOMATIC_ALLTIMESTEPS));
}
optionList.push_back(caf::PdmOptionItemInfo(RangeModeEnum::uiText(RimLegendConfig::AUTOMATIC_CURRENT_TIMESTEP), RimLegendConfig::AUTOMATIC_CURRENT_TIMESTEP));
optionList.push_back(caf::PdmOptionItemInfo(RangeModeEnum::uiText(RimLegendConfig::USER_DEFINED), RimLegendConfig::USER_DEFINED));
}
return optionList;
}

View File

@ -101,6 +101,7 @@ public:
ColorRangesType colorRangeMode() { return m_colorRangeMode();}
void setMappingMode(MappingType mappingType);
MappingType mappingMode() { return m_mappingMode();}
void disableAllTimeStepsRange(bool doDisable);
void setAutomaticRanges(double globalMin, double globalMax, double localMin, double localMax);
void setClosestToZeroValues(double globalPosClosestToZero, double globalNegClosestToZero, double localPosClosestToZero, double localNegClosestToZero);
@ -150,6 +151,8 @@ private:
double m_localAutoPosClosestToZero;
double m_localAutoNegClosestToZero;
bool m_isAllTimeStepsRangeDisabled;
std::vector<int> m_categories;
std::vector<cvf::String> m_categoryNames;