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:
parent
66ac8fee1d
commit
3583e2ee10
@ -21,6 +21,8 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimProject.h"
|
||||
@ -106,6 +108,17 @@ void RicImportWellMeasurementsFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -932,6 +932,8 @@ void RimEclipseView::onLoadDataAndUpdate()
|
||||
m_virtualPerforationResult->loadData();
|
||||
}
|
||||
|
||||
m_wellMeasurementCollection->syncWithChangesInWellMeasurementCollection();
|
||||
|
||||
this->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
|
@ -175,6 +175,7 @@ void RimGeoMechView::onLoadDataAndUpdate()
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||
m_wellMeasurementCollection->syncWithChangesInWellMeasurementCollection();
|
||||
|
||||
this->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
|
@ -557,3 +557,11 @@ RimViewLinker* RimGridView::viewLinkerIfMasterView() const
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridView::updateWellMeasurements()
|
||||
{
|
||||
m_wellMeasurementCollection->syncWithChangesInWellMeasurementCollection();
|
||||
}
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
int fontSize,
|
||||
bool forceChange = false ) override;
|
||||
|
||||
void updateWellMeasurements();
|
||||
|
||||
protected:
|
||||
virtual void updateViewFollowingRangeFilterUpdates();
|
||||
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();
|
||||
if ( wellPathCollection )
|
||||
{
|
||||
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;
|
||||
measurementInView->setName( kind );
|
||||
measurementInView->setMeasurementKind( kind );
|
||||
m_measurementsInView.push_back( measurementInView );
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
@ -35,12 +35,13 @@ public:
|
||||
|
||||
std::vector<RimWellMeasurementInView*> measurements() const;
|
||||
|
||||
void syncWithChangesInWellMeasurementCollection();
|
||||
|
||||
protected:
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
void initAfterRead();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimWellMeasurementInView*> m_measurementsInView;
|
||||
|
Loading…
Reference in New Issue
Block a user