mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #5246 from OPM/feature-external-file-reference-list-in-project-file
Feature: #5147 External file reference list in project file
This commit is contained in:
commit
b01c4409f1
@ -316,7 +316,7 @@ bool RiaApplication::openFile( const QString& fileName )
|
||||
}
|
||||
else if ( fileType & RiaDefines::ANY_ECLIPSE_FILE )
|
||||
{
|
||||
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{ fileName }, true );
|
||||
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{fileName}, true );
|
||||
lastUsedDialogTag = RiaDefines::defaultDirectoryLabel( fileType );
|
||||
}
|
||||
|
||||
@ -701,7 +701,7 @@ bool RiaApplication::saveProjectAs( const QString& fileName, QString* errorMessa
|
||||
|
||||
onProjectBeingSaved();
|
||||
|
||||
if ( !m_project->writeFile() )
|
||||
if ( !m_project->writeProjectFile() )
|
||||
{
|
||||
CAF_ASSERT( errorMessage );
|
||||
*errorMessage = QString( "Not possible to save project file. Make sure you have sufficient access "
|
||||
|
@ -218,7 +218,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
|
||||
{
|
||||
std::vector<RigCompletionData> fractureCompletions;
|
||||
|
||||
if ( !caseToApply || !caseToApply->eclipseCaseData() )
|
||||
if ( !caseToApply || !caseToApply->eclipseCaseData() || !wellPathGeometry )
|
||||
{
|
||||
return fractureCompletions;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ std::vector<RigCompletionData>
|
||||
{
|
||||
std::vector<RigCompletionData> completionData;
|
||||
|
||||
if ( !wellPath || !wellPath->completions() )
|
||||
if ( !wellPath || !wellPath->completions() || !wellPath->wellPathGeometry() )
|
||||
{
|
||||
return completionData;
|
||||
}
|
||||
@ -197,7 +197,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
|
||||
const RimWellPath* wellPath,
|
||||
const RicExportCompletionDataSettingsUi& settings )
|
||||
{
|
||||
if ( !wellPath ) return;
|
||||
if ( !wellPath || !wellPath->wellPathGeometry() ) return;
|
||||
|
||||
// Generate data
|
||||
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
|
||||
|
@ -1168,7 +1168,12 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeatureImpl::gener
|
||||
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
|
||||
|
||||
std::vector<RigCompletionData> completionData;
|
||||
const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(
|
||||
if ( !wellPath || !wellPath->wellPathGeometry() )
|
||||
{
|
||||
return completionData;
|
||||
}
|
||||
|
||||
const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(
|
||||
RiaDefines::MATRIX_MODEL );
|
||||
|
||||
if ( wellPath->perforationIntervalCollection()->isChecked() )
|
||||
|
@ -254,7 +254,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createWellFileLocationText( co
|
||||
if ( fileWellPath )
|
||||
{
|
||||
formatter.add( wellPath->name() );
|
||||
formatter.add( fileWellPath->filepath() );
|
||||
formatter.add( fileWellPath->filePath() );
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered( bool isChecked )
|
||||
&errorMsg );
|
||||
if ( isOk )
|
||||
{
|
||||
inputProperty->fileName = exportSettings.fileName;
|
||||
inputProperty->fileName = exportSettings.fileName();
|
||||
inputProperty->eclipseKeyword = exportSettings.eclipseKeyword;
|
||||
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
||||
|
||||
|
@ -21,9 +21,12 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimFileWellPath.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellPathImport.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuWellImportWizard.h"
|
||||
|
||||
@ -82,8 +85,7 @@ void RicWellPathsImportSsihubFeature::onActionTriggered( bool isChecked )
|
||||
// Update the UTM bounding box from the reservoir
|
||||
app->project()->computeUtmAreaOfInterest();
|
||||
|
||||
QString wellPathsFolderPath = RimTools::getCacheRootDirectoryPathFromProject();
|
||||
wellPathsFolderPath += "_wellpaths";
|
||||
QString wellPathsFolderPath = RimFileWellPath::getCacheDirectoryPath();
|
||||
QDir::root().mkpath( wellPathsFolderPath );
|
||||
|
||||
if ( !app->project()->wellPathImport() ) return;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RimWellPathImport.h"
|
||||
|
||||
#include "RimFileWellPath.h"
|
||||
#include "RimOilFieldEntry.h"
|
||||
#include "RimOilRegionEntry.h"
|
||||
#include "RimTools.h"
|
||||
@ -224,8 +225,7 @@ RimWellPathImport::~RimWellPathImport()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathImport::updateFilePaths()
|
||||
{
|
||||
QString wellPathsFolderPath = RimTools::getCacheRootDirectoryPathFromProject();
|
||||
wellPathsFolderPath += "_wellpaths";
|
||||
QString wellPathsFolderPath = RimFileWellPath::getCacheDirectoryPath();
|
||||
|
||||
for ( size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++ )
|
||||
{
|
||||
|
@ -323,6 +323,11 @@ message ExportContourMapToTextRequest
|
||||
int32 viewId = 5;
|
||||
}
|
||||
|
||||
message SaveProjectRequest
|
||||
{
|
||||
string filePath = 1;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
@ -372,6 +377,7 @@ message CommandParams
|
||||
ExportWellLogPlotDataRequest exportWellLogPlotData = 36;
|
||||
SetWindowSizeParams setPlotWindowSize = 37;
|
||||
ExportContourMapToTextRequest exportContourMapToText = 38;
|
||||
SaveProjectRequest saveProject = 39;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,14 @@ class Project(PdmObject):
|
||||
"""
|
||||
self._execute_command(openProject=Cmd.FilePathRequest(path=path))
|
||||
return self
|
||||
|
||||
def save(self, path=""):
|
||||
"""Save the project to the existing project file, or to a new file
|
||||
Arguments:
|
||||
path(str): File path to the file to save the project to. If empty, saves to the active project file
|
||||
"""
|
||||
self._execute_command(saveProject=Cmd.SaveProjectRequest(filePath=path))
|
||||
return self
|
||||
|
||||
def close(self):
|
||||
"""Close the current project (and open new blank project)"""
|
||||
|
@ -69,7 +69,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate()
|
||||
|
||||
CAF_PDM_InitObject("Fracture Template", ":/FractureTemplate16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_stimPlanFileName, "StimPlanFileName", QString(""), "File Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_stimPlanFileName, "StimPlanFileName", "File Name", "", "", "");
|
||||
m_stimPlanFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&m_wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Well/Fracture Intersection Depth", "", "", "");
|
||||
@ -171,9 +171,9 @@ void RimStimPlanFractureTemplate::setFileName( const QString& fileName )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RimStimPlanFractureTemplate::fileName()
|
||||
QString RimStimPlanFractureTemplate::fileName()
|
||||
{
|
||||
return m_stimPlanFileName();
|
||||
return m_stimPlanFileName().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -182,7 +182,7 @@ const QString& RimStimPlanFractureTemplate::fileName()
|
||||
void RimStimPlanFractureTemplate::updateFilePathsFromProjectPath( const QString& newProjectPath,
|
||||
const QString& oldProjectPath )
|
||||
{
|
||||
m_stimPlanFileName = RimTools::relocateFile( m_stimPlanFileName(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
// m_stimPlanFileName = RimTools::relocateFile( m_stimPlanFileName(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -253,7 +253,7 @@ void RimStimPlanFractureTemplate::loadDataAndUpdate()
|
||||
|
||||
if ( m_readError ) return;
|
||||
|
||||
m_stimPlanFractureDefinitionData = RifStimPlanXmlReader::readStimPlanXMLFile( m_stimPlanFileName(),
|
||||
m_stimPlanFractureDefinitionData = RifStimPlanXmlReader::readStimPlanXMLFile( m_stimPlanFileName().path(),
|
||||
m_conductivityScaleFactor(),
|
||||
m_halfLengthScaleFactor(),
|
||||
m_heightScaleFactor(),
|
||||
|
@ -56,8 +56,8 @@ public:
|
||||
void loadDataAndUpdate() override;
|
||||
void setDefaultsBasedOnXMLfile();
|
||||
|
||||
void setFileName( const QString& fileName );
|
||||
const QString& fileName();
|
||||
void setFileName( const QString& fileName );
|
||||
QString fileName();
|
||||
|
||||
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
|
||||
|
||||
@ -130,7 +130,7 @@ private:
|
||||
caf::PdmField<double> m_wellPathDepthAtFracture;
|
||||
caf::PdmField<QString> m_borderPolygonResultName;
|
||||
|
||||
caf::PdmField<QString> m_stimPlanFileName;
|
||||
caf::PdmField<caf::FilePath> m_stimPlanFileName;
|
||||
cvf::ref<RigStimPlanFractureDefinition> m_stimPlanFractureDefinitionData;
|
||||
cvf::ref<RigFractureGrid> m_fractureGrid;
|
||||
bool m_readError;
|
||||
|
@ -89,8 +89,8 @@ RimEclipseCase::RimEclipseCase()
|
||||
CAF_PDM_InitField( &m_flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "" );
|
||||
CAF_PDM_InitField( &m_flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filesContainingFaultsSemColSeparated, "CachedFileNamesContainingFaults", "", "", "", "" );
|
||||
m_filesContainingFaultsSemColSeparated.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_filesContainingFaults, "CachedFileNamesContainingFaults", "", "", "", "" );
|
||||
m_filesContainingFaults.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps", "", "", "" );
|
||||
m_contourMapCollection = new RimEclipseContourMapViewCollection;
|
||||
@ -746,12 +746,12 @@ const RimReservoirCellResultsStorage* RimEclipseCase::resultsStorage( RiaDefines
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RimEclipseCase::filesContainingFaults() const
|
||||
{
|
||||
QString separatedPaths = m_filesContainingFaultsSemColSeparated;
|
||||
QStringList pathList = separatedPaths.split( ";", QString::SkipEmptyParts );
|
||||
std::vector<QString> stdPathList;
|
||||
|
||||
for ( auto& path : pathList )
|
||||
stdPathList.push_back( path );
|
||||
for ( auto& filePath : m_filesContainingFaults() )
|
||||
{
|
||||
stdPathList.push_back( filePath.path() );
|
||||
}
|
||||
|
||||
return stdPathList;
|
||||
}
|
||||
@ -759,20 +759,15 @@ std::vector<QString> RimEclipseCase::filesContainingFaults() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCase::setFilesContainingFaults( const std::vector<QString>& val )
|
||||
void RimEclipseCase::setFilesContainingFaults( const std::vector<QString>& pathStrings )
|
||||
{
|
||||
QString separatedPaths;
|
||||
|
||||
for ( size_t i = 0; i < val.size(); ++i )
|
||||
std::vector<caf::FilePath> filePaths;
|
||||
for ( const auto& pathString : pathStrings )
|
||||
{
|
||||
const auto& path = val[i];
|
||||
separatedPaths += path;
|
||||
if ( !( i + 1 >= val.size() ) )
|
||||
{
|
||||
separatedPaths += ";";
|
||||
}
|
||||
filePaths.push_back( pathString );
|
||||
}
|
||||
m_filesContainingFaultsSemColSeparated = separatedPaths;
|
||||
|
||||
m_filesContainingFaults = filePaths;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -145,8 +145,8 @@ protected:
|
||||
caf::PdmChildField<RimEclipseInputPropertyCollection*> m_inputPropertyCollection;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_filesContainingFaultsSemColSeparated;
|
||||
caf::PdmField<bool> m_releaseResultMemory;
|
||||
caf::PdmField<std::vector<caf::FilePath>> m_filesContainingFaults;
|
||||
caf::PdmField<bool> m_releaseResultMemory;
|
||||
|
||||
caf::PdmChildField<RimEclipseContourMapViewCollection*> m_contourMapCollection;
|
||||
|
||||
|
@ -55,7 +55,7 @@ RimEclipseInputCase::RimEclipseInputCase()
|
||||
: RimEclipseCase()
|
||||
{
|
||||
CAF_PDM_InitObject( "RimInputCase", ":/EclipseInput48x48.png", "", "" );
|
||||
CAF_PDM_InitField( &m_gridFileName, "GridFileName", QString(), "Case File Name", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_gridFileName, "GridFileName", "Case File Name", "", "", "" );
|
||||
m_gridFileName.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_additionalFiles, "AdditionalFileNamesProxy", "Additional Files", "", "", "" );
|
||||
@ -190,16 +190,16 @@ bool RimEclipseInputCase::openEclipseGridFile()
|
||||
{
|
||||
cvf::ref<RifReaderInterface> readerInterface;
|
||||
|
||||
if ( m_gridFileName().contains( RiaDefines::mockModelBasicInputCase() ) )
|
||||
if ( m_gridFileName().path().contains( RiaDefines::mockModelBasicInputCase() ) )
|
||||
{
|
||||
readerInterface = this->createMockModel( this->m_gridFileName() );
|
||||
readerInterface = this->createMockModel( this->m_gridFileName().path() );
|
||||
}
|
||||
else
|
||||
{
|
||||
readerInterface = new RifReaderEclipseInput;
|
||||
|
||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( this );
|
||||
if ( !readerInterface->open( m_gridFileName, eclipseCase.p() ) )
|
||||
if ( !readerInterface->open( m_gridFileName().path(), eclipseCase.p() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -258,7 +258,7 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
|
||||
{
|
||||
filenames.push_back( fileName );
|
||||
}
|
||||
filenames.push_back( m_gridFileName );
|
||||
filenames.push_back( m_gridFileName().path() );
|
||||
|
||||
RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( inputPropertyCollection(),
|
||||
eclipseCaseData(),
|
||||
@ -302,7 +302,7 @@ cvf::ref<RifReaderInterface> RimEclipseInputCase::createMockModel( QString model
|
||||
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
|
||||
inputProperty->resultName = "PORO";
|
||||
inputProperty->eclipseKeyword = "PORO";
|
||||
inputProperty->fileName = "PORO.prop";
|
||||
inputProperty->fileName = QString( "PORO.prop" );
|
||||
m_inputPropertyCollection->inputProperties.push_back( inputProperty );
|
||||
}
|
||||
|
||||
@ -332,9 +332,9 @@ void RimEclipseInputCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseInputCase::locationOnDisc() const
|
||||
{
|
||||
if ( m_gridFileName().isEmpty() ) return QString();
|
||||
if ( m_gridFileName().path().isEmpty() ) return QString();
|
||||
|
||||
QFileInfo fi( m_gridFileName );
|
||||
QFileInfo fi( m_gridFileName().path() );
|
||||
return fi.absolutePath();
|
||||
}
|
||||
|
||||
@ -343,19 +343,19 @@ QString RimEclipseInputCase::locationOnDisc() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseInputCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
bool foundFile = false;
|
||||
std::vector<QString> searchedPaths;
|
||||
// bool foundFile = false;
|
||||
// std::vector<QString> searchedPaths;
|
||||
|
||||
m_gridFileName = RimTools::relocateFile( m_gridFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||
// m_gridFileName = RimTools::relocateFile( m_gridFileName().path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||
|
||||
for ( RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
|
||||
{
|
||||
inputProperty->fileName = RimTools::relocateFile( inputProperty->fileName,
|
||||
newProjectPath,
|
||||
oldProjectPath,
|
||||
&foundFile,
|
||||
&searchedPaths );
|
||||
}
|
||||
// for ( RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
|
||||
//{
|
||||
// inputProperty->fileName = RimTools::relocateFile( inputProperty->fileName,
|
||||
// newProjectPath,
|
||||
// oldProjectPath,
|
||||
// &foundFile,
|
||||
// &searchedPaths );
|
||||
//}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -366,8 +366,9 @@ void RimEclipseInputCase::updateAdditionalFileFolder( const QString& newFolder )
|
||||
QDir newDir( newFolder );
|
||||
for ( RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
|
||||
{
|
||||
if ( inputProperty->fileName == m_gridFileName ) continue;
|
||||
QFileInfo oldFilePath( inputProperty->fileName );
|
||||
if ( inputProperty->fileName == m_gridFileName().path() ) continue;
|
||||
|
||||
QFileInfo oldFilePath( inputProperty->fileName().path() );
|
||||
QFileInfo newFilePath( newDir, oldFilePath.fileName() );
|
||||
inputProperty->fileName = newFilePath.absoluteFilePath();
|
||||
}
|
||||
@ -381,8 +382,10 @@ std::vector<QString> RimEclipseInputCase::additionalFiles() const
|
||||
std::vector<QString> additionalFiles;
|
||||
for ( const RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
|
||||
{
|
||||
if ( inputProperty->fileName == m_gridFileName ) continue;
|
||||
additionalFiles.push_back( inputProperty->fileName );
|
||||
if ( inputProperty->fileName == m_gridFileName().path() ) continue;
|
||||
|
||||
additionalFiles.push_back( inputProperty->fileName().path() );
|
||||
}
|
||||
|
||||
return additionalFiles;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
QString locationOnDisc() const override;
|
||||
QString gridFileName() const override
|
||||
{
|
||||
return m_gridFileName();
|
||||
return m_gridFileName().path();
|
||||
}
|
||||
|
||||
void updateFilePathsFromProjectPath( const QString& projectPath, const QString& oldProjectPath ) override;
|
||||
@ -75,7 +75,7 @@ private:
|
||||
|
||||
private:
|
||||
// Fields
|
||||
caf::PdmField<QString> m_gridFileName;
|
||||
caf::PdmField<caf::FilePath> m_gridFileName;
|
||||
caf::PdmProxyValueField<std::vector<QString>> m_additionalFiles;
|
||||
|
||||
// Obsolete fields
|
||||
|
@ -58,7 +58,7 @@ RimEclipseInputProperty::RimEclipseInputProperty()
|
||||
|
||||
CAF_PDM_InitField( &resultName, "ResultName", QString(), "Result Name", "", "", "" );
|
||||
CAF_PDM_InitField( &eclipseKeyword, "EclipseKeyword", QString(), "Eclipse Keyword", "", "", "" );
|
||||
CAF_PDM_InitField( &fileName, "FileName", QString(), "Filename", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &fileName, "FileName", "Filename", "", "", "" );
|
||||
CAF_PDM_InitField( &resolvedState, "ResolvedState", (ResolveStateEnum)UNKNOWN, "Data State", "", "", "" );
|
||||
|
||||
resolvedState.uiCapability()->setUiReadOnly( true );
|
||||
|
@ -49,9 +49,10 @@ public:
|
||||
typedef caf::AppEnum<ResolveState> ResolveStateEnum;
|
||||
|
||||
// Fields:
|
||||
caf::PdmField<QString> resultName;
|
||||
caf::PdmField<QString> eclipseKeyword;
|
||||
caf::PdmField<QString> fileName; // ReadOnly Serves as key to syncronize read eclipse prop data and this inputProp object.
|
||||
caf::PdmField<QString> resultName;
|
||||
caf::PdmField<QString> eclipseKeyword;
|
||||
caf::PdmField<caf::FilePath> fileName; // ReadOnly Serves as key to syncronize
|
||||
// read eclipse prop data and this inputProp object.
|
||||
caf::PdmField<ResolveStateEnum> resolvedState; // ReadOnly and not writable
|
||||
|
||||
// PdmObject Overrides
|
||||
|
@ -56,7 +56,7 @@ std::vector<RimEclipseInputProperty*> RimEclipseInputPropertyCollection::findInp
|
||||
{
|
||||
if ( !inputProperties[i] ) continue;
|
||||
|
||||
QFileInfo propFile( inputProperties[i]->fileName() );
|
||||
QFileInfo propFile( inputProperties[i]->fileName().path() );
|
||||
if ( fileInfo == propFile ) result.push_back( inputProperties[i] );
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
{
|
||||
CAF_PDM_InitObject( "Eclipse Case", ":/Case48x48.png", "", "" );
|
||||
|
||||
RICF_InitField( &caseFileName, "CaseFileName", QString(), "Case File Name", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &caseFileName, "CaseFileName", "Case File Name", "", "", "" );
|
||||
caseFileName.uiCapability()->setUiReadOnly( true );
|
||||
caseFileName.capability<RicfFieldHandle>()->setIOWriteable( false );
|
||||
|
||||
@ -94,7 +94,7 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
m_flipYAxis.xmlCapability()->setIOWritable( true );
|
||||
// flipYAxis.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField( &m_sourSimFileName, "SourSimFileName", QString(), "SourSim File Name", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_sourSimFileName, "SourSimFileName", "SourSim File Name", "", "", "" );
|
||||
m_sourSimFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||
#ifndef USE_HDF5
|
||||
m_sourSimFileName.uiCapability()->setUiHidden( true );
|
||||
@ -127,13 +127,13 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
||||
|
||||
cvf::ref<RifReaderInterface> readerInterface;
|
||||
|
||||
if ( caseFileName().contains( "Result Mock Debug Model" ) )
|
||||
if ( caseFileName().path().contains( "Result Mock Debug Model" ) )
|
||||
{
|
||||
readerInterface = this->createMockModel( this->caseFileName() );
|
||||
readerInterface = this->createMockModel( this->caseFileName().path() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !caf::Utils::fileExists( caseFileName() ) )
|
||||
if ( !caf::Utils::fileExists( caseFileName().path() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -142,7 +142,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
||||
readerEclipseOutput->setFilenamesWithFaults( this->filesContainingFaults() );
|
||||
|
||||
cvf::ref<RifEclipseRestartDataAccess> restartDataAccess = RifEclipseOutputFileTools::createDynamicResultAccess(
|
||||
caseFileName() );
|
||||
caseFileName().path() );
|
||||
|
||||
{
|
||||
std::vector<QDateTime> timeSteps;
|
||||
@ -177,11 +177,12 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
||||
}
|
||||
m_timeStepFilter->updateFilteredTimeStepsFromUi();
|
||||
}
|
||||
|
||||
readerEclipseOutput->setFileDataAccess( restartDataAccess.p() );
|
||||
readerEclipseOutput->setTimeStepFilter( m_timeStepFilter->filteredTimeSteps() );
|
||||
|
||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( this );
|
||||
if ( !readerEclipseOutput->open( caseFileName(), eclipseCase.p() ) )
|
||||
if ( !readerEclipseOutput->open( caseFileName().path(), eclipseCase.p() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -209,7 +210,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
||||
m_gridAndWellDataIsReadFromFile = true;
|
||||
m_activeCellInfoIsReadFromFile = true;
|
||||
|
||||
QFileInfo eclipseCaseFileInfo( caseFileName() );
|
||||
QFileInfo eclipseCaseFileInfo( caseFileName().path() );
|
||||
QString rftFileName = eclipseCaseFileInfo.path() + "/" + eclipseCaseFileInfo.completeBaseName() + ".RFT";
|
||||
QFileInfo rftFileInfo( rftFileName );
|
||||
|
||||
@ -224,10 +225,10 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
||||
m_flowDiagSolutions.push_back( new RimFlowDiagSolution() );
|
||||
}
|
||||
|
||||
if ( !m_sourSimFileName().isEmpty() )
|
||||
if ( !m_sourSimFileName().path().isEmpty() )
|
||||
{
|
||||
RifReaderEclipseOutput* outReader = dynamic_cast<RifReaderEclipseOutput*>( readerInterface.p() );
|
||||
outReader->setHdf5FileName( m_sourSimFileName() );
|
||||
outReader->setHdf5FileName( m_sourSimFileName().path() );
|
||||
}
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
@ -274,13 +275,13 @@ bool RimEclipseResultCase::openAndReadActiveCellData( RigEclipseCaseData* mainEc
|
||||
if ( m_activeCellInfoIsReadFromFile ) return true;
|
||||
|
||||
cvf::ref<RifReaderInterface> readerInterface;
|
||||
if ( caseFileName().contains( "Result Mock Debug Model" ) )
|
||||
if ( caseFileName().path().contains( "Result Mock Debug Model" ) )
|
||||
{
|
||||
readerInterface = this->createMockModel( this->caseFileName() );
|
||||
readerInterface = this->createMockModel( this->caseFileName().path() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !caf::Utils::fileExists( caseFileName() ) )
|
||||
if ( !caf::Utils::fileExists( caseFileName().path() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -292,7 +293,7 @@ bool RimEclipseResultCase::openAndReadActiveCellData( RigEclipseCaseData* mainEc
|
||||
|
||||
std::vector<QDateTime> timeStepDates = mainEclipseCase->results( RiaDefines::MATRIX_MODEL )->timeStepDates();
|
||||
cvf::ref<RifReaderEclipseOutput> readerEclipseOutput = new RifReaderEclipseOutput;
|
||||
if ( !readerEclipseOutput->openAndReadActiveCellData( caseFileName(), timeStepDates, eclipseCase.p() ) )
|
||||
if ( !readerEclipseOutput->openAndReadActiveCellData( caseFileName().path(), timeStepDates, eclipseCase.p() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -322,7 +323,7 @@ void RimEclipseResultCase::loadAndUpdateSourSimData()
|
||||
{
|
||||
if ( !results( RiaDefines::MATRIX_MODEL ) ) return;
|
||||
|
||||
results( RiaDefines::MATRIX_MODEL )->setHdf5Filename( m_sourSimFileName );
|
||||
results( RiaDefines::MATRIX_MODEL )->setHdf5Filename( m_sourSimFileName().path() );
|
||||
|
||||
if ( !hasSourSimFile() )
|
||||
{
|
||||
@ -468,7 +469,7 @@ RimEclipseResultCase::~RimEclipseResultCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseResultCase::locationOnDisc() const
|
||||
{
|
||||
QFileInfo fi( caseFileName() );
|
||||
QFileInfo fi( caseFileName().path() );
|
||||
return fi.absolutePath();
|
||||
}
|
||||
|
||||
@ -477,7 +478,7 @@ QString RimEclipseResultCase::locationOnDisc() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::readGridDimensions( std::vector<std::vector<int>>& gridDimensions )
|
||||
{
|
||||
RifEclipseOutputFileTools::readGridDimensions( caseFileName(), gridDimensions );
|
||||
RifEclipseOutputFileTools::readGridDimensions( caseFileName().path(), gridDimensions );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -485,22 +486,22 @@ void RimEclipseResultCase::readGridDimensions( std::vector<std::vector<int>>& gr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
bool foundFile = false;
|
||||
std::vector<QString> searchedPaths;
|
||||
// bool foundFile = false;
|
||||
// std::vector<QString> searchedPaths;
|
||||
|
||||
// Update filename and folder paths when opening project from a different file location
|
||||
caseFileName = RimTools::relocateFile( caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||
// caseFileName = RimTools::relocateFile( caseFileName().path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||
|
||||
std::vector<QString> relocatedFaultFiles;
|
||||
const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
|
||||
for ( auto faultFileName : orgFilesContainingFaults )
|
||||
{
|
||||
QString relocatedFaultFile =
|
||||
RimTools::relocateFile( faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||
relocatedFaultFiles.push_back( relocatedFaultFile );
|
||||
}
|
||||
|
||||
setFilesContainingFaults( relocatedFaultFiles );
|
||||
// std::vector<QString> relocatedFaultFiles;
|
||||
// const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
|
||||
// for ( auto faultFileName : orgFilesContainingFaults )
|
||||
// {
|
||||
// QString relocatedFaultFile =
|
||||
// RimTools::relocateFile( faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||
// relocatedFaultFiles.push_back( relocatedFaultFile );
|
||||
// }
|
||||
//
|
||||
// setFilesContainingFaults( relocatedFaultFiles );
|
||||
|
||||
#if 0 // Output the search path for debugging
|
||||
for (size_t i = 0; i < searchedPaths.size(); ++i)
|
||||
@ -586,7 +587,7 @@ void RimEclipseResultCase::setSourSimFileName( const QString& fileName )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultCase::hasSourSimFile()
|
||||
{
|
||||
return !m_sourSimFileName().isEmpty();
|
||||
return !m_sourSimFileName().path().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -597,7 +598,7 @@ void RimEclipseResultCase::initAfterRead()
|
||||
RimEclipseCase::initAfterRead();
|
||||
|
||||
// Convert from old (9.0.2) way of storing the case file
|
||||
if ( caseFileName().isEmpty() )
|
||||
if ( caseFileName().path().isEmpty() )
|
||||
{
|
||||
if ( !this->m_caseName_OBSOLETE().isEmpty() && !caseDirectory().isEmpty() )
|
||||
{
|
||||
@ -658,7 +659,7 @@ void RimEclipseResultCase::defineEditorAttribute( const caf::PdmFieldHandle* fie
|
||||
if ( myAttr )
|
||||
{
|
||||
myAttr->m_fileSelectionFilter = "SourSim (*.sourres)";
|
||||
myAttr->m_defaultPath = QFileInfo( caseFileName() ).absolutePath();
|
||||
myAttr->m_defaultPath = QFileInfo( caseFileName().path() ).absolutePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include <cafPdmProxyValueField.h>
|
||||
|
||||
class RifReaderEclipseRft;
|
||||
@ -65,7 +66,7 @@ public:
|
||||
QString locationOnDisc() const override;
|
||||
QString gridFileName() const override
|
||||
{
|
||||
return caseFileName();
|
||||
return caseFileName().path();
|
||||
}
|
||||
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;
|
||||
|
||||
@ -98,10 +99,10 @@ private:
|
||||
cvf::ref<RifReaderEclipseRft> m_readerEclipseRft;
|
||||
|
||||
// Fields:
|
||||
caf::PdmField<QString> caseFileName;
|
||||
caf::PdmField<caf::FilePath> caseFileName;
|
||||
caf::PdmProxyValueField<RiaEclipseUnitTools::UnitSystemType> m_unitSystem;
|
||||
caf::PdmChildArrayField<RimFlowDiagSolution*> m_flowDiagSolutions;
|
||||
caf::PdmField<QString> m_sourSimFileName;
|
||||
caf::PdmField<caf::FilePath> m_sourSimFileName;
|
||||
|
||||
// Obsolete field
|
||||
caf::PdmField<QString> caseDirectory;
|
||||
|
@ -33,8 +33,11 @@ RimFileWellPath::RimFileWellPath()
|
||||
m_surveyType.uiCapability()->setUiReadOnly( true );
|
||||
m_surveyType.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitField( &m_filepath, "WellPathFilepath", QString( "" ), "File Path", "", "", "" );
|
||||
m_filepath.uiCapability()->setUiReadOnly( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_filePath, "WellPathFilepath", "File Path", "", "", "" );
|
||||
m_filePath.uiCapability()->setUiReadOnly( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_filePathInCache, "WellPathFilePathInCache", "File Name", "", "", "" );
|
||||
m_filePathInCache.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in File", "", "", "" );
|
||||
m_wellPathIndexInFile.uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
@ -47,9 +50,16 @@ RimFileWellPath::~RimFileWellPath() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFileWellPath::filepath() const
|
||||
QString RimFileWellPath::filePath() const
|
||||
{
|
||||
return m_filepath();
|
||||
if ( isStoredInCache() || m_filePath().path().isEmpty() )
|
||||
{
|
||||
return m_filePathInCache();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_filePath().path();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -57,7 +67,7 @@ QString RimFileWellPath::filepath() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFileWellPath::setFilepath( const QString& path )
|
||||
{
|
||||
m_filepath = path;
|
||||
m_filePath = path;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -96,7 +106,16 @@ void RimFileWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
RimWellPath::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
caf::PdmUiGroup* fileInfoGroup = uiOrdering.createGroupBeforeGroup( "Simulation Well", "File" );
|
||||
fileInfoGroup->add( &m_filepath );
|
||||
|
||||
if ( isStoredInCache() )
|
||||
{
|
||||
fileInfoGroup->add( &m_filePathInCache );
|
||||
}
|
||||
else
|
||||
{
|
||||
fileInfoGroup->add( &m_filePath );
|
||||
}
|
||||
|
||||
fileInfoGroup->add( &m_wellPathIndexInFile );
|
||||
|
||||
if ( !id().isEmpty() ) uiOrdering.insertBeforeItem( m_datumElevation.uiCapability(), &id );
|
||||
@ -112,10 +131,12 @@ void RimFileWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFileWellPath::readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter )
|
||||
{
|
||||
if ( caf::Utils::fileExists( m_filepath() ) )
|
||||
if ( caf::Utils::fileExists( this->filePath() ) )
|
||||
{
|
||||
RifWellPathImporter::WellData wellData = wellPathImporter->readWellData( m_filepath(), m_wellPathIndexInFile() );
|
||||
RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData( m_filepath(),
|
||||
RifWellPathImporter::WellData wellData = wellPathImporter->readWellData( this->filePath(),
|
||||
m_wellPathIndexInFile() );
|
||||
|
||||
RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData( this->filePath(),
|
||||
m_wellPathIndexInFile() );
|
||||
// General well info
|
||||
|
||||
@ -128,11 +149,22 @@ bool RimFileWellPath::readWellPathFile( QString* errorMessage, RifWellPathImport
|
||||
updateDate = wellMetaData.m_updateDate.toString( "d MMMM yyyy" );
|
||||
|
||||
setWellPathGeometry( wellData.m_wellPathGeometry.p() );
|
||||
|
||||
// Now that the data is read, we know if this is an SSIHUB wellpath that needs to be stored in the
|
||||
// cache folder along with the project file. If it is, move the pathfile reference to the m_filePathInCache
|
||||
// in order to avoid it being handled as an externalFilePath by the RimProject class
|
||||
|
||||
if ( isStoredInCache() && !m_filePath().path().isEmpty() )
|
||||
{
|
||||
m_filePathInCache = m_filePath().path();
|
||||
m_filePath = QString( "" );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( errorMessage ) ( *errorMessage ) = "Could not find the well path file: " + m_filepath();
|
||||
if ( errorMessage ) ( *errorMessage ) = "Could not find the well path file: " + this->filePath();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -152,7 +184,7 @@ QString RimFileWellPath::getCacheDirectoryPath()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFileWellPath::getCacheFileName()
|
||||
{
|
||||
if ( m_filepath().isEmpty() )
|
||||
if ( m_filePathInCache().isEmpty() )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@ -160,8 +192,9 @@ QString RimFileWellPath::getCacheFileName()
|
||||
QString cacheFileName;
|
||||
|
||||
// Make the path correct related to the possibly new project filename
|
||||
|
||||
QString newCacheDirPath = getCacheDirectoryPath();
|
||||
QFileInfo oldCacheFile( m_filepath );
|
||||
QFileInfo oldCacheFile( m_filePathInCache() );
|
||||
|
||||
cacheFileName = newCacheDirPath + "/" + oldCacheFile.fileName();
|
||||
|
||||
@ -173,13 +206,14 @@ QString RimFileWellPath::getCacheFileName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFileWellPath::setupBeforeSave()
|
||||
{
|
||||
// Copy the possibly "cached" SSIHUB wellpath, stored in the folder along the project file
|
||||
// SSIHUB is the only source for populating Id, use text in this field to decide if the cache file must be copied to new project cache location
|
||||
if ( !isStoredInCache() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_filepath().isEmpty() )
|
||||
if ( m_filePathInCache().isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -189,21 +223,21 @@ void RimFileWellPath::setupBeforeSave()
|
||||
QString newCacheFileName = getCacheFileName();
|
||||
|
||||
// Use QFileInfo to get same string representation to avoid issues with mix of forward and backward slashes
|
||||
QFileInfo prevFileInfo( m_filepath );
|
||||
QFileInfo prevFileInfo( m_filePathInCache() );
|
||||
QFileInfo currentFileInfo( newCacheFileName );
|
||||
|
||||
if ( prevFileInfo.absoluteFilePath().compare( currentFileInfo.absoluteFilePath() ) != 0 )
|
||||
{
|
||||
QFile::copy( m_filepath, newCacheFileName );
|
||||
QFile::copy( m_filePathInCache(), newCacheFileName );
|
||||
|
||||
m_filepath = newCacheFileName;
|
||||
m_filePathInCache = newCacheFileName;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFileWellPath::isStoredInCache()
|
||||
bool RimFileWellPath::isStoredInCache() const
|
||||
{
|
||||
// SSIHUB is the only source for populating Id, use text in this field to decide if the cache file must be copied to new project cache location
|
||||
return !id().isEmpty();
|
||||
@ -214,7 +248,7 @@ bool RimFileWellPath::isStoredInCache()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFileWellPath::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
RimWellPath::updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
|
||||
// RimWellPath::updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
|
||||
|
||||
if ( isStoredInCache() )
|
||||
{
|
||||
@ -222,11 +256,11 @@ void RimFileWellPath::updateFilePathsFromProjectPath( const QString& newProjectP
|
||||
|
||||
if ( caf::Utils::fileExists( newCacheFileName ) )
|
||||
{
|
||||
m_filepath = newCacheFileName;
|
||||
m_filePathInCache = newCacheFileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_filepath = RimTools::relocateFile( m_filepath(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_filepath = RimTools::relocateFile( m_filepath(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
// }
|
||||
}
|
||||
|
@ -26,12 +26,13 @@ public:
|
||||
RimFileWellPath();
|
||||
~RimFileWellPath() override;
|
||||
|
||||
QString filepath() const;
|
||||
QString filePath() const;
|
||||
void setFilepath( const QString& path );
|
||||
bool readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter );
|
||||
int wellPathIndexInFile() const; // -1 means none.
|
||||
void setWellPathIndexInFile( int index );
|
||||
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;
|
||||
static QString getCacheDirectoryPath();
|
||||
|
||||
private:
|
||||
QString surveyType()
|
||||
@ -39,14 +40,14 @@ private:
|
||||
return m_surveyType;
|
||||
}
|
||||
void setSurveyType( QString surveyType );
|
||||
bool isStoredInCache();
|
||||
bool isStoredInCache() const;
|
||||
QString getCacheFileName();
|
||||
QString getCacheDirectoryPath();
|
||||
|
||||
void setupBeforeSave() override;
|
||||
|
||||
caf::PdmField<QString> m_filepath;
|
||||
caf::PdmField<int> m_wellPathIndexInFile; // -1 means none.
|
||||
caf::PdmField<caf::FilePath> m_filePath;
|
||||
caf::PdmField<QString> m_filePathInCache; // Used for SSIHUB imported well paths
|
||||
caf::PdmField<int> m_wellPathIndexInFile; // -1 means none.
|
||||
|
||||
caf::PdmField<QString> id;
|
||||
caf::PdmField<QString> sourceSystem;
|
||||
|
@ -42,7 +42,7 @@ RimFormationNames::RimFormationNames()
|
||||
{
|
||||
CAF_PDM_InitObject( "Formation Names", ":/Formations16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_formationNamesFileName, "FormationNamesFileName", QString( "" ), "File Name", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_formationNamesFileName, "FormationNamesFileName", "File Name", "", "", "" );
|
||||
|
||||
m_formationNamesFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||
}
|
||||
@ -68,13 +68,14 @@ void RimFormationNames::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
{
|
||||
QMessageBox::warning( nullptr, "Formation Names", errorMessage );
|
||||
}
|
||||
updateConnectedViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFormationNames::initAfterRead()
|
||||
void RimFormationNames::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
updateUiTreeName();
|
||||
}
|
||||
@ -92,9 +93,9 @@ void RimFormationNames::setFileName( const QString& fileName )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RimFormationNames::fileName()
|
||||
QString RimFormationNames::fileName()
|
||||
{
|
||||
return m_formationNamesFileName();
|
||||
return m_formationNamesFileName().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -102,7 +103,7 @@ const QString& RimFormationNames::fileName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFormationNames::fileNameWoPath()
|
||||
{
|
||||
QFileInfo fnameFileInfo( m_formationNamesFileName() );
|
||||
QFileInfo fnameFileInfo( m_formationNamesFileName().path() );
|
||||
return fnameFileInfo.fileName();
|
||||
}
|
||||
|
||||
@ -142,18 +143,19 @@ void RimFormationNames::updateConnectedViews()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFormationNames::readFormationNamesFile( QString* errorMessage )
|
||||
{
|
||||
QFile dataFile( m_formationNamesFileName() );
|
||||
QFile dataFile( m_formationNamesFileName().path() );
|
||||
|
||||
if ( !dataFile.open( QFile::ReadOnly ) )
|
||||
{
|
||||
if ( errorMessage ) ( *errorMessage ) += "Could not open the File: " + ( m_formationNamesFileName() ) + "\n";
|
||||
if ( errorMessage )
|
||||
( *errorMessage ) += "Could not open the File: " + ( m_formationNamesFileName().path() ) + "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
m_formationNamesData = new RigFormationNames;
|
||||
QTextStream stream( &dataFile );
|
||||
|
||||
QFileInfo fileInfo( m_formationNamesFileName() );
|
||||
QFileInfo fileInfo( m_formationNamesFileName().path() );
|
||||
|
||||
if ( fileInfo.fileName() == RimFormationNames::layerZoneTableFileName() )
|
||||
{
|
||||
@ -170,8 +172,8 @@ void RimFormationNames::readFormationNamesFile( QString* errorMessage )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFormationNames::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
m_formationNamesFileName =
|
||||
RimTools::relocateFile( m_formationNamesFileName(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
// m_formationNamesFileName =
|
||||
// RimTools::relocateFile( m_formationNamesFileName(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -297,8 +299,9 @@ void RimFormationNames::readFmuFormationNameFile( QTextStream& stream, QString*
|
||||
|
||||
if ( lineStream.status() != QTextStream::Ok )
|
||||
{
|
||||
*errorMessage =
|
||||
QString( "Failed to parse line %1 of '%2'" ).arg( lineNumber ).arg( m_formationNamesFileName() );
|
||||
*errorMessage = QString( "Failed to parse line %1 of '%2'" )
|
||||
.arg( lineNumber )
|
||||
.arg( m_formationNamesFileName().path() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,9 @@ public:
|
||||
RimFormationNames();
|
||||
~RimFormationNames() override;
|
||||
|
||||
void setFileName( const QString& fileName );
|
||||
const QString& fileName();
|
||||
QString fileNameWoPath();
|
||||
void setFileName( const QString& fileName );
|
||||
QString fileName();
|
||||
QString fileNameWoPath();
|
||||
|
||||
RigFormationNames* formationNamesData()
|
||||
{
|
||||
@ -55,7 +55,8 @@ protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
virtual void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
|
||||
private:
|
||||
void updateUiTreeName();
|
||||
@ -63,7 +64,7 @@ private:
|
||||
void readFmuFormationNameFile( QTextStream& stream, QString* errorMessage );
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_formationNamesFileName;
|
||||
caf::PdmField<caf::FilePath> m_formationNamesFileName;
|
||||
|
||||
cvf::ref<RigFormationNames> m_formationNamesData;
|
||||
};
|
||||
|
@ -97,6 +97,7 @@
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QMenu>
|
||||
#include <algorithm>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -114,6 +115,9 @@ RimProject::RimProject( void )
|
||||
CAF_PDM_InitFieldNoDefault( &m_projectFileVersionString, "ProjectFileVersionString", "", "", "", "" );
|
||||
m_projectFileVersionString.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_globalPathList, "ReferencedExternalFiles", "", "", "", "" );
|
||||
m_globalPathList.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &oilFields, "OilFields", "Oil Fields", "", "", "" );
|
||||
oilFields.uiCapability()->setUiHidden( true );
|
||||
|
||||
@ -257,6 +261,8 @@ void RimProject::close()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::initAfterRead()
|
||||
{
|
||||
this->distributePathsFromGlobalPathList();
|
||||
|
||||
// Create an empty oil field in case the project did not contain one
|
||||
if ( oilFields.size() < 1 )
|
||||
{
|
||||
@ -332,6 +338,18 @@ void RimProject::setupBeforeSave()
|
||||
m_projectFileVersionString = STRPRODUCTVER;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimProject::writeProjectFile()
|
||||
{
|
||||
this->transferPathsToGlobalPathList();
|
||||
bool couldOpenFile = this->writeFile();
|
||||
this->distributePathsFromGlobalPathList();
|
||||
|
||||
return couldOpenFile;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Support list of multiple script paths divided by ';'
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1368,3 +1386,203 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
#define PATHIDCHAR "$"
|
||||
|
||||
class GlobalPathListMapper
|
||||
{
|
||||
const QString pathIdBaseString = "PathId_";
|
||||
|
||||
public:
|
||||
GlobalPathListMapper( const QString& globalPathListTable )
|
||||
{
|
||||
m_nextValidIdNumber = 1;
|
||||
QStringList pathPairs = globalPathListTable.split( ";", QString::SkipEmptyParts );
|
||||
|
||||
for ( const QString& pathIdPathPair : pathPairs )
|
||||
{
|
||||
QStringList pathIdPathComponents = pathIdPathPair.trimmed().split( PATHIDCHAR );
|
||||
|
||||
if ( pathIdPathComponents.size() == 3 && pathIdPathComponents[0].size() == 0 )
|
||||
{
|
||||
QString pathIdCore = pathIdPathComponents[1];
|
||||
QString pathId = PATHIDCHAR + pathIdCore + PATHIDCHAR;
|
||||
QString path = pathIdPathComponents[2].trimmed();
|
||||
|
||||
// Check if we have a standard id, and store the max number
|
||||
|
||||
if ( pathIdCore.startsWith( pathIdBaseString ) )
|
||||
{
|
||||
bool isOk = false;
|
||||
QString numberText = pathIdCore.right( pathIdCore.size() - pathIdBaseString.size() );
|
||||
size_t idNumber = numberText.toUInt( &isOk );
|
||||
|
||||
if ( isOk )
|
||||
{
|
||||
m_nextValidIdNumber = std::max( m_nextValidIdNumber, idNumber );
|
||||
}
|
||||
}
|
||||
|
||||
// Check for unique pathId
|
||||
{
|
||||
auto pathIdPathPairIt = m_oldPathIdToPathMap.find( pathId );
|
||||
|
||||
if ( pathIdPathPairIt != m_oldPathIdToPathMap.end() )
|
||||
{
|
||||
// Error: pathID is already used
|
||||
}
|
||||
}
|
||||
|
||||
// Check for multiple identical paths
|
||||
{
|
||||
auto pathPathIdPairIt = m_oldPathToPathIdMap.find( path );
|
||||
|
||||
if ( pathPathIdPairIt != m_oldPathToPathIdMap.end() )
|
||||
{
|
||||
// Warning: path has already been assigned a pathId
|
||||
}
|
||||
}
|
||||
|
||||
m_oldPathIdToPathMap[pathId] = path;
|
||||
m_oldPathToPathIdMap[path] = pathId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error: The text is ill formatted
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString addPathAndGetId( const QString& path )
|
||||
{
|
||||
// Want to re-use ids from last save to avoid unnecessary changes and make the behavior predictable
|
||||
QString pathId;
|
||||
QString trimmedPath = path.trimmed();
|
||||
|
||||
auto pathToIdIt = m_oldPathToPathIdMap.find( trimmedPath );
|
||||
if ( pathToIdIt != m_oldPathToPathIdMap.end() )
|
||||
{
|
||||
pathId = pathToIdIt->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto pathPathIdPairIt = m_newPathToPathIdMap.find( trimmedPath );
|
||||
if ( pathPathIdPairIt != m_newPathToPathIdMap.end() )
|
||||
{
|
||||
pathId = pathPathIdPairIt->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
pathId = createUnusedId();
|
||||
}
|
||||
}
|
||||
|
||||
m_newPathIdToPathMap[pathId] = trimmedPath;
|
||||
m_newPathToPathIdMap[trimmedPath] = pathId;
|
||||
|
||||
return pathId;
|
||||
};
|
||||
|
||||
QString newGlobalPathListTable() const
|
||||
{
|
||||
QString pathList;
|
||||
pathList += "\n";
|
||||
for ( const auto& pathIdPathPairIt : m_newPathIdToPathMap )
|
||||
{
|
||||
pathList += " " + pathIdPathPairIt.first + " " + pathIdPathPairIt.second + ";\n";
|
||||
}
|
||||
|
||||
pathList += " ";
|
||||
|
||||
return pathList;
|
||||
}
|
||||
|
||||
QString pathFromPathId( const QString& pathId, bool* isFound ) const
|
||||
{
|
||||
auto it = m_oldPathIdToPathMap.find( pathId );
|
||||
if ( it != m_oldPathIdToPathMap.end() )
|
||||
{
|
||||
( *isFound ) = true;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
( *isFound ) = false;
|
||||
return "";
|
||||
}
|
||||
|
||||
private:
|
||||
QString createUnusedId()
|
||||
{
|
||||
QString numberString = QString( "%1" ).arg( (uint)m_nextValidIdNumber, 3, 10, QChar( '0' ) );
|
||||
QString pathIdentifier = PATHIDCHAR + pathIdBaseString + numberString + PATHIDCHAR;
|
||||
m_nextValidIdNumber++;
|
||||
return pathIdentifier;
|
||||
}
|
||||
|
||||
size_t m_nextValidIdNumber; // Set when parsing the globalPathListTable. Increment while creating new id's
|
||||
|
||||
std::map<QString, QString> m_newPathIdToPathMap;
|
||||
std::map<QString, QString> m_newPathToPathIdMap;
|
||||
|
||||
std::map<QString, QString> m_oldPathIdToPathMap;
|
||||
std::map<QString, QString> m_oldPathToPathIdMap;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::transferPathsToGlobalPathList()
|
||||
{
|
||||
GlobalPathListMapper pathListMapper( m_globalPathList() );
|
||||
|
||||
std::vector<caf::FilePath*> filePaths;
|
||||
fieldContentsByType( this, filePaths );
|
||||
|
||||
for ( caf::FilePath* filePath : filePaths )
|
||||
{
|
||||
QString path = filePath->path();
|
||||
if ( !path.isEmpty() )
|
||||
{
|
||||
QString pathId = pathListMapper.addPathAndGetId( path );
|
||||
filePath->setPath( pathId );
|
||||
}
|
||||
}
|
||||
|
||||
m_globalPathList = pathListMapper.newGlobalPathListTable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::distributePathsFromGlobalPathList()
|
||||
{
|
||||
GlobalPathListMapper pathListMapper( m_globalPathList() );
|
||||
|
||||
std::vector<caf::FilePath*> filePaths;
|
||||
fieldContentsByType( this, filePaths );
|
||||
|
||||
for ( caf::FilePath* filePath : filePaths )
|
||||
{
|
||||
QString pathIdCandidate = filePath->path().trimmed();
|
||||
QStringList pathIdComponents = pathIdCandidate.split( PATHIDCHAR );
|
||||
|
||||
if ( pathIdComponents.size() == 3 && pathIdComponents[0].size() == 0 && pathIdComponents[1].size() > 0 &&
|
||||
pathIdComponents[2].size() == 0 )
|
||||
{
|
||||
bool isFound = false;
|
||||
QString path = pathListMapper.pathFromPathId( pathIdCandidate, &isFound );
|
||||
if ( isFound )
|
||||
{
|
||||
filePath->setPath( path );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The pathId can not be found in the path list
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The pathIdCandidate is probably a real path. Leave alone.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +107,8 @@ public:
|
||||
caf::PdmField<QString> plotWindowTreeViewState;
|
||||
caf::PdmField<QString> plotWindowCurrentModelIndexPath;
|
||||
|
||||
bool writeProjectFile();
|
||||
|
||||
void setScriptDirectories( const QString& scriptDirectories );
|
||||
void setPlotTemplateFolders( const QStringList& plotTemplateFolders );
|
||||
|
||||
@ -193,7 +195,11 @@ private:
|
||||
template <typename T>
|
||||
void fieldContentsByType( caf::PdmObjectHandle* object, std::vector<T*>& typedFields );
|
||||
|
||||
void transferPathsToGlobalPathList();
|
||||
void distributePathsFromGlobalPathList();
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_globalPathList;
|
||||
caf::PdmField<QString> m_projectFileVersionString;
|
||||
|
||||
caf::PdmChildField<RimDialogData*> m_dialogData;
|
||||
|
@ -151,9 +151,9 @@ bool RimWellLogFile::readFile( QString* errorMessage )
|
||||
m_wellLogDataFile = new RigWellLogFile;
|
||||
}
|
||||
|
||||
m_name = QFileInfo( m_fileName ).fileName();
|
||||
m_name = QFileInfo( m_fileName().path() ).fileName();
|
||||
|
||||
if ( !m_wellLogDataFile->open( m_fileName, errorMessage ) )
|
||||
if ( !m_wellLogDataFile->open( m_fileName().path(), errorMessage ) )
|
||||
{
|
||||
m_wellLogDataFile = nullptr;
|
||||
return false;
|
||||
@ -191,7 +191,7 @@ bool RimWellLogFile::readFile( QString* errorMessage )
|
||||
this->firstAncestorOrThisOfType( wellPath );
|
||||
if ( wellPath )
|
||||
{
|
||||
if ( wellPath->filepath().isEmpty() ) // Has dummy wellpath
|
||||
if ( wellPath->filePath().isEmpty() ) // Has dummy wellpath
|
||||
{
|
||||
wellPath->setName( m_wellName );
|
||||
}
|
||||
@ -242,15 +242,15 @@ bool RimWellLogFile::hasFlowData() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFile::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
bool foundFile = false;
|
||||
std::vector<QString> searchedPaths;
|
||||
|
||||
QString fileNameCandidate =
|
||||
RimTools::relocateFile( m_fileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||
if ( foundFile )
|
||||
{
|
||||
m_fileName = fileNameCandidate;
|
||||
}
|
||||
// bool foundFile = false;
|
||||
// std::vector<QString> searchedPaths;
|
||||
//
|
||||
// QString fileNameCandidate =
|
||||
// RimTools::relocateFile( m_fileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||
// if ( foundFile )
|
||||
// {
|
||||
// m_fileName = fileNameCandidate;
|
||||
// }
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
void setFileName( const QString& fileName );
|
||||
QString fileName() const
|
||||
{
|
||||
return m_fileName;
|
||||
return m_fileName().path();
|
||||
}
|
||||
QString name() const
|
||||
{
|
||||
@ -109,7 +109,7 @@ private:
|
||||
private:
|
||||
cvf::ref<RigWellLogFile> m_wellLogDataFile;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<QString> m_fileName;
|
||||
caf::PdmField<caf::FilePath> m_fileName;
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<QDateTime> m_date;
|
||||
bool m_lasFileHasValidDate;
|
||||
|
@ -118,7 +118,7 @@ RimWellPath::RimWellPath()
|
||||
CAF_PDM_InitField( &m_formationKeyInFile, "WellPathFormationKeyInFile", QString( "" ), "Key in File", "", "", "" );
|
||||
m_formationKeyInFile.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_wellPathFormationFilePath, "WellPathFormationFilePath", QString( "" ), "File Path", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellPathFormationFilePath, "WellPathFormationFilePath", "File Path", "", "", "" );
|
||||
m_wellPathFormationFilePath.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogFile_OBSOLETE, "WellLogFile", "Well Log File", "", "", "" );
|
||||
@ -627,20 +627,20 @@ size_t RimWellPath::simulationWellBranchCount( const QString& simWellName )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
{
|
||||
bool foundFile = false;
|
||||
std::vector<QString> searchedPaths;
|
||||
|
||||
QString fileNameCandidate = RimTools::relocateFile( m_wellPathFormationFilePath,
|
||||
newProjectPath,
|
||||
oldProjectPath,
|
||||
&foundFile,
|
||||
&searchedPaths );
|
||||
if ( foundFile )
|
||||
{
|
||||
m_wellPathFormationFilePath = fileNameCandidate;
|
||||
}
|
||||
}
|
||||
//{
|
||||
// bool foundFile = false;
|
||||
// std::vector<QString> searchedPaths;
|
||||
//
|
||||
// QString fileNameCandidate = RimTools::relocateFile( m_wellPathFormationFilePath,
|
||||
// newProjectPath,
|
||||
// oldProjectPath,
|
||||
// &foundFile,
|
||||
// &searchedPaths );
|
||||
// if ( foundFile )
|
||||
// {
|
||||
// m_wellPathFormationFilePath = fileNameCandidate;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -738,14 +738,14 @@ void RimWellPath::setFormationsGeometry( cvf::ref<RigWellPathFormations> wellPat
|
||||
bool RimWellPath::readWellPathFormationsFile( QString* errorMessage,
|
||||
RifWellPathFormationsImporter* wellPathFormationsImporter )
|
||||
{
|
||||
if ( m_wellPathFormationFilePath().isEmpty() )
|
||||
if ( m_wellPathFormationFilePath().path().isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( caf::Utils::fileExists( m_wellPathFormationFilePath() ) )
|
||||
if ( caf::Utils::fileExists( m_wellPathFormationFilePath().path() ) )
|
||||
{
|
||||
m_wellPathFormations = wellPathFormationsImporter->readWellPathFormations( m_wellPathFormationFilePath(),
|
||||
m_wellPathFormations = wellPathFormationsImporter->readWellPathFormations( m_wellPathFormationFilePath().path(),
|
||||
m_formationKeyInFile() );
|
||||
if ( m_name().isEmpty() )
|
||||
{
|
||||
@ -755,7 +755,8 @@ bool RimWellPath::readWellPathFormationsFile( QString* err
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( errorMessage ) ( *errorMessage ) = "Could not find the well pick file: " + m_wellPathFormationFilePath();
|
||||
if ( errorMessage )
|
||||
( *errorMessage ) = "Could not find the well pick file: " + m_wellPathFormationFilePath().path();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -766,20 +767,21 @@ bool RimWellPath::readWellPathFormationsFile( QString* err
|
||||
bool RimWellPath::reloadWellPathFormationsFile( QString* errorMessage,
|
||||
RifWellPathFormationsImporter* wellPathFormationsImporter )
|
||||
{
|
||||
if ( m_wellPathFormationFilePath().isEmpty() )
|
||||
if ( m_wellPathFormationFilePath().path().isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( caf::Utils::fileExists( m_wellPathFormationFilePath() ) )
|
||||
if ( caf::Utils::fileExists( m_wellPathFormationFilePath().path() ) )
|
||||
{
|
||||
m_wellPathFormations = wellPathFormationsImporter->reloadWellPathFormations( m_wellPathFormationFilePath(),
|
||||
m_wellPathFormations = wellPathFormationsImporter->reloadWellPathFormations( m_wellPathFormationFilePath().path(),
|
||||
m_formationKeyInFile() );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( errorMessage ) ( *errorMessage ) = "Could not find the well pick file: " + m_wellPathFormationFilePath();
|
||||
if ( errorMessage )
|
||||
( *errorMessage ) = "Could not find the well pick file: " + m_wellPathFormationFilePath().path();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "RimWellPathComponentInterface.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
@ -158,8 +159,8 @@ private:
|
||||
|
||||
caf::PdmField<RiaEclipseUnitTools::UnitSystemType> m_unitSystem;
|
||||
|
||||
caf::PdmField<QString> m_wellPathFormationFilePath;
|
||||
caf::PdmField<QString> m_formationKeyInFile;
|
||||
caf::PdmField<caf::FilePath> m_wellPathFormationFilePath;
|
||||
caf::PdmField<QString> m_formationKeyInFile;
|
||||
|
||||
caf::PdmField<bool> m_showWellPath;
|
||||
caf::PdmField<bool> m_showWellPathLabel;
|
||||
|
@ -148,7 +148,7 @@ void RimWellPathCollection::loadDataAndUpdate()
|
||||
RimModeledWellPath* mWPath = dynamic_cast<RimModeledWellPath*>( wellPaths[wpIdx] );
|
||||
if ( fWPath )
|
||||
{
|
||||
if ( !fWPath->filepath().isEmpty() )
|
||||
if ( !fWPath->filePath().isEmpty() )
|
||||
{
|
||||
QString errorMessage;
|
||||
if ( !fWPath->readWellPathFile( &errorMessage, m_wellPathImporter ) )
|
||||
@ -221,7 +221,7 @@ std::vector<RimWellPath*> RimWellPathCollection::addWellPaths( QStringList fileP
|
||||
f1.setFileName( filePath );
|
||||
QString s1 = f1.fileName();
|
||||
QFile f2;
|
||||
f2.setFileName( fWPath->filepath() );
|
||||
f2.setFileName( fWPath->filePath() );
|
||||
QString s2 = f2.fileName();
|
||||
if ( s1 == s2 )
|
||||
{
|
||||
@ -285,7 +285,7 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
|
||||
RimFileWellPath* existingWellPath = dynamic_cast<RimFileWellPath*>( tryFindMatchingWellPath( wellPath->name() ) );
|
||||
if ( existingWellPath )
|
||||
{
|
||||
existingWellPath->setFilepath( wellPath->filepath() );
|
||||
existingWellPath->setFilepath( wellPath->filePath() );
|
||||
existingWellPath->setWellPathIndexInFile( wellPath->wellPathIndexInFile() );
|
||||
existingWellPath->readWellPathFile( nullptr, m_wellPathImporter );
|
||||
|
||||
@ -596,7 +596,7 @@ void RimWellPathCollection::removeWellPath( RimWellPath* wellPath )
|
||||
for ( size_t i = 0; i < wellPaths.size(); i++ )
|
||||
{
|
||||
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPaths[i] );
|
||||
if ( fWPath && fWPath->filepath() == fileWellPath->filepath() )
|
||||
if ( fWPath && fWPath->filePath() == fileWellPath->filePath() )
|
||||
{
|
||||
isFilePathUsed = true;
|
||||
break;
|
||||
@ -607,7 +607,7 @@ void RimWellPathCollection::removeWellPath( RimWellPath* wellPath )
|
||||
{
|
||||
// One file can have multiple well paths
|
||||
// If no other well paths are referencing the filepath, remove cached data from the file reader
|
||||
m_wellPathImporter->removeFilePath( fileWellPath->filepath() );
|
||||
m_wellPathImporter->removeFilePath( fileWellPath->filePath() );
|
||||
}
|
||||
}
|
||||
updateAllRequiredEditors();
|
||||
|
@ -56,7 +56,7 @@ RimFileSummaryCase::~RimFileSummaryCase() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFileSummaryCase::summaryHeaderFilename() const
|
||||
{
|
||||
return m_summaryHeaderFilename();
|
||||
return m_summaryHeaderFilename().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -74,8 +74,8 @@ QString RimFileSummaryCase::caseName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFileSummaryCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
m_summaryHeaderFilename =
|
||||
RimTools::relocateFile( m_summaryHeaderFilename(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
// m_summaryHeaderFilename =
|
||||
// RimTools::relocateFile( m_summaryHeaderFilename().path(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -115,7 +115,7 @@ RimEclipseCase* RimGridSummaryCase::associatedEclipseCase()
|
||||
if ( eclCase )
|
||||
{
|
||||
QString sumHeaderFileName = summaryHeaderFilenameFromEclipseCase( eclCase );
|
||||
if ( sumHeaderFileName == m_summaryHeaderFilename )
|
||||
if ( sumHeaderFileName == m_summaryHeaderFilename().path() )
|
||||
{
|
||||
m_eclipseCase = eclCase;
|
||||
this->updateAutoShortName();
|
||||
@ -135,7 +135,7 @@ RimEclipseCase* RimGridSummaryCase::associatedEclipseCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridSummaryCase::summaryHeaderFilename() const
|
||||
{
|
||||
if ( !m_eclipseCase() ) return m_summaryHeaderFilename();
|
||||
if ( !m_eclipseCase() ) return m_summaryHeaderFilename().path();
|
||||
|
||||
return summaryHeaderFilenameFromEclipseCase( m_eclipseCase() );
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ QString RimObservedSummaryData::caseName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimObservedSummaryData::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
m_summaryHeaderFilename =
|
||||
RimTools::relocateFile( m_summaryHeaderFilename(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
// m_summaryHeaderFilename =
|
||||
// RimTools::relocateFile( m_summaryHeaderFilename(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -62,7 +62,7 @@ RimSummaryCase::~RimSummaryCase() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryCase::summaryHeaderFilename() const
|
||||
{
|
||||
return m_summaryHeaderFilename();
|
||||
return m_summaryHeaderFilename().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
#include "RigCaseRealizationParameters.h"
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
@ -81,10 +82,10 @@ protected:
|
||||
const QVariant& newValue ) override;
|
||||
void updateTreeItemName();
|
||||
|
||||
caf::PdmField<QString> m_shortName;
|
||||
caf::PdmField<bool> m_useAutoShortName;
|
||||
caf::PdmField<QString> m_summaryHeaderFilename;
|
||||
bool m_isObservedData;
|
||||
caf::PdmField<QString> m_shortName;
|
||||
caf::PdmField<bool> m_useAutoShortName;
|
||||
caf::PdmField<caf::FilePath> m_summaryHeaderFilename;
|
||||
bool m_isObservedData;
|
||||
|
||||
std::shared_ptr<RigCaseRealizationParameters> m_crlParameters;
|
||||
|
||||
|
@ -568,7 +568,7 @@ public:
|
||||
inputProperty = new RimEclipseInputProperty;
|
||||
inputProperty->resultName = m_currentPropertyName;
|
||||
inputProperty->eclipseKeyword = "";
|
||||
inputProperty->fileName = "";
|
||||
inputProperty->fileName = QString( "" );
|
||||
inputRes->inputPropertyCollection()->inputProperties.push_back( inputProperty );
|
||||
inputRes->inputPropertyCollection()->updateConnectedEditors();
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ public:
|
||||
inputProperty = new RimEclipseInputProperty;
|
||||
inputProperty->resultName = m_currentPropertyName;
|
||||
inputProperty->eclipseKeyword = "";
|
||||
inputProperty->fileName = "";
|
||||
inputProperty->fileName = QString( "" );
|
||||
inputRes->inputPropertyCollection()->inputProperties.push_back( inputProperty );
|
||||
inputRes->inputPropertyCollection()->updateConnectedEditors();
|
||||
}
|
||||
@ -1080,7 +1080,7 @@ public:
|
||||
inputProperty = new RimEclipseInputProperty;
|
||||
inputProperty->resultName = m_currentPropertyName;
|
||||
inputProperty->eclipseKeyword = "";
|
||||
inputProperty->fileName = "";
|
||||
inputProperty->fileName = QString( "" );
|
||||
inputRes->inputPropertyCollection()->inputProperties.push_back( inputProperty );
|
||||
inputRes->inputPropertyCollection()->updateConnectedEditors();
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ public:
|
||||
|
||||
static bool isEqual(const QVariant& variantValue, const QVariant& variantValue2)
|
||||
{
|
||||
return variantValue.value<FilePath>() == variantValue2.value<FilePath>();
|
||||
return variantValue.toString() == variantValue2.toString();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user