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:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user