mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
Add annotation label support to surface intersection lines
This commit is contained in:
@@ -153,6 +153,14 @@ Rim3dView::Rim3dView()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fontSize, "FontSize", "Font Size" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_annotationStrategy, "AnnotationStrategy", "Annotation Strategy" );
|
||||
CAF_PDM_InitField( &m_annotationCountHint, "AnnotationCountHint", 5, "Annotation Count Hint" );
|
||||
CAF_PDM_InitField( &m_useCustomAnnotationStrategy,
|
||||
"UseCustomAnnotationStrategy",
|
||||
false,
|
||||
"Use Custom Annotation Strategy",
|
||||
"Specify the strategy to be applied on all screen space annotations." );
|
||||
|
||||
m_seismicVizModel = new cvf::ModelBasicList;
|
||||
m_seismicVizModel->setName( "SeismicSectionModel" );
|
||||
|
||||
@@ -509,6 +517,14 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr
|
||||
gridGroup->add( &meshMode );
|
||||
gridGroup->add( &surfaceMode );
|
||||
|
||||
caf::PdmUiGroup* annotationGroup = uiOrdering.addNewGroup( "Annotations" );
|
||||
annotationGroup->add( &m_useCustomAnnotationStrategy );
|
||||
annotationGroup->add( &m_annotationStrategy );
|
||||
annotationGroup->add( &m_annotationCountHint );
|
||||
m_annotationStrategy.uiCapability()->setUiReadOnly( !m_useCustomAnnotationStrategy );
|
||||
m_annotationCountHint.uiCapability()->setUiReadOnly(
|
||||
!m_useCustomAnnotationStrategy || ( m_annotationStrategy() != RivAnnotationTools::LabelPositionStrategy::COUNT_HINT ) );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
@@ -678,6 +694,8 @@ void Rim3dView::updateDisplayModelForCurrentTimeStepAndRedraw()
|
||||
restoreComparisonView();
|
||||
}
|
||||
|
||||
updateScreenSpaceModel();
|
||||
|
||||
nativeOrOverrideViewer()->update();
|
||||
}
|
||||
|
||||
@@ -742,6 +760,8 @@ void Rim3dView::createDisplayModelAndRedraw()
|
||||
viewer()->setMainScene( nullptr, true );
|
||||
viewer()->removeAllFrames( true );
|
||||
}
|
||||
|
||||
updateScreenSpaceModel();
|
||||
}
|
||||
|
||||
if ( RiuMainWindow::instance() )
|
||||
@@ -899,6 +919,14 @@ bool Rim3dView::isLightingDisabled() const
|
||||
return m_disableLighting();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dView::onViewNavigationChanged()
|
||||
{
|
||||
updateScreenSpaceModel();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1022,6 +1050,14 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const
|
||||
{
|
||||
createDisplayModelAndRedraw();
|
||||
}
|
||||
else if ( changedField == &m_annotationCountHint || changedField == &m_annotationStrategy || changedField == &m_useCustomAnnotationStrategy )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
updateScreenSpaceModel();
|
||||
m_viewer->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1637,6 +1673,36 @@ void Rim3dView::appendAnnotationsToModel()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dView::updateScreenSpaceModel()
|
||||
{
|
||||
if ( !m_viewer || !m_viewer->mainCamera() ) return;
|
||||
|
||||
if ( m_screenSpaceModel.isNull() )
|
||||
{
|
||||
m_screenSpaceModel = new cvf::ModelBasicList;
|
||||
m_screenSpaceModel->setName( "ScreenSpaceModel" );
|
||||
}
|
||||
m_screenSpaceModel->removeAllParts();
|
||||
|
||||
// Build annotation parts and put into screen space model
|
||||
cvf::Collection<cvf::Part> partCollection;
|
||||
m_viewer->currentScene()->allParts( &partCollection );
|
||||
|
||||
RivAnnotationTools annoTool;
|
||||
if ( m_useCustomAnnotationStrategy )
|
||||
{
|
||||
annoTool.setOverrideLabelPositionStrategy( m_annotationStrategy() );
|
||||
annoTool.setCountHint( m_annotationCountHint() );
|
||||
}
|
||||
|
||||
annoTool.addAnnotationLabels( partCollection, m_viewer->mainCamera(), m_screenSpaceModel.p() );
|
||||
|
||||
nativeOrOverrideViewer()->addStaticModelOnce( m_screenSpaceModel.p(), isUsingOverrideViewer() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -19,10 +19,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RimNameConfig.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include "RiuViewerToViewInterface.h"
|
||||
|
||||
#include "RivAnnotationTools.h"
|
||||
#include "RivCellSetEnum.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
@@ -247,6 +250,8 @@ protected:
|
||||
|
||||
virtual cvf::Transform* scaleTransform() = 0;
|
||||
|
||||
void onViewNavigationChanged() override;
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmFieldHandle* backgroundColorField();
|
||||
@@ -272,6 +277,7 @@ protected:
|
||||
cvf::ref<cvf::ModelBasicList> m_seismicVizModel;
|
||||
cvf::ref<RivWellPathsPartMgr> m_wellPathsPartManager;
|
||||
cvf::ref<cvf::ModelBasicList> m_highlightVizModel;
|
||||
cvf::ref<cvf::ModelBasicList> m_screenSpaceModel;
|
||||
|
||||
caf::PdmField<double> m_scaleZ;
|
||||
caf::PdmField<double> m_customScaleZ;
|
||||
@@ -306,6 +312,7 @@ private:
|
||||
void appendMeasurementToModel();
|
||||
void appendCellFiltersToModel();
|
||||
void appendAnnotationsToModel();
|
||||
void updateScreenSpaceModel();
|
||||
|
||||
// Pure private methods : Override viewer and comparison view
|
||||
|
||||
@@ -332,6 +339,10 @@ private:
|
||||
caf::PdmField<bool> m_showZScaleLabel;
|
||||
caf::PdmPtrField<Rim3dView*> m_comparisonView;
|
||||
|
||||
caf::PdmField<bool> m_useCustomAnnotationStrategy;
|
||||
caf::PdmField<caf::AppEnum<RivAnnotationTools::LabelPositionStrategy>> m_annotationStrategy;
|
||||
caf::PdmField<int> m_annotationCountHint;
|
||||
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_fontSize;
|
||||
|
||||
// 3D display model data
|
||||
|
||||
Reference in New Issue
Block a user