mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4819 Write contour map metadata header.
This commit is contained in:
parent
10d257480d
commit
847bd0736a
@ -34,6 +34,7 @@
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
|
||||
@ -136,6 +137,28 @@ void RicExportContourMapToAsciiFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportContourMapToAsciiFeature::writeMetaDataToStream( QTextStream& stream,
|
||||
const RimContourMapProjection* contourMapProjection,
|
||||
const QString& caseName,
|
||||
bool exportLocalCoordinates )
|
||||
{
|
||||
cvf::Vec2ui numVerticesIJ = contourMapProjection->numberOfVerticesIJ();
|
||||
stream << "# case name : " << caseName << "\n";
|
||||
stream << "# sampling points : nx=" << numVerticesIJ.x() << " ny=" << numVerticesIJ.y() << "\n";
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
stream << "# time and date : " << now.toString( Qt::ISODate ) << "\n";
|
||||
stream << "# property name : " << contourMapProjection->resultDescriptionText() << "\n";
|
||||
if ( exportLocalCoordinates )
|
||||
{
|
||||
stream << "# UTM offset : x=" << contourMapProjection->origin3d().x()
|
||||
<< " y=" << contourMapProjection->origin3d().y() << "\n";
|
||||
}
|
||||
stream << "\n\n";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -217,10 +240,12 @@ RicfCommandResponse RicExportContourMapToAsciiFeature::execute()
|
||||
if ( existingEclipseContourMap )
|
||||
{
|
||||
contourMapProjection = existingEclipseContourMap->contourMapProjection();
|
||||
contourMapName = existingEclipseContourMap->createAutoName();
|
||||
}
|
||||
else if ( existingGeoMechContourMap )
|
||||
{
|
||||
contourMapProjection = existingGeoMechContourMap->contourMapProjection();
|
||||
contourMapName = existingGeoMechContourMap->createAutoName();
|
||||
}
|
||||
|
||||
CAF_ASSERT( contourMapProjection );
|
||||
@ -234,6 +259,7 @@ RicfCommandResponse RicExportContourMapToAsciiFeature::execute()
|
||||
{
|
||||
QString tableText;
|
||||
QTextStream stream( &exportFile );
|
||||
writeMetaDataToStream( stream, contourMapProjection, contourMapName, m_exportLocalCoordinates.value() );
|
||||
writeContourMapToStream( stream,
|
||||
contourMapProjection,
|
||||
m_exportLocalCoordinates.value(),
|
||||
|
@ -41,6 +41,11 @@ protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
|
||||
static void writeMetaDataToStream( QTextStream& stream,
|
||||
const RimContourMapProjection* contourMapProjection,
|
||||
const QString& caseName,
|
||||
bool exportLocalCoordinates );
|
||||
|
||||
static void writeContourMapToStream( QTextStream& stream,
|
||||
const RimContourMapProjection* contourMapProjection,
|
||||
bool exportLocalCoordinates,
|
||||
|
Loading…
Reference in New Issue
Block a user