#51 Add background to standard legends. Needed a separate legend implementation, now in caf. Cleaned up CategoryLegend to make it ready for the new background.

This commit is contained in:
Jacob Støren
2018-03-08 11:20:27 +01:00
parent 00236c493e
commit c258528dc5
14 changed files with 1258 additions and 107 deletions

View File

@@ -82,10 +82,10 @@
#include "cafDisplayCoordTransform.h"
#include "cafFrameAnimationControl.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafOverlayScalarMapperLegend.h"
#include "cvfDrawable.h"
#include "cvfModelBasicList.h"
#include "cvfOverlayScalarMapperLegend.h"
#include "cvfPart.h"
#include "cvfScene.h"
#include "cvfViewport.h"

View File

@@ -55,9 +55,9 @@
#include "cafFrameAnimationControl.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafProgressInfo.h"
#include "cafOverlayScalarMapperLegend.h"
#include "cvfModelBasicList.h"
#include "cvfOverlayScalarMapperLegend.h"
#include "cvfPart.h"
#include "cvfScene.h"
#include "cvfTransform.h"

View File

@@ -32,6 +32,7 @@
#include "cafCategoryLegend.h"
#include "cafCategoryMapper.h"
#include "cafOverlayScalarMapperLegend.h"
#include "cafFactory.h"
#include "cafPdmFieldCvfColor.h"
@@ -39,7 +40,6 @@
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiLineEditor.h"
#include "cvfOverlayScalarMapperLegend.h"
#include "cvfScalarMapperContinuousLinear.h"
#include "cvfScalarMapperContinuousLog.h"
#include "cvfScalarMapperDiscreteLinear.h"
@@ -143,7 +143,7 @@ RimLegendConfig::RimLegendConfig()
m_categoryMapper = new caf::CategoryMapper;
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
m_scalarMapperLegend = new cvf::OverlayScalarMapperLegend(standardFont);
m_scalarMapperLegend = new caf::OverlayScalarMapperLegend(standardFont);
m_categoryLegend = new caf::CategoryLegend(standardFont, m_categoryMapper.p());
updateFieldVisibility();
@@ -359,7 +359,7 @@ void RimLegendConfig::updateLegend()
// Using Fixed format
NumberFormatType nft = m_tickNumberFormat();
m_scalarMapperLegend->setTickFormat((cvf::OverlayScalarMapperLegend::NumberFormat)nft);
m_scalarMapperLegend->setTickFormat((caf::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();
@@ -510,7 +510,7 @@ void RimLegendConfig::recreateLegend()
// the legend disappeared because of this, so workaround: recreate the legend when needed:
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
m_scalarMapperLegend = new cvf::OverlayScalarMapperLegend(standardFont);
m_scalarMapperLegend = new caf::OverlayScalarMapperLegend(standardFont);
m_categoryLegend = new caf::CategoryLegend(standardFont, m_categoryMapper.p());
updateLegend();

View File

@@ -33,7 +33,6 @@ namespace cvf
class ScalarMapperContinuousLog;
class ScalarMapperContinuousLinear;
class OverlayItem;
class OverlayScalarMapperLegend;
class ScalarMapperDiscreteLinear;
class ScalarMapperDiscreteLog;
class ScalarMapper;
@@ -44,6 +43,7 @@ namespace caf
{
class CategoryLegend;
class CategoryMapper;
class OverlayScalarMapperLegend;
}
class Rim3dView;
@@ -146,7 +146,7 @@ private:
cvf::ref<cvf::ScalarMapperContinuousLinear> m_linSmoothScalarMapper;
cvf::ref<cvf::ScalarMapper> m_currentScalarMapper;
cvf::ref<cvf::OverlayScalarMapperLegend> m_scalarMapperLegend;
cvf::ref<caf::OverlayScalarMapperLegend> m_scalarMapperLegend;
cvf::ref<caf::CategoryMapper> m_categoryMapper;
cvf::ref<caf::CategoryLegend> m_categoryLegend;

View File

@@ -40,6 +40,7 @@
#include "RiuViewerCommands.h"
#include "cafCategoryLegend.h"
#include "cafOverlayScalarMapperLegend.h"
#include "cafCeetronPlusNavigation.h"
#include "cafDisplayCoordTransform.h"
#include "cafEffectGenerator.h"
@@ -49,7 +50,6 @@
#include "cvfFont.h"
#include "cvfOpenGLResourceManager.h"
#include "cvfOverlayAxisCross.h"
#include "cvfOverlayScalarMapperLegend.h"
#include "cvfRenderQueueSorter.h"
#include "cvfRenderSequence.h"
#include "cvfRendering.h"
@@ -908,17 +908,17 @@ void RiuViewer::updateLegendTextAndTickMarkColor(cvf::OverlayItem* legend)
cvf::Color3f contrastColor = computeContrastColor();
cvf::OverlayScalarMapperLegend* scalarMapperLegend = dynamic_cast<cvf::OverlayScalarMapperLegend*>(legend);
caf::OverlayScalarMapperLegend* scalarMapperLegend = dynamic_cast<caf::OverlayScalarMapperLegend*>(legend);
if (scalarMapperLegend)
{
scalarMapperLegend->setColor(contrastColor);
scalarMapperLegend->setTextColor(contrastColor);
scalarMapperLegend->setLineColor(contrastColor);
}
caf::CategoryLegend* categoryLegend = dynamic_cast<caf::CategoryLegend*>(legend);
if (categoryLegend)
{
categoryLegend->setColor(contrastColor);
categoryLegend->setTextColor(contrastColor);
categoryLegend->setLineColor(contrastColor);
}

View File

@@ -81,11 +81,11 @@
#include "cafDisplayCoordTransform.h"
#include "cafPdmUiTreeView.h"
#include "cafSelectionManager.h"
#include "cafOverlayScalarMapperLegend.h"
#include "cvfDrawableGeo.h"
#include "cvfHitItemCollection.h"
#include "cvfOverlayAxisCross.h"
#include "cvfOverlayScalarMapperLegend.h"
#include "cvfPart.h"
#include "cvfTransform.h"