mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Thermal Fracture: Add action to import Reveal csv
This commit is contained in:
parent
ffb0c5a03f
commit
cb0bc1392d
@ -9,6 +9,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSimWellFractureAtPosFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSimWellFractureAtPosFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSimWellFractureFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSimWellFractureFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanFractureTemplateFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanFractureTemplateFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicNewThermalFractureTemplateFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureAtPosFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureAtPosFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanModelFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanModelFeature.h
|
||||||
@ -33,6 +34,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSimWellFractureAtPosFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSimWellFractureAtPosFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSimWellFractureFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSimWellFractureFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanFractureTemplateFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanFractureTemplateFeature.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicNewThermalFractureTemplateFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureAtPosFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureAtPosFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanModelFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanModelFeature.cpp
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class RimFracture;
|
||||||
|
class RimFractureTemplate;
|
||||||
|
class RimThermalFractureTemplate;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
template <class T>
|
||||||
|
class RicMeshFractureTemplateHelper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void createNewTemplateForFractureAndUpdate( RimFracture* fracture,
|
||||||
|
const QString& title,
|
||||||
|
const QString& lastUsedDialogFallback,
|
||||||
|
const QString& fileFilter,
|
||||||
|
const QString& defaultTemplateName );
|
||||||
|
|
||||||
|
static void selectFractureTemplateAndUpdate( RimFractureTemplate* fractureTemplate );
|
||||||
|
static std::vector<T*> createNewTemplatesFromFiles( const std::vector<QString>& fileNames,
|
||||||
|
const QString& defaultTemplateName,
|
||||||
|
bool reuseExistingTemplatesWithMatchingNames = false );
|
||||||
|
static std::vector<T*> createNewTemplates( const QString& title,
|
||||||
|
const QString& lastUsedDialogFallback,
|
||||||
|
const QString& fileFilter,
|
||||||
|
const QString& defaultTemplateName );
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "RicMeshFractureTemplateHelper.inl"
|
@ -0,0 +1,157 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RimEclipseView.h"
|
||||||
|
#include "RimFractureTemplateCollection.h"
|
||||||
|
#include "RimOilField.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimThermalFractureTemplate.h"
|
||||||
|
#include "RimWellPathFracture.h"
|
||||||
|
|
||||||
|
#include "Riu3DMainWindowTools.h"
|
||||||
|
#include "RiuFileDialogTools.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
template <class T>
|
||||||
|
void RicMeshFractureTemplateHelper<T>::createNewTemplateForFractureAndUpdate( RimFracture* fracture,
|
||||||
|
const QString& title,
|
||||||
|
const QString& lastUsedDialogFallback,
|
||||||
|
const QString& fileFilter,
|
||||||
|
const QString& defaultTemplateName )
|
||||||
|
{
|
||||||
|
std::vector<T*> newTemplates = createNewTemplates( title, lastUsedDialogFallback, fileFilter, defaultTemplateName );
|
||||||
|
if ( !newTemplates.empty() )
|
||||||
|
{
|
||||||
|
T* lastTemplateCreated = newTemplates.back();
|
||||||
|
fracture->setFractureTemplate( lastTemplateCreated );
|
||||||
|
|
||||||
|
selectFractureTemplateAndUpdate( lastTemplateCreated );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
template <class T>
|
||||||
|
void RicMeshFractureTemplateHelper<T>::selectFractureTemplateAndUpdate( RimFractureTemplate* fractureTemplate )
|
||||||
|
{
|
||||||
|
fractureTemplate->loadDataAndUpdate();
|
||||||
|
|
||||||
|
RimFractureTemplateCollection* templateCollection = nullptr;
|
||||||
|
fractureTemplate->firstAncestorOrThisOfTypeAsserted( templateCollection );
|
||||||
|
templateCollection->updateConnectedEditors();
|
||||||
|
|
||||||
|
RimProject* project = RimProject::current();
|
||||||
|
|
||||||
|
project->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||||
|
Riu3DMainWindowTools::selectAsCurrentItem( fractureTemplate );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
template <class T>
|
||||||
|
std::vector<T*> RicMeshFractureTemplateHelper<T>::createNewTemplates( const QString& title,
|
||||||
|
const QString& lastUsedDialogFallback,
|
||||||
|
const QString& fileFilter,
|
||||||
|
const QString& defaultTemplateName )
|
||||||
|
{
|
||||||
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
QString defaultDir = app->lastUsedDialogDirectoryWithFallbackToProjectFolder( lastUsedDialogFallback );
|
||||||
|
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr, title, defaultDir, fileFilter );
|
||||||
|
|
||||||
|
auto templates =
|
||||||
|
createNewTemplatesFromFiles( std::vector<QString>( fileNames.begin(), fileNames.end() ), defaultTemplateName );
|
||||||
|
|
||||||
|
if ( !fileNames.isEmpty() )
|
||||||
|
{
|
||||||
|
app->setLastUsedDialogDirectory( lastUsedDialogFallback, QFileInfo( fileNames.last() ).absolutePath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return templates;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
template <class T>
|
||||||
|
std::vector<T*> RicMeshFractureTemplateHelper<T>::createNewTemplatesFromFiles( const std::vector<QString>& fileNames,
|
||||||
|
const QString& defaultTemplateName,
|
||||||
|
bool reuseExistingTemplatesWithMatchingNames )
|
||||||
|
{
|
||||||
|
if ( fileNames.empty() ) return std::vector<T*>();
|
||||||
|
|
||||||
|
RimProject* project = RimProject::current();
|
||||||
|
CVF_ASSERT( project );
|
||||||
|
|
||||||
|
RimOilField* oilfield = project->activeOilField();
|
||||||
|
if ( oilfield == nullptr ) return std::vector<T*>();
|
||||||
|
|
||||||
|
RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection();
|
||||||
|
if ( !fracDefColl ) return std::vector<T*>();
|
||||||
|
|
||||||
|
auto findTemplateByName = []( RimFractureTemplateCollection* coll, const QString& name ) -> T* {
|
||||||
|
for ( auto t : coll->fractureTemplates() )
|
||||||
|
if ( t->name() == name ) return dynamic_cast<T*>( t );
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<T*> newFractures;
|
||||||
|
for ( auto fileName : fileNames )
|
||||||
|
{
|
||||||
|
if ( fileName.isEmpty() ) continue;
|
||||||
|
|
||||||
|
QFileInfo stimplanfileFileInfo( fileName );
|
||||||
|
QString name = stimplanfileFileInfo.baseName();
|
||||||
|
if ( name.isEmpty() )
|
||||||
|
{
|
||||||
|
name = defaultTemplateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
T* fractureDef = nullptr;
|
||||||
|
if ( reuseExistingTemplatesWithMatchingNames ) fractureDef = findTemplateByName( fracDefColl, name );
|
||||||
|
|
||||||
|
if ( fractureDef == nullptr )
|
||||||
|
{
|
||||||
|
fractureDef = new T();
|
||||||
|
fracDefColl->addFractureTemplate( fractureDef );
|
||||||
|
fractureDef->setName( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
fractureDef->setFileName( fileName );
|
||||||
|
fractureDef->loadDataAndUpdate();
|
||||||
|
fractureDef->setDefaultsBasedOnFile();
|
||||||
|
fractureDef->setDefaultWellDiameterFromUnit();
|
||||||
|
newFractures.push_back( fractureDef );
|
||||||
|
}
|
||||||
|
|
||||||
|
return newFractures;
|
||||||
|
}
|
@ -19,24 +19,10 @@
|
|||||||
|
|
||||||
#include "RicNewStimPlanFractureTemplateFeature.h"
|
#include "RicNewStimPlanFractureTemplateFeature.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RicMeshFractureTemplateHelper.h"
|
||||||
|
|
||||||
#include "RimEclipseView.h"
|
|
||||||
#include "RimFractureTemplateCollection.h"
|
|
||||||
#include "RimOilField.h"
|
|
||||||
#include "RimProject.h"
|
|
||||||
#include "RimStimPlanFractureTemplate.h"
|
#include "RimStimPlanFractureTemplate.h"
|
||||||
#include "RimWellPathFracture.h"
|
|
||||||
|
|
||||||
#include "Riu3DMainWindowTools.h"
|
|
||||||
#include "RiuFileDialogTools.h"
|
|
||||||
|
|
||||||
#include "cafSelectionManager.h"
|
|
||||||
|
|
||||||
#include "cvfAssert.h"
|
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT( RicNewStimPlanFractureTemplateFeature, "RicNewStimPlanFractureTemplateFeature" );
|
CAF_CMD_SOURCE_INIT( RicNewStimPlanFractureTemplateFeature, "RicNewStimPlanFractureTemplateFeature" );
|
||||||
@ -46,14 +32,11 @@ CAF_CMD_SOURCE_INIT( RicNewStimPlanFractureTemplateFeature, "RicNewStimPlanFract
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicNewStimPlanFractureTemplateFeature::createNewTemplateForFractureAndUpdate( RimFracture* fracture )
|
void RicNewStimPlanFractureTemplateFeature::createNewTemplateForFractureAndUpdate( RimFracture* fracture )
|
||||||
{
|
{
|
||||||
std::vector<RimStimPlanFractureTemplate*> newTemplates = createNewTemplates();
|
RicMeshFractureTemplateHelper<RimStimPlanFractureTemplate>::createNewTemplateForFractureAndUpdate( fracture,
|
||||||
if ( !newTemplates.empty() )
|
title(),
|
||||||
{
|
lastUsedDialogFallback(),
|
||||||
RimStimPlanFractureTemplate* lastTemplateCreated = newTemplates.back();
|
fileFilter(),
|
||||||
fracture->setFractureTemplate( lastTemplateCreated );
|
defaultTemplateName() );
|
||||||
|
|
||||||
selectFractureTemplateAndUpdate( lastTemplateCreated );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -61,16 +44,7 @@ void RicNewStimPlanFractureTemplateFeature::createNewTemplateForFractureAndUpdat
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicNewStimPlanFractureTemplateFeature::selectFractureTemplateAndUpdate( RimFractureTemplate* fractureTemplate )
|
void RicNewStimPlanFractureTemplateFeature::selectFractureTemplateAndUpdate( RimFractureTemplate* fractureTemplate )
|
||||||
{
|
{
|
||||||
fractureTemplate->loadDataAndUpdate();
|
RicMeshFractureTemplateHelper<RimStimPlanFractureTemplate>::selectFractureTemplateAndUpdate( fractureTemplate );
|
||||||
|
|
||||||
RimFractureTemplateCollection* templateCollection = nullptr;
|
|
||||||
fractureTemplate->firstAncestorOrThisOfTypeAsserted( templateCollection );
|
|
||||||
templateCollection->updateConnectedEditors();
|
|
||||||
|
|
||||||
RimProject* project = RimProject::current();
|
|
||||||
|
|
||||||
project->scheduleCreateDisplayModelAndRedrawAllViews();
|
|
||||||
Riu3DMainWindowTools::selectAsCurrentItem( fractureTemplate );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -78,21 +52,10 @@ void RicNewStimPlanFractureTemplateFeature::selectFractureTemplateAndUpdate( Rim
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimStimPlanFractureTemplate*> RicNewStimPlanFractureTemplateFeature::createNewTemplates()
|
std::vector<RimStimPlanFractureTemplate*> RicNewStimPlanFractureTemplateFeature::createNewTemplates()
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
return RicMeshFractureTemplateHelper<RimStimPlanFractureTemplate>::createNewTemplates( title(),
|
||||||
QString defaultDir = app->lastUsedDialogDirectoryWithFallbackToProjectFolder( "STIMPLAN_XML_DIR" );
|
lastUsedDialogFallback(),
|
||||||
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr,
|
fileFilter(),
|
||||||
"Open StimPlan XML File",
|
defaultTemplateName() );
|
||||||
defaultDir,
|
|
||||||
"StimPlan XML File (*.xml);;All files(*.*)" );
|
|
||||||
|
|
||||||
auto templates = createNewTemplatesFromFiles( std::vector<QString>( fileNames.begin(), fileNames.end() ) );
|
|
||||||
|
|
||||||
if ( !fileNames.isEmpty() )
|
|
||||||
{
|
|
||||||
app->setLastUsedDialogDirectory( "STIMPLAN_XML_DIR", QFileInfo( fileNames.last() ).absolutePath() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return templates;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -102,55 +65,9 @@ std::vector<RimStimPlanFractureTemplate*>
|
|||||||
RicNewStimPlanFractureTemplateFeature::createNewTemplatesFromFiles( const std::vector<QString>& fileNames,
|
RicNewStimPlanFractureTemplateFeature::createNewTemplatesFromFiles( const std::vector<QString>& fileNames,
|
||||||
bool reuseExistingTemplatesWithMatchingNames )
|
bool reuseExistingTemplatesWithMatchingNames )
|
||||||
{
|
{
|
||||||
if ( fileNames.empty() ) return std::vector<RimStimPlanFractureTemplate*>();
|
return RicMeshFractureTemplateHelper<RimStimPlanFractureTemplate>::createNewTemplatesFromFiles( fileNames,
|
||||||
|
defaultTemplateName(),
|
||||||
RimProject* project = RimProject::current();
|
reuseExistingTemplatesWithMatchingNames );
|
||||||
CVF_ASSERT( project );
|
|
||||||
|
|
||||||
RimOilField* oilfield = project->activeOilField();
|
|
||||||
if ( oilfield == nullptr ) return std::vector<RimStimPlanFractureTemplate*>();
|
|
||||||
|
|
||||||
RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection();
|
|
||||||
if ( !fracDefColl ) return std::vector<RimStimPlanFractureTemplate*>();
|
|
||||||
|
|
||||||
auto findTemplateByName = []( RimFractureTemplateCollection* coll,
|
|
||||||
const QString& name ) -> RimStimPlanFractureTemplate* {
|
|
||||||
for ( auto t : coll->fractureTemplates() )
|
|
||||||
if ( t->name() == name ) return dynamic_cast<RimStimPlanFractureTemplate*>( t );
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<RimStimPlanFractureTemplate*> newFractures;
|
|
||||||
for ( auto fileName : fileNames )
|
|
||||||
{
|
|
||||||
if ( fileName.isEmpty() ) continue;
|
|
||||||
|
|
||||||
QFileInfo stimplanfileFileInfo( fileName );
|
|
||||||
QString name = stimplanfileFileInfo.baseName();
|
|
||||||
if ( name.isEmpty() )
|
|
||||||
{
|
|
||||||
name = "StimPlan Fracture Template";
|
|
||||||
}
|
|
||||||
|
|
||||||
RimStimPlanFractureTemplate* fractureDef = nullptr;
|
|
||||||
if ( reuseExistingTemplatesWithMatchingNames ) fractureDef = findTemplateByName( fracDefColl, name );
|
|
||||||
|
|
||||||
if ( fractureDef == nullptr )
|
|
||||||
{
|
|
||||||
fractureDef = new RimStimPlanFractureTemplate();
|
|
||||||
fracDefColl->addFractureTemplate( fractureDef );
|
|
||||||
fractureDef->setName( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
fractureDef->setFileName( fileName );
|
|
||||||
fractureDef->loadDataAndUpdate();
|
|
||||||
fractureDef->setDefaultsBasedOnFile();
|
|
||||||
fractureDef->setDefaultWellDiameterFromUnit();
|
|
||||||
newFractures.push_back( fractureDef );
|
|
||||||
}
|
|
||||||
|
|
||||||
return newFractures;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -181,3 +98,35 @@ bool RicNewStimPlanFractureTemplateFeature::isCommandEnabled()
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RicNewStimPlanFractureTemplateFeature::fileFilter()
|
||||||
|
{
|
||||||
|
return "StimPlan XML File (*.xml);;All files(*.*)";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RicNewStimPlanFractureTemplateFeature::title()
|
||||||
|
{
|
||||||
|
return "Open StimPlan XML File";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RicNewStimPlanFractureTemplateFeature::lastUsedDialogFallback()
|
||||||
|
{
|
||||||
|
return "STIMPLAN_XML_DIR";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RicNewStimPlanFractureTemplateFeature::defaultTemplateName()
|
||||||
|
{
|
||||||
|
return "StimPlan Fracture Template";
|
||||||
|
}
|
||||||
|
@ -44,4 +44,9 @@ protected:
|
|||||||
void onActionTriggered( bool isChecked ) override;
|
void onActionTriggered( bool isChecked ) override;
|
||||||
void setupActionLook( QAction* actionToSetup ) override;
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
bool isCommandEnabled() override;
|
bool isCommandEnabled() override;
|
||||||
|
|
||||||
|
static QString fileFilter();
|
||||||
|
static QString title();
|
||||||
|
static QString defaultTemplateName();
|
||||||
|
static QString lastUsedDialogFallback();
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,131 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RicNewThermalFractureTemplateFeature.h"
|
||||||
|
|
||||||
|
#include "RicMeshFractureTemplateHelper.h"
|
||||||
|
|
||||||
|
#include "RimThermalFractureTemplate.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT( RicNewThermalFractureTemplateFeature, "RicNewThermalFractureTemplateFeature" );
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewThermalFractureTemplateFeature::createNewTemplateForFractureAndUpdate( RimFracture* fracture )
|
||||||
|
{
|
||||||
|
RicMeshFractureTemplateHelper<RimThermalFractureTemplate>::createNewTemplateForFractureAndUpdate( fracture,
|
||||||
|
title(),
|
||||||
|
lastUsedDialogFallback(),
|
||||||
|
fileFilter(),
|
||||||
|
defaultTemplateName() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewThermalFractureTemplateFeature::selectFractureTemplateAndUpdate( RimFractureTemplate* fractureTemplate )
|
||||||
|
{
|
||||||
|
RicMeshFractureTemplateHelper<RimThermalFractureTemplate>::selectFractureTemplateAndUpdate( fractureTemplate );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimThermalFractureTemplate*> RicNewThermalFractureTemplateFeature::createNewTemplates()
|
||||||
|
{
|
||||||
|
return RicMeshFractureTemplateHelper<RimThermalFractureTemplate>::createNewTemplates( title(),
|
||||||
|
lastUsedDialogFallback(),
|
||||||
|
fileFilter(),
|
||||||
|
defaultTemplateName() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimThermalFractureTemplate*>
|
||||||
|
RicNewThermalFractureTemplateFeature::createNewTemplatesFromFiles( const std::vector<QString>& fileNames,
|
||||||
|
bool reuseExistingTemplatesWithMatchingNames )
|
||||||
|
{
|
||||||
|
return RicMeshFractureTemplateHelper<RimThermalFractureTemplate>::createNewTemplatesFromFiles( fileNames,
|
||||||
|
defaultTemplateName(),
|
||||||
|
reuseExistingTemplatesWithMatchingNames );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewThermalFractureTemplateFeature::onActionTriggered( bool isChecked )
|
||||||
|
{
|
||||||
|
std::vector<RimThermalFractureTemplate*> newFractures = createNewTemplates();
|
||||||
|
if ( !newFractures.empty() )
|
||||||
|
{
|
||||||
|
selectFractureTemplateAndUpdate( newFractures.back() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewThermalFractureTemplateFeature::setupActionLook( QAction* actionToSetup )
|
||||||
|
{
|
||||||
|
actionToSetup->setIcon( QIcon( ":/FractureTemplate16x16.png" ) );
|
||||||
|
actionToSetup->setText( "New Thermal Fracture Template" );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicNewThermalFractureTemplateFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
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";
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class RimFracture;
|
||||||
|
class RimFractureTemplate;
|
||||||
|
class RimThermalFractureTemplate;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicNewThermalFractureTemplateFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
static void createNewTemplateForFractureAndUpdate( RimFracture* fracture );
|
||||||
|
static void selectFractureTemplateAndUpdate( RimFractureTemplate* fractureTemplate );
|
||||||
|
static std::vector<RimThermalFractureTemplate*>
|
||||||
|
createNewTemplatesFromFiles( const std::vector<QString>& fileNames,
|
||||||
|
bool reuseExistingTemplatesWithMatchingNames = false );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static std::vector<RimThermalFractureTemplate*> createNewTemplates();
|
||||||
|
void onActionTriggered( bool isChecked ) override;
|
||||||
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
bool isCommandEnabled() override;
|
||||||
|
|
||||||
|
static QString fileFilter();
|
||||||
|
static QString title();
|
||||||
|
static QString defaultTemplateName();
|
||||||
|
static QString lastUsedDialogFallback();
|
||||||
|
};
|
@ -954,6 +954,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
menuBuilder.addSeparator();
|
menuBuilder.addSeparator();
|
||||||
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
||||||
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
||||||
|
menuBuilder << "RicNewThermalFractureTemplateFeature";
|
||||||
menuBuilder << "Separator";
|
menuBuilder << "Separator";
|
||||||
menuBuilder << "RicConvertAllFractureTemplatesToMetricFeature";
|
menuBuilder << "RicConvertAllFractureTemplatesToMetricFeature";
|
||||||
menuBuilder << "RicConvertAllFractureTemplatesToFieldFeature";
|
menuBuilder << "RicConvertAllFractureTemplatesToFieldFeature";
|
||||||
@ -965,6 +966,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
menuBuilder.addSeparator();
|
menuBuilder.addSeparator();
|
||||||
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
||||||
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
||||||
|
menuBuilder << "RicNewThermalFractureTemplateFeature";
|
||||||
menuBuilder << "Separator";
|
menuBuilder << "Separator";
|
||||||
menuBuilder << "RicConvertFractureTemplateUnitFeature";
|
menuBuilder << "RicConvertFractureTemplateUnitFeature";
|
||||||
}
|
}
|
||||||
@ -975,6 +977,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
menuBuilder.addSeparator();
|
menuBuilder.addSeparator();
|
||||||
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
||||||
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
||||||
|
menuBuilder << "RicNewThermalFractureTemplateFeature";
|
||||||
menuBuilder << "Separator";
|
menuBuilder << "Separator";
|
||||||
menuBuilder << "RicConvertFractureTemplateUnitFeature";
|
menuBuilder << "RicConvertFractureTemplateUnitFeature";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user