Janitor : Use RimWellLogTrack in RimDepthTrackPlot

This commit is contained in:
Magne Sjaastad 2022-03-07 09:36:18 +01:00
parent 85d3f98f91
commit 6700c21086
3 changed files with 33 additions and 23 deletions

View File

@ -52,14 +52,13 @@ std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString&
bool convertCurveUnits )
{
std::vector<RimWellLogCurve*> allCurves;
std::vector<RimPlot*> plots = plotWindow->visiblePlots();
auto plots = plotWindow->visiblePlots();
for ( RimPlot* plot : plots )
for ( auto plot : plots )
{
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plot );
if ( track )
if ( plot )
{
std::vector<RimWellLogCurve*> curves = track->visibleCurves();
std::vector<RimWellLogCurve*> curves = plot->visibleCurves();
allCurves.insert( allCurves.end(), curves.begin(), curves.end() );
}
}

View File

@ -178,9 +178,9 @@ RimDepthTrackPlot& RimDepthTrackPlot::operator=( RimDepthTrackPlot&& rhs )
RimPlotWindow::operator=( std::move( rhs ) );
// Move all tracks
std::vector<RimPlot*> plots = rhs.m_plots.childObjects();
auto plots = rhs.m_plots.childObjects();
rhs.m_plots.clear();
for ( RimPlot* plot : plots )
for ( auto plot : plots )
{
m_plots.push_back( plot );
}
@ -245,7 +245,7 @@ size_t RimDepthTrackPlot::plotCount() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimDepthTrackPlot::plotIndex( const RimPlot* plot ) const
size_t RimDepthTrackPlot::plotIndex( const RimWellLogTrack* plot ) const
{
return m_plots.index( plot );
}
@ -268,16 +268,23 @@ RimPlot* RimDepthTrackPlot::plotByIndex( size_t index ) const
//--------------------------------------------------------------------------------------------------
std::vector<RimPlot*> RimDepthTrackPlot::plots() const
{
return m_plots.childObjects();
std::vector<RimPlot*> baseClassPlots;
for ( auto p : m_plots.childObjects() )
{
baseClassPlots.push_back( p );
}
return baseClassPlots;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlot*> RimDepthTrackPlot::visiblePlots() const
std::vector<RimWellLogTrack*> RimDepthTrackPlot::visiblePlots() const
{
std::vector<RimPlot*> allVisiblePlots;
for ( RimPlot* plot : m_plots() )
std::vector<RimWellLogTrack*> allVisiblePlots;
for ( auto plot : m_plots() )
{
if ( plot->showWindow() )
{
@ -1049,16 +1056,19 @@ caf::PdmFieldHandle* RimDepthTrackPlot::userDescriptionField()
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index )
{
if ( plot )
auto wellLogTrack = dynamic_cast<RimWellLogTrack*>( plot );
CVF_ASSERT( plot && !wellLogTrack && "Only type RimWellLogTrack is supported in RimDepthTrackPlot" );
if ( wellLogTrack )
{
m_plots.insert( index, plot );
m_plots.insert( index, wellLogTrack );
if ( m_viewer )
{
plot->createPlotWidget();
m_viewer->insertPlot( plot->plotWidget(), index );
wellLogTrack->createPlotWidget();
m_viewer->insertPlot( wellLogTrack->plotWidget(), index );
}
plot->setShowWindow( true );
wellLogTrack->setShowWindow( true );
onPlotAdditionOrRemoval();
}
}

View File

@ -43,6 +43,7 @@ class RiuWellLogPlot;
class RimPlot;
class RimEnsembleCurveSet;
class RiuPlotAxis;
class RimWellLogTrack;
class QKeyEvent;
@ -83,15 +84,15 @@ public:
QString description() const override;
size_t plotCount() const override;
size_t plotIndex( const RimPlot* plot ) const;
size_t plotIndex( const RimWellLogTrack* plot ) const;
RimPlot* plotByIndex( size_t index ) const;
int columnCount() const override;
std::vector<RimPlot*> plots() const override;
std::vector<RimPlot*> visiblePlots() const;
void insertPlot( RimPlot* plot, size_t index ) final;
void removePlot( RimPlot* plot ) final;
std::vector<RimPlot*> plots() const override;
std::vector<RimWellLogTrack*> visiblePlots() const;
void insertPlot( RimPlot* plot, size_t index ) final;
void removePlot( RimPlot* plot ) final;
DepthTypeEnum depthType() const;
void setDepthType( DepthTypeEnum depthType );
@ -191,7 +192,7 @@ protected:
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisValueFontSize;
caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig;
caf::PdmChildArrayField<RimPlot*> m_plots;
caf::PdmChildArrayField<RimWellLogTrack*> m_plots;
caf::PdmField<caf::AppEnum<RimEnsembleWellLogStatistics::DepthEqualization>> m_depthEqualization;
caf::PdmPtrField<RimEnsembleCurveSet*> m_ensembleCurveSet;