Merge pull request #4959 from OPM/feature-combination-plot-2

Create Grid plot collection and allow creation of new combination plots
This commit is contained in:
Gaute Lindkvist 2019-10-31 15:54:34 +01:00 committed by GitHub
commit 32622ff250
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 1322 additions and 604 deletions

View File

@ -58,6 +58,7 @@
#include "RimGeoMechView.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h"
#include "RimObservedDataCollection.h"
@ -310,39 +311,47 @@ void RiaGuiApplication::loadAndUpdatePlotData()
RimPltPlotCollection* pltColl = nullptr;
RimGridCrossPlotCollection* gcpColl = nullptr;
RimSaturationPressurePlotCollection* sppColl = nullptr;
RimGridPlotWindowCollection* gpwColl = nullptr;
if ( m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection() )
if ( m_project->mainPlotCollection() )
{
if ( m_project->mainPlotCollection()->wellLogPlotCollection() )
{
wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection();
}
if ( m_project->mainPlotCollection() && m_project->mainPlotCollection()->summaryPlotCollection() )
if ( m_project->mainPlotCollection()->summaryPlotCollection() )
{
spColl = m_project->mainPlotCollection()->summaryPlotCollection();
}
if ( m_project->mainPlotCollection() && m_project->mainPlotCollection()->summaryCrossPlotCollection() )
if ( m_project->mainPlotCollection()->summaryCrossPlotCollection() )
{
scpColl = m_project->mainPlotCollection()->summaryCrossPlotCollection();
}
if ( m_project->mainPlotCollection() && m_project->mainPlotCollection()->flowPlotCollection() )
if ( m_project->mainPlotCollection()->flowPlotCollection() )
{
flowColl = m_project->mainPlotCollection()->flowPlotCollection();
}
if ( m_project->mainPlotCollection() && m_project->mainPlotCollection()->rftPlotCollection() )
if ( m_project->mainPlotCollection()->rftPlotCollection() )
{
rftColl = m_project->mainPlotCollection()->rftPlotCollection();
}
if ( m_project->mainPlotCollection() && m_project->mainPlotCollection()->pltPlotCollection() )
if ( m_project->mainPlotCollection()->pltPlotCollection() )
{
pltColl = m_project->mainPlotCollection()->pltPlotCollection();
}
if ( m_project->mainPlotCollection() && m_project->mainPlotCollection()->gridCrossPlotCollection() )
if ( m_project->mainPlotCollection()->gridCrossPlotCollection() )
{
gcpColl = m_project->mainPlotCollection()->gridCrossPlotCollection();
}
if ( m_project->mainPlotCollection() && m_project->mainPlotCollection()->saturationPressurePlotCollection() )
if ( m_project->mainPlotCollection()->saturationPressurePlotCollection() )
{
sppColl = m_project->mainPlotCollection()->saturationPressurePlotCollection();
}
if ( m_project->mainPlotCollection()->combinationPlotCollection() )
{
gpwColl = m_project->mainPlotCollection()->combinationPlotCollection();
}
}
size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
@ -353,6 +362,7 @@ void RiaGuiApplication::loadAndUpdatePlotData()
plotCount += pltColl ? pltColl->pltPlots().size() : 0;
plotCount += gcpColl ? gcpColl->gridCrossPlots().size() : 0;
plotCount += sppColl ? sppColl->plots().size() : 0;
plotCount += gpwColl ? gpwColl->gridPlotWindows().size() : 0;
if ( plotCount > 0 )
{
@ -426,6 +436,15 @@ void RiaGuiApplication::loadAndUpdatePlotData()
plotProgress.incrementProgress();
}
}
if ( gpwColl )
{
for ( const auto& gridPlotWindow : gpwColl->gridPlotWindows() )
{
gridPlotWindow->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
}
}

View File

@ -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
)

View File

@ -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;
}

View File

@ -0,0 +1,149 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimPlotInterface.h"
#include "RimProject.h"
#include "RiuPlotMainWindowTools.h"
#include <QAction>
#include "cafSelectionManager.h"
#include "cvfAssert.h"
RICF_SOURCE_INIT( RicNewGridPlotWindowFeature, "RicNewGridPlotWindowFeature", "createCombinationPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewGridPlotWindowFeature::RicNewGridPlotWindowFeature()
{
CAF_PDM_InitObject( "Create Combination Plot", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_plots, "plots", "Plots", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfCommandResponse RicNewGridPlotWindowFeature::execute()
{
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 );
if ( !m_plots().empty() )
{
std::vector<RimPlotInterface*> plotInterfaces;
for ( auto ptr : m_plots() )
{
plotInterfaces.push_back( reinterpret_cast<RimPlotInterface*>( ptr ) );
}
plotWindow->movePlotsToThis( plotInterfaces, nullptr );
}
plotCollection->updateAllRequiredEditors();
plotWindow->loadDataAndUpdate();
RiuPlotMainWindowTools::setExpanded( plotCollection, true );
RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true );
return RicfCommandResponse();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewGridPlotWindowFeature::isCommandEnabled()
{
RimGridPlotWindowCollection* gridPlotCollection = caf::SelectionManager::instance()
->selectedItemOfType<RimGridPlotWindowCollection>();
if ( gridPlotCollection )
{
return true;
}
auto selectedPlots = selectedPlotInterfaces();
std::vector<caf::PdmUiItem*> selectedUiItems;
caf::SelectionManager::instance()->selectedItems( selectedUiItems );
return !selectedPlots.empty() && selectedPlots.size() == selectedUiItems.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewGridPlotWindowFeature::onActionTriggered( bool isChecked )
{
m_plots.v().clear();
auto selectedPlots = selectedPlotInterfaces();
for ( RimPlotInterface* plotInterface : selectedPlots )
{
m_plots.v().push_back( reinterpret_cast<uintptr_t>( plotInterface ) );
}
execute();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewGridPlotWindowFeature::setupActionLook( QAction* actionToSetup )
{
if ( selectedPlotInterfaces().empty() )
{
actionToSetup->setText( "New Empty Combination Plot" );
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
}
else
{
actionToSetup->setText( "Create Combination Plot from selected plots" );
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotInterface*> RicNewGridPlotWindowFeature::selectedPlotInterfaces()
{
std::vector<caf::PdmUiItem*> uiItems;
caf::SelectionManager::instance()->selectedItems( uiItems );
std::vector<RimPlotInterface*> plotInterfaces;
for ( caf::PdmUiItem* uiItem : uiItems )
{
RimPlotInterface* plotInterface = dynamic_cast<RimPlotInterface*>( uiItem );
if ( plotInterface )
{
plotInterfaces.push_back( plotInterface );
}
}
return plotInterfaces;
}

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicfCommandObject.h"
#include "cafCmdFeature.h"
#include "cafPdmField.h"
#include <vector>
class RimPlotInterface;
//==================================================================================================
///
//==================================================================================================
class RicNewGridPlotWindowFeature : public caf::CmdFeature, public RicfCommandObject
{
RICF_HEADER_INIT;
public:
RicNewGridPlotWindowFeature();
virtual RicfCommandResponse execute() override;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
static std::vector<RimPlotInterface*> selectedPlotInterfaces();
private:
caf::PdmField<std::vector<uint64_t>> m_plots;
};

View File

@ -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();
}

View File

@ -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;

View File

@ -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,13 +47,18 @@ 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 );
}

View File

@ -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();
}

View File

@ -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 );
}
}

View File

@ -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 );
};

View File

@ -137,6 +137,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.h
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindowCollection.h
)
@ -278,6 +279,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindowCollection.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -130,7 +130,7 @@ RimWellPltPlot::RimWellPltPlot()
CAF_PDM_InitFieldNoDefault( &m_phases, "Phases", "Phases", "", "", "" );
m_phases.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
m_phases = std::vector<caf::AppEnum<FlowPhase>>( {FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER} );
m_phases = std::vector<caf::AppEnum<FlowPhase>>( { FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER } );
m_phases.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_nameConfig->setCustomName( "PLT Plot" );
@ -139,7 +139,7 @@ RimWellPltPlot::RimWellPltPlot()
m_doInitAfterLoad = false;
m_isOnLoad = true;
setAvailableDepthTypes( {RimWellLogPlot::MEASURED_DEPTH} );
setAvailableDepthTypes( { RimWellLogPlot::MEASURED_DEPTH } );
}
//--------------------------------------------------------------------------------------------------
@ -999,15 +999,13 @@ void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
if ( track )
{
track->uiOrderingForRftPltFormations( uiOrdering );
caf::PdmUiGroup* axesGroup = uiOrdering.addNewGroup( "Axes" );
track->uiOrderingForXAxisSettings( *axesGroup );
uiOrderingForDepthAxis( *axesGroup );
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" );
legendAndAxisGroup->setCollapsedByDefault( true );
createPlotSettingsUiGroup( *legendAndAxisGroup );
track->uiOrderingForXAxisSettings( *legendAndAxisGroup );
uiOrderingForDepthAxis( *legendAndAxisGroup );
caf::PdmUiGroup* plotLayoutGroup = uiOrdering.addNewGroup( "Plot Layout" );
plotLayoutGroup->setCollapsedByDefault( true );
RimWellLogPlot::uiOrderingForPlotLayout( *plotLayoutGroup );
}
}

View File

@ -917,13 +917,13 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
if ( track )
{
track->uiOrderingForRftPltFormations( uiOrdering );
caf::PdmUiGroup* axesGroup = uiOrdering.addNewGroup( "Axes" );
track->uiOrderingForXAxisSettings( *axesGroup );
uiOrderingForDepthAxis( *axesGroup );
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" );
legendAndAxisGroup->setCollapsedByDefault( true );
createPlotSettingsUiGroup( *legendAndAxisGroup );
track->uiOrderingForXAxisSettings( *legendAndAxisGroup );
uiOrderingForDepthAxis( *legendAndAxisGroup );
caf::PdmUiGroup* plotLayoutGroup = uiOrdering.addNewGroup( "Plot Layout" );
plotLayoutGroup->setCollapsedByDefault( true );
RimWellLogPlot::uiOrderingForPlotLayout( *plotLayoutGroup );
}
}

View File

@ -26,8 +26,10 @@
#include "RiuPlotMainWindowTools.h"
#include "RiuQwtPlotTools.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridCrossPlotCurve.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimGridPlotWindow.h"
#include "RimPlotAxisProperties.h"
#include "cafPdmUiCheckBoxEditor.h"
@ -53,10 +55,7 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitObject( "Grid Cross Plot", ":/SummaryXPlotLight16x16.png", "", "" );
CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" );
CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Show Legend", "", "", "" );
CAF_PDM_InitField( &m_legendFontSize, "LegendFontSize", 10, "Legend and Info Font Size", "", "", "" );
m_legendFontSize = RiaFontCache::pointSizeFromFontSizeEnum(
RiaApplication::instance()->preferences()->defaultPlotFontSize() );
CAF_PDM_InitField( &m_showLegend_OBSOLETE, "ShowLegend", false, "Show Legend", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" );
m_nameConfig.uiCapability()->setUiTreeHidden( true );
@ -96,6 +95,22 @@ bool RimGridCrossPlot::isChecked() const
return isWindowVisible();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::setChecked( bool checked )
{
m_showWindow = checked;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridCrossPlot::description() const
{
return createAutoName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -421,6 +436,17 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
updatePlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::initAfterRead()
{
if ( m_showLegend_OBSOLETE() )
{
m_showPlotLegends = true;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -429,12 +455,16 @@ void RimGridCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add( &m_showInfoBox );
uiOrdering.add( &m_showLegend );
if ( m_showLegend() )
if ( isStandalonePlot() )
{
uiOrdering.add( &m_showPlotLegends );
if ( m_showPlotLegends() )
{
uiOrdering.add( &m_legendFontSize );
}
}
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Name Configuration" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
@ -464,17 +494,10 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_showLegend )
{
m_plotWidget->setLegendVisible( m_showLegend() );
}
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_legendFontSize )
{
m_plotWidget->setLegendFontSize( m_legendFontSize() );
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->updateLegendIcons();
}
updateLegend();
}
onLoadDataAndUpdate();
}
@ -546,9 +569,7 @@ void RimGridCrossPlot::updatePlot()
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
}
m_plotWidget->setLegendVisible( m_showLegend() );
m_plotWidget->setLegendFontSize( m_legendFontSize() );
m_plotWidget->updateLegendSizesToMatchPlot();
updateLegend();
m_plotWidget->scheduleReplot();
}
}
@ -563,7 +584,7 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
m_crossPlotDataSets[i]->updateCurveNames( i, m_crossPlotDataSets.size() );
}
if ( m_plotWidget )
if ( m_plotWidget && isStandalonePlot() )
{
m_plotWidget->setTitle( this->createAutoName() );
}
@ -666,6 +687,12 @@ void RimGridCrossPlot::setYAxisInverted( bool inverted )
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::legendFontSize() const
{
RimGridPlotWindow* plotWindow = nullptr;
this->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
return plotWindow->legendFontSize();
}
return m_legendFontSize;
}
@ -735,6 +762,19 @@ void RimGridCrossPlot::updateLayout()
updatePlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateLegend()
{
m_plotWidget->setInternalQwtLegendVisible( m_showPlotLegends() && isStandalonePlot() );
m_plotWidget->setLegendFontSize( m_legendFontSize() );
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->updateLegendIcons();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -829,27 +869,18 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
{
m_plotWidget->enableAxis( qwtAxisId, true );
QwtText axisTitle( axisParameterString );
QFont titleFont = m_plotWidget->axisTitle( qwtAxisId ).font();
titleFont.setBold( true );
titleFont.setPointSize( axisProperties->titleFontSize() );
axisTitle.setFont( titleFont );
QFont valuesFont = m_plotWidget->axisFont( qwtAxisId );
valuesFont.setPointSize( axisProperties->valuesFontSize() );
m_plotWidget->setAxisFont( qwtAxisId, valuesFont );
switch ( axisProperties->titlePosition() )
Qt::AlignmentFlag alignment = Qt::AlignCenter;
if ( axisProperties->titlePosition() == RimPlotAxisPropertiesInterface::AXIS_TITLE_END )
{
case RimPlotAxisProperties::AXIS_TITLE_CENTER:
axisTitle.setRenderFlags( Qt::AlignCenter );
break;
case RimPlotAxisProperties::AXIS_TITLE_END:
axisTitle.setRenderFlags( Qt::AlignRight );
break;
alignment = Qt::AlignRight;
}
m_plotWidget->setAxisTitle( qwtAxisId, axisTitle );
m_plotWidget->setAxisFontsAndAlignment( qwtAxisId,
axisProperties->titleFontSize(),
axisProperties->valuesFontSize(),
true,
alignment );
m_plotWidget->setAxisTitleText( qwtAxisId, axisParameterString );
m_plotWidget->setAxisTitleEnabled( qwtAxisId, true );
if ( axisProperties->isLogarithmicScaleEnabled )
{
@ -1025,6 +1056,35 @@ void RimGridCrossPlot::removeDataSetLegend( RimGridCrossPlotDataSet* dataSet )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::removeFromMdiAreaAndCollection()
{
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
this->firstAncestorOrThisOfType( crossPlotCollection );
if ( crossPlotCollection )
{
crossPlotCollection->removeGridCrossPlot( this );
this->revokeMdiWindowStatus();
crossPlotCollection->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAfterInsertingIntoGridPlotWindow()
{
if ( m_plotWidget )
{
m_plotWidget->setTitle( "" );
m_plotWidget->setInternalQwtLegendVisible( false );
}
updateAxes();
updateLayout();
}
//--------------------------------------------------------------------------------------------------
/// Name Configuration
///

View File

@ -58,6 +58,9 @@ public:
~RimGridCrossPlot();
bool isChecked() const override;
void setChecked( bool checked ) override;
QString description() const override;
RimGridCrossPlotDataSet* createDataSet();
int indexOfDataSet( const RimGridCrossPlotDataSet* dataSet ) const;
@ -95,11 +98,12 @@ public:
bool forceChange = false ) override;
void updateLayout() override;
void updateLegend();
void updateZoomInQwt() override;
void updateZoomFromQwt() override;
void loadDataAndUpdate();
void loadDataAndUpdate() override;
void setAutoScaleXEnabled( bool enabled ) override;
void setAutoScaleYEnabled( bool enabled ) override;
@ -110,10 +114,14 @@ public:
void addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet );
void removeDataSetLegend( RimGridCrossPlotDataSet* dataSet );
void removeFromMdiAreaAndCollection() override;
void updateAfterInsertingIntoGridPlotWindow() override;
protected:
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
@ -144,8 +152,7 @@ protected:
private:
caf::PdmField<bool> m_showInfoBox;
caf::PdmField<bool> m_showLegend;
caf::PdmField<int> m_legendFontSize;
caf::PdmField<bool> m_showLegend_OBSOLETE;
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;

View File

@ -75,3 +75,11 @@ void RimGridCrossPlotCollection::addGridCrossPlot( RimGridCrossPlot* plot )
{
m_gridCrossPlots().push_back( plot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCollection::removeGridCrossPlot( RimGridCrossPlot* plot )
{
m_gridCrossPlots.removeChildObject( plot );
}

View File

@ -39,6 +39,7 @@ public:
std::vector<RimGridCrossPlot*> gridCrossPlots() const;
RimGridCrossPlot* createGridCrossPlot();
void addGridCrossPlot( RimGridCrossPlot* plot );
void removeGridCrossPlot( RimGridCrossPlot* plot );
private:
caf::PdmChildArrayField<RimGridCrossPlot*> m_gridCrossPlots;

View File

@ -71,6 +71,7 @@
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimGridPlotWindowCollection.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimIntersection.h"
#include "RimIntersectionBox.h"
@ -506,7 +507,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicNewWellLogRftCurveFeature";
menuBuilder << "RicNewWellLogFileCurveFeature";
menuBuilder << "Separator";
menuBuilder << "RicDeleteWellLogPlotTrackFeature";
menuBuilder << "RicDeleteSubPlotFeature";
}
else if ( dynamic_cast<RimWellLogCurve*>( uiItem ) )
{
@ -562,6 +563,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicCopyReferencesToClipboardFeature";
menuBuilder << "Separator";
menuBuilder << "RicViewZoomAllFeature";
menuBuilder << "Separator";
menuBuilder << "RicDeleteSubPlotFeature";
}
else if ( dynamic_cast<RimSummaryCurve*>( uiItem ) )
{
@ -864,6 +867,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicDeleteSummaryCaseCollectionFeature";
menuBuilder << "RicCloseObservedDataFeature";
menuBuilder << "RicNewGridPlotWindowFeature";
// Work in progress -- End
appendCreateCompletions( menuBuilder, menuBuilder.itemCount() > 0u );
bool addedExportWellPaths = appendExportWellPaths( menuBuilder, menuBuilder.itemCount() > 0u ) > 0;

View File

@ -35,7 +35,7 @@ void RimGridPlotWindow::ColumnCountEnum::setUp()
addItem( RimGridPlotWindow::COLUMNS_3, "3", "3 Columns" );
addItem( RimGridPlotWindow::COLUMNS_4, "4", "4 Columns" );
addItem( RimGridPlotWindow::COLUMNS_UNLIMITED, "UNLIMITED", "Unlimited" );
setDefault( RimGridPlotWindow::COLUMNS_UNLIMITED );
setDefault( RimGridPlotWindow::COLUMNS_2 );
}
} // namespace caf
@ -46,13 +46,15 @@ CAF_PDM_SOURCE_INIT( RimGridPlotWindow, "GridPlotWindow" );
//--------------------------------------------------------------------------------------------------
RimGridPlotWindow::RimGridPlotWindow()
{
CAF_PDM_InitObject( "Grid Plot Window", ":/WellLogPlot16x16.png", "", "" );
CAF_PDM_InitObject( "Combination Plot", ":/WellLogPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "", "", "", "" );
m_plots.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_columnCountEnum, "NumberOfColumns", "Number of Columns", "", "", "" );
CAF_PDM_InitField( &m_showIndividualPlotTitles, "ShowPlotTitles", false, "Show Sub Plot Titles", "", "", "" );
m_viewer = nullptr;
}
@ -112,12 +114,14 @@ void RimGridPlotWindow::insertPlot( RimPlotInterface* plot, size_t index )
if ( plot )
{
m_plots.insert( index, toPdmObjectAsserted( plot ) );
plot->setChecked( true );
if ( m_viewer )
{
plot->createPlotWidget();
m_viewer->insertPlot( plot->viewer(), index );
}
plot->updateAfterInsertingIntoGridPlotWindow();
onPlotAdditionOrRemoval();
}
@ -140,6 +144,43 @@ void RimGridPlotWindow::removePlot( RimPlotInterface* plot )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::movePlotsToThis( const std::vector<RimPlotInterface*>& plotsToMove,
RimPlotInterface* plotToInsertAfter )
{
std::set<caf::PdmObject*> objectsToUpdate;
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
{
RimPlotInterface* plot = plotsToMove[tIdx];
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plot );
RimGridPlotWindow* srcPlot = nullptr;
pdmObject->firstAncestorOrThisOfType( srcPlot );
if ( srcPlot )
{
srcPlot->removePlot( plot );
}
else
{
plot->removeFromMdiAreaAndCollection();
}
}
size_t insertionStartIndex = 0;
if ( plotToInsertAfter ) insertionStartIndex = this->plotIndex( plotToInsertAfter ) + 1;
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
{
this->insertPlot( plotsToMove[tIdx], insertionStartIndex + tIdx );
}
this->updateLayout();
this->updateAllRequiredEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -271,21 +312,19 @@ caf::PdmFieldHandle* RimGridPlotWindow::columnCountField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::zoomAll()
bool RimGridPlotWindow::showPlotTitles() const
{
setAutoScaleXEnabled( true );
setAutoScaleYEnabled( true );
updateZoom();
return m_showIndividualPlotTitles;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmUiGroup* RimGridPlotWindow::createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering )
void RimGridPlotWindow::zoomAll()
{
caf::PdmUiGroup* titleAndLegendsGroup = RimPlotWindow::createPlotSettingsUiGroup( uiOrdering );
titleAndLegendsGroup->add( &m_columnCountEnum );
return titleAndLegendsGroup;
setAutoScaleXEnabled( true );
setAutoScaleYEnabled( true );
updateZoom();
}
//--------------------------------------------------------------------------------------------------
@ -326,11 +365,9 @@ QImage RimGridPlotWindow::snapshotWindowContent()
if ( m_viewer )
{
m_viewer->setScrollbarVisible( false );
m_viewer->setSelectionsVisible( false );
QPixmap pix = m_viewer->grab();
image = pix.toImage();
m_viewer->setScrollbarVisible( true );
m_viewer->setSelectionsVisible( true );
}
@ -370,6 +407,10 @@ void RimGridPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
{
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_showIndividualPlotTitles )
{
updateLayout();
}
if ( changedField == &m_columnCountEnum )
{
updateLayout();
@ -383,7 +424,20 @@ void RimGridPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
createPlotSettingsUiGroup( uiOrdering );
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Plot Layout" );
uiOrderingForPlotLayout( *titleAndLegendsGroup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showTitleInPlot );
uiOrdering.add( &m_description );
uiOrdering.add( &m_showIndividualPlotTitles );
RimPlotWindow::uiOrderingForPlotLayout( uiOrdering );
uiOrdering.add( &m_columnCountEnum );
}
//--------------------------------------------------------------------------------------------------
@ -426,7 +480,7 @@ QList<caf::PdmOptionItemInfo> RimGridPlotWindow::calculateValueOptions( const ca
void RimGridPlotWindow::onLoadDataAndUpdate()
{
updateMdiWindowVisibility();
setPlotTitleInWidget( this->fullPlotTitle() );
updatePlotTitle();
updatePlots();
updateLayout();
}
@ -443,18 +497,11 @@ void RimGridPlotWindow::initAfterRead()
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updatePlotTitle()
{
m_viewer->setTitleVisible( m_showTitleInPlot() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::setPlotTitleInWidget( const QString& title )
{
if ( m_viewer )
{
m_viewer->setPlotTitle( title );
m_viewer->setTitleVisible( m_showTitleInPlot() );
m_viewer->setPlotTitle( fullPlotTitle() );
}
updateMdiWindowTitle();
}
@ -512,6 +559,10 @@ bool RimGridPlotWindow::hasCustomFontSizes( RiaDefines::FontSettingType fontSett
{
return true;
}
if ( m_legendFontSize() != defaultFontSize )
{
return true;
}
for ( const RimPlotInterface* plot : plots() )
{
if ( plot->hasCustomFontSizes( fontSettingType, defaultFontSize ) )
@ -540,6 +591,12 @@ bool RimGridPlotWindow::applyFontSize( RiaDefines::FontSettingType fontSettingTy
somethingChanged = true;
}
if ( oldFontSize == m_legendFontSize() || forceChange )
{
m_legendFontSize = fontSize;
somethingChanged = true;
}
for ( RimPlotInterface* plot : plots() )
{
if ( plot->applyFontSize( fontSettingType, oldFontSize, fontSize, forceChange ) )

View File

@ -30,6 +30,8 @@
#include <QPointer>
#include <QString>
#include <vector>
class RimPlotInterface;
class RimGridPlotWindow : public RimPlotWindow
@ -58,6 +60,7 @@ public:
void addPlot( RimPlotInterface* plot );
void insertPlot( RimPlotInterface* plot, size_t index );
void removePlot( RimPlotInterface* plot );
void movePlotsToThis( const std::vector<RimPlotInterface*>& plots, RimPlotInterface* plotToInsertAfter );
size_t plotCount() const;
size_t plotIndex( const RimPlotInterface* plot ) const;
@ -75,11 +78,10 @@ public:
int columnCount() const;
caf::PdmFieldHandle* columnCountField();
bool showPlotTitles() const;
void zoomAll() override;
caf::PdmUiGroup* createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering ) override;
QString asciiDataForPlotExport() const;
virtual void onPlotAdditionOrRemoval();
@ -94,13 +96,15 @@ protected:
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
void updatePlotTitle() override;
void setPlotTitleInWidget( const QString& plotTitle );
void updatePlots();
virtual void updateZoom();
void recreatePlotWidgets();
@ -121,6 +125,7 @@ private:
protected:
caf::PdmField<ColumnCountEnum> m_columnCountEnum;
caf::PdmField<bool> m_showIndividualPlotTitles;
friend class RiuGridPlotWindow;
QPointer<RiuGridPlotWindow> m_viewer;

View File

@ -28,7 +28,7 @@ CAF_PDM_SOURCE_INIT( RimGridPlotWindowCollection, "RimGridPlotWindowCollection"
//--------------------------------------------------------------------------------------------------
RimGridPlotWindowCollection::RimGridPlotWindowCollection()
{
CAF_PDM_InitObject( "Combination Plots", ":/WellFlowPlot16x16.png", "", "" );
CAF_PDM_InitObject( "Combination Plots", ":/WellLogPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_gridPlotWindows, "GridPlotWindows", "Combination Plots", "", "", "" );
m_gridPlotWindows.uiCapability()->setUiHidden( true );

View File

@ -23,6 +23,7 @@
#include "RimFlowPlotCollection.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimRftPlotCollection.h"
@ -84,6 +85,9 @@ RimMainPlotCollection::RimMainPlotCollection()
"" );
m_saturationPressurePlotCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_combinationPlotCollection, "RimGridPlotWindowCollection", "Combination Plots", "", "", "" );
m_combinationPlotCollection.uiCapability()->setUiHidden( true );
m_wellLogPlotCollection = new RimWellLogPlotCollection();
m_rftPlotCollection = new RimRftPlotCollection();
m_pltPlotCollection = new RimPltPlotCollection();
@ -92,6 +96,7 @@ RimMainPlotCollection::RimMainPlotCollection()
m_flowPlotCollection = new RimFlowPlotCollection();
m_gridCrossPlotCollection = new RimGridCrossPlotCollection;
m_saturationPressurePlotCollection = new RimSaturationPressurePlotCollection;
m_combinationPlotCollection = new RimGridPlotWindowCollection;
}
//--------------------------------------------------------------------------------------------------
@ -180,6 +185,14 @@ RimSaturationPressurePlotCollection* RimMainPlotCollection::saturationPressurePl
return m_saturationPressurePlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindowCollection* RimMainPlotCollection::combinationPlotCollection()
{
return m_combinationPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -193,6 +206,7 @@ void RimMainPlotCollection::deleteAllContainedObjects()
m_gridCrossPlotCollection->deleteAllChildObjects();
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
m_saturationPressurePlotCollection()->deleteAllChildObjects();
m_combinationPlotCollection()->deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
@ -244,6 +258,14 @@ void RimMainPlotCollection::updatePlotsWithFormations()
crossPlot->loadDataAndUpdate();
}
}
if ( m_combinationPlotCollection )
{
for ( RimGridPlotWindow* plotWindow : m_combinationPlotCollection->gridPlotWindows() )
{
plotWindow->loadDataAndUpdate();
}
}
}
//--------------------------------------------------------------------------------------------------
@ -258,6 +280,14 @@ void RimMainPlotCollection::updatePlotsWithCompletions()
wellLogPlot->loadDataAndUpdate();
}
}
if ( m_combinationPlotCollection )
{
for ( RimGridPlotWindow* plotWindow : m_combinationPlotCollection->gridPlotWindows() )
{
plotWindow->loadDataAndUpdate();
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -30,6 +30,7 @@ class RimWellLogPlotCollection;
class RimRftPlotCollection;
class RimPltPlotCollection;
class RimGridCrossPlotCollection;
class RimGridPlotWindowCollection;
class RimSummaryPlotCollection;
class RimSummaryCrossPlotCollection;
class RimSummaryPlot;
@ -58,6 +59,7 @@ public:
RimFlowPlotCollection* flowPlotCollection();
RimGridCrossPlotCollection* gridCrossPlotCollection();
RimSaturationPressurePlotCollection* saturationPressurePlotCollection();
RimGridPlotWindowCollection* combinationPlotCollection();
void deleteAllContainedObjects();
void updateCurrentTimeStepInPlots();
@ -81,6 +83,7 @@ private:
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
caf::PdmChildField<RimGridCrossPlotCollection*> m_gridCrossPlotCollection;
caf::PdmChildField<RimSaturationPressurePlotCollection*> m_saturationPressurePlotCollection;
caf::PdmChildField<RimGridPlotWindowCollection*> m_combinationPlotCollection;
caf::PdmField<bool> m_show;
};

View File

@ -93,7 +93,10 @@ void RimMdiWindowController::handleViewerDeletion()
void RimMdiWindowController::removeWindowFromMDI()
{
RiuMainWindowBase* mainWin = getMainWindow();
if ( mainWin && viewWidget() ) mainWin->removeViewer( viewWidget() );
if ( mainWin && viewWidget() )
{
mainWin->removeViewer( viewWidget() );
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -49,7 +49,6 @@ public:
protected:
RimViewWindow* viewPdmObject();
QWidget* viewWidget();
RiuMdiSubWindow* viewSubWindow();
RiuMainWindowBase* getMainWindow();
// Overridden PDM methods

View File

@ -1,11 +1,11 @@
#include "RimPlotInterface.h"
#include "RimGridPlotWindow.h"
#include "RimPlotWindow.h"
#include "RiuQwtPlotWidget.h"
#define RI_PLOT_MIN_DEFAULT -10.0
#define RI_PLOT_MAX_DEFAULT 100.0
#include "cafPdmObject.h"
namespace caf
{
@ -21,6 +21,23 @@ void RimPlotInterface::WidthScaleFactorEnum::setUp()
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotInterface::isStandalonePlot() const
{
const caf::PdmObject* thisPdm = dynamic_cast<const caf::PdmObject*>( this );
CAF_ASSERT( thisPdm );
if ( thisPdm )
{
RimGridPlotWindow* gridPlotWindow = nullptr;
thisPdm->firstAncestorOrThisOfType( gridPlotWindow );
return gridPlotWindow == nullptr;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -45,12 +45,17 @@ public:
typedef caf::AppEnum<WidthScaleFactor> WidthScaleFactorEnum;
public:
virtual RiuQwtPlotWidget* viewer() = 0;
virtual bool isChecked() const = 0;
RimPlotInterface() = default;
virtual ~RimPlotInterface() = default;
bool isStandalonePlot() const;
virtual RiuQwtPlotWidget* viewer() = 0;
virtual bool isChecked() const = 0;
virtual void setChecked( bool checked ) = 0;
virtual QString description() const = 0;
virtual int widthScaleFactor() const
{
return NORMAL;
@ -81,6 +86,9 @@ public:
virtual void onAxisSelected( int axis, bool toggle ) {}
virtual void removeFromMdiAreaAndCollection() {}
virtual void updateAfterInsertingIntoGridPlotWindow() {}
protected:
virtual void updatePlotWindowLayout() {}
virtual void onWidthScaleFactorChange() {}

View File

@ -17,6 +17,9 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimPlotWindow.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "cafPdmUiComboBoxEditor.h"
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not use. Abstract class
@ -30,10 +33,13 @@ RimPlotWindow::RimPlotWindow()
CAF_PDM_InitField( &m_description, "PlotDescription", QString( "" ), "Name", "", "", "" );
CAF_PDM_InitField( &m_showTitleInPlot, "ShowTitleInPlot", false, "Show Title", "", "", "" );
CAF_PDM_InitField( &m_showTitleInPlot, "ShowTitleInPlot", true, "Show Title", "", "", "" );
CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", false, "Legend Orientation", "", "", "" );
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation", "", "", "" );
m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
int fontSize = RiaFontCache::pointSizeFromFontSizeEnum(
RiaApplication::instance()->preferences()->defaultPlotFontSize() );
CAF_PDM_InitField( &m_legendFontSize, "LegendFontSize", fontSize, "Legend Font Size", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
@ -124,6 +130,22 @@ void RimPlotWindow::setLegendsHorizontal( bool horizontal )
m_plotLegendsHorizontal = horizontal;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimPlotWindow::legendFontSize() const
{
return m_legendFontSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::setLegendFontSize( int fontSize )
{
m_legendFontSize = fontSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -137,10 +159,14 @@ void RimPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
{
updateLayout();
}
else if ( changedField == &m_showTitleInPlot )
else if ( changedField == &m_showTitleInPlot || changedField == &m_description )
{
updatePlotTitle();
}
else if ( changedField == &m_legendFontSize )
{
updateLayout();
}
updateConnectedEditors();
}
@ -152,7 +178,26 @@ QList<caf::PdmOptionItemInfo> RimPlotWindow::calculateValueOptions( const caf::P
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_plotLegendsHorizontal )
if ( fieldNeedingOptions == &m_legendFontSize )
{
std::vector<int> fontSizes;
fontSizes.push_back( 8 );
fontSizes.push_back( 9 );
fontSizes.push_back( 10 );
fontSizes.push_back( 11 );
fontSizes.push_back( 12 );
fontSizes.push_back( 14 );
fontSizes.push_back( 16 );
fontSizes.push_back( 18 );
fontSizes.push_back( 24 );
for ( int value : fontSizes )
{
QString text = QString( "%1" ).arg( value );
options.push_back( caf::PdmOptionItemInfo( text, value ) );
}
}
else if ( fieldNeedingOptions == &m_plotLegendsHorizontal )
{
options.push_back( caf::PdmOptionItemInfo( "Vertical", QVariant::fromValue( false ) ) );
options.push_back( caf::PdmOptionItemInfo( "Horizontal", QVariant::fromValue( true ) ) );
@ -163,11 +208,17 @@ QList<caf::PdmOptionItemInfo> RimPlotWindow::calculateValueOptions( const caf::P
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmUiGroup* RimPlotWindow::createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering )
caf::PdmFieldHandle* RimPlotWindow::userDescriptionField()
{
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Title and Legends" );
titleAndLegendsGroup->add( &m_showPlotLegends );
titleAndLegendsGroup->add( &m_plotLegendsHorizontal );
titleAndLegendsGroup->add( &m_showTitleInPlot );
return titleAndLegendsGroup;
return &m_description;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showPlotLegends );
uiOrdering.add( &m_plotLegendsHorizontal );
uiOrdering.add( &m_legendFontSize );
}

View File

@ -37,7 +37,7 @@ public:
RimPlotWindow& operator=( RimPlotWindow&& rhs );
virtual void setDescription( const QString& description );
virtual QString description() const;
QString description() const;
virtual QString fullPlotTitle() const;
bool isPlotTitleVisible() const;
@ -46,6 +46,8 @@ public:
void setLegendsVisible( bool doShow );
bool legendsHorizontal() const;
void setLegendsHorizontal( bool horizontal );
int legendFontSize() const;
void setLegendFontSize( int fontSize );
virtual void detachAllCurves() = 0;
virtual void handleKeyPressEvent( QKeyEvent* keyEvent ) {}
@ -57,8 +59,9 @@ protected:
const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
caf::PdmFieldHandle* userDescriptionField() override;
virtual caf::PdmUiGroup* createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering );
virtual void uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering );
virtual void updatePlotTitle() = 0;
protected:
@ -66,4 +69,5 @@ protected:
caf::PdmField<bool> m_showTitleInPlot;
caf::PdmField<bool> m_showPlotLegends;
caf::PdmField<bool> m_plotLegendsHorizontal;
caf::PdmField<int> m_legendFontSize;
};

View File

@ -50,6 +50,7 @@
#include "RimGeoMechCase.h"
#include "RimGeoMechModels.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimGridSummaryCase.h"
#include "RimGridView.h"
#include "RimIdenticalGridCaseGroup.h"
@ -1303,6 +1304,11 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
{
itemCollection->add( mainPlotCollection->saturationPressurePlotCollection() );
}
if ( mainPlotCollection->combinationPlotCollection() )
{
itemCollection->add( mainPlotCollection->combinationPlotCollection() );
}
}
}
else

View File

@ -34,6 +34,7 @@
#include "RimFlowPlotCollection.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryCaseMainCollection.h"
@ -176,5 +177,14 @@ void RimReloadCaseTools::updateAllPlots()
{
flowPlotCollection->loadDataAndUpdate();
}
RimGridPlotWindowCollection* gridPlotWindowCollection = project->mainPlotCollection()->combinationPlotCollection();
if ( gridPlotWindowCollection )
{
for ( RimGridPlotWindow* plotWindow : gridPlotWindowCollection->gridPlotWindows() )
{
plotWindow->loadDataAndUpdate();
}
}
}
}

View File

@ -28,6 +28,7 @@
#include "cvfAssert.h"
#include <QDebug>
#include <QWidget>
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimViewWindow, "ViewWindow" ); // Do not use. Abstract class
@ -148,6 +149,20 @@ void RimViewWindow::updateMdiWindowVisibility()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::revokeMdiWindowStatus()
{
if ( m_windowController() )
{
handleMdiWindowClosed();
deleteViewWidget();
delete m_windowController();
m_windowController = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -76,6 +76,8 @@ public:
{
setAsMdiWindow( 1 );
}
void revokeMdiWindowStatus();
bool isMdiWindow() const;
void setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry );

View File

@ -136,8 +136,9 @@ void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
parameterSources->add( &m_ucsSource );
parameterSources->add( &m_userDefinedUcs );
uiOrderingForDepthAxis( uiOrdering );
createPlotSettingsUiGroup( uiOrdering );
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Title, Legend and Axis" );
RimWellLogPlot::uiOrderingForPlotLayout( *legendAndAxisGroup );
uiOrderingForDepthAxis( *legendAndAxisGroup );
uiOrdering.skipRemainingFields( true );
}

View File

@ -342,7 +342,6 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );
CVF_ASSERT( wellLogPlot );
if ( !wellLogPlot ) return;
displayUnit = wellLogPlot->depthUnit();

View File

@ -113,6 +113,8 @@ RimWellLogPlot::RimWellLogPlot()
m_maxAvailableDepth = -HUGE_VAL;
m_commonDataSourceEnabled = true;
m_showTitleInPlot = false;
m_columnCountEnum = RimGridPlotWindow::COLUMNS_UNLIMITED;
}
//--------------------------------------------------------------------------------------------------
@ -302,31 +304,31 @@ void RimWellLogPlot::enableAllAutoNameTags( bool enable )
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Depth Axis" );
if ( m_availableDepthTypes.size() > 1u )
{
gridGroup->add( &m_depthType );
uiOrdering.add( &m_depthType );
}
if ( m_availableDepthUnits.size() > 1u )
{
gridGroup->add( &m_depthUnit );
uiOrdering.add( &m_depthUnit );
}
gridGroup->add( &m_minVisibleDepth );
gridGroup->add( &m_maxVisibleDepth );
gridGroup->add( &m_depthAxisGridVisibility );
uiOrdering.add( &m_minVisibleDepth );
uiOrdering.add( &m_maxVisibleDepth );
uiOrdering.add( &m_depthAxisGridVisibility );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmUiGroup* RimWellLogPlot::createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering )
void RimWellLogPlot::uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* titleAndLegendsGroup = RimGridPlotWindow::createPlotSettingsUiGroup( uiOrdering );
m_nameConfig->uiOrdering( "", *titleAndLegendsGroup );
return titleAndLegendsGroup;
uiOrdering.add( &m_showTitleInPlot );
m_nameConfig->uiOrdering( "", uiOrdering );
uiOrdering.add( &m_showIndividualPlotTitles );
RimPlotWindow::uiOrderingForPlotLayout( uiOrdering );
uiOrdering.add( &m_columnCountEnum );
}
//--------------------------------------------------------------------------------------------------
@ -423,7 +425,7 @@ QWidget* RimWellLogPlot::createViewWidget( QWidget* mainWindowParent )
void RimWellLogPlot::performAutoNameUpdate()
{
updateCommonDataSource();
this->setPlotTitleInWidget( this->createAutoName() );
updatePlotTitle();
}
//--------------------------------------------------------------------------------------------------
@ -597,8 +599,13 @@ void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
{
m_commonDataSource->uiOrdering( uiConfigName, uiOrdering );
}
uiOrderingForDepthAxis( uiOrdering );
createPlotSettingsUiGroup( uiOrdering );
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Depth Axis" );
uiOrderingForDepthAxis( *gridGroup );
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Plot Layout" );
uiOrderingForPlotLayout( *titleAndLegendsGroup );
uiOrdering.skipRemainingFields( true );
}
@ -673,6 +680,26 @@ void RimWellLogPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimWellLogPlot::snapshotWindowContent()
{
QImage image;
if ( m_viewer )
{
RiuWellLogPlot* wellLogViewer = dynamic_cast<RiuWellLogPlot*>( m_viewer.data() );
CAF_ASSERT( wellLogViewer );
bool isScrollbarVisible = wellLogViewer->isScrollbarVisible();
wellLogViewer->setScrollbarVisible( false );
image = RimGridPlotWindow::snapshotWindowContent();
wellLogViewer->setScrollbarVisible( isScrollbarVisible );
}
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -97,7 +97,7 @@ public:
void enableAllAutoNameTags( bool enable );
void uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering );
caf::PdmUiGroup* createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering );
void uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering ) override;
QString createAutoName() const override;
@ -131,6 +131,8 @@ protected:
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
QImage snapshotWindowContent() override;
protected:
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
bool m_commonDataSourceEnabled;

View File

@ -279,7 +279,7 @@ void RimWellLogTrack::setChecked( bool checked )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString RimWellLogTrack::description() const
QString RimWellLogTrack::description() const
{
return m_description;
}
@ -734,13 +734,14 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR,
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR );
RimWellLogPlot* plot = nullptr;
this->firstAncestorOrThisOfTypeAsserted( plot );
RimWellLogPlot* wellLogPlot = nullptr;
this->firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot )
{
m_plotWidget->enableGridLines( QwtPlot::yLeft,
plot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR,
plot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR );
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR,
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR );
}
m_plotWidget->scheduleReplot();
}
@ -1229,9 +1230,12 @@ void RimWellLogTrack::setXAxisTitle( const QString& text )
QString RimWellLogTrack::yAxisTitle() const
{
RimWellLogPlot* parent;
this->firstAncestorOrThisOfTypeAsserted( parent );
this->firstAncestorOrThisOfType( parent );
if ( parent )
{
return parent->depthAxisTitle();
}
return "";
}
//--------------------------------------------------------------------------------------------------
@ -1403,29 +1407,10 @@ void RimWellLogTrack::updateParentPlotZoom()
void RimWellLogTrack::updateEditors()
{
this->updateConnectedEditors();
RimPlotWindow* plotWindow = nullptr;
RimWellLogPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
plot->updateConnectedEditors();
RimWellRftPlot* rftPlot( nullptr );
firstAncestorOrThisOfType( rftPlot );
if ( rftPlot )
{
rftPlot->updateConnectedEditors();
}
else
{
RimWellPltPlot* pltPlot( nullptr );
firstAncestorOrThisOfType( pltPlot );
if ( pltPlot )
{
pltPlot->updateConnectedEditors();
}
}
firstAncestorOrThisOfTypeAsserted( plotWindow );
plotWindow->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
@ -1734,17 +1719,6 @@ void RimWellLogTrack::updateAxisScaleEngine()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::isFirstVisibleTrackInPlot() const
{
RimGridPlotWindow* plotWindow = nullptr;
firstAncestorOrThisOfTypeAsserted( plotWindow );
std::vector<RimPlotInterface*> visiblePlots = plotWindow->visiblePlots();
return visiblePlots.empty() ? false : visiblePlots.front() == this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -90,8 +90,8 @@ public:
typedef caf::AppEnum<RiuPlotAnnotationTool::RegionDisplay> RegionAnnotationDisplayEnum;
bool isChecked() const override;
void setChecked( bool checked );
const QString description() const;
void setChecked( bool checked ) override;
QString description() const override;
void setDescription( const QString& description );
int widthScaleFactor() const override;
void setWidthScaleFactor( WidthScaleFactor scaleFactor ) override;
@ -258,7 +258,6 @@ private:
void updateWellPathAttributesOnPlot();
void removeRegionAnnotations();
void updateAxisScaleEngine();
bool isFirstVisibleTrackInPlot() const;
std::pair<double, double> adjustXRange( double minValue, double maxValue, double tickInterval );

View File

@ -123,24 +123,17 @@ void RimSummaryPlotYAxisFormatter::applyYAxisPropertiesToPlot( RiuSummaryQwtPlot
axisTitleY.setText( axisTitle );
switch ( m_axisProperties->titlePosition() )
Qt::AlignmentFlag titleAlignment = Qt::AlignCenter;
if ( m_axisProperties->titlePosition() == RimPlotAxisPropertiesInterface::AXIS_TITLE_END )
{
case RimPlotAxisProperties::AXIS_TITLE_CENTER:
axisTitleY.setRenderFlags( Qt::AlignCenter );
break;
case RimPlotAxisProperties::AXIS_TITLE_END:
axisTitleY.setRenderFlags( Qt::AlignRight );
break;
titleAlignment = Qt::AlignRight;
}
qwtPlot->setAxisTitle( m_axisProperties->qwtPlotAxisType(), axisTitleY );
}
{
QFont yAxisFont = qwtPlot->axisFont( m_axisProperties->qwtPlotAxisType() );
yAxisFont.setBold( false );
yAxisFont.setPointSize( m_axisProperties->valuesFontSize() );
qwtPlot->setAxisFont( m_axisProperties->qwtPlotAxisType(), yAxisFont );
qwtPlot->setAxisFontsAndAlignment( m_axisProperties->qwtPlotAxisType(),
m_axisProperties->titleFontSize(),
m_axisProperties->valuesFontSize(),
true,
titleAlignment );
qwtPlot->setAxisTitleText( m_axisProperties->qwtPlotAxisType(), axisTitle );
}
{

View File

@ -32,6 +32,7 @@
#include "RimAsciiDataCurve.h"
#include "RimEnsembleCurveSet.h"
#include "RimEnsembleCurveSetCollection.h"
#include "RimGridPlotWindow.h"
#include "RimGridTimeHistoryCurve.h"
#include "RimPlotAxisProperties.h"
#include "RimProject.h"
@ -146,19 +147,14 @@ RimSummaryPlot::RimSummaryPlot()
m_description = "Summary Plot";
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Plot Title", "", "", "" );
m_showPlotTitle.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Legend", "", "", "" );
m_showLegend.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_legendFontSize, "LegendFontSize", 11, "Legend Font Size", "", "", "" );
m_showLegend.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", true, "Plot Title", "", "", "" );
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_showLegend_OBSOLETE, "ShowLegend", true, "Legend", "", "", "" );
m_showLegend_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto Title", "", "", "" );
m_useAutoPlotTitle.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" );
m_normalizeCurveYValues.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitFieldNoDefault( &m_curveFilters_OBSOLETE, "SummaryCurveFilters", "", "", "", "" );
m_curveFilters_OBSOLETE.uiCapability()->setUiTreeHidden( true );
@ -213,6 +209,7 @@ RimSummaryPlot::RimSummaryPlot()
m_textCurveSetEditor = new RimSummaryPlotFilterTextCurveSetEditor;
m_isCrossPlot = false;
m_isDraggable = true;
m_nameHelperAllCurves.reset( new RimSummaryPlotNameHelper );
@ -585,7 +582,6 @@ void RimSummaryPlot::updateAll()
updatePlotTitle();
m_plotWidget->updateLegend();
updateAxes();
updateZoomInQwt();
}
}
@ -1319,37 +1315,6 @@ caf::PdmFieldHandle* RimSummaryPlot::userDescriptionField()
return &m_description;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimSummaryPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_legendFontSize )
{
std::vector<int> fontSizes;
fontSizes.push_back( 8 );
fontSizes.push_back( 9 );
fontSizes.push_back( 10 );
fontSizes.push_back( 11 );
fontSizes.push_back( 12 );
fontSizes.push_back( 14 );
fontSizes.push_back( 16 );
fontSizes.push_back( 18 );
fontSizes.push_back( 24 );
for ( int value : fontSizes )
{
QString text = QString( "%1" ).arg( value );
options.push_back( caf::PdmOptionItemInfo( text, value ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1357,25 +1322,19 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_description || changedField == &m_showPlotTitle || changedField == &m_useAutoPlotTitle )
if ( changedField == &m_showWindow )
{
updateWindowVisibility();
}
if ( changedField == &m_useAutoPlotTitle )
{
updatePlotTitle();
updateConnectedEditors();
}
if ( changedField == &m_showLegend )
{
if ( m_plotWidget ) m_plotWidget->setLegendVisible( m_showLegend );
}
if ( changedField == &m_legendFontSize )
{
if ( m_plotWidget ) m_plotWidget->setLegendFontSize( m_legendFontSize() );
}
if ( changedField == &m_useAutoPlotTitle && !m_useAutoPlotTitle )
if ( !m_useAutoPlotTitle )
{
// When auto name of plot is turned off, update the auto name for all curves
@ -1384,6 +1343,7 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
c->updateCurveNameNoLegendUpdate();
}
}
}
if ( changedField == &m_normalizeCurveYValues )
{
@ -1396,24 +1356,6 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
QImage RimSummaryPlot::snapshotWindowContent()
{
#if 0
// This does not work with the color legend widgets. Is there a reason for doing this, and not to grab the widget ?
QImage image;
if (m_qwtPlot)
{
image = QImage(m_qwtPlot->size(), QImage::Format_ARGB32);
image.fill(QColor(Qt::white).rgb());
QPainter painter(&image);
QRectF rect(0, 0, m_qwtPlot->size().width(), m_qwtPlot->size().height());
QwtPlotRenderer plotRenderer;
plotRenderer.render(m_qwtPlot, &painter, rect);
}
return image;
#endif
QImage image;
if ( m_plotWidget )
@ -1472,7 +1414,7 @@ void RimSummaryPlot::onLoadDataAndUpdate()
{
updatePlotTitle();
updateMdiWindowVisibility();
updateWindowVisibility();
if ( m_summaryCurveCollection )
{
@ -1493,7 +1435,7 @@ void RimSummaryPlot::onLoadDataAndUpdate()
if ( m_plotWidget )
{
m_plotWidget->setLegendVisible( m_showLegend );
m_plotWidget->setLegendVisible( m_showPlotLegends && isStandalonePlot() );
m_plotWidget->setLegendFontSize( m_legendFontSize() );
m_plotWidget->updateLegend();
}
@ -1582,6 +1524,39 @@ void RimSummaryPlot::removeEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::removeFromMdiAreaAndCollection()
{
RimSummaryPlotCollection* summaryCollection = nullptr;
this->firstAncestorOrThisOfType( summaryCollection );
if ( summaryCollection )
{
summaryCollection->removeSummaryPlot( this );
this->revokeMdiWindowStatus();
summaryCollection->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateAfterInsertingIntoGridPlotWindow()
{
if ( m_plotWidget )
{
m_plotWidget->setTitle( "" );
m_plotWidget->setLegendVisible( false );
}
if ( m_timeAxisProperties )
{
m_timeAxisProperties->showTitle = true;
}
updateAxes();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1617,9 +1592,17 @@ bool RimSummaryPlot::isChecked() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::enableShowPlotTitle( bool enable )
void RimSummaryPlot::setChecked( bool checked )
{
m_showPlotTitle = enable;
m_showWindow = checked;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::setDraggable( bool draggable )
{
m_isDraggable = draggable;
}
//--------------------------------------------------------------------------------------------------
@ -1660,19 +1643,30 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* mainOptions = uiOrdering.addNewGroup( "General Plot Options" );
mainOptions->setCollapsedByDefault( true );
mainOptions->add( &m_showPlotTitle );
if ( m_showPlotTitle )
if ( isStandalonePlot() )
{
mainOptions->add( &m_showTitleInPlot );
if ( m_showTitleInPlot )
{
mainOptions->add( &m_useAutoPlotTitle );
mainOptions->add( &m_description );
}
}
else
{
mainOptions->add( &m_useAutoPlotTitle );
mainOptions->add( &m_description );
}
m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle );
mainOptions->add( &m_showLegend );
if ( m_showLegend() )
if ( isStandalonePlot() )
{
mainOptions->add( &m_showPlotLegends );
if ( m_showPlotLegends() )
{
mainOptions->add( &m_legendFontSize );
}
}
mainOptions->add( &m_normalizeCurveYValues );
@ -1689,6 +1683,7 @@ QWidget* RimSummaryPlot::createViewWidget( QWidget* mainWindowParent )
if ( !m_plotWidget )
{
m_plotWidget = new RiuSummaryQwtPlot( this, mainWindowParent );
m_plotWidget->setDraggable( m_isDraggable );
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
{
@ -1769,6 +1764,16 @@ void RimSummaryPlot::initAfterRead()
m_useAutoPlotTitle = false;
}
}
if ( m_showPlotTitle_OBSOLETE() )
{
m_showTitleInPlot = true;
}
if ( m_showLegend_OBSOLETE() )
{
m_showPlotLegends = true;
}
}
//--------------------------------------------------------------------------------------------------
@ -1776,13 +1781,13 @@ void RimSummaryPlot::initAfterRead()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateMdiWindowTitle()
{
if ( m_plotWidget )
if ( m_plotWidget && isStandalonePlot() )
{
QString plotTitle = description();
QString plotTitle = fullPlotTitle();
m_plotWidget->setWindowTitle( plotTitle );
if ( m_showPlotTitle )
if ( m_showTitleInPlot )
{
m_plotWidget->setTitle( plotTitle );
}
@ -1790,6 +1795,7 @@ void RimSummaryPlot::updateMdiWindowTitle()
{
m_plotWidget->setTitle( "" );
}
m_plotWidget->scheduleReplot();
}
}
@ -1836,6 +1842,23 @@ void RimSummaryPlot::updateNameHelperWithCurveData( RimSummaryPlotNameHelper* na
nameHelper->setEnsembleCases( ensembleCases );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateWindowVisibility()
{
RimGridPlotWindow* plotWindow = nullptr;
this->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
else
{
updateMdiWindowVisibility();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1909,14 +1932,6 @@ void RimSummaryPlot::reattachAllCurves()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::showLegend( bool enable )
{
m_showLegend = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -2062,24 +2077,6 @@ size_t RimSummaryPlot::curveCount() const
return m_summaryCurveCollection->curves().size() + m_gridTimeHistoryCurves.size() + m_asciiDataCurves.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_showLegend || field == &m_showPlotTitle || field == &m_useAutoPlotTitle ||
field == &m_normalizeCurveYValues )
{
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>( attribute );
if ( myAttr )
{
myAttr->m_useNativeCheckBoxLabel = true;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -72,11 +72,12 @@ public:
RimSummaryPlot();
~RimSummaryPlot() override;
void setDescription( const QString& description );
QString description() const;
void setDescription( const QString& description ) override;
QString description() const override;
bool isChecked() const override;
void setChecked( bool checked ) override;
void setDraggable( bool draggable );
void enableShowPlotTitle( bool enable );
void enableAutoPlotTitle( bool enable );
bool autoPlotTitle() const;
@ -100,7 +101,7 @@ public:
size_t curveCount() const;
void detachAllCurves();
void detachAllCurves() override;
void reattachAllCurves();
void updateCaseNameHasChanged();
@ -154,9 +155,8 @@ public:
void setNormalizationEnabled( bool enable );
bool isNormalizationEnabled();
void showLegend( bool enable );
void handleKeyPressEvent( QKeyEvent* keyEvent );
void handleKeyPressEvent( QKeyEvent* keyEvent ) override;
virtual RimSummaryPlotSourceStepping* sourceSteppingObjectForKeyEventHandling() const;
virtual std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
@ -171,11 +171,14 @@ public:
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
void onAxisSelected( int axis, bool toggle ) override;
void loadDataAndUpdate();
void loadDataAndUpdate() override;
void addOrUpdateEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
void removeEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
void removeFromMdiAreaAndCollection() override;
void updateAfterInsertingIntoGridPlotWindow() override;
public:
// RimViewWindow overrides
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
@ -186,18 +189,15 @@ private:
void updateMdiWindowTitle() override;
void updateNameHelperWithCurveData( RimSummaryPlotNameHelper* nameHelper ) const;
void updateWindowVisibility();
protected:
// Overridden PDM methods
caf::PdmFieldHandle* userDescriptionField() override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void onLoadDataAndUpdate() override;
@ -222,12 +222,8 @@ private:
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_showLegend;
caf::PdmField<bool> m_normalizeCurveYValues;
caf::PdmField<int> m_legendFontSize;
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
@ -248,6 +244,7 @@ private:
std::unique_ptr<QwtPlotTextLabel> m_plotInfoLabel;
bool m_isCrossPlot;
bool m_isDraggable;
std::unique_ptr<RimSummaryPlotNameHelper> m_nameHelperAllCurves;
@ -255,4 +252,7 @@ private:
caf::PdmChildArrayField<RimSummaryCurve*> m_summaryCurves_OBSOLETE;
caf::PdmChildArrayField<RimSummaryCurveFilter_OBSOLETE*> m_curveFilters_OBSOLETE;
caf::PdmField<bool> m_isAutoZoom_OBSOLETE;
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmField<bool> m_showLegend_OBSOLETE;
};

View File

@ -94,3 +94,11 @@ void RimSummaryPlotCollection::summaryPlotItemInfos( QList<caf::PdmOptionItemInf
caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotCollection::removeSummaryPlot( RimSummaryPlot* summaryPlot )
{
summaryPlots.removeChildObject( summaryPlot );
}

View File

@ -42,4 +42,6 @@ public:
void updateSummaryNameHasChanged();
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;
void removeSummaryPlot( RimSummaryPlot* summaryPlot );
};

View File

@ -30,6 +30,7 @@
#include "RimGridPlotWindow.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMimeData.h"
#include "RimPlotInterface.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCaseMainCollection.h"
@ -162,7 +163,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
}
if ( dynamic_cast<RimEclipseCase*>( uiItem ) || dynamic_cast<RimWellLogCurve*>( uiItem ) ||
dynamic_cast<RimWellLogFileChannel*>( uiItem ) || dynamic_cast<RimWellLogTrack*>( uiItem ) ||
dynamic_cast<RimWellLogFileChannel*>( uiItem ) || dynamic_cast<RimPlotInterface*>( uiItem ) ||
dynamic_cast<RimSummaryCase*>( uiItem ) )
{
// TODO: Remember to handle reservoir holding the main grid
@ -185,6 +186,20 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if ( dynamic_cast<RimGridPlotWindow*>( uiItem ) )
{
if ( RiuTypedPdmObjects<RimPlotInterface>::containsTypedObjects( m_dragItems ) )
{
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if ( dynamic_cast<RimPlotInterface*>( uiItem ) )
{
if ( RiuTypedPdmObjects<RimPlotInterface>::containsTypedObjects( m_dragItems ) )
{
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if ( dynamic_cast<RimWellLogTrack*>( uiItem ) )
{
if ( RiuTypedPdmObjects<RimWellLogCurve>::containsTypedObjects( m_dragItems ) )
@ -459,7 +474,7 @@ bool RiuDragDrop::handleGridPlotWindowDrop( Qt::DropAction action,
insertAfter = dynamic_cast<RimPlotInterface*>( visibleTracks[insertAfterPosition] );
}
}
RicWellLogPlotTrackFeatureImpl::movePlotsToGridPlotWindow( gridPlotWindow, plots, insertAfter );
gridPlotWindow->movePlotsToThis( plots, insertAfter );
return true;
}
}

View File

@ -107,7 +107,7 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimPlotInterface* plotDefinition, QWid
this->installEventFilter( this );
this->canvas()->installEventFilter( this );
setLegendVisible( true );
setInternalQwtLegendVisible( true );
}
//--------------------------------------------------------------------------------------------------
@ -268,9 +268,9 @@ void RiuGridCrossQwtPlot::setLegendFontSize( int fontSize )
}
//--------------------------------------------------------------------------------------------------
///
/// The internal qwt legend is not used in grid plot windows
//--------------------------------------------------------------------------------------------------
void RiuGridCrossQwtPlot::setLegendVisible( bool visible )
void RiuGridCrossQwtPlot::setInternalQwtLegendVisible( bool visible )
{
if ( visible )
{

View File

@ -61,7 +61,7 @@ public:
RimViewWindow* ownerViewWindow() const override;
void setLegendFontSize( int fontSize );
void setLegendVisible( bool visible );
void setInternalQwtLegendVisible( bool visible );
protected:
void updateLayout() override;

View File

@ -78,8 +78,8 @@ RiuGridPlotWindow::RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget
m_plotLayout->addWidget( m_plotWidgetFrame, 1 );
m_gridLayout = new QGridLayout( m_plotWidgetFrame );
m_gridLayout->setMargin( 0 );
m_gridLayout->setSpacing( 2 );
m_gridLayout->setContentsMargins( 1, 1, 1, 1 );
m_gridLayout->setSpacing( 1 );
QPalette newPalette( palette() );
newPalette.setColor( QPalette::Background, Qt::white );
@ -87,15 +87,15 @@ RiuGridPlotWindow::RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget
setAutoFillBackground( true );
m_scrollBar = new QScrollBar( nullptr );
m_scrollBar->setOrientation( Qt::Vertical );
m_scrollBar->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
m_scrollBarLayout = new QVBoxLayout;
m_scrollBarLayout->addWidget( m_scrollBar, 0 );
new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition );
m_dropTargetPlaceHolder = new QLabel( "Drag plots here" );
m_dropTargetPlaceHolder->setAlignment( Qt::AlignCenter );
m_dropTargetPlaceHolder->setObjectName(
QString( "%1" ).arg( reinterpret_cast<uint64_t>( m_dropTargetPlaceHolder.data() ) ) );
m_dropTargetStyleSheet = createDropTargetStyleSheet();
m_dropTargetStyleSheet.applyToWidget( m_dropTargetPlaceHolder );
this->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding );
setFocusPolicy( Qt::StrongFocus );
@ -105,6 +105,8 @@ RiuGridPlotWindow::RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget
RiaApplication* app = RiaApplication::instance();
int defaultFontSize = RiaFontCache::pointSizeFromFontSizeEnum( app->preferences()->defaultPlotFontSize() );
setFontSize( defaultFontSize );
this->setObjectName( QString( "%1" ).arg( reinterpret_cast<uint64_t>( this ) ) );
}
//--------------------------------------------------------------------------------------------------
@ -149,9 +151,12 @@ void RiuGridPlotWindow::addPlot( RiuQwtPlotWidget* plotWidget )
void RiuGridPlotWindow::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index )
{
plotWidget->setDraggable( true ); // Becomes draggable when added to a grid plot window
m_plotWidgets.insert( static_cast<int>( index ), plotWidget );
QLabel* subTitle = new QLabel( plotWidget->plotDefinition()->description() );
subTitle->setAlignment( Qt::AlignRight );
m_subTitles.insert( static_cast<int>( index ), subTitle );
RiuQwtPlotLegend* legend = new RiuQwtPlotLegend( this );
int legendColumns = 1;
if ( m_plotDefinition->legendsHorizontal() )
@ -170,6 +175,7 @@ void RiuGridPlotWindow::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index )
plotWidget->updateLegend();
m_legends.insert( static_cast<int>( index ), legend );
m_legendColumns.insert( static_cast<int>( index ), -1 );
scheduleUpdate();
}
@ -187,10 +193,16 @@ void RiuGridPlotWindow::removePlot( RiuQwtPlotWidget* plotWidget )
plotWidget->setParent( nullptr );
RiuQwtPlotLegend* legend = m_legends[plotWidgetIdx];
legend->setParent( nullptr );
m_legends.removeAt( plotWidgetIdx );
m_legendColumns.removeAt( plotWidgetIdx );
delete legend;
QLabel* subTitle = m_subTitles[plotWidgetIdx];
subTitle->setParent( nullptr );
m_subTitles.removeAt( plotWidgetIdx );
delete subTitle;
scheduleUpdate();
}
@ -202,28 +214,6 @@ void RiuGridPlotWindow::setPlotTitle( const QString& plotTitle )
m_plotTitle->setText( plotTitle );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuGridPlotWindow::preferredWidth() const
{
int titleWidth = 0;
if ( m_plotTitle && m_plotTitle->isVisible() )
{
titleWidth = m_plotTitle->width();
}
QList<QPointer<RiuQwtPlotWidget>> visiblePlotWidgets = this->visiblePlotWidgets();
auto rowAndColumnCount = this->rowAndColumnCount( visiblePlotWidgets.size() );
int sumColumnWidths = 0;
for ( int visibleIndex = 0; visibleIndex < rowAndColumnCount.second; ++visibleIndex )
{
sumColumnWidths += visiblePlotWidgets[visibleIndex]->width();
}
return std::max( titleWidth, sumColumnWidths );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -232,14 +222,6 @@ void RiuGridPlotWindow::setTitleVisible( bool visible )
m_plotTitle->setVisible( visible );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::setScrollbarVisible( bool visible )
{
m_scrollBar->setVisible( visible );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -390,8 +372,10 @@ void RiuGridPlotWindow::showEvent( QShowEvent* event )
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::dragEnterEvent( QDragEnterEvent* event )
{
if ( this->geometry().contains( event->pos() ) )
RiuQwtPlotWidget* source = dynamic_cast<RiuQwtPlotWidget*>( event->source() );
if ( source )
{
setWidgetState( RiuWidgetStyleSheet::DRAG_TARGET_INTO );
event->acceptProposedAction();
}
}
@ -401,11 +385,13 @@ void RiuGridPlotWindow::dragEnterEvent( QDragEnterEvent* event )
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::dragMoveEvent( QDragMoveEvent* event )
{
if ( this->geometry().contains( event->pos() ) )
if ( event->answerRect().intersects( this->geometry() ) )
{
RiuQwtPlotWidget* source = dynamic_cast<RiuQwtPlotWidget*>( event->source() );
if ( source )
if ( source && willAcceptDroppedPlot( source ) )
{
setWidgetState( RiuWidgetStyleSheet::DRAG_TARGET_INTO );
QRect originalGeometry = source->geometry();
QPoint offset = source->dragStartPosition();
QRect newRect( event->pos() - offset, originalGeometry.size() );
@ -431,9 +417,8 @@ void RiuGridPlotWindow::dragMoveEvent( QDragMoveEvent* event )
{
int insertAfterIndex = insertBeforeIndex - 1;
visiblePlotWidgets[insertAfterIndex]->setWidgetState( RiuWidgetStyleSheet::DRAG_TARGET_AFTER );
event->acceptProposedAction();
}
event->acceptProposedAction();
}
}
}
@ -443,6 +428,8 @@ void RiuGridPlotWindow::dragMoveEvent( QDragMoveEvent* event )
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::dragLeaveEvent( QDragLeaveEvent* event )
{
setWidgetState( RiuWidgetStyleSheet::DEFAULT );
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
{
m_plotWidgets[tIdx]->setWidgetState( RiuWidgetStyleSheet::DEFAULT );
@ -454,6 +441,8 @@ void RiuGridPlotWindow::dragLeaveEvent( QDragLeaveEvent* event )
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::dropEvent( QDropEvent* event )
{
setWidgetState( RiuWidgetStyleSheet::DEFAULT );
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
{
m_plotWidgets[tIdx]->setWidgetState( RiuWidgetStyleSheet::DEFAULT );
@ -463,7 +452,7 @@ void RiuGridPlotWindow::dropEvent( QDropEvent* event )
{
RiuQwtPlotWidget* source = dynamic_cast<RiuQwtPlotWidget*>( event->source() );
if ( source )
if ( source && willAcceptDroppedPlot( source ) )
{
event->acceptProposedAction();
@ -489,21 +478,34 @@ void RiuGridPlotWindow::dropEvent( QDropEvent* event )
insertAfter = m_plotWidgets[beforeIndex - 1]->plotDefinition();
}
RimPlotInterface* plotWidget = source->plotDefinition();
RimPlotInterface* plotToMove = source->plotDefinition();
if ( insertAfter != plotWidget )
if ( insertAfter != plotToMove )
{
RicWellLogPlotTrackFeatureImpl::movePlotsToGridPlotWindow( m_plotDefinition, { plotWidget }, insertAfter );
m_plotDefinition->movePlotsToThis( { plotToMove }, insertAfter );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuGridPlotWindow::willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<int, int> RiuGridPlotWindow::rowAndColumnCount( int plotWidgetCount ) const
{
if ( plotWidgetCount == 0 )
{
return std::make_pair( 0, 0 );
}
int columnCount = std::max( 1, std::min( m_plotDefinition->columnCount(), plotWidgetCount ) );
int rowCount = static_cast<int>( std::ceil( plotWidgetCount / static_cast<double>( columnCount ) ) );
return std::make_pair( rowCount, columnCount );
@ -516,6 +518,8 @@ void RiuGridPlotWindow::onSelectionManagerSelectionChanged( const std::set<int>&
{
for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets )
{
CAF_ASSERT( plotWidget );
bool isSelected = false;
for ( int changedLevel : changedSelectionLevels )
{
@ -536,21 +540,115 @@ void RiuGridPlotWindow::onSelectionManagerSelectionChanged( const std::set<int>&
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::performUpdate()
void RiuGridPlotWindow::setWidgetState( RiuWidgetStyleSheet::StateTag widgetState )
{
reinsertPlotWidgetsAndScrollbar();
alignCanvasTopsAndScrollbar();
m_dropTargetStyleSheet.setWidgetState( m_dropTargetPlaceHolder, widgetState );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::alignCanvasTopsAndScrollbar()
bool RiuGridPlotWindow::showYAxis( int row, int column ) const
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::performUpdate()
{
reinsertPlotWidgets();
alignCanvasTops();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::reinsertPlotWidgets()
{
clearGridLayout();
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
{
m_plotWidgets[tIdx]->hide();
m_legends[tIdx]->hide();
}
QList<QPointer<QLabel>> subTitles = this->visibleTitles();
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
if ( plotWidgets.empty() )
{
m_gridLayout->addWidget( m_dropTargetPlaceHolder, 0, 0 );
m_gridLayout->setRowStretch( 0, 1 );
m_dropTargetPlaceHolder->setVisible( true );
}
else
{
m_dropTargetPlaceHolder->setVisible( false );
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
{
int row = visibleIndex / rowAndColumnCount.second;
int column = visibleIndex % rowAndColumnCount.second;
m_gridLayout->addWidget( subTitles[visibleIndex], 3 * row, column );
m_gridLayout->addWidget( legends[visibleIndex], 3 * row + 1, column );
m_gridLayout->addWidget( plotWidgets[visibleIndex], 3 * row + 2, column );
subTitles[visibleIndex]->setVisible( m_plotDefinition->showPlotTitles() );
if ( m_plotDefinition->legendsVisible() )
{
int legendColumns = 1;
if ( m_plotDefinition->legendsHorizontal() )
{
legendColumns = 0; // unlimited
}
legends[visibleIndex]->setMaxColumns( legendColumns );
int minimumHeight = legends[visibleIndex]->heightForWidth( plotWidgets[visibleIndex]->width() );
legends[visibleIndex]->setMinimumHeight( minimumHeight );
QFont legendFont = legends[visibleIndex]->font();
legendFont.setPointSize( m_plotDefinition->legendFontSize() );
legends[visibleIndex]->setFont( legendFont );
legends[visibleIndex]->show();
}
else
{
legends[visibleIndex]->hide();
}
plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( QwtPlot::yLeft, showYAxis( row, column ) );
plotWidgets[visibleIndex]->setAxisTitleEnabled( QwtPlot::yLeft, showYAxis( row, column ) );
plotWidgets[visibleIndex]->show();
int widthScaleFactor = plotWidgets[visibleIndex]->widthScaleFactor();
if ( showYAxis( row, column ) )
{
widthScaleFactor += 1; // Give it a bit extra room due to axis
}
m_gridLayout->setColumnStretch( column,
std::max( m_gridLayout->columnStretch( column ),
plotWidgets[visibleIndex]->widthScaleFactor() ) );
m_gridLayout->setRowStretch( 3 * row + 2, 1 );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuGridPlotWindow::alignCanvasTops()
{
CVF_ASSERT( m_legends.size() == m_plotWidgets.size() );
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = visiblePlotWidgets();
if ( plotWidgets.empty() ) return;
if ( plotWidgets.empty() ) return 0;
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
@ -570,73 +668,7 @@ void RiuGridPlotWindow::alignCanvasTopsAndScrollbar()
int row = visibleIndex / rowAndColumnCount.second;
plotWidgets[visibleIndex]->axisScaleDraw( QwtPlot::xTop )->setMinimumExtent( maxExtents[row] );
}
m_scrollBarLayout->setContentsMargins( 0, maxExtents[0], 0, 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::reinsertPlotWidgetsAndScrollbar()
{
clearGridLayout();
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
{
m_plotWidgets[tIdx]->hide();
m_legends[tIdx]->hide();
}
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
{
int row = visibleIndex / rowAndColumnCount.second;
int column = visibleIndex % rowAndColumnCount.second;
m_gridLayout->addWidget( legends[visibleIndex], 2 * row, column );
m_gridLayout->addWidget( plotWidgets[visibleIndex], 2 * row + 1, column );
if ( m_plotDefinition->legendsVisible() )
{
int legendColumns = 1;
if ( m_plotDefinition->legendsHorizontal() )
{
legendColumns = 0; // unlimited
}
legends[visibleIndex]->setMaxColumns( legendColumns );
int minimumHeight = legends[visibleIndex]->heightForWidth( plotWidgets[visibleIndex]->width() );
legends[visibleIndex]->setMinimumHeight( minimumHeight );
QFont legendFont = legends[visibleIndex]->font();
legendFont.setPointSize( fontSize() - 1 );
legends[visibleIndex]->setFont( legendFont );
legends[visibleIndex]->show();
}
else
{
legends[visibleIndex]->hide();
}
plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( QwtPlot::yLeft, column == 0 );
plotWidgets[visibleIndex]->setAxisTitleEnabled( QwtPlot::yLeft, column == 0 );
plotWidgets[visibleIndex]->show();
int widthScaleFactor = plotWidgets[visibleIndex]->widthScaleFactor();
if ( column == 0 )
{
widthScaleFactor += 1; // Give it a bit extra room due to axis
}
m_gridLayout->setColumnStretch( column,
std::max( m_gridLayout->columnStretch( column ),
plotWidgets[visibleIndex]->widthScaleFactor() ) );
m_gridLayout->setRowStretch( 2 * row + 1, 1 );
}
m_gridLayout->addLayout( m_scrollBarLayout, 1, rowAndColumnCount.second, rowAndColumnCount.first * 2 - 1, 1 );
m_gridLayout->setColumnStretch( rowAndColumnCount.second, 0 );
m_scrollBar->setVisible( plotWidgets.size() > 0 );
return maxExtents[0];
}
//--------------------------------------------------------------------------------------------------
@ -648,6 +680,7 @@ void RiuGridPlotWindow::clearGridLayout()
{
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
{
m_gridLayout->removeWidget( m_subTitles[tIdx] );
m_gridLayout->removeWidget( m_legends[tIdx] );
m_gridLayout->removeWidget( m_plotWidgets[tIdx] );
}
@ -662,6 +695,22 @@ void RiuGridPlotWindow::clearGridLayout()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWidgetStyleSheet RiuGridPlotWindow::createDropTargetStyleSheet()
{
RiuWidgetStyleSheet styleSheet;
styleSheet.set( "background-color", "white" );
styleSheet.set( "border", "1px dashed black" );
styleSheet.set( "font-size", "14pt" );
styleSheet.state( RiuWidgetStyleSheet::DRAG_TARGET_INTO ).set( "border", "1px dashed lime" );
styleSheet.state( RiuWidgetStyleSheet::DRAG_TARGET_INTO ).set( "background-color", "#DDFFDD" );
return styleSheet;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -693,3 +742,19 @@ QList<QPointer<RiuQwtPlotLegend>> RiuGridPlotWindow::visibleLegends() const
}
return legends;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<QPointer<QLabel>> RiuGridPlotWindow::visibleTitles() const
{
QList<QPointer<QLabel>> subTitles;
for ( int i = 0; i < m_plotWidgets.size(); ++i )
{
if ( m_plotWidgets[i]->isChecked() )
{
subTitles.push_back( m_subTitles[i] );
}
}
return subTitles;
}

View File

@ -20,6 +20,7 @@
#pragma once
#include "RiuInterfaceToViewWindow.h"
#include "RiuWidgetStyleSheet.h"
#include "cafPdmPointer.h"
#include "cafSelectionChangedReceiver.h"
@ -64,10 +65,8 @@ public:
void removePlot( RiuQwtPlotWidget* plotWidget );
void setPlotTitle( const QString& plotTitle );
int preferredWidth() const;
void setTitleVisible( bool visible );
void setScrollbarVisible( bool visible );
void setSelectionsVisible( bool visible );
void setFontSize( int fontSize );
@ -90,21 +89,28 @@ protected:
void dragMoveEvent( QDragMoveEvent* event ) override;
void dragLeaveEvent( QDragLeaveEvent* event ) override;
void dropEvent( QDropEvent* event ) override;
virtual bool willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const;
std::pair<int, int> rowAndColumnCount( int plotWidgetCount ) const;
virtual void onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels ) override;
private slots:
void performUpdate();
void setWidgetState( RiuWidgetStyleSheet::StateTag widgetState );
virtual bool showYAxis( int row, int column ) const;
void reinsertPlotWidgets();
int alignCanvasTops();
private:
void alignCanvasTopsAndScrollbar();
void reinsertPlotWidgetsAndScrollbar();
void clearGridLayout();
RiuWidgetStyleSheet createDropTargetStyleSheet();
QList<QPointer<RiuQwtPlotWidget>> visiblePlotWidgets() const;
QList<QPointer<RiuQwtPlotLegend>> visibleLegends() const;
QList<QPointer<QLabel>> visibleTitles() const;
private slots:
virtual void performUpdate();
protected:
QPointer<QVBoxLayout> m_layout;
@ -112,12 +118,14 @@ protected:
QPointer<QFrame> m_plotWidgetFrame;
QPointer<QGridLayout> m_gridLayout;
QPointer<QLabel> m_plotTitle;
QPointer<QVBoxLayout> m_scrollBarLayout;
QScrollBar* m_scrollBar;
QList<QPointer<RiuQwtPlotLegend>> m_legends;
QList<int> m_legendColumns;
QList<QPointer<QLabel>> m_subTitles;
QList<QPointer<RiuQwtPlotLegend>> m_legends;
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
caf::PdmPointer<RimGridPlotWindow> m_plotDefinition;
QPointer<QLabel> m_dropTargetPlaceHolder;
RiuWidgetStyleSheet m_dropTargetStyleSheet;
private:
friend class RiaPlotWindowRedrawScheduler;

View File

@ -158,6 +158,7 @@ void RiuPlotMainWindow::cleanupGuiBeforeProjectClose()
m_wellLogPlotToolBarEditor->clear();
m_summaryPlotToolBarEditor->clear();
m_gridPlotWindowToolBarEditor->clear();
setWindowTitle( "Plots - ResInsight" );
}
@ -381,6 +382,9 @@ void RiuPlotMainWindow::createToolBars()
m_summaryPlotToolBarEditor = new caf::PdmUiToolBarEditor( "Summary Plot", this );
m_summaryPlotToolBarEditor->hide();
m_gridPlotWindowToolBarEditor = new caf::PdmUiToolBarEditor( "Combination Plot", this );
m_gridPlotWindowToolBarEditor->hide();
}
//--------------------------------------------------------------------------------------------------
@ -546,7 +550,6 @@ void RiuPlotMainWindow::updateWellLogPlotToolBar()
{
std::vector<caf::PdmFieldHandle*> toolBarFields;
toolBarFields = wellLogPlot->commonDataSource()->fieldsToShowInToolbar();
toolBarFields.push_back( wellLogPlot->columnCountField() );
m_wellLogPlotToolBarEditor->setFields( toolBarFields );
m_wellLogPlotToolBarEditor->updateUi();
@ -563,12 +566,39 @@ void RiuPlotMainWindow::updateWellLogPlotToolBar()
refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateGridPlotWindowToolBar()
{
RimGridPlotWindow* plotWindow = dynamic_cast<RimGridPlotWindow*>( m_activePlotViewWindow.p() );
if ( plotWindow )
{
std::vector<caf::PdmFieldHandle*> toolBarFields = { plotWindow->columnCountField() };
m_gridPlotWindowToolBarEditor->setFields( toolBarFields );
m_gridPlotWindowToolBarEditor->updateUi();
m_gridPlotWindowToolBarEditor->show();
}
else
{
m_gridPlotWindowToolBarEditor->clear();
m_gridPlotWindowToolBarEditor->hide();
}
refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateSummaryPlotToolBar( bool forceUpdateUi )
{
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( m_activePlotViewWindow.p() );
RimGridPlotWindow* gridPlotWindow = dynamic_cast<RimGridPlotWindow*>( m_activePlotViewWindow.p() );
if ( gridPlotWindow )
{
summaryPlot = caf::SelectionManager::instance()->selectedItemOfType<RimSummaryPlot>();
}
if ( summaryPlot )
{
std::vector<caf::PdmFieldHandle*> toolBarFields = summaryPlot->fieldsToShowInToolbar();
@ -630,17 +660,9 @@ void RiuPlotMainWindow::addViewer( QWidget* viewer, const RimMdiWindowGeometry&
subWindowSize = QSize( windowsGeometry.width, windowsGeometry.height );
}
else
{
RiuGridPlotWindow* wellLogPlot = dynamic_cast<RiuGridPlotWindow*>( viewer );
if ( wellLogPlot )
{
subWindowSize = QSize( wellLogPlot->preferredWidth(), m_mdiArea->height() );
}
else
{
subWindowSize = QSize( 400, 400 );
}
}
addViewerToMdiArea( m_mdiArea, viewer, subWindowPos, subWindowSize );
@ -695,6 +717,7 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow )
updateWellLogPlotToolBar();
updateSummaryPlotToolBar();
updateGridPlotWindowToolBar();
}
//--------------------------------------------------------------------------------------------------

View File

@ -80,6 +80,7 @@ public:
void addToTemporaryWidgets( QWidget* widget );
void updateWellLogPlotToolBar();
void updateGridPlotWindowToolBar();
void updateSummaryPlotToolBar( bool forceUpdateUi = false );
void setFocusToLineEditInSummaryToolBar();
@ -120,6 +121,7 @@ private:
QMenu* m_windowMenu;
caf::PdmUiToolBarEditor* m_wellLogPlotToolBarEditor;
caf::PdmUiToolBarEditor* m_gridPlotWindowToolBarEditor;
caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor;
std::unique_ptr<caf::PdmUiDragDropInterface> m_dragDropInterface;

View File

@ -61,7 +61,7 @@
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidget* parent )
: QwtPlot( parent )
, m_draggable( false )
, m_draggable( true )
{
m_plotOwner = dynamic_cast<caf::PdmObject*>( plotTrackDefinition );
CAF_ASSERT( m_plotOwner );
@ -178,7 +178,6 @@ void RiuQwtPlotWidget::setEnabledAxes( const std::set<QwtPlot::Axis> enabledAxes
axisScaleDraw( axis )->setMinimumExtent( axisExtent( axis ) );
setMinimumWidth( defaultMinimumWidth() );
axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Backbone, false );
axisWidget( axis )->setMargin( 0 );
m_axisTitlesEnabled[axis] = true;
}
@ -196,13 +195,6 @@ void RiuQwtPlotWidget::setEnabledAxes( const std::set<QwtPlot::Axis> enabledAxes
void RiuQwtPlotWidget::setAxisTitleText( QwtPlot::Axis axis, const QString& title )
{
m_axisTitles[axis] = title;
QwtText axisTitleText = axisTitle( axis );
if ( title != axisTitleText.text() )
{
axisTitleText.setText( title );
setAxisTitle( axis, axisTitleText );
}
applyAxisTitleToQwt( axis );
}
@ -568,10 +560,11 @@ void RiuQwtPlotWidget::showEvent( QShowEvent* event )
void RiuQwtPlotWidget::applyAxisTitleToQwt( QwtPlot::Axis axis )
{
QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" );
QwtText axisTitle = this->axisTitle( QwtPlot::yLeft );
QwtText axisTitle = this->axisTitle( axis );
if ( titleToApply != axisTitle.text() )
{
axisTitle.setText( titleToApply );
setAxisTitle( axis, axisTitle );
if ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight )
{
@ -613,7 +606,7 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS
RiuWidgetStyleSheet RiuQwtPlotWidget::createPlotStyleSheet() const
{
QColor backgroundColor = QColor( "white" );
QColor highlightColor = this->palette().highlight().color();
QColor highlightColor = QApplication::palette().highlight().color();
QColor blendedHighlightColor = RiaColorTools::blendQColors( highlightColor, backgroundColor, 1, 5 );
QColor nearlyBackgroundColor = RiaColorTools::blendQColors( highlightColor, backgroundColor, 1, 30 );
@ -645,7 +638,7 @@ RiuWidgetStyleSheet RiuQwtPlotWidget::createCanvasStyleSheet() const
{
RiuWidgetStyleSheet styleSheet;
styleSheet.set( "background-color", "#FAFAFA" );
styleSheet.set( "border", "1px solid black" );
styleSheet.set( "border", "1px solid LightGray" );
return styleSheet;
}

View File

@ -3,6 +3,9 @@
#include "RimPlotWindow.h"
#include "RimWellLogPlot.h"
#include "RiuQwtPlotWidget.h"
#include "RiuWellLogTrack.h"
#include "cafAssert.h"
#include "cafPdmPointer.h"
@ -14,7 +17,22 @@
RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent )
: RiuGridPlotWindow( plotDefinition, parent )
{
connect( m_scrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) );
m_trackScrollBar = new QScrollBar( nullptr );
m_trackScrollBar->setOrientation( Qt::Vertical );
m_trackScrollBar->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
m_trackScrollBarLayout = new QVBoxLayout;
m_trackScrollBarLayout->addWidget( m_trackScrollBar, 0 );
connect( m_trackScrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellLogPlot::isScrollbarVisible() const
{
return m_trackScrollBar->isVisible();
}
//--------------------------------------------------------------------------------------------------
@ -27,6 +45,14 @@ RimWellLogPlot* RiuWellLogPlot::wellLogPlotDefinition()
return wellLogPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setScrollbarVisible( bool visible )
{
m_trackScrollBar->setVisible( visible );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -36,14 +62,53 @@ void RiuWellLogPlot::updateVerticalScrollBar( double minVisible, double maxVisib
double visibleRange = maxVisible - minVisible;
m_scrollBar->blockSignals( true );
m_trackScrollBar->blockSignals( true );
{
m_scrollBar->setRange( (int)minAvailable, (int)( ( maxAvailable - visibleRange ) ) );
m_scrollBar->setPageStep( (int)visibleRange );
m_scrollBar->setValue( (int)minVisible );
m_scrollBar->setVisible( true );
m_trackScrollBar->setRange( (int)minAvailable, (int)( ( maxAvailable - visibleRange ) ) );
m_trackScrollBar->setPageStep( (int)visibleRange );
m_trackScrollBar->setValue( (int)minVisible );
m_trackScrollBar->setVisible( true );
}
m_scrollBar->blockSignals( false );
m_trackScrollBar->blockSignals( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellLogPlot::willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const
{
return dynamic_cast<const RiuWellLogTrack*>( plotWidget ) != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellLogPlot::showYAxis( int row, int column ) const
{
return column == 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::reinsertScrollbar()
{
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
m_trackScrollBar->setVisible( !plotWidgets.empty() );
m_gridLayout->addLayout( m_trackScrollBarLayout, 2, rowAndColumnCount.second, rowAndColumnCount.first * 2 - 1, 1 );
m_gridLayout->setColumnStretch( rowAndColumnCount.second, 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::alignScrollbar( int offset )
{
m_trackScrollBarLayout->setContentsMargins( 0, offset, 0, 0 );
}
//--------------------------------------------------------------------------------------------------
@ -59,3 +124,14 @@ void RiuWellLogPlot::slotSetMinDepth( int value )
wellLogPlotDefinition()->setDepthAxisRange( minimumDepth + delta, maximumDepth + delta );
wellLogPlotDefinition()->setAutoScaleYEnabled( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::performUpdate()
{
reinsertPlotWidgets();
reinsertScrollbar();
int axisShift = alignCanvasTops();
alignScrollbar( axisShift );
}

View File

@ -19,6 +19,7 @@
#include "RiuGridPlotWindow.h"
class RiuQwtPlotWidget;
class RimWellLogPlot;
class RiuWellLogPlot : public RiuGridPlotWindow
@ -26,11 +27,26 @@ class RiuWellLogPlot : public RiuGridPlotWindow
Q_OBJECT
public:
RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent );
void updateVerticalScrollBar( double minVisible, double maxVisible, double minAvailable, double maxAvailable );
bool isScrollbarVisible() const;
void setScrollbarVisible( bool visible );
void updateVerticalScrollBar( double minVisible, double maxVisible, double minAvailable, double maxAvailable ) override;
protected:
bool willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const override;
bool showYAxis( int row, int column ) const override;
void reinsertScrollbar();
void alignScrollbar( int offset );
private:
RimWellLogPlot* wellLogPlotDefinition();
private slots:
void slotSetMinDepth( int value );
void performUpdate() override;
private:
QPointer<QVBoxLayout> m_trackScrollBarLayout;
QScrollBar* m_trackScrollBar;
};

View File

@ -183,7 +183,7 @@ void RiuWidgetStyleSheet::refreshWidget( QWidget* widget ) const
QString RiuWidgetStyleSheet::buildStateString( StateTag state )
{
QString stateString;
if ( state > PSEUDO_STATE_LIMIT )
if ( state >= PSEUDO_STATE_LIMIT )
{
stateString += ":" + StateTagEnum::uiText( state );
}