///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RimPlotCurve.h" #include "RifCsvUserDataParser.h" #include "cafPdmObject.h" #include "cafPdmField.h" #include "cafAppEnum.h" #include #include #include //================================================================================================== /// //================================================================================================== class AsciiDataParseOptions { public: AsciiDataParseOptions() : useCustomDateTimeFormat(false), assumeNumericDataColumns(false) { } QString plotTitle; QString curvePrefix; QString decimalSeparator; QLocale locale; bool useCustomDateTimeFormat; QString dateFormat; QString timeFormat; QString fallbackDateTimeFormat; QString dateTimeFormat; QString cellSeparator; QString timeSeriesColumnName; bool assumeNumericDataColumns; RimPlotCurve::LineStyleEnum curveLineStyle; RimPlotCurve::PointSymbolEnum curveSymbol; float curveSymbolSkipDistance; }; //================================================================================================== /// //================================================================================================== class RicPasteAsciiDataToSummaryPlotFeatureUi : public caf::PdmObject { CAF_PDM_HEADER_INIT; public: enum UiMode { UI_MODE_NONE, UI_MODE_IMPORT, UI_MODE_PASTE }; enum DecimalSeparator { DECIMAL_COMMA, DECIMAL_DOT, }; typedef caf::AppEnum DecimalSeparatorEnum; enum DateFormat { DATE_DDMMYYYY_DOT_SEPARATED, DATE_DDMMYYYY_DASH_SEPARATED, DATE_DDMMYYYY_SLASH_SEPARATED, DATE_YYYYMMDD_DOT_SEPARATED, DATE_YYYYMMDD_DASH_SEPARATED, DATE_YYYYMMDD_SLASH_SEPARATED, DATE_MMDDYYYY_SLASH_SEPARATED, DATE_MMDDYY_SLASH_SEPARATED }; typedef caf::AppEnum DateFormatEnum; enum TimeFormat { TIME_NONE, TIME_HHMM, TIME_HHMMSS, TIME_HHMMSSZZZ, }; typedef caf::AppEnum TimeFormatEnum; enum CellSeparator { CELL_COMMA, CELL_TAB, CELL_SEMICOLON }; typedef caf::AppEnum CellSeparatorEnum; public: RicPasteAsciiDataToSummaryPlotFeatureUi(); void setUiModeImport(const QString& fileName); void setUiModePasteText(const QString& text); const AsciiDataParseOptions parseOptions() const; void createNewPlot(); protected: virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); private: void initialize(RifCsvUserDataParser* parser); private: UiMode m_uiMode; caf::PdmField m_plotTitle; caf::PdmField m_curvePrefix; caf::PdmField m_decimalSeparator; caf::PdmField m_dateFormat; caf::PdmField m_timeFormat; caf::PdmField m_useCustomDateFormat; caf::PdmField m_customDateTimeFormat; caf::PdmField m_cellSeparator; caf::PdmField m_timeSeriesColumnName; caf::PdmField> m_curveLineStyle; caf::PdmField> m_curveSymbol; caf::PdmField m_curveSymbolSkipDistance; bool m_createNewPlot; caf::PdmField m_previewText; std::unique_ptr m_parser; };