#4819 Write contour map metadata header.

This commit is contained in:
Kristian Bendiksen 2019-10-21 23:31:39 +02:00
parent 10d257480d
commit 847bd0736a
2 changed files with 31 additions and 0 deletions

View File

@ -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(),

View File

@ -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,