Further refactoring

This commit is contained in:
Gaute Lindkvist 2019-11-15 13:35:39 +01:00
parent 3dd4cb505b
commit 85d683634c
34 changed files with 283 additions and 237 deletions

View File

@ -43,7 +43,7 @@
#include "RimIdenticalGridCaseGroup.h"
#include "RimIntersection.h"
#include "RimIntersectionBox.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimPerforationInterval.h"
#include "RimPolylinesAnnotation.h"
#include "RimReachCircleAnnotation.h"
@ -110,7 +110,7 @@ bool isDeletable( caf::PdmUiItem* uiItem )
if ( dynamic_cast<RimWellLogCurve*>( uiItem ) ) return true;
if ( dynamic_cast<RimSummaryPlot*>( uiItem ) )
{
RimMultiPlot* plotWindow = nullptr;
RimMultiPlotWindow* plotWindow = nullptr;
static_cast<RimSummaryPlot*>( uiItem )->firstAncestorOrThisOfType( plotWindow );
return plotWindow == nullptr;
}
@ -139,7 +139,7 @@ bool isDeletable( caf::PdmUiItem* uiItem )
if ( dynamic_cast<RimPolylinesAnnotation*>( uiItem ) ) return true;
if ( dynamic_cast<RimGridCrossPlot*>( uiItem ) )
{
RimMultiPlot* plotWindow = nullptr;
RimMultiPlotWindow* plotWindow = nullptr;
static_cast<RimGridCrossPlot*>( uiItem )->firstAncestorOrThisOfType( plotWindow );
return plotWindow == nullptr;
}

View File

@ -22,8 +22,8 @@
#include "RiaApplication.h"
#include "RimMainPlotCollection.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotCollection.h"
#include "RimMultiPlotWindow.h"
#include "RimPlot.h"
#include "RimProject.h"
@ -53,7 +53,7 @@ RicfCommandResponse RicNewMultiPlotFeature::execute()
RimProject* project = RiaApplication::instance()->project();
RimMultiPlotCollection* plotCollection = project->mainPlotCollection()->multiPlotCollection();
RimMultiPlot* plotWindow = new RimMultiPlot;
RimMultiPlotWindow* plotWindow = new RimMultiPlotWindow;
plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) );
plotWindow->setAsPlotMdiWindow();
plotCollection->addMultiPlot( plotWindow );

View File

@ -25,7 +25,7 @@
#include "RiuPlotMainWindow.h"
#include "RiuQwtPlotWidget.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimPlotWindow.h"
#include "RimWellLogTrack.h"
@ -50,7 +50,7 @@ bool RicDeleteSubPlotFeature::isCommandEnabled()
size_t plotsSelected = 0;
for ( caf::PdmObject* object : selection )
{
RimMultiPlot* multiPlot = nullptr;
RimMultiPlotWindow* multiPlot = nullptr;
object->firstAncestorOrThisOfType( multiPlot );
if ( dynamic_cast<RimPlotWindow*>( object ) && multiPlot )
{
@ -72,11 +72,11 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
std::vector<RimPlot*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
std::set<RimMultiPlot*> alteredPlotWindows;
std::set<RimMultiPlotWindow*> alteredPlotWindows;
for ( RimPlot* plot : selection )
{
RimMultiPlot* plotWindow = nullptr;
RimMultiPlotWindow* plotWindow = nullptr;
plot->firstAncestorOrThisOfType( plotWindow );
if ( plot && plotWindow )
{
@ -89,7 +89,7 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
}
}
for ( RimMultiPlot* plotWindow : alteredPlotWindows )
for ( RimMultiPlotWindow* plotWindow : alteredPlotWindows )
{
plotWindow->uiCapability()->updateConnectedEditors();
}

View File

@ -146,7 +146,7 @@ class Project(PdmObject):
def plots(self):
"""Get a list of all plots belonging to a project"""
pdm_objects = self.descendants("RimPlot")
pdm_objects = self.descendants("RimPlotWindow")
plot_list = []
for pdm_object in pdm_objects:
plot_list.append(Plot(pdm_object))

View File

@ -74,7 +74,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.h
@ -216,7 +216,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.cpp

View File

@ -102,6 +102,7 @@ RimWellAllocationPlot::RimWellAllocationPlot()
m_accumulatedWellFlowPlot->setDepthType( RiaDefines::CONNECTION_NUMBER );
m_accumulatedWellFlowPlot->setLegendsVisible( false );
m_accumulatedWellFlowPlot->uiCapability()->setUiIconFromResourceString( ":/WellFlowPlot16x16.png" );
m_accumulatedWellFlowPlot->setAcceptDrops( false );
CAF_PDM_InitFieldNoDefault( &m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "" );
m_totalWellAllocationPlot.uiCapability()->setUiHidden( true );

View File

@ -29,7 +29,7 @@
#include "RimGridCrossPlotCollection.h"
#include "RimGridCrossPlotCurve.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimPlotAxisProperties.h"
#include "cafPdmUiCheckBoxEditor.h"
@ -380,32 +380,17 @@ void RimGridCrossPlot::removeDataSetLegend( RimGridCrossPlotDataSet* dataSet )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::removeFromMdiAreaAndCollection()
void RimGridCrossPlot::doRemoveFromCollection()
{
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
this->firstAncestorOrThisOfType( crossPlotCollection );
if ( crossPlotCollection )
{
crossPlotCollection->removeGridCrossPlot( this );
this->revokeMdiWindowStatus();
crossPlotCollection->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAfterInsertingIntoMultiPlot()
{
if ( m_plotWidget )
{
m_plotWidget->setTitle( "" );
m_plotWidget->setInternalQwtLegendVisible( false );
}
updateAxes();
updateLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -574,10 +559,13 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
m_crossPlotDataSets[i]->updateCurveNames( i, m_crossPlotDataSets.size() );
}
if ( m_plotWidget && isMdiWindow() )
if ( m_plotWidget )
{
if ( isMdiWindow() )
{
m_plotWidget->setTitle( this->createAutoName() );
}
}
updateMdiWindowTitle();
}
@ -747,7 +735,7 @@ bool RimGridCrossPlot::applyFontSize( RiaDefines::FontSettingType fontSettingTyp
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::performLayoutUpdate()
void RimGridCrossPlot::doUpdateLayout()
{
updateLegend();
updatePlot();

View File

@ -94,7 +94,7 @@ public:
int fontSize,
bool forceChange = false ) override;
void updateLegend();
void updateLegend() override;
void updateZoomInQwt() override;
void updateZoomFromQwt() override;
@ -107,9 +107,6 @@ public:
void addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet );
void removeDataSetLegend( RimGridCrossPlotDataSet* dataSet );
void removeFromMdiAreaAndCollection() override;
void updateAfterInsertingIntoMultiPlot() override;
protected:
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
void deleteViewWidget() override;
@ -141,10 +138,11 @@ protected:
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
private:
void performLayoutUpdate() override;
void doUpdateLayout() override;
void cleanupBeforeClose();
void doRemoveFromCollection() override;
private:
caf::PdmField<bool> m_showInfoBox;
caf::PdmField<bool> m_showLegend_OBSOLETE;

View File

@ -261,7 +261,7 @@ void RimMainPlotCollection::updatePlotsWithFormations()
if ( m_multiPlotCollection )
{
for ( RimMultiPlot* plotWindow : m_multiPlotCollection->multiPlots() )
for ( RimMultiPlotWindow* plotWindow : m_multiPlotCollection->multiPlots() )
{
plotWindow->loadDataAndUpdate();
}
@ -283,7 +283,7 @@ void RimMainPlotCollection::updatePlotsWithCompletions()
if ( m_multiPlotCollection )
{
for ( RimMultiPlot* plotWindow : m_multiPlotCollection->multiPlots() )
for ( RimMultiPlotWindow* plotWindow : m_multiPlotCollection->multiPlots() )
{
plotWindow->loadDataAndUpdate();
}

View File

@ -18,7 +18,7 @@
#include "RimMultiPlotCollection.h"
#include "RiaApplication.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimProject.h"
CAF_PDM_SOURCE_INIT( RimMultiPlotCollection, "RimMultiPlotCollection" );
@ -50,7 +50,7 @@ void RimMultiPlotCollection::deleteAllChildObjects()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimMultiPlot*> RimMultiPlotCollection::multiPlots() const
std::vector<RimMultiPlotWindow*> RimMultiPlotCollection::multiPlots() const
{
return m_multiPlots.childObjects();
}
@ -58,9 +58,9 @@ std::vector<RimMultiPlot*> RimMultiPlotCollection::multiPlots() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMultiPlot* RimMultiPlotCollection::createMultiPlot()
RimMultiPlotWindow* RimMultiPlotCollection::createMultiPlot()
{
RimMultiPlot* plot = new RimMultiPlot();
RimMultiPlotWindow* plot = new RimMultiPlotWindow();
plot->setAsPlotMdiWindow();
addMultiPlot( plot );
@ -70,7 +70,7 @@ RimMultiPlot* RimMultiPlotCollection::createMultiPlot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlotCollection::addMultiPlot( RimMultiPlot* plot )
void RimMultiPlotCollection::addMultiPlot( RimMultiPlotWindow* plot )
{
m_multiPlots().push_back( plot );
}

View File

@ -20,7 +20,7 @@
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimMultiPlot;
class RimMultiPlotWindow;
//==================================================================================================
///
@ -36,10 +36,10 @@ public:
void deleteAllChildObjects();
std::vector<RimMultiPlot*> multiPlots() const;
RimMultiPlot* createMultiPlot();
void addMultiPlot( RimMultiPlot* plot );
std::vector<RimMultiPlotWindow*> multiPlots() const;
RimMultiPlotWindow* createMultiPlot();
void addMultiPlot( RimMultiPlotWindow* plot );
private:
caf::PdmChildArrayField<RimMultiPlot*> m_multiPlots;
caf::PdmChildArrayField<RimMultiPlotWindow*> m_multiPlots;
};

View File

@ -15,7 +15,7 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimPlot.h"
@ -29,23 +29,24 @@
namespace caf
{
template <>
void RimMultiPlot::ColumnCountEnum::setUp()
void RimMultiPlotWindow::ColumnCountEnum::setUp()
{
addItem( RimMultiPlot::COLUMNS_1, "1", "1 Column" );
addItem( RimMultiPlot::COLUMNS_2, "2", "2 Columns" );
addItem( RimMultiPlot::COLUMNS_3, "3", "3 Columns" );
addItem( RimMultiPlot::COLUMNS_4, "4", "4 Columns" );
addItem( RimMultiPlot::COLUMNS_UNLIMITED, "UNLIMITED", "Unlimited" );
setDefault( RimMultiPlot::COLUMNS_2 );
addItem( RimMultiPlotWindow::COLUMNS_1, "1", "1 Column" );
addItem( RimMultiPlotWindow::COLUMNS_2, "2", "2 Columns" );
addItem( RimMultiPlotWindow::COLUMNS_3, "3", "3 Columns" );
addItem( RimMultiPlotWindow::COLUMNS_4, "4", "4 Columns" );
addItem( RimMultiPlotWindow::COLUMNS_UNLIMITED, "UNLIMITED", "Unlimited" );
setDefault( RimMultiPlotWindow::COLUMNS_2 );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RimMultiPlot, "MultiPlot" );
CAF_PDM_SOURCE_INIT( RimMultiPlotWindow, "MultiPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMultiPlot::RimMultiPlot()
RimMultiPlotWindow::RimMultiPlotWindow()
: m_acceptDrops( true )
{
CAF_PDM_InitObject( "Multi Plot", ":/WellLogPlot16x16.png", "", "" );
@ -65,7 +66,7 @@ RimMultiPlot::RimMultiPlot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMultiPlot::~RimMultiPlot()
RimMultiPlotWindow::~RimMultiPlotWindow()
{
removeMdiWindowFromMdiArea();
m_plots.deleteAllChildObjects();
@ -76,7 +77,7 @@ RimMultiPlot::~RimMultiPlot()
//--------------------------------------------------------------------------------------------------
/// Move-assignment operator. Argument has to be passed with std::move()
//--------------------------------------------------------------------------------------------------
RimMultiPlot& RimMultiPlot::operator=( RimMultiPlot&& rhs )
RimMultiPlotWindow& RimMultiPlotWindow::operator=( RimMultiPlotWindow&& rhs )
{
RimPlotWindow::operator=( std::move( rhs ) );
@ -96,7 +97,7 @@ RimMultiPlot& RimMultiPlot::operator=( RimMultiPlot&& rhs )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimMultiPlot::viewWidget()
QWidget* RimMultiPlotWindow::viewWidget()
{
return m_viewer;
}
@ -104,7 +105,7 @@ QWidget* RimMultiPlot::viewWidget()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimMultiPlot::description() const
QString RimMultiPlotWindow::description() const
{
return multiPlotTitle();
}
@ -112,7 +113,7 @@ QString RimMultiPlot::description() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimMultiPlot::isMultiPlotTitleVisible() const
bool RimMultiPlotWindow::isMultiPlotTitleVisible() const
{
return m_showPlotWindowTitle;
}
@ -120,7 +121,7 @@ bool RimMultiPlot::isMultiPlotTitleVisible() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setMultiPlotTitleVisible( bool visible )
void RimMultiPlotWindow::setMultiPlotTitleVisible( bool visible )
{
m_showPlotWindowTitle = visible;
}
@ -128,7 +129,7 @@ void RimMultiPlot::setMultiPlotTitleVisible( bool visible )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimMultiPlot::multiPlotTitle() const
QString RimMultiPlotWindow::multiPlotTitle() const
{
return m_plotWindowTitle;
}
@ -136,7 +137,7 @@ QString RimMultiPlot::multiPlotTitle() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setMultiPlotTitle( const QString& title )
void RimMultiPlotWindow::setMultiPlotTitle( const QString& title )
{
m_plotWindowTitle = title;
}
@ -144,7 +145,7 @@ void RimMultiPlot::setMultiPlotTitle( const QString& title )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::addPlot( RimPlot* plot )
void RimMultiPlotWindow::addPlot( RimPlot* plot )
{
insertPlot( plot, m_plots.size() );
}
@ -152,7 +153,7 @@ void RimMultiPlot::addPlot( RimPlot* plot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::insertPlot( RimPlot* plot, size_t index )
void RimMultiPlotWindow::insertPlot( RimPlot* plot, size_t index )
{
if ( plot )
{
@ -164,7 +165,7 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index )
plot->createPlotWidget();
m_viewer->insertPlot( plot->viewer(), index );
}
plot->updateAfterInsertingIntoMultiPlot();
plot->setLegendsVisible( false );
onPlotAdditionOrRemoval();
}
@ -173,7 +174,7 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::removePlot( RimPlot* plot )
void RimMultiPlotWindow::removePlot( RimPlot* plot )
{
if ( plot )
{
@ -190,23 +191,11 @@ void RimMultiPlot::removePlot( RimPlot* plot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, RimPlot* plotToInsertAfter )
void RimMultiPlotWindow::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, RimPlot* plotToInsertAfter )
{
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
{
RimPlot* plot = plotsToMove[tIdx];
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plot );
RimMultiPlot* srcPlot = nullptr;
pdmObject->firstAncestorOrThisOfType( srcPlot );
if ( srcPlot )
{
srcPlot->removePlot( plot );
}
else
{
plot->removeFromMdiAreaAndCollection();
}
plotsToMove[tIdx]->removeFromMdiAreaAndCollection();
}
size_t insertionStartIndex = 0;
@ -224,7 +213,7 @@ void RimMultiPlot::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, Ri
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimMultiPlot::plotCount() const
size_t RimMultiPlotWindow::plotCount() const
{
return m_plots.size();
}
@ -232,7 +221,7 @@ size_t RimMultiPlot::plotCount() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimMultiPlot::plotIndex( const RimPlot* plot ) const
size_t RimMultiPlotWindow::plotIndex( const RimPlot* plot ) const
{
return m_plots.index( plot );
}
@ -240,7 +229,7 @@ size_t RimMultiPlot::plotIndex( const RimPlot* plot ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot* RimMultiPlot::plotByIndex( size_t index ) const
RimPlot* RimMultiPlotWindow::plotByIndex( size_t index ) const
{
return m_plots[index];
}
@ -248,7 +237,7 @@ RimPlot* RimMultiPlot::plotByIndex( size_t index ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlot*> RimMultiPlot::plots() const
std::vector<RimPlot*> RimMultiPlotWindow::plots() const
{
return m_plots.childObjects();
}
@ -256,7 +245,7 @@ std::vector<RimPlot*> RimMultiPlot::plots() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlot*> RimMultiPlot::visiblePlots() const
std::vector<RimPlot*> RimMultiPlotWindow::visiblePlots() const
{
std::vector<RimPlot*> allVisiblePlots;
for ( RimPlot* plot : m_plots() )
@ -272,7 +261,7 @@ std::vector<RimPlot*> RimMultiPlot::visiblePlots() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::performLayoutUpdate()
void RimMultiPlotWindow::doUpdateLayout()
{
if ( m_showWindow )
{
@ -283,12 +272,12 @@ void RimMultiPlot::performLayoutUpdate()
//--------------------------------------------------------------------------------------------------
/// Empty default implementation
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updatePlotNames() {}
void RimMultiPlotWindow::updatePlotNames() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updatePlotOrderFromGridWidget()
void RimMultiPlotWindow::updatePlotOrderFromGridWidget()
{
std::sort( m_plots.begin(), m_plots.end(), [this]( RimPlot* lhs, RimPlot* rhs ) {
auto indexLhs = m_viewer->indexOfPlotWidget( lhs->viewer() );
@ -302,7 +291,7 @@ void RimMultiPlot::updatePlotOrderFromGridWidget()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setAutoScaleXEnabled( bool enabled )
void RimMultiPlotWindow::setAutoScaleXEnabled( bool enabled )
{
for ( RimPlot* plot : plots() )
{
@ -313,7 +302,7 @@ void RimMultiPlot::setAutoScaleXEnabled( bool enabled )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setAutoScaleYEnabled( bool enabled )
void RimMultiPlotWindow::setAutoScaleYEnabled( bool enabled )
{
for ( RimPlot* plot : plots() )
{
@ -324,7 +313,7 @@ void RimMultiPlot::setAutoScaleYEnabled( bool enabled )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimMultiPlot::columnCount() const
int RimMultiPlotWindow::columnCount() const
{
if ( m_columnCountEnum() == COLUMNS_UNLIMITED )
{
@ -336,7 +325,7 @@ int RimMultiPlot::columnCount() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimMultiPlot::columnCountField()
caf::PdmFieldHandle* RimMultiPlotWindow::columnCountField()
{
return &m_columnCountEnum;
}
@ -344,7 +333,7 @@ caf::PdmFieldHandle* RimMultiPlot::columnCountField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimMultiPlot::showPlotTitles() const
bool RimMultiPlotWindow::showPlotTitles() const
{
return m_showIndividualPlotTitles;
}
@ -352,7 +341,7 @@ bool RimMultiPlot::showPlotTitles() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::zoomAll()
void RimMultiPlotWindow::zoomAll()
{
setAutoScaleXEnabled( true );
setAutoScaleYEnabled( true );
@ -362,7 +351,7 @@ void RimMultiPlot::zoomAll()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimMultiPlot::asciiDataForPlotExport() const
QString RimMultiPlotWindow::asciiDataForPlotExport() const
{
QString out = multiPlotTitle() + "\n";
@ -380,7 +369,7 @@ QString RimMultiPlot::asciiDataForPlotExport() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::onPlotAdditionOrRemoval()
void RimMultiPlotWindow::onPlotAdditionOrRemoval()
{
updatePlotNames();
updateConnectedEditors();
@ -391,7 +380,23 @@ void RimMultiPlot::onPlotAdditionOrRemoval()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimMultiPlot::snapshotWindowContent()
void RimMultiPlotWindow::setAcceptDrops( bool acceptDrops )
{
m_acceptDrops = acceptDrops;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimMultiPlotWindow::acceptDrops() const
{
return m_acceptDrops;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimMultiPlotWindow::snapshotWindowContent()
{
QImage image;
@ -409,7 +414,7 @@ QImage RimMultiPlot::snapshotWindowContent()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimMultiPlot::createViewWidget( QWidget* mainWindowParent )
QWidget* RimMultiPlotWindow::createViewWidget( QWidget* mainWindowParent )
{
m_viewer = new RiuMultiPlotWindow( this, mainWindowParent );
recreatePlotWidgets();
@ -419,7 +424,7 @@ QWidget* RimMultiPlot::createViewWidget( QWidget* mainWindowParent )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::deleteViewWidget()
void RimMultiPlotWindow::deleteViewWidget()
{
cleanupBeforeClose();
}
@ -427,7 +432,7 @@ void RimMultiPlot::deleteViewWidget()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimMultiPlot::userDescriptionField()
caf::PdmFieldHandle* RimMultiPlotWindow::userDescriptionField()
{
return &m_plotWindowTitle;
}
@ -435,7 +440,7 @@ caf::PdmFieldHandle* RimMultiPlot::userDescriptionField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
void RimMultiPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
@ -460,7 +465,7 @@ void RimMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
void RimMultiPlotWindow::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Plot Layout" );
uiOrderingForPlotLayout( uiConfigName, *titleAndLegendsGroup );
@ -469,7 +474,7 @@ void RimMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& u
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
void RimMultiPlotWindow::uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showPlotWindowTitle );
uiOrdering.add( &m_plotWindowTitle );
@ -481,7 +486,7 @@ void RimMultiPlot::uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrde
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimMultiPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
QList<caf::PdmOptionItemInfo> RimMultiPlotWindow::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
@ -515,7 +520,7 @@ QList<caf::PdmOptionItemInfo> RimMultiPlot::calculateValueOptions( const caf::Pd
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::onLoadDataAndUpdate()
void RimMultiPlotWindow::onLoadDataAndUpdate()
{
updateMdiWindowVisibility();
updatePlotTitleInWidgets();
@ -526,7 +531,7 @@ void RimMultiPlot::onLoadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::initAfterRead()
void RimMultiPlotWindow::initAfterRead()
{
RimPlotWindow::initAfterRead();
}
@ -534,7 +539,7 @@ void RimMultiPlot::initAfterRead()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updatePlotTitleInWidgets()
void RimMultiPlotWindow::updatePlotTitleInWidgets()
{
if ( m_viewer )
{
@ -547,7 +552,7 @@ void RimMultiPlot::updatePlotTitleInWidgets()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updatePlots()
void RimMultiPlotWindow::updatePlots()
{
if ( m_showWindow )
{
@ -562,7 +567,7 @@ void RimMultiPlot::updatePlots()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updateZoom()
void RimMultiPlotWindow::updateZoom()
{
for ( RimPlot* plot : plots() )
{
@ -573,7 +578,7 @@ void RimMultiPlot::updateZoom()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::recreatePlotWidgets()
void RimMultiPlotWindow::recreatePlotWidgets()
{
CVF_ASSERT( m_viewer );
@ -589,7 +594,7 @@ void RimMultiPlot::recreatePlotWidgets()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimMultiPlot::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
bool RimMultiPlotWindow::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
{
if ( fontSettingType == RiaDefines::PLOT_FONT && m_viewer )
{
@ -615,7 +620,7 @@ bool RimMultiPlot::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingTy
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimMultiPlot::applyFontSize( RiaDefines::FontSettingType fontSettingType,
bool RimMultiPlotWindow::applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange /*= false */ )
@ -653,7 +658,7 @@ bool RimMultiPlot::applyFontSize( RiaDefines::FontSettingType fontSettingType,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::cleanupBeforeClose()
void RimMultiPlotWindow::cleanupBeforeClose()
{
auto plotVector = plots();
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )

View File

@ -34,7 +34,7 @@
class RimPlot;
class RimMultiPlot : public RimPlotWindow
class RimMultiPlotWindow : public RimPlotWindow
{
CAF_PDM_HEADER_INIT;
@ -50,10 +50,10 @@ public:
using ColumnCountEnum = caf::AppEnum<ColumnCount>;
public:
RimMultiPlot();
~RimMultiPlot() override;
RimMultiPlotWindow();
~RimMultiPlotWindow() override;
RimMultiPlot& operator=( RimMultiPlot&& rhs );
RimMultiPlotWindow& operator=( RimMultiPlotWindow&& rhs );
QWidget* viewWidget() override;
@ -90,6 +90,8 @@ public:
QString asciiDataForPlotExport() const;
virtual void onPlotAdditionOrRemoval();
void setAcceptDrops( bool acceptDrops );
bool acceptDrops() const;
protected:
QImage snapshotWindowContent() override;
@ -124,7 +126,7 @@ protected:
private:
void cleanupBeforeClose();
void performLayoutUpdate() override;
void doUpdateLayout() override;
protected:
caf::PdmField<bool> m_showPlotWindowTitle;
@ -137,4 +139,6 @@ protected:
private:
caf::PdmChildArrayField<RimPlot*> m_plots;
bool m_acceptDrops;
};

View File

@ -1,6 +1,6 @@
#include "RimPlot.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimPlotWindow.h"
#include "RiuQwtPlotWidget.h"
@ -35,6 +35,11 @@ RimPlot::RimPlot()
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot::~RimPlot() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -75,6 +80,40 @@ void RimPlot::setColSpan( RowOrColSpan colSpan )
m_colSpan = colSpan;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::removeFromMdiAreaAndCollection()
{
if ( isMdiWindow() )
{
revokeMdiWindowStatus();
}
doRemoveFromCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::updateAfterInsertingIntoMultiPlot()
{
updateLegend();
updateAxes();
updateLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
if ( !isMdiWindow() )
{
uiOrdering.add( &m_rowSpan );
uiOrdering.add( &m_colSpan );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -82,7 +121,6 @@ void RimPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const Q
{
if ( changedField == &m_colSpan || changedField == &m_rowSpan )
{
onRowOrColSpanChange();
updateParentLayout();
}
}

View File

@ -32,6 +32,10 @@ class RiuQwtPlotWidget;
class RimPlotCurve;
class QwtPlotCurve;
//==================================================================================================
///
///
//==================================================================================================
class RimPlot : public RimPlotWindow
{
CAF_PDM_HEADER_INIT;
@ -50,7 +54,7 @@ public:
public:
RimPlot();
virtual ~RimPlot() = default;
virtual ~RimPlot();
// Real implementations
void createPlotWidget();
@ -58,6 +62,8 @@ public:
RowOrColSpan colSpan() const;
void setRowSpan( RowOrColSpan rowSpan );
void setColSpan( RowOrColSpan colSpan );
void removeFromMdiAreaAndCollection();
void updateAfterInsertingIntoMultiPlot();
// Pure virtual interface methods
virtual RiuQwtPlotWidget* viewer() = 0;
@ -66,6 +72,7 @@ public:
virtual void setAutoScaleYEnabled( bool enabled ) = 0;
virtual void updateAxes() = 0;
virtual void updateLegend() = 0;
virtual void updateZoomInQwt() = 0;
virtual void updateZoomFromQwt() = 0;
@ -77,17 +84,14 @@ public:
virtual void onAxisSelected( int axis, bool toggle ) = 0;
// TODO: Refactor
virtual void removeFromMdiAreaAndCollection() {}
virtual void updateAfterInsertingIntoMultiPlot() {}
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
private:
virtual void onRowOrColSpanChange() {}
virtual void doRemoveFromCollection() = 0;
protected:
caf::PdmField<RowOrColSpanEnum> m_rowSpan;

View File

@ -132,7 +132,7 @@ void RimPlotWindow::setLegendFontSize( int fontSize )
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::updateLayout()
{
performLayoutUpdate();
doUpdateLayout();
}
//--------------------------------------------------------------------------------------------------
@ -233,7 +233,7 @@ void RimPlotWindow::setId( int id )
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::assignIdIfNecessary()
{
if ( m_id == -1 )
if ( m_id == -1 && isMdiWindow() )
{
RiaApplication::instance()->project()->assignPlotIdToPlotWindow( this );
}

View File

@ -25,10 +25,14 @@
#include "cafPdmObject.h"
class RimProject;
class QwtPlotCurve;
class QwtPlotCurve;
class QKeyEvent;
//==================================================================================================
///
///
//==================================================================================================
class RimPlotWindow : public RimViewWindow
{
CAF_PDM_HEADER_INIT;
@ -64,7 +68,7 @@ protected:
void uiOrderingForLegendSettings( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
private:
virtual void performLayoutUpdate() {}
virtual void doUpdateLayout() {}
private:
friend class RimProject;

View File

@ -182,7 +182,7 @@ void RimReloadCaseTools::updateAllPlots()
RimMultiPlotCollection* multiPlotCollection = project->mainPlotCollection()->multiPlotCollection();
if ( multiPlotCollection )
{
for ( RimMultiPlot* plotWindow : multiPlotCollection->multiPlots() )
for ( RimMultiPlotWindow* plotWindow : multiPlotCollection->multiPlots() )
{
plotWindow->loadDataAndUpdate();
}

View File

@ -326,7 +326,7 @@ void RimViewWindow::initAfterRead()
void RimViewWindow::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiTreeViewItemAttribute* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute );
if ( treeItemAttribute && RiaApplication::instance()->preferences()->showViewIdInProjectTree() )
if ( treeItemAttribute && RiaApplication::instance()->preferences()->showViewIdInProjectTree() && id() >= 0 )
{
treeItemAttribute->tag = QString( "%1" ).arg( id() );
cvf::Color3f viewColor = RiaColorTables::contrastCategoryPaletteColors().cycledColor3f( (size_t)id() );

View File

@ -110,7 +110,6 @@ protected:
virtual void updateMdiWindowTitle(); // Has real default implementation
virtual void deleteViewWidget() = 0;
virtual void onLoadDataAndUpdate() = 0;
virtual void assignIdIfNecessary() = 0;
virtual void onViewNavigationChanged();
virtual bool isWindowVisible() const; // Virtual To allow special visibility control
//////////
@ -130,6 +129,7 @@ private:
friend class RimProject;
void setAsMdiWindow( int mainWindowID );
virtual void assignIdIfNecessary() = 0;
protected:
caf::PdmField<bool> m_showWindow;

View File

@ -187,7 +187,7 @@ void RimWellLogCurve::updateLegendsInPlot()
firstAncestorOrThisOfType( wellLogTrack );
if ( wellLogTrack )
{
wellLogTrack->updateAllLegendItems();
wellLogTrack->updateLegend();
}
}

View File

@ -105,7 +105,7 @@ RimWellLogPlot::RimWellLogPlot()
m_maxAvailableDepth = -HUGE_VAL;
m_commonDataSourceEnabled = true;
m_columnCountEnum = RimMultiPlot::COLUMNS_UNLIMITED;
m_columnCountEnum = RimMultiPlotWindow::COLUMNS_UNLIMITED;
m_plotLegendsHorizontal = false;
setMultiPlotTitleVisible( false );
@ -116,7 +116,7 @@ RimWellLogPlot::RimWellLogPlot()
//--------------------------------------------------------------------------------------------------
RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
{
RimMultiPlot::operator=( std::move( rhs ) );
RimMultiPlotWindow::operator=( std::move( rhs ) );
auto dataSource = rhs.m_commonDataSource();
rhs.m_commonDataSource.removeChildObject( dataSource );
@ -183,7 +183,7 @@ void RimWellLogPlot::updateZoom()
m_maxAvailableDepth );
}
RimMultiPlot::updateZoom();
RimMultiPlotWindow::updateZoom();
}
//--------------------------------------------------------------------------------------------------
@ -503,7 +503,7 @@ void RimWellLogPlot::onPlotAdditionOrRemoval()
{
calculateAvailableDepthRange();
updateZoom();
RimMultiPlot::onPlotAdditionOrRemoval();
RimMultiPlotWindow::onPlotAdditionOrRemoval();
}
//--------------------------------------------------------------------------------------------------
@ -533,7 +533,7 @@ void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue );
RimMultiPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth )
{
@ -589,7 +589,7 @@ void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Plot Layout" );
uiOrderingForAutoName( uiConfigName, *titleAndLegendsGroup );
RimPlotWindow::uiOrderingForLegendSettings( uiConfigName, uiOrdering );
RimPlotWindow::uiOrderingForLegendSettings( uiConfigName, *titleAndLegendsGroup );
titleAndLegendsGroup->add( &m_columnCountEnum );
uiOrdering.skipRemainingFields( true );
@ -601,7 +601,8 @@ void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options = RimMultiPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
QList<caf::PdmOptionItemInfo> options = RimMultiPlotWindow::calculateValueOptions( fieldNeedingOptions,
useOptionsOnly );
if ( fieldNeedingOptions == &m_depthType )
{
@ -634,7 +635,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions( const caf::
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::initAfterRead()
{
RimMultiPlot::initAfterRead();
RimMultiPlotWindow::initAfterRead();
if ( m_depthAxisGridVisibility() == AXIS_GRID_MINOR )
{
@ -679,7 +680,7 @@ QImage RimWellLogPlot::snapshotWindowContent()
CAF_ASSERT( wellLogViewer );
bool isScrollbarVisible = wellLogViewer->isScrollbarVisible();
wellLogViewer->setScrollbarVisible( false );
image = RimMultiPlot::snapshotWindowContent();
image = RimMultiPlotWindow::snapshotWindowContent();
wellLogViewer->setScrollbarVisible( isScrollbarVisible );
}

View File

@ -27,7 +27,7 @@
#include "cafPdmObject.h"
#include "RiaDefines.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimWellLogPlotNameConfig.h"
#include <QPointer>
@ -43,7 +43,7 @@ class QKeyEvent;
///
///
//==================================================================================================
class RimWellLogPlot : public RimMultiPlot, public RimNameConfigHolderInterface
class RimWellLogPlot : public RimMultiPlotWindow, public RimNameConfigHolderInterface
{
CAF_PDM_HEADER_INIT;

View File

@ -487,6 +487,19 @@ void RimWellLogTrack::updateYZoom()
m_plotWidget->setAxisRange( QwtPlot::yLeft, m_visibleYRangeMin(), m_visibleYRangeMax() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::doRemoveFromCollection()
{
RimMultiPlotWindow* multiPlot = nullptr;
this->firstAncestorOrThisOfType( multiPlot );
if ( multiPlot )
{
multiPlot->removePlot( this );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -494,6 +507,8 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_showWindow )
{
if ( m_plotWidget )
@ -716,7 +731,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateAllLegendItems()
void RimWellLogTrack::updateLegend()
{
reattachAllCurves();
if ( m_plotWidget )
@ -1087,7 +1102,7 @@ void RimWellLogTrack::onLoadDataAndUpdate()
m_explicitTickIntervals.uiCapability()->setUiReadOnly( emptyRange );
m_xAxisGridVisibility.uiCapability()->setUiReadOnly( emptyRange );
updateAllLegendItems();
updateLegend();
}
//--------------------------------------------------------------------------------------------------

View File

@ -186,7 +186,7 @@ public:
void setFormationsForCaseWithSimWellOnly( bool caseWithSimWellOnly );
void updateXAxisAndGridTickIntervals();
void updateAllLegendItems();
void updateLegend() override;
QString asciiDataForPlotExport() const override;
@ -215,6 +215,8 @@ private:
void updateXZoom();
void updateYZoom();
void doRemoveFromCollection() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;

View File

@ -578,7 +578,7 @@ void RimSummaryCurve::updateLegendsInPlot()
{
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
plot->updateAllLegendItems();
plot->updateLegend();
}
//--------------------------------------------------------------------------------------------------

View File

@ -33,7 +33,7 @@
#include "RimEnsembleCurveSet.h"
#include "RimEnsembleCurveSetCollection.h"
#include "RimGridTimeHistoryCurve.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimPlotAxisProperties.h"
#include "RimProject.h"
#include "RimSummaryCase.h"
@ -603,8 +603,10 @@ void RimSummaryPlot::updateAll()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateAllLegendItems()
void RimSummaryPlot::updateLegend()
{
m_plotWidget->setLegendVisible( m_showPlotLegends && isMdiWindow() );
reattachAllCurves();
if ( m_plotWidget )
{
@ -1546,37 +1548,15 @@ void RimSummaryPlot::removeEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::removeFromMdiAreaAndCollection()
void RimSummaryPlot::doRemoveFromCollection()
{
if ( isMdiWindow() )
{
RimSummaryPlotCollection* summaryCollection = nullptr;
this->firstAncestorOrThisOfType( summaryCollection );
if ( summaryCollection )
{
summaryCollection->removeSummaryPlot( this );
this->revokeMdiWindowStatus();
summaryCollection->updateAllRequiredEditors();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateAfterInsertingIntoMultiPlot()
{
if ( m_plotWidget )
{
m_plotWidget->setTitle( "" );
m_plotWidget->setLegendVisible( false );
}
if ( m_timeAxisProperties )
{
m_timeAxisProperties->showTitle = true;
}
updateAxes();
}
//--------------------------------------------------------------------------------------------------
@ -1776,7 +1756,9 @@ void RimSummaryPlot::initAfterRead()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateMdiWindowTitle()
{
if ( m_plotWidget && isMdiWindow() )
if ( m_plotWidget )
{
if ( isMdiWindow() )
{
QString plotTitle = description();
@ -1790,6 +1772,11 @@ void RimSummaryPlot::updateMdiWindowTitle()
{
m_plotWidget->setTitle( "" );
}
}
else
{
m_plotWidget->setTitle( "" );
}
m_plotWidget->scheduleReplot();
}
}
@ -1856,7 +1843,7 @@ void RimSummaryPlot::updateWindowVisibility()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::performLayoutUpdate()
void RimSummaryPlot::doUpdateLayout()
{
this->loadDataAndUpdate();
}

View File

@ -135,7 +135,7 @@ public:
void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
void updateAll();
void updateAllLegendItems();
void updateLegend() override;
void setPlotInfoLabel( const QString& label );
void showPlotInfoLabel( bool show );
@ -173,9 +173,6 @@ public:
void addOrUpdateEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
void removeEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
void removeFromMdiAreaAndCollection() override;
void updateAfterInsertingIntoMultiPlot() override;
public:
// RimViewWindow overrides
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
@ -187,10 +184,12 @@ private:
void updateNameHelperWithCurveData( RimSummaryPlotNameHelper* nameHelper ) const;
void updateWindowVisibility();
void performLayoutUpdate() override;
void doUpdateLayout() override;
void detachAllPlotItems();
void doRemoveFromCollection() override;
protected:
// Overridden PDM methods
caf::PdmFieldHandle* userDescriptionField() override;

View File

@ -29,7 +29,7 @@
#include "RimEclipseResultCase.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMimeData.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimPlot.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
@ -186,7 +186,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if ( dynamic_cast<RimMultiPlot*>( uiItem ) )
else if ( dynamic_cast<RimMultiPlotWindow*>( uiItem ) )
{
if ( RiuTypedPdmObjects<RimPlot>::containsTypedObjects( m_dragItems ) )
{
@ -304,7 +304,7 @@ bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, in
return handleWellLogPlotTrackDrop( action, draggedObjects, wellLogPlotTrack, row );
}
RimMultiPlot* multiPlot;
RimMultiPlotWindow* multiPlot;
dropTarget->firstAncestorOrThisOfType( multiPlot );
if ( multiPlot )
{
@ -456,7 +456,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop( Qt::DropAction action,
//--------------------------------------------------------------------------------------------------
bool RiuDragDrop::handleMultiPlotDrop( Qt::DropAction action,
caf::PdmObjectGroup& draggedObjects,
RimMultiPlot* multiPlot,
RimMultiPlotWindow* multiPlot,
int insertAtPosition )
{
std::vector<RimPlot*> plots = RiuTypedPdmObjects<RimPlot>::typedObjectsFromGroup( draggedObjects );

View File

@ -29,7 +29,7 @@ namespace caf
class PdmObjectHandle;
}
class RimMultiPlot;
class RimMultiPlotWindow;
class RimIdenticalGridCaseGroup;
class RimSummaryCaseCollection;
class RimSummaryCaseMainCollection;
@ -67,7 +67,7 @@ private:
int insertAtPosition );
bool handleMultiPlotDrop( Qt::DropAction action,
caf::PdmObjectGroup& objectGroup,
RimMultiPlot* multiPlot,
RimMultiPlotWindow* multiPlot,
int insertAtPosition );
bool handleWellLogPlotCurveDrop( Qt::DropAction action,
caf::PdmObjectGroup& objectGroup,

View File

@ -26,7 +26,7 @@
#include "WellLogCommands/RicWellLogPlotTrackFeatureImpl.h"
#include "RimContextCommandBuilder.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimWellLogTrack.h"
#include "RiuMainWindow.h"
@ -57,7 +57,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuMultiPlotWindow::RiuMultiPlotWindow( RimMultiPlot* plotDefinition, QWidget* parent )
RiuMultiPlotWindow::RiuMultiPlotWindow( RimMultiPlotWindow* plotDefinition, QWidget* parent )
: QWidget( parent )
{
Q_ASSERT( plotDefinition );
@ -100,7 +100,7 @@ RiuMultiPlotWindow::RiuMultiPlotWindow( RimMultiPlot* plotDefinition, QWidget* p
setFocusPolicy( Qt::StrongFocus );
setAcceptDrops( true );
setAcceptDrops( m_plotDefinition->acceptDrops() );
RiaApplication* app = RiaApplication::instance();
int defaultFontSize = RiaFontCache::pointSizeFromFontSizeEnum( app->preferences()->defaultPlotFontSize() );
@ -117,7 +117,7 @@ RiuMultiPlotWindow::~RiuMultiPlotWindow() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMultiPlot* RiuMultiPlotWindow::ownerPlotDefinition()
RimMultiPlotWindow* RiuMultiPlotWindow::ownerPlotDefinition()
{
return m_plotDefinition;
}
@ -566,7 +566,7 @@ void RiuMultiPlotWindow::reinsertPlotWidgets()
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
if ( plotWidgets.empty() )
if ( plotWidgets.empty() && acceptDrops() )
{
m_gridLayout->addWidget( m_dropTargetPlaceHolder, 0, 0 );
m_gridLayout->setRowStretch( 0, 1 );

View File

@ -35,7 +35,7 @@
#include <map>
class RiaPlotWindowRedrawScheduler;
class RimMultiPlot;
class RimMultiPlotWindow;
class RiuQwtPlotLegend;
class RiuQwtPlotWidget;
@ -53,10 +53,10 @@ class RiuMultiPlotWindow : public QWidget, public RiuInterfaceToViewWindow, publ
Q_OBJECT
public:
RiuMultiPlotWindow( RimMultiPlot* plotDefinition, QWidget* parent = nullptr );
RiuMultiPlotWindow( RimMultiPlotWindow* plotDefinition, QWidget* parent = nullptr );
~RiuMultiPlotWindow() override;
RimMultiPlot* ownerPlotDefinition();
RimMultiPlotWindow* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
void addPlot( RiuQwtPlotWidget* plotWidget );
@ -122,7 +122,7 @@ protected:
QList<QPointer<QLabel>> m_subTitles;
QList<QPointer<RiuQwtPlotLegend>> m_legends;
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
caf::PdmPointer<RimMultiPlot> m_plotDefinition;
caf::PdmPointer<RimMultiPlotWindow> m_plotDefinition;
QPointer<QLabel> m_dropTargetPlaceHolder;
RiuWidgetStyleSheet m_dropTargetStyleSheet;

View File

@ -571,7 +571,7 @@ void RiuPlotMainWindow::updateWellLogPlotToolBar()
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateMultiPlotToolBar()
{
RimMultiPlot* plotWindow = dynamic_cast<RimMultiPlot*>( m_activePlotViewWindow.p() );
RimMultiPlotWindow* plotWindow = dynamic_cast<RimMultiPlotWindow*>( m_activePlotViewWindow.p() );
if ( plotWindow )
{
std::vector<caf::PdmFieldHandle*> toolBarFields = {plotWindow->columnCountField()};
@ -593,7 +593,7 @@ void RiuPlotMainWindow::updateMultiPlotToolBar()
void RiuPlotMainWindow::updateSummaryPlotToolBar( bool forceUpdateUi )
{
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( m_activePlotViewWindow.p() );
RimMultiPlot* multiPlot = dynamic_cast<RimMultiPlot*>( m_activePlotViewWindow.p() );
RimMultiPlotWindow* multiPlot = dynamic_cast<RimMultiPlotWindow*>( m_activePlotViewWindow.p() );
if ( multiPlot )
{
summaryPlot = caf::SelectionManager::instance()->selectedItemOfType<RimSummaryPlot>();

View File

@ -55,7 +55,7 @@ void PdmObjectGroup::createCopyByType(std::vector<PdmPointer<T> >* copyOfTypedOb
{
QString xml = xmlObj(sourceTypedObjects[i])->writeObjectToXmlString();
PdmObjectHandle* objectCopy = PdmXmlObjectHandle::readUnknownObjectFromXmlString(xml, PdmDefaultObjectFactory::instance());
PdmObjectHandle* objectCopy = PdmXmlObjectHandle::readUnknownObjectFromXmlString(xml, PdmDefaultObjectFactory::instance(), true);
T* typedObject = dynamic_cast<T*>(objectCopy);
CAF_ASSERT(typedObject);