///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RicNewThermalFractureTemplateFeature.h" #include "RicMeshFractureTemplateHelper.h" #include "RimThermalFractureTemplate.h" #include CAF_CMD_SOURCE_INIT( RicNewThermalFractureTemplateFeature, "RicNewThermalFractureTemplateFeature" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewThermalFractureTemplateFeature::createNewTemplateForFractureAndUpdate( RimFracture* fracture ) { RicMeshFractureTemplateHelper::createNewTemplateForFractureAndUpdate( fracture, title(), lastUsedDialogFallback(), fileFilter(), defaultTemplateName() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewThermalFractureTemplateFeature::selectFractureTemplateAndUpdate( RimFractureTemplate* fractureTemplate ) { RicMeshFractureTemplateHelper::selectFractureTemplateAndUpdate( fractureTemplate ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RicNewThermalFractureTemplateFeature::createNewTemplates() { return RicMeshFractureTemplateHelper::createNewTemplates( title(), lastUsedDialogFallback(), fileFilter(), defaultTemplateName() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RicNewThermalFractureTemplateFeature::createNewTemplatesFromFiles( const std::vector& fileNames, bool reuseExistingTemplatesWithMatchingNames ) { return RicMeshFractureTemplateHelper::createNewTemplatesFromFiles( fileNames, defaultTemplateName(), reuseExistingTemplatesWithMatchingNames ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewThermalFractureTemplateFeature::onActionTriggered( bool isChecked ) { std::vector newFractures = createNewTemplates(); if ( !newFractures.empty() ) { selectFractureTemplateAndUpdate( newFractures.back() ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewThermalFractureTemplateFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setIcon( QIcon( ":/FractureTemplate16x16.png" ) ); actionToSetup->setText( "New Thermal Fracture Template" ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString RicNewThermalFractureTemplateFeature::fileFilter() { return "Reveal Open-Server Files (*.csv);;All files (*.*)"; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString RicNewThermalFractureTemplateFeature::title() { return "Open Thermal Fracture File"; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString RicNewThermalFractureTemplateFeature::lastUsedDialogFallback() { return "REVEAL_CSV_DIR"; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString RicNewThermalFractureTemplateFeature::defaultTemplateName() { return "Thermal Fracture Template"; }