2013-12-04 05:04:42 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-24 00:14:52 -05:00
|
|
|
// Copyright (C) Statoil ASA
|
|
|
|
// Copyright (C) Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2013-12-04 05:04:42 -06:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2013-12-04 05:04:42 -06:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2013-12-04 05:04:42 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
2015-09-25 08:57:43 -05:00
|
|
|
|
|
|
|
#include "cvfObject.h"
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
2016-11-25 07:21:40 -06:00
|
|
|
#include <map>
|
2019-09-06 03:40:57 -05:00
|
|
|
#include <vector>
|
2015-09-25 08:57:43 -05:00
|
|
|
|
2013-12-04 05:04:42 -06:00
|
|
|
class RimProject;
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
//
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2013-12-04 05:04:42 -06:00
|
|
|
//
|
|
|
|
//==================================================================================================
|
|
|
|
class RiaProjectModifier : public cvf::Object
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RiaProjectModifier();
|
|
|
|
|
2019-11-03 07:08:21 -06:00
|
|
|
void setReplaceCaseFirstOccurrence( const QString& newGridFileName );
|
|
|
|
void setReplaceCase( int caseIdToReplace, const QString& newGridFileName );
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2019-11-03 07:08:21 -06:00
|
|
|
void setReplaceSourceCasesFirstOccurrence( const std::vector<QString>& newGridFileNames );
|
|
|
|
void setReplaceSourceCasesById( int caseGroupIdToReplace, const std::vector<QString>& newGridFileNames );
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void setReplacePropertiesFolderFirstOccurrence( QString newPropertiesFolder );
|
|
|
|
void setReplacePropertiesFolder( int caseIdToReplace, QString newPropertiesFolder );
|
2017-06-28 13:10:06 -05:00
|
|
|
|
2020-10-12 06:17:47 -05:00
|
|
|
// Used by the regression test system to invalidate all paths to test if the tests run as expected if external files
|
|
|
|
// are missing/invalid
|
|
|
|
void setInvalidateExternalPaths();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool applyModificationsToProject( RimProject* project );
|
2013-12-04 05:04:42 -06:00
|
|
|
|
|
|
|
private:
|
2019-09-06 03:40:57 -05:00
|
|
|
void replaceSourceCases( RimProject* project );
|
|
|
|
void replaceCase( RimProject* project );
|
|
|
|
void replacePropertiesFolder( RimProject* project );
|
2020-10-12 06:17:47 -05:00
|
|
|
void invalidateExternalPaths( RimProject* project );
|
2017-06-28 13:10:06 -05:00
|
|
|
|
2019-11-03 07:08:21 -06:00
|
|
|
static QString makeFilePathAbsolute( const QString& relOrAbsolutePath );
|
|
|
|
static QString caseNameFromGridFileName( const QString& fullGridFilePathName );
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static int firstCaseId( RimProject* project );
|
|
|
|
static int firstGroupId( RimProject* project );
|
|
|
|
static int firstInputCaseId( RimProject* project );
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static int firstOccurrenceId();
|
2016-11-28 04:30:03 -06:00
|
|
|
|
2016-11-25 07:21:40 -06:00
|
|
|
private:
|
2019-09-06 03:40:57 -05:00
|
|
|
std::map<int, QString> m_caseIdToGridFileNameMap;
|
|
|
|
std::map<int, std::vector<QString>> m_groupIdToGridFileNamesMap;
|
|
|
|
std::map<int, QString> m_caseIdToPropertiesFolderMap;
|
2020-10-12 06:17:47 -05:00
|
|
|
bool m_invalidateExternalPaths;
|
2013-12-04 05:04:42 -06:00
|
|
|
};
|