Merge pull request #4985 from OPM/feature-fix-point-manipulators-in-comparison-view

#4981 Fix well target manipulators not responding
This commit is contained in:
Jacob Støren 2019-11-05 15:42:02 +01:00 committed by GitHub
commit 58c1734334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 15 deletions

View File

@ -42,6 +42,7 @@
RivGridBoxGenerator::RivGridBoxGenerator()
: m_gridColor( cvf::Color3f::LIGHT_GRAY )
, m_gridLegendColor( cvf::Color3f::BLACK )
, m_needsRegeneration( true )
{
m_gridBoxModel = new cvf::ModelBasicList();
m_gridBoxModel->setName( "GridBoxModel" );
@ -55,6 +56,8 @@ RivGridBoxGenerator::RivGridBoxGenerator()
//--------------------------------------------------------------------------------------------------
void RivGridBoxGenerator::setScaleZ( double scaleZ )
{
if ( m_scaleZ != scaleZ ) m_needsRegeneration = true;
m_scaleZ = scaleZ;
}
@ -63,6 +66,8 @@ void RivGridBoxGenerator::setScaleZ( double scaleZ )
//--------------------------------------------------------------------------------------------------
void RivGridBoxGenerator::setDisplayModelOffset( cvf::Vec3d offset )
{
if ( m_displayModelOffset != offset ) m_needsRegeneration = true;
m_displayModelOffset = offset;
}
@ -183,6 +188,11 @@ void RivGridBoxGenerator::setGridBoxDomainCoordBoundingBox( const cvf::BoundingB
expandedBB.add( min );
expandedBB.add( max );
if ( m_domainCoordsBoundingBox.min() != expandedBB.min() || m_domainCoordsBoundingBox.max() != expandedBB.max() )
{
m_needsRegeneration = true;
}
m_domainCoordsBoundingBox = expandedBB;
}
@ -191,10 +201,14 @@ void RivGridBoxGenerator::setGridBoxDomainCoordBoundingBox( const cvf::BoundingB
//--------------------------------------------------------------------------------------------------
void RivGridBoxGenerator::createGridBoxParts()
{
computeDisplayCoords();
if ( m_needsRegeneration )
{
computeDisplayCoords();
createGridBoxFaceParts();
createGridBoxLegendParts();
createGridBoxFaceParts();
createGridBoxLegendParts();
m_needsRegeneration = false;
}
}
//--------------------------------------------------------------------------------------------------
@ -740,8 +754,12 @@ cvf::Vec3f RivGridBoxGenerator::cornerDirection( FaceType face1, FaceType face2
//--------------------------------------------------------------------------------------------------
void RivGridBoxGenerator::updateFromBackgroundColor( const cvf::Color3f& backgroundColor )
{
m_gridColor = RiaColorTools::computeOffsetColor( backgroundColor, 0.3f );
m_gridLegendColor = RiaColorTools::contrastColor( backgroundColor );
m_gridColor = RiaColorTools::computeOffsetColor( backgroundColor, 0.3f );
cvf::Color3f contrastColor = RiaColorTools::contrastColor( backgroundColor );
if ( contrastColor != m_gridLegendColor ) m_needsRegeneration = true;
m_gridLegendColor = contrastColor;
}
//--------------------------------------------------------------------------------------------------

View File

@ -122,4 +122,6 @@ private:
cvf::Color3f m_gridColor;
cvf::Color3f m_gridLegendColor;
bool m_needsRegeneration;
};

View File

@ -93,6 +93,7 @@ std::unique_ptr<QCursor> RiuViewer::s_hoverCursor;
RiuViewer::RiuViewer( const QGLFormat& format, QWidget* parent )
: caf::Viewer( format, parent )
, m_isNavigationRotationEnabled( true )
, m_zScale( 1.0 )
{
cvf::Font* standardFont = RiaGuiApplication::instance()->defaultSceneFont();
QFont font = RiaGuiApplication::instance()->font();
@ -490,7 +491,12 @@ void RiuViewer::showZScaleLabel( bool enable )
//--------------------------------------------------------------------------------------------------
void RiuViewer::setZScale( int scale )
{
bool isScaleChanged = m_zScale != scale;
m_zScale = scale;
m_zScaleLabel->setText( QString( "Z: %1" ).arg( scale ) );
if ( isScaleChanged ) m_selectionVisualizerManager->updateVisibleEditors();
}
//--------------------------------------------------------------------------------------------------
@ -531,14 +537,16 @@ void RiuViewer::setHistogramPercentiles( double pmin, double pmax, double mean )
//--------------------------------------------------------------------------------------------------
void RiuViewer::showGridBox( bool enable )
{
this->removeStaticModel( m_gridBoxGenerator->model() );
this->removeStaticModel( m_comparisonGridBoxGenerator->model() );
if ( enable )
{
this->addStaticModelOnce( m_gridBoxGenerator->model(), false );
this->addStaticModelOnce( m_comparisonGridBoxGenerator->model(), true );
}
else
{
this->removeStaticModel( m_gridBoxGenerator->model() );
this->removeStaticModel( m_comparisonGridBoxGenerator->model() );
}
}
//--------------------------------------------------------------------------------------------------
@ -930,8 +938,6 @@ void RiuViewer::updateGridBoxData( double scaleZ,
m_comparisonGridBoxGenerator->setGridBoxDomainCoordBoundingBox( domainCoordBoundingBox );
m_comparisonGridBoxGenerator->createGridBoxParts();
m_selectionVisualizerManager->updateVisibleEditors();
}
//--------------------------------------------------------------------------------------------------

View File

@ -175,6 +175,7 @@ private:
QLabel* m_zScaleLabel;
bool m_showZScaleLabel;
bool m_hideZScaleCheckbox;
double m_zScale;
caf::QStyledProgressBar* m_animationProgress;
bool m_showAnimProgress;

View File

@ -1358,12 +1358,15 @@ void caf::Viewer::addStaticModelOnce(cvf::Model* model, bool isForComparisonView
//--------------------------------------------------------------------------------------------------
void caf::Viewer::removeStaticModel(cvf::Model* model)
{
removeModelFromAllFrames(model);
m_staticModels.erase(model);
m_comparisonStaticModels.erase(model);
if ( m_staticModels.contains(model) || m_comparisonStaticModels.contains(model) )
{
removeModelFromAllFrames(model);
updateCachedValuesInScene();
m_staticModels.erase(model);
m_comparisonStaticModels.erase(model);
updateCachedValuesInScene();
}
}
//--------------------------------------------------------------------------------------------------