Make well log tracks reorderable

This commit is contained in:
Gaute Lindkvist 2020-08-05 15:30:24 +02:00
parent 5e9403d9f1
commit 92763ee902
2 changed files with 16 additions and 0 deletions

View File

@ -40,6 +40,7 @@
#include "RiuWellLogPlot.h"
#include "cafPdmFieldIOScriptability.h"
#include "cafPdmFieldReorderCapability.h"
#include "cafPdmObjectScriptability.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiDoubleValueEditor.h"
@ -116,6 +117,8 @@ RimDepthTrackPlot::RimDepthTrackPlot()
CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "", "", "", "" );
m_plots.uiCapability()->setUiHidden( true );
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots );
reorderability->orderChanged.connect( this, &RimDepthTrackPlot::onPlotsReordered );
m_availableDepthUnits = {RiaDefines::DepthUnitType::UNIT_METER, RiaDefines::DepthUnitType::UNIT_FEET};
m_availableDepthTypes = {RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
@ -571,6 +574,8 @@ void RimDepthTrackPlot::recreatePlotWidgets()
auto plotVector = plots();
m_viewer->removeAllPlots();
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
{
plotVector[tIdx]->createPlotWidget();
@ -715,6 +720,16 @@ void RimDepthTrackPlot::doUpdateLayout()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::onPlotsReordered( const SignalEmitter* emitter )
{
updateSubPlotNames();
recreatePlotWidgets();
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -155,6 +155,7 @@ private:
void onPlotAdditionOrRemoval();
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
void doUpdateLayout() override;
void onPlotsReordered( const SignalEmitter* emitter );
protected:
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;