Set background and frame color from the view plus update frame margins.

This commit is contained in:
Gaute Lindkvist
2018-04-09 13:14:19 +02:00
parent 507229f84b
commit 63ffade452
14 changed files with 90 additions and 51 deletions
@@ -603,7 +603,7 @@ void Rim2dIntersectionView::updateLegends()
if ( legend )
{
m_viewer->addColorLegendToBottomLeftCorner(legend);
m_viewer->addColorLegendToBottomLeftCorner(legend, this->backgroundColor());
}
}
+14 -6
View File
@@ -583,12 +583,7 @@ void Rim3dView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const
}
else if (changedField == &m_backgroundColor)
{
if (m_viewer != nullptr)
{
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
}
updateGridBoxData();
updateAnnotationItems();
this->applyBackgroundColor();
}
else if (changedField == &maximumFrameRate)
{
@@ -730,6 +725,19 @@ void Rim3dView::createHighlightAndGridBoxDisplayModel()
m_viewer->showGridBox(m_showGridBox());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::applyBackgroundColor()
{
if (m_viewer != nullptr)
{
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
}
updateGridBoxData();
updateAnnotationItems();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
+4 -1
View File
@@ -155,6 +155,10 @@ protected:
void createHighlightAndGridBoxDisplayModel();
// Implementation of RiuViewerToViewInterface
virtual cvf::Color3f backgroundColor() const override { return m_backgroundColor(); }
virtual void applyBackgroundColor();
// Abstract methods to implement in subclasses
virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) = 0;
@@ -206,7 +210,6 @@ private:
// Implementation of RiuViewerToViewInterface
virtual cvf::Color3f backgroundColor() const override { return m_backgroundColor();}
virtual void setCameraPosition(const cvf::Mat4d& cameraPosition) override { m_cameraPosition = cameraPosition; }
virtual void setCameraPointOfInterest(const cvf::Vec3d& cameraPointOfInterest) override { m_cameraPointOfInterest = cameraPointOfInterest;}
virtual QString timeStepName(int frameIdx) const override;
@@ -1085,7 +1085,7 @@ void RimEclipseView::updateLegends()
}
}
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend());
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend(), this->backgroundColor());
this->cellEdgeResult()->legendConfig()->setTitle(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName());
}
else
@@ -1101,7 +1101,7 @@ void RimEclipseView::updateLegends()
if (fractureColors()->isChecked() && stimPlanLegend->legend())
{
m_viewer->addColorLegendToBottomLeftCorner(stimPlanLegend->legend());
m_viewer->addColorLegendToBottomLeftCorner(stimPlanLegend->legend(), this->backgroundColor());
}
}
@@ -1111,7 +1111,7 @@ void RimEclipseView::updateLegends()
RimLegendConfig* virtLegend = m_virtualPerforationResult->legendConfig();
m_viewer->addColorLegendToBottomLeftCorner(virtLegend->legend());
m_viewer->addColorLegendToBottomLeftCorner(virtLegend->legend(), this->backgroundColor());
}
}
@@ -1126,7 +1126,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel,
if (resultColors->hasResult())
{
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend(), this->backgroundColor());
resultColors->legendConfig()->setTitle(legendLabel + resultColors->resultVariableUiShortName());
}
@@ -1136,7 +1136,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel,
if (resultColors->ternaryLegendConfig->legend())
{
resultColors->ternaryLegendConfig->setTitle(legendLabel);
m_viewer->addColorLegendToBottomLeftCorner(resultColors->ternaryLegendConfig->legend());
m_viewer->addColorLegendToBottomLeftCorner(resultColors->ternaryLegendConfig->legend(), this->backgroundColor());
}
}
}
@@ -1594,9 +1594,14 @@ void RimEclipseView::resetLegendsInViewer()
m_viewer->removeAllColorLegends();
if (cellResultNormalLegendConfig) m_viewer->addColorLegendToBottomLeftCorner(cellResultNormalLegendConfig->legend());
if (cellResultNormalLegendConfig)
{
m_viewer->addColorLegendToBottomLeftCorner(cellResultNormalLegendConfig->legend(),
this->backgroundColor());
}
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend());
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend(),
this->backgroundColor());
}
//--------------------------------------------------------------------------------------------------
@@ -1732,6 +1737,15 @@ bool RimEclipseView::showActiveCellsOnly()
return !m_showInactiveCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::applyBackgroundColor()
{
Rim3dView::applyBackgroundColor();
this->updateLegends();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -147,6 +147,7 @@ protected:
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) override;
virtual bool showActiveCellsOnly() override;
virtual void applyBackgroundColor() override;
private:
void createDisplayModel() override;
@@ -364,7 +364,8 @@ void RimGeoMechView::resetLegendsInViewer()
this->cellResult()->legendConfig->recreateLegend();
m_viewer->removeAllColorLegends();
m_viewer->addColorLegendToBottomLeftCorner(this->cellResult()->legendConfig->legend());
m_viewer->addColorLegendToBottomLeftCorner(this->cellResult()->legendConfig->legend(),
this->backgroundColor());
}
//--------------------------------------------------------------------------------------------------
@@ -380,14 +381,16 @@ void RimGeoMechView::updateLegends()
if (cellResult()->hasResult())
{
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend());
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend(),
this->backgroundColor());
}
updateTensorLegendTextAndRanges(m_tensorResults->arrowColorLegendConfig(), m_currentTimeStep());
if (tensorResults()->vectorColors() == RimTensorResults::RESULT_COLORS && tensorResults()->showTensors())
{
m_viewer->addColorLegendToBottomLeftCorner(m_tensorResults->arrowColorLegendConfig->legend());
m_viewer->addColorLegendToBottomLeftCorner(m_tensorResults->arrowColorLegendConfig->legend(),
this->backgroundColor());
}
}
}