#4817 #4830 #4832 #4837 #4839 Python commands for WBS creation, well path import and well log file import (#4838)

* Better minimum width for well log tracks

* Fix alignment of scrollbar in Well log plots

* Better Well Log Plot export

* Hide scroll bar before plotting
* Better borders

* Create plots through Python

* #4817 Create WBS plots with Python

* Rebase Summary and WellLogPlot on top of a new RimPlot

* Also Python: Allow setting folder as a parameter to export_snapshots

* #4832 Prepare for well path import command

* Well Path import WIP

* #4830 #4832 Import well paths and well log files from file using Python.

* #4837 Implement import of formation names in Python

* Fix debug build issue

* Fix RiaLogging build issue

* Fix warnings

* Yet another RiaLogging.h import added

* #4839 Import exporting of las and ascii files from well log plots
This commit is contained in:
Gaute Lindkvist 2019-10-09 09:21:28 +02:00 committed by GitHub
parent b24b0932a3
commit 11117383db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
106 changed files with 2128 additions and 339 deletions

View File

@ -765,6 +765,7 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim
geoMechCase->setFileName( fileName );
geoMechCase->caseUserDescription = caseName;
geoMechCase->setApplyTimeFilter( applyTimeStepFilter );
m_project->assignCaseIdToCase( geoMechCase );
RimGeoMechModels* geoMechModelCollection = m_project->activeOilField() ? m_project->activeOilField()->geoMechModels()
: nullptr;
@ -800,12 +801,15 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim
//--------------------------------------------------------------------------------------------------
/// Add a list of well path file paths (JSON files) to the well path collection
//--------------------------------------------------------------------------------------------------
void RiaApplication::addWellPathsToModel( QList<QString> wellPathFilePaths )
std::vector<RimFileWellPath*> RiaApplication::addWellPathsToModel( QList<QString> wellPathFilePaths,
QStringList* errorMessages )
{
if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return;
CAF_ASSERT( errorMessages );
if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return {};
RimOilField* oilField = m_project->activeOilField();
if ( oilField == nullptr ) return;
if ( oilField == nullptr ) return {};
if ( oilField->wellPathCollection == nullptr )
{
@ -815,9 +819,15 @@ void RiaApplication::addWellPathsToModel( QList<QString> wellPathFilePaths )
m_project->updateConnectedEditors();
}
if ( oilField->wellPathCollection ) oilField->wellPathCollection->addWellPaths( wellPathFilePaths );
std::vector<RimFileWellPath*> wellPaths;
if ( oilField->wellPathCollection )
{
wellPaths = oilField->wellPathCollection->addWellPaths( wellPathFilePaths, errorMessages );
}
oilField->wellPathCollection->updateConnectedEditors();
return wellPaths;
}
//--------------------------------------------------------------------------------------------------
@ -848,12 +858,15 @@ void RiaApplication::addWellPathFormationsToModel( QList<QString> wellPathFormat
//--------------------------------------------------------------------------------------------------
/// Add a list of well log file paths (LAS files) to the well path collection
//--------------------------------------------------------------------------------------------------
void RiaApplication::addWellLogsToModel( const QList<QString>& wellLogFilePaths )
std::vector<RimWellLogFile*> RiaApplication::addWellLogsToModel( const QList<QString>& wellLogFilePaths,
QStringList* errorMessages )
{
if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return;
CAF_ASSERT( errorMessages );
if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return {};
RimOilField* oilField = m_project->activeOilField();
if ( oilField == nullptr ) return;
if ( oilField == nullptr ) return {};
if ( oilField->wellPathCollection == nullptr )
{
@ -862,9 +875,12 @@ void RiaApplication::addWellLogsToModel( const QList<QString>& wellLogFilePaths
m_project->updateConnectedEditors();
}
oilField->wellPathCollection->addWellLogs( wellLogFilePaths );
std::vector<RimWellLogFile*> wellLogFiles = oilField->wellPathCollection->addWellLogs( wellLogFilePaths,
errorMessages );
oilField->wellPathCollection->updateConnectedEditors();
return wellLogFiles;
}
//--------------------------------------------------------------------------------------------------

View File

@ -54,11 +54,13 @@ class RigEclipseCaseData;
class RimCommandObject;
class RimEclipseCase;
class RimEclipseView;
class RimFileWellPath;
class RimGridView;
class RimProject;
class RimSummaryPlot;
class Rim3dView;
class RimViewWindow;
class RimWellLogFile;
class RimWellLogPlot;
class RimWellAllocationPlot;
@ -137,9 +139,9 @@ public:
bool openOdbCaseFromFile( const QString& fileName, bool applyTimeStepFilter = false );
void addWellPathsToModel( QList<QString> wellPathFilePaths );
void addWellPathFormationsToModel( QList<QString> wellPathFilePaths );
void addWellLogsToModel( const QList<QString>& wellLogFilePaths );
std::vector<RimFileWellPath*> addWellPathsToModel( QList<QString> wellPathFilePaths, QStringList* errorMessages );
void addWellPathFormationsToModel( QList<QString> wellPathFilePaths );
std::vector<RimWellLogFile*> addWellLogsToModel( const QList<QString>& wellLogFilePaths, QStringList* errorMessages );
QString scriptDirectories() const;
QString scriptEditorPath() const;

View File

@ -210,7 +210,7 @@ void RiaRegressionTestRunner::runRegressionTest()
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName );
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( fullPathGeneratedFolder );
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder( fullPathGeneratedFolder );
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( fullPathGeneratedFolder );
app->closeProject();
}

View File

@ -33,6 +33,11 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCreateGridCaseGroup.h
${CMAKE_CURRENT_LIST_DIR}/RicfCreateStatisticsCase.h
${CMAKE_CURRENT_LIST_DIR}/RicfCreateView.h
${CMAKE_CURRENT_LIST_DIR}/RicfCloneView.h
${CMAKE_CURRENT_LIST_DIR}/RicfNewWellBoreStabilityPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellPaths.h
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellLogFiles.h
${CMAKE_CURRENT_LIST_DIR}/RicfImportFormationNames.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellLogPlotData.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -69,6 +74,11 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCreateGridCaseGroup.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfCreateStatisticsCase.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfCreateView.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfCloneView.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfCreateWellBoreStabilityPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellPaths.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellLogFiles.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfImportFormationNames.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellLogPlotData.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -26,6 +26,15 @@ RicfCommandResponse::RicfCommandResponse( Status status, const QString& message
updateStatus( status, message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfCommandResponse::RicfCommandResponse( caf::PdmObject* ok_result )
: m_status( COMMAND_OK )
, m_result( ok_result )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -35,11 +44,11 @@ RicfCommandResponse::Status RicfCommandResponse::status() const
}
//--------------------------------------------------------------------------------------------------
///
/// The resulting message is sent in HTTP metadata and must not have any newlines.
//--------------------------------------------------------------------------------------------------
QString RicfCommandResponse::message() const
QString RicfCommandResponse::sanitizedResponseMessage() const
{
return m_messages.join( "\n" );
return m_messages.join( ";;" );
}
//--------------------------------------------------------------------------------------------------
@ -47,7 +56,7 @@ QString RicfCommandResponse::message() const
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RicfCommandResponse::result() const
{
return m_result.p();
return m_result.get();
}
//--------------------------------------------------------------------------------------------------
@ -55,7 +64,7 @@ caf::PdmObject* RicfCommandResponse::result() const
//--------------------------------------------------------------------------------------------------
void RicfCommandResponse::setResult( caf::PdmObject* result )
{
m_result = result;
m_result.reset( result );
}
//--------------------------------------------------------------------------------------------------
@ -63,8 +72,11 @@ void RicfCommandResponse::setResult( caf::PdmObject* result )
//--------------------------------------------------------------------------------------------------
void RicfCommandResponse::updateStatus( Status status, const QString& message )
{
QString cleanedMessage = message;
cleanedMessage.replace( '\n', ";;" );
m_status = std::max( m_status, status );
if ( !message.isEmpty() ) m_messages.push_back( QString( "%1:%2" ).arg( statusLabel( status ) ).arg( message ) );
if ( !message.isEmpty() )
m_messages.push_back( QString( "%1: %2" ).arg( statusLabel( status ) ).arg( cleanedMessage ) );
}
//--------------------------------------------------------------------------------------------------

View File

@ -43,9 +43,10 @@ public:
public:
RicfCommandResponse( Status status = COMMAND_OK, const QString& message = "" );
RicfCommandResponse( caf::PdmObject* ok_result );
Status status() const;
QString message() const;
QString sanitizedResponseMessage() const;
caf::PdmObject* result() const;
void setResult( caf::PdmObject* result );
void updateStatus( Status status, const QString& message );
@ -56,5 +57,5 @@ private:
private:
Status m_status;
QStringList m_messages;
caf::PdmPointer<caf::PdmObject> m_result;
std::unique_ptr<caf::PdmObject> m_result;
};

View File

@ -22,6 +22,11 @@
#include "cafPdmField.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RicfCreateViewResult : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;

View File

@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfCreateWellBoreStabilityPlotFeature.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "WellLogCommands/RicNewWellBoreStabilityPlotFeature.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
#include "RimProject.h"
#include "RimWellBoreStabilityPlot.h"
#include "RimWellPath.h"
#include <QAction>
CAF_PDM_SOURCE_INIT( RicfCreateWbsPlotResult, "createWbsPlotResult" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfCreateWbsPlotResult::RicfCreateWbsPlotResult( int viewId /*= -1*/ )
{
CAF_PDM_InitObject( "wbs_result", "", "", "" );
CAF_PDM_InitField( &this->viewId, "viewId", viewId, "", "", "", "" );
}
CAF_PDM_SOURCE_INIT( RicfCreateWellBoreStabilityPlotFeature, "createWellBoreStabilityPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfCreateWellBoreStabilityPlotFeature::RicfCreateWellBoreStabilityPlotFeature()
{
RICF_InitField( &m_caseId, "caseId", -1, "GeoMech Case Id", "", "", "" );
RICF_InitField( &m_wellPath, "wellPath", QString( "" ), "Well Path", "", "", "" );
RICF_InitField( &m_timeStep, "timeStep", -1, "Time Step", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfCommandResponse RicfCreateWellBoreStabilityPlotFeature::execute()
{
RimProject* project = RiaApplication::instance()->project();
std::vector<RimGeoMechCase*> geoMechCases;
project->descendantsIncludingThisOfType( geoMechCases );
RimGeoMechCase* chosenCase = nullptr;
for ( RimGeoMechCase* geoMechCase : geoMechCases )
{
if ( geoMechCase->caseId() == m_caseId() )
{
chosenCase = geoMechCase;
break;
}
}
RimWellPath* chosenWellPath = nullptr;
for ( RimWellPath* wellPath : project->allWellPaths() )
{
if ( wellPath->name() == m_wellPath() )
{
chosenWellPath = wellPath;
break;
}
}
if ( chosenCase && chosenWellPath && m_timeStep() >= 0 )
{
RimWellBoreStabilityPlot* wbsPlot = RicNewWellBoreStabilityPlotFeature::createPlot( chosenCase,
chosenWellPath,
m_timeStep() );
RicfCommandResponse response;
response.setResult( new RicfCreateWbsPlotResult( wbsPlot->id() ) );
return response;
}
QString error = QString( "createWellBoreStabilityPlot: Could not find GeoMech case with id %1" ).arg( m_caseId() );
RiaLogging::error( error );
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
}

View File

@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfCommandObject.h"
#include "cafPdmField.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RicfCreateWbsPlotResult : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RicfCreateWbsPlotResult( int viewId = -1 );
public:
caf::PdmField<int> viewId;
};
//==================================================================================================
//
//
//
//==================================================================================================
class RicfCreateWellBoreStabilityPlotFeature : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfCreateWellBoreStabilityPlotFeature();
RicfCommandResponse execute() override;
private:
caf::PdmField<int> m_caseId;
caf::PdmField<QString> m_wellPath;
caf::PdmField<int> m_timeStep;
};

View File

@ -53,6 +53,7 @@ RicfExportSnapshots::RicfExportSnapshots()
RICF_InitField( &m_prefix, "prefix", QString(), "Prefix", "", "", "" );
RICF_InitField( &m_caseId, "caseId", -1, "Case Id", "", "", "" );
RICF_InitField( &m_viewId, "viewId", -1, "View Id", "", "", "" );
RICF_InitField( &m_exportFolder, "exportFolder", QString(), "Export Folder", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
@ -74,6 +75,11 @@ RicfCommandResponse RicfExportSnapshots::execute()
QString absolutePathToSnapshotDir = RicfCommandFileExecutor::instance()->getExportPath(
RicfCommandFileExecutor::SNAPSHOTS );
if ( !m_exportFolder().isEmpty() )
{
absolutePathToSnapshotDir = m_exportFolder;
}
if ( absolutePathToSnapshotDir.isNull() )
{
absolutePathToSnapshotDir = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath(
@ -88,7 +94,9 @@ RicfCommandResponse RicfExportSnapshots::execute()
}
if ( m_type == RicfExportSnapshots::PLOTS || m_type == RicfExportSnapshots::ALL )
{
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder( absolutePathToSnapshotDir, m_prefix );
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( absolutePathToSnapshotDir,
m_prefix,
m_viewId() );
}
mainWnd->loadWinGeoAndDockToolBarLayout();

View File

@ -52,4 +52,5 @@ private:
caf::PdmField<QString> m_prefix;
caf::PdmField<int> m_caseId;
caf::PdmField<int> m_viewId;
caf::PdmField<QString> m_exportFolder;
};

View File

@ -0,0 +1,130 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfExportWellLogPlotData.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "ExportCommands/RicExportToLasFileFeature.h"
#include "WellLogCommands/RicAsciiExportWellLogPlotFeature.h"
#include "RimProject.h"
#include "RimWellLogPlot.h"
#include <QDir>
#include <QFileInfo>
#include <QStringList>
namespace caf
{
template <>
void RicfExportWellLogPlotData::ExportFormatEnum::setUp()
{
addItem( RicfExportWellLogPlotData::LAS, "LAS", "LAS" );
addItem( RicfExportWellLogPlotData::ASCII, "ASCII", "ASCII" );
setDefault( RicfExportWellLogPlotData::LAS );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RicfExportWellLogPlotDataResult, "exportWellLogPlotDataResult" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfExportWellLogPlotDataResult::RicfExportWellLogPlotDataResult()
{
CAF_PDM_InitObject( "export_well_data_result", "", "", "" );
CAF_PDM_InitFieldNoDefault( &this->exportedFiles, "exportedFiles", "", "", "", "" );
}
CAF_PDM_SOURCE_INIT( RicfExportWellLogPlotData, "exportWellLogPlotData" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfExportWellLogPlotData::RicfExportWellLogPlotData()
{
RICF_InitFieldNoDefault( &m_format, "exportFormat", "", "", "", "" );
RICF_InitField( &m_viewId, "viewId", -1, "", "", "", "" );
RICF_InitField( &m_folder, "exportFolder", QString(), "", "", "", "" );
RICF_InitField( &m_filePrefix, "filePrefix", QString(), "", "", "", "" );
RICF_InitField( &m_exportTvdRkb, "exportTvdRkb", false, "", "", "", "" );
RICF_InitField( &m_capitalizeFileNames, "capitalizeFileNames", false, "", "", "", "" );
RICF_InitField( &m_resampleInterval, "resampleInterval", 0.0, "", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfCommandResponse RicfExportWellLogPlotData::execute()
{
QStringList errorMessages;
RicfCommandResponse response;
if ( QFileInfo::exists( m_folder ) )
{
std::vector<RimWellLogPlot*> plots;
RiaApplication::instance()->project()->descendantsIncludingThisOfType( plots );
for ( RimWellLogPlot* plot : plots )
{
if ( plot->id() == m_viewId() )
{
RicfExportWellLogPlotDataResult* result = new RicfExportWellLogPlotDataResult;
if ( m_format() == ASCII )
{
QString validFileName =
RicAsciiExportWellLogPlotFeature::makeValidExportFileName( plot,
m_folder(),
m_filePrefix(),
m_capitalizeFileNames() );
if ( RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot( validFileName, plot ) )
{
result->exportedFiles.v().push_back( validFileName );
}
}
else
{
std::vector<QString> exportedFiles =
RicExportToLasFileFeature::exportToLasFiles( m_folder(),
m_filePrefix(),
plot,
m_exportTvdRkb(),
m_capitalizeFileNames(),
m_resampleInterval() );
result->exportedFiles.v() = exportedFiles;
}
response.setResult( result );
if ( result->exportedFiles().empty() )
{
errorMessages << "No files exported";
}
}
}
}
else
{
errorMessages << ( m_folder() + " does not exist" );
}
for ( QString errorMessage : errorMessages )
{
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
}
return response;
}

View File

@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfCommandObject.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RicfExportWellLogPlotDataResult : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RicfExportWellLogPlotDataResult();
public:
caf::PdmField<std::vector<QString>> exportedFiles;
};
//==================================================================================================
//
//
//
//==================================================================================================
class RicfExportWellLogPlotData : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
// Values are exposed in gRPC .proto. Do not change without also changing .proto
enum ExportFormat
{
LAS,
ASCII
};
typedef caf::AppEnum<ExportFormat> ExportFormatEnum;
public:
RicfExportWellLogPlotData();
RicfCommandResponse execute() override;
private:
caf::PdmField<ExportFormatEnum> m_format;
caf::PdmField<int> m_viewId;
caf::PdmField<QString> m_folder;
caf::PdmField<QString> m_filePrefix;
caf::PdmField<bool> m_exportTvdRkb;
caf::PdmField<bool> m_capitalizeFileNames;
caf::PdmField<double> m_resampleInterval;
};

View File

@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfImportFormationNames.h"
#include "RiaApplication.h"
#include "RicImportFormationNamesFeature.h"
#include "RimCase.h"
#include "RimFormationNames.h"
#include "RimProject.h"
#include <QFileInfo>
CAF_PDM_SOURCE_INIT( RicfImportFormationNames, "importFormationNames" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfImportFormationNames::RicfImportFormationNames()
{
RICF_InitFieldNoDefault( &m_formationFiles, "formationFiles", "", "", "", "" );
RICF_InitField( &m_applyToCaseId, "applyToCaseId", -1, "", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfCommandResponse RicfImportFormationNames::execute()
{
QStringList errorMessages, warningMessages;
if ( !m_formationFiles().empty() )
{
QStringList formationFileList;
for ( QString formationFile : m_formationFiles() )
{
if ( QFileInfo::exists( formationFile ) )
{
formationFileList.push_back( formationFile );
}
else
{
errorMessages.push_back( QString( "%1 does not exist" ).arg( formationFile ) );
}
}
RimFormationNames* formationNames = RicImportFormationNamesFeature::importFormationFiles( formationFileList );
if ( formationNames )
{
if ( m_applyToCaseId() != -1 )
{
bool foundCase = false;
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases( cases );
for ( RimCase* rimCase : cases )
{
if ( rimCase->caseId() == m_applyToCaseId() )
{
rimCase->setFormationNames( formationNames );
rimCase->updateConnectedEditors();
foundCase = true;
break;
}
}
if ( !foundCase ) warningMessages << "Could not find the case to apply the formations to";
}
}
}
else
{
errorMessages << "No formation files provided";
}
RicfCommandResponse response;
for ( QString warningMessage : warningMessages )
{
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
}
for ( QString errorMessage : errorMessages )
{
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
}
return response;
}

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfCommandObject.h"
#include "cafPdmField.h"
#include <QString>
#include <vector>
//==================================================================================================
///
///
//==================================================================================================
class RicfImportFormationNames : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfImportFormationNames();
RicfCommandResponse execute() override;
private:
caf::PdmField<std::vector<QString>> m_formationFiles;
caf::PdmField<int> m_applyToCaseId;
};

View File

@ -0,0 +1,115 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfImportWellLogFiles.h"
#include "WellLogCommands/RicWellLogsImportFileFeature.h"
#include "RimWellLogFile.h"
#include <QDir>
#include <QFileInfo>
#include <QStringList>
CAF_PDM_SOURCE_INIT( RicfImportWellLogFilesResult, "importWellLogFilesResult" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfImportWellLogFilesResult::RicfImportWellLogFilesResult()
{
CAF_PDM_InitObject( "well_log_files_result", "", "", "" );
CAF_PDM_InitFieldNoDefault( &wellPathNames, "wellPathNames", "", "", "", "" );
}
CAF_PDM_SOURCE_INIT( RicfImportWellLogFiles, "importWellLogFiles" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfImportWellLogFiles::RicfImportWellLogFiles()
{
RICF_InitFieldNoDefault( &m_wellLogFileFolder, "wellLogFolder", "", "", "", "" );
RICF_InitFieldNoDefault( &m_wellLogFilePaths, "wellLogFiles", "", "", "", "" );
}
RicfCommandResponse RicfImportWellLogFiles::execute()
{
QStringList errorMessages, warningMessages;
QStringList wellLogFilePaths;
QDir wellPathFolder( m_wellLogFileFolder );
if ( wellPathFolder.exists() )
{
QStringList nameFilters;
nameFilters << RicWellLogsImportFileFeature::wellLogFileNameFilters();
QStringList relativePaths = wellPathFolder.entryList( nameFilters, QDir::Files | QDir::NoDotAndDotDot );
for ( QString relativePath : relativePaths )
{
wellLogFilePaths.push_back( wellPathFolder.absoluteFilePath( relativePath ) );
}
}
else
{
errorMessages << ( m_wellLogFileFolder() + " doesn't exist" );
}
for ( QString wellLogFilePath : m_wellLogFilePaths() )
{
if ( QFileInfo::exists( wellLogFilePath ) )
{
wellLogFilePaths.push_back( wellLogFilePath );
}
else
{
errorMessages << ( wellLogFilePath + " doesn't exist" );
}
}
RicfCommandResponse response;
if ( !wellLogFilePaths.empty() )
{
std::vector<RimWellLogFile*> importedWellLogFiles =
RicWellLogsImportFileFeature::importWellLogFiles( wellLogFilePaths, &warningMessages );
if ( !importedWellLogFiles.empty() )
{
RicfImportWellLogFilesResult* result = new RicfImportWellLogFilesResult;
for ( RimWellLogFile* wellLogFile : importedWellLogFiles )
{
result->wellPathNames.v().push_back( wellLogFile->wellName() );
}
response.setResult( result );
}
}
else
{
warningMessages << "No well log files found";
}
for ( QString warningMessage : warningMessages )
{
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
}
for ( QString errorMessage : errorMessages )
{
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
}
return response;
}

View File

@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfCommandObject.h"
#include "cafPdmField.h"
#include <QString>
#include <vector>
//==================================================================================================
///
///
//==================================================================================================
class RicfImportWellLogFilesResult : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RicfImportWellLogFilesResult();
public:
caf::PdmField<std::vector<QString>> wellPathNames;
};
//==================================================================================================
///
///
//==================================================================================================
class RicfImportWellLogFiles : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfImportWellLogFiles();
RicfCommandResponse execute() override;
private:
caf::PdmField<QString> m_wellLogFileFolder;
caf::PdmField<std::vector<QString>> m_wellLogFilePaths;
};

View File

@ -0,0 +1,116 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfImportWellPaths.h"
#include "WellPathCommands/RicWellPathsImportFileFeature.h"
#include "RimFileWellPath.h"
#include <QDir>
#include <QFileInfo>
#include <QStringList>
CAF_PDM_SOURCE_INIT( RicfImportWellPathsResult, "importWellPathsResult" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfImportWellPathsResult::RicfImportWellPathsResult()
{
CAF_PDM_InitObject( "well_path_result", "", "", "" );
CAF_PDM_InitFieldNoDefault( &wellPathNames, "wellPathNames", "", "", "", "" );
}
CAF_PDM_SOURCE_INIT( RicfImportWellPaths, "importWellPaths" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfImportWellPaths::RicfImportWellPaths()
{
RICF_InitFieldNoDefault( &m_wellPathFolder, "wellPathFolder", "", "", "", "" );
RICF_InitFieldNoDefault( &m_wellPathFiles, "wellPathFiles", "", "", "", "" );
}
RicfCommandResponse RicfImportWellPaths::execute()
{
QStringList errorMessages, warningMessages;
QStringList wellPathFiles;
QDir wellPathFolder( m_wellPathFolder );
if ( wellPathFolder.exists() )
{
QStringList nameFilters;
nameFilters << RicWellPathsImportFileFeature::wellPathNameFilters();
QStringList relativePaths = wellPathFolder.entryList( nameFilters, QDir::Files | QDir::NoDotAndDotDot );
for ( QString relativePath : relativePaths )
{
wellPathFiles.push_back( wellPathFolder.absoluteFilePath( relativePath ) );
}
}
else
{
errorMessages << ( m_wellPathFolder() + " does not exist" );
}
for ( QString wellPathFile : m_wellPathFiles() )
{
if ( QFileInfo::exists( wellPathFile ) )
{
wellPathFiles.push_back( wellPathFile );
}
else
{
errorMessages << ( wellPathFile + " does not exist" );
}
}
RicfCommandResponse response;
if ( !wellPathFiles.empty() )
{
std::vector<RimFileWellPath*> importedWellPaths = RicWellPathsImportFileFeature::importWellPaths( wellPathFiles,
&warningMessages );
if ( !importedWellPaths.empty() )
{
RicfImportWellPathsResult* wellPathsResult = new RicfImportWellPathsResult;
for ( RimFileWellPath* wellPath : importedWellPaths )
{
wellPathsResult->wellPathNames.v().push_back( wellPath->name() );
}
response.setResult( wellPathsResult );
}
}
else
{
warningMessages << "No well paths found";
}
for ( QString warningMessage : warningMessages )
{
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
}
for ( QString errorMessage : errorMessages )
{
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
}
return response;
}

View File

@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RicfCommandObject.h"
#include "cafPdmField.h"
#include <QString>
#include <vector>
//==================================================================================================
///
///
//==================================================================================================
class RicfImportWellPathsResult : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RicfImportWellPathsResult();
public:
caf::PdmField<std::vector<QString>> wellPathNames;
};
//==================================================================================================
///
///
//==================================================================================================
class RicfImportWellPaths : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfImportWellPaths();
RicfCommandResponse execute() override;
private:
caf::PdmField<QString> m_wellPathFolder;
caf::PdmField<std::vector<QString>> m_wellPathFiles;
};

View File

@ -29,6 +29,8 @@
#include "RigWellLogCurveData.h"
#include "RimWellLogCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafSelectionManager.h"
@ -38,6 +40,73 @@
CAF_CMD_SOURCE_INIT( RicExportToLasFileFeature, "RicExportToLasFileFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString& exportFolder,
const QString& exportPrefix,
const RimWellLogPlot* plot,
bool exportTvdRkb,
bool capitalizeFileNames,
double resampleInterval )
{
std::vector<RimWellLogCurve*> allCurves;
std::vector<RimWellLogTrack*> tracks = plot->visibleTracks();
for ( RimWellLogTrack* track : tracks )
{
std::vector<RimWellLogCurve*> curves = track->visibleCurvesVector();
allCurves.insert( allCurves.end(), curves.begin(), curves.end() );
}
std::vector<QString> wellNames;
std::vector<double> rkbDiffs;
{
RigLasFileExporter lasExporter( allCurves );
lasExporter.wellPathsAndRkbDiff( &wellNames, &rkbDiffs );
return exportToLasFiles( exportFolder,
exportPrefix,
allCurves,
wellNames,
rkbDiffs,
capitalizeFileNames,
resampleInterval );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString& exportFolder,
const QString& filePrefix,
std::vector<RimWellLogCurve*> curves,
const std::vector<QString>& wellNames,
const std::vector<double>& rkbDiffs,
bool capitalizeFileNames,
double resampleInterval )
{
RigLasFileExporter lasExporter( curves );
std::vector<QString> writtenFiles;
if ( resampleInterval > 0.0 )
{
lasExporter.setResamplingInterval( resampleInterval );
}
if ( !rkbDiffs.empty() )
{
lasExporter.setRkbDiffs( wellNames, rkbDiffs );
}
writtenFiles = lasExporter.writeToFolder( exportFolder, filePrefix, capitalizeFileNames );
// Remember the path to next time
RiaApplication::instance()->setLastUsedDialogDirectory( "WELL_LOGS_DIR", exportFolder );
return writtenFiles;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -89,28 +158,33 @@ void RicExportToLasFileFeature::onActionTriggered( bool isChecked )
RicExportFeatureImpl::configureForExport( propertyDialog.dialogButtonBox() );
propertyDialog.resize( QSize( 400, 330 ) );
std::vector<QString> writtenFiles;
if ( propertyDialog.exec() == QDialog::Accepted && !featureUi.exportFolder().isEmpty() )
{
double resampleInterval = 0.0;
if ( featureUi.activateResample )
{
lasExporter.setResamplingInterval( featureUi.resampleInterval() );
resampleInterval = featureUi.resampleInterval();
}
std::vector<QString> wellNames;
std::vector<double> rkbDiffs;
if ( featureUi.exportTvdrkb )
{
std::vector<QString> wellNames;
std::vector<double> rkbDiffs;
lasExporter.wellPathsAndRkbDiff( &wellNames, &rkbDiffs );
std::vector<double> userDefRkbDiff;
featureUi.tvdrkbDiffForWellPaths( &userDefRkbDiff );
lasExporter.setRkbDiffs( wellNames, userDefRkbDiff );
rkbDiffs = userDefRkbDiff;
}
lasExporter.writeToFolder( featureUi.exportFolder(), featureUi.filePrefix(), featureUi.capitalizeFileName() );
// Remember the path to next time
RiaApplication::instance()->setLastUsedDialogDirectory( "WELL_LOGS_DIR", featureUi.exportFolder() );
exportToLasFiles( featureUi.exportFolder(),
featureUi.filePrefix(),
curves,
wellNames,
rkbDiffs,
featureUi.capitalizeFileName,
resampleInterval );
}
}

View File

@ -21,9 +21,12 @@
#include "cafCmdFeature.h"
#include <QString>
#include <vector>
class RimWellLogCurve;
class RimWellLogPlot;
//==================================================================================================
///
@ -32,6 +35,22 @@ class RicExportToLasFileFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static std::vector<QString> exportToLasFiles( const QString& exportFolder,
const QString& filePrefix,
const RimWellLogPlot* plot,
bool exportTvdRkb = false,
bool capitalizeFileNames = false,
double resampleInterval = 0.0 );
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 );
protected:
// Overrides
bool isCommandEnabled() override;

View File

@ -57,7 +57,7 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
// Save images in snapshot catalog relative to project directory
QString snapshotFolderName = app->createAbsolutePathFromProjectRelativePath( "snapshots" );
exportSnapshotOfAllPlotsIntoFolder( snapshotFolderName );
exportSnapshotOfPlotsIntoFolder( snapshotFolderName );
QString text = QString( "Exported snapshots to folder : \n%1" ).arg( snapshotFolderName );
RiaLogging::info( text );
@ -66,8 +66,9 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder( const QString& snapshotFolderName,
const QString& prefix )
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName,
const QString& prefix,
int viewId )
{
RiaApplication* app = RiaApplication::instance();
@ -87,7 +88,7 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder( const
for ( auto viewWindow : viewWindows )
{
if ( viewWindow->isMdiWindow() && viewWindow->viewWidget() )
if ( viewWindow->isMdiWindow() && viewWindow->viewWidget() && ( viewId == -1 || viewId == viewWindow->id() ) )
{
QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName( viewWindow );
if ( !prefix.isEmpty() )

View File

@ -32,7 +32,9 @@ class RicSnapshotAllPlotsToFileFeature : public caf::CmdFeature
public:
static void saveAllPlots();
static void exportSnapshotOfAllPlotsIntoFolder( const QString& snapshotFolderName, const QString& prefix = "" );
static void exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName,
const QString& prefix = "",
int viewId = -1 );
protected:
// Overrides

View File

@ -75,6 +75,8 @@ void RicAddStoredFlowCharacteristicsPlotFeature::onActionTriggered( bool isCheck
sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
CVF_ASSERT( flowCharacteristicsPlot );
RiaApplication::instance()->project()->assignViewIdToView( flowCharacteristicsPlot );
flowPlotColl->addFlowCharacteristicsPlotToStoredPlots( flowCharacteristicsPlot );
flowCharacteristicsPlot->resolveReferencesRecursively();

View File

@ -73,6 +73,8 @@ void RicAddStoredWellAllocationPlotFeature::onActionTriggered( bool isChecked )
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(
sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
RiaApplication::instance()->project()->assignViewIdToView( wellAllocationPlot );
CVF_ASSERT( wellAllocationPlot );
flowPlotColl->addWellAllocPlotToStoredPlots( wellAllocationPlot );

View File

@ -169,6 +169,7 @@ RimWellPath* RicWellLogTools::findWellPathWithLogFileFromSelection()
//--------------------------------------------------------------------------------------------------
template <typename ExtractionCurveType>
ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack* plotTrack,
RimCase* caseToApply,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
@ -182,28 +183,26 @@ ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
curve->setColor( curveColor );
RimCase* caseToApply = nullptr;
RimWellLogPlot* plot = nullptr;
RimWellLogPlot* plot = nullptr;
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
RimWellLogCurveCommonDataSource* commonDataSource = plot->commonDataSource();
if ( view )
if ( !caseToApply )
{
caseToApply = view->ownerCase();
}
else if ( commonDataSource->caseToApply() )
{
caseToApply = commonDataSource->caseToApply();
}
else if ( plotTrack->formationNamesCase() )
{
caseToApply = plotTrack->formationNamesCase();
}
else
{
std::vector<RimCase*> allCases;
RiaApplication::instance()->project()->allCases( allCases );
if ( !allCases.empty() ) caseToApply = allCases.front();
if ( commonDataSource->caseToApply() )
{
caseToApply = commonDataSource->caseToApply();
}
else if ( plotTrack->formationNamesCase() )
{
caseToApply = plotTrack->formationNamesCase();
}
else
{
std::vector<RimCase*> allCases;
RiaApplication::instance()->project()->allCases( allCases );
if ( !allCases.empty() ) caseToApply = allCases.front();
}
}
QString ownerSimWellName;
@ -267,7 +266,10 @@ ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
curve->setCase( caseToApply );
}
curve->setPropertiesFromView( view );
if ( view )
{
curve->setPropertiesFromView( view );
}
plotTrack->addCurve( curve );
@ -370,6 +372,7 @@ RimWellLogFileCurve* RicWellLogTools::addFileCurve( RimWellLogTrack* plotTrack,
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicWellLogTools::addWellLogExtractionCurve( RimWellLogTrack* plotTrack,
RimCase* rimCase,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
@ -378,6 +381,7 @@ RimWellLogExtractionCurve* RicWellLogTools::addWellLogExtractionCurve( RimWellLo
bool showPlotWindow /*= true */ )
{
return addExtractionCurve<RimWellLogExtractionCurve>( plotTrack,
rimCase,
view,
wellPath,
simWell,
@ -389,18 +393,19 @@ RimWellLogExtractionCurve* RicWellLogTools::addWellLogExtractionCurve( RimWellLo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogWbsCurve* RicWellLogTools::addWellLogWbsCurve( RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow /*= true */ )
RimWellLogWbsCurve* RicWellLogTools::addWellLogWbsCurve( RimWellLogTrack* plotTrack,
RimCase* rimCase,
Rim3dView* view,
RimWellPath* wellPath,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow /*= true */ )
{
return addExtractionCurve<RimWellLogWbsCurve>( plotTrack,
rimCase,
view,
wellPath,
simWell,
nullptr,
branchIndex,
useBranchDetection,
showPlotWindow );

View File

@ -22,6 +22,7 @@
#include <vector>
class RimCase;
class RimSimWellInView;
class Rim3dView;
class Rim3dWellLogCurveCollection;
@ -51,23 +52,25 @@ public:
static RimWellLogFileCurve* addFileCurve( RimWellLogTrack* plotTrack, bool showPlotWindow = true );
static RimWellLogExtractionCurve* addWellLogExtractionCurve( RimWellLogTrack* plotTrack,
RimCase* rimCase,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow = true );
static RimWellLogWbsCurve* addWellLogWbsCurve( RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow = true );
static RimWellLogWbsCurve* addWellLogWbsCurve( RimWellLogTrack* plotTrack,
RimCase* rimCase,
Rim3dView* view,
RimWellPath* wellPath,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow = true );
private:
template <typename ExtractionCurveType>
static ExtractionCurveType* addExtractionCurve( RimWellLogTrack* plotTrack,
RimCase* rimCase,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,

View File

@ -115,7 +115,8 @@ void RicWellPathsImportSsihubFeature::onActionTriggered( bool isChecked )
QStringList wellPaths = wellImportwizard.absoluteFilePathsToWellPaths();
if ( wellPaths.size() > 0 )
{
app->addWellPathsToModel( wellPaths );
QStringList errorMessages;
app->addWellPathsToModel( wellPaths, &errorMessages );
app->project()->scheduleCreateDisplayModelAndRedrawAllViews();
}

View File

@ -110,6 +110,21 @@ void RicAsciiExportWellLogPlotFeature::setupActionLook( QAction* actionToSetup )
actionToSetup->setIcon( QIcon( ":/Save.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicAsciiExportWellLogPlotFeature::makeValidExportFileName( const RimWellLogPlot* wellLogPlot,
const QString& folder,
const QString& prefix,
bool capitalizeFileName )
{
QString fileName = folder + "/" + prefix + caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
if ( capitalizeFileName ) fileName = fileName.toUpper();
QDir dir( folder );
return dir.absoluteFilePath( fileName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -20,6 +20,8 @@
#include "cafCmdFeature.h"
#include <QString>
class RimWellLogPlot;
//==================================================================================================
@ -29,11 +31,15 @@ class RicAsciiExportWellLogPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static QString makeValidExportFileName( const RimWellLogPlot* wellLogPlot,
const QString& folder,
const QString& prefix,
bool capitalizeFileName );
static bool exportAsciiForWellLogPlot( const QString& fileName, const RimWellLogPlot* wellLogPlot );
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
static bool exportAsciiForWellLogPlot( const QString& fileName, const RimWellLogPlot* wellLogPlot );
};

View File

@ -68,6 +68,8 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
QString wellName = selectedWellName();
RimWellRftPlot* rftPlot = new RimWellRftPlot();
RiaApplication::instance()->project()->assignViewIdToView( rftPlot );
rftPlot->setSimWellOrWellPathName( wellName );
RimWellLogTrack* plotTrack = new RimWellLogTrack();

View File

@ -58,6 +58,63 @@
CAF_CMD_SOURCE_INIT( RicNewWellBoreStabilityPlotFeature, "RicNewWellBoreStabilityPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellBoreStabilityPlot*
RicNewWellBoreStabilityPlotFeature::createPlot( RimGeoMechCase* geoMechCase, RimWellPath* wellPath, int timeStep )
{
caf::ProgressInfo progInfo( 100, "Creating Well Bore Stability Plot" );
RimWellBoreStabilityPlot* plot = RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( false,
"Well Bore Stability" );
{
auto task = progInfo.task( "Creating formation track", 2 );
createFormationTrack( plot, wellPath, geoMechCase );
}
{
auto task = progInfo.task( "Creating well design track", 3 );
createCasingShoeTrack( plot, wellPath, geoMechCase );
}
{
auto task = progInfo.task( "Creating parameters track", 15 );
createParametersTrack( plot, wellPath, geoMechCase, timeStep );
}
{
auto task = progInfo.task( "Creating stability curves track", 60 );
createStabilityCurvesTrack( plot, wellPath, geoMechCase, timeStep );
}
{
auto task = progInfo.task( "Creating angles track", 15 );
createAnglesTrack( plot, wellPath, geoMechCase, timeStep );
}
{
auto task = progInfo.task( "Updating all tracks", 5 );
plot->enableAllAutoNameTags( true );
plot->setPlotTitleVisible( true );
plot->setTrackLegendsVisible( true );
plot->setTrackLegendsHorizontal( true );
plot->setDepthType( RimWellLogPlot::TRUE_VERTICAL_DEPTH );
plot->setDepthAutoZoom( true );
RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot );
}
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -103,54 +160,14 @@ void RicNewWellBoreStabilityPlotFeature::onActionTriggered( bool isChecked )
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
if ( !geoMechView ) return;
caf::ProgressInfo progInfo( 100, "Creating Well Bore Stability Plot" );
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RimWellBoreStabilityPlot* plot = RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( false,
"Well Bore Stability" );
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
if ( !geoMechCase )
{
auto task = progInfo.task( "Creating formation track", 2 );
createFormationTrack( plot, wellPath, geoMechCase );
return;
}
{
auto task = progInfo.task( "Creating well design track", 3 );
createCasingShoeTrack( plot, wellPath, geoMechCase );
}
{
auto task = progInfo.task( "Creating parameters track", 15 );
createParametersTrack( plot, wellPath, geoMechView );
}
{
auto task = progInfo.task( "Creating stability curves track", 60 );
createStabilityCurvesTrack( plot, wellPath, geoMechView );
}
{
auto task = progInfo.task( "Creating angles track", 15 );
createAnglesTrack( plot, wellPath, geoMechView );
}
{
auto task = progInfo.task( "Updating all tracks", 5 );
plot->enableAllAutoNameTags( true );
plot->setPlotTitleVisible( true );
plot->setTrackLegendsVisible( true );
plot->setTrackLegendsHorizontal( true );
plot->setDepthType( RimWellLogPlot::TRUE_VERTICAL_DEPTH );
plot->setDepthAutoZoom( true );
RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot );
}
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
createPlot( geoMechCase, wellPath, view->currentTimeStep() );
}
//--------------------------------------------------------------------------------------------------
@ -203,7 +220,8 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechView* geoMechView )
RimGeoMechCase* geoMechCase,
int timeStep )
{
RimWellLogTrack* paramCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"WBS Parameters",
@ -213,7 +231,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
paramCurvesTrack->setTickIntervals( 0.5, 0.05 );
paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
paramCurvesTrack->setFormationWellPath( wellPath );
paramCurvesTrack->setFormationCase( geoMechView->geoMechCase() );
paramCurvesTrack->setFormationCase( geoMechCase );
paramCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::CURVE_ANNOTATIONS );
paramCurvesTrack->setShowRegionLabels( true );
paramCurvesTrack->setVisible( false );
@ -226,14 +244,15 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( paramCurvesTrack,
geoMechView,
geoMechCase,
nullptr,
wellPath,
nullptr,
-1,
false,
false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCurrentTimeStep( timeStep );
curve->setColor( colors[i % colors.size()] );
curve->setLineThickness( 2 );
curve->loadDataAndUpdate( false );
@ -247,7 +266,8 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechView* geoMechView )
RimGeoMechCase* geoMechCase,
int timeStep )
{
RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"Stability Curves",
@ -257,7 +277,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
stabilityCurvesTrack->setTickIntervals( 0.5, 0.05 );
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
stabilityCurvesTrack->setFormationWellPath( wellPath );
stabilityCurvesTrack->setFormationCase( geoMechView->geoMechCase() );
stabilityCurvesTrack->setFormationCase( geoMechCase );
stabilityCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::NO_ANNOTATIONS );
stabilityCurvesTrack->setShowRegionLabels( true );
@ -274,14 +294,14 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogWbsCurve* curve = RicWellLogTools::addWellLogWbsCurve( stabilityCurvesTrack,
geoMechView,
wellPath,
geoMechCase,
nullptr,
wellPath,
-1,
false,
false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCurrentTimeStep( timeStep );
curve->setAutoNameComponents( false, true, false, false, false );
curve->setColor( colors[i % colors.size()] );
curve->setLineThickness( 2 );
@ -297,7 +317,8 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechView* geoMechView )
RimGeoMechCase* geoMechCase,
int timeStep )
{
RimWellLogTrack* wellPathAnglesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"Well Path Angles",
@ -315,14 +336,15 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( wellPathAnglesTrack,
geoMechView,
geoMechCase,
nullptr,
wellPath,
nullptr,
-1,
false,
false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCurrentTimeStep( timeStep );
curve->setCustomName( resultName );
curve->setColor( colors[i % colors.size()] );
@ -349,7 +371,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
wellPathAnglesTrack->setTickIntervals( 90.0, 30.0 );
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
wellPathAnglesTrack->setFormationWellPath( wellPath );
wellPathAnglesTrack->setFormationCase( geoMechView->geoMechCase() );
wellPathAnglesTrack->setFormationCase( geoMechCase );
wellPathAnglesTrack->setAnnotationType( RiuPlotAnnotationTool::NO_ANNOTATIONS );
wellPathAnglesTrack->setShowRegionLabels( false );
}

View File

@ -32,6 +32,9 @@ class RicNewWellBoreStabilityPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static RimWellBoreStabilityPlot* createPlot( RimGeoMechCase* geoMechCase, RimWellPath* wellPath, int timeStep );
protected:
// Overrides
bool isCommandEnabled() override;
@ -39,9 +42,18 @@ protected:
void setupActionLook( QAction* actionToSetup ) override;
private:
void createFormationTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
void createCasingShoeTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
void createParametersTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView );
void createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView );
void createAnglesTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView );
static void createFormationTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
static void createCasingShoeTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
static void createParametersTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase,
int timeStep );
static void createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase,
int timeStep );
static void createAnglesTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase,
int timeStep );
};

View File

@ -74,7 +74,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>();
if ( wellLogPlotTrack )
{
RicWellLogTools::addWellLogExtractionCurve( wellLogPlotTrack, nullptr, nullptr, nullptr, -1, true );
RicWellLogTools::addWellLogExtractionCurve( wellLogPlotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
}
else
{
@ -108,12 +108,15 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
newWellLogPlotTrack->setFormationBranchDetection( useBranchDetection );
}
RimCase* ownerCase = nullptr;
if ( view )
{
ownerCase = view->ownerCase();
newWellLogPlotTrack->setFormationCase( view->ownerCase() );
}
RimWellLogExtractionCurve* plotCurve = RicWellLogTools::addWellLogExtractionCurve( newWellLogPlotTrack,
ownerCase,
view,
wellPath,
simWell,

View File

@ -53,12 +53,8 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked )
{
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( plotTrack,
nullptr,
nullptr,
nullptr,
-1,
true );
RimWellLogExtractionCurve* curve =
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
curve->loadDataAndUpdate( true );
RimWellLogPlot* plot = nullptr;
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );

View File

@ -53,6 +53,7 @@ RimWellBoreStabilityPlot*
RimWellBoreStabilityPlot* plot = new RimWellBoreStabilityPlot();
plot->setAsPlotMdiWindow();
RiaApplication::instance()->project()->assignViewIdToView( plot );
wellLogPlotColl->wellLogPlots().push_back( plot );
@ -87,6 +88,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC
RimWellLogPlot* plot = new RimWellLogPlot();
plot->setAsPlotMdiWindow();
RiaApplication::instance()->project()->assignViewIdToView( plot );
wellLogPlotColl->wellLogPlots().push_back( plot );

View File

@ -66,7 +66,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered( bool isChecked )
plotTrack->setDescription( QString( "Track %1" ).arg( wellLogPlot->trackCount() ) );
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>( wellLogPlot->viewWidget() );
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
plotWindow->setWidthOfMdiWindow( viewWidget, viewWidget->preferredWidth() );
wellLogPlot->updateConnectedEditors();

View File

@ -20,6 +20,9 @@
#include "RicWellLogsImportFileFeature.h"
#include "RiaApplication.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RimProject.h"
#include "Riu3DMainWindowTools.h"
@ -27,9 +30,38 @@
#include <QAction>
#include <QFileDialog>
#include <QMessageBox>
CAF_CMD_SOURCE_INIT( RicWellLogsImportFileFeature, "RicWellLogsImportFileFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogFile*> RicWellLogsImportFileFeature::importWellLogFiles( const QStringList& wellLogFilePaths,
QStringList* errorMessages )
{
RiaApplication* app = RiaApplication::instance();
// Remember the path to next time
app->setLastUsedDialogDirectory( "WELL_LOGS_DIR", QFileInfo( wellLogFilePaths.last() ).absolutePath() );
std::vector<RimWellLogFile*> wellLogFiles = app->addWellLogsToModel( wellLogFilePaths, errorMessages );
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
return wellLogFiles;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RicWellLogsImportFileFeature::wellLogFileNameFilters()
{
QStringList nameFilters;
nameFilters << "*.las";
return nameFilters;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -44,21 +76,29 @@ bool RicWellLogsImportFileFeature::isCommandEnabled()
void RicWellLogsImportFileFeature::onActionTriggered( bool isChecked )
{
// Open dialog box to select well path files
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory( "WELL_LOGS_DIR" );
QStringList wellLogFilePaths = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory( "WELL_LOGS_DIR" );
QString nameFilterString = QString( "Well Logs (%1);;All Files (*.*)" ).arg( wellLogFileNameFilters().join( " " ) );
QStringList wellLogFilePaths = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
"Import Well Logs",
defaultDir,
"Well Logs (*.las);;All Files (*.*)" );
nameFilterString );
if ( wellLogFilePaths.size() < 1 ) return;
if ( wellLogFilePaths.size() >= 1 )
{
QStringList errorMessages;
importWellLogFiles( wellLogFilePaths, &errorMessages );
if ( !errorMessages.empty() )
{
QString displayMessage = "Errors opening the LAS files: \n" + errorMessages.join( "\n" );
// Remember the path to next time
app->setLastUsedDialogDirectory( "WELL_LOGS_DIR", QFileInfo( wellLogFilePaths.last() ).absolutePath() );
app->addWellLogsToModel( wellLogFilePaths );
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
if ( RiaGuiApplication::isRunning() )
{
QMessageBox::warning( Riu3DMainWindowTools::mainWindowWidget(), "File open error", displayMessage );
}
RiaLogging::warning( displayMessage );
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -21,12 +21,19 @@
#include "cafCmdFeature.h"
#include <vector>
class RimWellLogFile;
//==================================================================================================
///
//==================================================================================================
class RicWellLogsImportFileFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
static std::vector<RimWellLogFile*> importWellLogFiles( const QStringList& wellLogFilePaths,
QStringList* errorMessages );
static QStringList wellLogFileNameFilters();
protected:
// Overrides

View File

@ -20,6 +20,8 @@
#include "RicWellPathsImportFileFeature.h"
#include "RiaApplication.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RimOilField.h"
#include "RimProject.h"
@ -30,9 +32,56 @@
#include <QAction>
#include <QFileDialog>
#include <QMessageBox>
CAF_CMD_SOURCE_INIT( RicWellPathsImportFileFeature, "RicWellPathsImportFileFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimFileWellPath*> RicWellPathsImportFileFeature::importWellPaths( const QStringList& wellPathFilePaths,
QStringList* errorMessages )
{
RiaApplication* app = RiaApplication::instance();
// Remember the path to next time
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );
std::vector<RimFileWellPath*> wellPaths = app->addWellPathsToModel( wellPathFilePaths, errorMessages );
RimProject* project = app->project();
if ( project )
{
project->scheduleCreateDisplayModelAndRedrawAllViews();
RimOilField* oilField = project->activeOilField();
if ( oilField && oilField->wellPathCollection->wellPaths().size() > 0 )
{
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
if ( wellPath )
{
Riu3DMainWindowTools::selectAsCurrentItem( wellPath );
}
}
}
return wellPaths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RicWellPathsImportFileFeature::wellPathNameFilters()
{
QStringList nameFilters;
nameFilters << "*.json"
<< "*.asc"
<< " *.asci"
<< "*.ascii"
<< "*.dev";
return nameFilters;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -50,35 +99,28 @@ void RicWellPathsImportFileFeature::onActionTriggered( bool isChecked )
RiaApplication* app = RiaApplication::instance();
QString lastUsedGridFolder = app->lastUsedDialogDirectory( "BINARY_GRID" );
QString defaultDir = app->lastUsedDialogDirectoryWithFallback( "WELLPATH_DIR", lastUsedGridFolder );
QStringList wellPathFilePaths =
QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
"Import Well Paths",
defaultDir,
"Well Paths (*.json *.asc *.asci *.ascii *.dev);;All Files (*.*)" );
if ( wellPathFilePaths.size() < 1 ) return;
QString nameList = QString( "Well Paths (%1);;All Files (*.*)" ).arg( wellPathNameFilters().join( " " ) );
// Remember the path to next time
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
"Import Well Paths",
defaultDir,
nameList );
app->addWellPathsToModel( wellPathFilePaths );
RimProject* project = app->project();
if ( project )
if ( wellPathFilePaths.size() >= 1 )
{
project->scheduleCreateDisplayModelAndRedrawAllViews();
RimOilField* oilField = project->activeOilField();
QStringList errorMessages;
importWellPaths( wellPathFilePaths, &errorMessages );
if ( !oilField ) return;
if ( oilField->wellPathCollection->wellPaths().size() > 0 )
if ( !errorMessages.empty() )
{
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
if ( wellPath )
QString displayMessage = "Errors loading well path files: \n" + errorMessages.join( "\n" );
if ( RiaGuiApplication::isRunning() )
{
Riu3DMainWindowTools::selectAsCurrentItem( wellPath );
QMessageBox::warning( Riu3DMainWindowTools::mainWindowWidget(), "File open error", displayMessage );
}
RiaLogging::warning( displayMessage );
}
}
}

View File

@ -21,6 +21,10 @@
#include "cafCmdFeature.h"
#include <vector>
class RimFileWellPath;
//==================================================================================================
///
//==================================================================================================
@ -28,6 +32,11 @@ class RicWellPathsImportFileFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static std::vector<RimFileWellPath*> importWellPaths( const QStringList& wellPathFilePaths,
QStringList* errorMessages );
static QStringList wellPathNameFilters();
protected:
// Overrides
bool isCommandEnabled() override;

View File

@ -168,6 +168,7 @@ if (RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
"rips/project.py"
"rips/instance.py"
"rips/pdmobject.py"
"rips/plot.py"
"rips/view.py"
"rips/PythonExamples/InstanceExample.py"
"rips/PythonExamples/CommandExample.py"

View File

@ -54,6 +54,7 @@ message ExportSnapshotsRequest
string prefix = 2;
int32 caseId = 3;
int32 viewId = 4;
string exportFolder = 5;
}
message ExportPropertyRequest
@ -268,6 +269,48 @@ message CloneViewRequest
int32 viewId = 1;
}
message CreateWbsPlotRequest
{
int32 caseId = 1;
string wellPath = 2;
int32 timeStep = 3;
}
message ImportWellPathsRequest
{
string wellPathFolder = 1;
repeated string wellPathFiles = 2;
}
message ImportWellLogFilesRequest
{
string wellLogFolder = 1;
repeated string wellLogFiles = 2;
}
message ImportFormationNamesRequest
{
repeated string formationFiles = 1;
int32 applyToCaseId = 2;
}
enum ExportFormat
{
LAS = 0;
ASCII = 1;
}
message ExportWellLogPlotDataRequest
{
ExportFormat exportFormat = 1;
int32 viewId = 2;
string exportFolder = 3;
string filePrefix = 4;
bool exportTvdRkb = 5;
bool capitalizeFileNames = 6;
double resampleInterval = 7;
}
/* CommandParams handles both command name and parameters in one.
* The message type and content is used as parameters and
* the name of the variable is used to find the command name. */
@ -310,6 +353,11 @@ message CommandParams
ExportFlowInfoRequest exportFlowCharacteristics = 29;
CreateViewRequest createView = 30;
CloneViewRequest cloneView = 31;
CreateWbsPlotRequest createWellBoreStabilityPlot = 32;
ImportWellPathsRequest importWellPaths = 33;
ImportWellLogFilesRequest importWellLogFiles = 34;
ImportFormationNamesRequest importFormationNames = 35;
ExportWellLogPlotDataRequest exportWellLogPlotData = 36;
}
}
@ -329,17 +377,41 @@ message CreateViewResult
int32 viewId = 1;
}
message CreateWbsPlotResult
{
int32 viewId = 1;
}
message ImportWellPathsResult
{
repeated string wellPathNames = 1;
}
message ImportWellLogFilesResult
{
repeated string wellPathNames = 1;
}
message ExportWellLogPlotDataResult
{
repeated string exportedFiles = 1;
}
/* Command reply handles the return values for the generic command
* The name of the variable is used to map to the cafPdmObject classKeyword */
message CommandReply
{
oneof result
{
Empty emptyResult = 1;
CaseRequest loadCaseResult = 2;
GridCaseGroupResult createGridCaseGroupResult = 3;
CreateStatisticsCaseResult createStatisticsCaseResult = 4;
CreateViewResult createViewResult = 5;
Empty emptyResult = 1;
CaseRequest loadCaseResult = 2;
GridCaseGroupResult createGridCaseGroupResult = 3;
CreateStatisticsCaseResult createStatisticsCaseResult = 4;
CreateViewResult createViewResult = 5;
CreateWbsPlotResult createWbsPlotResult = 6;
ImportWellPathsResult importWellPathsResult = 7;
ImportWellLogFilesResult importWellLogFilesResult = 8;
ExportWellLogPlotDataResult exportWellLogPlotDataResult = 9;
}
}

View File

@ -14,7 +14,9 @@ if resinsight is not None:
print ("Got " + str(len(cases)) + " cases: ")
for case in cases:
print("Case id: " + str(case.case_id))
print("Case name: " + case.name)
print("Case type: " + case.type)
print("Case grid path: " + case.grid_path())
timesteps = case.time_steps()

View File

@ -0,0 +1,30 @@
import os
# Load ResInsight Processing Server Client Library
import rips
# Connect to ResInsight instance
resInsight = rips.Instance.find()
cases = resInsight.project.cases()
well_paths = resInsight.project.import_well_paths(well_path_folder='D:/Projects/ResInsight-regression-test/ModelData/Norne_LessWellPaths')
well_log_files = resInsight.project.import_well_log_files(well_log_folder='D:/Projects/ResInsight-regression-test/ModelData/Norne_PLT_LAS')
if len(well_paths) < 1:
print("No well paths in project")
exit(1)
print(well_paths)
for case in cases:
if case.type == "GeoMechCase":
print (case.case_id)
case_path = case.grid_path()
folder_name = os.path.dirname(case_path)
case.import_formation_names(formation_files=['D:/Projects/ResInsight-regression-test/ModelData/norne/Norne_ATW2013.lyr'])
# create a folder to hold the snapshots
dirname = os.path.join(folder_name, 'snapshots')
print("Exporting to: " + dirname)
for well_path in well_paths:
wbsplot = case.create_well_bore_stability_plot(well_path=well_path, time_step=0)
wbsplot.export_snapshot(export_folder=dirname)

View File

@ -5,6 +5,7 @@
import rips
import grpc
import tempfile
resinsight = rips.Instance.find()
@ -14,7 +15,25 @@ case = None
try:
case = resinsight.project.load_case("Nonsense")
except grpc.RpcError as e:
print("Expected Server Exception Received: ", e)
print("Expected Server Exception Received while loading case: ", e)
# Try loading well paths from a non-existing folder. We should get a grpc.RpcError exception from the server
try:
well_path_files = resinsight.project.import_well_paths(well_path_folder="NONSENSE/NONSENSE")
except grpc.RpcError as e:
print("Expected Server Exception Received while loading wellpaths: ", e)
# Try loading well paths from an existing but empty folder. We should get a warning.
try:
with tempfile.TemporaryDirectory() as tmpdirname:
well_path_files = resinsight.project.import_well_paths(well_path_folder=tmpdirname)
assert(len(well_path_files) == 0)
assert(resinsight.project.has_warnings())
print("Should get warnings below")
for warning in resinsight.project.warnings():
print (warning)
except grpc.RpcError as e:
print("Unexpected Server Exception caught!!!", e)
case = resinsight.project.case(case_id=0)
if case is not None:
@ -53,5 +72,5 @@ if case is not None:
except IndexError:
print ("Got expected index out of bounds error on client side")

View File

@ -0,0 +1,18 @@
# Import the tempfile module
import tempfile
# Load ResInsight Processing Server Client Library
import rips
# Connect to ResInsight instance
resInsight = rips.Instance.find()
# Get a list of all plots
plots = resInsight.project.plots()
export_folder = tempfile.mkdtemp()
print("Exporting to: " + export_folder)
for plot in plots:
plot.export_snapshot(export_folder=export_folder)
plot.export_data_as_las(export_folder=export_folder)
plot.export_data_as_ascii(export_folder=export_folder)

View File

@ -0,0 +1,32 @@
# Load ResInsight Processing Server Client Library
import rips
# Connect to ResInsight instance
resInsight = rips.Instance.find()
well_path_names = resInsight.project.import_well_paths(well_path_folder='D:/Projects/ResInsight-regression-test/ModelData/norne/wellpaths')
if resInsight.project.has_warnings():
for warning in resInsight.project.warnings():
print(warning)
for well_path_name in well_path_names:
print("Imported from folder: " + well_path_name)
well_path_names = resInsight.project.import_well_paths(well_path_files=['D:/Projects/ResInsight-regression-test/ModelData/Norne_WellPaths/E-3H.json',
'D:/Projects/ResInsight-regression-test/ModelData/Norne_WellPaths/C-1H.json'])
if resInsight.project.has_warnings():
for warning in resInsight.project.warnings():
print(warning)
for well_path_name in well_path_names:
print("Imported from indivdual files: " + well_path_name)
well_path_names = resInsight.project.import_well_log_files(well_log_folder='D:/Projects/ResInsight-regression-test/ModelData/Norne_PLT_LAS')
if resInsight.project.has_warnings():
for warning in resInsight.project.warnings():
print(warning)
for well_path_name in well_path_names:
print("Imported well log file for: " + well_path_name)

View File

@ -9,4 +9,5 @@ from rips.grid import Grid
from rips.instance import Instance
from rips.pdmobject import PdmObject
from rips.view import View
from rips.project import Project
from rips.project import Project
from rips.plot import Plot

View File

@ -25,7 +25,7 @@ class Case(PdmObject):
Operate on a ResInsight case specified by a Case Id integer.
Not meant to be constructed separately but created by one of the following
methods in Project: loadCase, case, allCases, selectedCasesq
methods in Project: loadCase, case, allCases, selectedCases
Attributes:
id (int): Case Id corresponding to case Id in ResInsight project.
@ -37,11 +37,12 @@ class Case(PdmObject):
However we need overhead space, so the default is 8160.
This leaves 256B for overhead.
"""
def __init__(self, channel, case_id):
def __init__(self, channel, case_id, project):
# Private properties
self.__channel = channel
self.__case_stub = Case_pb2_grpc.CaseStub(channel)
self.__request = Case_pb2.CaseRequest(id=case_id)
self.__project = project
info = self.__case_stub.GetCaseInfo(self.__request)
self.__properties_stub = Properties_pb2_grpc.PropertiesStub(
@ -51,7 +52,9 @@ class Case(PdmObject):
# Public properties
self.case_id = case_id
self.group_id = info.group_id
self.name = info.name
self.type = info.type
self.chunk_size = 8160
def __grid_count(self):
@ -248,16 +251,17 @@ class Case(PdmObject):
self._execute_command(createView=Cmd.CreateViewRequest(
caseId=self.case_id)).createViewResult.viewId)
def export_snapshots_of_all_views(self, prefix=""):
def export_snapshots_of_all_views(self, prefix="", export_folder=""):
""" Export snapshots for all views in the case
Arguments:
prefix (str): Exported file name prefix
export_folder(str): The path to export to. By default will use the global export folder
"""
return self._execute_command(
exportSnapshots=Cmd.ExportSnapshotsRequest(
type="VIEWS", prefix=prefix, caseId=self.case_id, viewId=-1))
type="VIEWS", prefix=prefix, caseId=self.case_id, viewId=-1, exportFolder=export_folder))
def export_well_path_completions(
self,
@ -732,3 +736,33 @@ class Case(PdmObject):
undefinedValue=undefined_value,
exportFile=export_file,
))
def create_well_bore_stability_plot(self, well_path, time_step):
""" Create a new well bore stability plot
Arguments:
well_path(str): well path name
time_step(int): time step
Returns:
A new plot object
"""
plot_result = self._execute_command(createWellBoreStabilityPlot=Cmd.CreateWbsPlotRequest(caseId=self.case_id,
wellPath=well_path,
timeStep=time_step))
return self.__project.plot(view_id=plot_result.createWbsPlotResult.viewId)
def import_formation_names(self, formation_files=None):
""" Import formation names into project and apply it to the current case
Arguments:
formation_files(list): list of files to import
"""
if formation_files is None:
formation_files = []
elif isinstance(formation_files, str):
formation_files = [formation_files]
res = self._execute_command(importFormationNames=Cmd.ImportFormationNamesRequest(formationFiles=formation_files,
applyToCaseId=self.case_id))

View File

@ -14,14 +14,27 @@ class PdmObject:
"""
def _execute_command(self, **command_params):
return self._commands.Execute(Cmd.CommandParams(**command_params))
self.__warnings = []
response, call = self._commands.Execute.with_call(Cmd.CommandParams(**command_params))
for key, value in call.trailing_metadata():
value = value.replace(';;', '\n')
if key == 'warning':
self.__warnings.append(value)
return response
def __init__(self, pb2_object, channel):
self._pb2_object = pb2_object
self._channel = channel
self._pdm_object_stub = PdmObject_pb2_grpc.PdmObjectServiceStub(
self._channel)
self._pdm_object_stub = PdmObject_pb2_grpc.PdmObjectServiceStub(self._channel)
self._commands = CmdRpc.CommandsStub(channel)
self.__warnings = []
def warnings(self):
return self.__warnings
def has_warnings(self):
return len(self.__warnings) > 0
def pb2_object(self):
""" Private method"""

View File

@ -0,0 +1,73 @@
"""
ResInsight 2d plot module
"""
import rips.generated.Commands_pb2 as Cmd
from rips.pdmobject import PdmObject
class Plot(PdmObject):
"""ResInsight plot class
Attributes:
view_id(int): View Id corresponding to the View Id in ResInsight project.
"""
def __init__(self, pdm_object):
PdmObject.__init__(self, pdm_object.pb2_object(), pdm_object.channel())
self.view_id = pdm_object.get_value("ViewId")
def export_snapshot(self, export_folder='', file_prefix='', ):
""" Export snapshot for the current plot
Arguments:
export_folder(str): The path to export to. By default will use the global export folder
prefix (str): Exported file name prefix
"""
return self._execute_command(
exportSnapshots=Cmd.ExportSnapshotsRequest(type='PLOTS',
prefix=file_prefix,
viewId=self.view_id,
exportFolder=export_folder))
def export_data_as_las(self, export_folder, file_prefix='', export_tvdrkb=False, capitalize_file_names=False, resample_interval=0.0):
""" Export LAS file(s) for the current plot
Arguments:
export_folder(str): The path to export to. By default will use the global export folder
file_prefix (str): Exported file name prefix
export_tvdrkb(bool): Export in TVD-RKB format
capitalize_file_names(bool): Make all file names upper case
resample_interval(double): if > 0.0 the files will be resampled
Returns:
A list of files exported
"""
res = self._execute_command(exportWellLogPlotData=Cmd.ExportWellLogPlotDataRequest(exportFormat='LAS',
viewId=self.view_id,
exportFolder=export_folder,
filePrefix=file_prefix,
exportTvdRkb=export_tvdrkb,
capitalizeFileNames=capitalize_file_names,
resampleInterval=resample_interval))
return res.exportWellLogPlotDataResult.exportedFiles
def export_data_as_ascii(self, export_folder, file_prefix='', capitalize_file_names=False):
""" Export LAS file(s) for the current plot
Arguments:
export_folder(str): The path to export to. By default will use the global export folder
file_prefix (str): Exported file name prefix
capitalize_file_names(bool): Make all file names upper case
Returns:
A list of files exported
"""
res = self._execute_command(exportWellLogPlotData=Cmd.ExportWellLogPlotDataRequest(exportFormat='ASCII',
viewId=self.view_id,
exportFolder=export_folder,
filePrefix=file_prefix,
exportTvdRkb=False,
capitalizeFileNames=capitalize_file_names,
resampleInterval=0.0))
return res.exportWellLogPlotDataResult.exportedFiles

View File

@ -8,6 +8,7 @@ import grpc
from rips.case import Case
from rips.gridcasegroup import GridCaseGroup
from rips.pdmobject import PdmObject
from rips.plot import Plot
from rips.view import View
import rips.generated.Commands_pb2 as Cmd
@ -49,7 +50,7 @@ class Project(PdmObject):
"""
command_reply = self._execute_command(loadCase=Cmd.FilePathRequest(
path=path))
return Case(self._channel, command_reply.loadCaseResult.id)
return Case(self._channel, command_reply.loadCaseResult.id, self)
def selected_cases(self):
"""Get a list of all cases selected in the project tree
@ -60,7 +61,7 @@ class Project(PdmObject):
case_infos = self._project_stub.GetSelectedCases(Empty())
cases = []
for case_info in case_infos.data:
cases.append(Case(self._channel, case_info.id))
cases.append(Case(self._channel, case_info.id, self))
return cases
def cases(self):
@ -74,7 +75,7 @@ class Project(PdmObject):
cases = []
for case_info in case_infos.data:
cases.append(Case(self._channel, case_info.id))
cases.append(Case(self._channel, case_info.id, self))
return cases
except grpc.RpcError as rpc_error:
if rpc_error.code() == grpc.StatusCode.NOT_FOUND:
@ -91,7 +92,7 @@ class Project(PdmObject):
A rips Case object
"""
try:
case = Case(self._channel, case_id)
case = Case(self._channel, case_id, self)
return case
except grpc.RpcError:
return None
@ -133,7 +134,7 @@ class Project(PdmObject):
"""Get a particular view belonging to a case by providing view id
Arguments:
id(int): view id
view_id(int): view id
Returns: a view object
"""
views = self.views()
@ -142,6 +143,34 @@ class Project(PdmObject):
return view_object
return None
def plots(self):
"""Get a list of all plots belonging to a project"""
pdm_objects = self.descendants("RimPlot")
plot_list = []
for pdm_object in pdm_objects:
plot_list.append(Plot(pdm_object))
return plot_list
def plot(self, view_id):
"""Get a particular plot by providing view id
Arguments:
view_id(int): view id
Returns: a plot object
"""
plots = self.plots()
for plot_object in plots:
if plot_object.view_id == view_id:
return plot_object
return None
def well_paths(self):
"""Get a list of all the well path names in the project"""
pdm_objects = self.descendants("WellPathBase")
well_path_list = []
for pdm_object in pdm_objects:
well_path_list.append(pdm_object.get_value("WellPathName"))
return well_path_list
def grid_case_groups(self):
"""Get a list of all grid case groups in the project"""
case_groups = self.descendants("RimIdenticalGridCaseGroup")
@ -230,3 +259,52 @@ class Project(PdmObject):
return self._execute_command(
setFractureContainment=Cmd.SetFracContainmentRequest(
id=template_id, topLayer=top_layer, baseLayer=base_layer))
def import_well_paths(self, well_path_files=None, well_path_folder=''):
""" Import well paths into project
Arguments:
well_path_files(list): List of file paths to import
well_path_folder(str): A folder path containing files to import
Returns:
A list of well path names (strings)
"""
if well_path_files is None:
well_path_files = []
res = self._execute_command(importWellPaths=Cmd.ImportWellPathsRequest(wellPathFolder=well_path_folder,
wellPathFiles=well_path_files))
return res.importWellPathsResult.wellPathNames
def import_well_log_files(self, well_log_files=None, well_log_folder=''):
""" Import well log files into project
Arguments:
well_log_files(list): List of file paths to import
well_log_folder(str): A folder path containing files to import
Returns:
A list of well path names (strings) that had logs imported
"""
if well_log_files is None:
well_log_files = []
res = self._execute_command(importWellLogFiles=Cmd.ImportWellLogFilesRequest(wellLogFolder=well_log_folder,
wellLogFiles=well_log_files))
return res.importWellLogFilesResult.wellPathNames
def import_formation_names(self, formation_files=None):
""" Import formation names into project
Arguments:
formation_files(list): list of files to import
"""
if formation_files is None:
formation_files = []
elif isinstance(formation_files, str):
formation_files = [formation_files]
res = self._execute_command(importFormationNames=Cmd.ImportFormationNamesRequest(formationFiles=formation_files,
applyToCaseId=-1))

View File

@ -11,7 +11,7 @@ class View(PdmObject):
"""ResInsight view class
Attributes:
id(int): View Id corresponding to the View Id in ResInsight project.
view_id(int): View Id corresponding to the View Id in ResInsight project.
"""
def __init__(self, pdm_object):
@ -195,15 +195,17 @@ class View(PdmObject):
viewIds=[self.view_id],
undefinedValue=undefined_value))
def export_snapshot(self, prefix=''):
def export_snapshot(self, prefix='', export_folder=''):
""" Export snapshot for the current view
Arguments:
prefix (str): Exported file name prefix
export_folder(str): The path to export to. By default will use the global export folder
"""
case_id = self.case().case_id
return self._execute_command(
exportSnapshots=Cmd.ExportSnapshotsRequest(type='VIEWS',
prefix=prefix,
caseId=case_id,
viewId=self.view_id))
viewId=self.view_id,
exportFolder=export_folder))

View File

@ -262,10 +262,9 @@ grpc::Status RiaGrpcCaseService::GetTimeSteps( grpc::ServerContext* context,
{
RimCase* rimCase = findCase( request->id() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
if ( eclipseCase )
if ( rimCase )
{
std::vector<QDateTime> timeStepDates = eclipseCase->timeStepDates();
std::vector<QDateTime> timeStepDates = rimCase->timeStepDates();
for ( QDateTime dateTime : timeStepDates )
{
rips::TimeStepDate* date = reply->add_dates();
@ -278,7 +277,7 @@ grpc::Status RiaGrpcCaseService::GetTimeSteps( grpc::ServerContext* context,
}
return grpc::Status::OK;
}
return grpc::Status( grpc::NOT_FOUND, "Eclipse Case not found" );
return grpc::Status( grpc::NOT_FOUND, "Case not found" );
}
//--------------------------------------------------------------------------------------------------
@ -349,11 +348,10 @@ grpc::Status RiaGrpcCaseService::GetPdmObject( grpc::ServerContext* context,
const rips::CaseRequest* request,
rips::PdmObject* reply )
{
RimCase* rimCase = findCase( request->id() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
if ( eclipseCase )
RimCase* rimCase = findCase( request->id() );
if ( rimCase )
{
copyPdmObjectFromCafToRips( eclipseCase, reply );
copyPdmObjectFromCafToRips( rimCase, reply );
}
return grpc::Status::OK;
}

View File

@ -94,11 +94,11 @@ grpc::Status
RicfCommandResponse response = commandHandle->execute();
if ( response.status() == RicfCommandResponse::COMMAND_ERROR )
{
return grpc::Status( grpc::FAILED_PRECONDITION, response.message().toStdString() );
return grpc::Status( grpc::FAILED_PRECONDITION, response.sanitizedResponseMessage().toStdString() );
}
else if ( response.status() == RicfCommandResponse::COMMAND_WARNING )
{
context->AddInitialMetadata( "warning", response.message().toStdString() );
context->AddTrailingMetadata( "warning", response.sanitizedResponseMessage().toStdString() );
}
assignResultToReply( response.result(), reply );
@ -243,7 +243,23 @@ void RiaGrpcCommandService::assignGrpcFieldValue( Message* repl
{
if ( fieldDescriptor->is_repeated() )
{
CAF_ASSERT( false && "Assigning vector results to Command Results is not yet implemented" );
auto reflection = reply->GetReflection();
QVariant qValue = pdmValueField->toQVariant();
if ( fieldDescriptor->type() == FieldDescriptor::TYPE_STRING )
{
MutableRepeatedFieldRef<std::string> repeatedField =
reflection->GetMutableRepeatedFieldRef<std::string>( reply, fieldDescriptor );
QStringList stringList = qValue.toStringList();
for ( QString stringValue : stringList )
{
repeatedField.Add( stringValue.toStdString() );
}
}
else
{
CAF_ASSERT( false && "Assigning vector results to Command Results is only implemented for strings" );
}
return;
}
FieldDescriptor::Type fieldDataType = fieldDescriptor->type();

View File

@ -72,6 +72,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMainPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.h
@ -211,6 +212,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMainPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.cpp

View File

@ -366,6 +366,7 @@ QList<caf::PdmOptionItemInfo>
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
{
// Ensure a case is selected if one is available
RimProject* proj = nullptr;

View File

@ -18,7 +18,10 @@
#include "RimFlowPlotCollection.h"
#include "RiaApplication.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RimProject.h"
#include "RimWellAllocationPlot.h"
#include "cafProgressInfo.h"
@ -145,6 +148,7 @@ RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot()
{
m_defaultWellAllocPlot = new RimWellAllocationPlot;
m_defaultWellAllocPlot->setDescription( "Default Flow Diagnostics Plot" );
RiaApplication::instance()->project()->assignViewIdToView( m_flowCharacteristicsPlot );
}
this->updateConnectedEditors();
@ -160,6 +164,7 @@ RimFlowCharacteristicsPlot* RimFlowPlotCollection::defaultFlowCharacteristicsPlo
if ( !m_flowCharacteristicsPlot() )
{
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
RiaApplication::instance()->project()->assignViewIdToView( m_flowCharacteristicsPlot );
}
this->updateConnectedEditors();

View File

@ -419,6 +419,8 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add( &m_showInfoBox );
uiOrdering.add( &m_showLegend );

View File

@ -23,8 +23,8 @@
#include "RiaDefines.h"
#include "RimNameConfig.h"
#include "RimPlot.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include "RimViewWindow.h"
#include <QPointer>
@ -49,7 +49,7 @@ protected:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
};
class RimGridCrossPlot : public RimViewWindow, public RimRiuQwtPlotOwnerInterface, public RimNameConfigHolderInterface
class RimGridCrossPlot : public RimPlot, public RimRiuQwtPlotOwnerInterface, public RimNameConfigHolderInterface
{
CAF_PDM_HEADER_INIT;

View File

@ -17,7 +17,9 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimGridCrossPlotCollection.h"
#include "RiaApplication.h"
#include "RimGridCrossPlot.h"
#include "RimProject.h"
CAF_PDM_SOURCE_INIT( RimGridCrossPlotCollection, "RimGridCrossPlotCollection" );
@ -60,6 +62,7 @@ RimGridCrossPlot* RimGridCrossPlotCollection::createGridCrossPlot()
{
RimGridCrossPlot* plot = new RimGridCrossPlot();
plot->setAsPlotMdiWindow();
RiaApplication::instance()->project()->assignViewIdToView( plot );
// plot->setDescription(QString("Summary Cross Plot %1").arg(m_gridCrossPlots.size()));
addGridCrossPlot( plot );

View File

@ -18,12 +18,15 @@
#include "RimSaturationPressurePlotCollection.h"
#include "RiaApplication.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigEquil.h"
#include "RimEclipseResultCase.h"
#include "RimProject.h"
#include "RimSaturationPressurePlot.h"
CAF_PDM_SOURCE_INIT( RimSaturationPressurePlotCollection, "RimSaturationPressurePlotCollection" );
@ -89,6 +92,7 @@ std::vector<RimSaturationPressurePlot*>
{
RimSaturationPressurePlot* plot = new RimSaturationPressurePlot();
plot->setAsPlotMdiWindow();
RiaApplication::instance()->project()->assignViewIdToView( plot );
// As discussed with Liv Merete, it is not any use for creation of different plots for matrix/fracture. For
// now, use hardcoded value for MATRIX

View File

@ -127,10 +127,6 @@ Rim3dView::Rim3dView( void )
CAF_PDM_InitField( &m_showZScaleLabel, "ShowZScale", true, "Show Z Scale Label", "", "", "" );
RICF_InitField( &m_viewId, "ViewId", -1, "View ID", "", "", "" );
m_viewId.uiCapability()->setUiReadOnly( true );
m_viewId.capability<RicfFieldHandle>()->setIOWriteable( false );
m_crossSectionVizModel = new cvf::ModelBasicList;
m_crossSectionVizModel->setName( "CrossSectionModel" );
@ -185,22 +181,6 @@ QString Rim3dView::name() const
return m_nameConfig->customName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int Rim3dView::id() const
{
return m_viewId;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::setId( int id )
{
m_viewId = id;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -304,7 +284,7 @@ void Rim3dView::deleteViewWidget()
//--------------------------------------------------------------------------------------------------
void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_viewId );
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroupWithKeyword( "Viewer", "ViewGroup" );

View File

@ -109,9 +109,6 @@ public:
void setName( const QString& name );
QString name() const;
int id() const;
void setId( int id );
// Implementation of RiuViewerToViewInterface
cvf::Color3f backgroundColor() const override
{
@ -290,5 +287,4 @@ private:
caf::PdmField<cvf::Color3f> m_backgroundColor;
caf::PdmField<bool> m_showGridBox;
caf::PdmField<bool> m_showZScaleLabel;
caf::PdmField<int> m_viewId;
};

View File

@ -43,6 +43,8 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCase, "RimCase" );
RimCase::RimCase()
: m_isInActiveDestruction( false )
{
CAF_PDM_InitObject( "Case", ":/Case48x48.png", "", "" );
RICF_InitField( &caseUserDescription, "CaseUserDescription", QString(), "Case Name", "", "", "" );
RICF_InitField( &caseId, "CaseId", -1, "Case ID", "", "", "" );
@ -173,3 +175,14 @@ QList<caf::PdmOptionItemInfo> RimCase::calculateValueOptions( const caf::PdmFiel
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCase::initAfterRead()
{
if ( caseId() == -1 )
{
RiaApplication::instance()->project()->assignCaseIdToCase( this );
}
}

View File

@ -82,6 +82,7 @@ protected:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
virtual std::vector<Rim3dView*> allSpecialViews() const = 0;
void initAfterRead() override;
private:
caf::PdmFieldHandle* userDescriptionField() override

View File

@ -25,6 +25,7 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCheckableNamedObject, "CheckableNamedObject
//--------------------------------------------------------------------------------------------------
RimCheckableNamedObject::RimCheckableNamedObject( void )
{
CAF_PDM_InitObject( "Checkable object", "", "", "" );
CAF_PDM_InitField( &m_isChecked, "IsChecked", true, "Active", "", "", "" );
m_isChecked.uiCapability()->setUiHidden( true );
}

View File

@ -75,6 +75,8 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimEclipseCase, "RimReservoir" );
//--------------------------------------------------------------------------------------------------
RimEclipseCase::RimEclipseCase()
{
CAF_PDM_InitObject( "EclipseCase", ":/Case48x48.png", "", "" );
CAF_PDM_InitFieldNoDefault( &reservoirViews, "ReservoirViews", "", "", "", "" );
reservoirViews.uiCapability()->setUiHidden( true );
@ -246,6 +248,8 @@ const RigMainGrid* RimEclipseCase::mainGrid() const
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::initAfterRead()
{
RimCase::initAfterRead();
size_t j;
for ( j = 0; j < reservoirViews().size(); j++ )
{

View File

@ -160,6 +160,8 @@ void RimEclipseContourMapView::updateCurrentTimeStepAndRedraw()
//--------------------------------------------------------------------------------------------------
void RimEclipseContourMapView::initAfterRead()
{
RimEclipseView::initAfterRead();
disablePerspectiveProjectionField();
setShowGridBox( false );
meshMode.setValue( RiaDefines::NO_MESH );

View File

@ -12,6 +12,8 @@ CAF_PDM_SOURCE_INIT( RimFileWellPath, "WellPath" );
//--------------------------------------------------------------------------------------------------
RimFileWellPath::RimFileWellPath()
{
CAF_PDM_InitObject( "File Well Path", ":/Well.png", "", "" );
CAF_PDM_InitFieldNoDefault( &id, "WellPathId", "Id", "", "", "" );
id.uiCapability()->setUiReadOnly( true );
id.xmlCapability()->disableIO();

View File

@ -23,6 +23,7 @@
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RicfCommandObject.h"
#include "RifOdbReader.h"
#include "RigFemPartCollection.h"
@ -63,7 +64,7 @@ RimGeoMechCase::RimGeoMechCase( void )
{
CAF_PDM_InitObject( "Geomechanical Case", ":/GeoMechCase48x48.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_caseFileName, "CaseFileName", "Case File Name", "", "", "" );
RICF_InitFieldNoDefault( &m_caseFileName, "CaseFileName", "Case File Name", "", "", "" );
m_caseFileName.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &geoMechViews, "GeoMechViews", "", "", "", "" );
geoMechViews.uiCapability()->setUiHidden( true );
@ -387,6 +388,8 @@ std::vector<QDateTime> RimGeoMechCase::timeStepDates() const
//--------------------------------------------------------------------------------------------------
void RimGeoMechCase::initAfterRead()
{
RimCase::initAfterRead();
size_t j;
for ( j = 0; j < geoMechViews().size(); j++ )
{

View File

@ -172,6 +172,8 @@ bool RimGeoMechContourMapView::isTimeStepDependentDataVisible() const
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::initAfterRead()
{
RimGeoMechView::initAfterRead();
m_gridCollection->setActive( false ); // This is also not added to the tree view, so cannot be enabled.
disablePerspectiveProjectionField();
setShowGridBox( false );

View File

@ -109,6 +109,7 @@ protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void initAfterRead() override;
void createPartCollectionFromSelection( cvf::Collection<cvf::Part>* parts ) override;
void createDisplayModel() override;
@ -130,8 +131,6 @@ private:
void updateTensorLegendTextAndRanges( RimRegularLegendConfig* legendConfig, int timeStepIndex );
void initAfterRead() override;
caf::PdmChildField<RimTensorResults*> m_tensorResults;
caf::PdmChildField<RimGeoMechPropertyFilterCollection*> m_propertyFilterCollection;
caf::PdmPointer<RimGeoMechPropertyFilterCollection> m_overridePropertyFilterCollection;

View File

@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RimPlot.h"
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlot, "RimPlot" ); // Do not use. Abstract class
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot::RimPlot()
{
CAF_PDM_InitObject( "Plot", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimPlot::createPlotWidget()
{
return createViewWidget( nullptr );
}

View File

@ -0,0 +1,31 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RimNameConfig.h"
#include "RimViewWindow.h"
class RimPlot : public RimViewWindow
{
CAF_PDM_HEADER_INIT;
public:
RimPlot();
QWidget* createPlotWidget();
};

View File

@ -73,6 +73,7 @@
#include "RimValveTemplateCollection.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "RimViewWindow.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
@ -100,18 +101,11 @@ CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" );
//--------------------------------------------------------------------------------------------------
RimProject::RimProject( void )
{
CAF_PDM_InitObject( "Project", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_projectFileVersionString, "ProjectFileVersionString", "", "", "", "" );
m_projectFileVersionString.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &nextValidCaseId, "NextValidCaseId", 0, "Next Valid Case ID", "", "", "" );
nextValidCaseId.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &nextValidCaseGroupId, "NextValidCaseGroupId", 0, "Next Valid Case Group ID", "", "", "" );
nextValidCaseGroupId.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &nextValidViewId, "NextValidViewId", 0, "Next Valid View ID", "", "", "" );
nextValidViewId.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &oilFields, "OilFields", "Oil Fields", "", "", "" );
oilFields.uiCapability()->setUiHidden( true );
@ -244,9 +238,6 @@ void RimProject::close()
fileName = "";
nextValidCaseId = 0;
nextValidCaseGroupId = 0;
nextValidViewId = 0;
mainWindowCurrentModelIndexPath = "";
mainWindowTreeViewState = "";
plotWindowCurrentModelIndexPath = "";
@ -477,9 +468,17 @@ void RimProject::assignCaseIdToCase( RimCase* reservoirCase )
{
if ( reservoirCase )
{
reservoirCase->caseId = nextValidCaseId;
int nextValidCaseId = 0;
nextValidCaseId = nextValidCaseId + 1;
std::vector<RimCase*> cases;
this->descendantsIncludingThisOfType( cases );
for ( RimCase* rimCase : cases )
{
nextValidCaseId = std::max( nextValidCaseId, rimCase->caseId() + 1 );
}
reservoirCase->caseId = nextValidCaseId;
}
}
@ -490,21 +489,38 @@ void RimProject::assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup )
{
if ( caseGroup )
{
caseGroup->groupId = nextValidCaseGroupId;
int nextValidCaseGroupId = 0;
nextValidCaseGroupId = nextValidCaseGroupId + 1;
std::vector<RimIdenticalGridCaseGroup*> identicalCaseGroups;
this->descendantsIncludingThisOfType( identicalCaseGroups );
for ( RimIdenticalGridCaseGroup* existingCaseGroup : identicalCaseGroups )
{
nextValidCaseGroupId = std::max( nextValidCaseGroupId, existingCaseGroup->groupId() + 1 );
}
caseGroup->groupId = nextValidCaseGroupId;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::assignViewIdToView( Rim3dView* view )
void RimProject::assignViewIdToView( RimViewWindow* view )
{
if ( view )
{
int nextValidViewId = 0;
std::vector<RimViewWindow*> viewWindows;
this->descendantsIncludingThisOfType( viewWindows );
for ( RimViewWindow* existingView : viewWindows )
{
nextValidViewId = std::max( nextValidViewId, existingView->id() + 1 );
}
view->setId( nextValidViewId );
nextValidViewId = nextValidViewId + 1;
}
}

View File

@ -59,6 +59,7 @@ class Rim3dView;
class RimGridView;
class RimViewLinker;
class RimViewLinkerCollection;
class RimViewWindow;
class RimWellPath;
class RimWellPathImport;
class RimFractureTemplateCollection;
@ -115,7 +116,7 @@ public:
void assignCaseIdToCase( RimCase* reservoirCase );
void assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup );
void assignViewIdToView( Rim3dView* view );
void assignViewIdToView( RimViewWindow* view );
void allCases( std::vector<RimCase*>& cases ) const;
@ -199,10 +200,6 @@ private:
caf::PdmField<bool> m_subWindowsTiled3DWindow;
caf::PdmField<bool> m_subWindowsTiledPlotWindow;
caf::PdmField<int> nextValidCaseId; // Unique case ID within a project, used to identify a case from scripts
caf::PdmField<int> nextValidCaseGroupId; // Unique case group ID within a project, used to identify a case group from scripts
caf::PdmField<int> nextValidViewId; // Unique view ID within a project, used to identify a view from scripts
caf::PdmChildArrayField<RimEclipseCase*> casesObsolete; // obsolete
caf::PdmChildArrayField<RimIdenticalGridCaseGroup*> caseGroupsObsolete; // obsolete
};

View File

@ -18,10 +18,13 @@
#include "RimViewWindow.h"
#include "RiaApplication.h"
#include "RiaFieldHandleTools.h"
#include "RiaGuiApplication.h"
#include "RicfCommandObject.h"
#include "RimMdiWindowController.h"
#include "RimProject.h"
#include "cvfAssert.h"
@ -34,10 +37,16 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimViewWindow, "ViewWindow" ); // Do not use.
//--------------------------------------------------------------------------------------------------
RimViewWindow::RimViewWindow( void )
{
CAF_PDM_InitObject( "View window", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_windowController, "WindowController", "", "", "", "" );
m_windowController.uiCapability()->setUiHidden( true );
m_windowController.uiCapability()->setUiTreeChildrenHidden( true );
RICF_InitField( &m_viewId, "ViewId", -1, "View ID", "", "", "" );
m_viewId.uiCapability()->setUiReadOnly( true );
m_viewId.capability<RicfFieldHandle>()->setIOWriteable( false );
CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window", "", "", "" );
m_showWindow.uiCapability()->setUiHidden( true );
@ -54,6 +63,22 @@ RimViewWindow::~RimViewWindow( void )
if ( m_windowController() ) delete m_windowController();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimViewWindow::id() const
{
return m_viewId;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::setId( int id )
{
m_viewId = id;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -252,4 +277,16 @@ void RimViewWindow::initAfterRead()
setAsMdiWindow( mainWindowID );
setMdiWindowGeometry( wg );
}
if ( m_viewId() == -1 )
{
RiaApplication::instance()->project()->assignViewIdToView( this );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_viewId );
}

View File

@ -61,6 +61,9 @@ public:
RimViewWindow( void );
~RimViewWindow( void ) override;
int id() const;
void setId( int id );
void loadDataAndUpdate();
void handleMdiWindowClosed();
void updateMdiWindowVisibility();
@ -124,13 +127,17 @@ protected:
const QVariant& oldValue,
const QVariant& newValue ) override;
void initAfterRead() override;
caf::PdmField<bool> m_showWindow;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
void setAsMdiWindow( int mainWindowID );
protected:
caf::PdmField<bool> m_showWindow;
private:
caf::PdmChildField<RimMdiWindowController*> m_windowController;
caf::PdmField<int> m_viewId;
// Obsoleted field
caf::PdmField<std::vector<int>> obsoleteField_windowGeometry;

View File

@ -125,6 +125,8 @@ double RimWellBoreStabilityPlot::userDefinedUcs() const
//--------------------------------------------------------------------------------------------------
void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
m_commonDataSource->uiOrdering( uiConfigName, uiOrdering );
caf::PdmUiGroup* parameterSources = uiOrdering.addNewGroup( "Parameter Sources" );

View File

@ -489,6 +489,11 @@ void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength,
measuredDepthValues = geomExtractor->cellIntersectionMDs();
tvDepthValues = geomExtractor->cellIntersectionTVDs();
if ( measuredDepthValues.empty() )
{
return;
}
findAndLoadWbsParametersFromLasFiles( m_wellPath(), geomExtractor.p() );
RimWellBoreStabilityPlot* wbsPlot;
this->firstAncestorOrThisOfType( wbsPlot );

View File

@ -40,6 +40,7 @@
#include <QFileInfo>
#include <QMessageBox>
#include <QString>
#include <QStringList>
CAF_PDM_SOURCE_INIT( RimWellLogFile, "WellLogFile" );
@ -110,33 +111,20 @@ RimWellLogFile::~RimWellLogFile()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFile* RimWellLogFile::readWellLogFile( const QString& logFilePath )
RimWellLogFile* RimWellLogFile::readWellLogFile( const QString& logFilePath, QString* errorMessage )
{
CAF_ASSERT( errorMessage );
QFileInfo fi( logFilePath );
RimWellLogFile* wellLogFile = nullptr;
if ( fi.suffix().toUpper().compare( "LAS" ) == 0 )
{
QString errorMessage;
wellLogFile = new RimWellLogFile();
wellLogFile->setFileName( logFilePath );
if ( !wellLogFile->readFile( &errorMessage ) )
if ( !wellLogFile->readFile( errorMessage ) )
{
QString displayMessage = "Could not open the LAS file: \n" + logFilePath;
if ( !errorMessage.isEmpty() )
{
displayMessage += "\n\n";
displayMessage += errorMessage;
}
if ( RiaGuiApplication::isRunning() )
{
QMessageBox::warning( Riu3DMainWindowTools::mainWindowWidget(), "File open error", displayMessage );
}
RiaLogging::warning( errorMessage );
delete wellLogFile;
wellLogFile = nullptr;
}
@ -181,15 +169,10 @@ bool RimWellLogFile::readFile( QString* errorMessage )
}
else if ( !isDateValid( m_date() ) )
{
QMessageBox msgBox;
QString message =
*errorMessage =
QString(
"The LAS-file '%1' contains no recognizable date. Please assign a date in the LAS-file property panel" )
.arg( m_name() );
msgBox.setText( message );
msgBox.setStandardButtons( QMessageBox::Ok );
msgBox.exec();
m_date = DEFAULT_DATE_TIME;
}

View File

@ -46,7 +46,7 @@ public:
RimWellLogFile();
~RimWellLogFile() override;
static RimWellLogFile* readWellLogFile( const QString& logFilePath );
static RimWellLogFile* readWellLogFile( const QString& logFilePath, QString* errorMessage );
void setFileName( const QString& fileName );
QString fileName() const

View File

@ -176,14 +176,6 @@ RimWellLogPlot::~RimWellLogPlot()
delete m_nameConfig;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimWellLogPlot::createPlotWidget()
{
return createViewWidget( nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -283,8 +275,10 @@ QImage RimWellLogPlot::snapshotWindowContent()
if ( m_viewer )
{
m_viewer->setScrollbarVisible( false );
QPixmap pix = m_viewer->grab();
image = pix.toImage();
m_viewer->setScrollbarVisible( true );
}
return image;
@ -795,6 +789,8 @@ void RimWellLogPlot::depthZoomMinMax( double* minimumDepth, double* maximumDepth
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
m_commonDataSource->uiOrdering( uiConfigName, uiOrdering );
uiOrderingForDepthAxis( uiOrdering );
uiOrderingForPlotSettings( uiOrdering );
@ -943,7 +939,7 @@ void RimWellLogPlot::setDescription( const QString& description )
//--------------------------------------------------------------------------------------------------
QString RimWellLogPlot::description() const
{
return createAutoName();
return m_nameConfig->customName();
}
//--------------------------------------------------------------------------------------------------
@ -975,6 +971,8 @@ void RimWellLogPlot::deleteViewWidget()
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::initAfterRead()
{
RimViewWindow::initAfterRead();
updateCommonDataSource();
if ( !m_userName_OBSOLETE().isEmpty() )
{

View File

@ -26,6 +26,7 @@
#include "cafPdmObject.h"
#include "RiaDefines.h"
#include "RimPlot.h"
#include "RimViewWindow.h"
#include "RimWellLogPlotNameConfig.h"
@ -42,7 +43,7 @@ class QKeyEvent;
///
///
//==================================================================================================
class RimWellLogPlot : public RimViewWindow, public RimNameConfigHolderInterface
class RimWellLogPlot : public RimPlot, public RimNameConfigHolderInterface
{
CAF_PDM_HEADER_INIT;
@ -70,7 +71,6 @@ public:
RimWellLogPlot& operator=( RimWellLogPlot&& rhs );
QWidget* createPlotWidget();
QWidget* viewWidget() override;
void setDescription( const QString& description );

View File

@ -26,6 +26,8 @@
#include "RiaSimWellBranchTools.h"
#include "RiaWellNameComparer.h"
#include "RicfCommandObject.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
@ -73,7 +75,7 @@ RimWellPath::RimWellPath()
{
CAF_PDM_InitObject( "WellPath", ":/Well.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_name, "WellPathName", "Name", "", "", "" );
RICF_InitFieldNoDefault( &m_name, "WellPathName", "Name", "", "", "" );
m_name.uiCapability()->setUiReadOnly( true );
m_name.uiCapability()->setUiHidden( true );
m_name.xmlCapability()->disableIO();

View File

@ -198,8 +198,10 @@ void RimWellPathCollection::loadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::addWellPaths( QStringList filePaths )
std::vector<RimFileWellPath*> RimWellPathCollection::addWellPaths( QStringList filePaths, QStringList* errorMessages )
{
CAF_ASSERT( errorMessages );
std::vector<RimFileWellPath*> wellPathArray;
for ( QString filePath : filePaths )
@ -221,6 +223,7 @@ void RimWellPathCollection::addWellPaths( QStringList filePaths )
{
// printf("Attempting to open well path JSON file that is already open:\n %s\n", (const char*) filePath.toLocal8Bit());
alreadyOpen = true;
errorMessages->push_back( QString( "%1 is already loaded" ).arg( filePath ) );
break;
}
}
@ -254,6 +257,8 @@ void RimWellPathCollection::addWellPaths( QStringList filePaths )
scheduleRedrawAffectedViews();
updateAllRequiredEditors();
return wellPathArray;
}
//--------------------------------------------------------------------------------------------------
@ -315,13 +320,20 @@ void RimWellPathCollection::addWellPaths( const std::vector<RimWellPath*> incomi
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFile* RimWellPathCollection::addWellLogs( const QStringList& filePaths )
std::vector<RimWellLogFile*> RimWellPathCollection::addWellLogs( const QStringList& filePaths, QStringList* errorMessages )
{
RimWellLogFile* logFileInfo = nullptr;
CAF_ASSERT( errorMessages );
std::vector<RimWellLogFile*> logFileInfos;
foreach ( QString filePath, filePaths )
{
logFileInfo = RimWellLogFile::readWellLogFile( filePath );
QString errorMessage;
RimWellLogFile* logFileInfo = RimWellLogFile::readWellLogFile( filePath, &errorMessage );
if ( !errorMessage.isEmpty() )
{
errorMessages->push_back( errorMessage );
}
if ( logFileInfo )
{
RimWellPath* wellPath = tryFindMatchingWellPath( logFileInfo->wellName() );
@ -332,13 +344,14 @@ RimWellLogFile* RimWellPathCollection::addWellLogs( const QStringList& filePaths
}
wellPath->addWellLogFile( logFileInfo );
logFileInfos.push_back( logFileInfo );
}
}
this->sortWellsByName();
updateAllRequiredEditors();
return logFileInfo;
return logFileInfos;
}
//--------------------------------------------------------------------------------------------------

View File

@ -88,8 +88,8 @@ public:
caf::PdmChildArrayField<RimWellPath*> wellPaths;
void loadDataAndUpdate();
void addWellPaths( QStringList filePaths );
void loadDataAndUpdate();
std::vector<RimFileWellPath*> addWellPaths( QStringList filePaths, QStringList* errorMessages );
void removeWellPath( RimWellPath* wellPath );
void deleteAllWellPaths();
@ -99,11 +99,11 @@ public:
void readWellPathFormationFiles();
void reloadAllWellPathFormations();
RimWellPath* wellPathByName( const QString& wellPathName ) const;
RimWellPath* tryFindMatchingWellPath( const QString& wellName ) const;
void addWellPaths( const std::vector<RimWellPath*> incomingWellPaths );
RimWellLogFile* addWellLogs( const QStringList& filePaths );
void addWellPathFormations( const QStringList& filePaths );
RimWellPath* wellPathByName( const QString& wellPathName ) const;
RimWellPath* tryFindMatchingWellPath( const QString& wellName ) const;
void addWellPaths( const std::vector<RimWellPath*> incomingWellPaths );
std::vector<RimWellLogFile*> addWellLogs( const QStringList& filePaths, QStringList* errorMessages );
void addWellPathFormations( const QStringList& filePaths );
void scheduleRedrawAffectedViews();

View File

@ -52,10 +52,10 @@
#include "RiuSummaryQwtPlot.h"
#include "cafPdmObject.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiLineEditor.h"
#include "cvfScalarMapper.h"
@ -112,8 +112,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddressUiField, "SelectedVariableDisplayVar", "Vector", "", "", "" );
m_yValuesSummaryAddressUiField.xmlCapability()->disableIO();
m_yValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
m_yValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddress, "SummaryAddress", "Summary Address", "", "", "" );
m_yValuesSummaryAddress.uiCapability()->setUiHidden( true );
@ -122,7 +121,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
CAF_PDM_InitFieldNoDefault( &m_yPushButtonSelectSummaryAddress, "SelectAddress", "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_yPushButtonSelectSummaryAddress );
m_yPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_yPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_yPushButtonSelectSummaryAddress = false;
CAF_PDM_InitField( &m_colorMode, "ColorMode", caf::AppEnum<ColorMode>( SINGLE_COLOR ), "Coloring Mode", "", "", "" );
@ -174,9 +173,8 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter", "", "", "" );
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true );
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiHidden( true );
m_yValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable(false);
m_yValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false );
m_yValuesSummaryFilter_OBSOLETE = new RimSummaryFilter_OBSOLETE;
}
//--------------------------------------------------------------------------------------------------
@ -220,7 +218,7 @@ void RimEnsembleCurveSet::setColor( cvf::Color3f color )
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSet::loadDataAndUpdate( bool updateParentPlot )
{
m_yValuesSummaryAddressUiField = m_yValuesSummaryAddress->address();
m_yValuesSummaryAddressUiField = m_yValuesSummaryAddress->address();
updateAllCurves();
@ -637,10 +635,9 @@ void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector Y" );
curveDataGroup->add( &m_yValuesSummaryCaseCollection );
curveDataGroup->add( &m_yValuesSummaryAddressUiField );
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, {false, 1, 0});
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, {false, 1, 0} );
curveDataGroup->add( &m_plotAxis );
}
}
caf::PdmUiGroup* colorsGroup = uiOrdering.addNewGroup( "Colors" );
m_colorMode.uiCapability()->setUiReadOnly( !m_yValuesSummaryCaseCollection() );
@ -805,7 +802,7 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions( const
/// Optimization candidate
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSet::appendOptionItemsForSummaryAddresses( QList<caf::PdmOptionItemInfo>* options,
RimSummaryCaseCollection* summaryCaseGroup)
RimSummaryCaseCollection* summaryCaseGroup )
{
if ( !summaryCaseGroup ) return;

View File

@ -18,6 +18,8 @@
#include "RimSummaryCrossPlotCollection.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include "RimSummaryCrossPlot.h"
#include "RimSummaryPlot.h"
@ -87,6 +89,7 @@ RimSummaryPlot* RimSummaryCrossPlotCollection::createSummaryPlot()
{
RimSummaryPlot* plot = new RimSummaryCrossPlot();
plot->setAsPlotMdiWindow();
RiaApplication::instance()->project()->assignViewIdToView( plot );
plot->setDescription( QString( "Summary Cross Plot %1" ).arg( m_summaryCrossPlots.size() ) );

View File

@ -1606,6 +1606,8 @@ void RimSummaryPlot::setAsCrossPlot()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
caf::PdmUiGroup* mainOptions = uiOrdering.addNewGroup( "General Plot Options" );
mainOptions->add( &m_showPlotTitle );
@ -1686,6 +1688,8 @@ void RimSummaryPlot::deleteViewWidget()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::initAfterRead()
{
RimViewWindow::initAfterRead();
// Move summary curves from obsolete storage to the new curve collection
std::vector<RimSummaryCurve*> curvesToMove;

View File

@ -24,8 +24,8 @@
#include "RifEclipseSummaryAddress.h"
#include "RimPlot.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include "RimViewWindow.h"
#include "qwt_plot_textlabel.h"
@ -64,7 +64,7 @@ class QKeyEvent;
///
///
//==================================================================================================
class RimSummaryPlot : public RimViewWindow, public RimRiuQwtPlotOwnerInterface
class RimSummaryPlot : public RimPlot, public RimRiuQwtPlotOwnerInterface
{
CAF_PDM_HEADER_INIT;

View File

@ -18,6 +18,8 @@
#include "RimSummaryPlotCollection.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include "RimSummaryPlot.h"
CAF_PDM_SOURCE_INIT( RimSummaryPlotCollection, "SummaryPlotCollection" );
@ -48,6 +50,7 @@ RimSummaryPlot* RimSummaryPlotCollection::createSummaryPlotWithAutoTitle()
{
RimSummaryPlot* plot = new RimSummaryPlot();
plot->setAsPlotMdiWindow();
RiaApplication::instance()->project()->assignViewIdToView( plot );
plot->enableAutoPlotTitle( true );
summaryPlots.push_back( plot );
@ -62,6 +65,7 @@ RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString&
{
RimSummaryPlot* plot = new RimSummaryPlot();
plot->setAsPlotMdiWindow();
RiaApplication::instance()->project()->assignViewIdToView( plot );
summaryPlots.push_back( plot );
plot->setDescription( name );

View File

@ -96,13 +96,16 @@ void RigGeoMechWellLogExtractor::performCurveDataSmoothing( int
interfacePorePressuresDbl[i] = interfacePorePressures[i];
}
std::vector<std::vector<double>*> dependentValues = {tvds, &interfaceShValuesDbl, &interfacePorePressuresDbl};
if ( !mds->empty() && !values->empty() )
{
std::vector<std::vector<double>*> dependentValues = {tvds, &interfaceShValuesDbl, &interfacePorePressuresDbl};
std::vector<unsigned char> smoothOrFilterSegments = determineFilteringOrSmoothing( interfacePorePressuresDbl );
filterShortSegments( mds, values, &smoothOrFilterSegments, dependentValues );
filterColinearSegments( mds, values, &smoothOrFilterSegments, dependentValues );
std::vector<unsigned char> smoothOrFilterSegments = determineFilteringOrSmoothing( interfacePorePressuresDbl );
filterShortSegments( mds, values, &smoothOrFilterSegments, dependentValues );
filterColinearSegments( mds, values, &smoothOrFilterSegments, dependentValues );
smoothSegments( mds, tvds, values, interfaceShValuesDbl, smoothOrFilterSegments, smoothingTreshold );
smoothSegments( mds, tvds, values, interfaceShValuesDbl, smoothOrFilterSegments, smoothingTreshold );
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -374,10 +374,12 @@ void RigLasFileExporter::setRkbDiffs( const std::vector<QString>& wellNames, con
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigLasFileExporter::writeToFolder( const QString& exportFolder,
const QString& filePrefix /*= ""*/,
bool capitalizeFileName /*= false*/ )
std::vector<QString> RigLasFileExporter::writeToFolder( const QString& exportFolder,
const QString& filePrefix /*= ""*/,
bool capitalizeFileName /*= false*/ )
{
std::vector<QString> writtenFiles;
std::vector<SingleLasFileMetaData> lasFileDescriptions = createLasFileDescriptions( m_curves );
applyUserDefinedRkbOffsets( &lasFileDescriptions );
@ -414,9 +416,13 @@ bool RigLasFileExporter::writeToFolder( const QString& exportFolder,
std::vector<std::string> commentHeader;
lasFile.WriteToFile( fullPathName.toStdString(), commentHeader );
if ( QFileInfo::exists( fullPathName ) )
{
writtenFiles.push_back( fullPathName );
}
}
return true;
return writtenFiles;
}
//--------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,8 @@ public:
void wellPathsAndRkbDiff( std::vector<QString>* wellNames, std::vector<double>* rkbDiffs );
void setRkbDiffs( const std::vector<QString>& wellNames, const std::vector<double>& rkbDiffs );
bool writeToFolder( const QString& exportFolder, const QString& filePrefix = "", bool capitalizeFileName = false );
std::vector<QString>
writeToFolder( const QString& exportFolder, const QString& filePrefix = "", bool capitalizeFileName = false );
private:
std::vector<SingleLasFileMetaData> createLasFileDescriptions( const std::vector<RimWellLogCurve*>& curves );

View File

@ -38,9 +38,12 @@
#include "RimPlotAxisProperties.h"
#include "RiuPlotAnnotationTool.h"
#include "qwt_scale_draw.h"
#include "qwt_scale_widget.h"
#include "qwt_text.h"
#include "qwt_text_engine.h"
#include <QGraphicsDropShadowEffect>
#include <QLabel>
#include <QMenu>
#include <QResizeEvent>
@ -65,6 +68,22 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimViewWindow* ownerViewWindow, QWidge
m_selectedPointMarker->setSymbol( mySymbol );
m_selectedPointMarker->setLabelAlignment( Qt::AlignRight | Qt::AlignVCenter );
m_selectedPointMarker->setSpacing( 3 );
canvas()->setContentsMargins( 0, 0, 0, 0 );
QFrame* canvasFrame = dynamic_cast<QFrame*>( canvas() );
canvasFrame->setFrameShape( QFrame::Box );
canvasFrame->setStyleSheet( "border: 1px solid black" );
QGraphicsDropShadowEffect* dropShadowEffect = new QGraphicsDropShadowEffect( canvas() );
dropShadowEffect->setOffset( 1.0, 1.0 );
dropShadowEffect->setBlurRadius( 3.0 );
dropShadowEffect->setColor( QColor( 60, 60, 60, 60 ) );
canvas()->setGraphicsEffect( dropShadowEffect );
axisScaleDraw( QwtPlot::xBottom )->enableComponent( QwtAbstractScaleDraw::Backbone, false );
axisScaleDraw( QwtPlot::yLeft )->enableComponent( QwtAbstractScaleDraw::Backbone, false );
axisWidget( QwtPlot::xBottom )->setMargin( 0 );
axisWidget( QwtPlot::yLeft )->setMargin( 0 );
}
//--------------------------------------------------------------------------------------------------
@ -227,6 +246,7 @@ void RiuGridCrossQwtPlot::updateInfoBoxLayout()
}
}
QStringList infoText;
infoText << QString( "<b>View ID:</b> %1<br/>" ).arg( crossPlot->id() );
if ( curveInfoTexts.size() > 1 )
{
infoText += QString( "<ol style=\"margin-top: 0px; margin-left: 15px; -qt-list-indent:0;\">" );

View File

@ -78,7 +78,7 @@ void RiuQwtPlotCurve::setSamplesFromXValuesAndYValues( const std::vector<double>
ErrorAxis errorAxis )
{
CVF_ASSERT( xValues.size() == yValues.size() );
CVF_ASSERT( yErrorValues.empty() || yErrorValues.size() == xValues.size() );
CVF_ASSERT( errorValues.empty() || errorValues.size() == xValues.size() );
bool showErrorBars = m_showErrorBars && !errorValues.empty();
QPolygonF points;

View File

@ -214,6 +214,14 @@ void RiuWellLogPlot::setTitleVisible( bool visible )
m_plotTitle->setVisible( visible );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setScrollbarVisible( bool visible )
{
m_scrollBar->setVisible( visible );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More