#5116 Hide unneccessary tree elements for well measurements.

This commit is contained in:
Kristian Bendiksen 2020-01-10 10:00:08 +01:00
parent 391046c4fa
commit d09cae0e55
4 changed files with 36 additions and 4 deletions

View File

@ -22,7 +22,6 @@
#include "RimWellMeasurement.h"
#include "RimWellMeasurementFilePath.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmUiTableViewEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
@ -42,7 +41,7 @@ RimWellMeasurementCollection::RimWellMeasurementCollection()
m_measurements.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_importedFiles, "ImportedFiles", "Imported Files", "", "", "" );
m_importedFiles.uiCapability()->setUiTreeHidden( false );
m_importedFiles.uiCapability()->setUiTreeHidden( true );
this->setName( "Well Measurements" );
}
@ -81,6 +80,14 @@ std::vector<RimWellMeasurement*> RimWellMeasurementCollection::measurements() co
return attrs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellMeasurementCollection::isEmpty() const
{
return m_measurements.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -160,7 +167,10 @@ void RimWellMeasurementCollection::defineUiOrdering( QString uiConfigName, caf::
void RimWellMeasurementCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
QString uiConfigName /*= ""*/ )
{
uiTreeOrdering.add( &m_importedFiles );
if ( !m_importedFiles.empty() )
{
uiTreeOrdering.add( &m_importedFiles );
}
uiTreeOrdering.skipRemainingChildren( true );
}

View File

@ -45,6 +45,7 @@ public:
void appendMeasurement( RimWellMeasurement* measurement );
void deleteMeasurement( RimWellMeasurement* measurementToDelete );
void deleteAllMeasurements();
bool isEmpty() const;
std::set<QString> importedFiles() const;

View File

@ -47,6 +47,7 @@
#include "RifWellPathImporter.h"
#include "cafPdmUiEditorHandle.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafProgressInfo.h"
#include <QFile>
@ -432,6 +433,24 @@ void RimWellPathCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
advancedGroup->add( &wellPathClipZDistance );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
{
if ( !wellPaths.empty() )
{
uiTreeOrdering.add( &wellPaths );
}
if ( !m_wellMeasurements->isEmpty() )
{
uiTreeOrdering.add( &m_wellMeasurements );
}
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -121,7 +121,9 @@ protected:
const QVariant& newValue ) override;
private:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
caf::PdmFieldHandle* objectToggleField() override;
void readAndAddWellPaths( std::vector<RimFileWellPath*>& wellPathArray );