#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

@@ -51,6 +51,7 @@
#include "cvfqtUtils.h"
#include <cmath>
#include "RimIntersectionCollection.h"
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
@@ -191,7 +192,7 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
updateLegend();
Rim3dView* view = nullptr;
RimGridView* view = nullptr;
this->firstAncestorOrThisOfType(view);
if (view)
@@ -203,6 +204,8 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
}
view->updateCurrentTimeStepAndRedraw();
view->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
@@ -664,10 +667,11 @@ QString RimLegendConfig::categoryNameFromCategoryValue(double categoryResultValu
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimLegendConfig::setTitle(const cvf::String& title)
void RimLegendConfig::setTitle(const QString& title)
{
m_scalarMapperLegend->setTitle(title);
m_categoryLegend->setTitle(title);
auto cvfTitle = cvfqt::Utils::toString(title);
m_scalarMapperLegend->setTitle(cvfTitle);
m_categoryLegend->setTitle(cvfTitle);
}
//--------------------------------------------------------------------------------------------------
@@ -692,6 +696,7 @@ void RimLegendConfig::setUiValuesFromLegendConfig(const RimLegendConfig* otherLe
{
QString serializedObjectString = otherLegendConfig->writeObjectToXmlString();
this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance());
this->updateLegend();
}
//--------------------------------------------------------------------------------------------------