#5019 Add separate intersection results collection and items

This commit is contained in:
Jacob Støren 2019-11-12 11:51:50 +01:00
parent f6126497e7
commit fec449dc43
11 changed files with 444 additions and 0 deletions

View File

@ -89,6 +89,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogWbsCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimIntersection.h
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultDefinition.h
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultsDefinitionCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimContextCommandBuilder.h
${CMAKE_CURRENT_LIST_DIR}/RimGridCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotCurve.h
@ -231,6 +233,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogWbsCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimIntersection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultDefinition.cpp
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultsDefinitionCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimContextCommandBuilder.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotCurve.cpp

View File

@ -60,6 +60,7 @@
#include "cafPdmUiToolButtonEditor.h"
#include "cafPdmUiTreeSelectionEditor.h"
#include "cafUtils.h"
#include "RimIntersectionResultDefinition.h"
namespace caf
{
@ -442,6 +443,13 @@ void RimEclipseResultDefinition::updateAnyFieldHasChanged()
cellColors->updateConnectedEditors();
}
RimIntersectionResultDefinition* intersectResDef = nullptr;
this->firstAncestorOrThisOfType( intersectResDef );
if ( intersectResDef )
{
intersectResDef->updateConnectedEditors();
}
RimGridCrossPlotDataSet* crossPlotCurveSet = nullptr;
this->firstAncestorOrThisOfType( crossPlotCurveSet );
if ( crossPlotCurveSet )

View File

@ -1714,6 +1714,7 @@ void RimEclipseView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
uiTreeOrdering.add( cellResult() );
uiTreeOrdering.add( cellEdgeResult() );
uiTreeOrdering.add( faultResultSettings() );
uiTreeOrdering.add( &m_intersectionResultDefCollection );
uiTreeOrdering.add( wellCollection() );
{

View File

@ -74,6 +74,7 @@ protected:
virtual void updateLegendCategorySettings(){};
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
friend class RimIntersectionResultDefinition;
private:
// Overridden PDM methods

View File

@ -946,6 +946,7 @@ void RimGeoMechView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
uiTreeOrdering.add( cellResult() );
uiTreeOrdering.add( m_tensorResults() );
uiTreeOrdering.add( &m_intersectionResultDefCollection );
uiTreeOrdering.add( m_crossSectionCollection() );

View File

@ -25,6 +25,7 @@
#include "RimCellRangeFilterCollection.h"
#include "RimGridCollection.h"
#include "RimIntersectionCollection.h"
#include "RimIntersectionResultsDefinitionCollection.h"
#include "RimProject.h"
#include "RimPropertyFilterCollection.h"
#include "RimTextAnnotation.h"
@ -65,6 +66,15 @@ RimGridView::RimGridView()
m_crossSectionCollection.uiCapability()->setUiHidden( true );
m_crossSectionCollection = new RimIntersectionCollection();
CAF_PDM_InitFieldNoDefault( &m_intersectionResultDefCollection,
"IntersectionResultDefColl",
"Separate Intersection Results",
"",
"",
"" );
m_intersectionResultDefCollection.uiCapability()->setUiTreeHidden( true );
m_intersectionResultDefCollection = new RimIntersectionResultsDefinitionCollection;
CAF_PDM_InitFieldNoDefault( &m_gridCollection, "GridCollection", "GridCollection", "", "", "" );
m_gridCollection.uiCapability()->setUiHidden( true );
m_gridCollection = new RimGridCollection();

View File

@ -26,6 +26,7 @@ class RimAnnotationInViewCollection;
class RimEclipseContourMapProjection;
class Rim3dOverlayInfoConfig;
class RimIntersectionCollection;
class RimIntersectionResultsDefinitionCollection;
class RimPropertyFilterCollection;
class RimGridCollection;
class RimCellRangeFilterCollection;
@ -86,6 +87,9 @@ protected:
protected: // Fields
caf::PdmChildField<RimIntersectionCollection*> m_crossSectionCollection;
caf::PdmChildField<RimIntersectionResultsDefinitionCollection*> m_intersectionResultDefCollection;
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
caf::PdmChildField<RimCellRangeFilterCollection*> m_rangeFilterCollection;
caf::PdmChildField<RimCellRangeFilterCollection*> m_overrideRangeFilterCollection;

View File

@ -0,0 +1,231 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimIntersectionResultDefinition.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimRegularLegendConfig.h"
#include "RimTernaryLegendConfig.h"
#include "RimTools.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT( RimIntersectionResultDefinition, "IntersectionResultDefinition" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionResultDefinition::RimIntersectionResultDefinition()
{
CAF_PDM_InitObject( "Intersection Result Definition", "", "", "" );
CAF_PDM_InitField( &m_isActive, "IsActive", true, "Active", "", "", "" );
m_isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" );
CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_autoName, "IntersectionResultDefinitionDescription", "Description", "", "", "" );
m_autoName.registerGetMethod( this, &RimIntersectionResultDefinition::autoName );
m_autoName.uiCapability()->setUiHidden( true );
m_autoName.uiCapability()->setUiReadOnly( true );
m_autoName.xmlCapability()->setIOWritable( false );
CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "EclipseResultDef", "EclipseResultDef", "", "", "" );
m_eclipseResultDefinition.uiCapability()->setUiHidden( true );
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
m_eclipseResultDefinition = new RimEclipseResultDefinition;
CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "GeoMechResultDef", "GeoMechResultDef", "", "", "" );
m_geomResultDefinition.uiCapability()->setUiHidden( true );
m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
m_geomResultDefinition = new RimGeoMechResultDefinition;
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "Legend", "", "", "" );
m_legendConfig.uiCapability()->setUiHidden( true );
m_legendConfig.uiCapability()->setUiTreeChildrenHidden( false );
m_legendConfig = new RimRegularLegendConfig;
CAF_PDM_InitFieldNoDefault( &m_ternaryLegendConfig, "TernaryLegendConfig", "Legend", "", "", "" );
m_ternaryLegendConfig.uiCapability()->setUiHidden( true );
m_ternaryLegendConfig.uiCapability()->setUiTreeChildrenHidden( false );
m_ternaryLegendConfig = new RimTernaryLegendConfig;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionResultDefinition::~RimIntersectionResultDefinition() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimIntersectionResultDefinition::isActive()
{
return m_isActive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimIntersectionResultDefinition::autoName() const
{
QString timestepName;
QString caseName;
if ( m_case )
{
QStringList timestepNames = m_case->timeStepStrings();
if ( timestepNames.size() > m_timeStep() )
{
timestepName = timestepNames[m_timeStep()];
}
caseName = m_case->caseUserDescription();
}
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QString resultVarUiName;
if ( eclipseCase )
{
resultVarUiName = m_eclipseResultDefinition->resultVariableUiName();
}
else if ( geomCase )
{
resultVarUiName = m_geomResultDefinition->resultFieldUiName() + ":" +
m_geomResultDefinition->resultComponentUiName();
}
return caseName + " " + resultVarUiName + " " + timestepName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersectionResultDefinition::userDescriptionField()
{
return &m_autoName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersectionResultDefinition::objectToggleField()
{
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_case )
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
m_geomResultDefinition->setGeoMechCase( geomCase );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
}
this->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
RimIntersectionResultDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_case )
{
RimTools::caseOptionItems( &options );
}
else if ( fieldNeedingOptions == &m_timeStep )
{
QStringList timeStepNames;
if ( m_case )
{
timeStepNames = m_case->timeStepStrings();
}
for ( int i = 0; i < timeStepNames.size(); i++ )
{
options.push_back( caf::PdmOptionItemInfo( timeStepNames[i], i ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionResultDefinition::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_case );
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
if ( eclipseCase )
{
m_eclipseResultDefinition->uiOrdering( uiConfigName, uiOrdering );
}
else if ( geomCase )
{
m_geomResultDefinition->uiOrdering( uiConfigName, uiOrdering );
}
if ( ( eclipseCase && m_eclipseResultDefinition->hasDynamicResult() ) || geomCase )
{
uiOrdering.add( &m_timeStep );
}
uiOrdering.skipRemainingFields();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionResultDefinition::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
QString uiConfigName /*= ""*/ )
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
if ( !geomCase && m_eclipseResultDefinition->resultVariable() == RiaDefines::ternarySaturationResultName() )
{
uiTreeOrdering.add( m_ternaryLegendConfig() );
}
else
{
uiTreeOrdering.add( m_legendConfig() );
}
uiTreeOrdering.skipRemainingChildren( true );
}

View File

@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
#include "cafPdmPtrField.h"
class RimEclipseResultDefinition;
class RimGeoMechResultDefinition;
class RimCase;
class RimRegularLegendConfig;
class RimTernaryLegendConfig;
class RimIntersectionResultDefinition : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimIntersectionResultDefinition();
~RimIntersectionResultDefinition() override;
bool isActive();
QString autoName() const;
protected:
virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
virtual void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
private:
caf::PdmField<bool> m_isActive;
caf::PdmProxyValueField<QString> m_autoName;
caf::PdmPtrField<RimCase*> m_case;
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
caf::PdmChildField<RimGeoMechResultDefinition*> m_geomResultDefinition;
caf::PdmField<int> m_timeStep;
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
caf::PdmChildField<RimTernaryLegendConfig*> m_ternaryLegendConfig;
};

View File

@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimIntersectionResultsDefinitionCollection.h"
#include "RimIntersectionResultDefinition.h"
CAF_PDM_SOURCE_INIT( RimIntersectionResultsDefinitionCollection, "RimIntersectionResultsDefinitionCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionResultsDefinitionCollection::RimIntersectionResultsDefinitionCollection()
{
CAF_PDM_InitObject( "Separate Intersection Results", ":/CrossSections16x16.png", "", "" );
CAF_PDM_InitField( &m_isActive, "isActive", false, "Active", "", "", "" );
m_isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_intersectionResultsDefs, "IntersectionResultDefinitions", "Data Sources", "", "", "" );
m_intersectionResultsDefs.uiCapability()->setUiTreeHidden( true );
m_intersectionResultsDefs.push_back( new RimIntersectionResultDefinition ); // Add the default result definition
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionResultsDefinitionCollection::~RimIntersectionResultsDefinitionCollection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimIntersectionResultsDefinitionCollection::isActive()
{
return m_isActive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersectionResultsDefinitionCollection::objectToggleField()
{
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionResultsDefinitionCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
}

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
class RimIntersectionResultDefinition;
class RimIntersectionResultsDefinitionCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimIntersectionResultsDefinitionCollection();
~RimIntersectionResultsDefinitionCollection() override;
bool isActive();
protected:
caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
private:
caf::PdmField<bool> m_isActive;
caf::PdmChildArrayField<RimIntersectionResultDefinition*> m_intersectionResultsDefs;
};