Refactored after review

This commit is contained in:
Gaute Lindkvist
2018-04-09 11:51:30 +02:00
parent fe56375be6
commit b6fb60115a
18 changed files with 62 additions and 67 deletions

View File

@@ -603,7 +603,7 @@ void Rim2dIntersectionView::updateLegends()
if ( legend )
{
m_viewer->addColorLegendToBottomLeftCorner(legend, this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(legend);
}
}

View File

@@ -69,7 +69,7 @@ public:
bool showDefiningPoints() const;
protected:
void updateLegends();
void updateLegends() override;
virtual bool isGridVisualizationMode() const override;
virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) override;

View File

@@ -736,6 +736,7 @@ void Rim3dView::applyBackgroundColor()
}
updateGridBoxData();
updateAnnotationItems();
updateLegends();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -132,6 +132,7 @@ public:
void createHighlightAndGridBoxDisplayModelWithRedraw();
void updateGridBoxData();
void updateAnnotationItems();
virtual void updateLegends() = 0;
bool isMasterView() const;
@@ -157,7 +158,7 @@ protected:
// Implementation of RiuViewerToViewInterface
virtual cvf::Color3f backgroundColor() const override { return m_backgroundColor(); }
virtual void applyBackgroundColor();
void applyBackgroundColor();
// Abstract methods to implement in subclasses

View File

@@ -1087,7 +1087,7 @@ void RimEclipseView::updateLegends()
}
}
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend(), this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend());
this->cellEdgeResult()->legendConfig()->setTitle(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName());
}
else
@@ -1104,7 +1104,7 @@ void RimEclipseView::updateLegends()
if (fractureColors()->isChecked() && stimPlanLegend->legend())
{
m_viewer->addColorLegendToBottomLeftCorner(stimPlanLegend->legend(), this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(stimPlanLegend->legend());
}
}
@@ -1113,7 +1113,7 @@ void RimEclipseView::updateLegends()
updateVirtualConnectionLegendRanges();
RimLegendConfig* virtLegend = m_virtualPerforationResult->legendConfig();
m_viewer->addColorLegendToBottomLeftCorner(virtLegend->legend(), this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(virtLegend->legend());
}
}
@@ -1128,7 +1128,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel,
if (resultColors->hasResult() && resultColors->legendConfig()->enableLegend())
{
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend(), this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->setTitle(legendLabel + resultColors->resultVariableUiShortName());
}
@@ -1138,7 +1138,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel,
if (resultColors->ternaryLegendConfig->enableLegend() && resultColors->ternaryLegendConfig->legend())
{
resultColors->ternaryLegendConfig->setTitle(legendLabel);
m_viewer->addColorLegendToBottomLeftCorner(resultColors->ternaryLegendConfig->legend(), this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(resultColors->ternaryLegendConfig->legend());
}
}
}
@@ -1598,12 +1598,10 @@ void RimEclipseView::resetLegendsInViewer()
if (cellResultNormalLegendConfig)
{
m_viewer->addColorLegendToBottomLeftCorner(cellResultNormalLegendConfig->legend(),
this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(cellResultNormalLegendConfig->legend());
}
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend(),
this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend());
}
//--------------------------------------------------------------------------------------------------
@@ -1739,15 +1737,6 @@ bool RimEclipseView::showActiveCellsOnly()
return !m_showInactiveCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::applyBackgroundColor()
{
Rim3dView::applyBackgroundColor();
this->updateLegends();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -147,7 +147,6 @@ protected:
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) override;
virtual bool showActiveCellsOnly() override;
virtual void applyBackgroundColor() override;
private:
void createDisplayModel() override;
@@ -160,7 +159,7 @@ private:
virtual void updateStaticCellColors() override;
void updateStaticCellColors(RivCellSetEnum geometryType);
void updateLegends();
void updateLegends() override;
void updateMinMaxValuesAndAddLegendToView(QString legendLabel, RimEclipseCellColors* resultColors, RigCaseCellResultsData* cellResultsData);
virtual void resetLegendsInViewer() override;
void updateVirtualConnectionLegendRanges();

View File

@@ -364,8 +364,7 @@ void RimGeoMechView::resetLegendsInViewer()
this->cellResult()->legendConfig->recreateLegend();
m_viewer->removeAllColorLegends();
m_viewer->addColorLegendToBottomLeftCorner(this->cellResult()->legendConfig->legend(),
this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(this->cellResult()->legendConfig->legend());
}
//--------------------------------------------------------------------------------------------------
@@ -379,18 +378,19 @@ void RimGeoMechView::updateLegends()
this->updateLegendTextAndRanges(cellResult()->legendConfig(), m_currentTimeStep());
if (cellResult()->hasResult())
if (cellResult()->hasResult() && cellResult()->legendConfig()->enableLegend())
{
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend(),
this->backgroundColor());
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend());
}
updateTensorLegendTextAndRanges(m_tensorResults->arrowColorLegendConfig(), m_currentTimeStep());
if (tensorResults()->vectorColors() == RimTensorResults::RESULT_COLORS && tensorResults()->showTensors())
{
m_viewer->addColorLegendToBottomLeftCorner(m_tensorResults->arrowColorLegendConfig->legend(),
this->backgroundColor());
if (tensorResults()->arrowColorLegendConfig()->enableLegend())
{
m_viewer->addColorLegendToBottomLeftCorner(m_tensorResults->arrowColorLegendConfig->legend());
}
}
}
}

View File

@@ -110,7 +110,7 @@ private:
virtual void resetLegendsInViewer() override;
void updateLegends();
void updateLegends() override;
void updateTensorLegendTextAndRanges(RimLegendConfig* legendConfig, int timeStepIndex);

View File

@@ -371,7 +371,7 @@ void RimLegendConfig::updateLegend()
numDecimalDigits -= static_cast<int>(decadesInRange);
}
m_scalarMapperLegend->setTickPrecision(cvf::Math::clamp(numDecimalDigits, 0, 20));
m_scalarMapperLegend->computeLayoutAndExtents();
m_scalarMapperLegend->computeLayoutAndExtents(cvf::Vec2i(0, 0), m_scalarMapperLegend->sizeHint());
RiaApplication* app = RiaApplication::instance();
RiaPreferences* preferences = app->preferences();