#1784 Add option for curve prefix when pasting ASCII data

This commit is contained in:
Bjørnar Grip Fjær 2017-08-18 09:59:00 +02:00
parent bbb3e937d3
commit 6b0a59b864
3 changed files with 27 additions and 3 deletions

View File

@ -224,12 +224,21 @@ std::vector<RimAsciiDataCurve*> RicPasteAsciiDataToSummaryPlotFeature::parseCurv
std::map< CurveType, std::vector<RimAsciiDataCurve*> > curveToTypeMap;
QString curvePrefix = settings.curvePrefix();
for (size_t i = 0; i < values.size(); ++i)
{
RimAsciiDataCurve* curve = new RimAsciiDataCurve();
curve->setTimeSteps(timeSteps);
curve->setValues(values[i]);
curve->setTitle(headers[i]);
if (curvePrefix.isEmpty())
{
curve->setTitle(headers[i]);
}
else
{
curve->setTitle(QString("%1: %2").arg(curvePrefix).arg(headers[i]));
}
curveToTypeMap[guessCurveType(headers[i])].push_back(curve);
curves.push_back(curve);
}

View File

@ -65,6 +65,7 @@ RicPasteAsciiDataToSummaryPlotFeatureUi::RicPasteAsciiDataToSummaryPlotFeatureUi
CAF_PDM_InitObject("RicPasteAsciiDataToSummaryPlotFeatureUi", "", "", "");
CAF_PDM_InitField(&m_plotTitle, "PlotTitle", QString(), "Plot Title", "", "", "");
CAF_PDM_InitField(&m_curvePrefix, "CurvePrefix", QString(), "Curve Prefix", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_decimalSeparator, "DecimalSeparator", "Decimal Separator", "", "", "");
@ -134,6 +135,14 @@ QString RicPasteAsciiDataToSummaryPlotFeatureUi::plotTitle() const
return m_plotTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicPasteAsciiDataToSummaryPlotFeatureUi::curvePrefix() const
{
return m_curvePrefix();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -147,9 +156,13 @@ void RicPasteAsciiDataToSummaryPlotFeatureUi::createNewPlot()
//--------------------------------------------------------------------------------------------------
void RicPasteAsciiDataToSummaryPlotFeatureUi::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
if (m_createNewPlot)
{
uiOrdering.add(&m_plotTitle);
caf::PdmUiGroup* namingGroup = uiOrdering.addNewGroup("Naming");
if (m_createNewPlot)
{
namingGroup->add(&m_plotTitle);
}
namingGroup->add(&m_curvePrefix);
}
{

View File

@ -73,6 +73,7 @@ public:
QLocale decimalLocale() const;
QString cellSeparator() const;
QString plotTitle() const;
QString curvePrefix() const;
void createNewPlot();
@ -81,6 +82,7 @@ protected:
private:
caf::PdmField<QString> m_plotTitle;
caf::PdmField<QString> m_curvePrefix;
caf::PdmField<DecimalSeparatorEnum> m_decimalSeparator;
caf::PdmField<DateFormatEnum> m_dateFormat;
caf::PdmField<TimeFormatEnum> m_timeFormat;