mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Create Grid plot collection and allow creation of new combination plots
This commit is contained in:
@@ -83,6 +83,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextUi.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewGridPlotWindowFeature.h
|
||||
)
|
||||
|
||||
|
||||
@@ -164,6 +165,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextUi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewGridPlotWindowFeature.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotDataSet.h"
|
||||
#include "RimGridPlotWindow.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimIntersection.h"
|
||||
@@ -107,7 +108,12 @@ bool isDeletable( caf::PdmUiItem* uiItem )
|
||||
if ( dynamic_cast<RimViewController*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimWellLogPlot*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimWellLogCurve*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimSummaryPlot*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimSummaryPlot*>( uiItem ) )
|
||||
{
|
||||
RimGridPlotWindow* plotWindow = nullptr;
|
||||
static_cast<RimSummaryPlot*>( uiItem )->firstAncestorOrThisOfType( plotWindow );
|
||||
return plotWindow == nullptr;
|
||||
}
|
||||
if ( dynamic_cast<RimSummaryCurve*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimGridTimeHistoryCurve*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimIntersection*>( uiItem ) ) return true;
|
||||
@@ -131,7 +137,15 @@ bool isDeletable( caf::PdmUiItem* uiItem )
|
||||
if ( dynamic_cast<RimTextAnnotation*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimReachCircleAnnotation*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimPolylinesAnnotation*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimGridCrossPlot*>( uiItem ) )
|
||||
{
|
||||
RimGridPlotWindow* plotWindow = nullptr;
|
||||
static_cast<RimGridCrossPlot*>( uiItem )->firstAncestorOrThisOfType( plotWindow );
|
||||
return plotWindow == nullptr;
|
||||
}
|
||||
|
||||
if ( dynamic_cast<RimGridCrossPlot*>( uiItem ) ) return true;
|
||||
|
||||
if ( dynamic_cast<RimGridCrossPlotDataSet*>( uiItem ) ) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
71
ApplicationCode/Commands/RicNewGridPlotWindowFeature.cpp
Normal file
71
ApplicationCode/Commands/RicNewGridPlotWindowFeature.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewGridPlotWindowFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimGridPlotWindow.h"
|
||||
#include "RimGridPlotWindowCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include <QAction>
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewGridPlotWindowFeature, "RicNewGridPlotWindowFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewGridPlotWindowFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewGridPlotWindowFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RimGridPlotWindowCollection* plotCollection = project->mainPlotCollection()->combinationPlotCollection();
|
||||
|
||||
RimGridPlotWindow* plotWindow = new RimGridPlotWindow;
|
||||
plotWindow->setDescription( QString( "Combination Plot %1" ).arg( plotCollection->gridPlotWindows().size() + 1 ) );
|
||||
plotWindow->setAsPlotMdiWindow();
|
||||
plotCollection->addGridPlotWindow( plotWindow );
|
||||
plotCollection->updateAllRequiredEditors();
|
||||
|
||||
plotWindow->loadDataAndUpdate();
|
||||
|
||||
RiuPlotMainWindowTools::setExpanded( plotCollection, true );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewGridPlotWindowFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Empty Combination Plot" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
|
||||
}
|
||||
35
ApplicationCode/Commands/RicNewGridPlotWindowFeature.h
Normal file
35
ApplicationCode/Commands/RicNewGridPlotWindowFeature.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewGridPlotWindowFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -97,6 +97,7 @@ RicSummaryCurveCreator::RicSummaryCurveCreator()
|
||||
CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region", "", "", "" );
|
||||
|
||||
m_previewPlot.reset( new RimSummaryPlot() );
|
||||
m_previewPlot->setDraggable( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_useAutoPlotTitleProxy, "UseAutoPlotTitle", "Auto Plot Title", "", "", "" );
|
||||
m_useAutoPlotTitleProxy.registerGetMethod( this, &RicSummaryCurveCreator::proxyPlotAutoTitle );
|
||||
@@ -909,7 +910,7 @@ void RicSummaryCurveCreator::selectionEditorFieldChanged()
|
||||
void RicSummaryCurveCreator::proxyEnablePlotAutoTitle( const bool& enable )
|
||||
{
|
||||
m_previewPlot->enableAutoPlotTitle( enable );
|
||||
m_previewPlot->enableShowPlotTitle( enable );
|
||||
m_previewPlot->setPlotTitleVisible( enable );
|
||||
m_previewPlot->updateCurveNames();
|
||||
m_previewPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
|
||||
lastPlotCreated = newPlot;
|
||||
|
||||
newPlot->showLegend( !hideLegend );
|
||||
newPlot->setLegendsVisible( !hideLegend );
|
||||
newPlot->setNormalizationEnabled( isNormalizedY );
|
||||
|
||||
newPlot->applyDefaultCurveAppearances();
|
||||
@@ -532,7 +532,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
newPlot->ensembleCurveSetCollection()->addCurveSet( curveSet );
|
||||
}
|
||||
|
||||
newPlot->showLegend( !hideLegend );
|
||||
newPlot->setLegendsVisible( !hideLegend );
|
||||
newPlot->setNormalizationEnabled( isNormalizedY );
|
||||
|
||||
newPlot->applyDefaultCurveAppearances();
|
||||
@@ -601,7 +601,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
newPlot->addGridTimeHistoryCurve( curve );
|
||||
}
|
||||
|
||||
newPlot->showLegend( !hideLegend );
|
||||
newPlot->setLegendsVisible( !hideLegend );
|
||||
newPlot->setNormalizationEnabled( isNormalizedY );
|
||||
newPlot->loadDataAndUpdate();
|
||||
lastPlotCreated = newPlot;
|
||||
@@ -653,7 +653,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
{
|
||||
newPlot->addGridTimeHistoryCurve( newCurve );
|
||||
}
|
||||
newPlot->showLegend( !hideLegend );
|
||||
newPlot->setLegendsVisible( !hideLegend );
|
||||
newPlot->setNormalizationEnabled( isNormalizedY );
|
||||
newPlot->loadDataAndUpdate();
|
||||
lastPlotCreated = newPlot;
|
||||
|
||||
@@ -27,12 +27,13 @@
|
||||
|
||||
#include "RimGridPlotWindow.h"
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeleteSubPlotFeature, "RicDeleteWellLogPlotTrackFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicDeleteSubPlotFeature, "RicDeleteSubPlotFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -46,12 +47,17 @@ bool RicDeleteSubPlotFeature::isCommandEnabled()
|
||||
|
||||
if ( selection.size() > 0 )
|
||||
{
|
||||
RimGridPlotWindow* wellLogPlot = nullptr;
|
||||
selection[0]->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( dynamic_cast<RimPlotInterface*>( selection[0] ) && wellLogPlot && wellLogPlot->plotCount() > 1 )
|
||||
size_t plotsSelected = 0;
|
||||
for ( caf::PdmObject* object : selection )
|
||||
{
|
||||
return true;
|
||||
RimGridPlotWindow* gridPlotWindow = nullptr;
|
||||
object->firstAncestorOrThisOfType( gridPlotWindow );
|
||||
if ( dynamic_cast<RimPlotInterface*>( object ) && gridPlotWindow )
|
||||
{
|
||||
plotsSelected++;
|
||||
}
|
||||
}
|
||||
return plotsSelected == selection.size();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -66,34 +72,28 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
std::vector<caf::PdmObject*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
std::set<RimGridPlotWindow*> alteredWellLogPlots;
|
||||
std::set<RimGridPlotWindow*> alteredPlotWindows;
|
||||
|
||||
for ( size_t i = 0; i < selection.size(); i++ )
|
||||
{
|
||||
RimPlotInterface* plot = dynamic_cast<RimPlotInterface*>( selection[i] );
|
||||
|
||||
RimGridPlotWindow* wellLogPlot = nullptr;
|
||||
selection[i]->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( plot && wellLogPlot && wellLogPlot->plotCount() > 1 )
|
||||
RimGridPlotWindow* plotWindow = nullptr;
|
||||
selection[i]->firstAncestorOrThisOfType( plotWindow );
|
||||
if ( plot && plotWindow )
|
||||
{
|
||||
alteredWellLogPlots.insert( wellLogPlot );
|
||||
wellLogPlot->removePlot( plot );
|
||||
alteredPlotWindows.insert( plotWindow );
|
||||
plotWindow->removePlot( plot );
|
||||
caf::SelectionManager::instance()->removeObjectFromAllSelections( selection[i] );
|
||||
|
||||
wellLogPlot->updateConnectedEditors();
|
||||
plotWindow->updateConnectedEditors();
|
||||
delete plot;
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimGridPlotWindow* wellLogPlot : alteredWellLogPlots )
|
||||
for ( RimGridPlotWindow* plotWindow : alteredPlotWindows )
|
||||
{
|
||||
RiuGridPlotWindow* viewWidget = dynamic_cast<RiuGridPlotWindow*>( wellLogPlot->viewWidget() );
|
||||
plotWindow->setWidthOfMdiWindow( viewWidget, viewWidget->preferredWidth() );
|
||||
// TODO: add back with virtual methods
|
||||
// wellLogPlot->calculateAvailableDepthRange();
|
||||
// wellLogPlot->updateDepthZoom();
|
||||
wellLogPlot->uiCapability()->updateConnectedEditors();
|
||||
plotWindow->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,32 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteSubPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Delete Track" );
|
||||
QString actionText;
|
||||
std::vector<caf::PdmObject*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
size_t tracksSelected = 0u;
|
||||
for ( caf::PdmObject* object : selection )
|
||||
{
|
||||
if ( dynamic_cast<RimWellLogTrack*>( object ) )
|
||||
{
|
||||
tracksSelected++;
|
||||
}
|
||||
}
|
||||
if ( tracksSelected == selection.size() )
|
||||
{
|
||||
actionText = "Delete Track";
|
||||
}
|
||||
else
|
||||
{
|
||||
actionText = "Delete Plot";
|
||||
}
|
||||
if ( selection.size() > 1u )
|
||||
{
|
||||
actionText += "s";
|
||||
}
|
||||
|
||||
actionToSetup->setText( actionText );
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.png" ) );
|
||||
applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete );
|
||||
}
|
||||
|
||||
@@ -64,11 +64,8 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered( bool isChecked )
|
||||
RimWellLogTrack* plotTrack = new RimWellLogTrack;
|
||||
wellLogPlot->addPlot( plotTrack );
|
||||
plotTrack->setDescription( QString( "Track %1" ).arg( wellLogPlot->plotCount() ) );
|
||||
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>( wellLogPlot->viewWidget() );
|
||||
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
|
||||
|
||||
plotWindow->setWidthOfMdiWindow( viewWidget, viewWidget->preferredWidth() );
|
||||
wellLogPlot->updateConnectedEditors();
|
||||
wellLogPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
@@ -83,33 +87,3 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( RimWellLogTra
|
||||
destTrack->updateParentPlotZoom();
|
||||
destTrack->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellLogPlotTrackFeatureImpl::movePlotsToGridPlotWindow( RimGridPlotWindow* gridPlotWindow,
|
||||
const std::vector<RimPlotInterface*>& plotsToMove,
|
||||
RimPlotInterface* plotToInsertAfter )
|
||||
{
|
||||
CVF_ASSERT( gridPlotWindow );
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
|
||||
{
|
||||
RimPlotInterface* plot = plotsToMove[tIdx];
|
||||
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plot );
|
||||
RimGridPlotWindow* srcPlot;
|
||||
pdmObject->firstAncestorOrThisOfType( srcPlot );
|
||||
if ( srcPlot )
|
||||
{
|
||||
srcPlot->removePlot( plot );
|
||||
}
|
||||
}
|
||||
|
||||
size_t insertionStartIndex = 0;
|
||||
if ( plotToInsertAfter ) insertionStartIndex = gridPlotWindow->plotIndex( plotToInsertAfter ) + 1;
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
|
||||
{
|
||||
gridPlotWindow->insertPlot( plotsToMove[tIdx], insertionStartIndex + tIdx );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimGridPlotWindow;
|
||||
class RimPlotInterface;
|
||||
class RimWellLogPlot;
|
||||
class RimWellLogTrack;
|
||||
class RimWellLogCurve;
|
||||
|
||||
@@ -36,7 +33,4 @@ public:
|
||||
static void moveCurvesToWellLogPlotTrack( RimWellLogTrack* dstTrack,
|
||||
const std::vector<RimWellLogCurve*>& curves,
|
||||
RimWellLogCurve* insertAfterCurve );
|
||||
static void movePlotsToGridPlotWindow( RimGridPlotWindow* gridPlotWindow,
|
||||
const std::vector<RimPlotInterface*>& plots,
|
||||
RimPlotInterface* plotToInsertAfter );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user