mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6417 Fix update of cvf::Vec3d from Python
This commit is contained in:
parent
66c57cfae8
commit
2e1bf89bff
@ -179,10 +179,10 @@ class PdmObjectBase:
|
||||
if isinstance(value, PdmObjectBase):
|
||||
return value.__class__.__name__ + ":" + str(value.address())
|
||||
if isinstance(value, list):
|
||||
list_of_strings = []
|
||||
list_of_values = []
|
||||
for val in value:
|
||||
list_of_strings.append('\"' + self.__convert_to_grpc_value(val) + '\"')
|
||||
return "[" + ", ".join(list_of_strings) + "]"
|
||||
list_of_values.append(self.__convert_to_grpc_value(val))
|
||||
return "[" + ", ".join(list_of_values) + "]"
|
||||
return str(value)
|
||||
|
||||
def __get_grpc_value(self, camel_keyword):
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
#include "RimWellPathTarget.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
@ -24,9 +24,6 @@
|
||||
#include "RimCheckableNamedObject.h"
|
||||
#include "RimWellPathComponentInterface.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
|
@ -516,7 +516,11 @@ size_t Rim3dView::timeStepCount()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString Rim3dView::timeStepName( int frameIdx ) const
|
||||
{
|
||||
return this->ownerCase()->timeStepName( frameIdx );
|
||||
if ( this->ownerCase() )
|
||||
{
|
||||
return this->ownerCase()->timeStepName( frameIdx );
|
||||
}
|
||||
return QString( "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "cafPdmFieldReorderCapability.h"
|
||||
|
||||
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectMethod.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSummaryPlotCollection, "SummaryPlotCollection" );
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmObjectMethod.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
|
||||
class RimSummaryPlot;
|
||||
|
@ -104,6 +104,7 @@ caf::PdmObjectHandle* RimSummaryCase_availableAddresses::execute()
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
RifSummaryReaderInterface* sumReader = summaryCase->summaryReader();
|
||||
CAF_ASSERT( sumReader );
|
||||
|
||||
const std::set<RifEclipseSummaryAddress>& addresses = sumReader->allResultAddresses();
|
||||
|
||||
@ -153,6 +154,7 @@ caf::PdmObjectHandle* RimSummaryCase_availableTimeSteps::execute()
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
RifSummaryReaderInterface* sumReader = summaryCase->summaryReader();
|
||||
CAF_ASSERT( sumReader );
|
||||
|
||||
RifEclipseSummaryAddress adr;
|
||||
auto timeValues = sumReader->timeSteps( adr );
|
||||
|
@ -22,11 +22,6 @@ add_library( ${PROJECT_NAME}
|
||||
cafPdmXmlColor3f.cpp
|
||||
cafPdmXmlColor3f.h
|
||||
cafPdmFieldCvfColor.h
|
||||
cafPdmFieldScriptingCapabilityCvfColor3.h
|
||||
cafPdmFieldScriptingCapabilityCvfColor3.cpp
|
||||
cafPdmFieldScriptingCapabilityCvfVec3d.h
|
||||
cafPdmFieldScriptingCapabilityCvfVec3d.cpp
|
||||
|
||||
cafPdmCoreVec3d.h
|
||||
cafPdmUiCoreVec3d.cpp
|
||||
cafPdmUiCoreVec3d.h
|
||||
@ -41,7 +36,7 @@ add_library( ${PROJECT_NAME}
|
||||
cafPdmXmlMat4d.h
|
||||
cafPdmFieldCvfMat4d.h
|
||||
|
||||
cafPdmMat3d/cafPdmCoreMat3d.h
|
||||
cafPdmMat3d/cafPdmCoreMat3d.h
|
||||
cafPdmMat3d/cafPdmUiCoreMat3d.h
|
||||
cafPdmMat3d/cafPdmXmlMat3d.cpp
|
||||
cafPdmMat3d/cafPdmXmlMat3d.h
|
||||
@ -60,7 +55,6 @@ target_include_directories(${PROJECT_NAME}
|
||||
target_link_libraries ( ${PROJECT_NAME}
|
||||
cafUserInterface
|
||||
LibCore
|
||||
cafPdmScripting
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
||||
|
@ -30,6 +30,10 @@ set( PROJECT_FILES
|
||||
cafPdmMarkdownGenerator.cpp
|
||||
cafPdmMarkdownBuilder.h
|
||||
cafPdmMarkdownBuilder.cpp
|
||||
cafPdmFieldScriptingCapabilityCvfColor3.h
|
||||
cafPdmFieldScriptingCapabilityCvfColor3.cpp
|
||||
cafPdmFieldScriptingCapabilityCvfVec3d.h
|
||||
cafPdmFieldScriptingCapabilityCvfVec3d.cpp
|
||||
)
|
||||
|
||||
|
||||
@ -45,6 +49,7 @@ target_include_directories(${PROJECT_NAME}
|
||||
|
||||
target_link_libraries ( ${PROJECT_NAME}
|
||||
cafProjectDataModel
|
||||
cafPdmCvf
|
||||
)
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
@ -39,6 +39,8 @@
|
||||
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmCoreColor3f.h"
|
||||
#include "cafPdmCoreVec3d.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cafPdmScriptIOMessages.h"
|
||||
@ -47,6 +49,8 @@
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#define CAF_PDM_InitScriptableField( field, keyword, default, uiName, iconResourceName, toolTip, whatsThis ) \
|
||||
CAF_PDM_InitField( field, \
|
||||
keyword, \
|
||||
|
@ -33,6 +33,7 @@
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
#pragma once
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
|
||||
#include "cvfColor3.h"
|
@ -40,10 +40,10 @@ using namespace caf;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmFieldScriptingCapabilityIOHandler<cvf::Vec3d>::writeToField( cvf::Vec3d& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted )
|
||||
void PdmFieldScriptingCapabilityIOHandler<cvf::Vector3<double>>::writeToField( cvf::Vector3<double>& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted )
|
||||
{
|
||||
std::vector<double> fieldVectorValue;
|
||||
PdmFieldScriptingCapabilityIOHandler<std::vector<double>>::writeToField( fieldVectorValue,
|
||||
@ -67,10 +67,10 @@ void PdmFieldScriptingCapabilityIOHandler<cvf::Vec3d>::writeToField( cvf::Vec3d&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmFieldScriptingCapabilityIOHandler<cvf::Vec3d>::readFromField( const cvf::Vec3d& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings,
|
||||
bool quoteNonBuiltin )
|
||||
void PdmFieldScriptingCapabilityIOHandler<cvf::Vector3<double>>::readFromField( const cvf::Vector3<double>& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings,
|
||||
bool quoteNonBuiltin )
|
||||
{
|
||||
std::vector<double> fieldVectorValue( 3u );
|
||||
for ( int i = 0; i < 3; ++i )
|
@ -33,6 +33,8 @@
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
@ -40,15 +42,15 @@
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
struct PdmFieldScriptingCapabilityIOHandler<cvf::Vec3d>
|
||||
struct PdmFieldScriptingCapabilityIOHandler<cvf::Vector3<double>>
|
||||
{
|
||||
static void writeToField( cvf::Vec3d& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true );
|
||||
static void readFromField( const cvf::Vec3d& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings = true,
|
||||
bool quoteNonBuiltins = false );
|
||||
static void writeToField( cvf::Vector3<double>& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true );
|
||||
static void readFromField( const cvf::Vector3<double>& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings = true,
|
||||
bool quoteNonBuiltins = false );
|
||||
};
|
||||
} // namespace caf
|
||||
} // namespace caf
|
Loading…
Reference in New Issue
Block a user