#5019 Intersections have first data source as ianctive default

Icon state update for IResDefCollection
This commit is contained in:
Jacob Støren 2019-11-12 14:00:30 +01:00
parent fec449dc43
commit 62ed71ed76
7 changed files with 139 additions and 33 deletions

View File

@ -161,6 +161,14 @@ RimIntersectionCollection* RimGridView::crossSectionCollection() const
return m_crossSectionCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionResultsDefinitionCollection* RimGridView::separateIntersectionResultsCollection() const
{
return m_intersectionResultDefCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -45,15 +45,14 @@ public:
cvf::ref<cvf::UByteArray> currentTotalCellVisibility();
RimIntersectionCollection* crossSectionCollection() const;
RimIntersectionCollection* crossSectionCollection() const;
RimIntersectionResultsDefinitionCollection* separateIntersectionResultsCollection() const;
RimAnnotationInViewCollection* annotationCollection() const;
virtual const RimPropertyFilterCollection* propertyFilterCollection() const = 0;
void rangeFiltersUpdated();
RimCellRangeFilterCollection* rangeFilterCollection();
const RimCellRangeFilterCollection* rangeFilterCollection() const;
RimAnnotationInViewCollection* annotationCollection() const;
void rangeFiltersUpdated();
RimCellRangeFilterCollection* rangeFilterCollection();
const RimCellRangeFilterCollection* rangeFilterCollection() const;
bool hasOverridenRangeFilterCollection();
void setOverrideRangeFilterCollection( RimCellRangeFilterCollection* rfc );
@ -71,24 +70,22 @@ public:
bool forceChange = false ) override;
protected:
virtual void updateViewFollowingRangeFilterUpdates();
void initAfterRead() override;
void onClearReservoirCellVisibilitiesIfNeccessary() override;
virtual void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStep ) = 0;
void selectOverlayInfoConfig() override;
virtual void updateViewFollowingRangeFilterUpdates();
void onClearReservoirCellVisibilitiesIfNeccessary() override;
virtual void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStep ) = 0;
void selectOverlayInfoConfig() override;
RimGridCollection* gridCollection() const;
void clearReservoirCellVisibilities();
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
RimGridCollection* gridCollection() const;
void clearReservoirCellVisibilities();
void initAfterRead() override;
protected: // Fields
caf::PdmChildField<RimIntersectionCollection*> m_crossSectionCollection;
caf::PdmChildField<RimIntersectionCollection*> m_crossSectionCollection;
caf::PdmChildField<RimIntersectionResultsDefinitionCollection*> m_intersectionResultDefCollection;
caf::PdmChildField<RimIntersectionResultsDefinitionCollection*> m_intersectionResultDefCollection;
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
caf::PdmChildField<RimCellRangeFilterCollection*> m_rangeFilterCollection;

View File

@ -45,6 +45,9 @@
#include "cafPdmUiPushButtonEditor.h"
#include "Rim2dIntersectionView.h"
#include "RimGridView.h"
#include "RimIntersectionResultDefinition.h"
#include "RimIntersectionResultsDefinitionCollection.h"
#include "cvfBoundingBox.h"
#include "cvfGeometryTools.h"
#include "cvfPlane.h"
@ -134,6 +137,8 @@ RimIntersection::RimIntersection()
caf::PdmUiPushButtonEditor::configureEditorForField( &inputTwoAzimuthPointsFromViewerEnabled );
inputTwoAzimuthPointsFromViewerEnabled = false;
CAF_PDM_InitFieldNoDefault( &m_separateDataSource, "SeparateIntersectionDataSource", "Source", "", "", "" );
uiCapability()->setUiTreeChildrenHidden( true );
}
@ -286,6 +291,17 @@ void RimIntersection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
m_extentLength.uiCapability()->setUiReadOnly( false );
}
QString inactiveText;
if (!this->activeSeparateResultDefinition())
{
inactiveText = " (Inactive)";
}
caf::PdmUiGroup* separateResultsGroup = uiOrdering.addNewGroup( "Separate Data Source Reference" + inactiveText );
separateResultsGroup->setCollapsedByDefault(true);
separateResultsGroup->add(&m_separateDataSource);
m_separateDataSource.uiCapability()->setUiName("Source" + inactiveText);
updateWellExtentDefaultValue();
uiOrdering.skipRemainingFields( true );
@ -340,9 +356,52 @@ QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions( const caf:
options.push_back( caf::PdmOptionItemInfo( QString::number( bIdx + 1 ), QVariant::fromValue( bIdx ) ) );
}
}
else if ( fieldNeedingOptions == &m_separateDataSource )
{
RimGridView* view;
this->firstAncestorOrThisOfTypeAsserted( view );
std::vector<RimIntersectionResultDefinition*> iResDefs =
view->separateIntersectionResultsCollection()->intersectionResultsDefinitions();
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
for ( auto iresdef : iResDefs )
{
options.push_back( caf::PdmOptionItemInfo( iresdef->autoName(), iresdef ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersection::initAfterRead()
{
updateDefaultSeparateDataSource();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersection::updateDefaultSeparateDataSource()
{
if ( m_separateDataSource() == nullptr )
{
RimGridView* view;
this->firstAncestorOrThisOfTypeAsserted( view );
std::vector<RimIntersectionResultDefinition*> iResDefs =
view->separateIntersectionResultsCollection()->intersectionResultsDefinitions();
if ( iResDefs.size() )
{
m_separateDataSource = iResDefs[0];
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -752,6 +811,25 @@ void RimIntersection::appendPointToPolyLine( const cvf::Vec3d& point )
rebuildGeometryAndScheduleCreateDisplayModel();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionResultDefinition* RimIntersection::activeSeparateResultDefinition()
{
updateDefaultSeparateDataSource();
if (!m_separateDataSource) return nullptr;
if (!m_separateDataSource->isActive()) return nullptr;
RimGridView* view;
this->firstAncestorOrThisOfTypeAsserted( view );
if (!view->separateIntersectionResultsCollection()->isActive()) return nullptr;
return m_separateDataSource;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -30,6 +30,7 @@
class RimWellPath;
class RivIntersectionPartMgr;
class RimIntersectionResultDefinition;
class RimSimWellInView;
class RimSimWellInViewCollection;
class Rim2dIntersectionView;
@ -86,6 +87,8 @@ public:
std::vector<std::vector<cvf::Vec3d>> polyLines( cvf::Vec3d* flattenedPolylineStartPoint = nullptr ) const;
void appendPointToPolyLine( const cvf::Vec3d& point );
RimIntersectionResultDefinition* activeSeparateResultDefinition();
Rim2dIntersectionView* correspondingIntersectionView();
RivIntersectionPartMgr* intersectionPartMgr();
void rebuildGeometry();
@ -108,22 +111,19 @@ public:
void rebuildGeometryAndScheduleCreateDisplayModel();
protected:
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
virtual void initAfterRead() override;
private:
private:
caf::PdmField<int> m_branchIndex;
caf::PdmField<double> m_extentLength;
@ -136,6 +136,8 @@ private:
caf::PdmField<std::vector<cvf::Vec3d>> m_customExtrusionPoints;
caf::PdmField<std::vector<cvf::Vec3d>> m_twoAzimuthPoints;
caf::PdmPtrField<RimIntersectionResultDefinition*> m_separateDataSource;
static void setPushButtonText( bool buttonEnable, caf::PdmUiPushButtonEditorAttribute* attribute );
static void setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute );
@ -146,6 +148,7 @@ private:
void addExtents( std::vector<cvf::Vec3d>& polyLine ) const;
void updateName();
static double azimuthInRadians( cvf::Vec3d vec );
void updateDefaultSeparateDataSource();
private:
cvf::ref<RivIntersectionPartMgr> m_crossSectionPartMgr;

View File

@ -89,7 +89,7 @@ bool RimIntersectionResultDefinition::isActive()
QString RimIntersectionResultDefinition::autoName() const
{
QString timestepName;
QString caseName;
QString caseName = "Default undefined source";
if ( m_case )
{
@ -115,7 +115,7 @@ QString RimIntersectionResultDefinition::autoName() const
m_geomResultDefinition->resultComponentUiName();
}
return caseName + " " + resultVarUiName + " " + timestepName;
return resultVarUiName + " " + timestepName + " " + caseName;
}
//--------------------------------------------------------------------------------------------------

View File

@ -51,6 +51,14 @@ bool RimIntersectionResultsDefinitionCollection::isActive()
return m_isActive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimIntersectionResultDefinition*> RimIntersectionResultsDefinitionCollection::intersectionResultsDefinitions()
{
return m_intersectionResultsDefs.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -66,4 +74,13 @@ void RimIntersectionResultsDefinitionCollection::fieldChangedByUi( const caf::Pd
const QVariant& oldValue,
const QVariant& newValue )
{
this->updateUiIconFromToggleField();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionResultsDefinitionCollection::initAfterRead()
{
this->updateUiIconFromToggleField();
}

View File

@ -34,11 +34,14 @@ public:
bool isActive();
std::vector<RimIntersectionResultDefinition*> intersectionResultsDefinitions();
protected:
caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
virtual void initAfterRead() override;
private:
caf::PdmField<bool> m_isActive;