mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#1294 - Renaming and moving ascii export feature, now RicAsciiExportWellLogPlotFeature. Adding functionality for getting data to export (but formatting is still missing)
This commit is contained in:
parent
7f511f7004
commit
b89efbf73e
@ -26,7 +26,6 @@ ${CEE_CURRENT_LIST_DIR}RicAsciiExportWellAllocationPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.cpp
|
||||
)
|
||||
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
@ -20,6 +20,7 @@ ${CEE_CURRENT_LIST_DIR}RicPasteWellLogTrackFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAsciiExportWellLogPlotFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -38,6 +39,7 @@ ${CEE_CURRENT_LIST_DIR}RicPasteWellLogTrackFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAsciiExportWellLogPlotFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -16,12 +16,12 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicAsciiExportWellAllocationPlotFeature.h"
|
||||
#include "RicAsciiExportWellLogPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@ -39,12 +39,12 @@
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicAsciiExportWellAllocationPlotFeature, "RicAsciiExportWellAllocationPlotFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicAsciiExportWellLogPlotFeature, "RicAsciiExportWellLogPlotFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAsciiExportWellAllocationPlotFeature::isCommandEnabled()
|
||||
bool RicAsciiExportWellLogPlotFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -52,7 +52,7 @@ bool RicAsciiExportWellAllocationPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAsciiExportWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
||||
void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
@ -60,15 +60,15 @@ void RicAsciiExportWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
std::vector<RimWellAllocationPlot*> selectedWellAllocPlots;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedWellAllocPlots);
|
||||
std::vector<RimWellLogPlot*> selectedWellLogPlots;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedWellLogPlots);
|
||||
|
||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("PLOT_ASCIIEXPORT_DIR", projectFolder);
|
||||
QString defaultFileName = defaultDir + "/" + QString("WellAllocationPlotExport");
|
||||
QString fileName = QFileDialog::getSaveFileName(NULL, "Select file for Well Allocation Plot Export", defaultFileName, "All files(*.*)");
|
||||
QString fileName = QFileDialog::getSaveFileName(NULL, "Select file for Well Log Plot Export", defaultFileName, "All files(*.*)");
|
||||
|
||||
if (fileName.isEmpty()) return;
|
||||
bool isOk = writeAsciiExportForWellAllocPlots(fileName, selectedWellAllocPlots);
|
||||
bool isOk = writeAsciiExportForWellLogPlots(fileName, selectedWellLogPlots);
|
||||
|
||||
if (!isOk)
|
||||
{
|
||||
@ -80,7 +80,7 @@ void RicAsciiExportWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAsciiExportWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicAsciiExportWellLogPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Export Well Allocation Plot Data");
|
||||
}
|
||||
@ -88,7 +88,7 @@ void RicAsciiExportWellAllocationPlotFeature::setupActionLook(QAction* actionToS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAsciiExportWellAllocationPlotFeature::writeAsciiExportForWellAllocPlots(const QString& fileName, const std::vector<RimWellAllocationPlot*>& selectedWellAllocPlots)
|
||||
bool RicAsciiExportWellLogPlotFeature::writeAsciiExportForWellLogPlots(const QString& fileName, const std::vector<RimWellLogPlot*>& selectedWellLogPlots)
|
||||
{
|
||||
RiaLogging::info(QString("Writing ascii values for well allocation plot(s) to file: %1").arg(fileName));
|
||||
|
||||
@ -98,14 +98,15 @@ bool RicAsciiExportWellAllocationPlotFeature::writeAsciiExportForWellAllocPlots(
|
||||
return false;
|
||||
}
|
||||
|
||||
caf::ProgressInfo pi(selectedWellAllocPlots.size(), QString("Writing data to file %1").arg(fileName));
|
||||
caf::ProgressInfo pi(selectedWellLogPlots.size(), QString("Writing data to file %1").arg(fileName));
|
||||
size_t progress = 0;
|
||||
|
||||
QTextStream out(&file);
|
||||
for (RimWellAllocationPlot* wellAllocPlot : selectedWellAllocPlots)
|
||||
for (RimWellLogPlot* wellLogPlot : selectedWellLogPlots)
|
||||
{
|
||||
out << wellAllocPlot->description();
|
||||
/* out << summaryPlot->asciiDataForPlotExport();*/
|
||||
out << wellLogPlot->description();
|
||||
out << "\n";
|
||||
out << wellLogPlot->asciiDataForPlotExport();
|
||||
out << "\n\n";
|
||||
|
||||
progress++;
|
@ -21,12 +21,12 @@
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RimWellAllocationPlot;
|
||||
class RimWellLogPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicAsciiExportWellAllocationPlotFeature : public caf::CmdFeature
|
||||
class RicAsciiExportWellLogPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
@ -38,5 +38,5 @@ protected:
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
bool writeAsciiExportForWellAllocPlots(const QString& fileName, const std::vector<RimWellAllocationPlot*>& selectedSummaryPlots);
|
||||
bool writeAsciiExportForWellLogPlots(const QString& fileName, const std::vector<RimWellLogPlot*>& selectedSummaryPlots);
|
||||
};
|
@ -257,6 +257,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicPasteWellLogTrackFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewWellLogPlotTrackFeature";
|
||||
commandIds << "RicAsciiExportWellLogPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogTrack*>(uiItem))
|
||||
{
|
||||
@ -355,7 +356,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
else if (dynamic_cast<RimWellAllocationPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddStoredWellAllocationPlotFeature";
|
||||
commandIds << "RicAsciiExportWellAllocationPlotFeature";
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
#include <math.h>
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RigWellLogCurveData.h"
|
||||
|
||||
#define RI_LOGPLOT_MINDEPTH_DEFAULT 0.0
|
||||
#define RI_LOGPLOT_MAXDEPTH_DEFAULT 1000.0
|
||||
@ -383,6 +385,42 @@ QWidget* RimWellLogPlot::viewWidget()
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogPlot::asciiDataForPlotExport()
|
||||
{
|
||||
QString out;
|
||||
|
||||
for (RimWellLogTrack* track : m_tracks)
|
||||
{
|
||||
out += "\n" + track->description() + "\n";
|
||||
|
||||
std::vector<RimWellLogCurve* > curves = track->curvesVector();
|
||||
for (RimWellLogCurve* curve : curves)
|
||||
{
|
||||
out += curve->curveName() + "\n";
|
||||
const RigWellLogCurveData* curveData = curve->curveData();
|
||||
std::vector<double> xPlotValues = curveData->xPlotValues();
|
||||
|
||||
std::vector<double> depths;
|
||||
depths = curveData->measuredDepthPlotValues(RimDefines::UNIT_NONE);
|
||||
|
||||
if (!(depths.size() == xPlotValues.size())) return out;
|
||||
|
||||
for (int i = xPlotValues.size()-1; i >= 0; i--)
|
||||
{
|
||||
out += QString::number(depths[i]) + " " + QString::number(xPlotValues[i]) + " \n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -99,6 +99,8 @@ public:
|
||||
virtual void zoomAll() override;
|
||||
virtual QWidget* viewWidget() override;
|
||||
|
||||
QString asciiDataForPlotExport();
|
||||
|
||||
protected:
|
||||
|
||||
// Overridden PDM methods
|
||||
|
@ -491,3 +491,27 @@ std::vector<RimWellFlowRateCurve*> RimWellLogTrack::visibleStackedCurves()
|
||||
|
||||
return stackedCurves;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogTrack::description()
|
||||
{
|
||||
return m_userName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogCurve* > RimWellLogTrack::curvesVector()
|
||||
{
|
||||
std::vector<RimWellLogCurve* > curvesVector;
|
||||
|
||||
for (RimWellLogCurve* curve : curves)
|
||||
{
|
||||
curvesVector.push_back(curve);
|
||||
}
|
||||
|
||||
return curvesVector;
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,11 @@ public:
|
||||
void setLogarithmicScale(bool enable);
|
||||
|
||||
std::vector<RimWellFlowRateCurve*> visibleStackedCurves();
|
||||
|
||||
QString description();
|
||||
std::vector<RimWellLogCurve* > curvesVector();
|
||||
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
Loading…
Reference in New Issue
Block a user