Files
ResInsight/ApplicationLibCode/ProjectDataModelCommands/RimcCase.h
T
Kristian Bendiksen 147a60ceec #14772 Python: Add Project.import_formation_names and Case.set_formation_names as object methods and forward importFormationNames to them
The legacy command combined import and assignment with an applyToCaseId.
This is split into RimProject_importFormationNames (returns the
FormationNames object) and RimCase_setFormationNames (takes the
object). RimFormationNames is made scriptable so it can be returned and
passed. RicfImportFormationNames forwards to both.

Project.import_formation_names() in Python keeps its signature, now
returns the FormationNames object, and gains an apply_to_all_cases
flag (default True, matching the old behavior).
Case.import_formation_names() is kept and emits a DeprecationWarning.
2026-09-22 14:19:23 +02:00

86 lines
3.1 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026- 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 "cafPdmField.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmObjectMethod.h"
#include "cafPdmPtrField.h"
#include <QString>
class Rim3dView;
class RimFormationNames;
//==================================================================================================
/// Replace the grid file of a case (Eclipse result case or GeoMech case) and reload the project.
///
/// The project must be saved to file, as the replacement is performed by reloading the project
/// through a RiaProjectModifier. An explicit project file can be given to override the current
/// project file name (used by the legacy command file interface).
//==================================================================================================
class RimCase_replaceGrid : public caf::PdmVoidObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimCase_replaceGrid( caf::PdmObjectHandle* self );
void setNewGridFile( const QString& newGridFile );
void setProjectFile( const QString& projectFile );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
private:
caf::PdmField<QString> m_newGridFile;
caf::PdmField<QString> m_projectFile;
};
//==================================================================================================
/// Create a new 3D view in the case. Supports Eclipse cases and GeoMech cases.
//==================================================================================================
class RimCase_createView : public caf::PdmObjectCreationMethod
{
CAF_PDM_HEADER_INIT;
public:
RimCase_createView( caf::PdmObjectHandle* self );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
QString classKeywordReturnedType() const override;
};
//==================================================================================================
/// Set the active formation names of the case.
//==================================================================================================
class RimCase_setFormationNames : public caf::PdmVoidObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimCase_setFormationNames( caf::PdmObjectHandle* self );
void setFormationNames( RimFormationNames* formationNames );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
private:
caf::PdmPtrField<RimFormationNames*> m_formationNames;
};