mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fault reactivation (#10624)
Update result to generate well paths based on information from model generator. Store settings in JSON file. Add method to access local coordinate system definition
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
namespace ResInsightInternalJson
|
||||
{
|
||||
@@ -30,10 +31,14 @@ QMap<QString, QVariant> JsonReader::decodeFile( QString filePath )
|
||||
{
|
||||
QFile file;
|
||||
file.setFileName( filePath );
|
||||
file.open( QIODevice::ReadOnly );
|
||||
QByteArray byteArray = file.readAll();
|
||||
file.close();
|
||||
return Json::decode( byteArray );
|
||||
if ( file.open( QIODevice::ReadOnly ) )
|
||||
{
|
||||
QByteArray byteArray = file.readAll();
|
||||
file.close();
|
||||
return Json::decode( byteArray );
|
||||
}
|
||||
|
||||
return QMap<QString, QVariant>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -53,6 +58,25 @@ QString JsonReader::rootKeyText()
|
||||
return "root";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool JsonWriter::encodeFile( QString filePath, QMap<QString, QVariant> map )
|
||||
{
|
||||
QFile file;
|
||||
file.setFileName( filePath );
|
||||
if ( file.open( QIODevice::ReadWrite | QIODevice::Text ) )
|
||||
{
|
||||
QString content = Json::encode( map, true );
|
||||
QTextStream out( &file );
|
||||
out << content;
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user