mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
* General PdmObjectMethods for scripting.
This commit is contained in:
@@ -35,8 +35,6 @@
|
||||
#include "HoloLensCommands/RicHoloLensSessionManager.h"
|
||||
#include "RicImportGeneralDataFeature.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
#include "RicfFieldHandle.h"
|
||||
#include "RicfObjectCapability.h"
|
||||
|
||||
#include "Rim2dIntersectionViewCollection.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandObject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandResponse.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldCapability.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldHandle.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfObjectCapability.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifcCommandFileReader.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandResponse.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldCapability.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldHandle.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfObjectCapability.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifcCommandFileReader.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -18,13 +18,11 @@
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmPythonGenerator.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandObject::RicfCommandObject()
|
||||
: RicfObjectCapability( this, false )
|
||||
: PdmObjectScriptability( this, false )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -17,66 +17,11 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "RicfCommandResponse.h"
|
||||
#include "RicfFieldCapability.h"
|
||||
#include "RicfObjectCapability.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmObjectScriptabilityRegister.h"
|
||||
#include "cafPdmPythonGenerator.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCommandObject : public caf::PdmObject, public RicfObjectCapability
|
||||
{
|
||||
public:
|
||||
RicfCommandObject();
|
||||
~RicfCommandObject() override;
|
||||
|
||||
virtual RicfCommandResponse execute() = 0;
|
||||
};
|
||||
|
||||
#define RICF_InitField( field, keyword, default, uiName, iconResourceName, toolTip, whatsThis ) \
|
||||
CAF_PDM_InitField( field, \
|
||||
keyword, \
|
||||
default, \
|
||||
uiName, \
|
||||
iconResourceName, \
|
||||
caf::PdmPythonGenerator::pythonHelpString( toolTip, keyword ), \
|
||||
whatsThis ); \
|
||||
AddRicfCapabilityToField( field, keyword )
|
||||
|
||||
#define RICF_InitFieldNoDefault( field, keyword, uiName, iconResourceName, toolTip, whatsThis ) \
|
||||
CAF_PDM_InitFieldNoDefault( field, \
|
||||
keyword, \
|
||||
uiName, \
|
||||
iconResourceName, \
|
||||
caf::PdmPythonGenerator::pythonHelpString( toolTip, keyword ), \
|
||||
whatsThis ); \
|
||||
AddRicfCapabilityToField( field, keyword )
|
||||
|
||||
#define RICF_InitFieldTranslated( field, keyword, scriptKeyword, default, uiName, iconResourceName, toolTip, whatsThis ) \
|
||||
CAF_PDM_InitField( field, \
|
||||
keyword, \
|
||||
default, \
|
||||
uiName, \
|
||||
iconResourceName, \
|
||||
caf::PdmPythonGenerator::pythonHelpString( toolTip, scriptKeyword ), \
|
||||
whatsThis ); \
|
||||
AddRicfCapabilityToField( field, scriptKeyword )
|
||||
|
||||
#define RICF_InitFieldNoDefaultTranslated( field, keyword, scriptKeyword, uiName, iconResourceName, toolTip, whatsThis ) \
|
||||
CAF_PDM_InitFieldNoDefault( field, \
|
||||
keyword, \
|
||||
uiName, \
|
||||
iconResourceName, \
|
||||
caf::PdmPythonGenerator::pythonHelpString( toolTip, scriptKeyword ), \
|
||||
whatsThis ); \
|
||||
AddRicfCapabilityToField( field, scriptKeyword )
|
||||
#include "cafPdmObjectScriptability.h"
|
||||
#include "cafPdmScriptResponse.h"
|
||||
|
||||
#define RICF_HEADER_INIT \
|
||||
CAF_CMD_HEADER_INIT; \
|
||||
@@ -91,3 +36,17 @@ public:
|
||||
} \
|
||||
CAF_FACTORY_REGISTER2( caf::CmdFeature, ClassName, std::string, ClassName::idNameStatic() ); \
|
||||
CAF_PDM_SOURCE_INIT( ClassName, CommandKeyword )
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCommandObject : public caf::PdmObject, public caf::PdmObjectScriptability
|
||||
{
|
||||
public:
|
||||
RicfCommandObject();
|
||||
~RicfCommandObject() override;
|
||||
|
||||
virtual caf::PdmScriptResponse execute() = 0;
|
||||
};
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <memory>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Command response which contains status and possibly a result
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCommandResponse
|
||||
{
|
||||
public:
|
||||
// Status in order of severity from ok to critical
|
||||
enum Status
|
||||
{
|
||||
COMMAND_OK,
|
||||
COMMAND_WARNING,
|
||||
COMMAND_ERROR
|
||||
};
|
||||
|
||||
public:
|
||||
RicfCommandResponse( Status status = COMMAND_OK, const QString& message = "" );
|
||||
explicit RicfCommandResponse( caf::PdmObject* ok_result );
|
||||
|
||||
Status status() const;
|
||||
QString sanitizedResponseMessage() const;
|
||||
QStringList messages() const;
|
||||
caf::PdmObject* result() const;
|
||||
void setResult( caf::PdmObject* result );
|
||||
void updateStatus( Status status, const QString& message );
|
||||
|
||||
private:
|
||||
static QString statusLabel( Status status );
|
||||
|
||||
private:
|
||||
Status m_status;
|
||||
QStringList m_messages;
|
||||
std::unique_ptr<caf::PdmObject> m_result;
|
||||
};
|
||||
@@ -1,260 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RicfFieldHandle.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmScriptIOMessages.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QTextStream>
|
||||
|
||||
template <typename DataType>
|
||||
struct RicfFieldIOHandler
|
||||
{
|
||||
static void writeToField( DataType& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true )
|
||||
{
|
||||
inputStream >> fieldValue;
|
||||
if ( inputStream.status() == QTextStream::ReadCorruptData )
|
||||
{
|
||||
errorMessageContainer->addError( "Argument value is unreadable in the argument: \"" +
|
||||
errorMessageContainer->currentArgument + "\" in the command: \"" +
|
||||
errorMessageContainer->currentCommand + "\"" );
|
||||
|
||||
inputStream.setStatus( QTextStream::Ok );
|
||||
}
|
||||
}
|
||||
|
||||
static void readFromField( const DataType& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings = true,
|
||||
bool quoteNonBuiltins = false )
|
||||
{
|
||||
outputStream << fieldValue;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RicfFieldIOHandler<QString>
|
||||
{
|
||||
static void writeToField( QString& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true );
|
||||
static void readFromField( const QString& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings = true,
|
||||
bool quoteNonBuiltins = false );
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RicfFieldIOHandler<bool>
|
||||
{
|
||||
static void writeToField( bool& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true );
|
||||
static void readFromField( const bool& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings = true,
|
||||
bool quoteNonBuiltins = false );
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RicfFieldIOHandler<cvf::Color3f>
|
||||
{
|
||||
static void writeToField( cvf::Color3f& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true );
|
||||
static void readFromField( const cvf::Color3f& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings = true,
|
||||
bool quoteNonBuiltins = false );
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct RicfFieldIOHandler<caf::AppEnum<T>>
|
||||
{
|
||||
static void writeToField( caf::AppEnum<T>& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true )
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount( inputStream );
|
||||
QString accumulatedFieldValue;
|
||||
QChar nextChar;
|
||||
QChar currentChar;
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
nextChar = errorMessageContainer->peekNextChar( inputStream );
|
||||
if ( nextChar.isLetterOrNumber() || nextChar == QChar( '_' ) )
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount( inputStream );
|
||||
accumulatedFieldValue += currentChar;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !fieldValue.setFromText( accumulatedFieldValue ) )
|
||||
{
|
||||
// Unexpected enum value
|
||||
// Error message
|
||||
errorMessageContainer->addError( "Argument must be valid enum value. " +
|
||||
errorMessageContainer->currentArgument + "\" argument of the command: \"" +
|
||||
errorMessageContainer->currentCommand + "\"" );
|
||||
}
|
||||
}
|
||||
|
||||
static void readFromField( const caf::AppEnum<T>& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings = true,
|
||||
bool quoteNonBuiltins = false )
|
||||
{
|
||||
if ( quoteNonBuiltins )
|
||||
{
|
||||
outputStream << "\"" << fieldValue << "\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
outputStream << fieldValue;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct RicfFieldIOHandler<std::vector<T>>
|
||||
{
|
||||
static void writeToField( std::vector<T>& fieldValue,
|
||||
QTextStream& inputStream,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true )
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount( inputStream );
|
||||
QChar chr = errorMessageContainer->readCharWithLineNumberCount( inputStream );
|
||||
if ( chr == QChar( '[' ) )
|
||||
{
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount( inputStream );
|
||||
QChar nextChar = errorMessageContainer->peekNextChar( inputStream );
|
||||
if ( nextChar == QChar( ']' ) )
|
||||
{
|
||||
nextChar = errorMessageContainer->readCharWithLineNumberCount( inputStream );
|
||||
break;
|
||||
}
|
||||
else if ( nextChar == QChar( ',' ) )
|
||||
{
|
||||
nextChar = errorMessageContainer->readCharWithLineNumberCount( inputStream );
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount( inputStream );
|
||||
}
|
||||
|
||||
T value;
|
||||
RicfFieldIOHandler<T>::writeToField( value, inputStream, errorMessageContainer, true );
|
||||
fieldValue.push_back( value );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessageContainer->addError( "Array argument is missing start '['. " +
|
||||
errorMessageContainer->currentArgument + "\" argument of the command: \"" +
|
||||
errorMessageContainer->currentCommand + "\"" );
|
||||
}
|
||||
}
|
||||
|
||||
static void readFromField( const std::vector<T>& fieldValue,
|
||||
QTextStream& outputStream,
|
||||
bool quoteStrings = true,
|
||||
bool quoteNonBuiltins = false )
|
||||
{
|
||||
outputStream << "[";
|
||||
for ( size_t i = 0; i < fieldValue.size(); ++i )
|
||||
{
|
||||
RicfFieldIOHandler<T>::readFromField( fieldValue[i], outputStream, quoteNonBuiltins );
|
||||
if ( i < fieldValue.size() - 1 )
|
||||
{
|
||||
outputStream << ", ";
|
||||
}
|
||||
}
|
||||
outputStream << "]";
|
||||
}
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
template <typename FieldType>
|
||||
class RicfFieldCapability : public RicfFieldHandle
|
||||
{
|
||||
public:
|
||||
RicfFieldCapability( FieldType* field, const QString& fieldName, bool giveOwnership )
|
||||
: RicfFieldHandle( field, fieldName, giveOwnership )
|
||||
{
|
||||
m_field = field;
|
||||
}
|
||||
|
||||
// Xml Serializing
|
||||
public:
|
||||
void writeToField( QTextStream& inputStream,
|
||||
caf::PdmObjectFactory* objectFactory,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true ) override
|
||||
{
|
||||
typename FieldType::FieldDataType value;
|
||||
RicfFieldIOHandler<typename FieldType::FieldDataType>::writeToField( value,
|
||||
inputStream,
|
||||
errorMessageContainer,
|
||||
stringsAreQuoted );
|
||||
|
||||
if ( this->isIOWriteable() )
|
||||
{
|
||||
m_field->setValue( value );
|
||||
}
|
||||
}
|
||||
|
||||
void readFromField( QTextStream& outputStream, bool quoteStrings = true, bool quoteNonBuiltins = false ) const override
|
||||
{
|
||||
RicfFieldIOHandler<typename FieldType::FieldDataType>::readFromField( m_field->value(),
|
||||
outputStream,
|
||||
quoteStrings,
|
||||
quoteNonBuiltins );
|
||||
}
|
||||
|
||||
private:
|
||||
FieldType* m_field;
|
||||
};
|
||||
|
||||
template <typename FieldType>
|
||||
void AddRicfCapabilityToField( FieldType* field, const QString& fieldName )
|
||||
{
|
||||
if ( field->template capability<RicfFieldCapability<FieldType>>() == nullptr )
|
||||
{
|
||||
new RicfFieldCapability<FieldType>( field, fieldName, true );
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RicfFieldHandle.h"
|
||||
#include "cafPdmFieldHandle.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfFieldHandle::RicfFieldHandle( caf::PdmFieldHandle* owner, const QString& scriptFieldName, bool giveOwnership )
|
||||
: caf::PdmFieldScriptability( owner, scriptFieldName, giveOwnership )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfFieldHandle::~RicfFieldHandle()
|
||||
{
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "cafPdmFieldScriptability.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObjectFactory;
|
||||
class PdmFieldHandle;
|
||||
class PdmScriptIOMessages;
|
||||
} // namespace caf
|
||||
|
||||
class QTextStream;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfFieldHandle : public caf::PdmFieldScriptability
|
||||
{
|
||||
public:
|
||||
RicfFieldHandle( caf::PdmFieldHandle* owner, const QString& scriptFieldName, bool giveOwnership );
|
||||
~RicfFieldHandle() override;
|
||||
|
||||
private:
|
||||
caf::PdmFieldHandle* m_owner;
|
||||
QString m_fieldName;
|
||||
bool m_IOWriteable;
|
||||
};
|
||||
@@ -1,55 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "cafPdmObjectCapability.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObject;
|
||||
class PdmObjectHandle;
|
||||
class PdmObjectFactory;
|
||||
class PdmScriptIOMessages;
|
||||
} // namespace caf
|
||||
|
||||
class QTextStream;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfObjectCapability : public caf::PdmObjectCapability
|
||||
{
|
||||
public:
|
||||
RicfObjectCapability( caf::PdmObjectHandle* owner, bool giveOwnership );
|
||||
|
||||
~RicfObjectCapability() override;
|
||||
|
||||
void readFields( QTextStream& inputStream,
|
||||
caf::PdmObjectFactory* objectFactory,
|
||||
caf::PdmScriptIOMessages* errorMessageContainer );
|
||||
void writeFields( QTextStream& outputStream ) const;
|
||||
|
||||
private:
|
||||
caf::PdmObjectHandle* m_owner;
|
||||
};
|
||||
@@ -19,9 +19,9 @@
|
||||
#include "RifcCommandFileReader.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
#include "RicfObjectCapability.h"
|
||||
|
||||
#include "cafPdmObjectFactory.h"
|
||||
#include "cafPdmObjectScriptability.h"
|
||||
#include "cafPdmScriptIOMessages.h"
|
||||
|
||||
#include <QTextStream>
|
||||
@@ -127,7 +127,7 @@ std::vector<RicfCommandObject*> RicfCommandFileReader::readCommands( QTextStream
|
||||
else
|
||||
{
|
||||
readCommands.push_back( cObj );
|
||||
auto rcfCap = cObj->capability<RicfObjectCapability>();
|
||||
auto rcfCap = cObj->capability<caf::PdmObjectScriptability>();
|
||||
errorMessageContainer->currentCommand = commandName;
|
||||
rcfCap->readFields( inputStream, objectFactory, errorMessageContainer );
|
||||
errorMessageContainer->currentCommand = "";
|
||||
@@ -144,7 +144,7 @@ void RicfCommandFileReader::writeCommands( QTextStream& outputStream, const std:
|
||||
{
|
||||
for ( const auto& cmdObj : commandsToWrite )
|
||||
{
|
||||
auto rcfCap = cmdObj->capability<RicfObjectCapability>();
|
||||
auto rcfCap = cmdObj->capability<caf::PdmObjectScriptability>();
|
||||
if ( !rcfCap ) continue;
|
||||
|
||||
outputStream << cmdObj->classKeyword();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
@@ -25,13 +26,13 @@ CAF_PDM_SOURCE_INIT( RicfCloneView, "cloneView" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCloneView::RicfCloneView()
|
||||
{
|
||||
RICF_InitField( &m_viewId, "viewId", -1, "View Id", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewId, "viewId", -1, "View Id", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCloneView::execute()
|
||||
caf::PdmScriptResponse RicfCloneView::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
std::vector<Rim3dView*> allViews;
|
||||
@@ -66,7 +67,7 @@ RicfCommandResponse RicfCloneView::execute()
|
||||
|
||||
if ( newViewId >= 0 )
|
||||
{
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
response.setResult( new RicfCreateViewResult( newViewId ) );
|
||||
return response;
|
||||
}
|
||||
@@ -75,5 +76,5 @@ RicfCommandResponse RicfCloneView::execute()
|
||||
|
||||
QString error = QString( "cloneView: Could not clone view with id %1" ).arg( m_viewId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfCloneView : public RicfCommandObject
|
||||
public:
|
||||
RicfCloneView();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_viewId;
|
||||
|
||||
@@ -32,8 +32,8 @@ RicfCloseProject::RicfCloseProject()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCloseProject::execute()
|
||||
caf::PdmScriptResponse RicfCloseProject::execute()
|
||||
{
|
||||
RiaApplication::instance()->closeProject();
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfCloseProject : public RicfCommandObject
|
||||
public:
|
||||
RicfCloseProject();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfComputeCaseGroupStatistics, "computeCaseGroupStatistics" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -37,16 +39,16 @@ CAF_PDM_SOURCE_INIT( RicfComputeCaseGroupStatistics, "computeCaseGroupStatistics
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfComputeCaseGroupStatistics::RicfComputeCaseGroupStatistics()
|
||||
{
|
||||
RICF_InitField( &m_groupId, "caseGroupId", -1, "Case Group ID", "", "", "" );
|
||||
RICF_InitField( &m_caseIds, "caseIds", std::vector<int>(), "Case IDs", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_groupId, "caseGroupId", -1, "Case Group ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseIds, "caseIds", std::vector<int>(), "Case IDs", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfComputeCaseGroupStatistics::execute()
|
||||
caf::PdmScriptResponse RicfComputeCaseGroupStatistics::execute()
|
||||
{
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
|
||||
std::vector<int> caseIds = m_caseIds.v();
|
||||
|
||||
@@ -83,7 +85,7 @@ RicfCommandResponse RicfComputeCaseGroupStatistics::execute()
|
||||
"statistics case, cannot compute statistics." )
|
||||
.arg( caseId );
|
||||
RiaLogging::warning( warning );
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warning );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warning );
|
||||
}
|
||||
foundCase = true;
|
||||
break;
|
||||
@@ -99,7 +101,7 @@ RicfCommandResponse RicfComputeCaseGroupStatistics::execute()
|
||||
QString( "computeCaseGroupStatistics: Could not find statistics case with ID %1." ).arg( caseId );
|
||||
|
||||
RiaLogging::warning( warning );
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warning );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warning );
|
||||
}
|
||||
}
|
||||
return response;
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfComputeCaseGroupStatistics : public RicfCommandObject
|
||||
public:
|
||||
RicfComputeCaseGroupStatistics();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_groupId;
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
@@ -47,13 +49,13 @@ CAF_PDM_SOURCE_INIT( RicfCreateGridCaseGroup, "createGridCaseGroup" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateGridCaseGroup::RicfCreateGridCaseGroup()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_casePaths, "casePaths", "List of Paths to Case Files", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_casePaths, "casePaths", "List of Paths to Case Files", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateGridCaseGroup::execute()
|
||||
caf::PdmScriptResponse RicfCreateGridCaseGroup::execute()
|
||||
{
|
||||
QStringList casePaths;
|
||||
for ( QString casePath : m_casePaths() )
|
||||
@@ -71,10 +73,10 @@ RicfCommandResponse RicfCreateGridCaseGroup::execute()
|
||||
|
||||
if ( RiaImportEclipseCaseTools::addEclipseCases( casePaths, &caseGroup ) && caseGroup )
|
||||
{
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
response.setResult( new RicfCreateGridCaseGroupResult( caseGroup->groupId(), caseGroup->name() ) );
|
||||
return response;
|
||||
}
|
||||
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, "Could not load grid case group" );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, "Could not load grid case group" );
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class RicfCreateGridCaseGroup : public RicfCommandObject
|
||||
public:
|
||||
RicfCreateGridCaseGroup();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<QString>> m_casePaths;
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "RiaWellNameComparer.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfCreateLgrForCompletions, "createLgrForCompletions" );
|
||||
@@ -47,19 +49,19 @@ CAF_PDM_SOURCE_INIT( RicfCreateLgrForCompletions, "createLgrForCompletions" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateLgrForCompletions::RicfCreateLgrForCompletions()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_timeStep, "timeStep", 0, "Time Step Index", "", "", "" );
|
||||
RICF_InitField( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
RICF_InitField( &m_refinementI, "refinementI", -1, "RefinementI", "", "", "" );
|
||||
RICF_InitField( &m_refinementJ, "refinementJ", -1, "RefinementJ", "", "", "" );
|
||||
RICF_InitField( &m_refinementK, "refinementK", -1, "RefinementK", "", "", "" );
|
||||
RICF_InitField( &m_splitType, "splitType", Lgr::SplitTypeEnum(), "SplitType", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_timeStep, "timeStep", 0, "Time Step Index", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_refinementI, "refinementI", -1, "RefinementI", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_refinementJ, "refinementJ", -1, "RefinementJ", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_refinementK, "refinementK", -1, "RefinementK", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_splitType, "splitType", Lgr::SplitTypeEnum(), "SplitType", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateLgrForCompletions::execute()
|
||||
caf::PdmScriptResponse RicfCreateLgrForCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -74,7 +76,7 @@ RicfCommandResponse RicfCreateLgrForCompletions::execute()
|
||||
QString error = QString( "createLgrForCompletions: These well paths were not found: " ) +
|
||||
wellsNotFound.join( ", " );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +84,7 @@ RicfCommandResponse RicfCreateLgrForCompletions::execute()
|
||||
{
|
||||
QString error( "No well paths found" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
@@ -103,7 +105,7 @@ RicfCommandResponse RicfCreateLgrForCompletions::execute()
|
||||
{
|
||||
QString error( QString( "createLgrForCompletions: Could not find case with ID %1" ).arg( m_caseId() ) );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +124,7 @@ RicfCommandResponse RicfCreateLgrForCompletions::execute()
|
||||
|
||||
feature->updateViews( eclipseCase );
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
if ( !wellsIntersectingOtherLgrs.empty() )
|
||||
{
|
||||
auto wellsList = wellsIntersectingOtherLgrs.join( ", " );
|
||||
@@ -130,7 +132,7 @@ RicfCommandResponse RicfCreateLgrForCompletions::execute()
|
||||
"LGR(s).Affected wells : " +
|
||||
wellsList );
|
||||
RiaLogging::warning( warning );
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warning );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warning );
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class RicfCreateLgrForCompletions : public RicfCommandObject
|
||||
public:
|
||||
RicfCreateLgrForCompletions();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "RiaWellNameComparer.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfCreateMultipleFractures, "createMultipleFractures" );
|
||||
|
||||
@@ -58,15 +59,15 @@ void AppEnum<MultipleFractures::Action>::setUp()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateMultipleFractures::RicfCreateMultipleFractures()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
RICF_InitField( &m_minDistFromWellTd, "minDistFromWellTd", 100.0, "Min Distance From Well TD", "", "", "" );
|
||||
RICF_InitField( &m_maxFracturesPerWell, "maxFracturesPerWell", 100, "Max Fractures per Well", "", "", "" );
|
||||
RICF_InitField( &m_templateId, "templateId", -1, "Template ID", "", "", "" );
|
||||
RICF_InitField( &m_topLayer, "topLayer", -1, "Top Layer", "", "", "" );
|
||||
RICF_InitField( &m_baseLayer, "baseLayer", -1, "Base Layer", "", "", "" );
|
||||
RICF_InitField( &m_spacing, "spacing", 300.0, "Spacing", "", "", "" );
|
||||
RICF_InitField( &m_action,
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_minDistFromWellTd, "minDistFromWellTd", 100.0, "Min Distance From Well TD", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_maxFracturesPerWell, "maxFracturesPerWell", 100, "Max Fractures per Well", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_templateId, "templateId", -1, "Template ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_topLayer, "topLayer", -1, "Top Layer", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_baseLayer, "baseLayer", -1, "Base Layer", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_spacing, "spacing", 300.0, "Spacing", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_action,
|
||||
"action",
|
||||
caf::AppEnum<MultipleFractures::Action>( MultipleFractures::APPEND_FRACTURES ),
|
||||
"Action",
|
||||
@@ -78,7 +79,7 @@ RicfCreateMultipleFractures::RicfCreateMultipleFractures()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateMultipleFractures::execute()
|
||||
caf::PdmScriptResponse RicfCreateMultipleFractures::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -99,7 +100,7 @@ RicfCommandResponse RicfCreateMultipleFractures::execute()
|
||||
QString error =
|
||||
QString( "createMultipleFractures: These well paths were not found: %1" ).arg( wellsNotFound.join( ", " ) );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +108,7 @@ RicfCommandResponse RicfCreateMultipleFractures::execute()
|
||||
{
|
||||
QString error = QString( "createMultipleFractures: Could not find case with ID %1" ).arg( m_caseId );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
if ( !fractureTemplate )
|
||||
@@ -115,21 +116,21 @@ RicfCommandResponse RicfCreateMultipleFractures::execute()
|
||||
QString error =
|
||||
QString( "createMultipleFractures: Could not find fracture template with ID %1" ).arg( m_templateId );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
if ( wellPaths.empty() )
|
||||
{
|
||||
QString error( "createMultipleFractures: No wellpaths found" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
if ( !validateArguments() )
|
||||
{
|
||||
QString error( "createMultipleFractures: Mandatory argument(s) missing" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RicCreateMultipleFracturesOptionItemUi* options = new RicCreateMultipleFracturesOptionItemUi();
|
||||
@@ -163,7 +164,7 @@ RicfCommandResponse RicfCreateMultipleFractures::execute()
|
||||
if ( m_action == MultipleFractures::APPEND_FRACTURES ) feature->appendFractures();
|
||||
if ( m_action == MultipleFractures::REPLACE_FRACTURES ) feature->replaceFractures();
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -49,7 +49,7 @@ class RicfCreateMultipleFractures : public RicfCommandObject
|
||||
public:
|
||||
RicfCreateMultipleFractures();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
bool validateArguments() const;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimSaturationPressurePlotCollection.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfCreateSaturationPressurePlots, "createSaturationPressurePlots" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -36,13 +38,13 @@ CAF_PDM_SOURCE_INIT( RicfCreateSaturationPressurePlots, "createSaturationPressur
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateSaturationPressurePlots::RicfCreateSaturationPressurePlots()
|
||||
{
|
||||
RICF_InitField( &m_caseIds, "caseIds", std::vector<int>(), "Case IDs", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseIds, "caseIds", std::vector<int>(), "Case IDs", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateSaturationPressurePlots::execute()
|
||||
caf::PdmScriptResponse RicfCreateSaturationPressurePlots::execute()
|
||||
{
|
||||
std::vector<int> caseIds = m_caseIds();
|
||||
if ( caseIds.empty() )
|
||||
@@ -62,7 +64,7 @@ RicfCommandResponse RicfCreateSaturationPressurePlots::execute()
|
||||
{
|
||||
QString error( "createSaturationPressurePlots: No cases found" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
@@ -70,7 +72,7 @@ RicfCommandResponse RicfCreateSaturationPressurePlots::execute()
|
||||
{
|
||||
QString error( "No project loaded" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
auto eclipeCases = project->eclipseCases();
|
||||
@@ -93,5 +95,5 @@ RicfCommandResponse RicfCreateSaturationPressurePlots::execute()
|
||||
collection->updateAllRequiredEditors();
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfCreateSaturationPressurePlots : public RicfCommandObject
|
||||
public:
|
||||
RicfCreateSaturationPressurePlots();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<int>> m_caseIds;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
@@ -49,13 +50,13 @@ CAF_PDM_SOURCE_INIT( RicfCreateStatisticsCase, "createStatisticsCase" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateStatisticsCase::RicfCreateStatisticsCase()
|
||||
{
|
||||
RICF_InitField( &m_caseGroupId, "caseGroupId", -1, "Case Group Id", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseGroupId, "caseGroupId", -1, "Case Group Id", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateStatisticsCase::execute()
|
||||
caf::PdmScriptResponse RicfCreateStatisticsCase::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
|
||||
@@ -68,10 +69,10 @@ RicfCommandResponse RicfCreateStatisticsCase::execute()
|
||||
RimEclipseStatisticsCase* createdObject = gridCaseGroup->createAndAppendStatisticsCase();
|
||||
project->assignCaseIdToCase( createdObject );
|
||||
gridCaseGroup->updateConnectedEditors();
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
response.setResult( new RicfCreateStatisticsCaseResult( createdObject->caseId() ) );
|
||||
return response;
|
||||
}
|
||||
}
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, "Could not find grid case group" );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, "Could not find grid case group" );
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class RicfCreateStatisticsCase : public RicfCommandObject
|
||||
public:
|
||||
RicfCreateStatisticsCase();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseGroupId;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
@@ -34,13 +35,13 @@ CAF_PDM_SOURCE_INIT( RicfCreateView, "createView" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateView::RicfCreateView()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case Id", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case Id", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateView::execute()
|
||||
caf::PdmScriptResponse RicfCreateView::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
std::vector<RimCase*> allCases;
|
||||
@@ -72,7 +73,7 @@ RicfCommandResponse RicfCreateView::execute()
|
||||
|
||||
if ( viewId >= 0 )
|
||||
{
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
response.setResult( new RicfCreateViewResult( viewId ) );
|
||||
return response;
|
||||
}
|
||||
@@ -81,5 +82,5 @@ RicfCommandResponse RicfCreateView::execute()
|
||||
|
||||
QString error = QString( "createView: Could not create view for case id %1" ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class RicfCreateView : public RicfCommandObject
|
||||
public:
|
||||
RicfCreateView();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "RimWellBoreStabilityPlot.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfCreateWbsPlotResult, "createWbsPlotResult" );
|
||||
@@ -49,9 +51,9 @@ CAF_PDM_SOURCE_INIT( RicfCreateWellBoreStabilityPlotFeature, "createWellBoreStab
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateWellBoreStabilityPlotFeature::RicfCreateWellBoreStabilityPlotFeature()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "GeoMech Case Id", "", "", "" );
|
||||
RICF_InitField( &m_wellPath, "wellPath", QString( "" ), "Well Path", "", "", "" );
|
||||
RICF_InitField( &m_timeStep, "timeStep", -1, "Time Step", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "GeoMech Case Id", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_wellPath, "wellPath", QString( "" ), "Well Path", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_timeStep, "timeStep", -1, "Time Step", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wbsParameters, "wbsParameters", "WbsParameters", "", "", "" );
|
||||
}
|
||||
@@ -59,7 +61,7 @@ RicfCreateWellBoreStabilityPlotFeature::RicfCreateWellBoreStabilityPlotFeature()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateWellBoreStabilityPlotFeature::execute()
|
||||
caf::PdmScriptResponse RicfCreateWellBoreStabilityPlotFeature::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
|
||||
@@ -93,17 +95,17 @@ RicfCommandResponse RicfCreateWellBoreStabilityPlotFeature::execute()
|
||||
QString error = QString( "The well path %1 has no geometry. Cannot create a Well Bore Stability Plot" )
|
||||
.arg( chosenWellPath->name() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RimWellBoreStabilityPlot* wbsPlot =
|
||||
RicNewWellBoreStabilityPlotFeature::createPlot( chosenCase, chosenWellPath, m_timeStep(), m_wbsParameters() );
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
response.setResult( new RicfCreateWbsPlotResult( wbsPlot->id() ) );
|
||||
return response;
|
||||
}
|
||||
|
||||
QString error = QString( "createWellBoreStabilityPlot: Could not find GeoMech case with id %1" ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class RicfCreateWellBoreStabilityPlotFeature : public RicfCommandObject
|
||||
|
||||
public:
|
||||
RicfCreateWellBoreStabilityPlotFeature();
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
@@ -40,19 +42,19 @@ CAF_PDM_SOURCE_INIT( RicfExportFlowCharacteristics, "exportFlowCharacteristics"
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportFlowCharacteristics::RicfExportFlowCharacteristics()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_selectedTimeSteps, "timeSteps", std::vector<int>(), "Selected Time Steps", "", "", "" );
|
||||
RICF_InitField( &m_injectors, "injectors", std::vector<QString>(), "Injectors", "", "", "" );
|
||||
RICF_InitField( &m_producers, "producers", std::vector<QString>(), "Producers", "", "", "" );
|
||||
RICF_InitField( &m_fileName, "fileName", QString(), "Export File Name", "", "", "" );
|
||||
RICF_InitField( &m_minCommunication, "minimumCommunication", 0.0, "Minimum Communication", "", "", "" );
|
||||
RICF_InitField( &m_maxPvFraction, "aquiferCellThreshold", 0.1, "Aquifer Cell Threshold", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_selectedTimeSteps, "timeSteps", std::vector<int>(), "Selected Time Steps", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_injectors, "injectors", std::vector<QString>(), "Injectors", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_producers, "producers", std::vector<QString>(), "Producers", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_fileName, "fileName", QString(), "Export File Name", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_minCommunication, "minimumCommunication", 0.0, "Minimum Communication", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_maxPvFraction, "aquiferCellThreshold", 0.1, "Aquifer Cell Threshold", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportFlowCharacteristics::execute()
|
||||
caf::PdmScriptResponse RicfExportFlowCharacteristics::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -61,7 +63,7 @@ RicfCommandResponse RicfExportFlowCharacteristics::execute()
|
||||
{
|
||||
QString error = QString( "exportFlowCharacteristics: Could not find case with ID %1." ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
{
|
||||
@@ -79,7 +81,7 @@ RicfCommandResponse RicfExportFlowCharacteristics::execute()
|
||||
if ( !exportDir.mkpath( "." ) )
|
||||
{
|
||||
QString msg = QString( "Failed to create folder - %1" ).arg( exportFolder );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, msg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, msg );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,10 +113,10 @@ RicfCommandResponse RicfExportFlowCharacteristics::execute()
|
||||
else
|
||||
{
|
||||
QString msg = QString( "Failed to export file - %1" ).arg( exportFileName );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, msg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class RicfExportFlowCharacteristics : public RicfCommandObject
|
||||
public:
|
||||
RicfExportFlowCharacteristics();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include "RiaWellNameComparer.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportLgrForCompletions, "exportLgrForCompletions" );
|
||||
@@ -45,19 +47,19 @@ CAF_PDM_SOURCE_INIT( RicfExportLgrForCompletions, "exportLgrForCompletions" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportLgrForCompletions::RicfExportLgrForCompletions()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" );
|
||||
RICF_InitField( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
RICF_InitField( &m_refinementI, "refinementI", -1, "RefinementI", "", "", "" );
|
||||
RICF_InitField( &m_refinementJ, "refinementJ", -1, "RefinementJ", "", "", "" );
|
||||
RICF_InitField( &m_refinementK, "refinementK", -1, "RefinementK", "", "", "" );
|
||||
RICF_InitField( &m_splitType, "splitType", Lgr::SplitTypeEnum(), "SplitType", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_refinementI, "refinementI", -1, "RefinementI", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_refinementJ, "refinementJ", -1, "RefinementJ", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_refinementK, "refinementK", -1, "RefinementK", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_splitType, "splitType", Lgr::SplitTypeEnum(), "SplitType", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportLgrForCompletions::execute()
|
||||
caf::PdmScriptResponse RicfExportLgrForCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -72,7 +74,7 @@ RicfCommandResponse RicfExportLgrForCompletions::execute()
|
||||
QString error( QString( "exportLgrForCompletions: These well paths were not found: " ) +
|
||||
wellsNotFound.join( ", " ) );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +82,7 @@ RicfCommandResponse RicfExportLgrForCompletions::execute()
|
||||
{
|
||||
QString error( "exportLgrForCompletions: Could not find any well paths" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::LGRS );
|
||||
@@ -97,7 +99,7 @@ RicfCommandResponse RicfExportLgrForCompletions::execute()
|
||||
{
|
||||
QString error( QString( "exportLgrForCompletions: Could not find case with ID %1" ).arg( m_caseId() ) );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
caf::VecIjk lgrCellCounts( m_refinementI, m_refinementJ, m_refinementK );
|
||||
@@ -112,7 +114,7 @@ RicfCommandResponse RicfExportLgrForCompletions::execute()
|
||||
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES},
|
||||
&wellsIntersectingOtherLgrs );
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
if ( !wellsIntersectingOtherLgrs.empty() )
|
||||
{
|
||||
auto wellsList = wellsIntersectingOtherLgrs.join( ", " );
|
||||
@@ -120,7 +122,7 @@ RicfCommandResponse RicfExportLgrForCompletions::execute()
|
||||
"exportLgrForCompletions: No export for some wells due to existing intersecting LGR(s).Affected wells : " +
|
||||
wellsList );
|
||||
RiaLogging::warning( warning );
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warning );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warning );
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class RicfExportLgrForCompletions : public RicfCommandObject
|
||||
public:
|
||||
RicfExportLgrForCompletions();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include "CompletionExportCommands/RicExportCompletionDataSettingsUi.h"
|
||||
#include "CompletionExportCommands/RicWellPathExportMswCompletionsImpl.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportMsw, "exportMsw" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -43,18 +45,24 @@ CAF_PDM_SOURCE_INIT( RicfExportMsw, "exportMsw" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportMsw::RicfExportMsw()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_wellPathName, "wellPath", QString(), "Well Path Name", "", "", "" );
|
||||
RICF_InitField( &m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "" );
|
||||
RICF_InitField( &m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "" );
|
||||
RICF_InitField( &m_includeFractures, "includeFractures", true, "Include Fractures", "", "", "" );
|
||||
RICF_InitField( &m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_wellPathName, "wellPath", QString(), "Well Path Name", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_includeFractures, "includeFractures", true, "Include Fractures", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_fileSplit,
|
||||
"fileSplit",
|
||||
RicExportCompletionDataSettingsUi::ExportSplitType(),
|
||||
"File Split",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportMsw::execute()
|
||||
caf::PdmScriptResponse RicfExportMsw::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -65,7 +73,7 @@ RicfCommandResponse RicfExportMsw::execute()
|
||||
{
|
||||
QString error = QString( "exportMsw: Could not find case with ID %1." ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::COMPLETIONS );
|
||||
@@ -85,10 +93,10 @@ RicfCommandResponse RicfExportMsw::execute()
|
||||
{
|
||||
QString error = QString( "exportMsw: Could not find well path with name %1" ).arg( m_wellPathName() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions( exportSettings, {wellPath} );
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class RicfExportMsw : public RicfCommandObject
|
||||
public:
|
||||
RicfExportMsw();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaProjectModifier.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportMultiCaseSnapshots, "exportMultiCaseSnapshots" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -31,26 +33,26 @@ CAF_PDM_SOURCE_INIT( RicfExportMultiCaseSnapshots, "exportMultiCaseSnapshots" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportMultiCaseSnapshots::RicfExportMultiCaseSnapshots()
|
||||
{
|
||||
RICF_InitField( &m_gridListFile, "gridListFile", QString(), "Grid List File", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_gridListFile, "gridListFile", QString(), "Grid List File", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportMultiCaseSnapshots::execute()
|
||||
caf::PdmScriptResponse RicfExportMultiCaseSnapshots::execute()
|
||||
{
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
if ( !app )
|
||||
{
|
||||
QString error( "exportMultiCaseSnapshots: Requires GUI Application" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
if ( m_gridListFile().isNull() )
|
||||
{
|
||||
QString error( "exportMultiCaseSnapshots: Required parameter gridListFile." );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
@@ -59,7 +61,7 @@ RicfCommandResponse RicfExportMultiCaseSnapshots::execute()
|
||||
QString error( "exportMultiCaseSnapshots: 'openProject' must be called before 'exportMultiCaseSnapshots' to "
|
||||
"specify project file to replace cases in." );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
std::vector<QString> listFileNames = RiaApplication::readFileListFromTextFile( m_gridListFile() );
|
||||
@@ -67,5 +69,5 @@ RicfCommandResponse RicfExportMultiCaseSnapshots::execute()
|
||||
listFileNames,
|
||||
RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::SNAPSHOTS ) );
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfExportMultiCaseSnapshots : public RicfCommandObject
|
||||
public:
|
||||
RicfExportMultiCaseSnapshots();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_gridListFile;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QDir>
|
||||
@@ -47,19 +48,19 @@ CAF_PDM_SOURCE_INIT( RicfExportProperty, "exportProperty" );
|
||||
RicfExportProperty::RicfExportProperty()
|
||||
{
|
||||
// clang-format off
|
||||
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
|
||||
RICF_InitField(&m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", "");
|
||||
RICF_InitField(&m_propertyName, "property", QString(), "Property Name", "", "", "");
|
||||
RICF_InitField(&m_eclipseKeyword, "eclipseKeyword", QString(), "Eclipse Keyword", "", "", "");
|
||||
RICF_InitField(&m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", "");
|
||||
RICF_InitField(&m_exportFileName, "exportFile", QString(), "Export FileName", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_caseId, "caseId", -1, "Case ID", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_propertyName, "property", QString(), "Property Name", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_eclipseKeyword, "eclipseKeyword", QString(), "Eclipse Keyword", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_exportFileName, "exportFile", QString(), "Export FileName", "", "", "");
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportProperty::execute()
|
||||
caf::PdmScriptResponse RicfExportProperty::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -69,7 +70,7 @@ RicfCommandResponse RicfExportProperty::execute()
|
||||
{
|
||||
QString error = QString( "exportProperty: Could not find case with ID %1" ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
if ( !eclipseCase->eclipseCaseData() )
|
||||
@@ -78,7 +79,7 @@ RicfCommandResponse RicfExportProperty::execute()
|
||||
{
|
||||
QString error = QString( "exportProperty: Could not find eclipseCaseData with ID %1" ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,7 +92,7 @@ RicfCommandResponse RicfExportProperty::execute()
|
||||
{
|
||||
QString error = QString( "exportProperty: Could not find result property : %1" ).arg( m_propertyName() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
QString filePath = m_exportFileName;
|
||||
@@ -118,8 +119,8 @@ RicfCommandResponse RicfExportProperty::execute()
|
||||
m_undefinedValue,
|
||||
&errMsg ) )
|
||||
{
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errMsg );
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class RicfExportProperty : public RicfCommandObject
|
||||
public:
|
||||
RicfExportProperty();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <limits>
|
||||
@@ -47,16 +48,16 @@ CAF_PDM_SOURCE_INIT( RicfExportPropertyInViews, "exportPropertyInViews" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportPropertyInViews::RicfExportPropertyInViews()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_viewIds, "viewIds", std::vector<int>(), "View IDs", "", "", "" );
|
||||
RICF_InitField( &m_viewNames, "viewNames", std::vector<QString>(), "View Names", "", "", "" );
|
||||
RICF_InitField( &m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewIds, "viewIds", std::vector<int>(), "View IDs", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewNames, "viewNames", std::vector<QString>(), "View Names", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportPropertyInViews::execute()
|
||||
caf::PdmScriptResponse RicfExportPropertyInViews::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -65,7 +66,7 @@ RicfCommandResponse RicfExportPropertyInViews::execute()
|
||||
{
|
||||
QString error( QString( "exportProperty: Could not find case with ID %1" ).arg( m_caseId() ) );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
std::vector<RimEclipseView*> viewsForExport;
|
||||
@@ -110,7 +111,7 @@ RicfCommandResponse RicfExportPropertyInViews::execute()
|
||||
}
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
|
||||
for ( const auto& view : viewsForExport )
|
||||
{
|
||||
@@ -134,7 +135,7 @@ RicfCommandResponse RicfExportPropertyInViews::execute()
|
||||
.arg( view->currentTimeStep() )
|
||||
.arg( propertyName );
|
||||
RiaLogging::warning( warning );
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warning );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warning );
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -160,7 +161,7 @@ RicfCommandResponse RicfExportPropertyInViews::execute()
|
||||
&errorMsg );
|
||||
if ( !worked )
|
||||
{
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errorMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errorMsg );
|
||||
}
|
||||
}
|
||||
return response;
|
||||
|
||||
@@ -40,7 +40,7 @@ class RicfExportPropertyInViews : public RicfCommandObject
|
||||
public:
|
||||
RicfExportPropertyInViews();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
#include "CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportSimWellFractureCompletions, "exportSimWellFractureCompletions" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -44,13 +46,25 @@ CAF_PDM_SOURCE_INIT( RicfExportSimWellFractureCompletions, "exportSimWellFractur
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_viewId, "viewId", -1, "View ID", "", "", "" );
|
||||
RICF_InitField( &m_viewName, "viewName", QString( "" ), "View Name", "", "", "" );
|
||||
RICF_InitField( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" );
|
||||
RICF_InitField( &m_simWellNames, "simulationWellNames", std::vector<QString>(), "Simulation Well Names", "", "", "" );
|
||||
RICF_InitField( &m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "" );
|
||||
RICF_InitField( &m_compdatExport,
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewId, "viewId", -1, "View ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewName, "viewName", QString( "" ), "View Name", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_simWellNames,
|
||||
"simulationWellNames",
|
||||
std::vector<QString>(),
|
||||
"Simulation Well Names",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_fileSplit,
|
||||
"fileSplit",
|
||||
RicExportCompletionDataSettingsUi::ExportSplitType(),
|
||||
"File Split",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_compdatExport,
|
||||
"compdatExport",
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType(),
|
||||
"Compdat Export",
|
||||
@@ -62,7 +76,7 @@ RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportSimWellFractureCompletions::execute()
|
||||
caf::PdmScriptResponse RicfExportSimWellFractureCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -79,7 +93,7 @@ RicfCommandResponse RicfExportSimWellFractureCompletions::execute()
|
||||
{
|
||||
QString error = QString( "exportSimWellCompletions: Could not find case with ID %1" ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
}
|
||||
@@ -108,10 +122,10 @@ RicfCommandResponse RicfExportSimWellFractureCompletions::execute()
|
||||
.arg( m_viewName )
|
||||
.arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
if ( m_simWellNames().empty() )
|
||||
@@ -146,7 +160,7 @@ RicfCommandResponse RicfExportSimWellFractureCompletions::execute()
|
||||
.arg( m_viewName )
|
||||
.arg( m_caseId() );
|
||||
RiaLogging::warning( warning );
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warning );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warning );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class RicfExportSimWellFractureCompletions : public RicfCommandObject
|
||||
public:
|
||||
RicfExportSimWellFractureCompletions();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportSnapshots, "exportSnapshots" );
|
||||
@@ -58,24 +60,24 @@ void RicfExportSnapshots::SnapshotsTypeEnum::setUp()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportSnapshots::RicfExportSnapshots()
|
||||
{
|
||||
RICF_InitField( &m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "" );
|
||||
RICF_InitField( &m_prefix, "prefix", QString(), "Prefix", "", "", "" );
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case Id", "", "", "" );
|
||||
RICF_InitField( &m_viewId, "viewId", -1, "View Id", "", "", "" );
|
||||
RICF_InitField( &m_exportFolder, "exportFolder", QString(), "Export Folder", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &m_plotOutputFormat, "plotOutputFormat", "Output Format", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_prefix, "prefix", QString(), "Prefix", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case Id", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewId, "viewId", -1, "View Id", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_exportFolder, "exportFolder", QString(), "Export Folder", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_plotOutputFormat, "plotOutputFormat", "Output Format", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportSnapshots::execute()
|
||||
caf::PdmScriptResponse RicfExportSnapshots::execute()
|
||||
{
|
||||
if ( !RiaGuiApplication::isRunning() )
|
||||
{
|
||||
QString error( "RicfExportSnapshot: Command cannot run without a GUI" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
@@ -129,5 +131,5 @@ RicfCommandResponse RicfExportSnapshots::execute()
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
RiaGuiApplication::instance()->processEvents();
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
public:
|
||||
RicfExportSnapshots();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<SnapshotsTypeEnum> m_type;
|
||||
|
||||
@@ -38,8 +38,7 @@
|
||||
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include <cafUtils.h>
|
||||
|
||||
#include <QDir>
|
||||
@@ -63,31 +62,43 @@ void AppEnum<RicfExportVisibleCells::ExportKeyword>::setUp()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportVisibleCells::RicfExportVisibleCells()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_viewId, "viewId", -1, "View ID", "", "", "" );
|
||||
RICF_InitField( &m_viewName, "viewName", QString(), "View Name", "", "", "" );
|
||||
RICF_InitField( &m_exportKeyword,
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewId, "viewId", -1, "View ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewName, "viewName", QString(), "View Name", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_exportKeyword,
|
||||
"exportKeyword",
|
||||
caf::AppEnum<RicfExportVisibleCells::ExportKeyword>(),
|
||||
"Export Keyword",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
RICF_InitField( &m_visibleActiveCellsValue, "visibleActiveCellsValue", 1, "Visible Active Cells Value", "", "", "" );
|
||||
RICF_InitField( &m_hiddenActiveCellsValue, "hiddenActiveCellsValue", 0, "Hidden Active Cells Value", "", "", "" );
|
||||
RICF_InitField( &m_inactiveCellsValue, "inactiveCellsValue", 0, "Inactive Cells Value", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_visibleActiveCellsValue,
|
||||
"visibleActiveCellsValue",
|
||||
1,
|
||||
"Visible Active Cells Value",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_hiddenActiveCellsValue,
|
||||
"hiddenActiveCellsValue",
|
||||
0,
|
||||
"Hidden Active Cells Value",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_inactiveCellsValue, "inactiveCellsValue", 0, "Inactive Cells Value", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportVisibleCells::execute()
|
||||
caf::PdmScriptResponse RicfExportVisibleCells::execute()
|
||||
{
|
||||
if ( m_caseId < 0 || ( m_viewName().isEmpty() && m_viewId() < 0 ) )
|
||||
{
|
||||
QString error( "exportVisibleCells: CaseId or view name or view id not specified" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
RimEclipseView* eclipseView = nullptr;
|
||||
if ( m_viewId() >= 0 )
|
||||
@@ -105,7 +116,7 @@ RicfCommandResponse RicfExportVisibleCells::execute()
|
||||
.arg( m_viewName )
|
||||
.arg( m_caseId ) );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::CELLS );
|
||||
@@ -120,7 +131,7 @@ RicfCommandResponse RicfExportVisibleCells::execute()
|
||||
buildExportSettings( exportFolder, &exportSettings );
|
||||
RicSaveEclipseInputVisibleCellsFeature::executeCommand( eclipseView, exportSettings, "exportVisibleCells" );
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -45,7 +45,7 @@ class RicfExportVisibleCells : public RicfCommandObject
|
||||
public:
|
||||
RicfExportVisibleCells();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
void buildExportSettings( const QString& exportFolder, RicSaveEclipseInputVisibleCellsUi* exportSettings );
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
@@ -59,24 +61,24 @@ CAF_PDM_SOURCE_INIT( RicfExportWellLogPlotData, "exportWellLogPlotData" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportWellLogPlotData::RicfExportWellLogPlotData()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_format, "exportFormat", "", "", "", "" );
|
||||
RICF_InitField( &m_viewId, "viewId", -1, "", "", "", "" );
|
||||
RICF_InitField( &m_folder, "exportFolder", QString(), "", "", "", "" );
|
||||
RICF_InitField( &m_filePrefix, "filePrefix", QString(), "", "", "", "" );
|
||||
RICF_InitField( &m_exportTvdRkb, "exportTvdRkb", false, "", "", "", "" );
|
||||
RICF_InitField( &m_capitalizeFileNames, "capitalizeFileNames", false, "", "", "", "" );
|
||||
RICF_InitField( &m_resampleInterval, "resampleInterval", 0.0, "", "", "", "" );
|
||||
RICF_InitField( &m_convertCurveUnits, "convertCurveUnits", false, "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_format, "exportFormat", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewId, "viewId", -1, "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_folder, "exportFolder", QString(), "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_filePrefix, "filePrefix", QString(), "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_exportTvdRkb, "exportTvdRkb", false, "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_capitalizeFileNames, "capitalizeFileNames", false, "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_resampleInterval, "resampleInterval", 0.0, "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_convertCurveUnits, "convertCurveUnits", false, "", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportWellLogPlotData::execute()
|
||||
caf::PdmScriptResponse RicfExportWellLogPlotData::execute()
|
||||
{
|
||||
QStringList errorMessages;
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
|
||||
if ( QFileInfo::exists( m_folder ) )
|
||||
{
|
||||
@@ -133,7 +135,7 @@ RicfCommandResponse RicfExportWellLogPlotData::execute()
|
||||
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
public:
|
||||
RicfExportWellLogPlotData();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<ExportFormatEnum> m_format;
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#include "CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportWellPathCompletions, "exportWellPathCompletions" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -41,19 +43,25 @@ CAF_PDM_SOURCE_INIT( RicfExportWellPathCompletions, "exportWellPathCompletions"
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportWellPathCompletions::RicfExportWellPathCompletions()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" );
|
||||
RICF_InitField( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
|
||||
RICF_InitField( &m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "" );
|
||||
RICF_InitField( &m_compdatExport,
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_fileSplit,
|
||||
"fileSplit",
|
||||
RicExportCompletionDataSettingsUi::ExportSplitType(),
|
||||
"File Split",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_compdatExport,
|
||||
"compdatExport",
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType(),
|
||||
"Compdat Export",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
RICF_InitField( &m_combinationMode,
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_combinationMode,
|
||||
"combinationMode",
|
||||
RicExportCompletionDataSettingsUi::CombinationModeType(),
|
||||
"Combination Mode",
|
||||
@@ -61,12 +69,12 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
|
||||
"",
|
||||
"" );
|
||||
|
||||
RICF_InitField( &m_useLateralNTG, "useNtgHorizontally", false, "Use NTG Horizontally", "", "", "" );
|
||||
RICF_InitField( &m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "" );
|
||||
RICF_InitField( &m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "" );
|
||||
RICF_InitField( &m_includeFractures, "includeFractures", true, "Include Fractures", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_useLateralNTG, "useNtgHorizontally", false, "Use NTG Horizontally", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_includeFractures, "includeFractures", true, "Include Fractures", "", "", "" );
|
||||
|
||||
RICF_InitField( &m_excludeMainBoreForFishbones,
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_excludeMainBoreForFishbones,
|
||||
"excludeMainBoreForFishbones",
|
||||
false,
|
||||
"Exclude Main Bore for Fishbones",
|
||||
@@ -74,22 +82,40 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
|
||||
"",
|
||||
"" );
|
||||
|
||||
RICF_InitField( &m_performTransScaling, "performTransScaling", false, "Perform Transmissibility Scaling", "", "", "" );
|
||||
RICF_InitField( &m_transScalingTimeStep, "transScalingTimeStep", 0, "Transmissibility Scaling Pressure Time Step", "", "", "" );
|
||||
RICF_InitField( &m_transScalingInitialWBHP,
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_performTransScaling,
|
||||
"performTransScaling",
|
||||
false,
|
||||
"Perform Transmissibility Scaling",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_transScalingTimeStep,
|
||||
"transScalingTimeStep",
|
||||
0,
|
||||
"Transmissibility Scaling Pressure Time Step",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_transScalingInitialWBHP,
|
||||
"transScalingWBHPFromSummary",
|
||||
RicExportCompletionDataSettingsUi::TransScalingWBHPSource(),
|
||||
"Transmissibility Scaling WBHP from summary",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
RICF_InitField( &m_transScalingWBHP, "transScalingWBHP", 200.0, "Transmissibility Scaling Constant WBHP Value", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_transScalingWBHP,
|
||||
"transScalingWBHP",
|
||||
200.0,
|
||||
"Transmissibility Scaling Constant WBHP Value",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportWellPathCompletions::execute()
|
||||
caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -127,7 +153,7 @@ RicfCommandResponse RicfExportWellPathCompletions::execute()
|
||||
{
|
||||
QString error = QString( "exportWellPathCompletions: Could not find case with ID %1" ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
}
|
||||
@@ -139,7 +165,7 @@ RicfCommandResponse RicfExportWellPathCompletions::execute()
|
||||
}
|
||||
exportSettings->folder = exportFolder;
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
if ( m_wellPathNames().empty() )
|
||||
@@ -167,7 +193,7 @@ RicfCommandResponse RicfExportWellPathCompletions::execute()
|
||||
QString warning =
|
||||
QString( "exportWellPathCompletions: Could not find well path with name %1" ).arg( wellPathName );
|
||||
RiaLogging::warning( warning );
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warning );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warning );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class RicfExportWellPathCompletions : public RicfCommandObject
|
||||
public:
|
||||
RicfExportWellPathCompletions();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "RiaWellNameComparer.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportWellPaths, "exportWellPaths" );
|
||||
|
||||
@@ -44,14 +45,14 @@ CAF_PDM_SOURCE_INIT( RicfExportWellPaths, "exportWellPaths" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportWellPaths::RicfExportWellPaths()
|
||||
{
|
||||
RICF_InitField( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
RICF_InitField( &m_mdStepSize, "mdStepSize", 5.0, "MD Step Size", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_mdStepSize, "mdStepSize", 5.0, "MD Step Size", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportWellPaths::execute()
|
||||
caf::PdmScriptResponse RicfExportWellPaths::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@@ -66,7 +67,7 @@ RicfCommandResponse RicfExportWellPaths::execute()
|
||||
QString error( QString( "exportWellPaths: These well paths were not found: " ) +
|
||||
wellsNotFound.join( ", " ) );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +75,7 @@ RicfCommandResponse RicfExportWellPaths::execute()
|
||||
{
|
||||
QString error( "No well paths found" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::WELLPATHS );
|
||||
@@ -94,5 +95,5 @@ RicfCommandResponse RicfExportWellPaths::execute()
|
||||
feature->exportWellPath( wellPath, m_mdStepSize, exportFolder, false );
|
||||
}
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class RicfExportWellPaths : public RicfCommandObject
|
||||
public:
|
||||
RicfExportWellPaths();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<QString>> m_wellPathNames;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfImportFormationNames, "importFormationNames" );
|
||||
@@ -33,14 +35,14 @@ CAF_PDM_SOURCE_INIT( RicfImportFormationNames, "importFormationNames" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfImportFormationNames::RicfImportFormationNames()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_formationFiles, "formationFiles", "", "", "", "" );
|
||||
RICF_InitField( &m_applyToCaseId, "applyToCaseId", -1, "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_formationFiles, "formationFiles", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_applyToCaseId, "applyToCaseId", -1, "", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfImportFormationNames::execute()
|
||||
caf::PdmScriptResponse RicfImportFormationNames::execute()
|
||||
{
|
||||
QStringList errorMessages, warningMessages;
|
||||
|
||||
@@ -87,14 +89,14 @@ RicfCommandResponse RicfImportFormationNames::execute()
|
||||
errorMessages << "No formation files provided";
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
for ( QString warningMessage : warningMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warningMessage );
|
||||
}
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class RicfImportFormationNames : public RicfCommandObject
|
||||
public:
|
||||
RicfImportFormationNames();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<QString>> m_formationFiles;
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RimWellLogFile.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
@@ -44,11 +46,11 @@ CAF_PDM_SOURCE_INIT( RicfImportWellLogFiles, "importWellLogFiles" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfImportWellLogFiles::RicfImportWellLogFiles()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_wellLogFileFolder, "wellLogFolder", "", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &m_wellLogFilePaths, "wellLogFiles", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_wellLogFileFolder, "wellLogFolder", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_wellLogFilePaths, "wellLogFiles", "", "", "", "" );
|
||||
}
|
||||
|
||||
RicfCommandResponse RicfImportWellLogFiles::execute()
|
||||
caf::PdmScriptResponse RicfImportWellLogFiles::execute()
|
||||
{
|
||||
QStringList errorMessages, warningMessages;
|
||||
QStringList wellLogFilePaths;
|
||||
@@ -94,7 +96,7 @@ RicfCommandResponse RicfImportWellLogFiles::execute()
|
||||
}
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
|
||||
if ( !wellLogFilePaths.empty() )
|
||||
{
|
||||
@@ -117,12 +119,12 @@ RicfCommandResponse RicfImportWellLogFiles::execute()
|
||||
|
||||
for ( QString warningMessage : warningMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warningMessage );
|
||||
}
|
||||
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -50,7 +50,7 @@ class RicfImportWellLogFiles : public RicfCommandObject
|
||||
public:
|
||||
RicfImportWellLogFiles();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_wellLogFileFolder;
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
@@ -45,13 +47,13 @@ CAF_PDM_SOURCE_INIT( RicfLoadCase, "loadCase" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfLoadCase::RicfLoadCase()
|
||||
{
|
||||
RICF_InitField( &m_path, "path", QString(), "Path to Case File", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_path, "path", QString(), "Path to Case File", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfLoadCase::execute()
|
||||
caf::PdmScriptResponse RicfLoadCase::execute()
|
||||
{
|
||||
QString absolutePath = m_path;
|
||||
QFileInfo projectPathInfo( absolutePath );
|
||||
@@ -67,10 +69,10 @@ RicfCommandResponse RicfLoadCase::execute()
|
||||
{
|
||||
QString error = QString( "loadCase: Unable to load case from %1" ).arg( absolutePath );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
CAF_ASSERT( fileCaseIdMap.size() == 1u );
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
response.setResult( new RicfLoadCaseResult( fileCaseIdMap.begin()->second ) );
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class RicfLoadCase : public RicfCommandObject
|
||||
public:
|
||||
RicfLoadCase();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_path;
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
@@ -33,13 +35,13 @@ CAF_PDM_SOURCE_INIT( RicfOpenProject, "openProject" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfOpenProject::RicfOpenProject()
|
||||
{
|
||||
RICF_InitField( &m_path, "path", QString(), "Path", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_path, "path", QString(), "Path", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfOpenProject::execute()
|
||||
caf::PdmScriptResponse RicfOpenProject::execute()
|
||||
{
|
||||
QString projectPath = m_path;
|
||||
QFileInfo projectPathInfo( projectPath );
|
||||
@@ -53,10 +55,10 @@ RicfCommandResponse RicfOpenProject::execute()
|
||||
{
|
||||
QString errMsg = QString( "openProject: Unable to open project at %1" ).arg( m_path() );
|
||||
RiaLogging::error( errMsg );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errMsg );
|
||||
}
|
||||
|
||||
RicfCommandFileExecutor::instance()->setLastProjectPath( projectPath );
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfOpenProject : public RicfCommandObject
|
||||
public:
|
||||
RicfOpenProject();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_path;
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
@@ -36,8 +38,8 @@ CAF_PDM_SOURCE_INIT( RicfSingleCaseReplace, "replaceCase" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfSingleCaseReplace::RicfSingleCaseReplace()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_newGridFile, "newGridFile", QString(), "New Grid File", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_newGridFile, "newGridFile", QString(), "New Grid File", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -59,7 +61,7 @@ QString RicfSingleCaseReplace::filePath() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfSingleCaseReplace::execute()
|
||||
caf::PdmScriptResponse RicfSingleCaseReplace::execute()
|
||||
{
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if ( lastProjectPath.isNull() )
|
||||
@@ -67,7 +69,7 @@ RicfCommandResponse RicfSingleCaseReplace::execute()
|
||||
QString errMsg( "replaceCase: 'openProject' must be called before 'replaceCase' to specify project file to "
|
||||
"replace case in." );
|
||||
RiaLogging::error( errMsg );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errMsg );
|
||||
}
|
||||
|
||||
cvf::ref<RiaProjectModifier> projectModifier = new RiaProjectModifier;
|
||||
@@ -93,10 +95,10 @@ RicfCommandResponse RicfSingleCaseReplace::execute()
|
||||
{
|
||||
QString errMsg( "Could not reload project" );
|
||||
RiaLogging::error( errMsg );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errMsg );
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfMultiCaseReplace, "replaceMultipleCases" );
|
||||
@@ -119,13 +121,13 @@ void RicfMultiCaseReplace::setCaseReplacePairs( const std::map<int, QString>& ca
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfMultiCaseReplace::execute()
|
||||
caf::PdmScriptResponse RicfMultiCaseReplace::execute()
|
||||
{
|
||||
if ( m_caseIdToGridFileNameMap.empty() )
|
||||
{
|
||||
QString errMsg( "replaceCaseImpl: No replacements available." );
|
||||
RiaLogging::error( errMsg );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errMsg );
|
||||
}
|
||||
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
@@ -134,7 +136,7 @@ RicfCommandResponse RicfMultiCaseReplace::execute()
|
||||
QString errMsg( "replaceCase: 'openProject' must be called before 'replaceCase' to specify project file to "
|
||||
"replace case in." );
|
||||
RiaLogging::error( errMsg );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errMsg );
|
||||
}
|
||||
|
||||
cvf::ref<RiaProjectModifier> projectModifier = new RiaProjectModifier;
|
||||
@@ -163,8 +165,8 @@ RicfCommandResponse RicfMultiCaseReplace::execute()
|
||||
{
|
||||
QString errMsg( "Could not reload project" );
|
||||
RiaLogging::error( errMsg );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errMsg );
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
int caseId() const;
|
||||
QString filePath() const;
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_newGridFile;
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
void setCaseReplacePairs( const std::map<int, QString>& caseIdToGridFileNameMap );
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
std::map<int, QString> m_caseIdToGridFileNameMap;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaProjectModifier.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfReplaceSourceCases, "replaceSourceCases" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -31,20 +33,20 @@ CAF_PDM_SOURCE_INIT( RicfReplaceSourceCases, "replaceSourceCases" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfReplaceSourceCases::RicfReplaceSourceCases()
|
||||
{
|
||||
RICF_InitField( &m_caseGroupId, "caseGroupId", -1, "Case Group ID", "", "", "" );
|
||||
RICF_InitField( &m_gridListFile, "gridListFile", QString(), "Grid List File", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseGroupId, "caseGroupId", -1, "Case Group ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_gridListFile, "gridListFile", QString(), "Grid List File", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfReplaceSourceCases::execute()
|
||||
caf::PdmScriptResponse RicfReplaceSourceCases::execute()
|
||||
{
|
||||
if ( m_gridListFile().isNull() )
|
||||
{
|
||||
QString error( "replaceSourceCases: Required parameter gridListFile." );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
@@ -53,7 +55,7 @@ RicfCommandResponse RicfReplaceSourceCases::execute()
|
||||
QString error( "replaceSourceCases: 'openProject' must be called before 'replaceSourceCases' to specify "
|
||||
"project file to replace cases in." );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
cvf::ref<RiaProjectModifier> projectModifier = new RiaProjectModifier;
|
||||
@@ -74,7 +76,7 @@ RicfCommandResponse RicfReplaceSourceCases::execute()
|
||||
{
|
||||
QString error( "Could not reload project" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfReplaceSourceCases : public RicfCommandObject
|
||||
public:
|
||||
RicfReplaceSourceCases();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_gridListFile;
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfRunOctaveScript, "runOctaveScript" );
|
||||
@@ -35,14 +37,14 @@ CAF_PDM_SOURCE_INIT( RicfRunOctaveScript, "runOctaveScript" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfRunOctaveScript::RicfRunOctaveScript()
|
||||
{
|
||||
RICF_InitField( &m_path, "path", QString(), "Path", "", "", "" );
|
||||
RICF_InitField( &m_caseIds, "caseIds", std::vector<int>(), "Case IDs", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_path, "path", QString(), "Path", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseIds, "caseIds", std::vector<int>(), "Case IDs", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfRunOctaveScript::execute()
|
||||
caf::PdmScriptResponse RicfRunOctaveScript::execute()
|
||||
{
|
||||
QString octavePath = RiaApplication::instance()->octavePath();
|
||||
|
||||
@@ -77,12 +79,12 @@ RicfCommandResponse RicfRunOctaveScript::execute()
|
||||
RiaApplication::instance()->octaveProcessEnvironment() );
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
if ( !ok )
|
||||
{
|
||||
QString error = QString( "runOctaveScript: Could not execute script %1" ).arg( m_path() );
|
||||
RiaLogging::error( error );
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfRunOctaveScript : public RicfCommandObject
|
||||
public:
|
||||
RicfRunOctaveScript();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_path;
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfScaleFractureTemplate, "scaleFractureTemplate" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -35,13 +37,13 @@ RicfScaleFractureTemplate::RicfScaleFractureTemplate()
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
RICF_InitField(&m_id, "id", -1, "Id", "", "", "");
|
||||
RICF_InitField(&m_halfLengthScaleFactor, "halfLength", 1.0, "HalfLengthScaleFactor", "", "", "");
|
||||
RICF_InitField(&m_heightScaleFactor, "height", 1.0, "HeightScaleFactor", "", "", "");
|
||||
RICF_InitField(&m_dFactorScaleFactor, "dFactor", 1.0, "DFactorScaleFactor", "", "", "");
|
||||
RICF_InitField(&m_conductivityScaleFactor, "conductivity", 1.0, "ConductivityScaleFactor", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_id, "id", -1, "Id", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_halfLengthScaleFactor, "halfLength", 1.0, "HalfLengthScaleFactor", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_heightScaleFactor, "height", 1.0, "HeightScaleFactor", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_dFactorScaleFactor, "dFactor", 1.0, "DFactorScaleFactor", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_conductivityScaleFactor, "conductivity", 1.0, "ConductivityScaleFactor", "", "", "");
|
||||
|
||||
RICF_InitField(&m_OBSOLETE_widthScaleFactor, "width", 1.0, "WidthScaleFactor", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_OBSOLETE_widthScaleFactor, "width", 1.0, "WidthScaleFactor", "", "", "");
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
@@ -49,13 +51,13 @@ RicfScaleFractureTemplate::RicfScaleFractureTemplate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfScaleFractureTemplate::execute()
|
||||
caf::PdmScriptResponse RicfScaleFractureTemplate::execute()
|
||||
{
|
||||
if ( m_id < 0 )
|
||||
{
|
||||
QString error( "scaleFractureTemplate: Fracture template id not specified" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
@@ -64,7 +66,7 @@ RicfCommandResponse RicfScaleFractureTemplate::execute()
|
||||
{
|
||||
QString error( "scaleFractureTemplate: Project not found" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RimFractureTemplateCollection* templColl =
|
||||
@@ -75,12 +77,12 @@ RicfCommandResponse RicfScaleFractureTemplate::execute()
|
||||
{
|
||||
QString error = QString( "scaleFractureTemplate: Fracture template not found. Id=%1" ).arg( m_id );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
templ->setScaleFactors( m_halfLengthScaleFactor, m_heightScaleFactor, m_dFactorScaleFactor, m_conductivityScaleFactor );
|
||||
templ->loadDataAndUpdateGeometryHasChanged();
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -36,7 +36,7 @@ class RicfScaleFractureTemplate : public RicfCommandObject
|
||||
public:
|
||||
RicfScaleFractureTemplate();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
void initAfterRead() override;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfSetExportFolder, "setExportFolder" );
|
||||
@@ -31,16 +33,16 @@ CAF_PDM_SOURCE_INIT( RicfSetExportFolder, "setExportFolder" );
|
||||
RicfSetExportFolder::RicfSetExportFolder()
|
||||
{
|
||||
// clang-format off
|
||||
RICF_InitField(&m_type, "type", RicfCommandFileExecutor::ExportTypeEnum(RicfCommandFileExecutor::COMPLETIONS), "Type", "", "", "");
|
||||
RICF_InitField(&m_path, "path", QString(), "Path", "", "", "");
|
||||
RICF_InitField(&m_createFolder, "createFolder", false, "Create Folder", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_type, "type", RicfCommandFileExecutor::ExportTypeEnum(RicfCommandFileExecutor::COMPLETIONS), "Type", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_path, "path", QString(), "Path", "", "", "");
|
||||
CAF_PDM_InitScriptableFieldWithIO(&m_createFolder, "createFolder", false, "Create Folder", "", "", "");
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfSetExportFolder::execute()
|
||||
caf::PdmScriptResponse RicfSetExportFolder::execute()
|
||||
{
|
||||
if ( m_createFolder )
|
||||
{
|
||||
@@ -54,12 +56,12 @@ RicfCommandResponse RicfSetExportFolder::execute()
|
||||
{
|
||||
QString error = QString( "Could not create folder : %1" ).arg( m_path );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RicfCommandFileExecutor* executor = RicfCommandFileExecutor::instance();
|
||||
executor->setExportPath( m_type(), m_path );
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class RicfSetExportFolder : public RicfCommandObject
|
||||
public:
|
||||
RicfSetExportFolder();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<RicfCommandFileExecutor::ExportTypeEnum> m_type;
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfSetFractureContainment, "setFractureContainment" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -33,21 +35,21 @@ CAF_PDM_SOURCE_INIT( RicfSetFractureContainment, "setFractureContainment" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfSetFractureContainment::RicfSetFractureContainment()
|
||||
{
|
||||
RICF_InitField( &m_id, "id", -1, "Id", "", "", "" );
|
||||
RICF_InitField( &m_topLayer, "topLayer", -1, "TopLayer", "", "", "" );
|
||||
RICF_InitField( &m_baseLayer, "baseLayer", -1, "BaseLayer", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_id, "id", -1, "Id", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_topLayer, "topLayer", -1, "TopLayer", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_baseLayer, "baseLayer", -1, "BaseLayer", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfSetFractureContainment::execute()
|
||||
caf::PdmScriptResponse RicfSetFractureContainment::execute()
|
||||
{
|
||||
if ( m_id < 0 || m_topLayer < 0 || m_baseLayer < 0 )
|
||||
{
|
||||
QString error( "setFractureContainment: Required argument missing" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
@@ -56,7 +58,7 @@ RicfCommandResponse RicfSetFractureContainment::execute()
|
||||
{
|
||||
QString error( "setFractureContainment: Project not found" );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RimFractureTemplateCollection* templColl =
|
||||
@@ -67,11 +69,11 @@ RicfCommandResponse RicfSetFractureContainment::execute()
|
||||
{
|
||||
QString error = QString( "setFractureContainment: Fracture template not found. Id=%1" ).arg( m_id );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
templ->setContainmentTopKLayer( m_topLayer );
|
||||
templ->setContainmentBaseKLayer( m_baseLayer );
|
||||
templ->loadDataAndUpdateGeometryHasChanged();
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class RicfSetFractureContainment : public RicfCommandObject
|
||||
public:
|
||||
RicfSetFractureContainment();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_id;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfSetMainWindowSize, "setMainWindowSize" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -28,15 +30,15 @@ CAF_PDM_SOURCE_INIT( RicfSetMainWindowSize, "setMainWindowSize" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfSetMainWindowSize::RicfSetMainWindowSize()
|
||||
{
|
||||
RICF_InitField( &m_height, "height", -1, "Height", "", "", "" );
|
||||
RICF_InitField( &m_width, "width", -1, "Width", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_height, "height", -1, "Height", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_width, "width", -1, "Width", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfSetMainWindowSize::execute()
|
||||
caf::PdmScriptResponse RicfSetMainWindowSize::execute()
|
||||
{
|
||||
RiuMainWindow::instance()->resize( m_width, m_height );
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfSetMainWindowSize : public RicfCommandObject
|
||||
public:
|
||||
RicfSetMainWindowSize();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_height;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfSetPlotWindowSize, "setPlotWindowSize" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -28,20 +30,20 @@ CAF_PDM_SOURCE_INIT( RicfSetPlotWindowSize, "setPlotWindowSize" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfSetPlotWindowSize::RicfSetPlotWindowSize()
|
||||
{
|
||||
RICF_InitField( &m_height, "height", -1, "Height", "", "", "" );
|
||||
RICF_InitField( &m_width, "width", -1, "Width", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_height, "height", -1, "Height", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_width, "width", -1, "Width", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfSetPlotWindowSize::execute()
|
||||
caf::PdmScriptResponse RicfSetPlotWindowSize::execute()
|
||||
{
|
||||
RiaGuiApplication* guiApp = RiaGuiApplication::instance();
|
||||
if ( guiApp )
|
||||
{
|
||||
guiApp->getOrCreateAndShowMainPlotWindow()->resize( m_width, m_height );
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, "Need GUI ResInsight to set plot window size" );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, "Need GUI ResInsight to set plot window size" );
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfSetPlotWindowSize : public RicfCommandObject
|
||||
public:
|
||||
RicfSetPlotWindowSize();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_height;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfSetStartDir, "setStartDir" );
|
||||
@@ -30,28 +32,28 @@ CAF_PDM_SOURCE_INIT( RicfSetStartDir, "setStartDir" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfSetStartDir::RicfSetStartDir()
|
||||
{
|
||||
RICF_InitField( &m_path, "path", QString(), "Path", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_path, "path", QString(), "Path", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfSetStartDir::execute()
|
||||
caf::PdmScriptResponse RicfSetStartDir::execute()
|
||||
{
|
||||
QDir directory( m_path );
|
||||
if ( !directory.exists() )
|
||||
{
|
||||
QString error = QString( "Path does not exist: %1" ).arg( m_path );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
if ( !directory.isReadable() )
|
||||
{
|
||||
QString error = QString( "Path does not exist: %1" ).arg( m_path );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
RiaApplication::instance()->setStartDir( m_path );
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicfSetStartDir : public RicfCommandObject
|
||||
public:
|
||||
RicfSetStartDir();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_path;
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfSetTimeStep, "setTimeStep" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -34,9 +36,9 @@ CAF_PDM_SOURCE_INIT( RicfSetTimeStep, "setTimeStep" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfSetTimeStep::RicfSetTimeStep()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
RICF_InitField( &m_viewId, "viewId", -1, "View ID", "", "", "" );
|
||||
RICF_InitField( &m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewId, "viewId", -1, "View ID", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -66,7 +68,7 @@ void RicfSetTimeStep::setTimeStepIndex( int timeStepIndex )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfSetTimeStep::execute()
|
||||
caf::PdmScriptResponse RicfSetTimeStep::execute()
|
||||
{
|
||||
RimCase* rimCase = nullptr;
|
||||
std::vector<RimCase*> allCases;
|
||||
@@ -88,7 +90,7 @@ RicfCommandResponse RicfSetTimeStep::execute()
|
||||
{
|
||||
QString error = QString( "setTimeStep: Could not find case with ID %1" ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +102,7 @@ RicfCommandResponse RicfSetTimeStep::execute()
|
||||
.arg( maxTimeStep )
|
||||
.arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
|
||||
for ( Rim3dView* view : rimCase->views() )
|
||||
@@ -112,5 +114,5 @@ RicfCommandResponse RicfSetTimeStep::execute()
|
||||
}
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
void setViewId( int viewId );
|
||||
void setTimeStepIndex( int timeStepIndex );
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "RicSaveProjectFeature.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
|
||||
@@ -33,21 +35,21 @@ RICF_SOURCE_INIT( RicSaveProjectAsFeature, "RicSaveProjectAsFeature", "saveProje
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSaveProjectAsFeature::RicSaveProjectAsFeature()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_filePath, "filePath", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_filePath, "filePath", "", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicSaveProjectAsFeature::execute()
|
||||
caf::PdmScriptResponse RicSaveProjectAsFeature::execute()
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
QString errorMessage;
|
||||
if ( !RiaApplication::instance()->saveProjectAs( m_filePath(), &errorMessage ) )
|
||||
{
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -73,7 +75,7 @@ void RicSaveProjectAsFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
auto response = execute();
|
||||
|
||||
if ( response.status() != RicfCommandResponse::COMMAND_OK )
|
||||
if ( response.status() != caf::PdmScriptResponse::COMMAND_OK )
|
||||
{
|
||||
QString displayMessage = response.messages().join( "\n" );
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
|
||||
@@ -32,7 +32,7 @@ class RicSaveProjectAsFeature : public caf::CmdFeature, public RicfCommandObject
|
||||
|
||||
public:
|
||||
RicSaveProjectAsFeature();
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
@@ -38,7 +38,7 @@ RicSaveProjectFeature::RicSaveProjectFeature()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicSaveProjectFeature::execute()
|
||||
caf::PdmScriptResponse RicSaveProjectFeature::execute()
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
@@ -55,10 +55,10 @@ RicfCommandResponse RicSaveProjectFeature::execute()
|
||||
|
||||
if ( !worked )
|
||||
{
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -88,7 +88,7 @@ void RicSaveProjectFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
auto response = execute();
|
||||
if ( response.status() != RicfCommandResponse::COMMAND_OK )
|
||||
if ( response.status() != caf::PdmScriptResponse::COMMAND_OK )
|
||||
{
|
||||
QString displayMessage = response.messages().join( "\n" );
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
|
||||
@@ -32,7 +32,7 @@ class RicSaveProjectFeature : public caf::CmdFeature, public RicfCommandObject
|
||||
|
||||
public:
|
||||
RicSaveProjectFeature();
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafUtils.h"
|
||||
@@ -49,11 +50,11 @@ RICF_SOURCE_INIT( RicExportContourMapToTextFeature, "RicExportContourMapToTextFe
|
||||
|
||||
RicExportContourMapToTextFeature::RicExportContourMapToTextFeature()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_exportFileName, "exportFileName", "", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &m_exportLocalCoordinates, "exportLocalCoordinates", "", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &m_undefinedValueLabel, "undefinedValueLabel", "", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &m_excludeUndefinedValues, "excludeUndefinedValues", "", "", "", "" );
|
||||
RICF_InitField( &m_viewId, "viewId", -1, "View Id", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_exportFileName, "exportFileName", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_exportLocalCoordinates, "exportLocalCoordinates", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_undefinedValueLabel, "undefinedValueLabel", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_excludeUndefinedValues, "excludeUndefinedValues", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIO( &m_viewId, "viewId", -1, "View Id", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -127,13 +128,13 @@ void RicExportContourMapToTextFeature::onActionTriggered( bool isChecked )
|
||||
m_undefinedValueLabel = featureUi.undefinedValueLabel();
|
||||
m_excludeUndefinedValues = featureUi.excludeUndefinedValues();
|
||||
|
||||
RicfCommandResponse response = execute();
|
||||
caf::PdmScriptResponse response = execute();
|
||||
QStringList messages = response.messages();
|
||||
|
||||
if ( !messages.empty() )
|
||||
{
|
||||
QString displayMessage = QString( "Problem exporting contour map:\n%2" ).arg( messages.join( "\n" ) );
|
||||
if ( response.status() == RicfCommandResponse::COMMAND_ERROR )
|
||||
if ( response.status() == caf::PdmScriptResponse::COMMAND_ERROR )
|
||||
{
|
||||
RiaLogging::error( displayMessage );
|
||||
}
|
||||
@@ -273,9 +274,9 @@ void RicExportContourMapToTextFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicExportContourMapToTextFeature::execute()
|
||||
caf::PdmScriptResponse RicExportContourMapToTextFeature::execute()
|
||||
{
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
QStringList errorMessages, warningMessages;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
@@ -297,7 +298,7 @@ RicfCommandResponse RicExportContourMapToTextFeature::execute()
|
||||
|
||||
if ( !myView )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, "No contour map view found" );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_ERROR, "No contour map view found" );
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -339,7 +340,7 @@ RicfCommandResponse RicExportContourMapToTextFeature::execute()
|
||||
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -39,7 +39,7 @@ class RicExportContourMapToTextFeature : public caf::CmdFeature, public RicfComm
|
||||
|
||||
public:
|
||||
RicExportContourMapToTextFeature();
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
|
||||
@@ -47,7 +47,7 @@ RicNewMultiPlotFeature::RicNewMultiPlotFeature()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicNewMultiPlotFeature::execute()
|
||||
caf::PdmScriptResponse RicNewMultiPlotFeature::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RimMultiPlotCollection* plotCollection = project->mainPlotCollection()->multiPlotCollection();
|
||||
@@ -84,7 +84,7 @@ RicfCommandResponse RicNewMultiPlotFeature::execute()
|
||||
RiuPlotMainWindowTools::setExpanded( plotCollection, true );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true );
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -37,7 +37,7 @@ class RicNewMultiPlotFeature : public caf::CmdFeature, public RicfCommandObject
|
||||
public:
|
||||
RicNewMultiPlotFeature();
|
||||
|
||||
virtual RicfCommandResponse execute() override;
|
||||
virtual caf::PdmScriptResponse execute() override;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
@@ -78,7 +78,8 @@ RimEnsembleCurveSet* RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSet( R
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetsAndUpdate( std::vector<RimSummaryCaseCollection*> ensembles )
|
||||
RimSummaryPlot*
|
||||
RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetsAndUpdate( std::vector<RimSummaryCaseCollection*> ensembles )
|
||||
{
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
RimProject* proj = app->project();
|
||||
@@ -102,6 +103,7 @@ void RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetsAndUpdate( std:
|
||||
mainPlotWindow->selectAsCurrentItem( firstCurveSetCreated );
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicNewSummaryEnsembleCurveSetFeature : public caf::CmdFeature
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void createPlotForCurveSetsAndUpdate( std::vector<RimSummaryCaseCollection*> ensembles );
|
||||
static RimSummaryPlot* createPlotForCurveSetsAndUpdate( std::vector<RimSummaryCaseCollection*> ensembles );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafPdmFieldScriptability.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
#include "cvfAssert.h"
|
||||
|
||||
@@ -208,6 +210,29 @@ void extractPlotObjectsFromSelection( std::vector<RimSummaryCase*>* se
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicNewDefaultSummaryPlotFeature::createFromSummaryCases( RimSummaryPlotCollection* plotCollection,
|
||||
const std::vector<RimSummaryCase*>& summaryCases )
|
||||
{
|
||||
RimSummaryPlot* newPlot = plotCollection->createSummaryPlotWithAutoTitle();
|
||||
|
||||
for ( RimSummaryCase* sumCase : summaryCases )
|
||||
{
|
||||
RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot( newPlot, sumCase );
|
||||
}
|
||||
|
||||
newPlot->applyDefaultCurveAppearances();
|
||||
newPlot->loadDataAndUpdate();
|
||||
|
||||
plotCollection->updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::setExpanded( newPlot );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newPlot );
|
||||
return newPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -234,20 +259,7 @@ void RicNewDefaultSummaryPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimSummaryPlotCollection* sumPlotColl =
|
||||
RiaApplication::instance()->project()->mainPlotCollection()->summaryPlotCollection();
|
||||
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
|
||||
|
||||
for ( RimSummaryCase* sumCase : selectedIndividualSummaryCases )
|
||||
{
|
||||
RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot( newPlot, sumCase );
|
||||
}
|
||||
|
||||
newPlot->applyDefaultCurveAppearances();
|
||||
newPlot->loadDataAndUpdate();
|
||||
|
||||
sumPlotColl->updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::setExpanded( newPlot );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newPlot );
|
||||
createFromSummaryCases( sumPlotColl, selectedIndividualSummaryCases );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -276,3 +288,42 @@ void RicNewDefaultSummaryPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
}
|
||||
actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) );
|
||||
}
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryPlotCollection, RimSummaryPlotCollection_newSummaryPlot, "NewSummaryPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotCollection_newSummaryPlot::RimSummaryPlotCollection_newSummaryPlot( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Create Summary Plot", "", "", "Create a new Summary Plot" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_summaryCases, "SummaryCases", "", "", "", "Summary Cases" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_ensembles, "Ensembles", "", "", "", "Ensembles" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimSummaryPlotCollection_newSummaryPlot::execute()
|
||||
{
|
||||
if ( !m_summaryCases.empty() )
|
||||
{
|
||||
return RicNewDefaultSummaryPlotFeature::createFromSummaryCases( self<RimSummaryPlotCollection>(),
|
||||
m_summaryCases.ptrReferencedObjects() );
|
||||
}
|
||||
else if ( !m_ensembles.empty() )
|
||||
{
|
||||
return RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetsAndUpdate( m_ensembles.ptrReferencedObjects() );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotCollection_newSummaryPlot::deleteObjectAfterReply() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
|
||||
class RimSummaryPlotCollection;
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimSummaryPlot;
|
||||
|
||||
//==================================================================================================
|
||||
@@ -45,9 +49,31 @@ class RicNewDefaultSummaryPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static RimSummaryPlot* createFromSummaryCases( RimSummaryPlotCollection* plotCollection,
|
||||
const std::vector<RimSummaryCase*>& summaryCases );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryPlotCollection_newSummaryPlot : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSummaryPlotCollection_newSummaryPlot( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute();
|
||||
bool deleteObjectAfterReply() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrArrayField<RimSummaryCase*> m_summaryCases;
|
||||
caf::PdmPtrArrayField<RimSummaryCaseCollection*> m_ensembles;
|
||||
};
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
@@ -62,11 +64,11 @@ RICF_SOURCE_INIT( RicImportWellPaths, "RicWellPathsImportFileFeature", "importWe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicImportWellPaths::RicImportWellPaths()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_wellPathFolder, "wellPathFolder", "", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &m_wellPathFiles, "wellPathFiles", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_wellPathFolder, "wellPathFolder", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_wellPathFiles, "wellPathFiles", "", "", "", "" );
|
||||
}
|
||||
|
||||
RicfCommandResponse RicImportWellPaths::execute()
|
||||
caf::PdmScriptResponse RicImportWellPaths::execute()
|
||||
{
|
||||
QStringList errorMessages, warningMessages;
|
||||
QStringList wellPathFiles;
|
||||
@@ -115,7 +117,7 @@ RicfCommandResponse RicImportWellPaths::execute()
|
||||
}
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
if ( !wellPathFiles.empty() )
|
||||
{
|
||||
std::vector<RimWellPath*> importedWellPaths = importWellPaths( wellPathFiles, &warningMessages );
|
||||
@@ -137,12 +139,12 @@ RicfCommandResponse RicImportWellPaths::execute()
|
||||
|
||||
for ( QString warningMessage : warningMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warningMessage );
|
||||
}
|
||||
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
|
||||
return response;
|
||||
@@ -220,7 +222,7 @@ void RicImportWellPaths::onActionTriggered( bool isChecked )
|
||||
if ( wellPathFilePaths.size() >= 1 )
|
||||
{
|
||||
m_wellPathFiles.v() = std::vector<QString>( wellPathFilePaths.begin(), wellPathFilePaths.end() );
|
||||
RicfCommandResponse response = execute();
|
||||
caf::PdmScriptResponse response = execute();
|
||||
QStringList messages = response.messages();
|
||||
|
||||
if ( !messages.empty() )
|
||||
@@ -231,7 +233,7 @@ void RicImportWellPaths::onActionTriggered( bool isChecked )
|
||||
{
|
||||
QMessageBox::warning( Riu3DMainWindowTools::mainWindowWidget(), "Well Path Loading", displayMessage );
|
||||
}
|
||||
if ( response.status() == RicfCommandResponse::COMMAND_ERROR )
|
||||
if ( response.status() == caf::PdmScriptResponse::COMMAND_ERROR )
|
||||
{
|
||||
RiaLogging::error( displayMessage );
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class RicImportWellPaths : public caf::CmdFeature, public RicfCommandObject
|
||||
|
||||
public:
|
||||
RicImportWellPaths();
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
protected:
|
||||
static std::vector<RimWellPath*> importWellPaths( const QStringList& wellPathFilePaths, QStringList* errorMessages );
|
||||
|
||||
@@ -11,8 +11,9 @@ service PdmObjectService
|
||||
rpc GetAncestorPdmObject(PdmParentObjectRequest) returns (PdmObject) {}
|
||||
rpc CreateChildPdmObject(CreatePdmChildObjectRequest) returns (PdmObject) {}
|
||||
rpc UpdateExistingPdmObject(PdmObject) returns (Empty) {}
|
||||
rpc CallPdmObjectGetMethod(PdmObjectMethodRequest) returns (stream PdmObjectGetMethodReply) {}
|
||||
rpc CallPdmObjectSetMethod(stream PdmObjectSetMethodChunk) returns (ClientToServerStreamReply) {}
|
||||
rpc CallPdmObjectGetter(PdmObjectGetterRequest) returns (stream PdmObjectGetterReply) {}
|
||||
rpc CallPdmObjectSetter(stream PdmObjectSetterChunk) returns (ClientToServerStreamReply) {}
|
||||
rpc CallPdmObjectMethod(PdmObjectMethodRequest) returns (PdmObject) {}
|
||||
}
|
||||
|
||||
message PdmDescendantObjectRequest
|
||||
@@ -45,6 +46,7 @@ message PdmObject
|
||||
uint64 address = 2;
|
||||
map<string, string> parameters = 3;
|
||||
bool visible = 4;
|
||||
bool persistent = 5; // Does this object live on in ResInsight?
|
||||
}
|
||||
|
||||
message PdmObjectArray
|
||||
@@ -52,23 +54,23 @@ message PdmObjectArray
|
||||
repeated PdmObject objects = 1;
|
||||
}
|
||||
|
||||
message PdmObjectMethodRequest
|
||||
message PdmObjectGetterRequest
|
||||
{
|
||||
PdmObject object = 1;
|
||||
string method = 2;
|
||||
}
|
||||
|
||||
message PdmObjectSetMethodRequest
|
||||
message PdmObjectSetterRequest
|
||||
{
|
||||
PdmObjectMethodRequest request = 1;
|
||||
PdmObjectGetterRequest request = 1;
|
||||
int32 data_count = 2;
|
||||
}
|
||||
|
||||
message PdmObjectSetMethodChunk
|
||||
message PdmObjectSetterChunk
|
||||
{
|
||||
oneof data
|
||||
{
|
||||
PdmObjectSetMethodRequest set_request = 1;
|
||||
PdmObjectSetterRequest set_request = 1;
|
||||
DoubleArray doubles = 2;
|
||||
IntArray ints = 3;
|
||||
StringArray strings = 4;
|
||||
@@ -91,7 +93,7 @@ message StringArray
|
||||
repeated string data = 1;
|
||||
}
|
||||
|
||||
message PdmObjectGetMethodReply
|
||||
message PdmObjectGetterReply
|
||||
{
|
||||
oneof data
|
||||
{
|
||||
@@ -100,3 +102,10 @@ message PdmObjectGetMethodReply
|
||||
StringArray strings = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PdmObjectMethodRequest
|
||||
{
|
||||
PdmObject object = 1;
|
||||
string method = 2;
|
||||
PdmObject params = 3;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# Load ResInsight Processing Server Client Library
|
||||
import rips
|
||||
# Connect to ResInsight instance
|
||||
resinsight = rips.Instance.find()
|
||||
# Example code
|
||||
project = resinsight.project
|
||||
|
||||
summary_cases = project.descendants(rips.SummaryCase)
|
||||
summary_plot_collection = project.descendants(rips.SummaryPlotCollection)[0]
|
||||
|
||||
|
||||
|
||||
summary_plot = summary_plot_collection.new_summary_plot(summary_cases=summary_cases)
|
||||
@@ -179,10 +179,12 @@ def __convert_to_grpc_value(self, value):
|
||||
if value:
|
||||
return "true"
|
||||
return "false"
|
||||
if isinstance(value, PdmObject):
|
||||
return value.__class__.__name__ + ":" + str(value.address())
|
||||
if isinstance(value, list):
|
||||
list_of_strings = []
|
||||
for val in value:
|
||||
list_of_strings.append(self.__convert_to_grpc_value('\"' + val + '\"'))
|
||||
list_of_strings.append('\"' + self.__convert_to_grpc_value(val) + '\"')
|
||||
return "[" + ", ".join(list_of_strings) + "]"
|
||||
return str(value)
|
||||
|
||||
@@ -301,8 +303,8 @@ def ancestor(self, class_definition):
|
||||
|
||||
@add_method(PdmObject)
|
||||
def _call_get_method_async(self, method_name):
|
||||
request = PdmObject_pb2.PdmObjectMethodRequest(object=self._pb2_object, method=method_name)
|
||||
for chunk in self._pdm_object_stub.CallPdmObjectGetMethod(request):
|
||||
request = PdmObject_pb2.PdmObjectGetterRequest(object=self._pb2_object, method=method_name)
|
||||
for chunk in self._pdm_object_stub.CallPdmObjectGetter(request):
|
||||
yield chunk
|
||||
|
||||
@add_method(PdmObject)
|
||||
@@ -320,40 +322,48 @@ def __generate_set_method_chunks(self, array, method_request):
|
||||
index = -1
|
||||
|
||||
while index < len(array):
|
||||
chunk = PdmObject_pb2.PdmObjectSetMethodChunk()
|
||||
chunk = PdmObject_pb2.PdmObjectSetterChunk()
|
||||
if index is -1:
|
||||
chunk.set_request.CopyFrom(PdmObject_pb2.PdmObjectSetMethodRequest(request=method_request, data_count=len(array)))
|
||||
chunk.set_request.CopyFrom(PdmObject_pb2.PdmObjectSetterRequest(request=method_request, data_count=len(array)))
|
||||
index += 1
|
||||
else:
|
||||
actual_chunk_size = min(len(array) - index + 1, self.__chunk_size)
|
||||
if isinstance(array[0], float):
|
||||
chunk.CopyFrom(
|
||||
PdmObject_pb2.PdmObjectSetMethodChunk(doubles=PdmObject_pb2.DoubleArray(data=array[index:index +
|
||||
PdmObject_pb2.PdmObjectSetterChunk(doubles=PdmObject_pb2.DoubleArray(data=array[index:index +
|
||||
actual_chunk_size])))
|
||||
elif isinstance(array[0], int):
|
||||
chunk.CopyFrom(
|
||||
PdmObject_pb2.PdmObjectSetMethodChunk(ints=PdmObject_pb2.IntArray(data=array[index:index +
|
||||
PdmObject_pb2.PdmObjectSetterChunk(ints=PdmObject_pb2.IntArray(data=array[index:index +
|
||||
actual_chunk_size])))
|
||||
elif isinstance(array[0], str):
|
||||
chunk.CopyFrom(
|
||||
PdmObject_pb2.PdmObjectSetMethodChunk(strings=PdmObject_pb2.StringArray(data=array[index:index +
|
||||
PdmObject_pb2.PdmObjectSetterChunk(strings=PdmObject_pb2.StringArray(data=array[index:index +
|
||||
actual_chunk_size])))
|
||||
else:
|
||||
raise Exception("Wrong data type for set method")
|
||||
index += actual_chunk_size
|
||||
yield chunk
|
||||
# Final empty message to signal completion
|
||||
chunk = PdmObject_pb2.PdmObjectSetMethodChunk()
|
||||
chunk = PdmObject_pb2.PdmObjectSetterChunk()
|
||||
yield chunk
|
||||
|
||||
@add_method(PdmObject)
|
||||
def _call_set_method(self, method_name, values):
|
||||
method_request = PdmObject_pb2.PdmObjectMethodRequest(object=self._pb2_object, method=method_name)
|
||||
method_request = PdmObject_pb2.PdmObjectGetterRequest(object=self._pb2_object, method=method_name)
|
||||
request_iterator = self.__generate_set_method_chunks(values, method_request)
|
||||
reply = self._pdm_object_stub.CallPdmObjectSetMethod(request_iterator)
|
||||
reply = self._pdm_object_stub.CallPdmObjectSetter(request_iterator)
|
||||
if reply.accepted_value_count < len(values):
|
||||
raise IndexError
|
||||
|
||||
@add_method(PdmObject)
|
||||
def _call_pdm_method(self, method_name, **kwargs):
|
||||
pb2_params = PdmObject_pb2.PdmObject(class_keyword=method_name)
|
||||
for key, value in kwargs.items():
|
||||
pb2_params.parameters[snake_to_camel(key)] = self.__convert_to_grpc_value(value)
|
||||
request = PdmObject_pb2.PdmObjectMethodRequest(object=self._pb2_object, method=method_name, params=pb2_params)
|
||||
return self._pdm_object_stub.CallPdmObjectMethod(request)
|
||||
|
||||
@add_method(PdmObject)
|
||||
def update(self):
|
||||
"""Sync all fields from the Python Object to ResInsight"""
|
||||
|
||||
@@ -79,14 +79,14 @@ grpc::Status RiaGrpcCommandService::Execute( grpc::ServerContext* context, const
|
||||
}
|
||||
|
||||
// Execute command
|
||||
RicfCommandResponse response = commandHandle->execute();
|
||||
caf::PdmScriptResponse response = commandHandle->execute();
|
||||
|
||||
// Copy results
|
||||
if ( response.status() == RicfCommandResponse::COMMAND_ERROR )
|
||||
if ( response.status() == caf::PdmScriptResponse::COMMAND_ERROR )
|
||||
{
|
||||
return grpc::Status( grpc::FAILED_PRECONDITION, response.sanitizedResponseMessage().toStdString() );
|
||||
}
|
||||
else if ( response.status() == RicfCommandResponse::COMMAND_WARNING )
|
||||
else if ( response.status() == caf::PdmScriptResponse::COMMAND_WARNING )
|
||||
{
|
||||
context->AddTrailingMetadata( "warning", response.sanitizedResponseMessage().toStdString() );
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user