Mainwindow datasources (#8883)

* Main Window: add three dock widgets for splitting project tree

* Main Window: move scripts to separate tree widget

* Add eclipse result addresses to data source project tree.

* Grid Calculator: drag-and-drop for calculation variables.

* Grid Calculator: rename to 'Grid Property Calculator'.
This commit is contained in:
Kristian Bendiksen
2022-05-11 19:17:46 +02:00
committed by GitHub
parent 65827f9c1c
commit daf02571c2
17 changed files with 449 additions and 23 deletions

View File

@@ -124,6 +124,8 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionBand.h
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -247,6 +249,8 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionBand.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)

View File

@@ -21,7 +21,9 @@
#include "RimEclipseCase.h"
#include "RiaColorTables.h"
#include "RiaDefines.h"
#include "RiaFieldHandleTools.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaQDateTimeTools.h"
@@ -50,6 +52,8 @@
#include "RimEclipseInputPropertyCollection.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseResultAddress.h"
#include "RimEclipseResultAddressCollection.h"
#include "RimEclipseStatisticsCase.h"
#include "RimEclipseView.h"
#include "RimFaultInViewCollection.h"
@@ -119,6 +123,10 @@ RimEclipseCase::RimEclipseCase()
m_inputPropertyCollection = new RimEclipseInputPropertyCollection;
m_inputPropertyCollection->parentField()->uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_resultAddressCollections, "ResultAddressCollections", "Result Addresses" );
m_resultAddressCollections.uiCapability()->setUiHidden( true );
m_resultAddressCollections.xmlCapability()->disableIO();
// Init
m_matrixModelResults = new RimReservoirCellResultsStorage;
@@ -559,27 +567,63 @@ void RimEclipseCase::updateFormationNamesData()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
std::vector<PdmObjectHandle*> children;
reservoirViews.childObjects( &children );
for ( auto child : children )
uiTreeOrdering.add( child );
if ( !m_2dIntersectionViewCollection->views().empty() )
if ( uiConfigName == "MainWindow.ProjectTree" )
{
uiTreeOrdering.add( &m_2dIntersectionViewCollection );
std::vector<PdmObjectHandle*> children;
reservoirViews.childObjects( &children );
for ( auto child : children )
uiTreeOrdering.add( child );
if ( !m_2dIntersectionViewCollection->views().empty() )
{
uiTreeOrdering.add( &m_2dIntersectionViewCollection );
}
if ( !m_contourMapCollection->views().empty() )
{
uiTreeOrdering.add( &m_contourMapCollection );
}
}
if ( !m_contourMapCollection->views().empty() )
else if ( uiConfigName == "MainWindow.DataSources" )
{
uiTreeOrdering.add( &m_contourMapCollection );
if ( m_resultAddressCollections.empty() ) buildChildNodes();
uiTreeOrdering.add( &m_resultAddressCollections );
}
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::buildChildNodes()
{
m_resultAddressCollections.clear();
std::vector<RiaDefines::ResultCatType> resultTypes = { RiaDefines::ResultCatType::STATIC_NATIVE,
RiaDefines::ResultCatType::DYNAMIC_NATIVE,
RiaDefines::ResultCatType::INPUT_PROPERTY,
RiaDefines::ResultCatType::GENERATED };
for ( auto resultType : resultTypes )
{
auto resultAddressCollection = new RimEclipseResultAddressCollection;
resultAddressCollection->setResultType( resultType );
QString name = caf::AppEnum<RiaDefines::ResultCatType>::uiText( resultType );
resultAddressCollection->setName( name );
QStringList resultNames = results( RiaDefines::PorosityModelType::MATRIX_MODEL )->resultNames( resultType );
for ( auto resultName : resultNames )
{
resultAddressCollection->addAddress( resultName, resultType, this );
}
m_resultAddressCollections.push_back( resultAddressCollection );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -50,6 +50,7 @@ class RimEclipseInputPropertyCollection;
class RimEclipseView;
class RimIdenticalGridCaseGroup;
class RimReservoirCellResultsStorage;
class RimEclipseResultAddressCollection;
class RifReaderSettings;
//==================================================================================================
@@ -139,6 +140,7 @@ protected:
private:
void createTimeStepFormatString();
std::vector<Rim3dView*> allSpecialViews() const override;
void buildChildNodes();
protected:
caf::PdmField<bool> m_flipXAxis;
@@ -156,6 +158,8 @@ private:
QString m_timeStepFormatString;
std::map<QString, cvf::Color3f> m_wellToColorMap;
caf::PdmChildArrayField<RimEclipseResultAddressCollection*> m_resultAddressCollections;
caf::PdmChildField<RimReservoirCellResultsStorage*> m_matrixModelResults;
caf::PdmChildField<RimReservoirCellResultsStorage*> m_fractureModelResults;

View File

@@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimEclipseResultAddress.h"
#include "RimEclipseCase.h"
CAF_PDM_SOURCE_INIT( RimEclipseResultAddress, "EclipseResultAddress" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultAddress::RimEclipseResultAddress()
{
CAF_PDM_InitObject( "EclipseResultAddress", ":/DataVector.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_resultName, "ResultName", "Result Name" );
CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" );
CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultAddress::~RimEclipseResultAddress()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultAddress::resultName() const
{
return m_resultName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultAddress::setResultName( const QString& resultName )
{
m_resultName = resultName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultAddress::setResultType( RiaDefines::ResultCatType val )
{
m_resultType = val;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::ResultCatType RimEclipseResultAddress::resultType() const
{
return m_resultType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultAddress::setEclipseCase( RimEclipseCase* eclipseCase )
{
m_eclipseCase = eclipseCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RimEclipseResultAddress::eclipseCase() const
{
return m_eclipseCase;
}

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "RiaDefines.h"
class RimEclipseCase;
class RimEclipseResultAddress : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimEclipseResultAddress();
~RimEclipseResultAddress() override;
void setResultName( const QString& resultName );
QString resultName() const;
void setResultType( RiaDefines::ResultCatType val );
RiaDefines::ResultCatType resultType() const;
void setEclipseCase( RimEclipseCase* eclipseCase );
RimEclipseCase* eclipseCase() const;
private:
caf::PdmField<QString> m_resultName;
caf::PdmField<caf::AppEnum<RiaDefines::ResultCatType>> m_resultType;
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
};

View File

@@ -0,0 +1,87 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimEclipseResultAddressCollection.h"
#include "RimEclipseResultAddress.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT( RimEclipseResultAddressCollection, "RimEclipseResultAddressCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultAddressCollection::RimEclipseResultAddressCollection()
{
CAF_PDM_InitObject( "Folder", ":/Folder.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_adresses, "Addresses", "Addresses" );
m_adresses.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" );
m_resultType.uiCapability()->setUiHidden( true );
nameField()->uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultAddressCollection::~RimEclipseResultAddressCollection()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultAddressCollection::setResultType( RiaDefines::ResultCatType val )
{
m_resultType = val;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultAddressCollection::addAddress( const QString& resultName,
RiaDefines::ResultCatType resultType,
RimEclipseCase* eclipseCase )
{
auto addr = new RimEclipseResultAddress;
addr->setUiName( resultName );
addr->setResultName( resultName );
addr->setResultType( resultType );
addr->setEclipseCase( eclipseCase );
m_adresses.push_back( addr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultAddressCollection::clear()
{
m_adresses.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultAddressCollection::isEmpty() const
{
return m_adresses.empty();
}

View File

@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "RiaDefines.h"
#include "RimNamedObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmPtrField.h"
#include <QString>
class RimEclipseResultAddress;
class RimEclipseCase;
class RimEclipseResultAddressCollection : public RimNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimEclipseResultAddressCollection();
~RimEclipseResultAddressCollection() override;
void setResultType( RiaDefines::ResultCatType val );
void addAddress( const QString& resultName, RiaDefines::ResultCatType resultType, RimEclipseCase* eclipseCase );
bool isEmpty() const;
void clear();
private:
caf::PdmChildArrayField<RimEclipseResultAddress*> m_adresses;
caf::PdmField<caf::AppEnum<RiaDefines::ResultCatType>> m_resultType;
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
};

View File

@@ -23,9 +23,12 @@
#include "RiaPorosityModel.h"
#include "RiaResultNames.h"
#include "RiuDragDrop.h"
#include "RigCaseCellResultsData.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultAddress.h"
#include "RimTools.h"
CAF_PDM_SOURCE_INIT( RimGridCalculationVariable, "RimGridCalculationVariable" );
@@ -179,3 +182,29 @@ int RimGridCalculationVariable::allTimeStepsValue()
{
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCalculationVariable::handleDroppedMimeData( const QMimeData* data,
Qt::DropAction action,
caf::PdmFieldHandle* destinationField )
{
auto objects = RiuDragDrop::convertToObjects( data );
if ( !objects.empty() )
{
auto address = dynamic_cast<RimEclipseResultAddress*>( objects.front() );
if ( address ) setEclipseResultAddress( *address );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCalculationVariable::setEclipseResultAddress( const RimEclipseResultAddress& address )
{
m_resultVariable = address.resultName();
m_resultType = address.resultType();
m_eclipseCase = address.eclipseCase();
updateConnectedEditors();
}

View File

@@ -22,13 +22,12 @@
#include "RiaDefines.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
#include "cafPdmPtrField.h"
class RimEclipseCase;
class RimEclipseResultAddress;
class RigCaseCellResultsData;
//==================================================================================================
@@ -51,6 +50,10 @@ public:
static int allTimeStepsValue();
void handleDroppedMimeData( const QMimeData* data, Qt::DropAction action, caf::PdmFieldHandle* destinationField ) override;
void setEclipseResultAddress( const RimEclipseResultAddress& address );
private:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;

View File

@@ -1457,10 +1457,18 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
}
}
}
else if ( uiConfigName == "PlotWindow.Scripts" )
else if ( uiConfigName == "PlotWindow.Scripts" || uiConfigName == "MainWindow.Scripts" )
{
uiTreeOrdering.add( scriptCollection() );
}
else if ( uiConfigName == "MainWindow.DataSources" )
{
RimOilField* oilField = activeOilField();
if ( oilField )
{
if ( oilField->analysisModels() ) uiTreeOrdering.add( oilField->analysisModels() );
}
}
else
{
if ( viewLinkerCollection()->viewLinker() )
@@ -1483,7 +1491,6 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
}
uiTreeOrdering.add( colorLegendCollection() );
uiTreeOrdering.add( scriptCollection() );
}
uiTreeOrdering.skipRemainingChildren( true );