mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix problem with black background in snapshot export
This commit is contained in:
parent
3fc7378b8f
commit
a58d854030
@ -81,11 +81,12 @@ RicfCommandResponse RicfExportWellLogPlotData::execute()
|
||||
{
|
||||
std::vector<RimWellLogPlot*> plots;
|
||||
RiaApplication::instance()->project()->descendantsIncludingThisOfType( plots );
|
||||
RicfExportWellLogPlotDataResult* result = new RicfExportWellLogPlotDataResult;
|
||||
|
||||
for ( RimWellLogPlot* plot : plots )
|
||||
{
|
||||
if ( plot->id() == m_viewId() )
|
||||
{
|
||||
RicfExportWellLogPlotDataResult* result = new RicfExportWellLogPlotDataResult;
|
||||
if ( m_format() == ASCII )
|
||||
{
|
||||
QString validFileName =
|
||||
@ -106,16 +107,22 @@ RicfCommandResponse RicfExportWellLogPlotData::execute()
|
||||
plot,
|
||||
m_exportTvdRkb(),
|
||||
m_capitalizeFileNames(),
|
||||
true,
|
||||
m_resampleInterval() );
|
||||
result->exportedFiles.v() = exportedFiles;
|
||||
}
|
||||
response.setResult( result );
|
||||
if ( result->exportedFiles().empty() )
|
||||
{
|
||||
errorMessages << "No files exported";
|
||||
if ( exportedFiles.empty() )
|
||||
{
|
||||
errorMessages << QString( "No files exported for '%1'" ).arg( plot->description() );
|
||||
}
|
||||
else
|
||||
{
|
||||
result->exportedFiles.v().insert( result->exportedFiles.v().end(),
|
||||
exportedFiles.begin(),
|
||||
exportedFiles.end() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
response.setResult( result );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -48,6 +48,7 @@ std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString&
|
||||
const RimWellLogPlot* plotWindow,
|
||||
bool exportTvdRkb,
|
||||
bool capitalizeFileNames,
|
||||
bool alwaysOverwrite,
|
||||
double resampleInterval )
|
||||
{
|
||||
std::vector<RimWellLogCurve*> allCurves;
|
||||
@ -75,6 +76,7 @@ std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString&
|
||||
wellNames,
|
||||
rkbDiffs,
|
||||
capitalizeFileNames,
|
||||
alwaysOverwrite,
|
||||
resampleInterval );
|
||||
}
|
||||
}
|
||||
@ -88,6 +90,7 @@ std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString&
|
||||
const std::vector<QString>& wellNames,
|
||||
const std::vector<double>& rkbDiffs,
|
||||
bool capitalizeFileNames,
|
||||
bool alwaysOverwrite,
|
||||
double resampleInterval )
|
||||
{
|
||||
RigLasFileExporter lasExporter( curves );
|
||||
@ -104,7 +107,7 @@ std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString&
|
||||
lasExporter.setRkbDiffs( wellNames, rkbDiffs );
|
||||
}
|
||||
|
||||
writtenFiles = lasExporter.writeToFolder( exportFolder, filePrefix, capitalizeFileNames );
|
||||
writtenFiles = lasExporter.writeToFolder( exportFolder, filePrefix, capitalizeFileNames, alwaysOverwrite );
|
||||
|
||||
// Remember the path to next time
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory( "WELL_LOGS_DIR", exportFolder );
|
||||
@ -186,6 +189,7 @@ void RicExportToLasFileFeature::onActionTriggered( bool isChecked )
|
||||
wellNames,
|
||||
rkbDiffs,
|
||||
featureUi.capitalizeFileName,
|
||||
false,
|
||||
resampleInterval );
|
||||
}
|
||||
}
|
||||
|
@ -39,17 +39,19 @@ public:
|
||||
static std::vector<QString> exportToLasFiles( const QString& exportFolder,
|
||||
const QString& filePrefix,
|
||||
const RimWellLogPlot* plotWindow,
|
||||
bool exportTvdRkb = false,
|
||||
bool capitalizeFileNames = false,
|
||||
double resampleInterval = 0.0 );
|
||||
bool exportTvdRkb,
|
||||
bool capitalizeFileNames,
|
||||
bool alwaysOverwrite,
|
||||
double resampleInterval );
|
||||
|
||||
static std::vector<QString> exportToLasFiles( const QString& exportFolder,
|
||||
const QString& filePrefix,
|
||||
std::vector<RimWellLogCurve*> curves,
|
||||
const std::vector<QString>& wellNames = std::vector<QString>(),
|
||||
const std::vector<double>& rkbDiffs = std::vector<double>(),
|
||||
bool capitalizeFileNames = false,
|
||||
double resampleInterval = 0.0 );
|
||||
const std::vector<QString>& wellNames,
|
||||
const std::vector<double>& rkbDiffs,
|
||||
bool capitalizeFileNames,
|
||||
bool alwaysOverwrite,
|
||||
double resampleInterval );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
@ -42,7 +42,7 @@ class Plot(PdmObject):
|
||||
|
||||
Returns:
|
||||
A list of files exported
|
||||
"""
|
||||
"""
|
||||
res = self._execute_command(exportWellLogPlotData=Cmd.ExportWellLogPlotDataRequest(exportFormat='LAS',
|
||||
viewId=self.view_id,
|
||||
exportFolder=export_folder,
|
||||
|
@ -157,7 +157,9 @@ class Project(PdmObject):
|
||||
pdm_objects = self.descendants("RimPlotWindow")
|
||||
plot_list = []
|
||||
for pdm_object in pdm_objects:
|
||||
plot_list.append(Plot(pdm_object))
|
||||
plot = Plot(pdm_object)
|
||||
if plot.view_id != -1:
|
||||
plot_list.append(plot)
|
||||
return plot_list
|
||||
|
||||
def plot(self, view_id):
|
||||
|
@ -1040,6 +1040,8 @@ void RimWellPltPlot::initAfterRead()
|
||||
{
|
||||
RimWellLogPlot& wellLogPlot = dynamic_cast<RimWellLogPlot&>( *this );
|
||||
wellLogPlot = std::move( *m_wellLogPlot_OBSOLETE.value() );
|
||||
delete m_wellLogPlot_OBSOLETE;
|
||||
m_wellLogPlot_OBSOLETE = nullptr;
|
||||
}
|
||||
|
||||
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
|
||||
|
@ -1107,6 +1107,8 @@ void RimWellRftPlot::initAfterRead()
|
||||
{
|
||||
RimWellLogPlot& wellLogPlot = dynamic_cast<RimWellLogPlot&>( *this );
|
||||
wellLogPlot = std::move( *m_wellLogPlot_OBSOLETE.value() );
|
||||
delete m_wellLogPlot_OBSOLETE;
|
||||
m_wellLogPlot_OBSOLETE = nullptr;
|
||||
}
|
||||
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
|
||||
{
|
||||
|
@ -215,7 +215,6 @@ public:
|
||||
}
|
||||
else if ( firstCurveData->depthUnit() == RiaDefines::UNIT_NONE )
|
||||
{
|
||||
CVF_ASSERT( false );
|
||||
lasFile->AddLog( "DEPTH",
|
||||
"",
|
||||
"Depth in Connection number",
|
||||
@ -269,10 +268,6 @@ public:
|
||||
{
|
||||
lasFile->setDepthUnit( "FT" );
|
||||
}
|
||||
else if ( firstCurveData->depthUnit() == RiaDefines::UNIT_NONE )
|
||||
{
|
||||
CVF_ASSERT( false );
|
||||
}
|
||||
|
||||
double absentValue = SingleLasFileMetaData::createAbsentValue( m_minimumCurveValue );
|
||||
lasFile->SetMissing( absentValue );
|
||||
@ -387,7 +382,8 @@ void RigLasFileExporter::setRkbDiffs( const std::vector<QString>& wellNames, con
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RigLasFileExporter::writeToFolder( const QString& exportFolder,
|
||||
const QString& filePrefix /*= ""*/,
|
||||
bool capitalizeFileName /*= false*/ )
|
||||
bool capitalizeFileName /*= false*/,
|
||||
bool alwaysOverwrite /*= false*/ )
|
||||
{
|
||||
std::vector<QString> writtenFiles;
|
||||
|
||||
@ -413,7 +409,7 @@ std::vector<QString> RigLasFileExporter::writeToFolder( const QString& exportFol
|
||||
fileName = fileName.toUpper();
|
||||
}
|
||||
QString fullPathName = dir.absoluteFilePath( fileName );
|
||||
if ( caf::Utils::fileExists( fullPathName ) )
|
||||
if ( caf::Utils::fileExists( fullPathName ) && !alwaysOverwrite )
|
||||
{
|
||||
QString txt = QString( "File %1 exists.\n\nDo you want to overwrite the file?" ).arg( fullPathName );
|
||||
int ret = QMessageBox::question( nullptr,
|
||||
|
@ -38,8 +38,10 @@ public:
|
||||
void wellPathsAndRkbDiff( std::vector<QString>* wellNames, std::vector<double>* rkbDiffs );
|
||||
void setRkbDiffs( const std::vector<QString>& wellNames, const std::vector<double>& rkbDiffs );
|
||||
|
||||
std::vector<QString>
|
||||
writeToFolder( const QString& exportFolder, const QString& filePrefix = "", bool capitalizeFileName = false );
|
||||
std::vector<QString> writeToFolder( const QString& exportFolder,
|
||||
const QString& filePrefix = "",
|
||||
bool capitalizeFileName = false,
|
||||
bool alwaysOverwrite = false );
|
||||
|
||||
private:
|
||||
std::vector<SingleLasFileMetaData> createLasFileDescriptions( const std::vector<RimWellLogCurve*>& curves );
|
||||
|
@ -350,6 +350,7 @@ void RiuMultiPlotPage::renderTo( QPaintDevice* paintDevice )
|
||||
void RiuMultiPlotPage::renderTo( QPainter* painter, double scalingFactor )
|
||||
{
|
||||
setSelectionsVisible( false );
|
||||
painter->fillRect( painter->viewport(), Qt::white );
|
||||
m_plotTitle->render( painter );
|
||||
|
||||
// Subtract margins because we are rendering into part inside the margins
|
||||
|
@ -623,7 +623,6 @@ void RiuQwtPlotWidget::renderTo( QPainter* painter, const QRect& targetRect, dou
|
||||
QPoint canvasBottomRightInWindowCoords = canvasBottomRightInPlotCoords + plotTopLeftInWindowCoords;
|
||||
|
||||
QwtPlotRenderer renderer( this );
|
||||
renderer.setDiscardFlag( QwtPlotRenderer::DiscardBackground, true );
|
||||
renderer.render( this, painter, targetRect );
|
||||
static_cast<QwtPlotCanvas*>( this->canvas() )->setPaintAttribute( QwtPlotCanvas::BackingStore, true );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user