mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5757 Python : Add access to summary addresses
This commit is contained in:
parent
6adffe5050
commit
27def6c132
@ -2,13 +2,17 @@
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryCase.h
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryCase.cpp
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -16,6 +16,8 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RimcDataContainerString.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include "cafPdmObjectScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimcDataContainerString, "DataContainerString" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcDataContainerString::RimcDataContainerString()
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Data Container String", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_stringValues, "StringValues", "String Values", "", "", "" );
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "cafPdmObject.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcDataContainerString : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcDataContainerString();
|
||||
|
||||
caf::PdmField<std::vector<QString>> m_stringValues;
|
||||
};
|
@ -22,6 +22,7 @@
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimcDataContainerDouble.h"
|
||||
|
||||
#include "RimcDataContainerString.h"
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryCase, RimcSummaryCase_summaryVectorValues, "SummaryVectorValues" );
|
||||
@ -82,3 +83,52 @@ std::unique_ptr<caf::PdmObjectHandle> RimcSummaryCase_summaryVectorValues::defau
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimcDataContainerDouble );
|
||||
}
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryCase, RimcSummaryCase_AvailableAddresses, "AvailableAddresses" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcSummaryCase_AvailableAddresses::RimcSummaryCase_AvailableAddresses( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Available Addresses", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSummaryCase_AvailableAddresses::execute()
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
RifSummaryReaderInterface* sumReader = summaryCase->summaryReader();
|
||||
|
||||
const std::set<RifEclipseSummaryAddress>& addresses = sumReader->allResultAddresses();
|
||||
|
||||
std::vector<QString> adr;
|
||||
for ( const auto& a : addresses )
|
||||
{
|
||||
adr.push_back( QString::fromStdString( a.uiText() ) );
|
||||
}
|
||||
|
||||
auto dataObject = new RimcDataContainerString();
|
||||
dataObject->m_stringValues = adr;
|
||||
|
||||
return dataObject;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcSummaryCase_AvailableAddresses::resultIsPersistent() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcSummaryCase_AvailableAddresses::defaultResult() const
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimcDataContainerString );
|
||||
}
|
||||
|
@ -16,6 +16,8 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmObjectMethod.h"
|
||||
@ -41,3 +43,18 @@ public:
|
||||
private:
|
||||
caf::PdmField<QString> m_addressString;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcSummaryCase_AvailableAddresses : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcSummaryCase_AvailableAddresses( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute();
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
};
|
||||
|
@ -16,6 +16,8 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user