From 7a50fa12f89b522333bc1a025aa785b604ebf6d9 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Tue, 29 Jan 2019 10:05:57 +0100 Subject: [PATCH] #3953 Extend well completions spec --- ...ellPathExportCompletionDataFeatureImpl.cpp | 46 ++++-- .../Completions/RimWellPathAicdParameters.cpp | 33 +--- .../Completions/RimWellPathCompletions.cpp | 147 +++++++++++++++++- .../Completions/RimWellPathCompletions.h | 27 +++- Fwk/AppFwk/cafUserInterface/CMakeLists.txt | 2 + .../cafPdmDoubleStringValidator.cpp | 57 +++++++ .../cafPdmDoubleStringValidator.h | 64 ++++++++ .../cafPdmUniqueIdValidator.h | 1 + 8 files changed, 330 insertions(+), 47 deletions(-) create mode 100644 Fwk/AppFwk/cafUserInterface/cafPdmDoubleStringValidator.cpp create mode 100644 Fwk/AppFwk/cafUserInterface/cafPdmDoubleStringValidator.h diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index a65e2334ca..242668a6cb 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -705,14 +705,21 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile(RimEclipse QTextStream stream(exportFile.get()); RifEclipseDataTableFormatter formatter(stream); - formatter.setColumnSpacing(3); + formatter.setColumnSpacing(2); std::vector header = {RifEclipseOutputTableColumn("Well"), RifEclipseOutputTableColumn("Grp"), RifEclipseOutputTableColumn("I"), RifEclipseOutputTableColumn("J"), RifEclipseOutputTableColumn("RefDepth"), - RifEclipseOutputTableColumn("WellType")}; + RifEclipseOutputTableColumn("Type"), + RifEclipseOutputTableColumn("DrainRad"), + RifEclipseOutputTableColumn("GasInEq"), + RifEclipseOutputTableColumn("AutoShut"), + RifEclipseOutputTableColumn("XFlow"), + RifEclipseOutputTableColumn("FluidPVT"), + RifEclipseOutputTableColumn("HydSDens"), + RifEclipseOutputTableColumn("FluidInPlReg")}; formatter.keyword("WELSPECS"); formatter.header(header); @@ -732,15 +739,22 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile(RimEclipse // Export for (const auto wellPath : wellPathSet) { - auto rimCcompletions = wellPath->completions(); + auto rimCompletions = wellPath->completions(); auto ijIntersection = wellPathUpperGridIntersectionIJ(gridCase, wellPath); - formatter.add(rimCcompletions->wellNameForExport()) - .add(rimCcompletions->wellGroupNameForExport()) + formatter.add(rimCompletions->wellNameForExport()) + .add(rimCompletions->wellGroupNameForExport()) .addOneBasedCellIndex(ijIntersection.second.x()) .addOneBasedCellIndex(ijIntersection.second.y()) - .add(rimCcompletions->referenceDepthForExport()) - .add(rimCcompletions->wellTypeNameForExport()) + .add(rimCompletions->referenceDepthForExport()) + .add(rimCompletions->wellTypeNameForExport()) + .add(rimCompletions->drainageRadiusForExport()) + .add(rimCompletions->gasInflowEquationForExport()) + .add(rimCompletions->automaticWellShutInForExport()) + .add(rimCompletions->allowWellCrossFlowForExport()) + .add(rimCompletions->wellBoreFluidPVTForExport()) + .add(rimCompletions->hydrostaticDensityForExport()) + .add(rimCompletions->fluidInPlaceRegionForExport()) .rowCompleted(); } @@ -758,7 +772,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile( QTextStream stream(exportFile.get()); RifEclipseDataTableFormatter formatter(stream); - formatter.setColumnSpacing(3); + formatter.setColumnSpacing(2); std::vector header = {RifEclipseOutputTableColumn("Well"), RifEclipseOutputTableColumn("Grp"), @@ -766,7 +780,14 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile( RifEclipseOutputTableColumn("I"), RifEclipseOutputTableColumn("J"), RifEclipseOutputTableColumn("RefDepth"), - RifEclipseOutputTableColumn("WellType")}; + RifEclipseOutputTableColumn("Type"), + RifEclipseOutputTableColumn("DrainRad"), + RifEclipseOutputTableColumn("GasInEq"), + RifEclipseOutputTableColumn("AutoShut"), + RifEclipseOutputTableColumn("XFlow"), + RifEclipseOutputTableColumn("FluidPVT"), + RifEclipseOutputTableColumn("HydSDens"), + RifEclipseOutputTableColumn("FluidInPlReg")}; formatter.keyword("WELSPECL"); formatter.header(header); @@ -817,6 +838,13 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile( .addOneBasedCellIndex(ijIntersection.y()) .add(rimCompletions->referenceDepthForExport()) .add(rimCompletions->wellTypeNameForExport()) + .add(rimCompletions->drainageRadiusForExport()) + .add(rimCompletions->gasInflowEquationForExport()) + .add(rimCompletions->automaticWellShutInForExport()) + .add(rimCompletions->allowWellCrossFlowForExport()) + .add(rimCompletions->wellBoreFluidPVTForExport()) + .add(rimCompletions->hydrostaticDensityForExport()) + .add(rimCompletions->fluidInPlaceRegionForExport()) .rowCompleted(); } } diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp b/ApplicationCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp index 6d7fa130c7..fdeb8fb238 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp @@ -24,37 +24,12 @@ #include "cafPdmUiDoubleValueEditor.h" #include "cafPdmUiGroup.h" #include "cafPdmUiLineEditor.h" - -#include +#include "cafPdmDoubleStringValidator.h" #include CAF_PDM_SOURCE_INIT(RimWellPathAicdParameters, "WellPathAicdParameters"); -class NumericStringValidator : public QDoubleValidator -{ -public: - NumericStringValidator(const QString& defaultValue) - : m_defaultValue(defaultValue), QDoubleValidator(nullptr) - {} - - void fixup(QString& input) const override - { - input = m_defaultValue; - } - - State validate(QString& input, int& pos) const override - { - if (input == m_defaultValue) - { - return QValidator::Acceptable; - } - - return QDoubleValidator::validate(input, pos); - } -private: - QString m_defaultValue; -}; //-------------------------------------------------------------------------------------------------- /// @@ -133,7 +108,7 @@ std::array RimWellPathAicdParameters::doubleValues() co std::array doubleValues; for (int i = 0; i < (int)AICD_NUM_PARAMS; ++i) { - NumericStringValidator validator(nullptr); + caf::PdmDoubleStringValidator validator(nullptr); QString stringValue = m_aicdParameterFields[(AICDParameters)i].value(); bool ok = true; double doubleValue = stringValue.toDouble(&ok); @@ -186,11 +161,11 @@ void RimWellPathAicdParameters::defineEditorAttribute(const caf::PdmFieldHandle* { if (stringFieldsWithNoValidDefault().count(stringField)) { - lineEditorAttr->validator = new NumericStringValidator(""); + lineEditorAttr->validator = new caf::PdmDoubleStringValidator(""); } else { - lineEditorAttr->validator = new NumericStringValidator("1*"); + lineEditorAttr->validator = new caf::PdmDoubleStringValidator("1*"); } } } diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp index 23c65fc44e..05e6cd3eeb 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp @@ -32,6 +32,8 @@ #include "cvfAssert.h" +#include "cafPdmDoubleStringValidator.h" +#include "cafPdmUiDoubleValueEditor.h" #include "cafPdmUiLineEditor.h" #include "cafPdmUiTreeOrdering.h" @@ -56,7 +58,37 @@ namespace caf { setDefault(RimWellPathCompletions::OIL); } -} + + template<> + void RimWellPathCompletions::GasInflowEnum::setUp() + { + addItem(RimWellPathCompletions::STANDARD_EQ, "STD", "Standard"); + addItem(RimWellPathCompletions::RUSSELL_GOODRICH, "R-G", "Russell-Goodrich"); + addItem(RimWellPathCompletions::DRY_GAS_PSEUDO_PRESSURE, "P-P", "Dry Gas Pseudo-Pressure"); + addItem(RimWellPathCompletions::GENERALIZED_PSEUDO_PRESSURE, "GPP", "Generalized Pseudo-Pressure"); + + setDefault(RimWellPathCompletions::STANDARD_EQ); + } + + template<> + void RimWellPathCompletions::AutomaticWellShutInEnum::setUp() + { + addItem(RimWellPathCompletions::ISOLATE_FROM_FORMATION, "SHUT", "Isolate from Formation"); + addItem(RimWellPathCompletions::STOP_ABOVE_FORMATION, "STOP", "Stop above Formation"); + + setDefault(RimWellPathCompletions::STOP_ABOVE_FORMATION); + } + + template<> + void RimWellPathCompletions::HydrostaticDensityEnum::setUp() + { + addItem(RimWellPathCompletions::SEGMENTED, "SEG", "Segmented"); + addItem(RimWellPathCompletions::AVERAGED, "AVG", "Averaged"); + + setDefault(RimWellPathCompletions::SEGMENTED); + } + + } CAF_PDM_SOURCE_INIT(RimWellPathCompletions, "WellPathCompletions"); @@ -80,14 +112,19 @@ RimWellPathCompletions::RimWellPathCompletions() m_fractureCollection = new RimWellPathFractureCollection; m_fractureCollection.uiCapability()->setUiHidden(true); - CAF_PDM_InitField(&m_wellNameForExport, "WellNameForExport", QString(), "Well Name for Completion Export", "", "", ""); + CAF_PDM_InitField(&m_wellNameForExport, "WellNameForExport", QString(), "Well Name", "", "", ""); m_wellNameForExport.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName()); - CAF_PDM_InitField(&m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name for Completion Export", "", "", ""); - - CAF_PDM_InitField(&m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for Completion Export", "", "", ""); - - CAF_PDM_InitField(&m_wellType, "WellTypeForExport", WellTypeEnum(), "Well Type for Completion Export", "", "", ""); + CAF_PDM_InitField(&m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name", "", "", ""); + CAF_PDM_InitField(&m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP", "", "", ""); + CAF_PDM_InitField(&m_preferredFluidPhase, "WellTypeForExport", WellTypeEnum(), "Preferred Fluid Phase", "", "", ""); + CAF_PDM_InitField(&m_drainageRadiusForPI, "DrainageRadiusForPI", QString("0.0"), "Drainage Radius for PI", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in", "", "", ""); + CAF_PDM_InitField(&m_allowWellCrossFlow, "AllowWellCrossFlow", true, "Allow Well Cross-Flow", "", "", ""); + CAF_PDM_InitField(&m_wellBoreFluidPVTTable, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_hydrostaticDensity, "HydrostaticDensity", "Hydrostatic Density", "", "", ""); + CAF_PDM_InitField(&m_fluidInPlaceRegion, "FluidInPlaceRegion", 0, "Fluid In-Place Region", "", "", ""); } //-------------------------------------------------------------------------------------------------- @@ -153,7 +190,7 @@ QString RimWellPathCompletions::referenceDepthForExport() const //-------------------------------------------------------------------------------------------------- QString RimWellPathCompletions::wellTypeNameForExport() const { - switch (m_wellType.v()) + switch (m_preferredFluidPhase.v()) { case OIL: return "OIL"; case GAS: return "GAS"; @@ -227,6 +264,62 @@ bool RimWellPathCompletions::hasCompletions() const !perforationCollection()->perforations().empty(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimWellPathCompletions::drainageRadiusForExport() const +{ + return m_drainageRadiusForPI(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimWellPathCompletions::gasInflowEquationForExport() const +{ + return m_gasInflowEquation().text(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimWellPathCompletions::automaticWellShutInForExport() const +{ + return m_automaticWellShutIn().text(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimWellPathCompletions::allowWellCrossFlowForExport() const +{ + return m_allowWellCrossFlow() ? "YES" : "NO"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimWellPathCompletions::wellBoreFluidPVTForExport() const +{ + return QString("%1").arg(m_wellBoreFluidPVTTable()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimWellPathCompletions::hydrostaticDensityForExport() const +{ + return m_hydrostaticDensity().text(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimWellPathCompletions::fluidInPlaceRegionForExport() const +{ + return QString("%1").arg(m_fluidInPlaceRegion()); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -246,6 +339,26 @@ QRegExp RimWellPathCompletions::wellNameForExportRegExp() return rx; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathCompletions::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +{ + caf::PdmUiGroup* compExportGroup = uiOrdering.addNewGroup("Completion Export Parameters"); + compExportGroup->add(&m_wellNameForExport); + compExportGroup->add(&m_wellGroupName); + compExportGroup->add(&m_referenceDepth); + compExportGroup->add(&m_preferredFluidPhase); + compExportGroup->add(&m_drainageRadiusForPI); + compExportGroup->add(&m_gasInflowEquation); + compExportGroup->add(&m_automaticWellShutIn); + compExportGroup->add(&m_allowWellCrossFlow); + compExportGroup->add(&m_wellBoreFluidPVTTable); + compExportGroup->add(&m_hydrostaticDensity); + compExportGroup->add(&m_fluidInPlaceRegion); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -308,6 +421,24 @@ void RimWellPathCompletions::defineEditorAttribute(const caf::PdmFieldHandle* fi validator->setRegExp(wellNameForExportRegExp()); lineEditorAttr->validator = validator; } + else if (field == &m_drainageRadiusForPI && lineEditorAttr) + { + caf::PdmDoubleStringValidator* validator = new caf::PdmDoubleStringValidator("1*"); + lineEditorAttr->validator = validator; + } + else if (field == &m_wellBoreFluidPVTTable && lineEditorAttr) + { + // Positive integer + QIntValidator* validator = new QIntValidator(0, std::numeric_limits::max(), nullptr); + lineEditorAttr->validator = validator; + } + else if (field == &m_fluidInPlaceRegion && lineEditorAttr) + { + // Any integer + QIntValidator* validator = new QIntValidator(-std::numeric_limits::max(), std::numeric_limits::max(), nullptr); + lineEditorAttr->validator = validator; + + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h index f92fd37cf5..9ccd4186b1 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h @@ -39,6 +39,15 @@ class RimWellPathCompletions : public caf::PdmObject enum WellType {OIL, GAS, WATER, LIQUID}; typedef caf::AppEnum WellTypeEnum; + enum GasInflowEquation {STANDARD_EQ, RUSSELL_GOODRICH, DRY_GAS_PSEUDO_PRESSURE, GENERALIZED_PSEUDO_PRESSURE }; + typedef caf::AppEnum GasInflowEnum; + + enum AutomaticWellShutIn {ISOLATE_FROM_FORMATION, STOP_ABOVE_FORMATION }; + typedef caf::AppEnum AutomaticWellShutInEnum; + + enum HydrostaticDensity { SEGMENTED, AVERAGED }; + typedef caf::AppEnum HydrostaticDensityEnum; + public: RimWellPathCompletions(); @@ -56,9 +65,18 @@ public: QString wellTypeNameForExport() const; bool hasCompletions() const; + QString drainageRadiusForExport() const; + QString gasInflowEquationForExport() const; + QString automaticWellShutInForExport() const; + QString allowWellCrossFlowForExport() const; + QString wellBoreFluidPVTForExport() const; + QString hydrostaticDensityForExport() const; + QString fluidInPlaceRegionForExport() const; + void setUnitSystemSpecificDefaults(); static QRegExp wellNameForExportRegExp(); protected: + void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; @@ -75,5 +93,12 @@ private: caf::PdmField m_wellGroupName; caf::PdmField m_referenceDepth; - caf::PdmField m_wellType; + caf::PdmField m_preferredFluidPhase; + caf::PdmField m_drainageRadiusForPI; + caf::PdmField m_gasInflowEquation; + caf::PdmField m_automaticWellShutIn; + caf::PdmField m_allowWellCrossFlow; + caf::PdmField m_wellBoreFluidPVTTable; + caf::PdmField m_hydrostaticDensity; + caf::PdmField m_fluidInPlaceRegion; }; diff --git a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt index b60dd76cd9..fa8993d9d9 100644 --- a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt @@ -53,6 +53,7 @@ set (MOC_HEADER_FILES cafPdmUiFormLayoutObjectEditor.h cafPdmUiDoubleValueEditor.h cafPdmUniqueIdValidator.h + cafPdmDoubleStringValidator.h ) if ( NOT CMAKE_AUTOMOC ) @@ -156,6 +157,7 @@ set( PROJECT_FILES cafMemoryInspector.h cafMemoryInspector.cpp cafPdmUniqueIdValidator.cpp + cafPdmDoubleStringValidator.cpp ) add_library( ${PROJECT_NAME} diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmDoubleStringValidator.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmDoubleStringValidator.cpp new file mode 100644 index 0000000000..07a42ed8b1 --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmDoubleStringValidator.cpp @@ -0,0 +1,57 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library 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. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafPdmDoubleStringValidator.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QValidator::State caf::PdmDoubleStringValidator::validate(QString& inputString, int& position) const +{ + if (m_defaultString == inputString) + { + return QValidator::Acceptable; + } + return QDoubleValidator::validate(inputString, position); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void caf::PdmDoubleStringValidator::fixup(QString& inputString) const +{ + inputString = m_defaultString; +} diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmDoubleStringValidator.h b/Fwk/AppFwk/cafUserInterface/cafPdmDoubleStringValidator.h new file mode 100644 index 0000000000..9dad34ec9d --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmDoubleStringValidator.h @@ -0,0 +1,64 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library 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. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## +#pragma once + +#include +#include + +namespace caf +{ +////////////////////////////////////////////////////////////////////////// +/// Class that validates text strings containing double values but allows +/// a default text string that isn't necessarily a double. +/// Example use is the "1*" value in ECLIPSE output files or "N/A". +////////////////////////////////////////////////////////////////////////// +class PdmDoubleStringValidator : public QDoubleValidator +{ + Q_OBJECT +public: + PdmDoubleStringValidator(const QString& defaultString) + : QDoubleValidator(nullptr), m_defaultString(defaultString) + { + } + + State validate(QString& inputString, int& position) const override; + void fixup(QString& inputString) const override; + +private: + QString m_defaultString; +}; +} + diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUniqueIdValidator.h b/Fwk/AppFwk/cafUserInterface/cafPdmUniqueIdValidator.h index 07b7b2052f..fca050771c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUniqueIdValidator.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUniqueIdValidator.h @@ -42,6 +42,7 @@ namespace caf { class PdmUniqueIdValidator : public QValidator { + Q_OBJECT public: PdmUniqueIdValidator(const std::set& usedIds, bool multipleSelectionOfSameFieldsSelected, const QString& errorMessage, QObject* parent);