mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 05:37:21 -05:00
#14426 Remember last used export folder when exporting surface to IRAP/GRI
The export folder was only applied to the dialog when a single regular surface was selected. Always seed the folder from the last used EXPORT_SURFACE directory by splitting setDefaults() into setExportFolder() and setGridDefaults(). A single non-regular surface now also falls into the bounding box estimation branch instead of keeping the 10x10 field defaults.
This commit is contained in:
@@ -92,13 +92,18 @@ void RicExportSurfaceToGriFeature::exportSurfaces( const std::vector<RimSurface*
|
||||
|
||||
// Build default grid params
|
||||
RicExportSurfaceToGriUi ui;
|
||||
ui.setExportFolder( defaultDir );
|
||||
|
||||
if ( surfaces.size() == 1 )
|
||||
RimRegularSurface* regularSurface = ( surfaces.size() == 1 ) ? dynamic_cast<RimRegularSurface*>( surfaces[0] ) : nullptr;
|
||||
|
||||
if ( regularSurface )
|
||||
{
|
||||
if ( auto* reg = dynamic_cast<RimRegularSurface*>( surfaces[0] ) )
|
||||
{
|
||||
ui.setDefaults( defaultDir, reg->nx(), reg->ny(), reg->originX(), reg->originY(), reg->incrementX(), reg->incrementY() );
|
||||
}
|
||||
ui.setGridDefaults( regularSurface->nx(),
|
||||
regularSurface->ny(),
|
||||
regularSurface->originX(),
|
||||
regularSurface->originY(),
|
||||
regularSurface->incrementX(),
|
||||
regularSurface->incrementY() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -119,7 +124,7 @@ void RicExportSurfaceToGriFeature::exportSurfaces( const std::vector<RimSurface*
|
||||
const double spacing = ( areaApprox > 0.0 ) ? std::sqrt( areaApprox / static_cast<double>( totalVertexCount ) ) : 1.0;
|
||||
const int nx = std::max( 2, static_cast<int>( std::ceil( bb.extent().x() / spacing ) ) + 1 );
|
||||
const int ny = std::max( 2, static_cast<int>( std::ceil( bb.extent().y() / spacing ) ) + 1 );
|
||||
ui.setDefaults( defaultDir, nx, ny, bb.min().x(), bb.min().y(), spacing, spacing );
|
||||
ui.setGridDefaults( nx, ny, bb.min().x(), bb.min().y(), spacing, spacing );
|
||||
}
|
||||
|
||||
caf::PdmUiPropertyViewDialog dialog( nullptr, &ui, "Export Surface to IRAP/GRI", "" );
|
||||
|
||||
@@ -58,15 +58,22 @@ RicExportSurfaceToGriUi::RicExportSurfaceToGriUi()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportSurfaceToGriUi::setDefaults( const QString& exportFolder, int nx, int ny, double originX, double originY, double incrementX, double incrementY )
|
||||
void RicExportSurfaceToGriUi::setExportFolder( const QString& exportFolder )
|
||||
{
|
||||
m_exportFolder = exportFolder;
|
||||
m_nx = nx;
|
||||
m_ny = ny;
|
||||
m_originX = std::round( originX );
|
||||
m_originY = std::round( originY );
|
||||
m_incrementX = std::round( incrementX );
|
||||
m_incrementY = std::round( incrementY );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportSurfaceToGriUi::setGridDefaults( int nx, int ny, double originX, double originY, double incrementX, double incrementY )
|
||||
{
|
||||
m_nx = nx;
|
||||
m_ny = ny;
|
||||
m_originX = std::round( originX );
|
||||
m_originY = std::round( originY );
|
||||
m_incrementX = std::round( incrementX );
|
||||
m_incrementY = std::round( incrementY );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -40,7 +40,8 @@ public:
|
||||
|
||||
RicExportSurfaceToGriUi();
|
||||
|
||||
void setDefaults( const QString& exportFolder, int nx, int ny, double originX, double originY, double incrementX, double incrementY );
|
||||
void setExportFolder( const QString& exportFolder );
|
||||
void setGridDefaults( int nx, int ny, double originX, double originY, double incrementX, double incrementY );
|
||||
|
||||
RigRegularSurfaceData gridParams() const;
|
||||
QString exportFolder() const;
|
||||
|
||||
Reference in New Issue
Block a user