mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 14:40:26 -05:00
Add the inverse APIs to the existing discrete-property setters:
- case.property_data_type(property_type, property_name) returns "FLOAT" or
"INTEGER", matching the data_type flag passed to set_active_cell_property
/ set_grid_property.
- case.discrete_property_category_names(property_name) and
case.discrete_property_category_colors(property_name) return the
{int: str} mappings previously bound via
set_discrete_property_category_names, or empty dicts when nothing is bound.
Implemented as PdmObjectMethods on RimEclipseCase and
RimColorLegendCollection so the bindings surface automatically through
generated_classes.py.
122 lines
4.2 KiB
C++
122 lines
4.2 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 "cafPdmFieldCvfColor.h"
|
|
#include "cafPdmObjectHandle.h"
|
|
#include "cafPdmObjectMethod.h"
|
|
#include "cafPdmPtrField.h"
|
|
|
|
#include "cvfColor3.h"
|
|
|
|
#include <QString>
|
|
|
|
class RimCase;
|
|
class RimColorLegend;
|
|
|
|
//==================================================================================================
|
|
///
|
|
//==================================================================================================
|
|
class RimcColorLegendCollection_createColorLegend : public caf::PdmObjectCreationMethod
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
RimcColorLegendCollection_createColorLegend( caf::PdmObjectHandle* self );
|
|
|
|
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
|
QString classKeywordReturnedType() const override;
|
|
|
|
private:
|
|
caf::PdmField<QString> m_legendName;
|
|
};
|
|
|
|
//==================================================================================================
|
|
///
|
|
//==================================================================================================
|
|
class RimcColorLegend_addColorLegendItem : public caf::PdmObjectCreationMethod
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
RimcColorLegend_addColorLegendItem( caf::PdmObjectHandle* self );
|
|
|
|
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
|
QString classKeywordReturnedType() const override;
|
|
|
|
private:
|
|
caf::PdmField<int> m_categoryValue;
|
|
caf::PdmField<QString> m_categoryName;
|
|
caf::PdmField<cvf::Color3f> m_color;
|
|
};
|
|
|
|
//==================================================================================================
|
|
///
|
|
//==================================================================================================
|
|
class RimcColorLegendCollection_setDefaultColorLegendForResult : public caf::PdmVoidObjectMethod
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
RimcColorLegendCollection_setDefaultColorLegendForResult( caf::PdmObjectHandle* self );
|
|
|
|
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
|
|
|
private:
|
|
caf::PdmPtrField<RimCase*> m_case;
|
|
caf::PdmField<QString> m_resultName;
|
|
caf::PdmPtrField<RimColorLegend*> m_colorLegend;
|
|
};
|
|
|
|
//==================================================================================================
|
|
///
|
|
//==================================================================================================
|
|
class RimcColorLegendCollection_deleteColorLegend : public caf::PdmVoidObjectMethod
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
RimcColorLegendCollection_deleteColorLegend( caf::PdmObjectHandle* self );
|
|
|
|
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
|
|
|
private:
|
|
caf::PdmPtrField<RimCase*> m_case;
|
|
caf::PdmField<QString> m_resultName;
|
|
};
|
|
|
|
//==================================================================================================
|
|
///
|
|
//==================================================================================================
|
|
class RimcColorLegendCollection_findDefaultLegendForResult : public caf::PdmObjectMethod
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
RimcColorLegendCollection_findDefaultLegendForResult( caf::PdmObjectHandle* self );
|
|
|
|
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
|
QString classKeywordReturnedType() const override;
|
|
|
|
private:
|
|
caf::PdmPtrField<RimCase*> m_case;
|
|
caf::PdmField<QString> m_resultName;
|
|
};
|