2020-06-12 11:38:20 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2020- 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 "RicExportFractureModelPlotToFileFeature.h"
|
|
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
2020-08-25 11:39:32 +02:00
|
|
|
#include "RimFractureModel.h"
|
2020-06-12 11:38:20 +02:00
|
|
|
#include "RimFractureModelPlot.h"
|
|
|
|
|
|
2020-09-04 10:23:19 +02:00
|
|
|
#include "RiuFileDialogTools.h"
|
|
|
|
|
|
2020-06-12 11:38:20 +02:00
|
|
|
#include "RifFractureModelPlotExporter.h"
|
|
|
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
#include "cafUtils.h"
|
|
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT( RicExportFractureModelPlotToFileFeature, "RicExportFractureModelPlotToFileFeature" );
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
bool RicExportFractureModelPlotToFileFeature::isCommandEnabled()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RicExportFractureModelPlotToFileFeature::onActionTriggered( bool isChecked )
|
|
|
|
|
{
|
|
|
|
|
RimFractureModelPlot* fractureModelPlot =
|
|
|
|
|
caf::SelectionManager::instance()->selectedItemOfType<RimFractureModelPlot>();
|
|
|
|
|
if ( !fractureModelPlot ) return;
|
|
|
|
|
|
|
|
|
|
RiaApplication* app = RiaApplication::instance();
|
|
|
|
|
QString defaultDir = app->lastUsedDialogDirectory( "FRACTURE_MODEL_PLOT" );
|
|
|
|
|
|
2020-09-04 10:23:19 +02:00
|
|
|
QString directoryPath =
|
|
|
|
|
RiuFileDialogTools::getExistingDirectory( nullptr, "Select Directory for Fracture Model Plot Export", defaultDir );
|
2020-06-12 11:38:20 +02:00
|
|
|
|
2020-09-04 10:23:19 +02:00
|
|
|
if ( directoryPath.isEmpty() ) return;
|
2020-06-12 11:38:20 +02:00
|
|
|
|
2020-09-04 10:23:19 +02:00
|
|
|
RifFractureModelPlotExporter::writeToDirectory( fractureModelPlot,
|
|
|
|
|
fractureModelPlot->fractureModel()->useDetailedFluidLoss(),
|
|
|
|
|
directoryPath );
|
2020-06-12 11:38:20 +02:00
|
|
|
|
|
|
|
|
// Remember the path to next time
|
2020-09-04 10:23:19 +02:00
|
|
|
app->setLastUsedDialogDirectory( "FRACTURE_MODEL_PLOT", directoryPath );
|
2020-06-12 11:38:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RicExportFractureModelPlotToFileFeature::setupActionLook( QAction* actionToSetup )
|
|
|
|
|
{
|
2020-07-10 09:26:30 +02:00
|
|
|
actionToSetup->setText( "Export Fracture Model to File" );
|
2020-09-08 10:31:23 +02:00
|
|
|
actionToSetup->setIcon( QIcon( ":/Save24x24.png" ) );
|
2020-06-12 11:38:20 +02:00
|
|
|
}
|