mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5389 Delete empty measurement curves after deleting or changing measurements.
This commit is contained in:
parent
85bf09cefe
commit
2bb93ef872
@ -54,7 +54,7 @@ void RicDeleteWellMeasurementFilePathFeature::onActionTriggered( bool isChecked
|
||||
|
||||
wellMeasurementCollection->removeMeasurementsForFilePath( filePath );
|
||||
wellMeasurementCollection->removeFilePath( filePath );
|
||||
|
||||
wellMeasurementCollection->deleteAllEmptyCurves();
|
||||
wellMeasurementCollection->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ void RicReloadWellMeasurementsFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
RicWellMeasurementImportTools::removeWellMeasurementsFromFiles( filePaths );
|
||||
RicWellMeasurementImportTools::importWellMeasurementsFromFiles( filePaths );
|
||||
RicWellMeasurementImportTools::deleteAllEmptyMeasurementCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -141,6 +141,21 @@ void RicWellMeasurementImportTools::removeWellMeasurementsFromFiles( const std::
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellMeasurementImportTools::deleteAllEmptyMeasurementCurves()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
std::vector<RimWellMeasurementCollection*> measurementCollections;
|
||||
app->project()->descendantsIncludingThisOfType( measurementCollections );
|
||||
for ( auto measurementCollection : measurementCollections )
|
||||
{
|
||||
measurementCollection->deleteAllEmptyCurves();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -33,6 +33,7 @@ class RicWellMeasurementImportTools
|
||||
public:
|
||||
static void importWellMeasurementsFromFiles( const std::vector<RimWellMeasurementFilePath*>& filePaths );
|
||||
static void removeWellMeasurementsFromFiles( const std::vector<RimWellMeasurementFilePath*>& filePaths );
|
||||
static void deleteAllEmptyMeasurementCurves();
|
||||
|
||||
static void importWellMeasurementsFromFiles( const QStringList& filePaths, RimWellPathCollection* wellPathCollection );
|
||||
|
||||
|
@ -54,7 +54,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( RimWellLogTra
|
||||
curve->firstAncestorOrThisOfType( wellLogPlotTrack );
|
||||
if ( wellLogPlotTrack )
|
||||
{
|
||||
wellLogPlotTrack->takeOutCurve( curve );
|
||||
wellLogPlotTrack->removeCurve( curve );
|
||||
wellLogPlotTrack->updateConnectedEditors();
|
||||
srcTracks.insert( wellLogPlotTrack );
|
||||
RimWellLogPlot* plot;
|
||||
|
@ -734,7 +734,7 @@ void RimWellRftPlot::deleteCurvesAssosicatedWithObservedData( const RimObservedF
|
||||
RimWellLogRftCurve* rftCurve = dynamic_cast<RimWellLogRftCurve*>( curve );
|
||||
if ( rftCurve && rftCurve->observedFmuRftData() == observedFmuRftData )
|
||||
{
|
||||
track->takeOutCurve( rftCurve );
|
||||
track->removeCurve( rftCurve );
|
||||
delete rftCurve;
|
||||
}
|
||||
}
|
||||
|
@ -1026,7 +1026,7 @@ void RimWellLogTrack::insertCurve( RimWellLogCurve* curve, size_t index )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::takeOutCurve( RimWellLogCurve* curve )
|
||||
void RimWellLogTrack::removeCurve( RimWellLogCurve* curve )
|
||||
{
|
||||
size_t index = m_curves.index( curve );
|
||||
if ( index < m_curves.size() )
|
||||
@ -2584,3 +2584,11 @@ void RimWellLogTrack::removeRegionAnnotations()
|
||||
m_annotationTool->detachAllAnnotations();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::doUpdateLayout()
|
||||
{
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
void addCurve( RimWellLogCurve* curve );
|
||||
void insertCurve( RimWellLogCurve* curve, size_t index );
|
||||
void takeOutCurve( RimWellLogCurve* curve );
|
||||
void removeCurve( RimWellLogCurve* curve );
|
||||
void deleteAllCurves();
|
||||
|
||||
size_t curveIndex( RimWellLogCurve* curve );
|
||||
@ -281,6 +281,7 @@ private:
|
||||
RimWellLogPlot* parentWellLogPlot() const;
|
||||
|
||||
void handleWheelEvent( QWheelEvent* event ) override;
|
||||
void doUpdateLayout() override;
|
||||
|
||||
std::vector<std::pair<double, double>> waterAndRockRegions( RiaDefines::DepthTypeEnum depthType,
|
||||
const RigWellLogExtractor* extractor ) const;
|
||||
|
@ -187,7 +187,7 @@ void RimWellMeasurement::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
|
||||
RimWellMeasurementCollection* wellMeasurementCollection;
|
||||
this->firstAncestorOrThisOfTypeAsserted( wellMeasurementCollection );
|
||||
wellMeasurementCollection->updateAllReferringTracksAndCurves();
|
||||
wellMeasurementCollection->updateAllCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -17,6 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RimWellMeasurementCollection.h"
|
||||
|
||||
#include "RigWellLogCurveData.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
@ -54,27 +56,48 @@ RimWellMeasurementCollection::~RimWellMeasurementCollection() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::updateAllReferringTracksAndCurves()
|
||||
void RimWellMeasurementCollection::updateAllCurves()
|
||||
{
|
||||
std::vector<RimWellLogTrack*> wellLogTracks;
|
||||
|
||||
this->objectsWithReferringPtrFieldsOfType( wellLogTracks );
|
||||
for ( RimWellLogTrack* track : wellLogTracks )
|
||||
{
|
||||
track->loadDataAndUpdate();
|
||||
}
|
||||
this->updateConnectedEditors();
|
||||
|
||||
RimProject* proj;
|
||||
this->firstAncestorOrThisOfTypeAsserted( proj );
|
||||
RimMainPlotCollection* plotCollection = proj->mainPlotCollection();
|
||||
|
||||
std::vector<RimWellMeasurementCurve*> measurementCurves;
|
||||
plotCollection->descendantsIncludingThisOfType( measurementCurves );
|
||||
|
||||
for ( auto curve : measurementCurves )
|
||||
{
|
||||
curve->loadDataAndUpdate( true );
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::deleteAllEmptyCurves()
|
||||
{
|
||||
RimProject* proj;
|
||||
this->firstAncestorOrThisOfTypeAsserted( proj );
|
||||
RimMainPlotCollection* plotCollection = proj->mainPlotCollection();
|
||||
|
||||
std::vector<RimWellMeasurementCurve*> measurementCurves;
|
||||
plotCollection->descendantsIncludingThisOfType( measurementCurves );
|
||||
|
||||
for ( auto curve : measurementCurves )
|
||||
{
|
||||
if ( curve->curveData()->xValues().empty() )
|
||||
{
|
||||
RimWellLogTrack* track = nullptr;
|
||||
curve->firstAncestorOrThisOfTypeAsserted( track );
|
||||
|
||||
track->removeCurve( curve );
|
||||
delete curve;
|
||||
curve = nullptr;
|
||||
track->updateLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -111,7 +134,7 @@ void RimWellMeasurementCollection::insertMeasurement( RimWellMeasurement* insert
|
||||
m_measurements.push_back( measurement );
|
||||
|
||||
addFilePath( measurement->filePath() );
|
||||
this->updateAllReferringTracksAndCurves();
|
||||
this->updateAllCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -121,7 +144,7 @@ void RimWellMeasurementCollection::appendMeasurement( RimWellMeasurement* measur
|
||||
{
|
||||
m_measurements.push_back( measurement );
|
||||
addFilePath( measurement->filePath() );
|
||||
this->updateAllReferringTracksAndCurves();
|
||||
this->updateAllCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -132,7 +155,7 @@ void RimWellMeasurementCollection::deleteMeasurement( RimWellMeasurement* measur
|
||||
m_measurements.removeChildObject( measurementToDelete );
|
||||
delete measurementToDelete;
|
||||
|
||||
this->updateAllReferringTracksAndCurves();
|
||||
this->updateAllCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -141,7 +164,7 @@ void RimWellMeasurementCollection::deleteMeasurement( RimWellMeasurement* measur
|
||||
void RimWellMeasurementCollection::deleteAllMeasurements()
|
||||
{
|
||||
m_measurements.deleteAllChildObjects();
|
||||
this->updateAllReferringTracksAndCurves();
|
||||
this->updateAllCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -247,5 +270,5 @@ void RimWellMeasurementCollection::removeMeasurementsForFilePath( RimWellMeasure
|
||||
RimProject* proj;
|
||||
this->firstAncestorOrThisOfTypeAsserted( proj );
|
||||
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
this->updateAllReferringTracksAndCurves();
|
||||
this->updateAllCurves();
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ public:
|
||||
|
||||
std::vector<RimWellMeasurement*> measurements() const;
|
||||
|
||||
void updateAllReferringTracksAndCurves();
|
||||
void updateAllCurves();
|
||||
void deleteAllEmptyCurves();
|
||||
void insertMeasurement( RimWellMeasurement* insertBefore, RimWellMeasurement* measurement );
|
||||
void appendMeasurement( RimWellMeasurement* measurement );
|
||||
void deleteMeasurement( RimWellMeasurement* measurementToDelete );
|
||||
|
Loading…
Reference in New Issue
Block a user