mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9231 Contour Map: Fix crash when adding formations after a view is created
This commit is contained in:
parent
b7e2e5e3c2
commit
8f9fbab7e0
@ -33,11 +33,13 @@
|
|||||||
#include "RimColorLegendItem.h"
|
#include "RimColorLegendItem.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
|
#include "RimEclipseContourMapView.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimFormationNames.h"
|
#include "RimFormationNames.h"
|
||||||
#include "RimFormationNamesCollection.h"
|
#include "RimFormationNamesCollection.h"
|
||||||
#include "RimGeoMechCase.h"
|
#include "RimGeoMechCase.h"
|
||||||
#include "RimGeoMechCellColors.h"
|
#include "RimGeoMechCellColors.h"
|
||||||
|
#include "RimGeoMechContourMapView.h"
|
||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
@ -189,12 +191,12 @@ void RicImportFormationNamesFeature::addCustomColorLegend( QString& name, RimFor
|
|||||||
// return if no formation names or colors (latter e.g. in case of FMU input or LYR without colors)
|
// return if no formation names or colors (latter e.g. in case of FMU input or LYR without colors)
|
||||||
if ( formationNames.empty() || formationColors.empty() ) return;
|
if ( formationNames.empty() || formationColors.empty() ) return;
|
||||||
|
|
||||||
RimColorLegend* colorLegend = new RimColorLegend;
|
auto* colorLegend = new RimColorLegend;
|
||||||
colorLegend->setColorLegendName( name );
|
colorLegend->setColorLegendName( name );
|
||||||
|
|
||||||
for ( size_t i = 0; i < formationColors.size(); i++ )
|
for ( size_t i = 0; i < formationColors.size(); i++ )
|
||||||
{
|
{
|
||||||
RimColorLegendItem* colorLegendItem = new RimColorLegendItem;
|
auto* colorLegendItem = new RimColorLegendItem;
|
||||||
|
|
||||||
colorLegendItem->setValues( formationNames[i], (int)i, formationColors[i] );
|
colorLegendItem->setValues( formationNames[i], (int)i, formationColors[i] );
|
||||||
|
|
||||||
@ -214,9 +216,14 @@ void RicImportFormationNamesFeature::addCustomColorLegend( QString& name, RimFor
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicImportFormationNamesFeature::setFormationCellResultAndLegend( Rim3dView* activeView, QString& legendName )
|
void RicImportFormationNamesFeature::setFormationCellResultAndLegend( Rim3dView* activeView, QString& legendName )
|
||||||
{
|
{
|
||||||
RimRegularLegendConfig* legendConfig = nullptr;
|
auto eclipseContourMapView = dynamic_cast<RimEclipseContourMapView*>( activeView );
|
||||||
|
if ( eclipseContourMapView ) return;
|
||||||
|
|
||||||
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>( activeView );
|
auto geoMechContourMapView = dynamic_cast<RimGeoMechContourMapView*>( activeView );
|
||||||
|
if ( geoMechContourMapView ) return;
|
||||||
|
|
||||||
|
RimRegularLegendConfig* legendConfig = nullptr;
|
||||||
|
auto* eclView = dynamic_cast<RimEclipseView*>( activeView );
|
||||||
if ( eclView )
|
if ( eclView )
|
||||||
{
|
{
|
||||||
eclView->cellResult()->setResultType( RiaDefines::ResultCatType::FORMATION_NAMES );
|
eclView->cellResult()->setResultType( RiaDefines::ResultCatType::FORMATION_NAMES );
|
||||||
@ -229,7 +236,7 @@ void RicImportFormationNamesFeature::setFormationCellResultAndLegend( Rim3dView*
|
|||||||
eclView->updateAllRequiredEditors();
|
eclView->updateAllRequiredEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( activeView );
|
auto* geoMechView = dynamic_cast<RimGeoMechView*>( activeView );
|
||||||
if ( geoMechView )
|
if ( geoMechView )
|
||||||
{
|
{
|
||||||
legendConfig = geoMechView->cellResult()->legendConfig();
|
legendConfig = geoMechView->cellResult()->legendConfig();
|
||||||
|
@ -1027,9 +1027,16 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
threadTriangles[myThread][c].insert( threadTriangles[myThread][c].end(),
|
|
||||||
clippedTriangles.begin(),
|
{
|
||||||
clippedTriangles.end() );
|
// Add critical section here due to a weird bug when running in a single thread
|
||||||
|
// Running multi threaded does not require this critical section, as we use a thread local data
|
||||||
|
// structure
|
||||||
|
#pragma omp critical
|
||||||
|
threadTriangles[myThread][c].insert( threadTriangles[myThread][c].end(),
|
||||||
|
clippedTriangles.begin(),
|
||||||
|
clippedTriangles.end() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user