#5389 Delete empty measurement curves after deleting or changing measurements.

This commit is contained in:
Gaute Lindkvist 2020-02-07 13:00:48 +01:00
parent 85bf09cefe
commit 2bb93ef872
11 changed files with 72 additions and 22 deletions

View File

@ -54,7 +54,7 @@ void RicDeleteWellMeasurementFilePathFeature::onActionTriggered( bool isChecked
wellMeasurementCollection->removeMeasurementsForFilePath( filePath );
wellMeasurementCollection->removeFilePath( filePath );
wellMeasurementCollection->deleteAllEmptyCurves();
wellMeasurementCollection->uiCapability()->updateConnectedEditors();
}

View File

@ -53,6 +53,7 @@ void RicReloadWellMeasurementsFeature::onActionTriggered( bool isChecked )
RicWellMeasurementImportTools::removeWellMeasurementsFromFiles( filePaths );
RicWellMeasurementImportTools::importWellMeasurementsFromFiles( filePaths );
RicWellMeasurementImportTools::deleteAllEmptyMeasurementCurves();
}
//--------------------------------------------------------------------------------------------------

View File

@ -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();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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 );

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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();
}

View File

@ -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;

View File

@ -187,7 +187,7 @@ void RimWellMeasurement::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
RimWellMeasurementCollection* wellMeasurementCollection;
this->firstAncestorOrThisOfTypeAsserted( wellMeasurementCollection );
wellMeasurementCollection->updateAllReferringTracksAndCurves();
wellMeasurementCollection->updateAllCurves();
}
//--------------------------------------------------------------------------------------------------

View File

@ -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();
}

View File

@ -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 );