mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#12008 Improve display of curves from selected cells in 3D view
* Remove obsolete base class * Add conversion between one/zero-based IJK * Move code to RiaTextStringTools * Add automatic update of grid cell curves when clicking in 3D view * Fix missing conversion to QString
This commit is contained in:
parent
f743957b0a
commit
860588d755
@ -298,6 +298,7 @@
|
||||
<file>Select.svg</file>
|
||||
<file>NavigationProperty.svg</file>
|
||||
<file>user-defined-view.svg</file>
|
||||
<file>gear.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Shader">
|
||||
<file>fs_CellFace.glsl</file>
|
||||
|
6
ApplicationExeCode/Resources/gear.svg
Normal file
6
ApplicationExeCode/Resources/gear.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M11 3C10.4477 3 10 3.44772 10 4V4.56876C10 4.99658 9.71288 5.36825 9.31776 5.53229C8.9225 5.6964 8.46228 5.63386 8.15966 5.33123L7.75734 4.92891C7.36681 4.53839 6.73365 4.53839 6.34312 4.92891L4.92891 6.34313C4.53838 6.73365 4.53838 7.36681 4.92891 7.75734L5.33123 8.15966C5.63386 8.46229 5.6964 8.9225 5.53229 9.31776C5.36825 9.71288 4.99658 10 4.56877 10L4 10C3.44772 10 3 10.4477 3 11V13C3 13.5523 3.44772 14 4 14H4.56879C4.99659 14 5.36825 14.2871 5.53228 14.6822C5.69638 15.0775 5.63384 15.5377 5.33123 15.8403L4.92889 16.2426C4.53837 16.6331 4.53837 17.2663 4.92889 17.6568L6.34311 19.071C6.73363 19.4616 7.36679 19.4616 7.75732 19.071L8.1596 18.6688C8.46223 18.3661 8.92247 18.3036 9.31774 18.4677C9.71287 18.6317 10 19.0034 10 19.4313V20C10 20.5523 10.4477 21 11 21H13C13.5523 21 14 20.5523 14 20V19.4312C14 19.0034 14.2871 18.6318 14.6822 18.4677C15.0775 18.3036 15.5377 18.3661 15.8403 18.6688L16.2426 19.071C16.6331 19.4616 17.2663 19.4616 17.6568 19.071L19.071 17.6568C19.4616 17.2663 19.4616 16.6331 19.071 16.2426L18.6688 15.8403C18.3661 15.5377 18.3036 15.0775 18.4677 14.6822C18.6318 14.2871 19.0034 14 19.4312 14H20C20.5523 14 21 13.5523 21 13V11C21 10.4477 20.5523 10 20 10L19.4313 10C19.0034 10 18.6317 9.71287 18.4677 9.31774C18.3036 8.92247 18.3661 8.46223 18.6688 8.1596L19.071 7.75734C19.4615 7.36681 19.4616 6.73365 19.071 6.34312L17.6568 4.92891C17.2663 4.53838 16.6331 4.53838 16.2426 4.92891L15.8403 5.33123C15.5377 5.63384 15.0775 5.69638 14.6822 5.53228C14.2871 5.36825 14 4.99659 14 4.56879V4C14 3.44772 13.5523 3 13 3H11ZM12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14Z" fill="#000000"/>
|
||||
<path d="M11 3H13C13.5523 3 14 3.44772 14 4V4.56879C14 4.99659 14.2871 5.36825 14.6822 5.53228C15.0775 5.69638 15.5377 5.63384 15.8403 5.33123L16.2426 4.92891C16.6331 4.53838 17.2663 4.53838 17.6568 4.92891L19.071 6.34312C19.4616 6.73365 19.4615 7.36681 19.071 7.75734L18.6688 8.1596C18.3661 8.46223 18.3036 8.92247 18.4677 9.31774C18.6317 9.71287 19.0034 10 19.4313 10L20 10C20.5523 10 21 10.4477 21 11V13C21 13.5523 20.5523 14 20 14H19.4312C19.0034 14 18.6318 14.2871 18.4677 14.6822C18.3036 15.0775 18.3661 15.5377 18.6688 15.8403L19.071 16.2426C19.4616 16.6331 19.4616 17.2663 19.071 17.6568L17.6568 19.071C17.2663 19.4616 16.6331 19.4616 16.2426 19.071L15.8403 18.6688C15.5377 18.3661 15.0775 18.3036 14.6822 18.4677C14.2871 18.6318 14 19.0034 14 19.4312V20C14 20.5523 13.5523 21 13 21H11C10.4477 21 10 20.5523 10 20V19.4313C10 19.0034 9.71287 18.6317 9.31774 18.4677C8.92247 18.3036 8.46223 18.3661 8.1596 18.6688L7.75732 19.071C7.36679 19.4616 6.73363 19.4616 6.34311 19.071L4.92889 17.6568C4.53837 17.2663 4.53837 16.6331 4.92889 16.2426L5.33123 15.8403C5.63384 15.5377 5.69638 15.0775 5.53228 14.6822C5.36825 14.2871 4.99659 14 4.56879 14H4C3.44772 14 3 13.5523 3 13V11C3 10.4477 3.44772 10 4 10L4.56877 10C4.99658 10 5.36825 9.71288 5.53229 9.31776C5.6964 8.9225 5.63386 8.46229 5.33123 8.15966L4.92891 7.75734C4.53838 7.36681 4.53838 6.73365 4.92891 6.34313L6.34312 4.92891C6.73365 4.53839 7.36681 4.53839 7.75734 4.92891L8.15966 5.33123C8.46228 5.63386 8.9225 5.6964 9.31776 5.53229C9.71288 5.36825 10 4.99658 10 4.56876V4C10 3.44772 10.4477 3 11 3Z" stroke="#000000" stroke-width="1.5"/>
|
||||
<path d="M14 12C14 13.1046 13.1046 14 12 14C10.8954 14 10 13.1046 10 12C10 10.8954 10.8954 10 12 10C13.1046 10 14 10.8954 14 12Z" stroke="#000000" stroke-width="1.5"/>
|
||||
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
@ -206,6 +206,25 @@ bool RiaTextStringTools::isNumber( const QString& text, const QString& decimalPo
|
||||
return RiaStdStringTools::isNumber( stdString, decimalChar );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QVector<double> RiaTextStringTools::parseDoubleValues( const QString& input )
|
||||
{
|
||||
// Flexible regex to extract three double numbers with any surrounding text
|
||||
QRegularExpression coordRegex( R"([-+]?\d+\.?\d*)" );
|
||||
QRegularExpressionMatchIterator it = coordRegex.globalMatch( input );
|
||||
|
||||
QVector<double> coords;
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
QRegularExpressionMatch match = it.next();
|
||||
coords.append( match.captured().toDouble() );
|
||||
}
|
||||
|
||||
return coords;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -46,6 +46,8 @@ QString replaceTemplateTextWithValues( const QString& templateText, const std::m
|
||||
bool isTextEqual( QStringView text, QStringView compareText );
|
||||
bool isNumber( const QString& text, const QString& decimalPoint );
|
||||
|
||||
QVector<double> parseDoubleValues( const QString& input );
|
||||
|
||||
} // namespace RiaTextStringTools
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 8, 0 )
|
||||
|
@ -53,31 +53,6 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewGridTimeHistoryCurveFeature, "RicNewGridTimeHistoryCurveFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewGridTimeHistoryCurveFeature::createCurveFromSelectionItem( const RiuSelectionItem* selectionItem, RimSummaryPlot* plot )
|
||||
{
|
||||
CVF_ASSERT( selectionItem );
|
||||
CVF_ASSERT( plot );
|
||||
|
||||
RimGridTimeHistoryCurve* newCurve = new RimGridTimeHistoryCurve();
|
||||
newCurve->setFromSelectionItem( selectionItem );
|
||||
newCurve->setLineThickness( 2 );
|
||||
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plot->curveCount() );
|
||||
newCurve->setColor( curveColor );
|
||||
|
||||
plot->addGridTimeHistoryCurve( newCurve );
|
||||
|
||||
newCurve->loadDataAndUpdate( true );
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newCurve );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -92,10 +67,28 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
QString lastUsedPlotRef = app->cacheDataObject( lastUsedSummaryPlotKey ).toString();
|
||||
RimSummaryPlot* lastUsedPlot =
|
||||
dynamic_cast<RimSummaryPlot*>( caf::PdmReferenceHelper::objectFromReference( app->project(), lastUsedPlotRef ) );
|
||||
|
||||
if ( lastUsedPlot )
|
||||
{
|
||||
defaultSelectedPlot = lastUsedPlot;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto getFirstSummaryPlot = []() -> RimSummaryPlot*
|
||||
{
|
||||
auto summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection();
|
||||
for ( auto multiPlot : summaryPlotColl->multiPlots() )
|
||||
{
|
||||
for ( auto summaryPlot : multiPlot->summaryPlots() )
|
||||
{
|
||||
return summaryPlot;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
defaultSelectedPlot = getFirstSummaryPlot();
|
||||
}
|
||||
}
|
||||
|
||||
RicSelectSummaryPlotUI featureUi;
|
||||
@ -250,7 +243,7 @@ void RicNewGridTimeHistoryCurveFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
for ( auto item : items )
|
||||
{
|
||||
RicNewGridTimeHistoryCurveFeature::createCurveFromSelectionItem( item, summaryPlot );
|
||||
RimGridTimeHistoryCurve::createCurveFromSelectionItem( item, summaryPlot );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,6 @@ protected:
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
static void createCurveFromSelectionItem( const RiuSelectionItem* selectionItem, RimSummaryPlot* plot );
|
||||
static RimSummaryPlot* userSelectedSummaryPlot();
|
||||
static QString suggestedNewPlotName();
|
||||
};
|
||||
|
@ -204,10 +204,9 @@ RigWellResultPoint RifReaderEclipseWell::createWellResultPoint( const RigEclipse
|
||||
|
||||
resultPoint.setConnectionFactor( connectionFactor );
|
||||
|
||||
auto ijkOneBased = grid->ijkFromCellIndexOneBased( gridCellIndex );
|
||||
if ( ijkOneBased )
|
||||
if ( auto ijk = grid->ijkFromCellIndex( gridCellIndex ) )
|
||||
{
|
||||
resultPoint.setIjk( *ijkOneBased );
|
||||
resultPoint.setIjk( ijk->toOneBased() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimGeometrySelectionItem.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RiuGeoMechSelectionItem;
|
||||
@ -31,7 +30,7 @@ class RimGeoMechCase;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGeoMechGeometrySelectionItem : public RimGeometrySelectionItem
|
||||
class RimGeoMechGeometrySelectionItem : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -41,7 +40,7 @@ public:
|
||||
|
||||
void setFromSelectionItem( const RiuGeoMechSelectionItem* selectionItem );
|
||||
|
||||
QString geometrySelectionText() const override;
|
||||
QString geometrySelectionText() const;
|
||||
RimGeoMechCase* geoMechCase() const;
|
||||
|
||||
public:
|
||||
|
@ -64,7 +64,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCheckableNamedObject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCheckableObject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridTimeHistoryCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeometrySelectionItem.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseGeometrySelectionItem.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDialogData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTimeStepFilter.h
|
||||
@ -193,7 +192,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCheckableNamedObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCheckableObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridTimeHistoryCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeometrySelectionItem.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseGeometrySelectionItem.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDialogData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTimeStepFilter.cpp
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "RimEclipseGeometrySelectionItem.h"
|
||||
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigGridBase.h"
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
@ -25,6 +27,7 @@
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
@ -40,7 +43,10 @@ RimEclipseGeometrySelectionItem::RimEclipseGeometrySelectionItem()
|
||||
CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_gridIndex, "GridIndex", "Grid Index" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_cellIndex, "CellIndex", "Cell Index" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_localIntersectionPointInDisplay, "LocalIntersectionPoint", "local Intersection Point" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ijkText, "CellText", "IJK" );
|
||||
m_ijkText.registerGetMethod( this, &RimEclipseGeometrySelectionItem::ijkTextFromCell );
|
||||
m_ijkText.registerSetMethod( this, &RimEclipseGeometrySelectionItem::setCellFromIjkText );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -55,9 +61,8 @@ RimEclipseGeometrySelectionItem::~RimEclipseGeometrySelectionItem()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseGeometrySelectionItem::setFromSelectionItem( const RiuEclipseSelectionItem* selectionItem )
|
||||
{
|
||||
m_gridIndex = selectionItem->m_gridIndex;
|
||||
m_cellIndex = selectionItem->m_gridLocalCellIndex;
|
||||
m_localIntersectionPointInDisplay = selectionItem->m_localIntersectionPointInDisplay;
|
||||
m_gridIndex = selectionItem->m_gridIndex;
|
||||
m_cellIndex = selectionItem->m_gridLocalCellIndex;
|
||||
|
||||
m_eclipseCase = selectionItem->m_resultDefinition->eclipseCase();
|
||||
}
|
||||
@ -70,8 +75,8 @@ void RimEclipseGeometrySelectionItem::setFromCaseGridAndIJK( RimEclipseCase* ecl
|
||||
m_eclipseCase = eclipseCase;
|
||||
m_gridIndex = gridIndex;
|
||||
|
||||
size_t lgrCellIndex = eclipseCase->eclipseCaseData()->grid( gridIndex )->cellIndexFromIJK( i, j, k );
|
||||
size_t reservoirCellIndex = eclipseCase->eclipseCaseData()->grid( gridIndex )->reservoirCellIndex( lgrCellIndex );
|
||||
size_t localIndex = grid()->cellIndexFromIJK( i, j, k );
|
||||
size_t reservoirCellIndex = grid()->reservoirCellIndex( localIndex );
|
||||
m_cellIndex = reservoirCellIndex;
|
||||
}
|
||||
|
||||
@ -126,17 +131,76 @@ size_t RimEclipseGeometrySelectionItem::cellIndex() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3st RimEclipseGeometrySelectionItem::cellIJK() const
|
||||
void RimEclipseGeometrySelectionItem::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
cvf::Vec3st IJK( -1, -1, -1 );
|
||||
uiOrdering.add( &m_ijkText );
|
||||
uiOrdering.add( &m_eclipseCase );
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
if ( m_cellIndex != cvf::UNDEFINED_SIZE_T )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimEclipseGeometrySelectionItem::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_eclipseCase )
|
||||
{
|
||||
if ( m_eclipseCase && m_eclipseCase->eclipseCaseData() && m_eclipseCase->eclipseCaseData()->grid( m_gridIndex ) )
|
||||
RimTools::caseOptionItems( &options );
|
||||
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseGeometrySelectionItem::ijkTextFromCell() const
|
||||
{
|
||||
if ( grid() )
|
||||
{
|
||||
if ( auto zeroBased = grid()->ijkFromCellIndex( m_cellIndex ) )
|
||||
{
|
||||
m_eclipseCase->eclipseCaseData()->grid( m_gridIndex )->ijkFromCellIndex( m_cellIndex, &IJK[0], &IJK[1], &IJK[2] );
|
||||
auto oneBased = zeroBased->toOneBased();
|
||||
return QString( "%1 %2 %3" ).arg( oneBased.i() ).arg( oneBased.j() ).arg( oneBased.k() );
|
||||
}
|
||||
}
|
||||
|
||||
return IJK;
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseGeometrySelectionItem::setCellFromIjkText( const QString& text )
|
||||
{
|
||||
auto values = RiaTextStringTools::parseDoubleValues( text );
|
||||
if ( values.size() >= 3 )
|
||||
{
|
||||
int i = values[0] - 1;
|
||||
int j = values[1] - 1;
|
||||
int k = values[2] - 1;
|
||||
|
||||
if ( grid() )
|
||||
{
|
||||
size_t localIndex = grid()->cellIndexFromIJK( i, j, k );
|
||||
m_cellIndex = grid()->reservoirCellIndex( localIndex );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigGridBase* RimEclipseGeometrySelectionItem::grid() const
|
||||
{
|
||||
if ( m_eclipseCase && m_eclipseCase->eclipseCaseData() && m_eclipseCase->eclipseCaseData()->grid( m_gridIndex ) )
|
||||
{
|
||||
return m_eclipseCase->eclipseCaseData()->grid( m_gridIndex );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -18,20 +18,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimGeometrySelectionItem.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimEclipseCase;
|
||||
class RiuEclipseSelectionItem;
|
||||
class RigGridBase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEclipseGeometrySelectionItem : public RimGeometrySelectionItem
|
||||
class RimEclipseGeometrySelectionItem : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -41,17 +41,26 @@ public:
|
||||
|
||||
void setFromSelectionItem( const RiuEclipseSelectionItem* selectionItem );
|
||||
void setFromCaseGridAndIJK( RimEclipseCase* eclipseCase, size_t gridIndex, size_t i, size_t j, size_t k );
|
||||
QString geometrySelectionText() const override;
|
||||
QString geometrySelectionText() const;
|
||||
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
size_t gridIndex() const;
|
||||
size_t cellIndex() const;
|
||||
cvf::Vec3st cellIJK() const;
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
QString ijkTextFromCell() const;
|
||||
void setCellFromIjkText( const QString& text );
|
||||
|
||||
const RigGridBase* grid() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
||||
|
||||
caf::PdmField<size_t> m_gridIndex;
|
||||
caf::PdmField<size_t> m_cellIndex;
|
||||
caf::PdmField<cvf::Vec3d> m_localIntersectionPointInDisplay;
|
||||
caf::PdmProxyValueField<QString> m_ijkText;
|
||||
|
||||
caf::PdmField<size_t> m_gridIndex;
|
||||
caf::PdmField<size_t> m_cellIndex;
|
||||
};
|
||||
|
@ -1,35 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimGeometrySelectionItem.h"
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimGeometrySelectionItem, "GeometrySelectionItem" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeometrySelectionItem::RimGeometrySelectionItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeometrySelectionItem::~RimGeometrySelectionItem()
|
||||
{
|
||||
}
|
@ -26,26 +26,22 @@
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseGeometrySelectionItem.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechGeometrySelectionItem.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuFemTimeHistoryResultAccessor.h"
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
|
||||
#include "qwt_plot.h"
|
||||
#include "RiuPlotCurve.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGridTimeHistoryCurve, "GridTimeHistoryCurve" );
|
||||
|
||||
@ -66,8 +62,11 @@ RimGridTimeHistoryCurve::RimGridTimeHistoryCurve()
|
||||
CAF_PDM_InitFieldNoDefault( &m_geoMechResultDefinition, "GeoMechResultDefinition", "GeoMech Result Definition" );
|
||||
m_geoMechResultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_geometrySelectionItem, "GeometrySelectionItem", "Geometry Selection" );
|
||||
m_geometrySelectionItem.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_eclipseDataSource, "EclipseDataSource", "Eclipse Data Source" );
|
||||
m_eclipseDataSource.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_geoMechDataSource, "GeoMechDataSource", "Geomechanical Data Source" );
|
||||
m_geoMechDataSource.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_plotAxis, "PlotAxis", caf::AppEnum<RiaDefines::PlotAxis>( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ), "Axis" );
|
||||
|
||||
@ -84,49 +83,28 @@ RimGridTimeHistoryCurve::~RimGridTimeHistoryCurve()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::setFromSelectionItem( const RiuSelectionItem* selectionItem )
|
||||
void RimGridTimeHistoryCurve::setFromSelectionItem( const RiuSelectionItem* selectionItem, bool updateResultDefinition )
|
||||
{
|
||||
if ( m_geometrySelectionItem() )
|
||||
if ( const RiuEclipseSelectionItem* eclSelectionItem = dynamic_cast<const RiuEclipseSelectionItem*>( selectionItem ) )
|
||||
{
|
||||
delete m_geometrySelectionItem();
|
||||
}
|
||||
m_eclipseDataSource = new RimEclipseGeometrySelectionItem;
|
||||
m_eclipseDataSource->setFromSelectionItem( eclSelectionItem );
|
||||
|
||||
if ( m_eclipseResultDefinition() )
|
||||
{
|
||||
delete m_eclipseResultDefinition();
|
||||
}
|
||||
|
||||
if ( m_geoMechResultDefinition() )
|
||||
{
|
||||
delete m_geoMechResultDefinition();
|
||||
}
|
||||
|
||||
const RiuEclipseSelectionItem* eclSelectionItem = dynamic_cast<const RiuEclipseSelectionItem*>( selectionItem );
|
||||
if ( eclSelectionItem )
|
||||
{
|
||||
RimEclipseGeometrySelectionItem* geomSelectionItem = new RimEclipseGeometrySelectionItem;
|
||||
m_geometrySelectionItem = geomSelectionItem;
|
||||
|
||||
geomSelectionItem->setFromSelectionItem( eclSelectionItem );
|
||||
|
||||
if ( eclSelectionItem->m_resultDefinition )
|
||||
if ( updateResultDefinition && eclSelectionItem->m_resultDefinition )
|
||||
{
|
||||
m_eclipseResultDefinition = new RimEclipseResultDefinition;
|
||||
if ( !m_eclipseResultDefinition() ) m_eclipseResultDefinition = new RimEclipseResultDefinition;
|
||||
m_eclipseResultDefinition->simpleCopy( eclSelectionItem->m_resultDefinition );
|
||||
}
|
||||
}
|
||||
|
||||
const RiuGeoMechSelectionItem* geoMechSelectionItem = dynamic_cast<const RiuGeoMechSelectionItem*>( selectionItem );
|
||||
if ( geoMechSelectionItem )
|
||||
if ( const RiuGeoMechSelectionItem* geoMechSelectionItem = dynamic_cast<const RiuGeoMechSelectionItem*>( selectionItem ) )
|
||||
{
|
||||
RimGeoMechGeometrySelectionItem* geomSelectionItem = new RimGeoMechGeometrySelectionItem;
|
||||
m_geometrySelectionItem = geomSelectionItem;
|
||||
m_geoMechDataSource = new RimGeoMechGeometrySelectionItem;
|
||||
m_geoMechDataSource->setFromSelectionItem( geoMechSelectionItem );
|
||||
|
||||
geomSelectionItem->setFromSelectionItem( geoMechSelectionItem );
|
||||
|
||||
if ( geoMechSelectionItem->m_resultDefinition )
|
||||
if ( updateResultDefinition && geoMechSelectionItem->m_resultDefinition )
|
||||
{
|
||||
m_geoMechResultDefinition = new RimGeoMechResultDefinition;
|
||||
if ( !m_geoMechResultDefinition ) m_geoMechResultDefinition = new RimGeoMechResultDefinition;
|
||||
m_geoMechResultDefinition->setGeoMechCase( geoMechSelectionItem->m_resultDefinition->geoMechCase() );
|
||||
m_geoMechResultDefinition->setResultAddress( geoMechSelectionItem->m_resultDefinition->resultAddress() );
|
||||
}
|
||||
@ -145,7 +123,6 @@ void RimGridTimeHistoryCurve::setFromEclipseCellAndResult( RimEclipseCase*
|
||||
size_t k,
|
||||
const RigEclipseResultAddress& resAddr )
|
||||
{
|
||||
delete m_geometrySelectionItem();
|
||||
delete m_eclipseResultDefinition();
|
||||
delete m_geoMechResultDefinition();
|
||||
|
||||
@ -153,33 +130,8 @@ void RimGridTimeHistoryCurve::setFromEclipseCellAndResult( RimEclipseCase*
|
||||
m_eclipseResultDefinition->setEclipseCase( eclCase );
|
||||
m_eclipseResultDefinition->setFromEclipseResultAddress( resAddr );
|
||||
|
||||
RimEclipseGeometrySelectionItem* geomSelectionItem = new RimEclipseGeometrySelectionItem;
|
||||
m_geometrySelectionItem = geomSelectionItem;
|
||||
geomSelectionItem->setFromCaseGridAndIJK( eclCase, gridIdx, i, j, k );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigGridCellResultAddress RimGridTimeHistoryCurve::resultAddress()
|
||||
{
|
||||
RimEclipseGeometrySelectionItem* eclipseGeomSelectionItem =
|
||||
dynamic_cast<RimEclipseGeometrySelectionItem*>( m_geometrySelectionItem.value() );
|
||||
|
||||
if ( m_eclipseResultDefinition && eclipseGeomSelectionItem )
|
||||
{
|
||||
cvf::Vec3st IJK = eclipseGeomSelectionItem->cellIJK();
|
||||
|
||||
return RigGridCellResultAddress( eclipseGeomSelectionItem->gridIndex(),
|
||||
IJK[0],
|
||||
IJK[1],
|
||||
IJK[2],
|
||||
m_eclipseResultDefinition->eclipseResultAddress() );
|
||||
}
|
||||
|
||||
// Todo: support geomech stuff
|
||||
|
||||
return RigGridCellResultAddress();
|
||||
m_eclipseDataSource = new RimEclipseGeometrySelectionItem;
|
||||
m_eclipseDataSource->setFromCaseGridAndIJK( eclCase, gridIdx, i, j, k );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -343,6 +295,31 @@ RimCase* RimGridTimeHistoryCurve::gridCase() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::createCurveFromSelectionItem( const RiuSelectionItem* selectionItem, RimSummaryPlot* plot )
|
||||
{
|
||||
if ( !selectionItem || !plot ) return;
|
||||
|
||||
RimGridTimeHistoryCurve* newCurve = new RimGridTimeHistoryCurve();
|
||||
bool updateResultDefinition = true;
|
||||
newCurve->setFromSelectionItem( selectionItem, updateResultDefinition );
|
||||
newCurve->setLineThickness( 2 );
|
||||
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plot->curveCount() );
|
||||
newCurve->setColor( curveColor );
|
||||
|
||||
plot->addGridTimeHistoryCurve( newCurve );
|
||||
|
||||
newCurve->loadDataAndUpdate( true );
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newCurve );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -434,8 +411,7 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
}
|
||||
}
|
||||
|
||||
updateZoomInParentPlot();
|
||||
|
||||
plot->zoomAll();
|
||||
if ( m_parentPlot ) m_parentPlot->replot();
|
||||
|
||||
updateQwtPlotAxis();
|
||||
@ -554,9 +530,10 @@ void RimGridTimeHistoryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUi
|
||||
{
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
uiOrdering.add( &m_geometrySelectionText );
|
||||
caf::PdmUiGroup* dataSource = uiOrdering.addNewGroup( "Data Source" );
|
||||
dataSource->add( &m_geometrySelectionText );
|
||||
eclipseGeomSelectionItem()->uiOrdering( uiConfigName, *dataSource );
|
||||
|
||||
// Fields declared in RimResultDefinition
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup( "Result" );
|
||||
if ( eclipseGeomSelectionItem() )
|
||||
{
|
||||
@ -574,11 +551,14 @@ void RimGridTimeHistoryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUi
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
||||
appearanceGroup->setCollapsedByDefault();
|
||||
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
|
||||
nameGroup->setCollapsedByDefault();
|
||||
nameGroup->add( &m_showLegend );
|
||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -610,6 +590,19 @@ void RimGridTimeHistoryCurve::fieldChangedByUi( const caf::PdmFieldHandle* chang
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField )
|
||||
{
|
||||
if ( m_eclipseDataSource() && m_eclipseResultDefinition() )
|
||||
{
|
||||
m_eclipseResultDefinition->setEclipseCase( m_eclipseDataSource->eclipseCase() );
|
||||
}
|
||||
|
||||
onLoadDataAndUpdate( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -629,9 +622,7 @@ RigMainGrid* RimGridTimeHistoryCurve::mainGrid()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseGeometrySelectionItem* RimGridTimeHistoryCurve::eclipseGeomSelectionItem() const
|
||||
{
|
||||
RimGeometrySelectionItem* pickItem = m_geometrySelectionItem();
|
||||
|
||||
return dynamic_cast<RimEclipseGeometrySelectionItem*>( pickItem );
|
||||
return m_eclipseDataSource();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -639,9 +630,7 @@ RimEclipseGeometrySelectionItem* RimGridTimeHistoryCurve::eclipseGeomSelectionIt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechGeometrySelectionItem* RimGridTimeHistoryCurve::geoMechGeomSelectionItem() const
|
||||
{
|
||||
RimGeometrySelectionItem* pickItem = m_geometrySelectionItem();
|
||||
|
||||
return dynamic_cast<RimGeoMechGeometrySelectionItem*>( pickItem );
|
||||
return m_geoMechDataSource();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -671,9 +660,9 @@ QString RimGridTimeHistoryCurve::geometrySelectionText() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
if ( eclipseGeomSelectionItem() && m_geometrySelectionItem() )
|
||||
if ( eclipseGeomSelectionItem() )
|
||||
{
|
||||
text = m_geometrySelectionItem->geometrySelectionText();
|
||||
text = eclipseGeomSelectionItem()->geometrySelectionText();
|
||||
}
|
||||
else if ( geoMechGeomSelectionItem() )
|
||||
{
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
|
||||
#include <memory>
|
||||
|
||||
class RigMainGrid;
|
||||
@ -34,11 +33,11 @@ class RimEclipseResultDefinition;
|
||||
class RimEclipseGeometrySelectionItem;
|
||||
class RimGeoMechResultDefinition;
|
||||
class RimGeoMechGeometrySelectionItem;
|
||||
class RimGeometrySelectionItem;
|
||||
class RiuFemTimeHistoryResultAccessor;
|
||||
class RiuSelectionItem;
|
||||
class RigEclipseResultAddress;
|
||||
class RimCase;
|
||||
class RimSummaryPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -48,12 +47,11 @@ class RimGridTimeHistoryCurve : public RimPlotCurve
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
public:
|
||||
RimGridTimeHistoryCurve();
|
||||
~RimGridTimeHistoryCurve() override;
|
||||
|
||||
void setFromSelectionItem( const RiuSelectionItem* selectionItem );
|
||||
void setFromSelectionItem( const RiuSelectionItem* selectionItem, bool updateResultDefinition );
|
||||
void setFromEclipseCellAndResult( RimEclipseCase* eclCase, size_t gridIdx, size_t i, size_t j, size_t k, const RigEclipseResultAddress& resAddr );
|
||||
RiuPlotAxis yAxis() const;
|
||||
void setYAxis( RiaDefines::PlotAxis plotAxis );
|
||||
@ -62,12 +60,12 @@ public:
|
||||
std::vector<time_t> timeStepValues() const;
|
||||
std::vector<double> daysSinceSimulationStart() const;
|
||||
|
||||
RigGridCellResultAddress resultAddress();
|
||||
|
||||
QString quantityName() const;
|
||||
QString caseName() const;
|
||||
RimCase* gridCase() const;
|
||||
|
||||
static void createCurveFromSelectionItem( const RiuSelectionItem* selectionItem, RimSummaryPlot* plot );
|
||||
|
||||
protected:
|
||||
QString createCurveAutoName() override;
|
||||
void updateZoomInParentPlot() override;
|
||||
@ -76,6 +74,7 @@ protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void initAfterRead() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
||||
|
||||
private:
|
||||
RigMainGrid* mainGrid();
|
||||
@ -93,6 +92,8 @@ private:
|
||||
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
|
||||
caf::PdmChildField<RimGeoMechResultDefinition*> m_geoMechResultDefinition;
|
||||
|
||||
caf::PdmChildField<RimGeometrySelectionItem*> m_geometrySelectionItem;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::PlotAxis>> m_plotAxis;
|
||||
|
||||
caf::PdmChildField<RimEclipseGeometrySelectionItem*> m_eclipseDataSource;
|
||||
caf::PdmChildField<RimGeoMechGeometrySelectionItem*> m_geoMechDataSource;
|
||||
};
|
||||
|
@ -102,8 +102,8 @@
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RimWellTargetCandidatesGenerator.h"
|
||||
#include "Tools/RimAutomationSettings.h"
|
||||
#include "VerticalFlowPerformance/RimVfpDataCollection.h"
|
||||
#include "VerticalFlowPerformance/RimVfpPlotCollection.h"
|
||||
|
||||
@ -232,6 +232,9 @@ RimProject::RimProject()
|
||||
m_plotTemplateTopFolder = new RimPlotTemplateFolderItem();
|
||||
m_plotTemplateTopFolder.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_automationSettings, "AutomationSettings", "Automation Settings" );
|
||||
m_automationSettings = new RimAutomationSettings();
|
||||
|
||||
// For now, create a default first oilfield that contains the rest of the project
|
||||
oilFields.push_back( new RimOilField );
|
||||
|
||||
@ -365,6 +368,14 @@ RimQuickAccessCollection* RimProject::pinnedFieldCollection() const
|
||||
return m_pinnedFieldCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAutomationSettings* RimProject::automationSettings() const
|
||||
{
|
||||
return m_automationSettings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1416,6 +1427,7 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
statisticsItemCollection->add( m_mainPlotCollection->ensembleFractureStatisticsPlotCollection() );
|
||||
}
|
||||
#endif
|
||||
uiTreeOrdering.add( automationSettings() );
|
||||
}
|
||||
}
|
||||
else if ( uiConfigName == "PlotWindow.DataSources" )
|
||||
|
@ -72,6 +72,7 @@ class RimCompletionTemplateCollection;
|
||||
class RimPlotTemplateFolderItem;
|
||||
class RimGridCalculationCollection;
|
||||
class RimQuickAccessCollection;
|
||||
class RimAutomationSettings;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -192,6 +193,7 @@ public:
|
||||
void updatesAfterProjectFileIsRead();
|
||||
|
||||
RimQuickAccessCollection* pinnedFieldCollection() const;
|
||||
RimAutomationSettings* automationSettings() const;
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
@ -207,6 +209,7 @@ private:
|
||||
private:
|
||||
caf::PdmChildField<RimMainPlotCollection*> m_mainPlotCollection;
|
||||
caf::PdmChildField<RimQuickAccessCollection*> m_pinnedFieldCollection;
|
||||
caf::PdmChildField<RimAutomationSettings*> m_automationSettings;
|
||||
|
||||
caf::PdmField<QString> m_globalPathList;
|
||||
caf::PdmField<QString> m_projectFileVersionString;
|
||||
|
@ -144,10 +144,13 @@ void RimSummaryMultiPlotCollection::summaryPlotItemInfos( QList<caf::PdmOptionIt
|
||||
{
|
||||
for ( RimSummaryMultiPlot* multiPlot : multiPlots() )
|
||||
{
|
||||
auto mainPlotName = multiPlot->description();
|
||||
|
||||
for ( RimSummaryPlot* plot : multiPlot->summaryPlots() )
|
||||
{
|
||||
QString displayName = plot->userDescriptionField()->uiCapability()->uiValue().toString();
|
||||
optionInfos->push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) );
|
||||
QString displayName = mainPlotName + " : ";
|
||||
displayName += plot->userDescriptionField()->uiCapability()->uiValue().toString();
|
||||
optionInfos->push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ QString RimSummaryNameHelper::aggregatedPlotTitle( const RimSummaryNameHelper& o
|
||||
size_t pos = vectorName.find( '_' );
|
||||
if ( pos != std::string::npos )
|
||||
{
|
||||
title += "(" + vectorName + ")";
|
||||
title += QString( " (%1)" ).arg( QString::fromStdString( vectorName ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaVariableMapper.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisTools.h
|
||||
set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaVariableMapper.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAutomationSettings.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaVariableMapper.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisTools.cpp
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaVariableMapper.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAutomationSettings.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimAutomationSettings, "RimAutomationSettings" );
|
||||
|
||||
@ -42,36 +42,24 @@ RimAutomationSettings::RimAutomationSettings()
|
||||
"Cell Selection Destination",
|
||||
"",
|
||||
"Add curves to the selected Summary Plot when clicking on cells in a 3D view." );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_createSummaryPlot, "CreateSummaryPlot", "Create Summary Plot" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_createSummaryPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RimAutomationSettings::cellSelectionDestination() const
|
||||
std::vector<RimSummaryPlot*> RimAutomationSettings::summaryPlots() const
|
||||
{
|
||||
return m_cellSelectionDestination();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAutomationSettings::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_createSummaryPlot )
|
||||
if ( auto summaryPlot = dynamic_cast<RimSummaryPlot*>( m_cellSelectionDestination() ) )
|
||||
{
|
||||
if ( m_createSummaryPlot )
|
||||
{
|
||||
RimSummaryPlot* newPlot = new RimSummaryPlot();
|
||||
RiaSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( newPlot );
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( this );
|
||||
|
||||
m_cellSelectionDestination = newPlot;
|
||||
}
|
||||
return { summaryPlot };
|
||||
}
|
||||
|
||||
if ( auto multiSummaryPlot = dynamic_cast<RimSummaryMultiPlot*>( m_cellSelectionDestination() ) )
|
||||
{
|
||||
return multiSummaryPlot->summaryPlots();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -83,9 +71,6 @@ void RimAutomationSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
||||
|
||||
group->add( &m_cellSelectionDestination );
|
||||
m_cellSelectionDestination.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
// group->add( &m_createSummaryPlot );
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -99,7 +84,19 @@ QList<caf::PdmOptionItemInfo> RimAutomationSettings::calculateValueOptions( cons
|
||||
{
|
||||
if ( auto summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection() )
|
||||
{
|
||||
summaryPlotColl->summaryPlotItemInfos( &options );
|
||||
for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() )
|
||||
{
|
||||
auto mainPlotName = multiPlot->description();
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( mainPlotName, multiPlot, false, multiPlot->uiIconProvider() ) );
|
||||
|
||||
for ( RimSummaryPlot* plot : multiPlot->summaryPlots() )
|
||||
{
|
||||
QString displayName = mainPlotName + " : ";
|
||||
displayName += plot->userDescriptionField()->uiCapability()->uiValue().toString();
|
||||
options.push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
@ -107,17 +104,3 @@ QList<caf::PdmOptionItemInfo> RimAutomationSettings::calculateValueOptions( cons
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAutomationSettings::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_createSummaryPlot )
|
||||
{
|
||||
if ( auto* attr = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) )
|
||||
{
|
||||
attr->m_buttonText = "Create Plot";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
// Copyright (C) 2025 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
|
||||
@ -18,15 +18,30 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimGeometrySelectionItem : public caf::PdmObject
|
||||
class RimPlotWindow;
|
||||
class RimSummaryPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAutomationSettings : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGeometrySelectionItem();
|
||||
~RimGeometrySelectionItem() override;
|
||||
RimAutomationSettings();
|
||||
|
||||
virtual QString geometrySelectionText() const = 0;
|
||||
std::vector<RimSummaryPlot*> summaryPlots() const;
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimPlotWindow*> m_cellSelectionDestination;
|
||||
};
|
@ -246,20 +246,6 @@ std::optional<caf::VecIjk> RigGridBase::ijkFromCellIndex( size_t cellIndex ) con
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::optional<caf::VecIjk> RigGridBase::ijkFromCellIndexOneBased( size_t cellIndex ) const
|
||||
{
|
||||
size_t i, j, k;
|
||||
if ( ijkFromCellIndex( cellIndex, &i, &j, &k ) )
|
||||
{
|
||||
return caf::VecIjk( ++i, ++j, ++k );
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// This version does no if-guarding. Check that all dimensions of the grid are non-zero before using.
|
||||
/// Useful for running in a loop after doing the sanity check once.
|
||||
|
@ -99,7 +99,6 @@ public:
|
||||
virtual void ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const;
|
||||
|
||||
std::optional<caf::VecIjk> ijkFromCellIndex( size_t cellIndex ) const;
|
||||
std::optional<caf::VecIjk> ijkFromCellIndexOneBased( size_t cellIndex ) const;
|
||||
|
||||
bool cellIJKFromCoordinate( const cvf::Vec3d& coord, size_t* i, size_t* j, size_t* k ) const override; // unused
|
||||
void cellMinMaxCordinates( size_t cellIndex, cvf::Vec3d* minCoordinate, cvf::Vec3d* maxCoordinate ) const override; // unused
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "RiuCellSelectionTool.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimEclipseView.h"
|
||||
@ -199,25 +200,6 @@ void RiuCellSelectionTool::validateAndAppend()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QVector<double> RiuCellSelectionTool::parseDoubleValues( const QString& input )
|
||||
{
|
||||
// Flexible regex to extract three double numbers with any surrounding text
|
||||
QRegularExpression coordRegex( R"([-+]?\d+\.?\d*)" );
|
||||
QRegularExpressionMatchIterator it = coordRegex.globalMatch( input );
|
||||
|
||||
QVector<double> coords;
|
||||
while ( it.hasNext() && coords.size() < 3 )
|
||||
{
|
||||
QRegularExpressionMatch match = it.next();
|
||||
coords.append( match.captured().toDouble() );
|
||||
}
|
||||
|
||||
return coords;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -234,7 +216,7 @@ RiuEclipseSelectionItem* RiuCellSelectionTool::createSelectionItemFromInput()
|
||||
|
||||
if ( m_xyzRadio->isChecked() )
|
||||
{
|
||||
QVector<double> coords = parseDoubleValues( m_coordinateEdit->text().trimmed() );
|
||||
QVector<double> coords = RiaTextStringTools::parseDoubleValues( m_coordinateEdit->text().trimmed() );
|
||||
if ( coords.size() < 2 )
|
||||
{
|
||||
return nullptr;
|
||||
@ -274,7 +256,7 @@ RiuEclipseSelectionItem* RiuCellSelectionTool::createSelectionItemFromInput()
|
||||
}
|
||||
else
|
||||
{
|
||||
QVector<double> ijkValues = parseDoubleValues( m_cellEdit->text().trimmed() );
|
||||
QVector<double> ijkValues = RiaTextStringTools::parseDoubleValues( m_cellEdit->text().trimmed() );
|
||||
if ( ijkValues.size() != 3 )
|
||||
{
|
||||
return nullptr;
|
||||
|
@ -52,7 +52,6 @@ private slots:
|
||||
void validateAndAppend();
|
||||
|
||||
private:
|
||||
static QVector<double> parseDoubleValues( const QString& input );
|
||||
RiuEclipseSelectionItem* createSelectionItemFromInput();
|
||||
void updateVisibleUiItems();
|
||||
void setupUI();
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "RiuSelectionChangedHandler.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaResultNames.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
@ -37,7 +38,10 @@
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "Tools/RimAutomationSettings.h"
|
||||
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuDepthQwtPlot.h"
|
||||
@ -125,6 +129,7 @@ void RiuSelectionChangedHandler::handleItemAppended( const RiuSelectionItem* ite
|
||||
if ( mohrsCirclePlot ) mohrsCirclePlot->appendSelection( item );
|
||||
|
||||
updateResultInfo( item );
|
||||
updateGridCellCurvesFromSelection();
|
||||
|
||||
scheduleUpdateForAllVisibleViews();
|
||||
}
|
||||
@ -417,6 +422,80 @@ void RiuSelectionChangedHandler::updateResultInfo( const RiuSelectionItem* itemA
|
||||
mainWnd->setResultInfo( resultInfo );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSelectionChangedHandler::updateGridCellCurvesFromSelection()
|
||||
{
|
||||
std::vector<RiuSelectionItem*> items;
|
||||
Riu3dSelectionManager::instance()->selectedItems( items );
|
||||
if ( items.empty() ) return;
|
||||
|
||||
auto autoSettings = RimProject::current()->automationSettings();
|
||||
for ( auto summaryPlot : autoSettings->summaryPlots() )
|
||||
{
|
||||
// if no curves present, create from selection
|
||||
if ( summaryPlot->gridTimeHistoryCurves().empty() )
|
||||
{
|
||||
for ( auto item : items )
|
||||
{
|
||||
RimGridTimeHistoryCurve::createCurveFromSelectionItem( item, summaryPlot );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// find unique result types like soil, swat
|
||||
// for each result type, create a curve for all cells in selection
|
||||
|
||||
auto curves = summaryPlot->gridTimeHistoryCurves();
|
||||
|
||||
std::map<QString, RimGridTimeHistoryCurve*> uniqueCurves;
|
||||
for ( auto curve : curves )
|
||||
{
|
||||
if ( uniqueCurves.contains( curve->quantityName() ) ) continue;
|
||||
uniqueCurves[curve->quantityName()] = curve;
|
||||
}
|
||||
|
||||
std::vector<RimGridTimeHistoryCurve*> sourceCurves;
|
||||
std::transform( uniqueCurves.begin(),
|
||||
uniqueCurves.end(),
|
||||
std::back_inserter( sourceCurves ),
|
||||
[]( const auto& pair ) { return pair.second; } );
|
||||
|
||||
std::vector<RimGridTimeHistoryCurve*> newCurves;
|
||||
|
||||
for ( auto curve : sourceCurves )
|
||||
{
|
||||
int index = 0;
|
||||
for ( auto item : items )
|
||||
{
|
||||
auto newCurve = curve->copyObject<RimGridTimeHistoryCurve>();
|
||||
bool updateResultDefinition = false;
|
||||
newCurve->setFromSelectionItem( item, updateResultDefinition );
|
||||
|
||||
if ( index != 0 )
|
||||
{
|
||||
cvf::Color3f curveColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f( index );
|
||||
newCurve->setColor( curveColor );
|
||||
}
|
||||
index++;
|
||||
|
||||
newCurves.push_back( newCurve );
|
||||
}
|
||||
}
|
||||
|
||||
summaryPlot->deleteAllGridTimeHistoryCurves();
|
||||
for ( auto c : newCurves )
|
||||
{
|
||||
summaryPlot->addGridTimeHistoryCurve( c );
|
||||
}
|
||||
|
||||
summaryPlot->updateConnectedEditors();
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -47,4 +47,6 @@ private:
|
||||
|
||||
void scheduleUpdateForAllVisibleViews() const;
|
||||
void updateResultInfo( const RiuSelectionItem* itemAdded ) const;
|
||||
|
||||
static void updateGridCellCurvesFromSelection();
|
||||
};
|
||||
|
@ -46,6 +46,22 @@ VecIjk::VecIjk( size_t i, size_t j, size_t k )
|
||||
m_values = { { i, j, k } };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::VecIjk VecIjk::toOneBased() const
|
||||
{
|
||||
return VecIjk( i() + 1, j() + 1, k() + 1 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::VecIjk VecIjk::toZeroBased() const
|
||||
{
|
||||
return VecIjk( i() - 1, j() - 1, k() - 1 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -47,6 +47,9 @@ class VecIjk
|
||||
public:
|
||||
VecIjk( size_t i, size_t j, size_t k );
|
||||
|
||||
VecIjk toOneBased() const;
|
||||
VecIjk toZeroBased() const;
|
||||
|
||||
size_t i() const;
|
||||
size_t j() const;
|
||||
size_t k() const;
|
||||
|
Loading…
Reference in New Issue
Block a user