#2426 Add working legends to 2D intersection Views. Refactor to make legend update code work from a separate view with separate legend configs. Make sure legend and results are updated as the main view is updated. Adjust legendconfig->setTitle to use QString

This commit is contained in:
Jacob Støren
2018-02-01 17:45:22 +01:00
parent a4eb16883b
commit 29ac24f3dd
29 changed files with 428 additions and 225 deletions

View File

@@ -23,6 +23,7 @@
#include "RiaColorTables.h"
#include "RimEclipseView.h"
#include "RimIntersectionCollection.h"
#include "RimViewLinker.h"
#include "RivTernarySaturationOverlayItem.h"
@@ -146,7 +147,7 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
updateLabelText();
updateLegend();
Rim3dView* view = nullptr;
RimGridView* view = nullptr;
this->firstAncestorOrThisOfType(view);
if (view)
@@ -158,6 +159,7 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
}
view->updateCurrentTimeStepAndRedraw();
view->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
}
@@ -244,6 +246,7 @@ void RimTernaryLegendConfig::setUiValuesFromLegendConfig(const RimTernaryLegendC
{
QString serializedObjectString = otherLegendConfig->writeObjectToXmlString();
this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance());
this->updateLegend();
}
//--------------------------------------------------------------------------------------------------
@@ -316,6 +319,14 @@ void RimTernaryLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RivTernarySaturationOverlayItem* RimTernaryLegendConfig::legend() const
{
return m_legend.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -324,6 +335,14 @@ RivTernarySaturationOverlayItem* RimTernaryLegendConfig::legend()
return m_legend.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig::setTitle(const QString& title)
{
m_legend->setTitle(cvfqt::Utils::toString(title));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -462,7 +481,7 @@ void RimTernaryLegendConfig::updateLabelText()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivTernaryScalarMapper* RimTernaryLegendConfig::scalarMapper()
const RivTernaryScalarMapper* RimTernaryLegendConfig::scalarMapper() const
{
return m_scalarMapper.p();
}