mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5125 Update RimWellMeasurementInViewCollection when measurements are imported.
This commit is contained in:
@@ -21,6 +21,8 @@
|
|||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "RiaLogging.h"
|
#include "RiaLogging.h"
|
||||||
|
|
||||||
|
#include "Rim3dView.h"
|
||||||
|
#include "RimGridView.h"
|
||||||
#include "RimPerforationCollection.h"
|
#include "RimPerforationCollection.h"
|
||||||
#include "RimPerforationInterval.h"
|
#include "RimPerforationInterval.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
@@ -106,6 +108,17 @@ void RicImportWellMeasurementsFeature::onActionTriggered( bool isChecked )
|
|||||||
|
|
||||||
if ( app->project() )
|
if ( app->project() )
|
||||||
{
|
{
|
||||||
|
std::vector<Rim3dView*> views;
|
||||||
|
app->project()->allViews( views );
|
||||||
|
for ( auto& view : views )
|
||||||
|
{
|
||||||
|
RimGridView* gridView = dynamic_cast<RimGridView*>( view );
|
||||||
|
if ( gridView )
|
||||||
|
{
|
||||||
|
gridView->updateWellMeasurements();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
app->project()->scheduleCreateDisplayModelAndRedrawAllViews();
|
app->project()->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -932,6 +932,8 @@ void RimEclipseView::onLoadDataAndUpdate()
|
|||||||
m_virtualPerforationResult->loadData();
|
m_virtualPerforationResult->loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_wellMeasurementCollection->syncWithChangesInWellMeasurementCollection();
|
||||||
|
|
||||||
this->scheduleCreateDisplayModelAndRedraw();
|
this->scheduleCreateDisplayModelAndRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ void RimGeoMechView::onLoadDataAndUpdate()
|
|||||||
updateMdiWindowVisibility();
|
updateMdiWindowVisibility();
|
||||||
|
|
||||||
this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
|
this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||||
|
m_wellMeasurementCollection->syncWithChangesInWellMeasurementCollection();
|
||||||
|
|
||||||
this->scheduleCreateDisplayModelAndRedraw();
|
this->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
|
||||||
|
|||||||
@@ -557,3 +557,11 @@ RimViewLinker* RimGridView::viewLinkerIfMasterView() const
|
|||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridView::updateWellMeasurements()
|
||||||
|
{
|
||||||
|
m_wellMeasurementCollection->syncWithChangesInWellMeasurementCollection();
|
||||||
|
}
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ public:
|
|||||||
int fontSize,
|
int fontSize,
|
||||||
bool forceChange = false ) override;
|
bool forceChange = false ) override;
|
||||||
|
|
||||||
|
void updateWellMeasurements();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void updateViewFollowingRangeFilterUpdates();
|
virtual void updateViewFollowingRangeFilterUpdates();
|
||||||
void onClearReservoirCellVisibilitiesIfNeccessary() override;
|
void onClearReservoirCellVisibilitiesIfNeccessary() override;
|
||||||
|
|||||||
@@ -97,25 +97,44 @@ void RimWellMeasurementInViewCollection::fieldChangedByUi( const caf::PdmFieldHa
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellMeasurementInViewCollection::initAfterRead()
|
void RimWellMeasurementInViewCollection::syncWithChangesInWellMeasurementCollection()
|
||||||
{
|
{
|
||||||
// TODO: Need a better solution for this!!!
|
|
||||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||||
if ( wellPathCollection )
|
if ( wellPathCollection )
|
||||||
{
|
{
|
||||||
const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection();
|
const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection();
|
||||||
std::set<QString> measurementKinds;
|
|
||||||
for ( RimWellMeasurement* wellMeasurement : measurementCollection->measurements() )
|
// Make a set of the measurement kinds already present
|
||||||
|
std::set<QString> currentMeasurementKinds;
|
||||||
|
for ( RimWellMeasurementInView* wellMeasurement : measurements() )
|
||||||
{
|
{
|
||||||
measurementKinds.insert( wellMeasurement->kind() );
|
currentMeasurementKinds.insert( wellMeasurement->measurementKind() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( QString kind : measurementKinds )
|
// Make a set of the measurements we should have after the update
|
||||||
|
std::set<QString> targetMeasurementKinds;
|
||||||
|
for ( RimWellMeasurement* wellMeasurement : measurementCollection->measurements() )
|
||||||
|
{
|
||||||
|
targetMeasurementKinds.insert( wellMeasurement->kind() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// The difference between the sets is the measurement kinds to be added
|
||||||
|
std::set<QString> newMeasurementKinds;
|
||||||
|
std::set_difference( targetMeasurementKinds.begin(),
|
||||||
|
targetMeasurementKinds.end(),
|
||||||
|
currentMeasurementKinds.begin(),
|
||||||
|
currentMeasurementKinds.end(),
|
||||||
|
std::inserter( newMeasurementKinds, newMeasurementKinds.end() ) );
|
||||||
|
|
||||||
|
// Add the new measurement kinds
|
||||||
|
for ( QString kind : newMeasurementKinds )
|
||||||
{
|
{
|
||||||
RimWellMeasurementInView* measurementInView = new RimWellMeasurementInView;
|
RimWellMeasurementInView* measurementInView = new RimWellMeasurementInView;
|
||||||
measurementInView->setName( kind );
|
measurementInView->setName( kind );
|
||||||
measurementInView->setMeasurementKind( kind );
|
measurementInView->setMeasurementKind( kind );
|
||||||
m_measurementsInView.push_back( measurementInView );
|
m_measurementsInView.push_back( measurementInView );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateConnectedEditors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,12 +35,13 @@ public:
|
|||||||
|
|
||||||
std::vector<RimWellMeasurementInView*> measurements() const;
|
std::vector<RimWellMeasurementInView*> measurements() const;
|
||||||
|
|
||||||
|
void syncWithChangesInWellMeasurementCollection();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||||
const QVariant& oldValue,
|
const QVariant& oldValue,
|
||||||
const QVariant& newValue ) override;
|
const QVariant& newValue ) override;
|
||||||
void initAfterRead();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmChildArrayField<RimWellMeasurementInView*> m_measurementsInView;
|
caf::PdmChildArrayField<RimWellMeasurementInView*> m_measurementsInView;
|
||||||
|
|||||||
Reference in New Issue
Block a user