(#805) Cleaned up includes and generalized access to overlayItemLegend

This commit is contained in:
Magne Sjaastad 2016-08-01 22:27:03 +02:00
parent 2b588fa35f
commit 23bd3c9b0c
17 changed files with 96 additions and 58 deletions

View File

@ -25,8 +25,8 @@
#include "RimEclipseView.h"
#include "RimGeoMechCellColors.h"
#include "RimLegendConfig.h"
#include "RimGeoMechView.h"
#include "RimLegendConfig.h"
#include "RivResultToTextureMapper.h"
#include "RivScalarMapperUtils.h"

View File

@ -32,6 +32,7 @@
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimLegendConfig.h"
#include "RimTernaryLegendConfig.h"
#include "RivTernaryTextureCoordsCreator.h"

View File

@ -34,6 +34,7 @@
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechView.h"
#include "RimLegendConfig.h"
#include "RimTernaryLegendConfig.h"
#include "RivCrossSectionSourceInfo.h"

View File

@ -27,9 +27,10 @@
#include "RigResultAccessor.h"
#include "RimEclipseCase.h"
#include "RimFaultCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimFaultCollection.h"
#include "RimLegendConfig.h"
#include "RimTernaryLegendConfig.h"
#include "RivResultToTextureMapper.h"

View File

@ -27,13 +27,14 @@
#include "RigCaseData.h"
#include "RigResultAccessorFactory.h"
#include "RimEclipseCase.h"
#include "RimCellEdgeColors.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimEclipseView.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimTernaryLegendConfig.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimLegendConfig.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimTernaryLegendConfig.h"
#include "RivCellEdgeEffectGenerator.h"
#include "RivResultToTextureMapper.h"

View File

@ -20,9 +20,9 @@
#include "RivScalarMapperUtils.h"
#include "RimCellEdgeColors.h"
#include "RimLegendConfig.h"
#include "RimEclipseView.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimLegendConfig.h"
#include "RimTernaryLegendConfig.h"
#include "RivCellEdgeEffectGenerator.h"

View File

@ -19,15 +19,19 @@
#include "RivTextureCoordsCreator.h"
#include "RimEclipseCellColors.h"
#include "RigCaseData.h"
#include "RimEclipseView.h"
#include "RimEclipseCase.h"
#include "RigCaseCellResultsData.h"
#include "RigResultAccessorFactory.h"
#include "RigCaseData.h"
#include "RigPipeInCellEvaluator.h"
#include "RivResultToTextureMapper.h"
#include "RigResultAccessorFactory.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimLegendConfig.h"
#include "RivResultToTextureMapper.h"
//--------------------------------------------------------------------------------------------------
///

View File

@ -22,40 +22,40 @@
#include "RivWellHeadPartMgr.h"
#include "cvfLibCore.h"
#include "cvfModelBasicList.h"
#include "cvfTransform.h"
#include "cvfPart.h"
#include "cvfArrowGenerator.h"
#include "cafEffectGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfPrimitiveSetIndexedUShort.h"
#include "cvfGeometryBuilderFaceList.h"
#include "cvfDrawableText.h"
#include "cvfFixedAtlasFont.h"
#include "cvfqtUtils.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "cafPdmFieldCvfMat4d.h"
#include "RimCellEdgeColors.h"
#include "RimCellRangeFilterCollection.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimEclipseCellColors.h"
#include "RimLegendConfig.h"
#include "RimEclipseCase.h"
#include "RimEclipseWell.h"
#include "RiaApplication.h"
#include "RigCaseData.h"
#include "RigCell.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimCellEdgeColors.h"
#include "RimCellRangeFilterCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RimLegendConfig.h"
#include "RimReservoirCellResultsStorage.h"
#include "RivPipeGeometryGenerator.h"
#include "RivWellPipesPartMgr.h"
#include "RiaApplication.h"
#include "cafEffectGenerator.h"
#include "cafPdmFieldCvfMat4d.h"
#include "cvfArrowGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfDrawableText.h"
#include "cvfFixedAtlasFont.h"
#include "cvfGeometryBuilderFaceList.h"
#include "cvfLibCore.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfPrimitiveSetIndexedUShort.h"
#include "cvfTransform.h"
#include "cvfqtUtils.h"
//--------------------------------------------------------------------------------------------------

View File

@ -21,11 +21,13 @@
#include "RimCellEdgeColors.h"
#include "RigCaseCellResultsData.h"
#include "RimEclipseView.h"
#include "RimLegendConfig.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimEclipseView.h"
#include "cafPdmUiListEditor.h"
#include "cvfMath.h"

View File

@ -22,6 +22,7 @@
#include "RimEclipseFaultColors.h"
#include "RimEclipseView.h"
#include "RimLegendConfig.h"
#include "RimTernaryLegendConfig.h"
#include "RimViewController.h"
#include "RimViewLinker.h"

View File

@ -21,7 +21,6 @@
#pragma once
#include "RimDefines.h"
#include "RimLegendConfig.h"
#include "RimEclipseResultDefinition.h"
#include "cafPdmChildArrayField.h"
@ -29,6 +28,7 @@
#include "cafPdmPtrField.h"
class RimTernaryLegendConfig;
class RimLegendConfig;
//==================================================================================================
///

View File

@ -25,6 +25,7 @@
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimLegendConfig.h"
#include "RimTernaryLegendConfig.h"
#include "RiuMainWindow.h"

View File

@ -41,6 +41,7 @@
#include "RimEclipseWellCollection.h"
#include "RimFaultCollection.h"
#include "RimGridCollection.h"
#include "RimLegendConfig.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimTernaryLegendConfig.h"
@ -943,7 +944,12 @@ void RimEclipseView::updateLegends()
this->cellEdgeResult()->legendConfig->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig->legend());
this->cellEdgeResult()->legendConfig->legend()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariable));
cvf::OverlayScalarMapperLegend* scalarMapperLegend = dynamic_cast<cvf::OverlayScalarMapperLegend*>(this->cellEdgeResult()->legendConfig->legend());
if (scalarMapperLegend)
{
scalarMapperLegend->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariable));
}
}
else
{
@ -986,7 +992,12 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->legend()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable()));
cvf::OverlayScalarMapperLegend* scalarMapperLegend = dynamic_cast<cvf::OverlayScalarMapperLegend*>(resultColors->legendConfig()->legend());
if (scalarMapperLegend)
{
scalarMapperLegend->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable()));
}
}

View File

@ -435,7 +435,11 @@ void RimGeoMechView::updateLegends()
legendTitle += " [Bar]";
}
cellResult()->legendConfig->legend()->setTitle(legendTitle);
cvf::OverlayScalarMapperLegend* scalarMapperLegend = dynamic_cast<cvf::OverlayScalarMapperLegend*>(cellResult()->legendConfig->legend());
if (scalarMapperLegend)
{
scalarMapperLegend->setTitle(legendTitle);
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -20,6 +20,10 @@
#include "RimLegendConfig.h"
#include "RiaApplication.h"
#include "RimEclipseView.h"
#include "cafFactory.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h"
@ -34,9 +38,6 @@
#include <cmath>
#include "RiaApplication.h"
#include "RimEclipseView.h"
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
@ -124,7 +125,7 @@ RimLegendConfig::RimLegendConfig()
m_currentScalarMapper = m_linDiscreteScalarMapper;
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
m_legend = new cvf::OverlayScalarMapperLegend(standardFont);
m_scalarMapperLegend = new cvf::OverlayScalarMapperLegend(standardFont);
updateFieldVisibility();
updateLegend();
@ -358,7 +359,7 @@ void RimLegendConfig::updateLegend()
break;
}
m_legend->setScalarMapper(m_currentScalarMapper.p());
m_scalarMapperLegend->setScalarMapper(m_currentScalarMapper.p());
double decadesInRange = 0;
if (m_mappingMode == LOG10_CONTINUOUS || m_mappingMode == LOG10_DISCRETE)
@ -378,7 +379,7 @@ void RimLegendConfig::updateLegend()
// Using Fixed format
NumberFormatType nft = m_tickNumberFormat();
m_legend->setTickFormat((cvf::OverlayScalarMapperLegend::NumberFormat)nft);
m_scalarMapperLegend->setTickFormat((cvf::OverlayScalarMapperLegend::NumberFormat)nft);
// Set the fixed number of digits after the decimal point to the number needed to show all the significant digits.
int numDecimalDigits = m_precision();
@ -386,7 +387,7 @@ void RimLegendConfig::updateLegend()
{
numDecimalDigits -= static_cast<int>(decadesInRange);
}
m_legend->setTickPrecision(cvf::Math::clamp(numDecimalDigits, 0, 20));
m_scalarMapperLegend->setTickPrecision(cvf::Math::clamp(numDecimalDigits, 0, 20));
if (m_globalAutoMax != cvf::UNDEFINED_DOUBLE )
@ -546,7 +547,7 @@ void RimLegendConfig::recreateLegend()
// the legend disappeared because of this, so workaround: recreate the legend when needed:
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
m_legend = new cvf::OverlayScalarMapperLegend(standardFont);
m_scalarMapperLegend = new cvf::OverlayScalarMapperLegend(standardFont);
updateLegend();
}
@ -619,6 +620,14 @@ void RimLegendConfig::setClosestToZeroValues(double globalPosClosestToZero, doub
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::OverlayItem* RimLegendConfig::legend()
{
return m_scalarMapperLegend.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -33,6 +33,7 @@ namespace cvf
{
class ScalarMapperContinuousLog;
class ScalarMapperContinuousLinear;
class OverlayItem;
class OverlayScalarMapperLegend;
class ScalarMapperDiscreteLinear;
class ScalarMapperDiscreteLog;
@ -95,7 +96,7 @@ public:
void setClosestToZeroValues(double globalPosClosestToZero, double globalNegClosestToZero, double localPosClosestToZero, double localNegClosestToZero);
cvf::ScalarMapper* scalarMapper() { return m_currentScalarMapper.p(); }
cvf::OverlayScalarMapperLegend* legend() { return m_legend.p(); }
cvf::OverlayItem* legend();
protected:
@ -118,7 +119,7 @@ private:
cvf::ref<cvf::ScalarMapperContinuousLinear> m_linSmoothScalarMapper;
cvf::ref<cvf::ScalarMapper> m_currentScalarMapper;
cvf::ref<cvf::OverlayScalarMapperLegend> m_legend;
cvf::ref<cvf::OverlayScalarMapperLegend> m_scalarMapperLegend;
double m_globalAutoMax;
double m_globalAutoMin;

View File

@ -44,6 +44,7 @@
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechView.h"
#include "RimLegendConfig.h"
#include "RimTernaryLegendConfig.h"
#include "RimViewController.h"
#include "RimWellPath.h"