mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor RimPlotWindow and RimPlotInterface
This commit is contained in:
@@ -50,10 +50,10 @@ std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString&
|
||||
bool capitalizeFileNames,
|
||||
double resampleInterval )
|
||||
{
|
||||
std::vector<RimWellLogCurve*> allCurves;
|
||||
std::vector<RimPlotInterface*> plots = plotWindow->visiblePlots();
|
||||
std::vector<RimWellLogCurve*> allCurves;
|
||||
std::vector<RimPlot*> plots = plotWindow->visiblePlots();
|
||||
|
||||
for ( RimPlotInterface* plot : plots )
|
||||
for ( RimPlot* plot : plots )
|
||||
{
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plot );
|
||||
if ( track )
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimMultiPlotCollection.h"
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
@@ -60,12 +60,12 @@ RicfCommandResponse RicNewMultiPlotFeature::execute()
|
||||
|
||||
if ( !m_plots().empty() )
|
||||
{
|
||||
std::vector<RimPlotInterface*> plotInterfaces;
|
||||
std::vector<RimPlot*> plots;
|
||||
for ( auto ptr : m_plots() )
|
||||
{
|
||||
plotInterfaces.push_back( reinterpret_cast<RimPlotInterface*>( ptr ) );
|
||||
plots.push_back( reinterpret_cast<RimPlot*>( ptr ) );
|
||||
}
|
||||
plotWindow->movePlotsToThis( plotInterfaces, nullptr );
|
||||
plotWindow->movePlotsToThis( plots, nullptr );
|
||||
}
|
||||
|
||||
plotCollection->updateAllRequiredEditors();
|
||||
@@ -89,12 +89,12 @@ bool RicNewMultiPlotFeature::isCommandEnabled()
|
||||
return true;
|
||||
}
|
||||
|
||||
auto selectedPlots = selectedPlotInterfaces();
|
||||
auto plots = selectedPlots();
|
||||
|
||||
std::vector<caf::PdmUiItem*> selectedUiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedUiItems );
|
||||
|
||||
return !selectedPlots.empty() && selectedPlots.size() == selectedUiItems.size();
|
||||
return !plots.empty() && plots.size() == selectedUiItems.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -103,10 +103,10 @@ bool RicNewMultiPlotFeature::isCommandEnabled()
|
||||
void RicNewMultiPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
m_plots.v().clear();
|
||||
auto selectedPlots = selectedPlotInterfaces();
|
||||
for ( RimPlotInterface* plotInterface : selectedPlots )
|
||||
auto plots = selectedPlots();
|
||||
for ( RimPlot* plot : plots )
|
||||
{
|
||||
m_plots.v().push_back( reinterpret_cast<uintptr_t>( plotInterface ) );
|
||||
m_plots.v().push_back( reinterpret_cast<uintptr_t>( plot ) );
|
||||
}
|
||||
execute();
|
||||
}
|
||||
@@ -116,7 +116,7 @@ void RicNewMultiPlotFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewMultiPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
if ( selectedPlotInterfaces().empty() )
|
||||
if ( selectedPlots().empty() )
|
||||
{
|
||||
actionToSetup->setText( "New Empty Multi Plot" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
|
||||
@@ -131,19 +131,19 @@ void RicNewMultiPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlotInterface*> RicNewMultiPlotFeature::selectedPlotInterfaces()
|
||||
std::vector<RimPlot*> RicNewMultiPlotFeature::selectedPlots()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
|
||||
std::vector<RimPlotInterface*> plotInterfaces;
|
||||
std::vector<RimPlot*> plots;
|
||||
for ( caf::PdmUiItem* uiItem : uiItems )
|
||||
{
|
||||
RimPlotInterface* plotInterface = dynamic_cast<RimPlotInterface*>( uiItem );
|
||||
RimPlot* plotInterface = dynamic_cast<RimPlot*>( uiItem );
|
||||
if ( plotInterface )
|
||||
{
|
||||
plotInterfaces.push_back( plotInterface );
|
||||
plots.push_back( plotInterface );
|
||||
}
|
||||
}
|
||||
return plotInterfaces;
|
||||
return plots;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimPlotInterface;
|
||||
class RimPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -45,7 +45,7 @@ protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
static std::vector<RimPlotInterface*> selectedPlotInterfaces();
|
||||
static std::vector<RimPlot*> selectedPlots();
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<uint64_t>> m_plots;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -52,7 +52,7 @@ bool RicDeleteSubPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimMultiPlot* multiPlot = nullptr;
|
||||
object->firstAncestorOrThisOfType( multiPlot );
|
||||
if ( dynamic_cast<RimPlotInterface*>( object ) && multiPlot )
|
||||
if ( dynamic_cast<RimPlotWindow*>( object ) && multiPlot )
|
||||
{
|
||||
plotsSelected++;
|
||||
}
|
||||
@@ -70,21 +70,19 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
|
||||
|
||||
std::vector<caf::PdmObject*> selection;
|
||||
std::vector<RimPlot*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
std::set<RimMultiPlot*> alteredPlotWindows;
|
||||
|
||||
for ( size_t i = 0; i < selection.size(); i++ )
|
||||
for ( RimPlot* plot : selection )
|
||||
{
|
||||
RimPlotInterface* plot = dynamic_cast<RimPlotInterface*>( selection[i] );
|
||||
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
selection[i]->firstAncestorOrThisOfType( plotWindow );
|
||||
plot->firstAncestorOrThisOfType( plotWindow );
|
||||
if ( plot && plotWindow )
|
||||
{
|
||||
alteredPlotWindows.insert( plotWindow );
|
||||
plotWindow->removePlot( plot );
|
||||
caf::SelectionManager::instance()->removeObjectFromAllSelections( selection[i] );
|
||||
caf::SelectionManager::instance()->removeObjectFromAllSelections( plot );
|
||||
|
||||
plotWindow->updateConnectedEditors();
|
||||
delete plot;
|
||||
|
||||
@@ -191,7 +191,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil
|
||||
formationTrack->setFormationCase( geoMechCase );
|
||||
formationTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
|
||||
formationTrack->setVisibleXRange( 0.0, 0.0 );
|
||||
formationTrack->setColSpan( RimPlotInterface::ONE );
|
||||
formationTrack->setColSpan( RimPlot::ONE );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -202,7 +202,7 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
|
||||
RimGeoMechCase* geoMechCase )
|
||||
{
|
||||
RimWellLogTrack* casingShoeTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Well Design", plot );
|
||||
casingShoeTrack->setColSpan( RimPlotInterface::ONE );
|
||||
casingShoeTrack->setColSpan( RimPlot::ONE );
|
||||
casingShoeTrack->setFormationWellPath( wellPath );
|
||||
casingShoeTrack->setFormationCase( geoMechCase );
|
||||
casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
|
||||
@@ -226,7 +226,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
|
||||
RimWellLogTrack* paramCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
|
||||
"WBS Parameters",
|
||||
plot );
|
||||
paramCurvesTrack->setColSpan( RimPlotInterface::TWO );
|
||||
paramCurvesTrack->setColSpan( RimPlot::TWO );
|
||||
paramCurvesTrack->setAutoScaleXEnabled( true );
|
||||
paramCurvesTrack->setTickIntervals( 0.5, 0.05 );
|
||||
paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
|
||||
@@ -234,7 +234,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
|
||||
paramCurvesTrack->setFormationCase( geoMechCase );
|
||||
paramCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::CURVE_ANNOTATIONS );
|
||||
paramCurvesTrack->setShowRegionLabels( true );
|
||||
paramCurvesTrack->setChecked( false );
|
||||
paramCurvesTrack->setShowWindow( false );
|
||||
std::vector<QString> resultNames = RiaDefines::wellPathStabilityParameterNames();
|
||||
|
||||
std::vector<cvf::Color3f> colors = {cvf::Color3f::CRIMSON, cvf::Color3f::DARK_YELLOW};
|
||||
@@ -272,7 +272,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
|
||||
RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
|
||||
"Stability Curves",
|
||||
plot );
|
||||
stabilityCurvesTrack->setColSpan( RimPlotInterface::FIVE );
|
||||
stabilityCurvesTrack->setColSpan( RimPlot::FIVE );
|
||||
stabilityCurvesTrack->setAutoScaleXEnabled( true );
|
||||
stabilityCurvesTrack->setTickIntervals( 0.5, 0.05 );
|
||||
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
|
||||
@@ -361,7 +361,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
|
||||
maxValue = cvf::Math::clamp( maxValue, angleIncrement, 360.0 );
|
||||
minValue = cvf::Math::clamp( minValue, 0.0, maxValue - 90.0 );
|
||||
}
|
||||
wellPathAnglesTrack->setColSpan( RimPlotInterface::THREE );
|
||||
wellPathAnglesTrack->setColSpan( RimPlot::THREE );
|
||||
wellPathAnglesTrack->setVisibleXRange( minValue, maxValue );
|
||||
wellPathAnglesTrack->setTickIntervals( 90.0, 30.0 );
|
||||
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
|
||||
|
||||
Reference in New Issue
Block a user