diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 43ce0d6455..33267d87a6 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -73,6 +73,8 @@ RimWellAllocationPlot::RimWellAllocationPlot() CAF_PDM_InitFieldNoDefault(&m_accumulatedWellFlowPlot, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", ""); m_accumulatedWellFlowPlot.uiCapability()->setUiHidden(true); m_accumulatedWellFlowPlot = new RimWellLogPlot; + m_accumulatedWellFlowPlot->setDepthUnit(RimDefines::UNIT_NONE); + m_accumulatedWellFlowPlot->setDepthType(RimWellLogPlot::CONNECTION_NUMBER); CAF_PDM_InitFieldNoDefault(&m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", ""); m_totalWellAllocationPlot.uiCapability()->setUiHidden(true); @@ -308,7 +310,7 @@ void RimWellAllocationPlot::addStackedCurve(const QString& tracerName, RimWellLogTrack* plotTrack) { RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; - curve->setFlowValues(tracerName, connNumbers, accFlow); + curve->setFlowValuesPrConnection(tracerName, connNumbers, accFlow); if ( m_flowDiagSolution ) curve->setColor(m_flowDiagSolution->tracerColor(tracerName)); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index abcc9733e2..a11ad11ea2 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -142,7 +142,7 @@ void RimWellFlowRateCurve::updateStackedPlotData() bool isFirstTrack = (wellLogTrack == wellLogPlot->trackByIndex(0)); - RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER; + RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_NONE; std::vector depthValues = m_curveData->measuredDepthPlotValues(displayUnit); if (depthValues.size()) depthValues.insert(depthValues.begin(), depthValues[0]); // Insert the first depth position again, to make room for a real 0 value @@ -192,10 +192,10 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellFlowRateCurve::setFlowValues(const QString& tracerName, const std::vector& measuredDepths, const std::vector& flowRates) +void RimWellFlowRateCurve::setFlowValuesPrConnection(const QString& tracerName, const std::vector& connectionNumbers, const std::vector& flowRates) { m_curveData = new RigWellLogCurveData; - m_curveData->setValuesAndMD(flowRates, measuredDepths, RimDefines::UNIT_METER, false); + m_curveData->setValuesAndMD(flowRates, connectionNumbers, RimDefines::UNIT_NONE, false); m_tracerName = tracerName; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h index 1fc4b02ee2..cd498e8eaf 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h @@ -38,7 +38,7 @@ public: RimWellFlowRateCurve(); virtual ~RimWellFlowRateCurve(); - void setFlowValues(const QString& tracerName , const std::vector& measuredDepths, const std::vector& flowRates); + void setFlowValuesPrConnection(const QString& tracerName , const std::vector& connectionNumbers, const std::vector& flowRates); void updateStackedPlotData(); virtual QString wellName() const override; diff --git a/ApplicationCode/ProjectDataModel/RimDefines.cpp b/ApplicationCode/ProjectDataModel/RimDefines.cpp index a4795ac89d..ec64948c4a 100644 --- a/ApplicationCode/ProjectDataModel/RimDefines.cpp +++ b/ApplicationCode/ProjectDataModel/RimDefines.cpp @@ -50,6 +50,8 @@ namespace caf { addItem(RimDefines::UNIT_METER, "UNIT_METER", "Meter"); addItem(RimDefines::UNIT_FEET, "UNIT_FEET", "Feet"); + addItem(RimDefines::UNIT_NONE, "UNIT_NONE", "None"); + setDefault(RimDefines::UNIT_METER); } diff --git a/ApplicationCode/ProjectDataModel/RimDefines.h b/ApplicationCode/ProjectDataModel/RimDefines.h index 4fb5a5b4a9..779f763d27 100644 --- a/ApplicationCode/ProjectDataModel/RimDefines.h +++ b/ApplicationCode/ProjectDataModel/RimDefines.h @@ -77,7 +77,8 @@ public: enum DepthUnitType { UNIT_METER, - UNIT_FEET + UNIT_FEET, + UNIT_NONE }; static double feetPerMeter() { return 3.2808399; } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 2d950c2054..3186516e75 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -304,7 +304,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate() { m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->trueDepthPlotValues(displayUnit).data(), static_cast(m_curveData->xPlotValues().size())); } - else + else if (wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH) { m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast(m_curveData->xPlotValues().size())); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index d45613b2d1..b397e90457 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -30,6 +30,7 @@ #include "cvfAssert.h" #include +#include "RimWellAllocationPlot.h" #define RI_LOGPLOT_MINDEPTH_DEFAULT 0.0 #define RI_LOGPLOT_MAXDEPTH_DEFAULT 1000.0 @@ -41,6 +42,8 @@ namespace caf { { addItem(RimWellLogPlot::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth"); addItem(RimWellLogPlot::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth"); + addItem(RimWellLogPlot::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length"); + addItem(RimWellLogPlot::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number"); setDefault(RimWellLogPlot::MEASURED_DEPTH); } @@ -111,6 +114,7 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c { updateMdiWindowTitle(); } + if (changedField == &m_depthType || changedField == &m_depthUnit) { @@ -118,6 +122,36 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimWellLogPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) +{ + QList options; + + if (fieldNeedingOptions == &m_depthType ) + { + using DepthAppEnum = caf::AppEnum< DepthTypeEnum >; + for (size_t i = 0; i < DepthAppEnum::size(); ++i) + { + DepthTypeEnum enumVal = DepthAppEnum::fromIndex(i); + if (m_disabledDepthTypes.count( enumVal) == 0) + { + options.push_back(caf::PdmOptionItemInfo(DepthAppEnum::uiText(enumVal), enumVal)); + } + } + } + else if ( fieldNeedingOptions == &m_depthUnit) + { + using UnitAppEnum = caf::AppEnum< RimDefines::DepthUnitType >; + options.push_back(caf::PdmOptionItemInfo(UnitAppEnum::uiText(RimDefines::UNIT_METER), RimDefines::UNIT_METER)); + options.push_back(caf::PdmOptionItemInfo(UnitAppEnum::uiText(RimDefines::UNIT_FEET), RimDefines::UNIT_FEET)); + } + + (*useOptionsOnly) = true; + return options; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -352,12 +386,17 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& { uiOrdering.add(&m_userName); uiOrdering.add(&m_depthType); - uiOrdering.add(&m_depthUnit); + if ( m_depthType() != CONNECTION_NUMBER ) + { + uiOrdering.add(&m_depthUnit); + } caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup("Visible Depth Range"); gridGroup->add(&m_isAutoScaleDepthEnabled); gridGroup->add(&m_minVisibleDepth); gridGroup->add(&m_maxVisibleDepth); + + uiOrdering.setForgetRemainingFields(true); } @@ -377,6 +416,8 @@ void RimWellLogPlot::updateTracks() { if (m_showWindow) { + updateDisabledDepthTypes(); + for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx) { m_tracks[tIdx]->loadDataAndUpdate(); @@ -518,6 +559,14 @@ RimWellLogPlot::DepthTypeEnum RimWellLogPlot::depthType() const return m_depthType.value(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogPlot::setDepthType(DepthTypeEnum depthType) +{ + m_depthType = depthType; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -536,14 +585,24 @@ QString RimWellLogPlot::depthPlotTitle() const switch (m_depthType.value()) { case MEASURED_DEPTH: - depthTitle = "MD"; - break; + depthTitle = "MD"; + break; case TRUE_VERTICAL_DEPTH: - depthTitle = "TVD"; - break; + depthTitle = "TVD"; + break; + + case PSEUDO_LENGTH: + depthTitle = "PL"; + break; + + case CONNECTION_NUMBER: + depthTitle = "Connection"; + break; } + if (m_depthType() == CONNECTION_NUMBER) return depthTitle; + if (m_depthUnit == RimDefines::UNIT_METER) { depthTitle += " [m]"; @@ -552,6 +611,10 @@ QString RimWellLogPlot::depthPlotTitle() const { depthTitle += " [ft]"; } + else if (m_depthUnit == RimDefines::UNIT_NONE) + { + depthTitle += ""; + } return depthTitle; } @@ -574,3 +637,24 @@ void RimWellLogPlot::setDepthUnit(RimDefines::DepthUnitType depthUnit) updateTracks(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogPlot::updateDisabledDepthTypes() +{ + m_disabledDepthTypes.clear(); + RimWellAllocationPlot* wap; + firstAncestorOrThisOfType(wap); + if (wap) + { + m_disabledDepthTypes.insert(MEASURED_DEPTH); + m_disabledDepthTypes.insert(TRUE_VERTICAL_DEPTH); + m_disabledDepthTypes.insert(PSEUDO_LENGTH); + } + else + { + m_disabledDepthTypes.insert(PSEUDO_LENGTH); + m_disabledDepthTypes.insert(CONNECTION_NUMBER); + } +} + diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h index 8c961158a1..821374da32 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h @@ -45,10 +45,14 @@ public: enum DepthTypeEnum { MEASURED_DEPTH, - TRUE_VERTICAL_DEPTH + TRUE_VERTICAL_DEPTH, + PSEUDO_LENGTH, + CONNECTION_NUMBER }; + + public: RimWellLogPlot(); virtual ~RimWellLogPlot(); @@ -57,10 +61,12 @@ public: QString description() const; DepthTypeEnum depthType() const; + void setDepthType(DepthTypeEnum depthType); RimDefines::DepthUnitType depthUnit() const; void setDepthUnit(RimDefines::DepthUnitType depthUnit); + QString depthPlotTitle() const; void addTrack(RimWellLogTrack* track); @@ -97,6 +103,7 @@ protected: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; } + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; virtual QImage snapshotWindowContent() override; @@ -107,6 +114,8 @@ private: void recreateTrackPlots(); void detachAllCurves(); + void updateDisabledDepthTypes(); + public: // Needed by RiuWellAllocation Plot // RimViewWindow overrides @@ -118,6 +127,7 @@ private: caf::PdmField< caf::AppEnum< DepthTypeEnum > > m_depthType; caf::PdmField< caf::AppEnum< RimDefines::DepthUnitType > > m_depthUnit; + std::set m_disabledDepthTypes; caf::PdmChildArrayField m_tracks; diff --git a/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp b/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp index c7201c9ae9..b6c9d3ea21 100644 --- a/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp +++ b/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp @@ -203,6 +203,11 @@ public: { lasFile->AddLog("DEPTH", "FT", "Depth in feet", firstCurveData->measuredDepths()); } + else if ( firstCurveData->depthUnit() == RimDefines::UNIT_NONE ) + { + CVF_ASSERT(false); + lasFile->AddLog("DEPTH", "", "Depth in Connection number", firstCurveData->measuredDepths()); + } if (firstCurveData->tvDepths().size()) { @@ -225,6 +230,12 @@ public: { lasFile->AddLog("TVDRKB", "FT", "True vertical depth (Rotary Kelly Bushing)", tvdrkbValues); } + else if ( firstCurveData->depthUnit() == RimDefines::UNIT_NONE ) + { + CVF_ASSERT(false); + lasFile->AddLog("TVDRKB", "", "", tvdrkbValues); + } + } } @@ -243,6 +254,10 @@ public: { lasFile->setDepthUnit("FT"); } + else if ( firstCurveData->depthUnit() == RimDefines::UNIT_NONE ) + { + CVF_ASSERT(false); + } double absentValue = SingleLasFileMetaData::createAbsentValue(m_minimumCurveValue); lasFile->SetMissing(absentValue); diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp index 76f78734e9..38196efa7e 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp @@ -228,6 +228,11 @@ QString RigWellLogFile::wellLogChannelUnitString(const QString& wellLogChannelNa { return "FT"; } + else if (displayDepthUnit == RimDefines::UNIT_NONE) + { + CVF_ASSERT(false); + return ""; + } } } @@ -279,7 +284,11 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString else if (curveData->depthUnit() == RimDefines::UNIT_FEET) { lasFile.AddLog("DEPTH", "FT", "Depth in feet", curveData->measuredDepths()); - + } + else if (curveData->depthUnit() == RimDefines::UNIT_NONE) + { + CVF_ASSERT(false); + lasFile.AddLog("DEPTH", "", "Depth in connection number", curveData->measuredDepths()); } if(curveData->tvDepths().size()) @@ -305,6 +314,11 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString { lasFile.setDepthUnit("FT"); } + else if ( curveData->depthUnit() == RimDefines::UNIT_NONE ) + { + CVF_ASSERT(false); + lasFile.setDepthUnit(""); + } lasFile.setVersionInfo("2.0");