Add button to import element properties for GeoMechCase.

This commit is contained in:
Kristian Bendiksen 2020-04-03 10:31:41 +02:00
parent 0d0ecf42fa
commit 1fde4a09b5
4 changed files with 38 additions and 2 deletions

View File

@ -43,6 +43,14 @@ bool RicImportElementPropertyFeature::isCommandEnabled()
///
//--------------------------------------------------------------------------------------------------
void RicImportElementPropertyFeature::onActionTriggered( bool isChecked )
{
importElementProperties();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportElementPropertyFeature::importElementProperties()
{
RiaApplication* app = RiaApplication::instance();

View File

@ -27,6 +27,8 @@ class RicImportElementPropertyFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
static void importElementProperties();
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;

View File

@ -23,6 +23,7 @@
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RicImportElementPropertyFeature.h"
#include "RicfCommandObject.h"
#include "RifOdbReader.h"
@ -49,6 +50,7 @@
#include "RimTools.h"
#include "RimWellLogPlotCollection.h"
#include "cafCmdFeatureManager.h"
#include "cafPdmFieldIOScriptability.h"
#include "cafPdmObjectScriptability.h"
#include "cafPdmUiDoubleValueEditor.h"
@ -121,6 +123,9 @@ RimGeoMechCase::RimGeoMechCase( void )
"" );
m_elementPropertyFileNameIndexUiSelection.xmlCapability()->disableIO();
CAF_PDM_InitField( &m_importElementPropertyFileCommand, "importElementPropertyFileCommad", false, "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_importElementPropertyFileCommand );
CAF_PDM_InitField( &m_closeElementPropertyFileCommand, "closeElementPropertyFileCommad", false, "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_closeElementPropertyFileCommand );
@ -746,6 +751,12 @@ void RimGeoMechCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
closeSelectedElementPropertyFiles();
updateConnectedEditors();
}
else if ( changedField == &m_importElementPropertyFileCommand )
{
m_importElementPropertyFileCommand = false;
importElementPropertyFile();
updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------
@ -923,6 +934,14 @@ void RimGeoMechCase::reloadSelectedElementPropertyFiles()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechCase::importElementPropertyFile()
{
RicImportElementPropertyFeature::importElementProperties();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -939,6 +958,7 @@ void RimGeoMechCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* elmPropGroup = uiOrdering.addNewGroup( "Element Properties" );
elmPropGroup->add( &m_elementPropertyFileNameIndexUiSelection );
elmPropGroup->add( &m_importElementPropertyFileCommand );
elmPropGroup->add( &m_reloadElementPropertyFileCommand );
elmPropGroup->add( &m_closeElementPropertyFileCommand );
@ -961,13 +981,17 @@ void RimGeoMechCase::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_importElementPropertyFileCommand )
{
dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute )->m_buttonText = "Import Element Property";
}
if ( field == &m_reloadElementPropertyFileCommand )
{
dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute )->m_buttonText = "Reload Case(s)";
dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute )->m_buttonText = "Reload Element Property";
}
if ( field == &m_closeElementPropertyFileCommand )
{
dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute )->m_buttonText = "Close Case(s)";
dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute )->m_buttonText = "Close Element Property";
}
if ( field == &m_biotFixedCoefficient )

View File

@ -119,6 +119,7 @@ private:
void initAfterRead() override;
static QString subStringOfDigits( const QString& timeStepString, int numberOfDigitsToFind );
void importElementPropertyFile();
void closeSelectedElementPropertyFiles();
void reloadSelectedElementPropertyFiles();
std::vector<Rim3dView*> allSpecialViews() const override;
@ -131,6 +132,7 @@ private:
caf::PdmField<double> m_frictionAngleDeg;
caf::PdmField<std::vector<caf::FilePath>> m_elementPropertyFileNames;
caf::PdmField<std::vector<int>> m_elementPropertyFileNameIndexUiSelection;
caf::PdmField<bool> m_importElementPropertyFileCommand;
caf::PdmField<bool> m_closeElementPropertyFileCommand;
caf::PdmField<bool> m_reloadElementPropertyFileCommand;