From 738af9c88e02ae04b74a7f0927f48abdc6311bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 4 Nov 2015 12:51:55 +0100 Subject: [PATCH 01/27] (#606)(#607) Added gui for the statistics control. Started refactoring Refactoring to access pr timestep data from the statistics calculation. --- .../GeoMechDataModel/RigFemNativeStatCalc.cpp | 55 +++++------ .../GeoMechDataModel/RigFemNativeStatCalc.h | 6 +- .../Rim3dOverlayInfoConfig.cpp | 93 +++++++++++++++---- .../ProjectDataModel/Rim3dOverlayInfoConfig.h | 24 ++++- .../RigMultipleDatasetStatCalc.cpp | 32 ++++--- .../RigMultipleDatasetStatCalc.h | 5 +- .../ReservoirDataModel/RigNativeStatCalc.cpp | 38 ++++---- .../ReservoirDataModel/RigNativeStatCalc.h | 6 +- .../RigStatisticsCalculator.cpp | 45 +++++++++ .../RigStatisticsCalculator.h | 9 +- 10 files changed, 216 insertions(+), 97 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp index 246eb857d9..5642863662 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp @@ -92,53 +92,48 @@ void RigFemNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos } } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigFemNativeStatCalc::valueSumAndSampleCount(double& valueSum, size_t& sampleCount) +void RigFemNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) { - int timestepCount = (int)(this->timeStepCount()); - int partCount = static_cast(m_resultsData->m_femPartResults.size()); + int tsIdx = static_cast(timeStepIndex); + int partCount = static_cast(m_resultsData->m_femPartResults.size()); - for (int pIdx = 0; pIdx < partCount; ++pIdx) - { - for (int tIdx = 0; tIdx < timestepCount; tIdx++) - { - const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, tIdx); - size_t undefValueCount = 0; - for (size_t cIdx = 0; cIdx < values.size(); ++cIdx) - { - double value = values[cIdx]; - if (value == HUGE_VAL || value != value) - { - ++undefValueCount; - continue; - } + for (int pIdx = 0; pIdx < partCount; ++pIdx) + { + const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, tsIdx); + size_t undefValueCount = 0; + for (size_t cIdx = 0; cIdx < values.size(); ++cIdx) + { + double value = values[cIdx]; + if (value == HUGE_VAL || value != value) + { + ++undefValueCount; + continue; + } - valueSum += value; - } + valueSum += value; + } - sampleCount += values.size(); - sampleCount -= undefValueCount; - } - } + sampleCount += values.size(); + sampleCount -= undefValueCount; + } } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigFemNativeStatCalc::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator) +void RigFemNativeStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) { - int timestepCount = (int)(this->timeStepCount()); int partCount = static_cast(m_resultsData->m_femPartResults.size()); for (int pIdx = 0; pIdx < partCount; ++pIdx) { - for (int tIdx = 0; tIdx < timestepCount; tIdx++) - { - const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, tIdx); + const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, static_cast(timeStepIndex)); - histogramCalculator.addData(values); - } + histogramCalculator.addData(values); } } diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.h index 269083a74e..9f7b67104b 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.h @@ -37,9 +37,11 @@ public: virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max); virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg); - virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount); - virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator); + virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount); + + virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator); + virtual size_t timeStepCount(); private: diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 458a091220..f80ce53311 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -41,7 +41,37 @@ #include "RigFemResultAddress.h" #include "RigFemPartResultsCollection.h" +#include "RigStatisticsDataCache.h" + CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig"); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- + +namespace caf +{ +template<> +void caf::AppEnum::setUp() +{ + addItem(Rim3dOverlayInfoConfig::ALL_TIMESTEPS, "ALL_TIMESTEPS", "All Time Steps"); + addItem(Rim3dOverlayInfoConfig::CURRENT_TIMESTEP, "CURRENT_TIMESTEP", "Current Time Step"); + setDefault(Rim3dOverlayInfoConfig::ALL_TIMESTEPS); +} +} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- + +namespace caf +{ +template<> +void caf::AppEnum::setUp() +{ + addItem(Rim3dOverlayInfoConfig::ALL_CELLS, "ALL_CELLS", "All Active Cells"); + addItem(Rim3dOverlayInfoConfig::VISIBLE_CELLS, "VISIBLE_CELLS", "Visible Cells"); + setDefault(Rim3dOverlayInfoConfig::ALL_CELLS); +} +} //-------------------------------------------------------------------------------------------------- /// @@ -56,6 +86,9 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig() CAF_PDM_InitField(&showInfoText, "ShowInfoText", true, "Info Text", "", "", ""); CAF_PDM_InitField(&showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", ""); CAF_PDM_InitField(&showHistogram, "ShowHistogram", true, "Histogram", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_statisticsTimeRange, "StatisticsTimeRange", "Statistics Time Range", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_statisticsCellRange, "StatisticsCellRange", "Statistics Cell Range", "", "", ""); } //-------------------------------------------------------------------------------------------------- @@ -111,7 +144,7 @@ void Rim3dOverlayInfoConfig::update3DInfo() m_viewDef->viewer()->showAnimationProgress(showAnimProgress()); RimEclipseView * reservoirView = dynamic_cast(m_viewDef.p()); - if (reservoirView) updateReservoir3DInfo(reservoirView); + if (reservoirView) updateEclipse3DInfo(reservoirView); RimGeoMechView * geoMechView = dynamic_cast(m_viewDef.p()); if (geoMechView) updateGeoMech3DInfo(geoMechView); } @@ -135,7 +168,7 @@ void Rim3dOverlayInfoConfig::setReservoirView(RimView* ownerReservoirView) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dOverlayInfoConfig::updateReservoir3DInfo(RimEclipseView * reservoirView) +void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView) { if (showInfoText()) { @@ -183,19 +216,38 @@ void Rim3dOverlayInfoConfig::updateReservoir3DInfo(RimEclipseView * reservoirVie if (reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult()) { infoText += QString("Cell Property: %1 ").arg(propName); + // Wait until regression tests confirm new statisticks is ok infoText += QString("
Statistics for: ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText(); - double min, max; - double p10, p90; - double mean; - size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex(); - reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max); - reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90); - reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean); + if (m_statisticsCellRange == ALL_CELLS) + { + double min, max; + double p10, p90; + double mean; + + size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex(); - //infoText += QString("
Min: %1 P10: %2 Mean: %3 P90: %4 Max: %5
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); - //infoText += QString("
Min: %1   P10: %2   Mean: %3 \n  P90: %4   Max: %5 
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); - infoText += QString("" - "
MinP10 Mean P90 Max
%1 %2 %3 %4 %5
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); + if (m_statisticsTimeRange == ALL_TIMESTEPS) + { + reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max); + reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90); + reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean); + } + else if (m_statisticsTimeRange == CURRENT_TIMESTEP) + { + int timeStepIdx = reservoirView->currentTimeStep(); + reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, timeStepIdx, min, max); + //reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, timeStepIdx, p10, p90); + //reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean); + p10 = HUGE_VAL; + p90 = HUGE_VAL; + mean = HUGE_VAL; + } + + infoText += QString("" + "" + "" + "
Min P10 Mean P90 Max
%1 %2 %3 %4 %5
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); + } if (reservoirView->faultResultSettings()->hasValidCustomResult()) { @@ -257,6 +309,8 @@ void Rim3dOverlayInfoConfig::updateReservoir3DInfo(RimEclipseView * reservoirVie { if (reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult()) { + if (m_statisticsCellRange == ALL_CELLS && m_statisticsTimeRange == ALL_TIMESTEPS) + { double min, max; double p10, p90; double mean; @@ -269,6 +323,7 @@ void Rim3dOverlayInfoConfig::updateReservoir3DInfo(RimEclipseView * reservoirVie reservoirView->viewer()->showHistogram(true); reservoirView->viewer()->setHistogram(min, max, reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex)); reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean); + } } } } @@ -322,8 +377,7 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) break; } - infoText += QString( - "Cell result: %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName); + infoText += QString("Cell result: %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName); double min = 0, max = 0; double p10 = 0, p90 = 0; @@ -332,13 +386,12 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); caseData->femPartResults()->meanScalarValue(resAddress, &mean); caseData->femPartResults()->minMaxScalarValues(resAddress,&min, &max); - - // ToDo: Implement statistics for geomech data - caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90); - infoText += QString("" - "
MinP10 Mean P90 Max
%1 %2 %3 %4 %5
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); + infoText += QString("" + "" + "" + "
Min P10 Mean P90 Max
%1 %2 %3 %4 %5
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); } else { diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h index 463fb6b71b..4391f3c393 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h @@ -24,12 +24,14 @@ #include "cafAppEnum.h" #include "cvfAssert.h" +#include "cvfObject.h" #include "cvfVector2.h" class RimEclipseView; class RimGeoMechView; class RimView; +class RigStatisticsDataCache; //================================================================================================== /// @@ -51,18 +53,34 @@ public: caf::PdmField showInfoText; caf::PdmField showAnimProgress; caf::PdmField showHistogram; - + + enum StatisticsTimeRangeType + { + ALL_TIMESTEPS, + CURRENT_TIMESTEP + }; + + enum StatisticsCellRangeType + { + ALL_CELLS, + VISIBLE_CELLS + }; + protected: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); virtual caf::PdmFieldHandle* objectToggleField(); private: - void updateReservoir3DInfo(RimEclipseView * reservoirView); + void updateEclipse3DInfo(RimEclipseView * reservoirView); void updateGeoMech3DInfo(RimGeoMechView * geoMechView); - + caf::PdmField > m_statisticsTimeRange; + caf::PdmField > m_statisticsCellRange; caf::PdmPointer m_viewDef; cvf::Vec2ui m_position; + + cvf::ref m_visibleCellStatistics; + }; diff --git a/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.cpp b/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.cpp index 8db3f8a136..ba654ccf16 100644 --- a/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.cpp @@ -67,30 +67,32 @@ void RigMultipleDatasetStatCalc::posNegClosestToZero(size_t timeStepIndex, doubl } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigMultipleDatasetStatCalc::valueSumAndSampleCount(double& valueSum, size_t& sampleCount) -{ - for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++) - { - if (m_nativeStatisticsCalculators.at(i)) - { - m_nativeStatisticsCalculators.at(i)->valueSumAndSampleCount(valueSum, sampleCount); - } - } -} //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigMultipleDatasetStatCalc::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator) +void RigMultipleDatasetStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) { for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++) { if (m_nativeStatisticsCalculators.at(i)) { - m_nativeStatisticsCalculators.at(i)->addDataToHistogramCalculator(histogramCalculator); + m_nativeStatisticsCalculators.at(i)->valueSumAndSampleCount(timeStepIndex, valueSum, sampleCount); + } + } +} + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigMultipleDatasetStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) +{ + for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++) + { + if (m_nativeStatisticsCalculators.at(i)) + { + m_nativeStatisticsCalculators.at(i)->addDataToHistogramCalculator(timeStepIndex, histogramCalculator); } } } diff --git a/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.h b/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.h index 6085aa2e1c..b36e4e1aa3 100644 --- a/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.h @@ -44,8 +44,9 @@ public: virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max); virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg); - virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount); - virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator); + virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount); + + virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator); virtual size_t timeStepCount(); diff --git a/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.cpp b/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.cpp index 5008764d42..d6d1a6ac99 100644 --- a/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.cpp @@ -94,40 +94,36 @@ void RigNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, d //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNativeStatCalc::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator) +void RigNativeStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) { - for (size_t tIdx = 0; tIdx < m_resultsData->timeStepCount(m_scalarResultIndex); tIdx++) - { - std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, tIdx); + std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); - histogramCalculator.addData(values); - } + histogramCalculator.addData(values); } + + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNativeStatCalc::valueSumAndSampleCount(double& valueSum, size_t& sampleCount) +void RigNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) { - for (size_t tIdx = 0; tIdx < m_resultsData->timeStepCount(m_scalarResultIndex); tIdx++) + std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); + size_t undefValueCount = 0; + for (size_t cIdx = 0; cIdx < values.size(); ++cIdx) { - std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, tIdx); - size_t undefValueCount = 0; - for (size_t cIdx = 0; cIdx < values.size(); ++cIdx) + double value = values[cIdx]; + if (value == HUGE_VAL || value != value) { - double value = values[cIdx]; - if (value == HUGE_VAL || value != value) - { - ++undefValueCount; - continue; - } - - valueSum += value; + ++undefValueCount; + continue; } - sampleCount += values.size(); - sampleCount -= undefValueCount; + valueSum += value; } + + sampleCount += values.size(); + sampleCount -= undefValueCount; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.h b/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.h index ece9cf800d..929888dcae 100644 --- a/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.h @@ -38,9 +38,11 @@ public: virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max); virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg); - virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount); - virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator); + virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount); + + virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator); + virtual size_t timeStepCount(); private: diff --git a/ApplicationCode/ResultStatisticsCache/RigStatisticsCalculator.cpp b/ApplicationCode/ResultStatisticsCache/RigStatisticsCalculator.cpp index 6550dc8e68..80270f146d 100644 --- a/ApplicationCode/ResultStatisticsCache/RigStatisticsCalculator.cpp +++ b/ApplicationCode/ResultStatisticsCache/RigStatisticsCalculator.cpp @@ -42,3 +42,48 @@ void RigStatisticsCalculator::meanCellScalarValue(double& meanValue) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsCalculator::meanCellScalarValue(size_t timeStepIndex, double& meanValue) +{ + double valueSum = 0.0; + size_t sampleCount = 0; + + this->valueSumAndSampleCount(timeStepIndex, valueSum, sampleCount); + + if (sampleCount == 0) + { + meanValue = HUGE_VAL; + } + else + { + meanValue = valueSum / sampleCount; + } + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsCalculator::valueSumAndSampleCount(double& valueSum, size_t& sampleCount) +{ + size_t tsCount = this->timeStepCount(); + for (size_t tIdx = 0; tIdx < tsCount; tIdx++) + { + this->valueSumAndSampleCount(tIdx, valueSum, sampleCount); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsCalculator::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator) +{ + size_t tsCount = this->timeStepCount(); + for (size_t tIdx = 0; tIdx < tsCount; tIdx++) + { + this->addDataToHistogramCalculator(tIdx, histogramCalculator); + } +} + diff --git a/ApplicationCode/ResultStatisticsCache/RigStatisticsCalculator.h b/ApplicationCode/ResultStatisticsCache/RigStatisticsCalculator.h index 02ff0967ab..d3ab541e54 100644 --- a/ApplicationCode/ResultStatisticsCache/RigStatisticsCalculator.h +++ b/ApplicationCode/ResultStatisticsCache/RigStatisticsCalculator.h @@ -37,8 +37,13 @@ public: virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) = 0; void meanCellScalarValue(double& meanValue); - virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount) = 0; - virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator) = 0; + void meanCellScalarValue(size_t timeStepIndex, double& meanValue); + + void valueSumAndSampleCount(double& valueSum, size_t& sampleCount); + virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) = 0; + + void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator); + virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) = 0; virtual size_t timeStepCount() = 0; }; From a4d7e369ebcbb8938ef2e706e6048124a592dfbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 4 Nov 2015 15:44:09 +0100 Subject: [PATCH 02/27] (#606)(#607) Added option to show 3D-info statistics pr. time step. --- .../RigFemPartResultsCollection.cpp | 24 +++ .../RigFemPartResultsCollection.h | 5 +- .../Rim3dOverlayInfoConfig.cpp | 112 ++++++++---- .../RigCaseCellResultsData.cpp | 24 +++ .../RigCaseCellResultsData.h | 3 + .../RigStatisticsDataCache.cpp | 159 +++++++++++------- .../RigStatisticsDataCache.h | 57 +++++-- 7 files changed, 274 insertions(+), 110 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index 8421d1dcc4..493f626c54 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -781,6 +781,14 @@ void RigFemPartResultsCollection::meanScalarValue(const RigFemResultAddress& res this->statistics(resVarAddr)->meanCellScalarValues(*meanValue); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemPartResultsCollection::meanScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* meanValue) +{ + this->statistics(resVarAddr)->meanCellScalarValues(frameIndex, *meanValue); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -789,6 +797,14 @@ void RigFemPartResultsCollection::p10p90ScalarValues(const RigFemResultAddress& this->statistics(resVarAddr)->p10p90CellScalarValues(*p10, *p90); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemPartResultsCollection::p10p90ScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex, double* p10, double* p90) +{ + this->statistics(resVarAddr)->p10p90CellScalarValues(frameIndex, *p10, *p90); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -797,3 +813,11 @@ const std::vector& RigFemPartResultsCollection::scalarValuesHistogram(co return this->statistics(resVarAddr)->cellScalarValuesHistogram(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RigFemPartResultsCollection::scalarValuesHistogram(const RigFemResultAddress& resVarAddr, int frameIndex) +{ + return this->statistics(resVarAddr)->cellScalarValuesHistogram(frameIndex); +} + diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h index 48dd83b91e..8980de73c3 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h @@ -48,12 +48,15 @@ public: void minMaxScalarValues (const RigFemResultAddress& resVarAddr, int frameIndex, double* localMin, double* localMax); - void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero); void minMaxScalarValues (const RigFemResultAddress& resVarAddr, double* globalMin, double* globalMax); + void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero); void posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero); void meanScalarValue(const RigFemResultAddress& resVarAddr, double* meanValue); + void meanScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* meanValue); void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, double* p10, double* p90); + void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex, double* p10, double* p90); const std::vector& scalarValuesHistogram(const RigFemResultAddress& resVarAddr); + const std::vector& scalarValuesHistogram(const RigFemResultAddress& resVarAddr, int frameIndex); private: RigFemScalarResultFrames* findOrLoadScalarResult(int partIndex, diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index f80ce53311..a22a6bf821 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -89,6 +89,7 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig() CAF_PDM_InitFieldNoDefault(&m_statisticsTimeRange, "StatisticsTimeRange", "Statistics Time Range", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_statisticsCellRange, "StatisticsCellRange", "Statistics Cell Range", "", "", ""); + m_statisticsCellRange.uiCapability()->setUiHidden(true); } //-------------------------------------------------------------------------------------------------- @@ -220,9 +221,9 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView) if (m_statisticsCellRange == ALL_CELLS) { - double min, max; - double p10, p90; - double mean; + double min = HUGE_VAL, max = HUGE_VAL; + double p10 = HUGE_VAL, p90 = HUGE_VAL; + double mean = HUGE_VAL; size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex(); @@ -236,11 +237,8 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView) { int timeStepIdx = reservoirView->currentTimeStep(); reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, timeStepIdx, min, max); - //reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, timeStepIdx, p10, p90); - //reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean); - p10 = HUGE_VAL; - p90 = HUGE_VAL; - mean = HUGE_VAL; + reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, timeStepIdx, p10, p90); + reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean); } infoText += QString("" @@ -309,20 +307,38 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView) { if (reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult()) { - if (m_statisticsCellRange == ALL_CELLS && m_statisticsTimeRange == ALL_TIMESTEPS) + if (m_statisticsCellRange == ALL_CELLS) { - double min, max; - double p10, p90; - double mean; + double min = HUGE_VAL, max = HUGE_VAL; + double p10 = HUGE_VAL, p90 = HUGE_VAL; + double mean = HUGE_VAL; + const std::vector* histogram = NULL; - size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex(); - reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max); - reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90); - reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean); + size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex(); - reservoirView->viewer()->showHistogram(true); - reservoirView->viewer()->setHistogram(min, max, reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex)); - reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean); + if (m_statisticsTimeRange == ALL_TIMESTEPS) + { + reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max); + reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90); + reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean); + histogram = &(reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex)); + } + else if (m_statisticsTimeRange == CURRENT_TIMESTEP ) + { + int timeStepIdx = reservoirView->currentTimeStep(); + reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, timeStepIdx, min, max); + reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, timeStepIdx, p10, p90); + reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean); + histogram = &(reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex, timeStepIdx)); + } + else + { + CVF_ASSERT(false); + } + + reservoirView->viewer()->showHistogram(true); + reservoirView->viewer()->setHistogram(min, max, *histogram); + reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean); } } } @@ -379,14 +395,25 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) infoText += QString("Cell result: %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName); - double min = 0, max = 0; - double p10 = 0, p90 = 0; - double mean = 0; - + double min = HUGE_VAL, max = HUGE_VAL; + double p10 = HUGE_VAL, p90 = HUGE_VAL; + double mean = HUGE_VAL; + RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); - caseData->femPartResults()->meanScalarValue(resAddress, &mean); - caseData->femPartResults()->minMaxScalarValues(resAddress,&min, &max); - caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90); + + if (m_statisticsTimeRange == ALL_TIMESTEPS) + { + caseData->femPartResults()->meanScalarValue (resAddress, &mean); + caseData->femPartResults()->minMaxScalarValues(resAddress,&min, &max); + caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90); + } + else if (m_statisticsTimeRange == CURRENT_TIMESTEP) + { + int timeStepIdx = geoMechView->currentTimeStep(); + caseData->femPartResults()->meanScalarValue (resAddress, timeStepIdx, &mean); + caseData->femPartResults()->minMaxScalarValues(resAddress, timeStepIdx, &min, &max); + caseData->femPartResults()->p10p90ScalarValues(resAddress, timeStepIdx, &p10, &p90); + } infoText += QString("
" "" @@ -420,15 +447,34 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) if (caseData) { - double min = 0, max = 0; - double p10 = 0, p90 = 0; - double mean = 0; + double min = HUGE_VAL, max = HUGE_VAL; + double p10 = HUGE_VAL, p90 = HUGE_VAL; + double mean = HUGE_VAL; + const std::vector* histogram = NULL; RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); - caseData->femPartResults()->meanScalarValue(resAddress, &mean); - caseData->femPartResults()->minMaxScalarValues(resAddress, &min, &max); - caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90); - geoMechView->viewer()->setHistogram(min, max, caseData->femPartResults()->scalarValuesHistogram(resAddress)); + + if (m_statisticsTimeRange == ALL_TIMESTEPS) + { + caseData->femPartResults()->meanScalarValue(resAddress, &mean); + caseData->femPartResults()->minMaxScalarValues(resAddress, &min, &max); + caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90); + histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress)); + } + else if (m_statisticsTimeRange == CURRENT_TIMESTEP) + { + int timeStepIdx = geoMechView->currentTimeStep(); + caseData->femPartResults()->meanScalarValue(resAddress, timeStepIdx, &mean); + caseData->femPartResults()->minMaxScalarValues(resAddress, timeStepIdx, &min, &max); + caseData->femPartResults()->p10p90ScalarValues(resAddress, timeStepIdx, &p10, &p90); + histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress, timeStepIdx)); + } + else + { + CVF_ASSERT(false); + } + + geoMechView->viewer()->setHistogram(min, max, *histogram); geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean); } } diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 10e2a61c47..885b24d48e 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -87,6 +87,14 @@ const std::vector& RigCaseCellResultsData::cellScalarValuesHistogram(siz return m_statisticsDataCache[scalarResultIndex]->cellScalarValuesHistogram(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RigCaseCellResultsData::cellScalarValuesHistogram(size_t scalarResultIndex, size_t timeStepIndex) +{ + return m_statisticsDataCache[scalarResultIndex]->cellScalarValuesHistogram(timeStepIndex); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -95,6 +103,14 @@ void RigCaseCellResultsData::p10p90CellScalarValues(size_t scalarResultIndex, do m_statisticsDataCache[scalarResultIndex]->p10p90CellScalarValues(p10, p90); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCaseCellResultsData::p10p90CellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& p10, double& p90) +{ + m_statisticsDataCache[scalarResultIndex]->p10p90CellScalarValues(timeStepIndex, p10, p90); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -103,6 +119,14 @@ void RigCaseCellResultsData::meanCellScalarValues(size_t scalarResultIndex, doub m_statisticsDataCache[scalarResultIndex]->meanCellScalarValues(meanValue); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCaseCellResultsData::meanCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue) +{ + m_statisticsDataCache[scalarResultIndex]->meanCellScalarValues(timeStepIndex, meanValue); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h index a772be7f47..901b57d224 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -54,8 +54,11 @@ public: void posNegClosestToZero(size_t scalarResultIndex, double& pos, double& neg); void posNegClosestToZero(size_t scalarResultIndex, size_t timeStepIndex, double& pos, double& neg); const std::vector& cellScalarValuesHistogram(size_t scalarResultIndex); + const std::vector& cellScalarValuesHistogram(size_t scalarResultIndex, size_t timeStepIndex); void p10p90CellScalarValues(size_t scalarResultIndex, double& p10, double& p90); + void p10p90CellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& p10, double& p90); void meanCellScalarValues(size_t scalarResultIndex, double& meanValue); + void meanCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue); // Access meta-information about the results size_t resultCount() const; diff --git a/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp b/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp index 5b4a7182b4..dff04de95e 100644 --- a/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp +++ b/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp @@ -39,20 +39,8 @@ RigStatisticsDataCache::RigStatisticsDataCache(RigStatisticsCalculator* statisti //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::clearAllStatistics() { - m_minValue = HUGE_VAL; - m_maxValue = -HUGE_VAL; - m_isMaxMinCalculated = false; - m_posClosestToZero = HUGE_VAL; - m_negClosestToZero = -HUGE_VAL; - m_isClosestToZeroCalculated = false; - m_p10 = HUGE_VAL; - m_p90 = HUGE_VAL; - m_meanValue = HUGE_VAL; - m_isMeanCalculated = false; - - m_histogram.clear(); - m_maxMinValuesPrTs.clear(); - m_posNegClosestToZeroPrTs.clear(); + m_statsAllTimesteps = StatisticsValues(); + m_statsPrTs.clear(); } //-------------------------------------------------------------------------------------------------- @@ -60,7 +48,7 @@ void RigStatisticsDataCache::clearAllStatistics() //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::minMaxCellScalarValues(double& min, double& max) { - if (!m_isMaxMinCalculated) + if (!m_statsAllTimesteps.m_isMaxMinCalculated) { min = HUGE_VAL; max = -HUGE_VAL; @@ -74,13 +62,13 @@ void RigStatisticsDataCache::minMaxCellScalarValues(double& min, double& max) if (tsmax > max) max = tsmax; } - m_minValue = min; - m_maxValue = max; - m_isMaxMinCalculated = true; + m_statsAllTimesteps.m_minValue = min; + m_statsAllTimesteps.m_maxValue = max; + m_statsAllTimesteps.m_isMaxMinCalculated = true; } - min = m_minValue; - max = m_maxValue; + min = m_statsAllTimesteps.m_minValue; + max = m_statsAllTimesteps.m_maxValue; } //-------------------------------------------------------------------------------------------------- @@ -88,27 +76,26 @@ void RigStatisticsDataCache::minMaxCellScalarValues(double& min, double& max) //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) { - if (timeStepIndex >= m_maxMinValuesPrTs.size()) + if (timeStepIndex >= m_statsPrTs.size()) { - m_maxMinValuesPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL)); - m_isMaxMinPrTsCalculated.resize(timeStepIndex + 1, false); + m_statsPrTs.resize(timeStepIndex + 1); } - if (!m_isMaxMinPrTsCalculated[timeStepIndex]) + if (!m_statsPrTs[timeStepIndex].m_isMaxMinCalculated) { double tsMin = HUGE_VAL; double tsMax = -HUGE_VAL; m_statisticsCalculator->minMaxCellScalarValues(timeStepIndex, tsMin, tsMax); - m_maxMinValuesPrTs[timeStepIndex].first = tsMin; - m_maxMinValuesPrTs[timeStepIndex].second = tsMax; + m_statsPrTs[timeStepIndex].m_minValue = tsMin; + m_statsPrTs[timeStepIndex].m_maxValue = tsMax; - m_isMaxMinPrTsCalculated[timeStepIndex] = true; + m_statsPrTs[timeStepIndex].m_isMaxMinCalculated = true; } - min = m_maxMinValuesPrTs[timeStepIndex].first; - max = m_maxMinValuesPrTs[timeStepIndex].second; + min = m_statsPrTs[timeStepIndex].m_minValue; + max = m_statsPrTs[timeStepIndex].m_maxValue; } //-------------------------------------------------------------------------------------------------- @@ -116,7 +103,7 @@ void RigStatisticsDataCache::minMaxCellScalarValues(size_t timeStepIndex, double //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::posNegClosestToZero(double& pos, double& neg) { - if (!m_isClosestToZeroCalculated) + if (!m_statsAllTimesteps.m_isClosestToZeroCalculated) { pos = HUGE_VAL; neg = -HUGE_VAL; @@ -130,13 +117,13 @@ void RigStatisticsDataCache::posNegClosestToZero(double& pos, double& neg) if (tsPos < pos && tsPos > 0) pos = tsPos; } - m_posClosestToZero = pos; - m_negClosestToZero = neg; - m_isClosestToZeroCalculated = true; + m_statsAllTimesteps.m_posClosestToZero = pos; + m_statsAllTimesteps.m_negClosestToZero = neg; + m_statsAllTimesteps.m_isClosestToZeroCalculated = true; } - pos = m_posClosestToZero; - neg = m_negClosestToZero; + pos = m_statsAllTimesteps.m_posClosestToZero; + neg = m_statsAllTimesteps.m_negClosestToZero; } //-------------------------------------------------------------------------------------------------- @@ -144,13 +131,12 @@ void RigStatisticsDataCache::posNegClosestToZero(double& pos, double& neg) //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& posNearZero, double& negNearZero) { - if (timeStepIndex >= m_posNegClosestToZeroPrTs.size()) + if (timeStepIndex >= m_statsPrTs.size()) { - m_posNegClosestToZeroPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL)); - m_isClosestToZeroPrTsCalculated.resize(timeStepIndex + 1, false); + m_statsPrTs.resize(timeStepIndex + 1); } - if (!m_isClosestToZeroPrTsCalculated[timeStepIndex]) + if (!m_statsPrTs[timeStepIndex].m_isClosestToZeroCalculated) { double pos = HUGE_VAL; @@ -158,14 +144,14 @@ void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& p m_statisticsCalculator->posNegClosestToZero(timeStepIndex, pos, neg); - m_posNegClosestToZeroPrTs[timeStepIndex].first = pos; - m_posNegClosestToZeroPrTs[timeStepIndex].second = neg; + m_statsPrTs[timeStepIndex].m_posClosestToZero = pos; + m_statsPrTs[timeStepIndex].m_negClosestToZero = neg; - m_isClosestToZeroPrTsCalculated[timeStepIndex] = true; + m_statsPrTs[timeStepIndex].m_isClosestToZeroCalculated = true; } - posNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].first; - negNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].second; + posNearZero = m_statsPrTs[timeStepIndex].m_posClosestToZero; + negNearZero = m_statsPrTs[timeStepIndex].m_negClosestToZero; } //-------------------------------------------------------------------------------------------------- @@ -173,9 +159,19 @@ void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& p //-------------------------------------------------------------------------------------------------- const std::vector& RigStatisticsDataCache::cellScalarValuesHistogram() { - computeStatisticsIfNeeded(); + computeHistogramStatisticsIfNeeded(); - return m_histogram; + return m_statsAllTimesteps.m_histogram; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RigStatisticsDataCache::cellScalarValuesHistogram(size_t timeStepIndex) +{ + computeHistogramStatisticsIfNeeded(timeStepIndex); + + return m_statsPrTs[timeStepIndex].m_histogram; } //-------------------------------------------------------------------------------------------------- @@ -183,11 +179,21 @@ const std::vector& RigStatisticsDataCache::cellScalarValuesHistogram() //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::p10p90CellScalarValues(double& p10, double& p90) { - // First make sure they are calculated - computeStatisticsIfNeeded(); + computeHistogramStatisticsIfNeeded(); - p10 = m_p10; - p90 = m_p90; + p10 = m_statsAllTimesteps.m_p10; + p90 = m_statsAllTimesteps.m_p90; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsDataCache::p10p90CellScalarValues(size_t timeStepIndex, double& p10, double& p90) +{ + computeHistogramStatisticsIfNeeded(timeStepIndex); + + p10 = m_statsPrTs[timeStepIndex].m_p10; + p90 = m_statsPrTs[timeStepIndex].m_p90; } //-------------------------------------------------------------------------------------------------- @@ -195,33 +201,68 @@ void RigStatisticsDataCache::p10p90CellScalarValues(double& p10, double& p90) //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::meanCellScalarValues(double& meanValue) { - if (!m_isMeanCalculated) + if (!m_statsAllTimesteps.m_isMeanCalculated) { - m_statisticsCalculator->meanCellScalarValue(m_meanValue); - m_isMeanCalculated = true; + m_statisticsCalculator->meanCellScalarValue(m_statsAllTimesteps.m_meanValue); + m_statsAllTimesteps.m_isMeanCalculated = true; } - meanValue = m_meanValue; + meanValue = m_statsAllTimesteps.m_meanValue; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigStatisticsDataCache::computeStatisticsIfNeeded() +void RigStatisticsDataCache::meanCellScalarValues(size_t timeStepIndex, double& meanValue) { - if (m_histogram.size() == 0) + if (!m_statsPrTs[timeStepIndex].m_isMeanCalculated) + { + m_statisticsCalculator->meanCellScalarValue(timeStepIndex, m_statsPrTs[timeStepIndex].m_meanValue); + m_statsPrTs[timeStepIndex].m_isMeanCalculated = true; + } + + meanValue = m_statsPrTs[timeStepIndex].m_meanValue; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsDataCache::computeHistogramStatisticsIfNeeded() +{ + if (m_statsAllTimesteps.m_histogram.size() == 0) { double min; double max; size_t nBins = 100; this->minMaxCellScalarValues(min, max); - RigHistogramCalculator histCalc(min, max, nBins, &m_histogram); + RigHistogramCalculator histCalc(min, max, nBins, &m_statsAllTimesteps.m_histogram); m_statisticsCalculator->addDataToHistogramCalculator(histCalc); - m_p10 = histCalc.calculatePercentil(0.1); - m_p90 = histCalc.calculatePercentil(0.9); + m_statsAllTimesteps.m_p10 = histCalc.calculatePercentil(0.1); + m_statsAllTimesteps.m_p90 = histCalc.calculatePercentil(0.9); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsDataCache::computeHistogramStatisticsIfNeeded(size_t timeStepIndex) +{ + if (m_statsPrTs[timeStepIndex].m_histogram.size() == 0) + { + double min; + double max; + size_t nBins = 100; + this->minMaxCellScalarValues(min, max); + + RigHistogramCalculator histCalc(min, max, nBins, &m_statsPrTs[timeStepIndex].m_histogram); + + m_statisticsCalculator->addDataToHistogramCalculator(timeStepIndex, histCalc); + + m_statsPrTs[timeStepIndex].m_p10 = histCalc.calculatePercentil(0.1); + m_statsPrTs[timeStepIndex].m_p90 = histCalc.calculatePercentil(0.9); } } diff --git a/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.h b/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.h index ae4c262f35..4926a0a68c 100644 --- a/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.h +++ b/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.h @@ -39,37 +39,60 @@ public: void minMaxCellScalarValues(double& min, double& max); void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max); + void posNegClosestToZero(double& pos, double& neg); void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg); void p10p90CellScalarValues(double& p10, double& p90); + void p10p90CellScalarValues(size_t timeStepIndex, double& p10, double& p90); + void meanCellScalarValues(double& meanValue); + void meanCellScalarValues(size_t timeStepIndex, double& meanValue); + const std::vector& cellScalarValuesHistogram(); + const std::vector& cellScalarValuesHistogram(size_t timeStepIndex); private: - void computeStatisticsIfNeeded(); + void computeHistogramStatisticsIfNeeded(); + void computeHistogramStatisticsIfNeeded(size_t timeStepIndex); private: - double m_minValue; - double m_maxValue; - bool m_isMaxMinCalculated; + struct StatisticsValues + { + StatisticsValues() + { + m_minValue = HUGE_VAL; + m_maxValue = -HUGE_VAL; + m_isMaxMinCalculated = false; + m_meanValue = HUGE_VAL; + m_isMeanCalculated = false; + m_posClosestToZero = HUGE_VAL; + m_negClosestToZero = -HUGE_VAL; + m_isClosestToZeroCalculated = false; + m_p10 = HUGE_VAL; + m_p90 = HUGE_VAL; + } - double m_posClosestToZero; - double m_negClosestToZero; - bool m_isClosestToZeroCalculated; + double m_minValue; + double m_maxValue; + bool m_isMaxMinCalculated; + + double m_meanValue; + bool m_isMeanCalculated; - double m_p10; - double m_p90; - double m_meanValue; - bool m_isMeanCalculated; + double m_posClosestToZero; + double m_negClosestToZero; + bool m_isClosestToZeroCalculated; + + double m_p10; + double m_p90; - std::vector m_histogram; + std::vector m_histogram; + }; - std::vector > m_maxMinValuesPrTs; ///< Max min values for each time step - std::vector m_isMaxMinPrTsCalculated; - std::vector > m_posNegClosestToZeroPrTs; ///< PosNeg values for each time step - std::vector m_isClosestToZeroPrTsCalculated; + StatisticsValues m_statsAllTimesteps; + std::vector m_statsPrTs; - cvf::ref m_statisticsCalculator; + cvf::ref m_statisticsCalculator; }; From b64d34c79171d59f3fa70d44f40eaa3f4989a195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 4 Nov 2015 15:53:21 +0100 Subject: [PATCH 03/27] Rename of StatCalc classes --- .../ReservoirDataModel/CMakeLists_files.cmake | 8 +++---- .../RigCaseCellResultsData.cpp | 16 +++++++------- ...pp => RigEclipseMultiPropertyStatCalc.cpp} | 22 +++++++++---------- ...lc.h => RigEclipseMultiPropertyStatCalc.h} | 4 ++-- ...tCalc.cpp => RigEclipseNativeStatCalc.cpp} | 14 ++++++------ ...eStatCalc.h => RigEclipseNativeStatCalc.h} | 4 ++-- 6 files changed, 34 insertions(+), 34 deletions(-) rename ApplicationCode/ReservoirDataModel/{RigMultipleDatasetStatCalc.cpp => RigEclipseMultiPropertyStatCalc.cpp} (78%) rename ApplicationCode/ReservoirDataModel/{RigMultipleDatasetStatCalc.h => RigEclipseMultiPropertyStatCalc.h} (94%) rename ApplicationCode/ReservoirDataModel/{RigNativeStatCalc.cpp => RigEclipseNativeStatCalc.cpp} (85%) rename ApplicationCode/ReservoirDataModel/{RigNativeStatCalc.h => RigEclipseNativeStatCalc.h} (91%) diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index 21ddac0704..33f6106e01 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -34,8 +34,8 @@ ${CEE_CURRENT_LIST_DIR}cvfGeometryTools.inl ${CEE_CURRENT_LIST_DIR}RigPipeInCellEvaluator.h ${CEE_CURRENT_LIST_DIR}RigResultAccessor2d.h ${CEE_CURRENT_LIST_DIR}RigTernaryResultAccessor2d.h -${CEE_CURRENT_LIST_DIR}RigNativeStatCalc.h -${CEE_CURRENT_LIST_DIR}RigMultipleDatasetStatCalc.h +${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.h +${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.h ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h ) @@ -65,8 +65,8 @@ ${CEE_CURRENT_LIST_DIR}RigFault.cpp ${CEE_CURRENT_LIST_DIR}RigNNCData.cpp ${CEE_CURRENT_LIST_DIR}cvfGeometryTools.cpp ${CEE_CURRENT_LIST_DIR}RigTernaryResultAccessor2d.cpp -${CEE_CURRENT_LIST_DIR}RigNativeStatCalc.cpp -${CEE_CURRENT_LIST_DIR}RigMultipleDatasetStatCalc.cpp +${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.cpp +${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp ) diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 885b24d48e..48f2aa9083 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -23,8 +23,8 @@ #include "RigMainGrid.h" #include "RigStatisticsDataCache.h" #include "RigStatisticsMath.h" -#include "RigMultipleDatasetStatCalc.h" -#include "RigNativeStatCalc.h" +#include "RigEclipseMultiPropertyStatCalc.h" +#include "RigEclipseNativeStatCalc.h" #include #include @@ -249,7 +249,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty if (resultName == RimDefines::combinedTransmissibilityResultName()) { - cvf::ref calc = new RigMultipleDatasetStatCalc(); + cvf::ref calc = new RigEclipseMultiPropertyStatCalc(); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, "TRANX")); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, "TRANY")); @@ -259,7 +259,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty } else if (resultName == RimDefines::combinedMultResultName()) { - cvf::ref calc = new RigMultipleDatasetStatCalc(); + cvf::ref calc = new RigEclipseMultiPropertyStatCalc(); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, "MULTX")); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, "MULTX-")); @@ -272,7 +272,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty } else if (resultName == RimDefines::combinedRiTranResultName()) { - cvf::ref calc = new RigMultipleDatasetStatCalc(); + cvf::ref calc = new RigEclipseMultiPropertyStatCalc(); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTranXResultName())); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTranYResultName())); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTranZResultName())); @@ -280,7 +280,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty } else if (resultName == RimDefines::combinedRiMultResultName()) { - cvf::ref calc = new RigMultipleDatasetStatCalc(); + cvf::ref calc = new RigEclipseMultiPropertyStatCalc(); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultXResultName())); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultYResultName())); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultZResultName())); @@ -288,7 +288,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty } else if (resultName == RimDefines::combinedRiAreaNormTranResultName()) { - cvf::ref calc = new RigMultipleDatasetStatCalc(); + cvf::ref calc = new RigEclipseMultiPropertyStatCalc(); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTranXResultName())); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTranYResultName())); calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTranZResultName())); @@ -296,7 +296,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty } else { - statisticsCalculator = new RigNativeStatCalc(this, scalarResultIndex); + statisticsCalculator = new RigEclipseNativeStatCalc(this, scalarResultIndex); } cvf::ref dataCache = new RigStatisticsDataCache(statisticsCalculator.p()); diff --git a/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.cpp similarity index 78% rename from ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.cpp rename to ApplicationCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.cpp index ba654ccf16..7bceecbf91 100644 --- a/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.cpp @@ -17,21 +17,21 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RigMultipleDatasetStatCalc.h" -#include "RigNativeStatCalc.h" +#include "RigEclipseMultiPropertyStatCalc.h" +#include "RigEclipseNativeStatCalc.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigMultipleDatasetStatCalc::RigMultipleDatasetStatCalc() +RigEclipseMultiPropertyStatCalc::RigEclipseMultiPropertyStatCalc() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigMultipleDatasetStatCalc::addStatisticsCalculator(RigStatisticsCalculator* statisticsCalculator) +void RigEclipseMultiPropertyStatCalc::addStatisticsCalculator(RigStatisticsCalculator* statisticsCalculator) { if (statisticsCalculator) { @@ -42,7 +42,7 @@ void RigMultipleDatasetStatCalc::addStatisticsCalculator(RigStatisticsCalculator //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigMultipleDatasetStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) +void RigEclipseMultiPropertyStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) { for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++) { @@ -56,7 +56,7 @@ void RigMultipleDatasetStatCalc::minMaxCellScalarValues(size_t timeStepIndex, do //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigMultipleDatasetStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) +void RigEclipseMultiPropertyStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) { for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++) { @@ -71,7 +71,7 @@ void RigMultipleDatasetStatCalc::posNegClosestToZero(size_t timeStepIndex, doubl //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigMultipleDatasetStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) +void RigEclipseMultiPropertyStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) { for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++) { @@ -86,7 +86,7 @@ void RigMultipleDatasetStatCalc::valueSumAndSampleCount(size_t timeStepIndex, do //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigMultipleDatasetStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) +void RigEclipseMultiPropertyStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) { for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++) { @@ -100,7 +100,7 @@ void RigMultipleDatasetStatCalc::addDataToHistogramCalculator(size_t timeStepInd //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RigMultipleDatasetStatCalc::timeStepCount() +size_t RigEclipseMultiPropertyStatCalc::timeStepCount() { if (m_nativeStatisticsCalculators.size() > 0) { @@ -113,11 +113,11 @@ size_t RigMultipleDatasetStatCalc::timeStepCount() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigMultipleDatasetStatCalc::addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex) +void RigEclipseMultiPropertyStatCalc::addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex) { if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) { - this->addStatisticsCalculator(new RigNativeStatCalc(cellResultsData, scalarResultIndex)); + this->addStatisticsCalculator(new RigEclipseNativeStatCalc(cellResultsData, scalarResultIndex)); } } diff --git a/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.h b/ApplicationCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.h similarity index 94% rename from ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.h rename to ApplicationCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.h index b36e4e1aa3..6a85fa2afb 100644 --- a/ApplicationCode/ReservoirDataModel/RigMultipleDatasetStatCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.h @@ -34,10 +34,10 @@ class RigCaseCellResultsData; //================================================================================================== /// //================================================================================================== -class RigMultipleDatasetStatCalc : public RigStatisticsCalculator +class RigEclipseMultiPropertyStatCalc : public RigStatisticsCalculator { public: - RigMultipleDatasetStatCalc(); + RigEclipseMultiPropertyStatCalc(); void addStatisticsCalculator(RigStatisticsCalculator* statisticsCalculator); void addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndices); diff --git a/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp similarity index 85% rename from ApplicationCode/ReservoirDataModel/RigNativeStatCalc.cpp rename to ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp index d6d1a6ac99..a152114abf 100644 --- a/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp @@ -17,7 +17,7 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RigNativeStatCalc.h" +#include "RigEclipseNativeStatCalc.h" #include "RigStatisticsMath.h" #include "RigCaseCellResultsData.h" @@ -29,7 +29,7 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigNativeStatCalc::RigNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex) +RigEclipseNativeStatCalc::RigEclipseNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex) : m_resultsData(cellResultsData), m_scalarResultIndex(scalarResultIndex) { @@ -39,7 +39,7 @@ RigNativeStatCalc::RigNativeStatCalc(RigCaseCellResultsData* cellResultsData, si //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) +void RigEclipseNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) { std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); @@ -66,7 +66,7 @@ void RigNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) +void RigEclipseNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) { std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); @@ -94,7 +94,7 @@ void RigNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, d //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNativeStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) +void RigEclipseNativeStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) { std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); @@ -106,7 +106,7 @@ void RigNativeStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) +void RigEclipseNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) { std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); size_t undefValueCount = 0; @@ -129,7 +129,7 @@ void RigNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& val //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RigNativeStatCalc::timeStepCount() +size_t RigEclipseNativeStatCalc::timeStepCount() { return m_resultsData->timeStepCount(m_scalarResultIndex); } diff --git a/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.h b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h similarity index 91% rename from ApplicationCode/ReservoirDataModel/RigNativeStatCalc.h rename to ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h index 929888dcae..2ad79f4c4d 100644 --- a/ApplicationCode/ReservoirDataModel/RigNativeStatCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h @@ -31,10 +31,10 @@ class RigCaseCellResultsData; //================================================================================================== /// //================================================================================================== -class RigNativeStatCalc : public RigStatisticsCalculator +class RigEclipseNativeStatCalc : public RigStatisticsCalculator { public: - RigNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex); + RigEclipseNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex); virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max); virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg); From f77a92a77b74681532fe0312e4efa014725bc933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 4 Nov 2015 15:57:06 +0100 Subject: [PATCH 04/27] Rename TrackPlot/PlotTrack classes to Track --- .../Commands/RicDeleteItemExec.cpp | 2 +- .../RicAddWellLogToPlotFeature.cpp | 2 +- .../RicDeleteWellLogPlotTrackFeature.cpp | 6 +-- .../RicNewWellLogCurveExtractionFeature.cpp | 10 ++-- .../RicNewWellLogCurveExtractionFeature.h | 6 +-- .../RicNewWellLogFileCurveFeature.cpp | 12 ++--- .../RicNewWellLogFileCurveFeature.h | 8 ++-- .../RicNewWellLogPlotFeature.cpp | 2 +- .../RicNewWellLogPlotFeatureImpl.cpp | 4 +- .../RicNewWellLogPlotFeatureImpl.h | 4 +- .../RicNewWellLogPlotTrackFeature.cpp | 2 +- .../RicWellLogPlotTrackFeatureImpl.cpp | 14 +++--- .../RicWellLogPlotTrackFeatureImpl.h | 8 ++-- .../ProjectDataModel/RimProject.cpp | 2 +- .../ProjectDataModel/RimWellLogPlot.cpp | 12 ++--- .../ProjectDataModel/RimWellLogPlot.h | 14 +++--- .../ProjectDataModel/RimWellLogPlotCurve.cpp | 6 +-- .../ProjectDataModel/RimWellLogPlotCurve.h | 6 +-- .../ProjectDataModel/RimWellLogPlotTrack.cpp | 46 +++++++++---------- .../ProjectDataModel/RimWellLogPlotTrack.h | 12 ++--- ApplicationCode/UserInterface/RiuDragDrop.cpp | 20 ++++---- ApplicationCode/UserInterface/RiuDragDrop.h | 4 +- .../UserInterface/RiuWellLogPlot.cpp | 6 +-- .../UserInterface/RiuWellLogPlot.h | 10 ++-- .../UserInterface/RiuWellLogTrackPlot.cpp | 24 +++++----- .../UserInterface/RiuWellLogTrackPlot.h | 10 ++-- 26 files changed, 126 insertions(+), 126 deletions(-) diff --git a/ApplicationCode/Commands/RicDeleteItemExec.cpp b/ApplicationCode/Commands/RicDeleteItemExec.cpp index 184c982563..85ae9a4c80 100644 --- a/ApplicationCode/Commands/RicDeleteItemExec.cpp +++ b/ApplicationCode/Commands/RicDeleteItemExec.cpp @@ -120,7 +120,7 @@ void RicDeleteItemExec::redo() wellLogPlot->zoomAllDepth(); } - RimWellLogPlotTrack* wellLogPlotTrack; + RimWellLogTrack* wellLogPlotTrack; parentObj->firstAnchestorOrThisOfType(wellLogPlotTrack); if (wellLogPlotTrack) { diff --git a/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp index dd966b8043..9d70eec660 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp @@ -68,7 +68,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked) RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot(); - RimWellLogPlotTrack* plotTrack = new RimWellLogPlotTrack(); + RimWellLogTrack* plotTrack = new RimWellLogTrack(); plot->addTrack(plotTrack); plotTrack->setDescription(QString("Track %1").arg(plot->trackCount())); diff --git a/ApplicationCode/Commands/WellLogCommands/RicDeleteWellLogPlotTrackFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicDeleteWellLogPlotTrackFeature.cpp index a6efaedfd5..12bca0e1e7 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicDeleteWellLogPlotTrackFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicDeleteWellLogPlotTrackFeature.cpp @@ -34,7 +34,7 @@ CAF_CMD_SOURCE_INIT(RicDeleteWellLogPlotTrackFeature, "RicDeleteWellLogPlotTrack //-------------------------------------------------------------------------------------------------- bool RicDeleteWellLogPlotTrackFeature::isCommandEnabled() { - std::vector selection; + std::vector selection; caf::SelectionManager::instance()->objectsByType(&selection); if (selection.size() > 0) @@ -55,12 +55,12 @@ bool RicDeleteWellLogPlotTrackFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicDeleteWellLogPlotTrackFeature::onActionTriggered(bool isChecked) { - std::vector selection; + std::vector selection; caf::SelectionManager::instance()->objectsByType(&selection); for (size_t i = 0; i < selection.size(); i++) { - RimWellLogPlotTrack* track = selection[i]; + RimWellLogTrack* track = selection[i]; RimWellLogPlot* wellLogPlot = NULL; track->firstAnchestorOrThisOfType(wellLogPlot); diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp index b862b28307..e4cbdfb00a 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp @@ -54,7 +54,7 @@ bool RicNewWellLogCurveExtractionFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked) { - RimWellLogPlotTrack* wellLogPlotTrack = selectedWellLogPlotTrack(); + RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack(); if (wellLogPlotTrack) { addCurve(wellLogPlotTrack, NULL, NULL); @@ -64,7 +64,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked) RimWellPath* wellPath = selectedWellPath(); if (wellPath) { - RimWellLogPlotTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); + RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath); plotCurve->updatePlotData(); @@ -84,9 +84,9 @@ void RicNewWellLogCurveExtractionFeature::setupActionLook(QAction* actionToSetup //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrack() const +RimWellLogTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrack() const { - std::vector selection; + std::vector selection; caf::SelectionManager::instance()->objectsByType(&selection); return selection.size() > 0 ? selection[0] : NULL; } @@ -115,7 +115,7 @@ bool RicNewWellLogCurveExtractionFeature::caseAvailable() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogPlotTrack* plotTrack, RimView* view, RimWellPath* wellPath) +RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath) { CVF_ASSERT(plotTrack); diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h index 84fe43c76a..97d33a9b70 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h @@ -22,7 +22,7 @@ #include "cafCmdFeature.h" class RimWellLogExtractionCurve; -class RimWellLogPlotTrack; +class RimWellLogTrack; class RimWellPath; class RimView; @@ -34,7 +34,7 @@ class RicNewWellLogCurveExtractionFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; public: - static RimWellLogExtractionCurve* addCurve(RimWellLogPlotTrack* plotTrack, RimView* view, RimWellPath* wellPath); + static RimWellLogExtractionCurve* addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath); protected: @@ -44,7 +44,7 @@ protected: virtual void setupActionLook( QAction* actionToSetup ); private: - RimWellLogPlotTrack* selectedWellLogPlotTrack() const; + RimWellLogTrack* selectedWellLogPlotTrack() const; RimWellPath* selectedWellPath() const; bool caseAvailable() const; }; diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp index 2fbcb81055..c75ba4ab8f 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp @@ -56,7 +56,7 @@ bool RicNewWellLogFileCurveFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewWellLogFileCurveFeature::onActionTriggered(bool isChecked) { - RimWellLogPlotTrack* wellLogPlotTrack = selectedWellLogPlotTrack(); + RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack(); if (wellLogPlotTrack) { addCurve(wellLogPlotTrack); @@ -66,7 +66,7 @@ void RicNewWellLogFileCurveFeature::onActionTriggered(bool isChecked) RimWellPath* wellPath = selectedWellPathWithLogFile(); if (wellPath) { - RimWellLogPlotTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); + RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RimWellLogFileCurve* plotCurve = addCurve(wellLogPlotTrack); plotCurve->setWellPath(wellPath); plotCurve->updateConnectedEditors(); @@ -85,9 +85,9 @@ void RicNewWellLogFileCurveFeature::setupActionLook(QAction* actionToSetup) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotTrack* RicNewWellLogFileCurveFeature::selectedWellLogPlotTrack() const +RimWellLogTrack* RicNewWellLogFileCurveFeature::selectedWellLogPlotTrack() const { - std::vector selection; + std::vector selection; caf::SelectionManager::instance()->objectsByType(&selection); return selection.size() > 0 ? selection[0] : NULL; } @@ -140,7 +140,7 @@ bool RicNewWellLogFileCurveFeature::wellLogFilesAvailable() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogFileCurve* RicNewWellLogFileCurveFeature::addCurve(RimWellLogPlotTrack* plotTrack) +RimWellLogFileCurve* RicNewWellLogFileCurveFeature::addCurve(RimWellLogTrack* plotTrack) { CVF_ASSERT(plotTrack); @@ -162,7 +162,7 @@ RimWellLogFileCurve* RicNewWellLogFileCurveFeature::addCurve(RimWellLogPlotTrack //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(RimWellLogPlotTrack* plotTrack, const std::vector& wellLogFileChannels) +void RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack, const std::vector& wellLogFileChannels) { for (size_t cIdx = 0; cIdx < wellLogFileChannels.size(); cIdx++) { diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h index 0c42f4a19c..d5991817c2 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h @@ -23,7 +23,7 @@ #include -class RimWellLogPlotTrack; +class RimWellLogTrack; class RimWellLogFileCurve; class RimWellPath; class RimWellLogFileChannel; @@ -37,9 +37,9 @@ class RicNewWellLogFileCurveFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; public: - static RimWellLogFileCurve* addCurve(RimWellLogPlotTrack* plotTrack); + static RimWellLogFileCurve* addCurve(RimWellLogTrack* plotTrack); - static void addWellLogChannelsToPlotTrack(RimWellLogPlotTrack* plotTrack, const std::vector& wellLogFileChannels); + static void addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack, const std::vector& wellLogFileChannels); protected: // Overrides @@ -48,7 +48,7 @@ protected: virtual void setupActionLook( QAction* actionToSetup ); private: - RimWellLogPlotTrack* selectedWellLogPlotTrack() const; + RimWellLogTrack* selectedWellLogPlotTrack() const; RimWellPath* selectedWellPathWithLogFile() const; bool wellLogFilesAvailable() const; }; diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp index 3f90c9d037..e456116c1e 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp @@ -50,7 +50,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked) { - RimWellLogPlotTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); + RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL); } diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp index bc5cf34067..7e7671ddf0 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp @@ -83,11 +83,11 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack() +RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack() { RimWellLogPlot* plot = createWellLogPlot(); - RimWellLogPlotTrack* plotTrack = new RimWellLogPlotTrack(); + RimWellLogTrack* plotTrack = new RimWellLogTrack(); plot->addTrack(plotTrack); plotTrack->setDescription(QString("Track %1").arg(plot->trackCount())); diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.h b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.h index f681dc1998..c50de7d82a 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.h +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.h @@ -22,7 +22,7 @@ class RimMainPlotCollection; class RimWellLogPlotCollection; class RimWellLogPlot; -class RimWellLogPlotTrack; +class RimWellLogTrack; //================================================================================================== /// @@ -34,5 +34,5 @@ public: static RimMainPlotCollection* mainPlotCollection(); static RimWellLogPlotCollection* wellLogPlotCollection(); static RimWellLogPlot* createWellLogPlot(); - static RimWellLogPlotTrack* createWellLogPlotTrack(); + static RimWellLogTrack* createWellLogPlotTrack(); }; diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp index f988a934bb..446798da8b 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp @@ -49,7 +49,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered(bool isChecked) RimWellLogPlot* wellLogPlot = selectedWellLogPlot(); if (wellLogPlot) { - RimWellLogPlotTrack* plotTrack = new RimWellLogPlotTrack; + RimWellLogTrack* plotTrack = new RimWellLogTrack; wellLogPlot->addTrack(plotTrack); plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount())); diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp index 3d69d234ce..24dad36f64 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp @@ -30,20 +30,20 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* destTrack, +void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogTrack* destTrack, const std::vector& curves, RimWellLogPlotCurve* curveToInsertAfter) { CVF_ASSERT(destTrack ); - std::set srcTracks; + std::set srcTracks; std::set srcPlots; for (size_t cIdx = 0; cIdx < curves.size(); cIdx++) { RimWellLogPlotCurve* curve = curves[cIdx]; - RimWellLogPlotTrack* wellLogPlotTrack; + RimWellLogTrack* wellLogPlotTrack; curve->firstAnchestorOrThisOfType(wellLogPlotTrack); if (wellLogPlotTrack) { @@ -69,7 +69,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlot (*pIt)->calculateAvailableDepthRange(); } - for (std::set::iterator tIt = srcTracks.begin(); tIt != srcTracks.end(); ++tIt) + for (std::set::iterator tIt = srcTracks.begin(); tIt != srcTracks.end(); ++tIt) { (*tIt)->zoomAllXAndZoomAllDepthOnOwnerPlot(); } @@ -83,8 +83,8 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlot /// //-------------------------------------------------------------------------------------------------- void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dstWellLogPlot, - const std::vector& tracksToMove, - RimWellLogPlotTrack* trackToInsertAfter) + const std::vector& tracksToMove, + RimWellLogTrack* trackToInsertAfter) { CVF_ASSERT(dstWellLogPlot); @@ -92,7 +92,7 @@ void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dst for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++) { - RimWellLogPlotTrack* track = tracksToMove[tIdx]; + RimWellLogTrack* track = tracksToMove[tIdx]; RimWellLogPlot* srcPlot; track->firstAnchestorOrThisOfType(srcPlot); diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.h b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.h index 2f4fdaf71d..e9eee75395 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.h +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.h @@ -22,7 +22,7 @@ #include class RimWellLogPlot; -class RimWellLogPlotTrack; +class RimWellLogTrack; class RimWellLogPlotCurve; //================================================================================================== @@ -32,10 +32,10 @@ class RicWellLogPlotTrackFeatureImpl { public: - static void moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* dstTrack, + static void moveCurvesToWellLogPlotTrack(RimWellLogTrack* dstTrack, const std::vector& curves, RimWellLogPlotCurve* insertAfterCurve); static void moveTracksToWellLogPlot(RimWellLogPlot* wellLogPlot, - const std::vector& tracks, - RimWellLogPlotTrack* trackToInsertAfter); + const std::vector& tracks, + RimWellLogTrack* trackToInsertAfter); }; diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index f0c24a21ff..045bb8adff 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -814,7 +814,7 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu) commandIds << "RicNewWellLogPlotTrackFeature"; commandIds << "RicDeleteItemFeature"; } - else if (dynamic_cast(uiItem)) + else if (dynamic_cast(uiItem)) { commandIds << "RicNewWellLogCurveExtractionFeature"; commandIds << "RicNewWellLogFileCurveFeature"; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index cccff5c598..be6dbb6727 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -167,7 +167,7 @@ caf::PdmFieldHandle* RimWellLogPlot::objectToggleField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::addTrack(RimWellLogPlotTrack* track) +void RimWellLogPlot::addTrack(RimWellLogTrack* track) { m_tracks.push_back(track); if (m_viewer) @@ -182,7 +182,7 @@ void RimWellLogPlot::addTrack(RimWellLogPlotTrack* track) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::insertTrack(RimWellLogPlotTrack* track, size_t index) +void RimWellLogPlot::insertTrack(RimWellLogTrack* track, size_t index) { m_tracks.insert(index, track); @@ -198,7 +198,7 @@ void RimWellLogPlot::insertTrack(RimWellLogPlotTrack* track, size_t index) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::removeTrack(RimWellLogPlotTrack* track) +void RimWellLogPlot::removeTrack(RimWellLogTrack* track) { if (track) { @@ -210,11 +210,11 @@ void RimWellLogPlot::removeTrack(RimWellLogPlotTrack* track) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector& tracksToMove) +void RimWellLogPlot::moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector& tracksToMove) { for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++) { - RimWellLogPlotTrack* track = tracksToMove[tIdx]; + RimWellLogTrack* track = tracksToMove[tIdx]; RimWellLogPlot* wellLogPlot; track->firstAnchestorOrThisOfType(wellLogPlot); @@ -534,7 +534,7 @@ QString RimWellLogPlot::depthPlotTitle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RimWellLogPlot::trackIndex(RimWellLogPlotTrack* track) +size_t RimWellLogPlot::trackIndex(RimWellLogTrack* track) { return m_tracks.index(track); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h index 3f86ca434a..544c1befc3 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h @@ -27,7 +27,7 @@ #include class RiuWellLogPlot; -class RimWellLogPlotTrack; +class RimWellLogTrack; //================================================================================================== @@ -56,12 +56,12 @@ public: caf::PdmField< std::vector > windowGeometry; - void addTrack(RimWellLogPlotTrack* track); - void insertTrack(RimWellLogPlotTrack* track, size_t index); + void addTrack(RimWellLogTrack* track); + void insertTrack(RimWellLogTrack* track, size_t index); size_t trackCount() { return m_tracks.size();} - void removeTrack(RimWellLogPlotTrack* track); - size_t trackIndex(RimWellLogPlotTrack* track); - void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector& tracksToMove); + void removeTrack(RimWellLogTrack* track); + size_t trackIndex(RimWellLogTrack* track); + void moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector& tracksToMove); void loadDataAndUpdate(); void updateTracks(); @@ -101,7 +101,7 @@ private: caf::PdmField m_showWindow; caf::PdmField m_userName; caf::PdmField< caf::AppEnum< DepthTypeEnum > > m_depthType; - caf::PdmChildArrayField m_tracks; + caf::PdmChildArrayField m_tracks; caf::PdmField m_minVisibleDepth; caf::PdmField m_maxVisibleDepth; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp index 04c0895339..203059d253 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp @@ -132,7 +132,7 @@ void RimWellLogPlotCurve::updateCurveVisibility() wellLogPlot->calculateAvailableDepthRange(); } - RimWellLogPlotTrack* wellLogPlotTrack; + RimWellLogTrack* wellLogPlotTrack; this->firstAnchestorOrThisOfType(wellLogPlotTrack); if (wellLogPlotTrack) { @@ -157,7 +157,7 @@ void RimWellLogPlotCurve::updatePlotConfiguration() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::setQwtTrack(RiuWellLogTrackPlot* plot) +void RimWellLogPlotCurve::setQwtTrack(RiuWellLogTrack* plot) { m_ownerQwtTrack = plot; if (m_showCurve) @@ -274,7 +274,7 @@ void RimWellLogPlotCurve::zoomAllOwnerTrackAndPlot() wellLogPlot->zoomAllDepth(); } - RimWellLogPlotTrack* plotTrack; + RimWellLogTrack* plotTrack; firstAnchestorOrThisOfType(plotTrack); if (plotTrack) { diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h index 3ecccc9ba6..da8b95d383 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h @@ -28,7 +28,7 @@ #include class RigWellLogCurveData; -class RiuWellLogTrackPlot; +class RiuWellLogTrack; class RiuWellLogPlotCurve; class QwtPlotCurve; class QString; @@ -49,7 +49,7 @@ public: bool depthRange(double* minimumDepth, double* maximumDepth) const; bool valueRange(double* minimumValue, double* maximumValue) const; - void setQwtTrack(RiuWellLogTrackPlot* plot); + void setQwtTrack(RiuWellLogTrack* plot); void detachQwtCurve(); bool isCurveVisible() const; @@ -81,7 +81,7 @@ protected: virtual void initAfterRead(); - QPointer m_ownerQwtTrack; + QPointer m_ownerQwtTrack; RiuWellLogPlotCurve* m_qwtPlotCurve; cvf::ref m_curveData; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.cpp index d7b21d941f..6cd3ed2441 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.cpp @@ -35,12 +35,12 @@ #define RI_LOGPLOTTRACK_MAXX_DEFAULT 100.0 -CAF_PDM_SOURCE_INIT(RimWellLogPlotTrack, "WellLogPlotTrack"); +CAF_PDM_SOURCE_INIT(RimWellLogTrack, "WellLogPlotTrack"); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotTrack::RimWellLogPlotTrack() +RimWellLogTrack::RimWellLogTrack() { CAF_PDM_InitObject("Track", ":/WellLogTrack16x16.png", "", ""); @@ -60,7 +60,7 @@ RimWellLogPlotTrack::RimWellLogPlotTrack() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotTrack::~RimWellLogPlotTrack() +RimWellLogTrack::~RimWellLogTrack() { delete m_wellLogTrackPlotWidget; } @@ -68,7 +68,7 @@ RimWellLogPlotTrack::~RimWellLogPlotTrack() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::setDescription(const QString& description) +void RimWellLogTrack::setDescription(const QString& description) { m_userName = description; } @@ -76,7 +76,7 @@ void RimWellLogPlotTrack::setDescription(const QString& description) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { if (changedField == &m_show) { @@ -104,7 +104,7 @@ void RimWellLogPlotTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedFie //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimWellLogPlotTrack::objectToggleField() +caf::PdmFieldHandle* RimWellLogTrack::objectToggleField() { return &m_show; } @@ -112,7 +112,7 @@ caf::PdmFieldHandle* RimWellLogPlotTrack::objectToggleField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimWellLogPlotTrack::userDescriptionField() +caf::PdmFieldHandle* RimWellLogTrack::userDescriptionField() { return &m_userName; } @@ -120,7 +120,7 @@ caf::PdmFieldHandle* RimWellLogPlotTrack::userDescriptionField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::addCurve(RimWellLogPlotCurve* curve) +void RimWellLogTrack::addCurve(RimWellLogPlotCurve* curve) { curves.push_back(curve); @@ -133,7 +133,7 @@ void RimWellLogPlotTrack::addCurve(RimWellLogPlotCurve* curve) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::insertCurve(RimWellLogPlotCurve* curve, size_t index) +void RimWellLogTrack::insertCurve(RimWellLogPlotCurve* curve, size_t index) { curves.insert(index, curve); // Todo: Mark curve data to use either TVD or MD @@ -147,7 +147,7 @@ void RimWellLogPlotTrack::insertCurve(RimWellLogPlotCurve* curve, size_t index) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::removeCurve(RimWellLogPlotCurve* curve) +void RimWellLogTrack::removeCurve(RimWellLogPlotCurve* curve) { size_t index = curves.index(curve); if ( index < curves.size()) @@ -161,7 +161,7 @@ void RimWellLogPlotTrack::removeCurve(RimWellLogPlotCurve* curve) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuWellLogTrackPlot* RimWellLogPlotTrack::viewer() +RiuWellLogTrack* RimWellLogTrack::viewer() { return m_wellLogTrackPlotWidget; } @@ -169,7 +169,7 @@ RiuWellLogTrackPlot* RimWellLogPlotTrack::viewer() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::availableDepthRange(double* minimumDepth, double* maximumDepth) +void RimWellLogTrack::availableDepthRange(double* minimumDepth, double* maximumDepth) { double minDepth = HUGE_VAL; double maxDepth = -HUGE_VAL; @@ -202,7 +202,7 @@ void RimWellLogPlotTrack::availableDepthRange(double* minimumDepth, double* maxi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::loadDataAndUpdate() +void RimWellLogTrack::loadDataAndUpdate() { CVF_ASSERT(m_wellLogTrackPlotWidget); @@ -222,11 +222,11 @@ void RimWellLogPlotTrack::loadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::recreateViewer() +void RimWellLogTrack::recreateViewer() { if (m_wellLogTrackPlotWidget == NULL) { - m_wellLogTrackPlotWidget = new RiuWellLogTrackPlot(this); + m_wellLogTrackPlotWidget = new RiuWellLogTrack(this); for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx) { @@ -238,7 +238,7 @@ void RimWellLogPlotTrack::recreateViewer() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::detachAllCurves() +void RimWellLogTrack::detachAllCurves() { for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx) { @@ -249,7 +249,7 @@ void RimWellLogPlotTrack::detachAllCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::zoomAllXAndZoomAllDepthOnOwnerPlot() +void RimWellLogTrack::zoomAllXAndZoomAllDepthOnOwnerPlot() { if (m_wellLogTrackPlotWidget) { @@ -269,7 +269,7 @@ void RimWellLogPlotTrack::zoomAllXAndZoomAllDepthOnOwnerPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::alignDepthZoomToPlotAndZoomAllX() +void RimWellLogTrack::alignDepthZoomToPlotAndZoomAllX() { if (m_wellLogTrackPlotWidget) { @@ -292,7 +292,7 @@ void RimWellLogPlotTrack::alignDepthZoomToPlotAndZoomAllX() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::zoomAllXAxis() +void RimWellLogTrack::zoomAllXAxis() { double minValue = HUGE_VAL; double maxValue = -HUGE_VAL; @@ -333,7 +333,7 @@ void RimWellLogPlotTrack::zoomAllXAxis() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotCurve* RimWellLogPlotTrack::curveDefinitionFromCurve(const QwtPlotCurve* curve) const +RimWellLogPlotCurve* RimWellLogTrack::curveDefinitionFromCurve(const QwtPlotCurve* curve) const { for (size_t idx = 0; idx < curves.size(); idx++) { @@ -349,7 +349,7 @@ RimWellLogPlotCurve* RimWellLogPlotTrack::curveDefinitionFromCurve(const QwtPlot //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +void RimWellLogTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) { uiOrdering.add(&m_userName); @@ -361,7 +361,7 @@ void RimWellLogPlotTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RimWellLogPlotTrack::curveIndex(RimWellLogPlotCurve* curve) +size_t RimWellLogTrack::curveIndex(RimWellLogPlotCurve* curve) { return curves.index(curve); } @@ -369,7 +369,7 @@ size_t RimWellLogPlotTrack::curveIndex(RimWellLogPlotCurve* curve) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimWellLogPlotTrack::isVisible() +bool RimWellLogTrack::isVisible() { return m_show; } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.h index d106e0b3c4..66f4119e44 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.h @@ -28,7 +28,7 @@ #include class RimWellLogPlotCurve; -class RiuWellLogTrackPlot; +class RiuWellLogTrack; class QwtPlotCurve; @@ -36,12 +36,12 @@ class QwtPlotCurve; /// /// //================================================================================================== -class RimWellLogPlotTrack : public caf::PdmObject +class RimWellLogTrack : public caf::PdmObject { CAF_PDM_HEADER_INIT; public: - RimWellLogPlotTrack(); - virtual ~RimWellLogPlotTrack(); + RimWellLogTrack(); + virtual ~RimWellLogTrack(); void setDescription(const QString& description); bool isVisible(); @@ -61,7 +61,7 @@ public: void alignDepthZoomToPlotAndZoomAllX(); void zoomAllXAxis(); - RiuWellLogTrackPlot* viewer(); + RiuWellLogTrack* viewer(); RimWellLogPlotCurve* curveDefinitionFromCurve(const QwtPlotCurve* curve) const; @@ -81,5 +81,5 @@ private: caf::PdmField m_visibleXRangeMin; caf::PdmField m_visibleXRangeMax; - QPointer m_wellLogTrackPlotWidget; + QPointer m_wellLogTrackPlotWidget; }; diff --git a/ApplicationCode/UserInterface/RiuDragDrop.cpp b/ApplicationCode/UserInterface/RiuDragDrop.cpp index f5aea1513b..070cce6287 100644 --- a/ApplicationCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationCode/UserInterface/RiuDragDrop.cpp @@ -150,7 +150,7 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const if (dynamic_cast(uiItem) || dynamic_cast(uiItem) || dynamic_cast(uiItem) || - dynamic_cast(uiItem)) + dynamic_cast(uiItem)) { // TODO: Remember to handle reservoir holding the main grid itemflags |= Qt::ItemIsDragEnabled; @@ -167,18 +167,18 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const { if (dynamic_cast(uiItem)) { - if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) + if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) { itemflags |= Qt::ItemIsDropEnabled; } } - else if (dynamic_cast(uiItem)) + else if (dynamic_cast(uiItem)) { if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) { itemflags |= Qt::ItemIsDropEnabled; } - else if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) + else if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) { itemflags |= Qt::ItemIsDropEnabled; } @@ -193,7 +193,7 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const } else if (m_proposedDropAction == Qt::CopyAction) { - if (dynamic_cast(uiItem)) + if (dynamic_cast(uiItem)) { if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) { @@ -248,7 +248,7 @@ bool RiuDragDrop::dropMimeData(const QMimeData *data, Qt::DropAction action, int return handleWellLogPlotCurveDrop(action, draggedObjects, wellLogPlotCurve); } - RimWellLogPlotTrack* wellLogPlotTrack; + RimWellLogTrack* wellLogPlotTrack; dropTarget->firstAnchestorOrThisOfType(wellLogPlotTrack); if (wellLogPlotTrack) { @@ -333,7 +333,7 @@ bool RiuDragDrop::handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectG //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlotTrack* trackTarget) +bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogTrack* trackTarget) { std::vector wellLogFileChannels = RiuTypedPdmObjects::typedObjectsFromGroup(draggedObjects); if (wellLogFileChannels.size() > 0) @@ -355,7 +355,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje } } - std::vector wellLogPlotTracks = RiuTypedPdmObjects::typedObjectsFromGroup(draggedObjects); + std::vector wellLogPlotTracks = RiuTypedPdmObjects::typedObjectsFromGroup(draggedObjects); if (wellLogPlotTracks.size() > 0) { if (action == Qt::MoveAction) @@ -380,7 +380,7 @@ bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObje { if (action == Qt::MoveAction) { - RimWellLogPlotTrack* wellLogPlotTrack; + RimWellLogTrack* wellLogPlotTrack; curveDropTarget->firstAnchestorOrThisOfType(wellLogPlotTrack); RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(wellLogPlotTrack, wellLogPlotCurves, curveDropTarget); @@ -396,7 +396,7 @@ bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObje //-------------------------------------------------------------------------------------------------- bool RiuDragDrop::handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlot* wellLogPlotTarget) { - std::vector wellLogPlotTracks = RiuTypedPdmObjects::typedObjectsFromGroup(draggedObjects); + std::vector wellLogPlotTracks = RiuTypedPdmObjects::typedObjectsFromGroup(draggedObjects); if (wellLogPlotTracks.size() > 0) { if (action == Qt::MoveAction) diff --git a/ApplicationCode/UserInterface/RiuDragDrop.h b/ApplicationCode/UserInterface/RiuDragDrop.h index 203251dc72..c9d6764e5c 100644 --- a/ApplicationCode/UserInterface/RiuDragDrop.h +++ b/ApplicationCode/UserInterface/RiuDragDrop.h @@ -32,7 +32,7 @@ namespace caf class RimIdenticalGridCaseGroup; class RimWellLogPlot; -class RimWellLogPlotTrack; +class RimWellLogTrack; class RimWellLogPlotCurve; //-------------------------------------------------------------------------------------------------- @@ -57,7 +57,7 @@ protected: private: void moveCasesToGridGroup(caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup); bool handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup); - bool handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotTrack* wellLogPlotTrack); + bool handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogTrack* wellLogPlotTrack); bool handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlot* wellLogPlot); bool handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotCurve* wellLogPlotCurve); diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp index 8fff877713..8bf2e048ef 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp @@ -73,7 +73,7 @@ RiuWellLogPlot::~RiuWellLogPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::addTrackPlot(RiuWellLogTrackPlot* trackPlot) +void RiuWellLogPlot::addTrackPlot(RiuWellLogTrack* trackPlot) { // Insert the plot to the left of the scroll bar insertTrackPlot(trackPlot, m_trackPlots.size()); @@ -82,7 +82,7 @@ void RiuWellLogPlot::addTrackPlot(RiuWellLogTrackPlot* trackPlot) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrackPlot* trackPlot, size_t index) +void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index) { trackPlot->setParent(this); @@ -113,7 +113,7 @@ void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrackPlot* trackPlot, size_t inde //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::removeTrackPlot(RiuWellLogTrackPlot* trackPlot) +void RiuWellLogPlot::removeTrackPlot(RiuWellLogTrack* trackPlot) { if (!trackPlot) return; diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.h b/ApplicationCode/UserInterface/RiuWellLogPlot.h index 749fb1b1c5..b88398c527 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.h +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.h @@ -24,7 +24,7 @@ #include "cafPdmPointer.h" class RimWellLogPlot; -class RiuWellLogTrackPlot; +class RiuWellLogTrack; class QHBoxLayout; class QScrollBar; @@ -46,9 +46,9 @@ public: RimWellLogPlot* ownerPlotDefinition(); - void addTrackPlot(RiuWellLogTrackPlot* trackPlot); - void insertTrackPlot(RiuWellLogTrackPlot* trackPlot, size_t index); - void removeTrackPlot(RiuWellLogTrackPlot* trackPlot); + void addTrackPlot(RiuWellLogTrack* trackPlot); + void insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index); + void removeTrackPlot(RiuWellLogTrack* trackPlot); void setDepthZoomAndReplot(double minDepth, double maxDepth); @@ -73,7 +73,7 @@ private: QHBoxLayout* m_layout; QScrollBar* m_scrollBar; QList m_legends; - QList m_trackPlots; + QList m_trackPlots; caf::PdmPointer m_plotDefinition; QTimer* m_scheduleUpdateChildrenLayoutTimer; }; diff --git a/ApplicationCode/UserInterface/RiuWellLogTrackPlot.cpp b/ApplicationCode/UserInterface/RiuWellLogTrackPlot.cpp index 170e74ce57..99ac238534 100644 --- a/ApplicationCode/UserInterface/RiuWellLogTrackPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogTrackPlot.cpp @@ -48,7 +48,7 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuWellLogTrackPlot::RiuWellLogTrackPlot(RimWellLogPlotTrack* plotTrackDefinition, QWidget* parent) +RiuWellLogTrack::RiuWellLogTrack(RimWellLogTrack* plotTrackDefinition, QWidget* parent) : QwtPlot(parent) { Q_ASSERT(plotTrackDefinition); @@ -64,7 +64,7 @@ RiuWellLogTrackPlot::RiuWellLogTrackPlot(RimWellLogPlotTrack* plotTrackDefinitio //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuWellLogTrackPlot::~RiuWellLogTrackPlot() +RiuWellLogTrack::~RiuWellLogTrack() { m_grid->detach(); delete m_grid; @@ -73,7 +73,7 @@ RiuWellLogTrackPlot::~RiuWellLogTrackPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogTrackPlot::setDefaults() +void RiuWellLogTrack::setDefaults() { QPalette newPalette(palette()); newPalette.setColor(QPalette::Background, Qt::white); @@ -130,7 +130,7 @@ void RiuWellLogTrackPlot::setDefaults() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogTrackPlot::setDepthZoom(double minDepth, double maxDepth) +void RiuWellLogTrack::setDepthZoom(double minDepth, double maxDepth) { // Note: Y-axis is inverted setAxisScale(QwtPlot::yLeft, maxDepth, minDepth); @@ -139,7 +139,7 @@ void RiuWellLogTrackPlot::setDepthZoom(double minDepth, double maxDepth) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogTrackPlot::setXRange(double min, double max) +void RiuWellLogTrack::setXRange(double min, double max) { setAxisScale(QwtPlot::xTop, min, max); setAxisScale(QwtPlot::xBottom, min, max); @@ -148,7 +148,7 @@ void RiuWellLogTrackPlot::setXRange(double min, double max) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogTrackPlot::setDepthTitle(const QString& title) +void RiuWellLogTrack::setDepthTitle(const QString& title) { QwtText axisTitleY = axisTitle(QwtPlot::yLeft); axisTitleY.setText(title); @@ -158,7 +158,7 @@ void RiuWellLogTrackPlot::setDepthTitle(const QString& title) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiuWellLogTrackPlot::eventFilter(QObject* watched, QEvent* event) +bool RiuWellLogTrack::eventFilter(QObject* watched, QEvent* event) { if (watched == canvas()) { @@ -218,7 +218,7 @@ bool RiuWellLogTrackPlot::eventFilter(QObject* watched, QEvent* event) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogTrackPlot::focusInEvent(QFocusEvent* event) +void RiuWellLogTrack::focusInEvent(QFocusEvent* event) { if (m_plotTrackDefinition) { @@ -230,7 +230,7 @@ void RiuWellLogTrackPlot::focusInEvent(QFocusEvent* event) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogTrackPlot::selectClosestCurve(const QPoint& pos) +void RiuWellLogTrack::selectClosestCurve(const QPoint& pos) { QwtPlotCurve* closestCurve = NULL; double distMin = DBL_MAX; @@ -264,7 +264,7 @@ void RiuWellLogTrackPlot::selectClosestCurve(const QPoint& pos) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QSize RiuWellLogTrackPlot::sizeHint() const +QSize RiuWellLogTrack::sizeHint() const { return QSize(0, 0); } @@ -272,7 +272,7 @@ QSize RiuWellLogTrackPlot::sizeHint() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QSize RiuWellLogTrackPlot::minimumSizeHint() const +QSize RiuWellLogTrack::minimumSizeHint() const { return QSize(0, 0); } @@ -280,7 +280,7 @@ QSize RiuWellLogTrackPlot::minimumSizeHint() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiuWellLogTrackPlot::isRimTrackVisible() +bool RiuWellLogTrack::isRimTrackVisible() { if (m_plotTrackDefinition) { diff --git a/ApplicationCode/UserInterface/RiuWellLogTrackPlot.h b/ApplicationCode/UserInterface/RiuWellLogTrackPlot.h index a32e35afa6..9378144688 100644 --- a/ApplicationCode/UserInterface/RiuWellLogTrackPlot.h +++ b/ApplicationCode/UserInterface/RiuWellLogTrackPlot.h @@ -22,7 +22,7 @@ #include "qwt_plot.h" #include "cafPdmPointer.h" -class RimWellLogPlotTrack; +class RimWellLogTrack; class QwtPlotGrid; class QwtLegend; @@ -33,13 +33,13 @@ class QEvent; // // //================================================================================================== -class RiuWellLogTrackPlot : public QwtPlot +class RiuWellLogTrack : public QwtPlot { Q_OBJECT public: - RiuWellLogTrackPlot(RimWellLogPlotTrack* plotTrackDefinition, QWidget* parent = NULL); - virtual ~RiuWellLogTrackPlot(); + RiuWellLogTrack(RimWellLogTrack* plotTrackDefinition, QWidget* parent = NULL); + virtual ~RiuWellLogTrack(); void setDepthZoom(double minDepth, double maxDepth); void setDepthTitle(const QString& title); @@ -59,7 +59,7 @@ private: void selectClosestCurve(const QPoint& pos); private: - caf::PdmPointer m_plotTrackDefinition; + caf::PdmPointer m_plotTrackDefinition; QwtPlotGrid* m_grid; }; From 10582750ab170fc87707e38d86ee7a0abe933fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 4 Nov 2015 16:14:42 +0100 Subject: [PATCH 05/27] Renamed files PlotTrack/TrackPlot -> Track --- ApplicationCode/CMakeLists.txt | 6 +++--- ApplicationCode/Commands/RicDeleteItemExec.cpp | 2 +- ApplicationCode/Commands/RicDeleteItemFeature.cpp | 2 +- .../Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp | 4 ++-- .../WellLogCommands/RicDeleteWellLogPlotTrackFeature.cpp | 2 +- .../WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp | 2 +- .../WellLogCommands/RicNewWellLogFileCurveFeature.cpp | 2 +- .../Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp | 2 +- .../WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp | 2 +- .../WellLogCommands/RicNewWellLogPlotTrackFeature.cpp | 2 +- .../WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp | 2 +- ApplicationCode/ProjectDataModel/CMakeLists_files.cmake | 4 ++-- ApplicationCode/ProjectDataModel/RimProject.cpp | 2 +- .../ProjectDataModel/RimWellLogExtractionCurve.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp | 4 ++-- .../{RimWellLogPlotTrack.cpp => RimWellLogTrack.cpp} | 4 ++-- .../{RimWellLogPlotTrack.h => RimWellLogTrack.h} | 0 ApplicationCode/UserInterface/RiuDragDrop.cpp | 4 ++-- ApplicationCode/UserInterface/RiuWellLogPlot.cpp | 4 ++-- .../{RiuWellLogTrackPlot.cpp => RiuWellLogTrack.cpp} | 4 ++-- .../{RiuWellLogTrackPlot.h => RiuWellLogTrack.h} | 0 23 files changed, 33 insertions(+), 33 deletions(-) rename ApplicationCode/ProjectDataModel/{RimWellLogPlotTrack.cpp => RimWellLogTrack.cpp} (99%) rename ApplicationCode/ProjectDataModel/{RimWellLogPlotTrack.h => RimWellLogTrack.h} (100%) rename ApplicationCode/UserInterface/{RiuWellLogTrackPlot.cpp => RiuWellLogTrack.cpp} (99%) rename ApplicationCode/UserInterface/{RiuWellLogTrackPlot.h => RiuWellLogTrack.h} (100%) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 46be7f3dce..e1a80d6e3f 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -86,8 +86,8 @@ set( USER_INTERFACE_FILES UserInterface/RiuWellLogPlot.h UserInterface/RiuWellLogPlotCurve.cpp UserInterface/RiuWellLogPlotCurve.h - UserInterface/RiuWellLogTrackPlot.cpp - UserInterface/RiuWellLogTrackPlot.h + UserInterface/RiuWellLogTrack.cpp + UserInterface/RiuWellLogTrack.h UserInterface/RiuProjectPropertyView.h UserInterface/RiuProjectPropertyView.cpp ) @@ -182,7 +182,7 @@ set ( QT_MOC_HEADERS UserInterface/RiuViewerCommands.h UserInterface/RiuTreeViewEventFilter.h UserInterface/RiuWellLogPlot.h - UserInterface/RiuWellLogTrackPlot.h + UserInterface/RiuWellLogTrack.h ) qt4_wrap_cpp( MOC_FILES_CPP ${QT_MOC_HEADERS} ) diff --git a/ApplicationCode/Commands/RicDeleteItemExec.cpp b/ApplicationCode/Commands/RicDeleteItemExec.cpp index 85ae9a4c80..6b335c716c 100644 --- a/ApplicationCode/Commands/RicDeleteItemExec.cpp +++ b/ApplicationCode/Commands/RicDeleteItemExec.cpp @@ -29,7 +29,7 @@ #include "RimViewLinkerCollection.h" #include "RimWellLogPlot.h" #include "RimWellLogPlotCollection.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellPathCollection.h" #include "cafNotificationCenter.h" diff --git a/ApplicationCode/Commands/RicDeleteItemFeature.cpp b/ApplicationCode/Commands/RicDeleteItemFeature.cpp index 6e9a9fe65b..387fc7be26 100644 --- a/ApplicationCode/Commands/RicDeleteItemFeature.cpp +++ b/ApplicationCode/Commands/RicDeleteItemFeature.cpp @@ -22,7 +22,7 @@ #include "RicDeleteItemExecData.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "cafCmdExecCommandManager.h" #include "cafCmdSelectionHelper.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp index 9d70eec660..2ae4694c36 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp @@ -25,7 +25,7 @@ #include "RimWellLogFile.h" #include "RimWellLogFileChannel.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogFileCurve.h" #include "RimProject.h" #include "RimMainPlotCollection.h" @@ -37,7 +37,7 @@ #include "RiaApplication.h" #include "RiuMainWindow.h" -#include "RiuWellLogTrackPlot.h" +#include "RiuWellLogTrack.h" #include "cafSelectionManager.h" #include "cafPdmUiTreeView.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicDeleteWellLogPlotTrackFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicDeleteWellLogPlotTrackFeature.cpp index 12bca0e1e7..b5a89d10ce 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicDeleteWellLogPlotTrackFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicDeleteWellLogPlotTrackFeature.cpp @@ -19,7 +19,7 @@ #include "RicDeleteWellLogPlotTrackFeature.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogPlot.h" #include "cafSelectionManager.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp index e4cbdfb00a..4241d7f526 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp @@ -22,7 +22,7 @@ #include "RicWellLogPlotCurveFeatureImpl.h" #include "RicNewWellLogPlotFeatureImpl.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogExtractionCurve.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp index c75ba4ab8f..96855dfde5 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp @@ -23,7 +23,7 @@ #include "RicNewWellLogPlotFeatureImpl.h" #include "RimWellLogFileCurve.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogFile.h" #include "RimWellLogFileChannel.h" #include "RimWellPath.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp index e456116c1e..4888ce4d2a 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp @@ -25,7 +25,7 @@ #include "RimProject.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogPlotCurve.h" #include "RiaApplication.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp index 7e7671ddf0..f993a6b376 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp @@ -23,7 +23,7 @@ #include "RimMainPlotCollection.h" #include "RimWellLogPlotCollection.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RiaApplication.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp index 446798da8b..56fc5b51a7 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp @@ -20,7 +20,7 @@ #include "RicNewWellLogPlotTrackFeature.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RiuMainWindow.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp index 24dad36f64..db45f26819 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp @@ -20,7 +20,7 @@ #include "RicWellLogPlotTrackFeatureImpl.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogPlotCurve.h" #include "RiuMainWindow.h" diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index 1e61fa84d9..b7cf593110 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -63,7 +63,7 @@ ${CEE_CURRENT_LIST_DIR}RimViewController.h ${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.h ${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.h ${CEE_CURRENT_LIST_DIR}RimWellLogPlot.h -${CEE_CURRENT_LIST_DIR}RimWellLogPlotTrack.h +${CEE_CURRENT_LIST_DIR}RimWellLogTrack.h ${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.h ${CEE_CURRENT_LIST_DIR}RimViewLinker.h ${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.h @@ -132,7 +132,7 @@ ${CEE_CURRENT_LIST_DIR}RimViewController.cpp ${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.cpp ${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.cpp ${CEE_CURRENT_LIST_DIR}RimWellLogPlot.cpp -${CEE_CURRENT_LIST_DIR}RimWellLogPlotTrack.cpp +${CEE_CURRENT_LIST_DIR}RimWellLogTrack.cpp ${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.cpp ${CEE_CURRENT_LIST_DIR}RimViewLinker.cpp ${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.cpp diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 045bb8adff..802a8e765f 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -625,7 +625,7 @@ void RimProject::computeUtmAreaOfInterest() #include "RimEclipseCellColors.h" #include "RimEclipseFaultColors.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogPlotCurve.h" #include "RimWellLogFileChannel.h" #include diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 647da20dec..c742c926b0 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -38,7 +38,7 @@ #include "RimWellLogPlot.h" #include "RimWellLogPlotCollection.h" #include "RimWellLogPlotCurve.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" #include "RimEclipseView.h" @@ -47,7 +47,7 @@ #include "RimGeoMechCellColors.h" #include "RiuWellLogPlotCurve.h" -#include "RiuWellLogTrackPlot.h" +#include "RiuWellLogTrack.h" #include "cafPdmUiTreeOrdering.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index b648aa9ba5..b42536c63a 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -25,10 +25,10 @@ #include "RimWellPath.h" #include "RimWellLogFileChannel.h" #include "RimWellLogFile.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogPlot.h" -#include "RiuWellLogTrackPlot.h" +#include "RiuWellLogTrack.h" #include "RiuWellLogPlotCurve.h" #include "RiaApplication.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index be6dbb6727..b2627f34b4 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -19,10 +19,10 @@ #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RiuWellLogPlot.h" -#include "RiuWellLogTrackPlot.h" +#include "RiuWellLogTrack.h" #include "RiuMainWindow.h" #include "cafPdmUiTreeView.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp index 203059d253..1e5998da57 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp @@ -21,10 +21,10 @@ #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RiuWellLogPlotCurve.h" -#include "RiuWellLogTrackPlot.h" +#include "RiuWellLogTrack.h" #include "cvfAssert.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp similarity index 99% rename from ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.cpp rename to ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 6cd3ed2441..b55600b5b4 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -17,12 +17,12 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogPlot.h" #include "RimWellLogPlotCurve.h" -#include "RiuWellLogTrackPlot.h" +#include "RiuWellLogTrack.h" #include "RiuWellLogPlot.h" #include "RiuMainWindow.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h similarity index 100% rename from ApplicationCode/ProjectDataModel/RimWellLogPlotTrack.h rename to ApplicationCode/ProjectDataModel/RimWellLogTrack.h diff --git a/ApplicationCode/UserInterface/RiuDragDrop.cpp b/ApplicationCode/UserInterface/RiuDragDrop.cpp index 070cce6287..e4598bc0fb 100644 --- a/ApplicationCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationCode/UserInterface/RiuDragDrop.cpp @@ -30,11 +30,11 @@ #include "RimIdenticalGridCaseGroup.h" #include "RimMimeData.h" #include "RimWellLogFileChannel.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogPlotCurve.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RiuMainWindow.h" #include "cafPdmUiTreeView.h" diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp index 8bf2e048ef..d3e88d8720 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp @@ -19,11 +19,11 @@ #include "RiuWellLogPlot.h" -#include "RiuWellLogTrackPlot.h" +#include "RiuWellLogTrack.h" #include "RiuMainWindow.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "cafPdmUiTreeView.h" #include "cvfAssert.h" diff --git a/ApplicationCode/UserInterface/RiuWellLogTrackPlot.cpp b/ApplicationCode/UserInterface/RiuWellLogTrack.cpp similarity index 99% rename from ApplicationCode/UserInterface/RiuWellLogTrackPlot.cpp rename to ApplicationCode/UserInterface/RiuWellLogTrack.cpp index 99ac238534..32b276ec27 100644 --- a/ApplicationCode/UserInterface/RiuWellLogTrackPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogTrack.cpp @@ -17,10 +17,10 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RiuWellLogTrackPlot.h" +#include "RiuWellLogTrack.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotTrack.h" +#include "RimWellLogTrack.h" #include "RimWellLogPlotCurve.h" #include "RiuMainWindow.h" diff --git a/ApplicationCode/UserInterface/RiuWellLogTrackPlot.h b/ApplicationCode/UserInterface/RiuWellLogTrack.h similarity index 100% rename from ApplicationCode/UserInterface/RiuWellLogTrackPlot.h rename to ApplicationCode/UserInterface/RiuWellLogTrack.h From 7b7ecf2f26fc3f7108080047362e4b5c634d51dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 4 Nov 2015 16:19:38 +0100 Subject: [PATCH 06/27] Renamed PlotCurve -> Curve --- .../Commands/RicExportToLasFileFeature.cpp | 6 +-- .../Commands/RicExportToLasFileFeature.h | 4 +- .../RicWellLogPlotTrackFeatureImpl.cpp | 6 +-- .../RicWellLogPlotTrackFeatureImpl.h | 6 +-- .../RimEclipseResultDefinition.cpp | 4 +- .../RimGeoMechResultDefinition.cpp | 2 +- .../ProjectDataModel/RimProject.cpp | 2 +- .../RimWellLogExtractionCurve.cpp | 6 +-- .../RimWellLogExtractionCurve.h | 2 +- .../ProjectDataModel/RimWellLogFileCurve.cpp | 4 +- .../ProjectDataModel/RimWellLogFileCurve.h | 2 +- .../ProjectDataModel/RimWellLogPlotCurve.cpp | 44 +++++++++---------- .../ProjectDataModel/RimWellLogPlotCurve.h | 10 ++--- .../ProjectDataModel/RimWellLogTrack.cpp | 10 ++--- .../ProjectDataModel/RimWellLogTrack.h | 14 +++--- .../ReservoirDataModel/RigWellLogFile.cpp | 2 +- .../ReservoirDataModel/RigWellLogFile.h | 4 +- ApplicationCode/UserInterface/RiuDragDrop.cpp | 18 ++++---- ApplicationCode/UserInterface/RiuDragDrop.h | 4 +- .../UserInterface/RiuWellLogPlotCurve.cpp | 8 ++-- .../UserInterface/RiuWellLogPlotCurve.h | 6 +-- .../UserInterface/RiuWellLogTrack.cpp | 2 +- 22 files changed, 83 insertions(+), 83 deletions(-) diff --git a/ApplicationCode/Commands/RicExportToLasFileFeature.cpp b/ApplicationCode/Commands/RicExportToLasFileFeature.cpp index 17c45bf7c0..ed4c9d0135 100644 --- a/ApplicationCode/Commands/RicExportToLasFileFeature.cpp +++ b/ApplicationCode/Commands/RicExportToLasFileFeature.cpp @@ -46,7 +46,7 @@ bool RicExportToLasFileFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicExportToLasFileFeature::onActionTriggered(bool isChecked) { - RimWellLogPlotCurve* curve = selectedWellLogPlotCurve(); + RimWellLogCurve* curve = selectedWellLogPlotCurve(); if (curve) { QString defaultDir = RiaApplication::instance()->defaultFileDialogDirectory("WELL_LOGS_DIR"); @@ -77,9 +77,9 @@ void RicExportToLasFileFeature::setupActionLook(QAction* actionToSetup) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotCurve* RicExportToLasFileFeature::selectedWellLogPlotCurve() const +RimWellLogCurve* RicExportToLasFileFeature::selectedWellLogPlotCurve() const { - std::vector selection; + std::vector selection; caf::SelectionManager::instance()->objectsByType(&selection); if (selection.size() > 0) diff --git a/ApplicationCode/Commands/RicExportToLasFileFeature.h b/ApplicationCode/Commands/RicExportToLasFileFeature.h index 527fb64169..78ab3603b9 100644 --- a/ApplicationCode/Commands/RicExportToLasFileFeature.h +++ b/ApplicationCode/Commands/RicExportToLasFileFeature.h @@ -23,7 +23,7 @@ #include -class RimWellLogPlotCurve; +class RimWellLogCurve; //================================================================================================== /// @@ -39,7 +39,7 @@ protected: virtual void setupActionLook( QAction* actionToSetup ); private: - RimWellLogPlotCurve* selectedWellLogPlotCurve() const; + RimWellLogCurve* selectedWellLogPlotCurve() const; }; diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp index db45f26819..e23bc60938 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp @@ -31,8 +31,8 @@ /// //-------------------------------------------------------------------------------------------------- void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogTrack* destTrack, - const std::vector& curves, - RimWellLogPlotCurve* curveToInsertAfter) + const std::vector& curves, + RimWellLogCurve* curveToInsertAfter) { CVF_ASSERT(destTrack ); @@ -41,7 +41,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogTrac for (size_t cIdx = 0; cIdx < curves.size(); cIdx++) { - RimWellLogPlotCurve* curve = curves[cIdx]; + RimWellLogCurve* curve = curves[cIdx]; RimWellLogTrack* wellLogPlotTrack; curve->firstAnchestorOrThisOfType(wellLogPlotTrack); diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.h b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.h index e9eee75395..6eb2135d31 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.h +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.h @@ -23,7 +23,7 @@ class RimWellLogPlot; class RimWellLogTrack; -class RimWellLogPlotCurve; +class RimWellLogCurve; //================================================================================================== /// @@ -33,8 +33,8 @@ class RicWellLogPlotTrackFeatureImpl public: static void moveCurvesToWellLogPlotTrack(RimWellLogTrack* dstTrack, - const std::vector& curves, - RimWellLogPlotCurve* insertAfterCurve); + const std::vector& curves, + RimWellLogCurve* insertAfterCurve); static void moveTracksToWellLogPlot(RimWellLogPlot* wellLogPlot, const std::vector& tracks, RimWellLogTrack* trackToInsertAfter); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 8ed6e0aa43..f6142e0aa3 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -128,7 +128,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha RimEclipsePropertyFilter* propFilter = dynamic_cast(this->parentField()->ownerObject()); RimView* view = NULL; this->firstAnchestorOrThisOfType(view); - RimWellLogPlotCurve* curve = NULL; + RimWellLogCurve* curve = NULL; this->firstAnchestorOrThisOfType(curve); if (&m_resultVariableUiField == changedField) @@ -194,7 +194,7 @@ QList RimEclipseResultDefinition::calculateValueOptions( { QList optionItems = calculateValueOptionsForSpecifiedDerivedListPosition(false, fieldNeedingOptions, useOptionsOnly); - RimWellLogPlotCurve* curve = NULL; + RimWellLogCurve* curve = NULL; this->firstAnchestorOrThisOfType(curve); RimEclipsePropertyFilter* propFilter = dynamic_cast(this->parentField()->ownerObject()); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp index 1ea9ba925d..4f65e507a0 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp @@ -150,7 +150,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha RimGeoMechPropertyFilter* propFilter = dynamic_cast(this->parentField()->ownerObject()); RimView* view = NULL; this->firstAnchestorOrThisOfType(view); - RimWellLogPlotCurve* curve = NULL; + RimWellLogCurve* curve = NULL; this->firstAnchestorOrThisOfType(curve); diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 802a8e765f..047e93f5f6 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -820,7 +820,7 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu) commandIds << "RicNewWellLogFileCurveFeature"; commandIds << "RicDeleteWellLogPlotTrackFeature"; } - else if (dynamic_cast(uiItem)) + else if (dynamic_cast(uiItem)) { commandIds << "RicExportToLasFileFeature"; commandIds << "RicDeleteItemFeature"; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index c742c926b0..77ebfa5041 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -145,7 +145,7 @@ void RimWellLogExtractionCurve::setPropertiesFromView(RimView* view) //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { - RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue); + RimWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue); if (changedField == &m_case) { @@ -177,7 +177,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::updatePlotData() { - RimWellLogPlotCurve::updatePlotConfiguration(); + RimWellLogCurve::updatePlotConfiguration(); if (isCurveVisible()) { @@ -378,7 +378,7 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::initAfterRead() { - RimWellLogPlotCurve::initAfterRead(); + RimWellLogCurve::initAfterRead(); RimGeoMechCase* geomCase = dynamic_cast(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast(m_case.value()); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h index ae9774523a..0c5bcdad60 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h @@ -34,7 +34,7 @@ class RimView; /// /// //================================================================================================== -class RimWellLogExtractionCurve : public RimWellLogPlotCurve +class RimWellLogExtractionCurve : public RimWellLogCurve { CAF_PDM_HEADER_INIT; public: diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index b42536c63a..b925080d82 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -70,7 +70,7 @@ RimWellLogFileCurve::~RimWellLogFileCurve() //-------------------------------------------------------------------------------------------------- void RimWellLogFileCurve::updatePlotData() { - RimWellLogPlotCurve::updatePlotConfiguration(); + RimWellLogCurve::updatePlotConfiguration(); if (isCurveVisible()) { @@ -143,7 +143,7 @@ void RimWellLogFileCurve::setWellLogChannelName(const QString& name) //-------------------------------------------------------------------------------------------------- void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { - RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue); + RimWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue); if (changedField == &m_wellPath) { diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h index 9b493a8a40..5c89e5778d 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h @@ -33,7 +33,7 @@ class RimWellLogFileChannel; /// /// //================================================================================================== -class RimWellLogFileCurve : public RimWellLogPlotCurve +class RimWellLogFileCurve : public RimWellLogCurve { CAF_PDM_HEADER_INIT; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp index 1e5998da57..a95175eb8c 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp @@ -29,12 +29,12 @@ #include "cvfAssert.h" // NB! Special macro for pure virtual class -CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimWellLogPlotCurve, "WellLogPlotCurve"); +CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimWellLogCurve, "WellLogPlotCurve"); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotCurve::RimWellLogPlotCurve() +RimWellLogCurve::RimWellLogCurve() { CAF_PDM_InitObject("Curve", ":/WellLogCurve16x16.png", "", ""); @@ -49,7 +49,7 @@ RimWellLogPlotCurve::RimWellLogPlotCurve() CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", ""); - m_qwtPlotCurve = new RiuWellLogPlotCurve; + m_qwtPlotCurve = new RiuWellLogCurve; m_qwtPlotCurve->setXAxis(QwtPlot::xTop); m_qwtPlotCurve->setYAxis(QwtPlot::yLeft); @@ -59,7 +59,7 @@ RimWellLogPlotCurve::RimWellLogPlotCurve() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotCurve::~RimWellLogPlotCurve() +RimWellLogCurve::~RimWellLogCurve() { m_qwtPlotCurve->detach(); delete m_qwtPlotCurve; @@ -73,7 +73,7 @@ RimWellLogPlotCurve::~RimWellLogPlotCurve() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +void RimWellLogCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { if (changedField == &m_showCurve) { @@ -106,7 +106,7 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimWellLogPlotCurve::objectToggleField() +caf::PdmFieldHandle* RimWellLogCurve::objectToggleField() { return &m_showCurve; } @@ -114,7 +114,7 @@ caf::PdmFieldHandle* RimWellLogPlotCurve::objectToggleField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::updateCurveVisibility() +void RimWellLogCurve::updateCurveVisibility() { if (m_showCurve() && m_ownerQwtTrack) { @@ -144,7 +144,7 @@ void RimWellLogPlotCurve::updateCurveVisibility() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::updatePlotConfiguration() +void RimWellLogCurve::updatePlotConfiguration() { this->updateCurveVisibility(); this->updateCurveName(); @@ -157,7 +157,7 @@ void RimWellLogPlotCurve::updatePlotConfiguration() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::setQwtTrack(RiuWellLogTrack* plot) +void RimWellLogCurve::setQwtTrack(RiuWellLogTrack* plot) { m_ownerQwtTrack = plot; if (m_showCurve) @@ -170,7 +170,7 @@ void RimWellLogPlotCurve::setQwtTrack(RiuWellLogTrack* plot) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimWellLogPlotCurve::userDescriptionField() +caf::PdmFieldHandle* RimWellLogCurve::userDescriptionField() { return &m_curveName; } @@ -178,7 +178,7 @@ caf::PdmFieldHandle* RimWellLogPlotCurve::userDescriptionField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimWellLogPlotCurve::depthRange(double* minimumDepth, double* maximumDepth) const +bool RimWellLogCurve::depthRange(double* minimumDepth, double* maximumDepth) const { CVF_ASSERT(minimumDepth && maximumDepth); CVF_ASSERT(m_qwtPlotCurve); @@ -197,7 +197,7 @@ bool RimWellLogPlotCurve::depthRange(double* minimumDepth, double* maximumDepth) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimWellLogPlotCurve::valueRange(double* minimumValue, double* maximumValue) const +bool RimWellLogCurve::valueRange(double* minimumValue, double* maximumValue) const { CVF_ASSERT(minimumValue && maximumValue); CVF_ASSERT(m_qwtPlotCurve); @@ -216,7 +216,7 @@ bool RimWellLogPlotCurve::valueRange(double* minimumValue, double* maximumValue) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::setColor(const cvf::Color3f& color) +void RimWellLogCurve::setColor(const cvf::Color3f& color) { m_curveColor = color; } @@ -224,7 +224,7 @@ void RimWellLogPlotCurve::setColor(const cvf::Color3f& color) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::detachQwtCurve() +void RimWellLogCurve::detachQwtCurve() { m_qwtPlotCurve->detach(); } @@ -232,7 +232,7 @@ void RimWellLogPlotCurve::detachQwtCurve() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const +QwtPlotCurve* RimWellLogCurve::plotCurve() const { return m_qwtPlotCurve; } @@ -240,7 +240,7 @@ QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::updatePlotTitle() +void RimWellLogCurve::updatePlotTitle() { m_qwtPlotCurve->setTitle(m_curveName); } @@ -248,7 +248,7 @@ void RimWellLogPlotCurve::updatePlotTitle() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimWellLogPlotCurve::isCurveVisible() const +bool RimWellLogCurve::isCurveVisible() const { return m_showCurve; } @@ -256,7 +256,7 @@ bool RimWellLogPlotCurve::isCurveVisible() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::initAfterRead() +void RimWellLogCurve::initAfterRead() { updateOptionSensitivity(); } @@ -264,7 +264,7 @@ void RimWellLogPlotCurve::initAfterRead() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::zoomAllOwnerTrackAndPlot() +void RimWellLogCurve::zoomAllOwnerTrackAndPlot() { RimWellLogPlot* wellLogPlot; firstAnchestorOrThisOfType(wellLogPlot); @@ -285,7 +285,7 @@ void RimWellLogPlotCurve::zoomAllOwnerTrackAndPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::updateCurveName() +void RimWellLogCurve::updateCurveName() { if (m_autoName) { @@ -300,7 +300,7 @@ void RimWellLogPlotCurve::updateCurveName() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCurve::updateOptionSensitivity() +void RimWellLogCurve::updateOptionSensitivity() { m_curveName.uiCapability()->setUiReadOnly(m_autoName); } @@ -308,7 +308,7 @@ void RimWellLogPlotCurve::updateOptionSensitivity() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const RigWellLogCurveData* RimWellLogPlotCurve::curveData() const +const RigWellLogCurveData* RimWellLogCurve::curveData() const { return m_curveData.p(); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h index da8b95d383..cb4780bc34 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h @@ -29,7 +29,7 @@ class RigWellLogCurveData; class RiuWellLogTrack; -class RiuWellLogPlotCurve; +class RiuWellLogCurve; class QwtPlotCurve; class QString; @@ -37,12 +37,12 @@ class QString; /// /// //================================================================================================== -class RimWellLogPlotCurve : public caf::PdmObject +class RimWellLogCurve : public caf::PdmObject { CAF_PDM_HEADER_INIT; public: - RimWellLogPlotCurve(); - virtual ~RimWellLogPlotCurve(); + RimWellLogCurve(); + virtual ~RimWellLogCurve(); void setColor(const cvf::Color3f& color); @@ -82,7 +82,7 @@ protected: QPointer m_ownerQwtTrack; - RiuWellLogPlotCurve* m_qwtPlotCurve; + RiuWellLogCurve* m_qwtPlotCurve; cvf::ref m_curveData; caf::PdmField m_showCurve; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index b55600b5b4..d92c049e2f 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -120,7 +120,7 @@ caf::PdmFieldHandle* RimWellLogTrack::userDescriptionField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::addCurve(RimWellLogPlotCurve* curve) +void RimWellLogTrack::addCurve(RimWellLogCurve* curve) { curves.push_back(curve); @@ -133,7 +133,7 @@ void RimWellLogTrack::addCurve(RimWellLogPlotCurve* curve) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::insertCurve(RimWellLogPlotCurve* curve, size_t index) +void RimWellLogTrack::insertCurve(RimWellLogCurve* curve, size_t index) { curves.insert(index, curve); // Todo: Mark curve data to use either TVD or MD @@ -147,7 +147,7 @@ void RimWellLogTrack::insertCurve(RimWellLogPlotCurve* curve, size_t index) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::removeCurve(RimWellLogPlotCurve* curve) +void RimWellLogTrack::removeCurve(RimWellLogCurve* curve) { size_t index = curves.index(curve); if ( index < curves.size()) @@ -333,7 +333,7 @@ void RimWellLogTrack::zoomAllXAxis() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotCurve* RimWellLogTrack::curveDefinitionFromCurve(const QwtPlotCurve* curve) const +RimWellLogCurve* RimWellLogTrack::curveDefinitionFromCurve(const QwtPlotCurve* curve) const { for (size_t idx = 0; idx < curves.size(); idx++) { @@ -361,7 +361,7 @@ void RimWellLogTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RimWellLogTrack::curveIndex(RimWellLogPlotCurve* curve) +size_t RimWellLogTrack::curveIndex(RimWellLogCurve* curve) { return curves.index(curve); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h index 66f4119e44..ca49f14f51 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h @@ -27,7 +27,7 @@ #include -class RimWellLogPlotCurve; +class RimWellLogCurve; class RiuWellLogTrack; class QwtPlotCurve; @@ -45,10 +45,10 @@ public: void setDescription(const QString& description); bool isVisible(); - void addCurve(RimWellLogPlotCurve* curve); - void insertCurve(RimWellLogPlotCurve* curve, size_t index); - void removeCurve(RimWellLogPlotCurve* curve); - size_t curveIndex(RimWellLogPlotCurve* curve); + void addCurve(RimWellLogCurve* curve); + void insertCurve(RimWellLogCurve* curve, size_t index); + void removeCurve(RimWellLogCurve* curve); + size_t curveIndex(RimWellLogCurve* curve); size_t curveCount() { return curves.size(); } void recreateViewer(); @@ -63,7 +63,7 @@ public: RiuWellLogTrack* viewer(); - RimWellLogPlotCurve* curveDefinitionFromCurve(const QwtPlotCurve* curve) const; + RimWellLogCurve* curveDefinitionFromCurve(const QwtPlotCurve* curve) const; protected: @@ -77,7 +77,7 @@ private: private: caf::PdmField m_show; caf::PdmField m_userName; - caf::PdmChildArrayField curves; + caf::PdmChildArrayField curves; caf::PdmField m_visibleXRangeMin; caf::PdmField m_visibleXRangeMax; diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp index 1e4dc6b751..c4c2b2b906 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp @@ -245,7 +245,7 @@ QString RigWellLogFile::wellLogChannelUnit(const QString& wellLogChannelName) co //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RigWellLogFile::exportToLasFile(const RimWellLogPlotCurve* curve, const QString& fileName) +bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString& fileName) { CVF_ASSERT(curve); diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.h b/ApplicationCode/ReservoirDataModel/RigWellLogFile.h index 348e1da03f..6db1694344 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.h @@ -30,7 +30,7 @@ namespace NRLib class Well; } -class RimWellLogPlotCurve; +class RimWellLogCurve; //================================================================================================== /// @@ -52,7 +52,7 @@ public: QString depthUnit() const; QString wellLogChannelUnit(const QString& wellLogChannelName) const; - static bool exportToLasFile(const RimWellLogPlotCurve* curve, const QString& fileName); + static bool exportToLasFile(const RimWellLogCurve* curve, const QString& fileName); private: void close(); diff --git a/ApplicationCode/UserInterface/RiuDragDrop.cpp b/ApplicationCode/UserInterface/RiuDragDrop.cpp index e4598bc0fb..b90ae79f5c 100644 --- a/ApplicationCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationCode/UserInterface/RiuDragDrop.cpp @@ -148,7 +148,7 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const caf::PdmUiItem* uiItem = uiTreeView->uiItemFromModelIndex(index); if (dynamic_cast(uiItem) || - dynamic_cast(uiItem) || + dynamic_cast(uiItem) || dynamic_cast(uiItem) || dynamic_cast(uiItem)) { @@ -174,7 +174,7 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const } else if (dynamic_cast(uiItem)) { - if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) + if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) { itemflags |= Qt::ItemIsDropEnabled; } @@ -183,9 +183,9 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const itemflags |= Qt::ItemIsDropEnabled; } } - else if (dynamic_cast(uiItem)) + else if (dynamic_cast(uiItem)) { - if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) + if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) { itemflags |= Qt::ItemIsDropEnabled; } @@ -200,7 +200,7 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const itemflags |= Qt::ItemIsDropEnabled; } } - else if (dynamic_cast(uiItem)) + else if (dynamic_cast(uiItem)) { if (RiuTypedPdmObjects::containsTypedObjects(m_dragItems)) { @@ -241,7 +241,7 @@ bool RiuDragDrop::dropMimeData(const QMimeData *data, Qt::DropAction action, int return handleGridCaseGroupDrop(action, draggedObjects, gridCaseGroup); } - RimWellLogPlotCurve* wellLogPlotCurve; + RimWellLogCurve* wellLogPlotCurve; dropTarget->firstAnchestorOrThisOfType(wellLogPlotCurve); if (wellLogPlotCurve) { @@ -345,7 +345,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje } } - std::vector wellLogPlotCurves = RiuTypedPdmObjects::typedObjectsFromGroup(draggedObjects); + std::vector wellLogPlotCurves = RiuTypedPdmObjects::typedObjectsFromGroup(draggedObjects); if (wellLogPlotCurves.size() > 0) { if (action == Qt::MoveAction) @@ -373,9 +373,9 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlotCurve* curveDropTarget) +bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogCurve* curveDropTarget) { - std::vector wellLogPlotCurves = RiuTypedPdmObjects::typedObjectsFromGroup(draggedObjects); + std::vector wellLogPlotCurves = RiuTypedPdmObjects::typedObjectsFromGroup(draggedObjects); if (wellLogPlotCurves.size() > 0) { if (action == Qt::MoveAction) diff --git a/ApplicationCode/UserInterface/RiuDragDrop.h b/ApplicationCode/UserInterface/RiuDragDrop.h index c9d6764e5c..d5a75c28dc 100644 --- a/ApplicationCode/UserInterface/RiuDragDrop.h +++ b/ApplicationCode/UserInterface/RiuDragDrop.h @@ -33,7 +33,7 @@ namespace caf class RimIdenticalGridCaseGroup; class RimWellLogPlot; class RimWellLogTrack; -class RimWellLogPlotCurve; +class RimWellLogCurve; //-------------------------------------------------------------------------------------------------- /// @@ -59,7 +59,7 @@ private: bool handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup); bool handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogTrack* wellLogPlotTrack); bool handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlot* wellLogPlot); - bool handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotCurve* wellLogPlotCurve); + bool handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogCurve* wellLogPlotCurve); static void objectGroupFromModelIndexes(caf::PdmObjectGroup* objectGroup, const QModelIndexList &indexes); static std::vector > objectHandlesFromSelection(); diff --git a/ApplicationCode/UserInterface/RiuWellLogPlotCurve.cpp b/ApplicationCode/UserInterface/RiuWellLogPlotCurve.cpp index 5c2a2e116c..3afeb1c20b 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlotCurve.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogPlotCurve.cpp @@ -25,21 +25,21 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuWellLogPlotCurve::RiuWellLogPlotCurve() +RiuWellLogCurve::RiuWellLogCurve() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuWellLogPlotCurve::~RiuWellLogPlotCurve() +RiuWellLogCurve::~RiuWellLogCurve() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlotCurve::drawCurve(QPainter* p, int style, +void RiuWellLogCurve::drawCurve(QPainter* p, int style, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to) const { @@ -57,7 +57,7 @@ void RiuWellLogPlotCurve::drawCurve(QPainter* p, int style, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlotCurve::setCurveData(const RigWellLogCurveData* curveData) +void RiuWellLogCurve::setCurveData(const RigWellLogCurveData* curveData) { CVF_ASSERT(curveData); diff --git a/ApplicationCode/UserInterface/RiuWellLogPlotCurve.h b/ApplicationCode/UserInterface/RiuWellLogPlotCurve.h index d7b5b25dd6..e08122864f 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlotCurve.h +++ b/ApplicationCode/UserInterface/RiuWellLogPlotCurve.h @@ -29,12 +29,12 @@ class RigWellLogCurveData; /// /// //================================================================================================== -class RiuWellLogPlotCurve : public QwtPlotCurve +class RiuWellLogCurve : public QwtPlotCurve { public: - RiuWellLogPlotCurve(); - virtual ~RiuWellLogPlotCurve(); + RiuWellLogCurve(); + virtual ~RiuWellLogCurve(); void setCurveData(const RigWellLogCurveData* curveData); diff --git a/ApplicationCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationCode/UserInterface/RiuWellLogTrack.cpp index 32b276ec27..4863c33dbe 100644 --- a/ApplicationCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogTrack.cpp @@ -253,7 +253,7 @@ void RiuWellLogTrack::selectClosestCurve(const QPoint& pos) if (closestCurve && distMin < 20) { - RimWellLogPlotCurve* selectedCurve = m_plotTrackDefinition->curveDefinitionFromCurve(closestCurve); + RimWellLogCurve* selectedCurve = m_plotTrackDefinition->curveDefinitionFromCurve(closestCurve); if (selectedCurve) { RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(selectedCurve); From 4388f391753f771709a025a02c8eda0da02325b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 4 Nov 2015 16:22:53 +0100 Subject: [PATCH 07/27] Renamed files PlotCurve->Curve --- ApplicationCode/CMakeLists.txt | 4 ++-- ApplicationCode/Commands/RicExportToLasFileFeature.cpp | 2 +- .../Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp | 2 +- .../WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp | 2 +- ApplicationCode/ProjectDataModel/CMakeLists_files.cmake | 4 ++-- .../ProjectDataModel/RimEclipseResultDefinition.cpp | 2 +- .../ProjectDataModel/RimGeoMechResultDefinition.cpp | 2 +- ApplicationCode/ProjectDataModel/RimProject.cpp | 2 +- .../{RimWellLogPlotCurve.cpp => RimWellLogCurve.cpp} | 4 ++-- .../{RimWellLogPlotCurve.h => RimWellLogCurve.h} | 0 .../ProjectDataModel/RimWellLogExtractionCurve.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h | 2 +- ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp | 2 +- ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h | 2 +- ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp | 2 +- ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp | 2 +- ApplicationCode/UserInterface/RiuDragDrop.cpp | 2 +- .../{RiuWellLogPlotCurve.cpp => RiuWellLogCurve.cpp} | 2 +- .../{RiuWellLogPlotCurve.h => RiuWellLogCurve.h} | 0 ApplicationCode/UserInterface/RiuWellLogTrack.cpp | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) rename ApplicationCode/ProjectDataModel/{RimWellLogPlotCurve.cpp => RimWellLogCurve.cpp} (99%) rename ApplicationCode/ProjectDataModel/{RimWellLogPlotCurve.h => RimWellLogCurve.h} (100%) rename ApplicationCode/UserInterface/{RiuWellLogPlotCurve.cpp => RiuWellLogCurve.cpp} (98%) rename ApplicationCode/UserInterface/{RiuWellLogPlotCurve.h => RiuWellLogCurve.h} (100%) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index e1a80d6e3f..0ec9defc82 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -84,8 +84,8 @@ set( USER_INTERFACE_FILES UserInterface/RiuTreeViewEventFilter.h UserInterface/RiuWellLogPlot.cpp UserInterface/RiuWellLogPlot.h - UserInterface/RiuWellLogPlotCurve.cpp - UserInterface/RiuWellLogPlotCurve.h + UserInterface/RiuWellLogCurve.cpp + UserInterface/RiuWellLogCurve.h UserInterface/RiuWellLogTrack.cpp UserInterface/RiuWellLogTrack.h UserInterface/RiuProjectPropertyView.h diff --git a/ApplicationCode/Commands/RicExportToLasFileFeature.cpp b/ApplicationCode/Commands/RicExportToLasFileFeature.cpp index ed4c9d0135..51c635f6b8 100644 --- a/ApplicationCode/Commands/RicExportToLasFileFeature.cpp +++ b/ApplicationCode/Commands/RicExportToLasFileFeature.cpp @@ -19,7 +19,7 @@ #include "RicExportToLasFileFeature.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "RigWellLogFile.h" #include "RiuMainWindow.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp index 4888ce4d2a..484664d25f 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.cpp @@ -26,7 +26,7 @@ #include "RimProject.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "RiaApplication.h" diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp index e23bc60938..f7341ee6b1 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp @@ -21,7 +21,7 @@ #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "RiuMainWindow.h" diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index b7cf593110..8ef43ea022 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -64,7 +64,7 @@ ${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.h ${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.h ${CEE_CURRENT_LIST_DIR}RimWellLogPlot.h ${CEE_CURRENT_LIST_DIR}RimWellLogTrack.h -${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.h +${CEE_CURRENT_LIST_DIR}RimWellLogCurve.h ${CEE_CURRENT_LIST_DIR}RimViewLinker.h ${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.h ${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.h @@ -133,7 +133,7 @@ ${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.cpp ${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.cpp ${CEE_CURRENT_LIST_DIR}RimWellLogPlot.cpp ${CEE_CURRENT_LIST_DIR}RimWellLogTrack.cpp -${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.cpp +${CEE_CURRENT_LIST_DIR}RimWellLogCurve.cpp ${CEE_CURRENT_LIST_DIR}RimViewLinker.cpp ${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.cpp ${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.cpp diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index f6142e0aa3..7d59856114 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -31,7 +31,7 @@ #include "RimReservoirCellResultsStorage.h" #include "RimView.h" #include "RimViewLinker.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "cafPdmUiListEditor.h" diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp index 4f65e507a0..c813f5f263 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp @@ -31,7 +31,7 @@ #include "RimGeoMechPropertyFilter.h" #include "RimGeoMechView.h" #include "RimViewLinker.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "cafPdmUiListEditor.h" diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 047e93f5f6..0d63a23332 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -626,7 +626,7 @@ void RimProject::computeUtmAreaOfInterest() #include "RimEclipseFaultColors.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "RimWellLogFileChannel.h" #include diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp similarity index 99% rename from ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp rename to ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp index a95175eb8c..144b5021d8 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp @@ -17,13 +17,13 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" -#include "RiuWellLogPlotCurve.h" +#include "RiuWellLogCurve.h" #include "RiuWellLogTrack.h" #include "cvfAssert.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogCurve.h similarity index 100% rename from ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h rename to ApplicationCode/ProjectDataModel/RimWellLogCurve.h diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 77ebfa5041..16193b5098 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -37,7 +37,7 @@ #include "RimProject.h" #include "RimWellLogPlot.h" #include "RimWellLogPlotCollection.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "RimWellLogTrack.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" @@ -46,7 +46,7 @@ #include "RimGeoMechView.h" #include "RimGeoMechCellColors.h" -#include "RiuWellLogPlotCurve.h" +#include "RiuWellLogCurve.h" #include "RiuWellLogTrack.h" #include "cafPdmUiTreeOrdering.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h index 0c5bcdad60..9f0428f412 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h @@ -19,7 +19,7 @@ #pragma once -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "cafPdmPtrField.h" #include "cafPdmChildField.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index b925080d82..46aca9455b 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -29,7 +29,7 @@ #include "RimWellLogPlot.h" #include "RiuWellLogTrack.h" -#include "RiuWellLogPlotCurve.h" +#include "RiuWellLogCurve.h" #include "RiaApplication.h" #include "RiaPreferences.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h index 5c89e5778d..c2c99be728 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h @@ -19,7 +19,7 @@ #pragma once -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "cafPdmPtrField.h" #include "cafPdmField.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index d92c049e2f..2fb419c114 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -20,7 +20,7 @@ #include "RimWellLogTrack.h" #include "RimWellLogPlot.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "RiuWellLogTrack.h" #include "RiuWellLogPlot.h" diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp index c4c2b2b906..6148816dac 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp @@ -19,7 +19,7 @@ #include "RigWellLogFile.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "well.hpp" #include "laswell.hpp" diff --git a/ApplicationCode/UserInterface/RiuDragDrop.cpp b/ApplicationCode/UserInterface/RiuDragDrop.cpp index b90ae79f5c..7f239b72ff 100644 --- a/ApplicationCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationCode/UserInterface/RiuDragDrop.cpp @@ -31,7 +31,7 @@ #include "RimMimeData.h" #include "RimWellLogFileChannel.h" #include "RimWellLogTrack.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" diff --git a/ApplicationCode/UserInterface/RiuWellLogPlotCurve.cpp b/ApplicationCode/UserInterface/RiuWellLogCurve.cpp similarity index 98% rename from ApplicationCode/UserInterface/RiuWellLogPlotCurve.cpp rename to ApplicationCode/UserInterface/RiuWellLogCurve.cpp index 3afeb1c20b..a4ec3ea0e2 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlotCurve.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogCurve.cpp @@ -17,7 +17,7 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RiuWellLogPlotCurve.h" +#include "RiuWellLogCurve.h" #include "RigWellLogCurveData.h" diff --git a/ApplicationCode/UserInterface/RiuWellLogPlotCurve.h b/ApplicationCode/UserInterface/RiuWellLogCurve.h similarity index 100% rename from ApplicationCode/UserInterface/RiuWellLogPlotCurve.h rename to ApplicationCode/UserInterface/RiuWellLogCurve.h diff --git a/ApplicationCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationCode/UserInterface/RiuWellLogTrack.cpp index 4863c33dbe..4447a3af8b 100644 --- a/ApplicationCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogTrack.cpp @@ -21,7 +21,7 @@ #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" -#include "RimWellLogPlotCurve.h" +#include "RimWellLogCurve.h" #include "RiuMainWindow.h" From 30adb2661e7a1471bd1635c30469ffbe854f99c2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 4 Nov 2015 09:39:55 +0100 Subject: [PATCH 08/27] (#612) Added time history plot as a dockwidget --- ApplicationCode/CMakeLists.txt | 2 + .../UserInterface/RiuMainWindow.cpp | 21 +-- ApplicationCode/UserInterface/RiuMainWindow.h | 3 + .../UserInterface/RiuTimeHistoryQwtPlot.cpp | 158 ++++++++++++++++++ .../UserInterface/RiuTimeHistoryQwtPlot.h | 46 +++++ 5 files changed, 218 insertions(+), 12 deletions(-) create mode 100644 ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp create mode 100644 ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 0ec9defc82..a8c4061212 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -90,6 +90,8 @@ set( USER_INTERFACE_FILES UserInterface/RiuWellLogTrack.h UserInterface/RiuProjectPropertyView.h UserInterface/RiuProjectPropertyView.cpp + UserInterface/RiuTimeHistoryQwtPlot.h + UserInterface/RiuTimeHistoryQwtPlot.cpp ) set( SOCKET_INTERFACE_FILES diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index b57ba4f65d..3dc6efce43 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -58,6 +58,7 @@ #include "RiuProcessMonitor.h" #include "RiuProjectPropertyView.h" #include "RiuResultInfoPanel.h" +#include "RiuTimeHistoryQwtPlot.h" #include "RiuTreeViewEventFilter.h" #include "RiuViewer.h" #include "RiuWellImportWizard.h" @@ -661,19 +662,15 @@ void RiuMainWindow::createDockPanels() addDockWidget(Qt::BottomDockWidgetArea, dockPanel); } - // Test - create well log viewer in a dock widget - // TODO: remove after making MDI widgets for well log viewers -// { -// QDockWidget* dockPanel = new QDockWidget("TEST - Well Log Viewer", this); -// dockPanel->setObjectName("dockWellLogViewer"); -// dockPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea); -// -// RiuWellLogViewer* wellLogViewer = new RiuWellLogViewer(dockPanel); -// dockPanel->setWidget(wellLogViewer); -// -// addDockWidget(Qt::BottomDockWidgetArea, dockPanel); -// } + { + QDockWidget* dockPanel = new QDockWidget("Time History Plot", this); + dockPanel->setObjectName("dockTimeHistoryPanel"); + dockPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea); + m_timeHistoryQwtPlot = new RiuTimeHistoryQwtPlot(dockPanel); + dockPanel->setWidget(m_timeHistoryQwtPlot); + addDockWidget(Qt::RightDockWidgetArea, dockPanel); + } setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea); diff --git a/ApplicationCode/UserInterface/RiuMainWindow.h b/ApplicationCode/UserInterface/RiuMainWindow.h index a6db88f08b..ea0553c699 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.h +++ b/ApplicationCode/UserInterface/RiuMainWindow.h @@ -42,6 +42,7 @@ class RiuProcessMonitor; class RiuResultInfoPanel; class RiuViewer; class RiuWellLogPlot; +class RiuTimeHistoryQwtPlot; namespace caf { @@ -198,6 +199,8 @@ private: RiuResultInfoPanel* m_resultInfoPanel; RiuProcessMonitor* m_processMonitor; + RiuTimeHistoryQwtPlot* m_timeHistoryQwtPlot; + QMenu* m_windowMenu; diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp new file mode 100644 index 0000000000..c75a047e28 --- /dev/null +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp @@ -0,0 +1,158 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuTimeHistoryQwtPlot.h" + +#include "cvfAssert.h" + +#include "qwt_legend.h" +#include "qwt_plot_curve.h" +#include "qwt_plot_layout.h" +#include "qwt_scale_engine.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuTimeHistoryQwtPlot::RiuTimeHistoryQwtPlot(QWidget* parent) + : QwtPlot(parent) +{ +/* + setFocusPolicy(Qt::ClickFocus); +*/ + setDefaults(); + + std::vector xValues; + std::vector yValues; + + xValues.push_back(1); + xValues.push_back(2); + xValues.push_back(3); + xValues.push_back(4); + + yValues.push_back(10); + yValues.push_back(12); + yValues.push_back(15); + yValues.push_back(11); + + addCurve("Test", xValues, yValues); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuTimeHistoryQwtPlot::~RiuTimeHistoryQwtPlot() +{ + deleteAllCurves(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector& xValues, const std::vector& yValues) +{ + CVF_ASSERT(xValues.size() == yValues.size()); + + QwtPlotCurve* plotCurve = new QwtPlotCurve("Curve 1"); + plotCurve->setSamples(xValues.data(), yValues.data(), (int) xValues.size()); + plotCurve->setTitle(curveName); + + plotCurve->attach(this); + m_plotCurves.push_back(plotCurve); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuTimeHistoryQwtPlot::deleteAllCurves() +{ + for (size_t i = 0; i < m_plotCurves.size(); i++) + { + m_plotCurves[i]->detach(); + delete m_plotCurves[i]; + } + + m_plotCurves.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuTimeHistoryQwtPlot::setDefaults() +{ + QPalette newPalette(palette()); + newPalette.setColor(QPalette::Background, Qt::white); + setPalette(newPalette); + + setAutoFillBackground(true); + setCanvasBackground(Qt::white); + + QFrame* canvasFrame = dynamic_cast(canvas()); + if (canvasFrame) + { + canvasFrame->setFrameShape(QFrame::NoFrame); + } + + canvas()->setMouseTracking(true); + canvas()->installEventFilter(this); + +/* + QPen gridPen(Qt::SolidLine); + gridPen.setColor(Qt::lightGray); + m_grid->setPen(gridPen); +*/ + + enableAxis(QwtPlot::xTop, true); + enableAxis(QwtPlot::yLeft, true); + enableAxis(QwtPlot::xBottom, false); + enableAxis(QwtPlot::yRight, false); + + plotLayout()->setAlignCanvasToScales(true); + + axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Inverted, true); + + // Align the canvas with the actual min and max values of the curves + axisScaleEngine(QwtPlot::xTop)->setAttribute(QwtScaleEngine::Floating, true); + axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating, true); + setAxisScale(QwtPlot::yLeft, 1000, 0); + setAxisScale(QwtPlot::xTop, -10, 100); + + QFont xAxisFont = axisFont(QwtPlot::xTop); + xAxisFont.setPixelSize(9); + setAxisFont(QwtPlot::xTop, xAxisFont); + + QFont yAxisFont = axisFont(QwtPlot::yLeft); + yAxisFont.setPixelSize(9); + setAxisFont(QwtPlot::yLeft, yAxisFont); + + QwtText axisTitleY = axisTitle(QwtPlot::yLeft); + QFont yAxisTitleFont = axisTitleY.font(); + yAxisTitleFont.setPixelSize(9); + yAxisTitleFont.setBold(false); + axisTitleY.setFont(yAxisTitleFont); + axisTitleY.setRenderFlags(Qt::AlignRight); + setAxisTitle(QwtPlot::yLeft, axisTitleY); + + + + QwtLegend* legend = new QwtLegend(this); + + // The legend will be deleted in the destructor of the plot or when + // another legend is inserted. + this->insertLegend(legend, BottomLegend); +} diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h new file mode 100644 index 0000000000..af3073e3ed --- /dev/null +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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 "qwt_plot.h" + +class QwtPlotCurve; + +//================================================================================================== +// +// +// +//================================================================================================== +class RiuTimeHistoryQwtPlot : public QwtPlot +{ +public: + RiuTimeHistoryQwtPlot(QWidget* parent = NULL); + virtual ~RiuTimeHistoryQwtPlot(); + + void addCurve(const QString& curveName, const std::vector& xValues, const std::vector& yValues); + void deleteAllCurves(); + +private: + void setDefaults(); + +private: + std::vector m_plotCurves; +}; + From 0011f090deaa70afc9f469b30f29509502e8cbd0 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 4 Nov 2015 14:18:52 +0100 Subject: [PATCH 09/27] (#612) Time history result accessor and display of curve from selection --- .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../RigTimeHistoryResultAccessor.cpp | 118 ++++++++++++++++++ .../RigTimeHistoryResultAccessor.h | 58 +++++++++ .../UserInterface/RiuMainWindow.cpp | 8 ++ ApplicationCode/UserInterface/RiuMainWindow.h | 2 + .../UserInterface/RiuTimeHistoryQwtPlot.cpp | 67 ++++------ .../UserInterface/RiuTimeHistoryQwtPlot.h | 2 +- .../UserInterface/RiuViewerCommands.cpp | 38 ++++++ .../UserInterface/RiuViewerCommands.h | 2 + 9 files changed, 256 insertions(+), 41 deletions(-) create mode 100644 ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp create mode 100644 ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.h diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index 33f6106e01..4fa870d18c 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -37,6 +37,7 @@ ${CEE_CURRENT_LIST_DIR}RigTernaryResultAccessor2d.h ${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.h ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.h ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h +${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -68,6 +69,7 @@ ${CEE_CURRENT_LIST_DIR}RigTernaryResultAccessor2d.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp +${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp new file mode 100644 index 0000000000..3b0f7283ee --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp @@ -0,0 +1,118 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA +// Copyright (C) Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RigTimeHistoryResultAccessor.h" + +#include // Needed for HUGE_VAL on Linux + +#include "RigCaseData.h" +#include "RigResultAccessor.h" +#include "RigResultAccessorFactory.h" +#include "RigCaseCellResultsData.h" + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigTimeHistoryResultAccessor::RigTimeHistoryResultAccessor(RigCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex, size_t scalarResultIndex, RifReaderInterface::PorosityModelResultType porosityModel) + : m_eclipseCaseData(eclipseCaseData), + m_gridIndex(gridIndex), + m_cellIndex(cellIndex), + m_scalarResultIndex(scalarResultIndex), + m_porosityModel(porosityModel) +{ + m_face = cvf::StructGridInterface::NO_FACE; + m_nncIndex = cvf::UNDEFINED_SIZE_T; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigTimeHistoryResultAccessor::setFace(cvf::StructGridInterface::FaceType face) +{ + m_face = face; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigTimeHistoryResultAccessor::setNncIndex(size_t nncIndex) +{ + m_nncIndex = nncIndex; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigTimeHistoryResultAccessor::yValues() const +{ + return m_yValues; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RigTimeHistoryResultAccessor::topologyText() +{ + QString text; + + if (m_eclipseCaseData) + { + if (m_cellIndex != cvf::UNDEFINED_SIZE_T) + { + size_t i = 0; + size_t j = 0; + size_t k = 0; + if (m_eclipseCaseData->grid(m_gridIndex)->ijkFromCellIndex(m_cellIndex, &i, &j, &k)) + { + // Adjust to 1-based Eclipse indexing + i++; + j++; + k++; + + cvf::StructGridInterface::FaceEnum faceEnum(m_face); + + text += QString("Cell : [%1, %2, %3]").arg(i).arg(j).arg(k); + } + } + } + + return text; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigTimeHistoryResultAccessor::computeCurveData() +{ + if (m_yValues.size() != 0) return; + + if (m_eclipseCaseData) + { + size_t timeStepCount = m_eclipseCaseData->results(m_porosityModel)->timeStepCount(m_scalarResultIndex); + + for (size_t i = 0; i < timeStepCount; i++) + { + cvf::ref resultAccessor = RigResultAccessorFactory::createResultAccessor(m_eclipseCaseData, m_gridIndex, m_porosityModel, i, m_scalarResultIndex); + + m_yValues.push_back(resultAccessor->cellScalar(m_cellIndex)); + } + } +} + diff --git a/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.h b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.h new file mode 100644 index 0000000000..928a627741 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA +// Copyright (C) Ceetron Solutions AS +// +// 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 "cvfStructGrid.h" +#include "RifReaderInterface.h" + +class RigCaseData; + + +class RigTimeHistoryResultAccessor +{ +public: + RigTimeHistoryResultAccessor(RigCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex, size_t scalarResultIndex, RifReaderInterface::PorosityModelResultType porosityModel); + + void setFace(cvf::StructGridInterface::FaceType face); + void setNncIndex(size_t nncIndex); + + void computeCurveData(); + QString topologyText(); + + QString curveName() const; + std::vector yValues() const; + +private: + + +private: + RigCaseData* m_eclipseCaseData; + + size_t m_gridIndex; + size_t m_cellIndex; + size_t m_nncIndex; + size_t m_scalarResultIndex; + + cvf::StructGridInterface::FaceType m_face; + RifReaderInterface::PorosityModelResultType m_porosityModel; + + std::vector m_yValues; +}; + diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 3dc6efce43..5e5f3c0d8b 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -1165,6 +1165,14 @@ QMdiSubWindow* RiuMainWindow::findMdiSubWindow(QWidget* viewer) return NULL; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuTimeHistoryQwtPlot* RiuMainWindow::timeHistoryPlot() +{ + return m_timeHistoryQwtPlot; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuMainWindow.h b/ApplicationCode/UserInterface/RiuMainWindow.h index ea0553c699..d2755cffd5 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.h +++ b/ApplicationCode/UserInterface/RiuMainWindow.h @@ -113,6 +113,8 @@ public: bool isAnyMdiSubWindowVisible(); QMdiSubWindow* findMdiSubWindow(QWidget* viewer); + RiuTimeHistoryQwtPlot* timeHistoryPlot(); + protected: virtual void closeEvent(QCloseEvent* event); diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp index c75a047e28..40f9151a10 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp @@ -25,6 +25,8 @@ #include "qwt_plot_curve.h" #include "qwt_plot_layout.h" #include "qwt_scale_engine.h" +#include "qwt_date_scale_draw.h" +#include "qwt_date_scale_engine.h" //-------------------------------------------------------------------------------------------------- /// @@ -32,25 +34,7 @@ RiuTimeHistoryQwtPlot::RiuTimeHistoryQwtPlot(QWidget* parent) : QwtPlot(parent) { -/* - setFocusPolicy(Qt::ClickFocus); -*/ setDefaults(); - - std::vector xValues; - std::vector yValues; - - xValues.push_back(1); - xValues.push_back(2); - xValues.push_back(3); - xValues.push_back(4); - - yValues.push_back(10); - yValues.push_back(12); - yValues.push_back(15); - yValues.push_back(11); - - addCurve("Test", xValues, yValues); } //-------------------------------------------------------------------------------------------------- @@ -64,16 +48,28 @@ RiuTimeHistoryQwtPlot::~RiuTimeHistoryQwtPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector& xValues, const std::vector& yValues) +void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector& dateTimes, const std::vector& yValues) { - CVF_ASSERT(xValues.size() == yValues.size()); + CVF_ASSERT(dateTimes.size() == yValues.size()); QwtPlotCurve* plotCurve = new QwtPlotCurve("Curve 1"); - plotCurve->setSamples(xValues.data(), yValues.data(), (int) xValues.size()); + + QPolygonF points; + for (int i = 0; i < dateTimes.size(); i++) + { + double milliSecSinceEpoch = QwtDate::toDouble(dateTimes[i]); + points << QPointF(milliSecSinceEpoch, yValues[i]); + } + + plotCurve->setSamples(points); plotCurve->setTitle(curveName); plotCurve->attach(this); m_plotCurves.push_back(plotCurve); + + this->setAxisScale( QwtPlot::xTop, QwtDate::toDouble(dateTimes.front()), QwtDate::toDouble(dateTimes.back())); + + this->replot(); } //-------------------------------------------------------------------------------------------------- @@ -111,30 +107,23 @@ void RiuTimeHistoryQwtPlot::setDefaults() canvas()->setMouseTracking(true); canvas()->installEventFilter(this); -/* - QPen gridPen(Qt::SolidLine); - gridPen.setColor(Qt::lightGray); - m_grid->setPen(gridPen); -*/ - - enableAxis(QwtPlot::xTop, true); + enableAxis(QwtPlot::xBottom, true); enableAxis(QwtPlot::yLeft, true); - enableAxis(QwtPlot::xBottom, false); + enableAxis(QwtPlot::xTop, false); enableAxis(QwtPlot::yRight, false); plotLayout()->setAlignCanvasToScales(true); - axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Inverted, true); + QwtDateScaleDraw* scaleDraw = new QwtDateScaleDraw(Qt::UTC); + scaleDraw->setDateFormat(QwtDate::Year, QString("dd-MM-yyyy")); + + QwtDateScaleEngine* scaleEngine = new QwtDateScaleEngine(Qt::UTC); + setAxisScaleEngine(QwtPlot::xBottom, scaleEngine); + setAxisScaleDraw(QwtPlot::xBottom, scaleDraw); - // Align the canvas with the actual min and max values of the curves - axisScaleEngine(QwtPlot::xTop)->setAttribute(QwtScaleEngine::Floating, true); - axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating, true); - setAxisScale(QwtPlot::yLeft, 1000, 0); - setAxisScale(QwtPlot::xTop, -10, 100); - - QFont xAxisFont = axisFont(QwtPlot::xTop); + QFont xAxisFont = axisFont(QwtPlot::xBottom); xAxisFont.setPixelSize(9); - setAxisFont(QwtPlot::xTop, xAxisFont); + setAxisFont(QwtPlot::xBottom, xAxisFont); QFont yAxisFont = axisFont(QwtPlot::yLeft); yAxisFont.setPixelSize(9); @@ -149,9 +138,7 @@ void RiuTimeHistoryQwtPlot::setDefaults() setAxisTitle(QwtPlot::yLeft, axisTitleY); - QwtLegend* legend = new QwtLegend(this); - // The legend will be deleted in the destructor of the plot or when // another legend is inserted. this->insertLegend(legend, BottomLegend); diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h index af3073e3ed..95323c9d88 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h @@ -34,7 +34,7 @@ public: RiuTimeHistoryQwtPlot(QWidget* parent = NULL); virtual ~RiuTimeHistoryQwtPlot(); - void addCurve(const QString& curveName, const std::vector& xValues, const std::vector& yValues); + void addCurve(const QString& curveName, const std::vector& dateTimes, const std::vector& yValues); void deleteAllCurves(); private: diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 6a9735e731..f246365420 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -26,9 +26,11 @@ #include "Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h" #include "RigCaseData.h" +#include "RigCaseCellResultsData.h" #include "RigFemPartCollection.h" #include "RigFemPartGrid.h" #include "RigGeoMechCaseData.h" +#include "RigTimeHistoryResultAccessor.h" #include "RimCellRangeFilter.h" #include "RimCellRangeFilterCollection.h" @@ -55,6 +57,7 @@ #include "RiuFemResultTextBuilder.h" #include "RiuMainWindow.h" #include "RiuResultTextBuilder.h" +#include "RiuTimeHistoryQwtPlot.h" #include "RiuViewer.h" #include "RivFemPartGeometryGenerator.h" @@ -489,6 +492,13 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) resultInfo = textBuilder.mainResultText(); pickInfo = textBuilder.topologyText(", "); + + if (eclipseView->cellResult()->hasDynamicResult() && + eclipseView->eclipseCase() && + eclipseView->eclipseCase()->reservoirData()) + { + addTimeHistoryCurve(eclipseView, gridIndex, cellIndex); + } } else if (geomView) { @@ -517,6 +527,34 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) mainWnd->setResultInfo(resultInfo); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex) +{ + RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(eclipseView->cellResult()->porosityModel()); + + std::vector timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(eclipseView->cellResult()->scalarResultIndex()); + + RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(), gridIndex, cellIndex, eclipseView->cellResult()->scalarResultIndex(), porosityModel); + timeHistResultAccessor.computeCurveData(); + + QString curveName = eclipseView->eclipseCase()->caseUserDescription(); + curveName += " - Result : "; + curveName += eclipseView->cellResult()->resultVariable(); + curveName += " - "; + curveName += timeHistResultAccessor.topologyText(); + + std::vector yValues = timeHistResultAccessor.yValues(); + + CVF_ASSERT(timeStepDates.size() == yValues.size()); + + RiuMainWindow* mainWnd = RiuMainWindow::instance(); + + mainWnd->timeHistoryPlot()->deleteAllCurves(); + mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, yValues); +} + //-------------------------------------------------------------------------------------------------- /// Perform picking and return the index of the face that was hit, if a drawable geo was hit //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.h b/ApplicationCode/UserInterface/RiuViewerCommands.h index edb0bff949..856079754c 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.h +++ b/ApplicationCode/UserInterface/RiuViewerCommands.h @@ -49,6 +49,7 @@ public: void displayContextMenu(QMouseEvent* event); void handlePickAction(int winPosX, int winPosY); + private slots: void slotRangeFilterI(); void slotRangeFilterJ(); @@ -62,6 +63,7 @@ private: void createSliceRangeFilter(int ijOrk); void extractIntersectionData(const cvf::HitItemCollection& hitItems, cvf::Vec3d* localIntersectionPoint, cvf::Part** firstPart, uint* firstPartFaceHit, cvf::Part** nncPart, uint* nncPartFaceHit); void updateSelectionFromPickedPart(cvf::Part* part); + void addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex); size_t m_currentGridIdx; size_t m_currentCellIndex; From 7db6835075ae16008f16b2ef3aa0f07cbedd4877 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 Nov 2015 07:27:04 +0100 Subject: [PATCH 10/27] (#612) Append new curves on cell click, clear when no cell is hit --- .../UserInterface/RiuTimeHistoryQwtPlot.cpp | 6 ++++++ .../UserInterface/RiuViewerCommands.cpp | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp index 40f9151a10..bb318a2602 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp @@ -19,7 +19,10 @@ #include "RiuTimeHistoryQwtPlot.h" +#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" + #include "cvfAssert.h" +#include "cvfColor3.h" #include "qwt_legend.h" #include "qwt_plot_curve.h" @@ -64,6 +67,9 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector plotCurve->setSamples(points); plotCurve->setTitle(curveName); + cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(); + plotCurve->setPen(QPen(QColor(curveColor.rByte(), curveColor.gByte(), curveColor.bByte()))); + plotCurve->attach(this); m_plotCurves.push_back(plotCurve); diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index f246365420..bb651890d3 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -472,6 +472,9 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) } } + + RiuMainWindow* mainWnd = RiuMainWindow::instance(); + // Compose a info text regarding the hit QString pickInfo = "No hits"; @@ -512,17 +515,17 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) pickInfo = textBuilder.topologyText(", "); } } + else + { + // Delete all curves if no cell is hit + mainWnd->timeHistoryPlot()->deleteAllCurves(); + } if (wellPath) { pickInfo = QString("Well path hit: %1").arg(wellPath->name()); } - // Display the text - - RiuMainWindow* mainWnd = RiuMainWindow::instance(); - if (!mainWnd) return; - mainWnd->statusBar()->showMessage(pickInfo); mainWnd->setResultInfo(resultInfo); } @@ -551,7 +554,6 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t RiuMainWindow* mainWnd = RiuMainWindow::instance(); - mainWnd->timeHistoryPlot()->deleteAllCurves(); mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, yValues); } From b30604edd166d8f780470cf4da984cda7dafaaf2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 Nov 2015 09:03:57 +0100 Subject: [PATCH 11/27] Rename --- .../RigTimeHistoryResultAccessor.cpp | 25 ++++++++----------- .../RigTimeHistoryResultAccessor.h | 16 ++++-------- .../UserInterface/RiuViewerCommands.cpp | 4 +-- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp index 3b0f7283ee..2a1bb6aaa4 100644 --- a/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp @@ -38,7 +38,8 @@ RigTimeHistoryResultAccessor::RigTimeHistoryResultAccessor(RigCaseData* eclipseC m_porosityModel(porosityModel) { m_face = cvf::StructGridInterface::NO_FACE; - m_nncIndex = cvf::UNDEFINED_SIZE_T; + + computeTimeHistoryData(); } //-------------------------------------------------------------------------------------------------- @@ -47,28 +48,22 @@ RigTimeHistoryResultAccessor::RigTimeHistoryResultAccessor(RigCaseData* eclipseC void RigTimeHistoryResultAccessor::setFace(cvf::StructGridInterface::FaceType face) { m_face = face; + + computeTimeHistoryData(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigTimeHistoryResultAccessor::setNncIndex(size_t nncIndex) +std::vector RigTimeHistoryResultAccessor::timeHistoryValues() const { - m_nncIndex = nncIndex; + return m_timeHistoryValues; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigTimeHistoryResultAccessor::yValues() const -{ - return m_yValues; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RigTimeHistoryResultAccessor::topologyText() +QString RigTimeHistoryResultAccessor::topologyText() const { QString text; @@ -99,9 +94,9 @@ QString RigTimeHistoryResultAccessor::topologyText() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigTimeHistoryResultAccessor::computeCurveData() +void RigTimeHistoryResultAccessor::computeTimeHistoryData() { - if (m_yValues.size() != 0) return; + m_timeHistoryValues.clear(); if (m_eclipseCaseData) { @@ -111,7 +106,7 @@ void RigTimeHistoryResultAccessor::computeCurveData() { cvf::ref resultAccessor = RigResultAccessorFactory::createResultAccessor(m_eclipseCaseData, m_gridIndex, m_porosityModel, i, m_scalarResultIndex); - m_yValues.push_back(resultAccessor->cellScalar(m_cellIndex)); + m_timeHistoryValues.push_back(resultAccessor->cellScalar(m_cellIndex)); } } } diff --git a/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.h b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.h index 928a627741..1caacfb575 100644 --- a/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.h +++ b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.h @@ -29,30 +29,24 @@ class RigTimeHistoryResultAccessor { public: RigTimeHistoryResultAccessor(RigCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex, size_t scalarResultIndex, RifReaderInterface::PorosityModelResultType porosityModel); - void setFace(cvf::StructGridInterface::FaceType face); - void setNncIndex(size_t nncIndex); - void computeCurveData(); - QString topologyText(); - - QString curveName() const; - std::vector yValues() const; + QString topologyText() const; + std::vector timeHistoryValues() const; private: - + void computeTimeHistoryData(); private: - RigCaseData* m_eclipseCaseData; + RigCaseData* m_eclipseCaseData; size_t m_gridIndex; size_t m_cellIndex; - size_t m_nncIndex; size_t m_scalarResultIndex; cvf::StructGridInterface::FaceType m_face; RifReaderInterface::PorosityModelResultType m_porosityModel; - std::vector m_yValues; + std::vector m_timeHistoryValues; }; diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index bb651890d3..4631782a85 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -540,7 +540,7 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t std::vector timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(eclipseView->cellResult()->scalarResultIndex()); RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(), gridIndex, cellIndex, eclipseView->cellResult()->scalarResultIndex(), porosityModel); - timeHistResultAccessor.computeCurveData(); + timeHistResultAccessor.computeTimeHistoryData(); QString curveName = eclipseView->eclipseCase()->caseUserDescription(); curveName += " - Result : "; @@ -548,7 +548,7 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t curveName += " - "; curveName += timeHistResultAccessor.topologyText(); - std::vector yValues = timeHistResultAccessor.yValues(); + std::vector yValues = timeHistResultAccessor.timeHistoryValues(); CVF_ASSERT(timeStepDates.size() == yValues.size()); From ff6e2755aab14a332b648b2a97ab6f4ad4e4ded7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 Nov 2015 11:45:18 +0100 Subject: [PATCH 12/27] Added time history plot for geo mech models --- .../GeoMech/GeoMechDataModel/CMakeLists.txt | 2 + .../RigFemTimeHistoryResultAccessor.cpp | 148 ++++++++++++++++++ .../RigFemTimeHistoryResultAccessor.h | 54 +++++++ .../UserInterface/RiuTimeHistoryQwtPlot.cpp | 21 ++- .../UserInterface/RiuTimeHistoryQwtPlot.h | 4 +- .../UserInterface/RiuViewerCommands.cpp | 49 +++++- .../UserInterface/RiuViewerCommands.h | 1 + 7 files changed, 271 insertions(+), 8 deletions(-) create mode 100644 ApplicationCode/GeoMech/GeoMechDataModel/RigFemTimeHistoryResultAccessor.cpp create mode 100644 ApplicationCode/GeoMech/GeoMechDataModel/RigFemTimeHistoryResultAccessor.h diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt b/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt index b7fbf20e04..530de2fb36 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt +++ b/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt @@ -32,6 +32,8 @@ add_library( ${PROJECT_NAME} RigFemPartGrid.cpp RigFemResultAddress.h RigFemResultPosEnum.h + RigFemTimeHistoryResultAccessor.h + RigFemTimeHistoryResultAccessor.cpp ) target_link_libraries( ${PROJECT_NAME} LibCore cafTensor ResultStatisticsCache) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTimeHistoryResultAccessor.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTimeHistoryResultAccessor.cpp new file mode 100644 index 0000000000..a06bb96463 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTimeHistoryResultAccessor.cpp @@ -0,0 +1,148 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA +// Copyright (C) Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RigFemTimeHistoryResultAccessor.h" + +#include "RigFemPart.h" +#include "RigFemPartCollection.h" +#include "RigFemPartGrid.h" +#include "RigFemPartResultsCollection.h" +#include "RigFemTypes.h" +#include "RigGeoMechCaseData.h" + +#include // Needed for HUGE_VAL on Linux + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFemTimeHistoryResultAccessor::RigFemTimeHistoryResultAccessor(RigGeoMechCaseData* geomData, RigFemResultAddress femResultAddress, + size_t gridIndex, size_t cellIndex, const cvf::Vec3d& intersectionPoint) + : m_geoMechCaseData(geomData), + m_femResultAddress(femResultAddress), + m_gridIndex(gridIndex), + m_cellIndex(cellIndex), + m_intersectionPoint(intersectionPoint) +{ + computeTimeHistoryData(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RigFemTimeHistoryResultAccessor::topologyText() const +{ + QString text; + + if (m_geoMechCaseData) + { + RigFemPart* femPart = m_geoMechCaseData->femParts()->part(m_gridIndex); + int elementId = femPart->elmId(m_cellIndex); + text += QString("Element : Id[%1]").arg(elementId); + + size_t i = 0; + size_t j = 0; + size_t k = 0; + if (m_geoMechCaseData->femParts()->part(m_gridIndex)->structGrid()->ijkFromCellIndex(m_cellIndex, &i, &j, &k)) + { + // Adjust to 1-based Eclipse indexing + i++; + j++; + k++; + + cvf::Vec3d domainCoord = m_intersectionPoint; + text += QString(", ijk[%1, %2, %3]").arg(i).arg(j).arg(k); + + QString formattedText; + formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z()); + + text += formattedText; + } + } + + return text; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigFemTimeHistoryResultAccessor::timeHistoryValues() const +{ + return m_timeHistoryValues; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemTimeHistoryResultAccessor::computeTimeHistoryData() +{ + m_timeHistoryValues.clear(); + + size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T; + + // Compute scalar result index from geometry + { + RigFemPart* femPart = m_geoMechCaseData->femParts()->part(m_gridIndex); + RigElementType elmType = femPart->elementType(m_cellIndex); + const int* elmentConn = femPart->connectivities(m_cellIndex); + int elmNodeCount = RigFemTypes::elmentNodeCount(elmType); + + // Find the closest node + int closestLocalNode = -1; + float minDist = std::numeric_limits::infinity(); + for (int lNodeIdx = 0; lNodeIdx < elmNodeCount; ++lNodeIdx) + { + int nodeIdx = elmentConn[lNodeIdx]; + cvf::Vec3f nodePos = femPart->nodes().coordinates[nodeIdx]; + float dist = (nodePos - cvf::Vec3f(m_intersectionPoint)).lengthSquared(); + if (dist < minDist) + { + closestLocalNode = lNodeIdx; + minDist = dist; + } + } + + // Create a text showing the results from the closest node + if (closestLocalNode >= 0) + { + int nodeIdx = elmentConn[closestLocalNode]; + if (m_femResultAddress.resultPosType == RIG_NODAL) + { + scalarResultIndex = static_cast(nodeIdx); + } + else + { + scalarResultIndex = femPart->elementNodeResultIdx(static_cast(m_cellIndex), closestLocalNode); + } + } + } + + if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) return; + + RigFemPartResultsCollection* femPartResultsColl = m_geoMechCaseData->femPartResults(); + for (int frameIdx = 0; frameIdx < femPartResultsColl->frameCount(); frameIdx++) + { + const std::vector& scalarResults = m_geoMechCaseData->femPartResults()->resultValues(m_femResultAddress, static_cast(m_gridIndex), frameIdx); + if (scalarResults.size()) + { + float scalarValue = scalarResults[scalarResultIndex]; + + m_timeHistoryValues.push_back(scalarValue); + } + } +} diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTimeHistoryResultAccessor.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTimeHistoryResultAccessor.h new file mode 100644 index 0000000000..cb47556c2a --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTimeHistoryResultAccessor.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA +// Copyright (C) Ceetron Solutions AS +// +// 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 "RigFemResultAddress.h" + +#include "cvfStructGrid.h" +#include "cvfVector3.h" + +class RigGeoMechCaseData; + + +class RigFemTimeHistoryResultAccessor +{ +public: + RigFemTimeHistoryResultAccessor(RigGeoMechCaseData* geomData, RigFemResultAddress femResultAddress, + size_t gridIndex, size_t cellIndex, const cvf::Vec3d& intersectionPoint); + + QString topologyText() const; + std::vector timeHistoryValues() const; + +private: + void computeTimeHistoryData(); + +private: + RigGeoMechCaseData* m_geoMechCaseData; + RigFemResultAddress m_femResultAddress; + + size_t m_gridIndex; + size_t m_cellIndex; + size_t m_scalarResultIndex; + + cvf::Vec3d m_intersectionPoint; + + std::vector m_timeHistoryValues; +}; + diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp index bb318a2602..d0f8f285fc 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp @@ -51,9 +51,9 @@ RiuTimeHistoryQwtPlot::~RiuTimeHistoryQwtPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector& dateTimes, const std::vector& yValues) +void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector& dateTimes, const std::vector& timeHistoryValues) { - CVF_ASSERT(dateTimes.size() == yValues.size()); + CVF_ASSERT(dateTimes.size() == timeHistoryValues.size()); QwtPlotCurve* plotCurve = new QwtPlotCurve("Curve 1"); @@ -61,7 +61,7 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector for (int i = 0; i < dateTimes.size(); i++) { double milliSecSinceEpoch = QwtDate::toDouble(dateTimes[i]); - points << QPointF(milliSecSinceEpoch, yValues[i]); + points << QPointF(milliSecSinceEpoch, timeHistoryValues[i]); } plotCurve->setSamples(points); @@ -78,6 +78,21 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector this->replot(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector& frameTimes, const std::vector& timeHistoryValues) +{ + std::vector dateTimes; + + for (size_t i = 0; i < frameTimes.size(); i++) + { + dateTimes.push_back(QwtDate::toDateTime(frameTimes[i])); + } + + addCurve(curveName, dateTimes, timeHistoryValues); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h index 95323c9d88..1caff45db1 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h @@ -34,7 +34,9 @@ public: RiuTimeHistoryQwtPlot(QWidget* parent = NULL); virtual ~RiuTimeHistoryQwtPlot(); - void addCurve(const QString& curveName, const std::vector& dateTimes, const std::vector& yValues); + void addCurve(const QString& curveName, const std::vector& dateTimes, const std::vector& timeHistoryValues); + void addCurve(const QString& curveName, const std::vector& frameTimes, const std::vector& timeHistoryValues); + void deleteAllCurves(); private: diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 4631782a85..84592b9c97 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -77,6 +77,7 @@ #include #include #include +#include "RigFemTimeHistoryResultAccessor.h" //================================================================================================== // @@ -513,6 +514,12 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) resultInfo = textBuilder.mainResultText(); pickInfo = textBuilder.topologyText(", "); + + if (geomView->cellResult() && + geomView->cellResult()->hasResult()) + { + addTimeHistoryCurve(geomView, gridIndex, cellIndex, localIntersectionPoint); + } } } else @@ -540,7 +547,6 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t std::vector timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(eclipseView->cellResult()->scalarResultIndex()); RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(), gridIndex, cellIndex, eclipseView->cellResult()->scalarResultIndex(), porosityModel); - timeHistResultAccessor.computeTimeHistoryData(); QString curveName = eclipseView->eclipseCase()->caseUserDescription(); curveName += " - Result : "; @@ -548,13 +554,48 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t curveName += " - "; curveName += timeHistResultAccessor.topologyText(); - std::vector yValues = timeHistResultAccessor.timeHistoryValues(); + std::vector timeHistoryValues = timeHistResultAccessor.timeHistoryValues(); - CVF_ASSERT(timeStepDates.size() == yValues.size()); + CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size()); RiuMainWindow* mainWnd = RiuMainWindow::instance(); - mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, yValues); + mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, timeHistoryValues); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint) +{ + if (geoMechView && + geoMechView->cellResult() && + geoMechView->geoMechCase() && + geoMechView->geoMechCase()->geoMechData()) + { + RigFemTimeHistoryResultAccessor timeHistResultAccessor(geoMechView->geoMechCase()->geoMechData(), geoMechView->cellResult->resultAddress(), gridIndex, cellIndex, localIntersectionPoint); + + QString curveName; + curveName.append(geoMechView->geoMechCase()->caseUserDescription() + ", "); + + caf::AppEnum resPosAppEnum = geoMechView->cellResult()->resultPositionType(); + curveName.append(resPosAppEnum.uiText() + ", "); + curveName.append(geoMechView->cellResult()->resultFieldUiName()+ ", ") ; + curveName.append(geoMechView->cellResult()->resultComponentUiName() + ":\n"); + curveName.append(timeHistResultAccessor.topologyText()); + + std::vector timeHistoryValues = timeHistResultAccessor.timeHistoryValues(); + std::vector frameTimes; + for (size_t i = 0; i < timeHistoryValues.size(); i++) + { + frameTimes.push_back(i); + } + + CVF_ASSERT(frameTimes.size() == timeHistoryValues.size()); + + RiuMainWindow* mainWnd = RiuMainWindow::instance(); + mainWnd->timeHistoryPlot()->addCurve(curveName, frameTimes, timeHistoryValues); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.h b/ApplicationCode/UserInterface/RiuViewerCommands.h index 856079754c..2a8de9e20d 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.h +++ b/ApplicationCode/UserInterface/RiuViewerCommands.h @@ -64,6 +64,7 @@ private: void extractIntersectionData(const cvf::HitItemCollection& hitItems, cvf::Vec3d* localIntersectionPoint, cvf::Part** firstPart, uint* firstPartFaceHit, cvf::Part** nncPart, uint* nncPartFaceHit); void updateSelectionFromPickedPart(cvf::Part* part); void addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex); + void addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint); size_t m_currentGridIdx; size_t m_currentCellIndex; From e3d76be0aab77c1cac5c33222775e55407933876 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 Nov 2015 12:32:29 +0100 Subject: [PATCH 13/27] (#612) Improved user interaction for adding/deleting curves When time hist plot is visible, CTRL + mouse click on a cell adds curve to plot Mouse click outside clears curve plot --- ApplicationCode/UserInterface/RiuViewer.cpp | 2 +- .../UserInterface/RiuViewerCommands.cpp | 87 +++++++++++-------- .../UserInterface/RiuViewerCommands.h | 2 +- 3 files changed, 52 insertions(+), 39 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuViewer.cpp b/ApplicationCode/UserInterface/RiuViewer.cpp index 73d8aa347e..c913390f03 100644 --- a/ApplicationCode/UserInterface/RiuViewer.cpp +++ b/ApplicationCode/UserInterface/RiuViewer.cpp @@ -225,7 +225,7 @@ void RiuViewer::mouseReleaseEvent(QMouseEvent* event) if (event->button() == Qt::LeftButton) { - m_viewerCommands->handlePickAction(event->x(), event->y()); + m_viewerCommands->handlePickAction(event->x(), event->y(), event->modifiers()); return; } else if (event->button() == Qt::RightButton) diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 84592b9c97..f5ede535b6 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -404,9 +404,8 @@ void RiuViewerCommands::slotAddGeoMechPropertyFilter() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) +void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers) { - size_t gridIndex = cvf::UNDEFINED_SIZE_T; size_t cellIndex = cvf::UNDEFINED_SIZE_T; size_t nncIndex = cvf::UNDEFINED_SIZE_T; @@ -474,13 +473,18 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) } - RiuMainWindow* mainWnd = RiuMainWindow::instance(); // Compose a info text regarding the hit QString pickInfo = "No hits"; QString resultInfo = ""; + bool addCurveToTimeHistoryPlot = false; + if (keyboardModifiers & Qt::ControlModifier) + { + addCurveToTimeHistoryPlot = true; + } + if (cellIndex != cvf::UNDEFINED_SIZE_T || nncIndex != cvf::UNDEFINED_SIZE_T) { RimEclipseView* eclipseView = dynamic_cast(m_reservoirView.p()); @@ -497,12 +501,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) pickInfo = textBuilder.topologyText(", "); - if (eclipseView->cellResult()->hasDynamicResult() && - eclipseView->eclipseCase() && - eclipseView->eclipseCase()->reservoirData()) - { - addTimeHistoryCurve(eclipseView, gridIndex, cellIndex); - } + if (addCurveToTimeHistoryPlot) addTimeHistoryCurve(eclipseView, gridIndex, cellIndex); } else if (geomView) { @@ -515,24 +514,26 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) pickInfo = textBuilder.topologyText(", "); - if (geomView->cellResult() && - geomView->cellResult()->hasResult()) - { - addTimeHistoryCurve(geomView, gridIndex, cellIndex, localIntersectionPoint); - } + if (addCurveToTimeHistoryPlot) addTimeHistoryCurve(geomView, gridIndex, cellIndex, localIntersectionPoint); } } - else - { - // Delete all curves if no cell is hit - mainWnd->timeHistoryPlot()->deleteAllCurves(); - } - + if (wellPath) { pickInfo = QString("Well path hit: %1").arg(wellPath->name()); } + RiuMainWindow* mainWnd = RiuMainWindow::instance(); + if (cellIndex == cvf::UNDEFINED_SIZE_T && + !(keyboardModifiers & Qt::ControlModifier)) + { + if (mainWnd->timeHistoryPlot()->isVisible()) + { + // Delete all curves if no cell is hit + mainWnd->timeHistoryPlot()->deleteAllCurves(); + } + } + mainWnd->statusBar()->showMessage(pickInfo); mainWnd->setResultInfo(resultInfo); } @@ -542,25 +543,33 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY) //-------------------------------------------------------------------------------------------------- void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex) { - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(eclipseView->cellResult()->porosityModel()); - - std::vector timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(eclipseView->cellResult()->scalarResultIndex()); - - RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(), gridIndex, cellIndex, eclipseView->cellResult()->scalarResultIndex(), porosityModel); - - QString curveName = eclipseView->eclipseCase()->caseUserDescription(); - curveName += " - Result : "; - curveName += eclipseView->cellResult()->resultVariable(); - curveName += " - "; - curveName += timeHistResultAccessor.topologyText(); - - std::vector timeHistoryValues = timeHistResultAccessor.timeHistoryValues(); - - CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size()); - RiuMainWindow* mainWnd = RiuMainWindow::instance(); + if (!mainWnd->timeHistoryPlot()->isVisible()) return; + + if (eclipseView->cellResult()->hasDynamicResult() && + eclipseView->eclipseCase() && + eclipseView->eclipseCase()->reservoirData()) + { + RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(eclipseView->cellResult()->porosityModel()); + + std::vector timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(eclipseView->cellResult()->scalarResultIndex()); + + RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(), gridIndex, cellIndex, eclipseView->cellResult()->scalarResultIndex(), porosityModel); + + QString curveName = eclipseView->eclipseCase()->caseUserDescription(); + curveName += ", "; + curveName += eclipseView->cellResult()->resultVariable(); + curveName += ", "; + curveName += QString("Grid index %1").arg(gridIndex); + curveName += ", "; + curveName += timeHistResultAccessor.topologyText(); + + std::vector timeHistoryValues = timeHistResultAccessor.timeHistoryValues(); + + CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size()); - mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, timeHistoryValues); + mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, timeHistoryValues); + } } //-------------------------------------------------------------------------------------------------- @@ -568,8 +577,12 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t //-------------------------------------------------------------------------------------------------- void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint) { + RiuMainWindow* mainWnd = RiuMainWindow::instance(); + if (!mainWnd->timeHistoryPlot()->isVisible()) return; + if (geoMechView && geoMechView->cellResult() && + geoMechView->cellResult()->hasResult() && geoMechView->geoMechCase() && geoMechView->geoMechCase()->geoMechData()) { diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.h b/ApplicationCode/UserInterface/RiuViewerCommands.h index 2a8de9e20d..3a3dcd44be 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.h +++ b/ApplicationCode/UserInterface/RiuViewerCommands.h @@ -47,7 +47,7 @@ public: void setOwnerView(RimView * owner); void displayContextMenu(QMouseEvent* event); - void handlePickAction(int winPosX, int winPosY); + void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers); private slots: From cef31b2c4ad116e26f173ffe57fc4b82df0f3dc1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 Nov 2015 14:12:49 +0100 Subject: [PATCH 14/27] (#612) Make sure time step dates are taken from scalar dataset with highest time step count --- ApplicationCode/UserInterface/RiuViewerCommands.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index f5ede535b6..465681d3d3 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -552,7 +552,9 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t { RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(eclipseView->cellResult()->porosityModel()); - std::vector timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(eclipseView->cellResult()->scalarResultIndex()); + size_t scalarIndexWithMaxTimeStepCount = cvf::UNDEFINED_SIZE_T; + eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount); + std::vector timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(scalarIndexWithMaxTimeStepCount); RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(), gridIndex, cellIndex, eclipseView->cellResult()->scalarResultIndex(), porosityModel); From 3c00a8394d19bf12dd352aa426061978cec38983 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 Nov 2015 08:32:58 +0100 Subject: [PATCH 15/27] Refactored and renamed to RuiLineSegmentQwtPlotCurve --- .../ProjectDataModel/RimWellLogCurve.cpp | 4 +-- .../ProjectDataModel/RimWellLogCurve.h | 4 +-- .../RimWellLogExtractionCurve.cpp | 2 +- .../ProjectDataModel/RimWellLogFileCurve.cpp | 2 +- ...rve.cpp => RiuLineSegmentQwtPlotCurve.cpp} | 26 ++++++++++------- ...ogCurve.h => RiuLineSegmentQwtPlotCurve.h} | 28 ++++++++++++++----- 6 files changed, 43 insertions(+), 23 deletions(-) rename ApplicationCode/UserInterface/{RiuWellLogCurve.cpp => RiuLineSegmentQwtPlotCurve.cpp} (70%) rename ApplicationCode/UserInterface/{RiuWellLogCurve.h => RiuLineSegmentQwtPlotCurve.h} (60%) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp index 144b5021d8..1ff66f5720 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp @@ -23,7 +23,7 @@ #include "RimWellLogTrack.h" -#include "RiuWellLogCurve.h" +#include "RiuLineSegmentQwtPlotCurve.h" #include "RiuWellLogTrack.h" #include "cvfAssert.h" @@ -49,7 +49,7 @@ RimWellLogCurve::RimWellLogCurve() CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", ""); - m_qwtPlotCurve = new RiuWellLogCurve; + m_qwtPlotCurve = new RiuLineSegmentQwtPlotCurve; m_qwtPlotCurve->setXAxis(QwtPlot::xTop); m_qwtPlotCurve->setYAxis(QwtPlot::yLeft); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogCurve.h index cb4780bc34..c7ff0a6e43 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogCurve.h @@ -29,7 +29,7 @@ class RigWellLogCurveData; class RiuWellLogTrack; -class RiuWellLogCurve; +class RiuLineSegmentQwtPlotCurve; class QwtPlotCurve; class QString; @@ -82,7 +82,7 @@ protected: QPointer m_ownerQwtTrack; - RiuWellLogCurve* m_qwtPlotCurve; + RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve; cvf::ref m_curveData; caf::PdmField m_showCurve; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 16193b5098..fbca8f08ba 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -46,7 +46,7 @@ #include "RimGeoMechView.h" #include "RimGeoMechCellColors.h" -#include "RiuWellLogCurve.h" +#include "RiuLineSegmentQwtPlotCurve.h" #include "RiuWellLogTrack.h" #include "cafPdmUiTreeOrdering.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index 46aca9455b..ca8abfa5f5 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -29,7 +29,7 @@ #include "RimWellLogPlot.h" #include "RiuWellLogTrack.h" -#include "RiuWellLogCurve.h" +#include "RiuLineSegmentQwtPlotCurve.h" #include "RiaApplication.h" #include "RiaPreferences.h" diff --git a/ApplicationCode/UserInterface/RiuWellLogCurve.cpp b/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.cpp similarity index 70% rename from ApplicationCode/UserInterface/RiuWellLogCurve.cpp rename to ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.cpp index a4ec3ea0e2..25ab39b761 100644 --- a/ApplicationCode/UserInterface/RiuWellLogCurve.cpp +++ b/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.cpp @@ -17,7 +17,7 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RiuWellLogCurve.h" +#include "RiuLineSegmentQwtPlotCurve.h" #include "RigWellLogCurveData.h" @@ -25,21 +25,21 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuWellLogCurve::RiuWellLogCurve() +RiuLineSegmentQwtPlotCurve::RiuLineSegmentQwtPlotCurve() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuWellLogCurve::~RiuWellLogCurve() +RiuLineSegmentQwtPlotCurve::~RiuLineSegmentQwtPlotCurve() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogCurve::drawCurve(QPainter* p, int style, +void RiuLineSegmentQwtPlotCurve::drawCurve(QPainter* p, int style, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to) const { @@ -57,13 +57,19 @@ void RiuWellLogCurve::drawCurve(QPainter* p, int style, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogCurve::setCurveData(const RigWellLogCurveData* curveData) +void RiuLineSegmentQwtPlotCurve::setCurveData(const RigWellLogCurveData* curveData) { CVF_ASSERT(curveData); - std::vector validXValues = curveData->xPlotValues(); - std::vector validYValues = curveData->depthPlotValues(); - - setSamples(validXValues.data(), validYValues.data(), (int) validXValues.size()); - m_polyLineStartStopIndices = curveData->polylineStartStopIndices(); + setCurveData(curveData->xPlotValues(), curveData->depthPlotValues(), curveData->polylineStartStopIndices()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuLineSegmentQwtPlotCurve::setCurveData(const std::vector& xValues, const std::vector& yValues, const std::vector< std::pair >& lineSegmentStartStopIndices) +{ + setSamples(xValues.data(), yValues.data(), static_cast(xValues.size())); + + m_polyLineStartStopIndices = lineSegmentStartStopIndices; } diff --git a/ApplicationCode/UserInterface/RiuWellLogCurve.h b/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.h similarity index 60% rename from ApplicationCode/UserInterface/RiuWellLogCurve.h rename to ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.h index e08122864f..dd40ad1de7 100644 --- a/ApplicationCode/UserInterface/RiuWellLogCurve.h +++ b/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.h @@ -26,20 +26,34 @@ class RigWellLogCurveData; //================================================================================================== -/// -/// +// +// The PlotCurve class is able to draw a curve using line segments. If inf data is present +// in the curve data, Qwt is not able to draw a nice curve. This class assumes that inf data is removed, +// and segments to be draw are indicated by start/stop indices into curve data. +// +// Here you can see the curve segments visualized. Curve segments are drawn between vector indices. +// +// 0 - 1 +// 5 - 7 +// 9 -10 +// +// * * +// / / \ +// Curve * * * *---* +// +// Values 1.0|2.0|inf|inf|inf|1.0|2.0|1.0|inf|1.0|1.0 +// Vec index 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 //================================================================================================== -class RiuWellLogCurve : public QwtPlotCurve +class RiuLineSegmentQwtPlotCurve : public QwtPlotCurve { public: - - RiuWellLogCurve(); - virtual ~RiuWellLogCurve(); + RiuLineSegmentQwtPlotCurve(); + virtual ~RiuLineSegmentQwtPlotCurve(); void setCurveData(const RigWellLogCurveData* curveData); + void setCurveData(const std::vector& xValues, const std::vector& yValues, const std::vector< std::pair >& lineSegmentStartStopIndices); protected: - virtual void drawCurve(QPainter* p, int style, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to) const; From ab3c5c029abcc8451a9c289bb358b25ea2b9a26b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 Nov 2015 10:08:35 +0100 Subject: [PATCH 16/27] Refactored RiuLineSegmnetQwtPlotCurve Removed domain specific code Created RigCurveDataTools Use symbol to draw single values --- ApplicationCode/CMakeLists.txt | 4 +- .../RimWellLogExtractionCurveImpl-Test.cpp | 6 +- .../RimWellLogExtractionCurve.cpp | 4 +- .../ProjectDataModel/RimWellLogFileCurve.cpp | 3 +- .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../ReservoirDataModel/RigCurveDataTools.cpp | 82 +++++++++++++++++ .../ReservoirDataModel/RigCurveDataTools.h | 54 ++++++++++++ .../RigWellLogCurveData.cpp | 88 ++----------------- .../ReservoirDataModel/RigWellLogCurveData.h | 22 ----- .../RiuLineSegmentQwtPlotCurve.cpp | 39 ++++---- .../RiuLineSegmentQwtPlotCurve.h | 26 +++--- .../UserInterface/RiuTimeHistoryQwtPlot.cpp | 26 +++++- 12 files changed, 210 insertions(+), 146 deletions(-) create mode 100644 ApplicationCode/ReservoirDataModel/RigCurveDataTools.cpp create mode 100644 ApplicationCode/ReservoirDataModel/RigCurveDataTools.h diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index a8c4061212..57b5c2d616 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -84,8 +84,8 @@ set( USER_INTERFACE_FILES UserInterface/RiuTreeViewEventFilter.h UserInterface/RiuWellLogPlot.cpp UserInterface/RiuWellLogPlot.h - UserInterface/RiuWellLogCurve.cpp - UserInterface/RiuWellLogCurve.h + UserInterface/RiuLineSegmentQwtPlotCurve.cpp + UserInterface/RiuLineSegmentQwtPlotCurve.h UserInterface/RiuWellLogTrack.cpp UserInterface/RiuWellLogTrack.h UserInterface/RiuProjectPropertyView.h diff --git a/ApplicationCode/ProjectDataModel/ProjectDataModel_UnitTests/RimWellLogExtractionCurveImpl-Test.cpp b/ApplicationCode/ProjectDataModel/ProjectDataModel_UnitTests/RimWellLogExtractionCurveImpl-Test.cpp index 1597263404..f38c69b79c 100644 --- a/ApplicationCode/ProjectDataModel/ProjectDataModel_UnitTests/RimWellLogExtractionCurveImpl-Test.cpp +++ b/ApplicationCode/ProjectDataModel/ProjectDataModel_UnitTests/RimWellLogExtractionCurveImpl-Test.cpp @@ -1,6 +1,6 @@ #include "gtest/gtest.h" -#include "RigWellLogCurveData.h" +#include "RigCurveDataTools.h" #include // Needed for HUGE_VAL on Linux @@ -19,7 +19,7 @@ TEST(RimWellLogExtractionCurveImplTest, StripOffInvalidValAtEndsOfVector) values.push_back(HUGE_VAL); std::vector< std::pair > valuesIntervals; - RigWellLogCurveDataTestInterface::calculateIntervalsOfValidValues(values, &valuesIntervals); + RigCurveDataTools::calculateIntervalsOfValidValues(values, &valuesIntervals); EXPECT_EQ(1, static_cast(valuesIntervals.size())); EXPECT_EQ(2, static_cast(valuesIntervals[0].first)); @@ -43,7 +43,7 @@ TEST(RimWellLogExtractionCurveImplTest, StripOffHugeValAtEndsAndInteriorOfVector values.push_back(HUGE_VAL); std::vector< std::pair > valuesIntervals; - RigWellLogCurveDataTestInterface::calculateIntervalsOfValidValues(values, &valuesIntervals); + RigCurveDataTools::calculateIntervalsOfValidValues(values, &valuesIntervals); EXPECT_EQ(2, static_cast(valuesIntervals.size())); EXPECT_EQ(2, static_cast(valuesIntervals[0].first)); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index fbca8f08ba..fc7ffc48cb 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -255,7 +255,9 @@ void RimWellLogExtractionCurve::updatePlotData() } } - m_qwtPlotCurve->setCurveData(m_curveData.p()); + m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues().data(), static_cast(m_curveData->xPlotValues().size())); + m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); + zoomAllOwnerTrackAndPlot(); if (m_ownerQwtTrack) m_ownerQwtTrack->replot(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index ca8abfa5f5..d7678531f8 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -114,7 +114,8 @@ void RimWellLogFileCurve::updatePlotData() } } - m_qwtPlotCurve->setCurveData(m_curveData.p()); + m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues().data(), static_cast(m_curveData->xPlotValues().size())); + m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); zoomAllOwnerTrackAndPlot(); diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index 4fa870d18c..68d64de050 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -38,6 +38,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.h ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.h ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h +${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -70,6 +71,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp +${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/ReservoirDataModel/RigCurveDataTools.cpp b/ApplicationCode/ReservoirDataModel/RigCurveDataTools.cpp new file mode 100644 index 0000000000..b9a856afa4 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigCurveDataTools.cpp @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RigCurveDataTools.h" + +#include + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCurveDataTools::calculateIntervalsOfValidValues(const std::vector& values, std::vector< std::pair >* intervals) +{ + CVF_ASSERT(intervals); + + int startIdx = -1; + size_t vIdx = 0; + + size_t valueCount = values.size(); + while (vIdx < valueCount) + { + double value = values[vIdx]; + if (value == HUGE_VAL || value == -HUGE_VAL || value != value) + { + if (startIdx >= 0) + { + intervals->push_back(std::make_pair(startIdx, vIdx - 1)); + startIdx = -1; + } + } + else if (startIdx < 0) + { + startIdx = (int)vIdx; + } + + vIdx++; + } + + if (startIdx >= 0 && startIdx < ((int)valueCount)) + { + intervals->push_back(std::make_pair(startIdx, valueCount - 1)); + } +} + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCurveDataTools::computePolyLineStartStopIndices(const std::vector< std::pair >& intervals, + std::vector< std::pair >* fltrIntervals) +{ + CVF_ASSERT(fltrIntervals); + + const size_t intervalCount = intervals.size(); + if (intervalCount < 1) return; + + size_t index = 0; + for (size_t intIdx = 0; intIdx < intervalCount; intIdx++) + { + size_t intervalSize = intervals[intIdx].second - intervals[intIdx].first + 1; + fltrIntervals->push_back(std::make_pair(index, index + intervalSize - 1)); + + index += intervalSize; + } +} + diff --git a/ApplicationCode/ReservoirDataModel/RigCurveDataTools.h b/ApplicationCode/ReservoirDataModel/RigCurveDataTools.h new file mode 100644 index 0000000000..deec6c889a --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigCurveDataTools.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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 "cvfAssert.h" + +#include + + +//================================================================================================== +/// +//================================================================================================== +class RigCurveDataTools +{ +public: + static void calculateIntervalsOfValidValues(const std::vector& values, + std::vector< std::pair >* intervals); + + template + static void getValuesByIntervals(const std::vector& values, + const std::vector< std::pair >& intervals, + std::vector* filteredValues) + { + CVF_ASSERT(filteredValues); + + for (size_t intIdx = 0; intIdx < intervals.size(); intIdx++) + { + for (size_t vIdx = intervals[intIdx].first; vIdx <= intervals[intIdx].second; vIdx++) + { + filteredValues->push_back(values[vIdx]); + } + } + } + + static void computePolyLineStartStopIndices(const std::vector< std::pair >& intervals, + std::vector< std::pair >* filteredIntervals); +}; diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp index e11cf920a7..79971dbcee 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp @@ -19,6 +19,8 @@ #include "RigWellLogCurveData.h" +#include "RigCurveDataTools.h" + #include "cvfMath.h" #include "cvfAssert.h" @@ -101,7 +103,7 @@ const std::vector& RigWellLogCurveData::measuredDepths() const std::vector RigWellLogCurveData::xPlotValues() const { std::vector filteredValues; - getValuesByIntervals(m_xValues, m_intervalsOfContinousValidValues, &filteredValues); + RigCurveDataTools::getValuesByIntervals(m_xValues, m_intervalsOfContinousValidValues, &filteredValues); return filteredValues; } @@ -114,11 +116,11 @@ std::vector RigWellLogCurveData::depthPlotValues() const std::vector filteredValues; if (m_tvDepths.size()) { - getValuesByIntervals(m_tvDepths, m_intervalsOfContinousValidValues, &filteredValues); + RigCurveDataTools::getValuesByIntervals(m_tvDepths, m_intervalsOfContinousValidValues, &filteredValues); } else { - getValuesByIntervals(m_measuredDepths, m_intervalsOfContinousValidValues, &filteredValues); + RigCurveDataTools::getValuesByIntervals(m_measuredDepths, m_intervalsOfContinousValidValues, &filteredValues); } return filteredValues; @@ -130,7 +132,7 @@ std::vector RigWellLogCurveData::depthPlotValues() const std::vector< std::pair > RigWellLogCurveData::polylineStartStopIndices() const { std::vector< std::pair > lineStartStopIndices; - computePolyLineStartStopIndices(m_intervalsOfContinousValidValues, &lineStartStopIndices); + RigCurveDataTools::computePolyLineStartStopIndices(m_intervalsOfContinousValidValues, &lineStartStopIndices); return lineStartStopIndices; } @@ -142,7 +144,7 @@ std::vector< std::pair > RigWellLogCurveData::polylineStartStopI void RigWellLogCurveData::calculateIntervalsOfContinousValidValues() { std::vector< std::pair > intervalsOfValidValues; - calculateIntervalsOfValidValues(m_xValues, &intervalsOfValidValues); + RigCurveDataTools::calculateIntervalsOfValidValues(m_xValues, &intervalsOfValidValues); m_intervalsOfContinousValidValues.clear(); @@ -168,42 +170,6 @@ void RigWellLogCurveData::calculateIntervalsOfContinousValidValues() } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigWellLogCurveData::calculateIntervalsOfValidValues(const std::vector& values, std::vector< std::pair >* intervals) -{ - CVF_ASSERT(intervals); - - int startIdx = -1; - size_t vIdx = 0; - - size_t valueCount = values.size(); - while (vIdx < valueCount) - { - double value = values[vIdx]; - if (value == HUGE_VAL || value == -HUGE_VAL || value != value) - { - if (startIdx >= 0) - { - intervals->push_back(std::make_pair(startIdx, vIdx - 1)); - startIdx = -1; - } - } - else if (startIdx < 0) - { - startIdx = (int)vIdx; - } - - vIdx++; - } - - if (startIdx >= 0 && startIdx < ((int)valueCount)) - { - intervals->push_back(std::make_pair(startIdx, valueCount - 1)); - } -} - //-------------------------------------------------------------------------------------------------- /// Splits the start stop interval between cells that are not close enough. /// The depth values are expected to contain pair of depths: Depth at cell enter, and cell leave @@ -242,46 +208,6 @@ void RigWellLogCurveData::splitIntervalAtEmptySpace(const std::vector& d } } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigWellLogCurveData::getValuesByIntervals(const std::vector& values, - const std::vector< std::pair >& intervals, - std::vector* filteredValues) -{ - CVF_ASSERT(filteredValues); - - for (size_t intIdx = 0; intIdx < intervals.size(); intIdx++) - { - for (size_t vIdx = intervals[intIdx].first; vIdx <= intervals[intIdx].second; vIdx++) - { - filteredValues->push_back(values[vIdx]); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigWellLogCurveData::computePolyLineStartStopIndices(const std::vector< std::pair >& intervals, - std::vector< std::pair >* fltrIntervals) -{ - CVF_ASSERT(fltrIntervals); - - const size_t intervalCount = intervals.size(); - if (intervalCount < 1) return; - - size_t index = 0; - for (size_t intIdx = 0; intIdx < intervalCount; intIdx++) - { - size_t intervalSize = intervals[intIdx].second - intervals[intIdx].first + 1; - fltrIntervals->push_back(std::make_pair(index, index + intervalSize - 1)); - - index += intervalSize; - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.h b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.h index a5025ec98b..6ce38c8026 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.h @@ -53,18 +53,9 @@ public: private: void calculateIntervalsOfContinousValidValues(); - static void calculateIntervalsOfValidValues(const std::vector& values, - std::vector< std::pair >* intervals); static void splitIntervalAtEmptySpace(const std::vector& depthValues, size_t startIdx, size_t stopIdx, std::vector< std::pair >* intervals); - - static void getValuesByIntervals(const std::vector& values, - const std::vector< std::pair >& intervals, - std::vector* filteredValues); - static void computePolyLineStartStopIndices(const std::vector< std::pair >& intervals, - std::vector< std::pair >* filteredIntervals); - private: std::vector m_xValues; std::vector m_measuredDepths; @@ -72,18 +63,5 @@ private: bool m_isExtractionCurve; std::vector< std::pair > m_intervalsOfContinousValidValues; - - friend class RigWellLogCurveDataTestInterface; }; -//================================================================================================== -/// -//================================================================================================== -class RigWellLogCurveDataTestInterface -{ -public: - static void calculateIntervalsOfValidValues(const std::vector& values, std::vector< std::pair >* intervals) - { - RigWellLogCurveData::calculateIntervalsOfValidValues(values, intervals); - } -}; diff --git a/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.cpp b/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.cpp index 25ab39b761..2716093d55 100644 --- a/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.cpp +++ b/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.cpp @@ -19,13 +19,14 @@ #include "RiuLineSegmentQwtPlotCurve.h" -#include "RigWellLogCurveData.h" +#include "qwt_symbol.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuLineSegmentQwtPlotCurve::RiuLineSegmentQwtPlotCurve() +RiuLineSegmentQwtPlotCurve::RiuLineSegmentQwtPlotCurve(const QString &title) + : QwtPlotCurve(title) { } @@ -48,28 +49,32 @@ void RiuLineSegmentQwtPlotCurve::drawCurve(QPainter* p, int style, { for (size_t intIdx = 0; intIdx < intervalCount; intIdx++) { - QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, (int) m_polyLineStartStopIndices[intIdx].first, (int) m_polyLineStartStopIndices[intIdx].second); + if (m_polyLineStartStopIndices[intIdx].first == m_polyLineStartStopIndices[intIdx].second) + { + // Use a symbol to draw a single value, as a single value will not be visible + // when using QwtPlotCurve::drawCurve without symbols activated + + QwtSymbol symbol(QwtSymbol::XCross); + symbol.setSize(10, 10); + + QwtPlotCurve::drawSymbols(p, symbol, xMap, yMap, canvasRect, (int) m_polyLineStartStopIndices[intIdx].first, (int) m_polyLineStartStopIndices[intIdx].second); + } + else + { + QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, (int) m_polyLineStartStopIndices[intIdx].first, (int) m_polyLineStartStopIndices[intIdx].second); + } } } - else QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, from, to); + else + { + QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, from, to); + } }; //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuLineSegmentQwtPlotCurve::setCurveData(const RigWellLogCurveData* curveData) +void RiuLineSegmentQwtPlotCurve::setLineSegmentStartStopIndices(const std::vector< std::pair >& lineSegmentStartStopIndices) { - CVF_ASSERT(curveData); - - setCurveData(curveData->xPlotValues(), curveData->depthPlotValues(), curveData->polylineStartStopIndices()); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuLineSegmentQwtPlotCurve::setCurveData(const std::vector& xValues, const std::vector& yValues, const std::vector< std::pair >& lineSegmentStartStopIndices) -{ - setSamples(xValues.data(), yValues.data(), static_cast(xValues.size())); - m_polyLineStartStopIndices = lineSegmentStartStopIndices; } diff --git a/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.h b/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.h index dd40ad1de7..084eb376d9 100644 --- a/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.h +++ b/ApplicationCode/UserInterface/RiuLineSegmentQwtPlotCurve.h @@ -21,15 +21,12 @@ #include "qwt_plot_curve.h" -#include - -class RigWellLogCurveData; - //================================================================================================== // -// The PlotCurve class is able to draw a curve using line segments. If inf data is present -// in the curve data, Qwt is not able to draw a nice curve. This class assumes that inf data is removed, -// and segments to be draw are indicated by start/stop indices into curve data. +// If infinite data is present in the curve data, Qwt is not able to draw a nice curve. +// This class assumes that inf data is removed, and segments to be draw are indicated by start/stop indices into curve data. +// +// Single values in the curve are drawn using a CrossX symbol // // Here you can see the curve segments visualized. Curve segments are drawn between vector indices. // @@ -37,21 +34,20 @@ class RigWellLogCurveData; // 5 - 7 // 9 -10 // -// * * +// / ^ // / / \ -// Curve * * * *---* +// Curve / / \ ----- X // -// Values 1.0|2.0|inf|inf|inf|1.0|2.0|1.0|inf|1.0|1.0 -// Vec index 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 +// Values 1.0|2.0|inf|inf|inf|1.0|2.0|1.0|inf|1.0|1.0|inf|1.0|inf +// Vec index 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13 //================================================================================================== class RiuLineSegmentQwtPlotCurve : public QwtPlotCurve { public: - RiuLineSegmentQwtPlotCurve(); + explicit RiuLineSegmentQwtPlotCurve(const QString &title = QString::null); virtual ~RiuLineSegmentQwtPlotCurve(); - void setCurveData(const RigWellLogCurveData* curveData); - void setCurveData(const std::vector& xValues, const std::vector& yValues, const std::vector< std::pair >& lineSegmentStartStopIndices); + void setLineSegmentStartStopIndices(const std::vector< std::pair >& lineSegmentStartStopIndices); protected: virtual void drawCurve(QPainter* p, int style, @@ -59,5 +55,5 @@ protected: const QRectF& canvasRect, int from, int to) const; private: - std::vector< std::pair > m_polyLineStartStopIndices; + std::vector< std::pair > m_polyLineStartStopIndices; }; diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp index d0f8f285fc..8c3551f3ad 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp @@ -19,8 +19,12 @@ #include "RiuTimeHistoryQwtPlot.h" +#include "RigCurveDataTools.h" + #include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" +#include "RiuLineSegmentQwtPlotCurve.h" + #include "cvfAssert.h" #include "cvfColor3.h" @@ -31,6 +35,7 @@ #include "qwt_date_scale_draw.h" #include "qwt_date_scale_engine.h" + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -55,16 +60,29 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector { CVF_ASSERT(dateTimes.size() == timeHistoryValues.size()); - QwtPlotCurve* plotCurve = new QwtPlotCurve("Curve 1"); + std::vector< std::pair > intervalsOfValidValues; + RigCurveDataTools::calculateIntervalsOfValidValues(timeHistoryValues, &intervalsOfValidValues); + + std::vector filteredTimeHistoryValues; + RigCurveDataTools::getValuesByIntervals(timeHistoryValues, intervalsOfValidValues, &filteredTimeHistoryValues); + + std::vector filteredDateTimes; + RigCurveDataTools::getValuesByIntervals(dateTimes, intervalsOfValidValues, &filteredDateTimes); + + std::vector< std::pair > filteredIntervals; + RigCurveDataTools::computePolyLineStartStopIndices(intervalsOfValidValues, &filteredIntervals); + + RiuLineSegmentQwtPlotCurve* plotCurve = new RiuLineSegmentQwtPlotCurve("Curve 1"); QPolygonF points; - for (int i = 0; i < dateTimes.size(); i++) + for (int i = 0; i < filteredDateTimes.size(); i++) { - double milliSecSinceEpoch = QwtDate::toDouble(dateTimes[i]); - points << QPointF(milliSecSinceEpoch, timeHistoryValues[i]); + double milliSecSinceEpoch = QwtDate::toDouble(filteredDateTimes[i]); + points << QPointF(milliSecSinceEpoch, filteredTimeHistoryValues[i]); } plotCurve->setSamples(points); + plotCurve->setLineSegmentStartStopIndices(filteredIntervals); plotCurve->setTitle(curveName); cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(); From 2adb9279cec715dd100a3a89743100f41f751077 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 Nov 2015 10:19:18 +0100 Subject: [PATCH 17/27] (#612) Added grid to QwtPlot --- .../UserInterface/RiuTimeHistoryQwtPlot.cpp | 37 +++++++++++++------ .../UserInterface/RiuTimeHistoryQwtPlot.h | 4 +- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp index 8c3551f3ad..09fe3bd589 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp @@ -28,12 +28,13 @@ #include "cvfAssert.h" #include "cvfColor3.h" -#include "qwt_legend.h" -#include "qwt_plot_curve.h" -#include "qwt_plot_layout.h" -#include "qwt_scale_engine.h" #include "qwt_date_scale_draw.h" #include "qwt_date_scale_engine.h" +#include "qwt_legend.h" +#include "qwt_plot_curve.h" +#include "qwt_plot_grid.h" +#include "qwt_plot_layout.h" +#include "qwt_scale_engine.h" //-------------------------------------------------------------------------------------------------- @@ -42,6 +43,9 @@ RiuTimeHistoryQwtPlot::RiuTimeHistoryQwtPlot(QWidget* parent) : QwtPlot(parent) { + m_grid = new QwtPlotGrid; + m_grid->attach(this); + setDefaults(); } @@ -51,6 +55,9 @@ RiuTimeHistoryQwtPlot::RiuTimeHistoryQwtPlot(QWidget* parent) RiuTimeHistoryQwtPlot::~RiuTimeHistoryQwtPlot() { deleteAllCurves(); + + m_grid->detach(); + delete m_grid; } //-------------------------------------------------------------------------------------------------- @@ -60,17 +67,19 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector { CVF_ASSERT(dateTimes.size() == timeHistoryValues.size()); - std::vector< std::pair > intervalsOfValidValues; - RigCurveDataTools::calculateIntervalsOfValidValues(timeHistoryValues, &intervalsOfValidValues); - std::vector filteredTimeHistoryValues; - RigCurveDataTools::getValuesByIntervals(timeHistoryValues, intervalsOfValidValues, &filteredTimeHistoryValues); - std::vector filteredDateTimes; - RigCurveDataTools::getValuesByIntervals(dateTimes, intervalsOfValidValues, &filteredDateTimes); - std::vector< std::pair > filteredIntervals; - RigCurveDataTools::computePolyLineStartStopIndices(intervalsOfValidValues, &filteredIntervals); + + { + std::vector< std::pair > intervalsOfValidValues; + RigCurveDataTools::calculateIntervalsOfValidValues(timeHistoryValues, &intervalsOfValidValues); + + RigCurveDataTools::getValuesByIntervals(timeHistoryValues, intervalsOfValidValues, &filteredTimeHistoryValues); + RigCurveDataTools::getValuesByIntervals(dateTimes, intervalsOfValidValues, &filteredDateTimes); + + RigCurveDataTools::computePolyLineStartStopIndices(intervalsOfValidValues, &filteredIntervals); + } RiuLineSegmentQwtPlotCurve* plotCurve = new RiuLineSegmentQwtPlotCurve("Curve 1"); @@ -146,6 +155,10 @@ void RiuTimeHistoryQwtPlot::setDefaults() canvas()->setMouseTracking(true); canvas()->installEventFilter(this); + QPen gridPen(Qt::SolidLine); + gridPen.setColor(Qt::lightGray); + m_grid->setPen(gridPen); + enableAxis(QwtPlot::xBottom, true); enableAxis(QwtPlot::yLeft, true); enableAxis(QwtPlot::xTop, false); diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h index 1caff45db1..6f39124dc5 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h @@ -22,6 +22,7 @@ #include "qwt_plot.h" class QwtPlotCurve; +class QwtPlotGrid; //================================================================================================== // @@ -43,6 +44,7 @@ private: void setDefaults(); private: - std::vector m_plotCurves; + std::vector m_plotCurves; + QwtPlotGrid* m_grid; }; From 0bd4f4a8f94b310bb9119aa33e1e6ec9533af4b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 6 Nov 2015 10:18:55 +0100 Subject: [PATCH 18/27] (#606) (#607) Calculate visible cells statistics for geomech Refactored some in 3D info regarding geomech cases. --- .../GeoMech/GeoMechDataModel/CMakeLists.txt | 2 + .../GeoMechDataModel/RigFemNativeStatCalc.cpp | 8 +- .../RigFemNativeVisibleCellsStatCalc.cpp | 166 +++++++++++ .../RigFemNativeVisibleCellsStatCalc.h | 106 +++++++ .../RigFemPartResultsCollection.cpp | 8 + .../RigFemPartResultsCollection.h | 3 +- .../Rim3dOverlayInfoConfig.cpp | 266 ++++++++++-------- .../ProjectDataModel/Rim3dOverlayInfoConfig.h | 3 + .../RigStatisticsDataCache.cpp | 64 +++-- .../RigStatisticsMath.cpp | 53 ++-- .../ResultStatisticsCache/RigStatisticsMath.h | 4 +- 11 files changed, 509 insertions(+), 174 deletions(-) create mode 100644 ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.cpp create mode 100644 ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.h diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt b/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt index 530de2fb36..c18640672a 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt +++ b/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt @@ -27,6 +27,8 @@ add_library( ${PROJECT_NAME} RigFemScalarResultFrames.cpp RigFemNativeStatCalc.h RigFemNativeStatCalc.cpp + RigFemNativeVisibleCellsStatCalc.h + RigFemNativeVisibleCellsStatCalc.cpp RigFemFaceComparator.h RigFemPartGrid.h RigFemPartGrid.cpp diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp index 5642863662..ffca823228 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp @@ -38,7 +38,7 @@ RigFemNativeStatCalc::RigFemNativeStatCalc(RigFemPartResultsCollection* femResul //-------------------------------------------------------------------------------------------------- void RigFemNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) { - for (int pIdx = 0; pIdx < static_cast(m_resultsData->m_femPartResults.size()); ++pIdx) + for (int pIdx = 0; pIdx < m_resultsData->partCount(); ++pIdx) { const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex); @@ -68,7 +68,7 @@ void RigFemNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& //-------------------------------------------------------------------------------------------------- void RigFemNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) { - for (int pIdx = 0; pIdx < static_cast(m_resultsData->m_femPartResults.size()); ++pIdx) + for (int pIdx = 0; pIdx < m_resultsData->partCount(); ++pIdx) { const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex); @@ -99,7 +99,7 @@ void RigFemNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos void RigFemNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) { int tsIdx = static_cast(timeStepIndex); - int partCount = static_cast(m_resultsData->m_femPartResults.size()); + int partCount = m_resultsData->partCount(); for (int pIdx = 0; pIdx < partCount; ++pIdx) { @@ -128,7 +128,7 @@ void RigFemNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& //-------------------------------------------------------------------------------------------------- void RigFemNativeStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) { - int partCount = static_cast(m_resultsData->m_femPartResults.size()); + int partCount = m_resultsData->partCount(); for (int pIdx = 0; pIdx < partCount; ++pIdx) { const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, static_cast(timeStepIndex)); diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.cpp new file mode 100644 index 0000000000..cc7ed6b31c --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.cpp @@ -0,0 +1,166 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + + +#include "RigFemNativeVisibleCellsStatCalc.h" +#include "RigFemScalarResultFrames.h" +#include "RigFemPartResultsCollection.h" + +#include +#include "RigStatisticsMath.h" +#include "RigGeoMechCaseData.h" +#include "RigFemPartCollection.h" +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFemNativeVisibleCellsStatCalc::RigFemNativeVisibleCellsStatCalc(RigGeoMechCaseData* femCase, + const RigFemResultAddress& resVarAddr, + const cvf::UByteArray* cellVisibilities) +: m_caseData(femCase), m_resVarAddr(resVarAddr), m_cellVisibilities(cellVisibilities) +{ + m_resultsData = femCase->femPartResults(); +} + +class MinMaxAccumulator +{ +public: + MinMaxAccumulator(double initMin, double initMax): max(initMax), min(initMin) {} + void addValue(double value) + { + if (value == HUGE_VAL) // TODO + { + return; + } + + if (value < min) + { + min = value; + } + + if (value > max) + { + max = value; + } + } + + double max; + double min; +}; + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemNativeVisibleCellsStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) +{ + MinMaxAccumulator acc(min, max); + traverseElementNodes(acc, timeStepIndex); + min = acc.min; + max = acc.max; +} + + +class PosNegAccumulator +{ +public: + PosNegAccumulator(double initPos, double initNeg): pos(initPos), neg(initNeg) {} + void addValue(double value) + { + if (value == HUGE_VAL) + { + return; + } + + if (value < pos && value > 0) + { + pos = value; + } + + if (value > neg && value < 0) + { + neg = value; + } + } + + double pos; + double neg; +}; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemNativeVisibleCellsStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) +{ + PosNegAccumulator acc(pos, neg); + traverseElementNodes(acc, timeStepIndex); + pos = acc.pos; + neg = acc.neg; + +} + +class SumCountAccumulator +{ +public: + SumCountAccumulator(double initSum, size_t initCount): valueSum(initSum), sampleCount(initCount) {} + + void addValue(double value) + { + if (value == HUGE_VAL || value != value) + { + return; + } + + valueSum += value; + ++sampleCount; + } + + double valueSum; + size_t sampleCount; +}; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemNativeVisibleCellsStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) +{ + SumCountAccumulator acc(valueSum, sampleCount); + traverseElementNodes(acc, timeStepIndex); + valueSum = acc.valueSum; + sampleCount = acc.sampleCount; +} + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemNativeVisibleCellsStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) +{ + traverseElementNodes(histogramCalculator, timeStepIndex); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigFemNativeVisibleCellsStatCalc::timeStepCount() +{ + return m_resultsData->frameCount(); +} + + diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.h new file mode 100644 index 0000000000..cc2eb0b342 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.h @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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 "RigStatisticsCalculator.h" +#include "RigFemResultAddress.h" +#include "cvfArray.h" + +class RigGeoMechCaseData; +class RigFemPartResultsCollection; + + +class RigFemNativeVisibleCellsStatCalc : public RigStatisticsCalculator +{ +public: + RigFemNativeVisibleCellsStatCalc(RigGeoMechCaseData* femCase, + const RigFemResultAddress& resVarAddr, + const cvf::UByteArray* cellVisibilities); + + virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max); + virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg); + virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount); + virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator); + virtual size_t timeStepCount(); + +private: + RigGeoMechCaseData* m_caseData; + RigFemPartResultsCollection* m_resultsData; + RigFemResultAddress m_resVarAddr; + cvf::cref m_cellVisibilities; + + template + void traverseElementNodes(StatisticsAccumulator& accumulator, size_t timeStepIndex) + { + int partCount = m_caseData->femParts()->partCount(); + + if (m_resVarAddr.resultPosType == RIG_NODAL) + { + for (int pIdx = 0; pIdx < partCount; ++pIdx) + { + RigFemPart* part = m_caseData->femParts()->part(pIdx); + const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex); + int elmCount = part->elementCount(); + + for (int elmIdx = 0; elmIdx < elmCount; ++elmIdx) + { + if (!(*m_cellVisibilities)[elmIdx]) continue; + + int elmNodeCount = RigFemTypes::elmentNodeCount(part->elementType(elmIdx)); + for (int elmLocIdx = 0; elmLocIdx < elmNodeCount; ++elmLocIdx) + { + size_t elmNodeResIdx = part->elementNodeResultIdx(elmIdx, elmLocIdx); + int nodeIdx = part->nodeIdxFromElementNodeResultIdx(elmNodeResIdx); + accumulator.addValue(values[nodeIdx]); + } + } + } + } + else + { + for (int pIdx = 0; pIdx < partCount; ++pIdx) + { + RigFemPart* part = m_caseData->femParts()->part(pIdx); + const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex); + int elmCount = part->elementCount(); + + for (int elmIdx = 0; elmIdx < elmCount; ++elmIdx) + { + if (!(*m_cellVisibilities)[elmIdx]) continue; + + int elmNodeCount = RigFemTypes::elmentNodeCount(part->elementType(elmIdx)); + for (int elmLocIdx = 0; elmLocIdx < elmNodeCount; ++elmLocIdx) + { + size_t elmNodeResIdx = part->elementNodeResultIdx(elmIdx, elmLocIdx); + accumulator.addValue(values[elmNodeResIdx]); + } + } + } + } + } + +}; + + + diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index 493f626c54..763ad3626a 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -821,3 +821,11 @@ const std::vector& RigFemPartResultsCollection::scalarValuesHistogram(co return this->statistics(resVarAddr)->cellScalarValuesHistogram(frameIndex); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RigFemPartResultsCollection::partCount() const +{ + return m_femParts->partCount(); +} + diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h index 8980de73c3..fe02ace9d8 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h @@ -43,7 +43,7 @@ public: std::vector stepNames(); bool assertResultsLoaded(const RigFemResultAddress& resVarAddr); const std::vector& resultValues(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex); - + int partCount() const; int frameCount(); @@ -67,7 +67,6 @@ private: RigFemScalarResultFrames* calculateBarConvertedResult(int partIndex, const RigFemResultAddress &convertedResultAddr, const std::string fieldNameToConvert); RigFemScalarResultFrames* calculateEnIpPorBarResult(int partIndex, const RigFemResultAddress &convertedResultAddr); - friend class RigFemNativeStatCalc; cvf::Collection m_femPartResults; cvf::ref m_readerInterface; cvf::cref m_femParts; diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index a22a6bf821..95e21c2632 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -42,6 +42,7 @@ #include "RigFemPartResultsCollection.h" #include "RigStatisticsDataCache.h" +#include "RigFemNativeVisibleCellsStatCalc.h" CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig"); //-------------------------------------------------------------------------------------------------- @@ -89,7 +90,7 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig() CAF_PDM_InitFieldNoDefault(&m_statisticsTimeRange, "StatisticsTimeRange", "Statistics Time Range", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_statisticsCellRange, "StatisticsCellRange", "Statistics Cell Range", "", "", ""); - m_statisticsCellRange.uiCapability()->setUiHidden(true); + //m_statisticsCellRange.uiCapability()->setUiHidden(true); } //-------------------------------------------------------------------------------------------------- @@ -143,6 +144,8 @@ void Rim3dOverlayInfoConfig::update3DInfo() m_viewDef->viewer()->showInfoText(showInfoText()); m_viewDef->viewer()->showHistogram(false); m_viewDef->viewer()->showAnimationProgress(showAnimProgress()); + + m_isVisCellStatUpToDate = false; RimEclipseView * reservoirView = dynamic_cast(m_viewDef.p()); if (reservoirView) updateEclipse3DInfo(reservoirView); @@ -217,7 +220,8 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView) if (reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult()) { infoText += QString("Cell Property: %1 ").arg(propName); - // Wait until regression tests confirm new statisticks is ok infoText += QString("
Statistics for: ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText(); + // Wait until regression tests confirm new statisticks is ok : + //infoText += QString("
Statistics for: ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText(); if (m_statisticsCellRange == ALL_CELLS) { @@ -349,116 +353,30 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView) //-------------------------------------------------------------------------------------------------- void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) { - if (showInfoText()) + RimGeoMechCase* geoMechCase = geoMechView->geoMechCase(); + RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL; + bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult(); + + // Retreive result stats if needed + + double min = HUGE_VAL, max = HUGE_VAL; + double p10 = HUGE_VAL, p90 = HUGE_VAL; + double mean = HUGE_VAL; + const std::vector* histogram = NULL; + + if (showInfoText() || showHistogram()) { - QString infoText; - - RimGeoMechCase* geoMechCase = geoMechView->geoMechCase(); - RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL; - RigFemPartCollection* femParts = caseData ? caseData->femParts() : NULL; - - if (femParts) + if (isResultsInfoRelevant) { - QString caseName = geoMechCase->caseUserDescription(); - QString cellCount = QString("%1").arg(femParts->totalElementCount()); - QString zScale = QString::number(geoMechView->scaleZ()); - - infoText = QString( - "

-- %1 --

" - "Cell count: %2 Z-Scale: %3
").arg(caseName, cellCount, zScale); - - if (geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult()) + RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); + if (m_statisticsCellRange == ALL_CELLS) { - QString resultPos; - QString fieldName = geoMechView->cellResult()->resultFieldUiName(); - QString compName = geoMechView->cellResult()->resultComponentUiName(); - - if (!fieldName.isEmpty()) - { - switch (geoMechView->cellResult()->resultPositionType()) - { - case RIG_NODAL: - resultPos = "Nodal"; - break; - - case RIG_ELEMENT_NODAL: - resultPos = "Element nodal"; - break; - - case RIG_INTEGRATION_POINT: - resultPos = "Integration point"; - break; - - default: - break; - } - - infoText += QString("Cell result: %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName); - - double min = HUGE_VAL, max = HUGE_VAL; - double p10 = HUGE_VAL, p90 = HUGE_VAL; - double mean = HUGE_VAL; - - RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); - - if (m_statisticsTimeRange == ALL_TIMESTEPS) - { - caseData->femPartResults()->meanScalarValue (resAddress, &mean); - caseData->femPartResults()->minMaxScalarValues(resAddress,&min, &max); - caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90); - } - else if (m_statisticsTimeRange == CURRENT_TIMESTEP) - { - int timeStepIdx = geoMechView->currentTimeStep(); - caseData->femPartResults()->meanScalarValue (resAddress, timeStepIdx, &mean); - caseData->femPartResults()->minMaxScalarValues(resAddress, timeStepIdx, &min, &max); - caseData->femPartResults()->p10p90ScalarValues(resAddress, timeStepIdx, &p10, &p90); - } - - infoText += QString("

Min P10 Mean P90 Max
" - "" - "" - "
Min P10 Mean P90 Max
%1 %2 %3 %4 %5
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); - } - else - { - infoText += QString("
"); - } - - int currentTimeStep = geoMechView->currentTimeStep(); - QString stepName = QString::fromStdString(caseData->femPartResults()->stepNames()[currentTimeStep]); - infoText += QString("Time Step: %1 Time: %2").arg(currentTimeStep).arg(stepName); - } - } - - geoMechView->viewer()->setInfoText(infoText); - } - - if (showHistogram()) - { - if (geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult()) - { - geoMechView->viewer()->showHistogram(true); - - // ToDo: Implement statistics for geomech data - - RimGeoMechCase* geoMechCase = geoMechView->geoMechCase(); - RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL; - - if (caseData) - { - double min = HUGE_VAL, max = HUGE_VAL; - double p10 = HUGE_VAL, p90 = HUGE_VAL; - double mean = HUGE_VAL; - const std::vector* histogram = NULL; - - RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); - if (m_statisticsTimeRange == ALL_TIMESTEPS) { caseData->femPartResults()->meanScalarValue(resAddress, &mean); caseData->femPartResults()->minMaxScalarValues(resAddress, &min, &max); caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90); + histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress)); } else if (m_statisticsTimeRange == CURRENT_TIMESTEP) @@ -467,16 +385,144 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) caseData->femPartResults()->meanScalarValue(resAddress, timeStepIdx, &mean); caseData->femPartResults()->minMaxScalarValues(resAddress, timeStepIdx, &min, &max); caseData->femPartResults()->p10p90ScalarValues(resAddress, timeStepIdx, &p10, &p90); + histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress, timeStepIdx)); } - else - { - CVF_ASSERT(false); - } + } + else if (m_statisticsCellRange == VISIBLE_CELLS) + { + this->updateVisCellStatsIfNeeded(); - geoMechView->viewer()->setHistogram(min, max, *histogram); - geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean); + if (m_statisticsTimeRange == ALL_TIMESTEPS) + { + // TODO: Only valid if we have no dynamic property filter + m_visibleCellStatistics->meanCellScalarValues(mean); + m_visibleCellStatistics->minMaxCellScalarValues(min, max); + m_visibleCellStatistics->p10p90CellScalarValues(p10, p90); + + histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram()); + } + else if (m_statisticsTimeRange == CURRENT_TIMESTEP) + { + int timeStepIdx = geoMechView->currentTimeStep(); + m_visibleCellStatistics->meanCellScalarValues(timeStepIdx, mean); + m_visibleCellStatistics->minMaxCellScalarValues(timeStepIdx, min, max); + m_visibleCellStatistics->p10p90CellScalarValues(timeStepIdx, p10, p90); + + histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(timeStepIdx)); + } } } } + + // Compose text + + if (showInfoText()) + { + QString infoText; + + RigFemPartCollection* femParts = caseData ? caseData->femParts() : NULL; + + if (femParts) + { + QString caseName = geoMechCase->caseUserDescription(); + QString cellCount = QString("%1").arg(femParts->totalElementCount()); + QString zScale = QString::number(geoMechView->scaleZ()); + + infoText = QString( + "

-- %1 --

" + "Cell count: %2 Z-Scale: %3
").arg(caseName, cellCount, zScale); + } + + if (isResultsInfoRelevant) + { + { + QString resultPos; + QString fieldName = geoMechView->cellResult()->resultFieldUiName(); + QString compName = geoMechView->cellResult()->resultComponentUiName(); + + switch (geoMechView->cellResult()->resultPositionType()) + { + case RIG_NODAL: + resultPos = "Nodal"; + break; + + case RIG_ELEMENT_NODAL: + resultPos = "Element nodal"; + break; + + case RIG_INTEGRATION_POINT: + resultPos = "Integration point"; + break; + + default: + break; + } + + infoText += QString("Cell result: %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName); + } + { + + infoText += QString("" + "" + "" + "
Min P10 Mean P90 Max
%1 %2 %3 %4 %5
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); + + + } + { + int currentTimeStep = geoMechView->currentTimeStep(); + QString stepName = QString::fromStdString(caseData->femPartResults()->stepNames()[currentTimeStep]); + infoText += QString("Time Step: %1 Time: %2").arg(currentTimeStep).arg(stepName); + } + } + + + geoMechView->viewer()->setInfoText(infoText); + } + + // Populate histogram + + if (showHistogram()) + { + if (isResultsInfoRelevant) + { + geoMechView->viewer()->showHistogram(true); + geoMechView->viewer()->setHistogram(min, max, *histogram); + geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded() +{ + RimEclipseView * eclipseView = dynamic_cast(m_viewDef.p()); + RimGeoMechView * geoMechView = dynamic_cast(m_viewDef.p()); + + if (!m_isVisCellStatUpToDate) + { + cvf::ref calc; + if (geoMechView) + { + RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); + calc = new RigFemNativeVisibleCellsStatCalc(geoMechView->geoMechCase()->geoMechData(), + resAddress, + geoMechView->currentTotalCellVisibility().p()); + m_visibleCellStatistics = new RigStatisticsDataCache(calc.p()); + m_isVisCellStatUpToDate = true; + } + else if (eclipseView) + { + // RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); + // cvf::ref calc = new RigEclipseNativeVisibleCellsStatCalc(geoMechView->geoMechCase()->geoMechData(), + // resAddress, + // geoMechView->currentTotalCellVisibility().p()); + } + + m_visibleCellStatistics = new RigStatisticsDataCache(calc.p()); + m_isVisCellStatUpToDate = true; + } } diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h index 4391f3c393..ef291904e4 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h @@ -81,6 +81,9 @@ private: cvf::Vec2ui m_position; + void updateVisCellStatsIfNeeded(); + + bool m_isVisCellStatUpToDate; cvf::ref m_visibleCellStatistics; }; diff --git a/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp b/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp index dff04de95e..774278f324 100644 --- a/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp +++ b/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp @@ -31,6 +31,8 @@ RigStatisticsDataCache::RigStatisticsDataCache(RigStatisticsCalculator* statisticsCalculator) : m_statisticsCalculator(statisticsCalculator) { + CVF_ASSERT(m_statisticsCalculator.notNull()); + clearAllStatistics(); } @@ -153,6 +155,40 @@ void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& p posNearZero = m_statsPrTs[timeStepIndex].m_posClosestToZero; negNearZero = m_statsPrTs[timeStepIndex].m_negClosestToZero; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsDataCache::meanCellScalarValues(double& meanValue) +{ + if (!m_statsAllTimesteps.m_isMeanCalculated) + { + m_statisticsCalculator->meanCellScalarValue(m_statsAllTimesteps.m_meanValue); + + m_statsAllTimesteps.m_isMeanCalculated = true; + } + + meanValue = m_statsAllTimesteps.m_meanValue; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsDataCache::meanCellScalarValues(size_t timeStepIndex, double& meanValue) +{ + if (timeStepIndex >= m_statsPrTs.size()) + { + m_statsPrTs.resize(timeStepIndex + 1); + } + + if (!m_statsPrTs[timeStepIndex].m_isMeanCalculated) + { + m_statisticsCalculator->meanCellScalarValue(timeStepIndex, m_statsPrTs[timeStepIndex].m_meanValue); + m_statsPrTs[timeStepIndex].m_isMeanCalculated = true; + } + + meanValue = m_statsPrTs[timeStepIndex].m_meanValue; +} + //-------------------------------------------------------------------------------------------------- /// @@ -196,34 +232,6 @@ void RigStatisticsDataCache::p10p90CellScalarValues(size_t timeStepIndex, double p90 = m_statsPrTs[timeStepIndex].m_p90; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigStatisticsDataCache::meanCellScalarValues(double& meanValue) -{ - if (!m_statsAllTimesteps.m_isMeanCalculated) - { - m_statisticsCalculator->meanCellScalarValue(m_statsAllTimesteps.m_meanValue); - m_statsAllTimesteps.m_isMeanCalculated = true; - } - - meanValue = m_statsAllTimesteps.m_meanValue; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigStatisticsDataCache::meanCellScalarValues(size_t timeStepIndex, double& meanValue) -{ - if (!m_statsPrTs[timeStepIndex].m_isMeanCalculated) - { - m_statisticsCalculator->meanCellScalarValue(timeStepIndex, m_statsPrTs[timeStepIndex].m_meanValue); - m_statsPrTs[timeStepIndex].m_isMeanCalculated = true; - } - - meanValue = m_statsPrTs[timeStepIndex].m_meanValue; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.cpp b/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.cpp index c63eed6991..dcaac02f1f 100644 --- a/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.cpp +++ b/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.cpp @@ -186,7 +186,28 @@ RigHistogramCalculator::RigHistogramCalculator(double min, double max, size_t nB for (size_t i = 0; i < m_histogram->size(); ++i) (*m_histogram)[i] = 0; m_range = max - min; - maxIndex = nBins-1; + m_maxIndex = nBins-1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigHistogramCalculator::addValue(double value) +{ + if (value == HUGE_VAL || value != value) + { + return; + } + + size_t index = 0; + + if (m_maxIndex > 0) index = (size_t)(m_maxIndex*(value - m_min)/m_range); + + if (index < m_histogram->size()) // Just clip to the max min range (-index will overflow to positive ) + { + (*m_histogram)[index]++; + m_observationCount++; + } } //-------------------------------------------------------------------------------------------------- @@ -197,20 +218,7 @@ void RigHistogramCalculator::addData(const std::vector& data) assert(m_histogram); for (size_t i = 0; i < data.size(); ++i) { - if (data[i] == HUGE_VAL) - { - continue; - } - - size_t index = 0; - - if (maxIndex > 0) index = (size_t)(maxIndex*(data[i] - m_min)/m_range); - - if(index < m_histogram->size()) // Just clip to the max min range (-index will overflow to positive ) - { - (*m_histogram)[index]++; - m_observationCount++; - } + addValue(data[i]); } } @@ -222,20 +230,7 @@ void RigHistogramCalculator::addData(const std::vector& data) assert(m_histogram); for (size_t i = 0; i < data.size(); ++i) { - if (data[i] == HUGE_VAL) - { - continue; - } - - size_t index = 0; - - if (maxIndex > 0) index = (size_t)(maxIndex*(data[i] - m_min)/m_range); - - if(index < m_histogram->size()) // Just clip to the max min range (-index will overflow to positive ) - { - (*m_histogram)[index]++; - m_observationCount++; - } + addValue(data[i]); } } diff --git a/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.h b/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.h index 59de3160ab..741edf2eb2 100644 --- a/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.h +++ b/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.h @@ -41,6 +41,8 @@ public: void addData(const std::vector& data); void addData(const std::vector& data); + void addValue(double value); + /// Calculates the estimated percentile from the histogram. /// the percentile is the domain value at which pVal of the observations are below it. /// Will only consider observed values between min and max, as all other values are discarded from the histogram @@ -48,7 +50,7 @@ public: double calculatePercentil(double pVal); private: - size_t maxIndex; + size_t m_maxIndex; double m_range; double m_min; size_t m_observationCount; From 67abe959db5d90bb8e6c6712e4f692471f933a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 6 Nov 2015 10:45:13 +0100 Subject: [PATCH 19/27] (#606) Made each node-result count only once --- .../RigFemNativeVisibleCellsStatCalc.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.h index cc2eb0b342..3bc76dbadc 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.h @@ -61,8 +61,12 @@ private: { RigFemPart* part = m_caseData->femParts()->part(pIdx); const std::vector& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex); - int elmCount = part->elementCount(); + size_t nodeCount = values.size(); + cvf::UByteArray nodeVisibilities(nodeCount); + nodeVisibilities.setAll(false); + + int elmCount = part->elementCount(); for (int elmIdx = 0; elmIdx < elmCount; ++elmIdx) { if (!(*m_cellVisibilities)[elmIdx]) continue; @@ -72,6 +76,14 @@ private: { size_t elmNodeResIdx = part->elementNodeResultIdx(elmIdx, elmLocIdx); int nodeIdx = part->nodeIdxFromElementNodeResultIdx(elmNodeResIdx); + nodeVisibilities[nodeIdx] = true; + } + } + + for (size_t nodeIdx = 0; nodeIdx < nodeCount; ++nodeIdx) + { + if (nodeVisibilities[nodeIdx]) + { accumulator.addValue(values[nodeIdx]); } } From 4f05c0d6b99bfdba60ea0986fd6c8d3a5a24deb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 6 Nov 2015 13:22:54 +0100 Subject: [PATCH 20/27] (#606) (#607) Added eclipse stats for visible cells --- .../RigFemNativeVisibleCellsStatCalc.cpp | 73 --------- .../Rim3dOverlayInfoConfig.cpp | 141 +++++++++--------- .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../RigEclipseNativeVisibleCellsStatCalc.cpp | 91 +++++++++++ .../RigEclipseNativeVisibleCellsStatCalc.h | 72 +++++++++ .../RigStatisticsDataCache.cpp | 2 +- .../ResultStatisticsCache/RigStatisticsMath.h | 75 ++++++++++ .../RiuSimpleHistogramWidget.cpp | 35 +++++ .../UserInterface/RiuSimpleHistogramWidget.h | 8 +- 9 files changed, 354 insertions(+), 145 deletions(-) create mode 100644 ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp create mode 100644 ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.cpp index cc7ed6b31c..b60a5ba5a2 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeVisibleCellsStatCalc.cpp @@ -37,33 +37,6 @@ RigFemNativeVisibleCellsStatCalc::RigFemNativeVisibleCellsStatCalc(RigGeoMechCas m_resultsData = femCase->femPartResults(); } -class MinMaxAccumulator -{ -public: - MinMaxAccumulator(double initMin, double initMax): max(initMax), min(initMin) {} - void addValue(double value) - { - if (value == HUGE_VAL) // TODO - { - return; - } - - if (value < min) - { - min = value; - } - - if (value > max) - { - max = value; - } - } - - double max; - double min; -}; - - //-------------------------------------------------------------------------------------------------- /// @@ -77,32 +50,6 @@ void RigFemNativeVisibleCellsStatCalc::minMaxCellScalarValues(size_t timeStepInd } -class PosNegAccumulator -{ -public: - PosNegAccumulator(double initPos, double initNeg): pos(initPos), neg(initNeg) {} - void addValue(double value) - { - if (value == HUGE_VAL) - { - return; - } - - if (value < pos && value > 0) - { - pos = value; - } - - if (value > neg && value < 0) - { - neg = value; - } - } - - double pos; - double neg; -}; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -115,26 +62,6 @@ void RigFemNativeVisibleCellsStatCalc::posNegClosestToZero(size_t timeStepIndex, } -class SumCountAccumulator -{ -public: - SumCountAccumulator(double initSum, size_t initCount): valueSum(initSum), sampleCount(initCount) {} - - void addValue(double value) - { - if (value == HUGE_VAL || value != value) - { - return; - } - - valueSum += value; - ++sampleCount; - } - - double valueSum; - size_t sampleCount; -}; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 95e21c2632..1ce6ef516f 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -43,6 +43,7 @@ #include "RigStatisticsDataCache.h" #include "RigFemNativeVisibleCellsStatCalc.h" +#include "RigEclipseNativeVisibleCellsStatCalc.h" CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig"); //-------------------------------------------------------------------------------------------------- @@ -174,6 +175,65 @@ void Rim3dOverlayInfoConfig::setReservoirView(RimView* ownerReservoirView) //-------------------------------------------------------------------------------------------------- void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView) { + double min = HUGE_VAL, max = HUGE_VAL; + double p10 = HUGE_VAL, p90 = HUGE_VAL; + double mean = HUGE_VAL; + const std::vector* histogram = NULL; + + bool isResultsInfoRelevant = reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult(); + + if (showHistogram() || showInfoText()) + { + if (isResultsInfoRelevant) + { + size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex(); + if (m_statisticsCellRange == ALL_CELLS) + { + if (m_statisticsTimeRange == ALL_TIMESTEPS) + { + reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max); + reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90); + reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean); + histogram = &(reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex)); + } + else if (m_statisticsTimeRange == CURRENT_TIMESTEP ) + { + int timeStepIdx = reservoirView->currentTimeStep(); + reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, timeStepIdx, min, max); + reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, timeStepIdx, p10, p90); + reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean); + histogram = &(reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex, timeStepIdx)); + } + else + { + CVF_ASSERT(false); + } + } + else if ( m_statisticsCellRange == VISIBLE_CELLS) + { + updateVisCellStatsIfNeeded(); + if (m_statisticsTimeRange == ALL_TIMESTEPS) + { + // TODO: Only valid if we have no dynamic property filter + m_visibleCellStatistics->meanCellScalarValues(mean); + m_visibleCellStatistics->minMaxCellScalarValues(min, max); + m_visibleCellStatistics->p10p90CellScalarValues(p10, p90); + + histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram()); + } + else if (m_statisticsTimeRange == CURRENT_TIMESTEP) + { + int currentTimeStep = reservoirView->currentTimeStep(); + m_visibleCellStatistics->meanCellScalarValues(currentTimeStep, mean); + m_visibleCellStatistics->minMaxCellScalarValues(currentTimeStep, min, max); + m_visibleCellStatistics->p10p90CellScalarValues(currentTimeStep, p10, p90); + + histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(currentTimeStep)); + } + } + } + } + if (showInfoText()) { QString caseName; @@ -217,39 +277,17 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView) infoText += QString("Cell Property: %1 ").arg(propName); } - if (reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult()) + if (isResultsInfoRelevant) { infoText += QString("Cell Property: %1 ").arg(propName); // Wait until regression tests confirm new statisticks is ok : //infoText += QString("
Statistics for: ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText(); - if (m_statisticsCellRange == ALL_CELLS) - { - double min = HUGE_VAL, max = HUGE_VAL; - double p10 = HUGE_VAL, p90 = HUGE_VAL; - double mean = HUGE_VAL; - - size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex(); - if (m_statisticsTimeRange == ALL_TIMESTEPS) - { - reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max); - reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90); - reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean); - } - else if (m_statisticsTimeRange == CURRENT_TIMESTEP) - { - int timeStepIdx = reservoirView->currentTimeStep(); - reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, timeStepIdx, min, max); - reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, timeStepIdx, p10, p90); - reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean); - } - - infoText += QString("" - "" - "" - "
Min P10 Mean P90 Max
%1 %2 %3 %4 %5
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); - } + infoText += QString("" + "" + "" + "
Min P10 Mean P90 Max
%1 %2 %3 %4 %5
").arg(min).arg(p10).arg(mean).arg(p90).arg(max); if (reservoirView->faultResultSettings()->hasValidCustomResult()) { @@ -309,41 +347,11 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView) if (showHistogram()) { - if (reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult()) + if (isResultsInfoRelevant) { - if (m_statisticsCellRange == ALL_CELLS) - { - double min = HUGE_VAL, max = HUGE_VAL; - double p10 = HUGE_VAL, p90 = HUGE_VAL; - double mean = HUGE_VAL; - const std::vector* histogram = NULL; - - size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex(); - - if (m_statisticsTimeRange == ALL_TIMESTEPS) - { - reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max); - reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90); - reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean); - histogram = &(reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex)); - } - else if (m_statisticsTimeRange == CURRENT_TIMESTEP ) - { - int timeStepIdx = reservoirView->currentTimeStep(); - reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, timeStepIdx, min, max); - reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, timeStepIdx, p10, p90); - reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean); - histogram = &(reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex, timeStepIdx)); - } - else - { - CVF_ASSERT(false); - } - - reservoirView->viewer()->showHistogram(true); - reservoirView->viewer()->setHistogram(min, max, *histogram); - reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean); - } + reservoirView->viewer()->showHistogram(true); + reservoirView->viewer()->setHistogram(min, max, *histogram); + reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean); } } } @@ -511,15 +519,14 @@ void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded() calc = new RigFemNativeVisibleCellsStatCalc(geoMechView->geoMechCase()->geoMechData(), resAddress, geoMechView->currentTotalCellVisibility().p()); - m_visibleCellStatistics = new RigStatisticsDataCache(calc.p()); - m_isVisCellStatUpToDate = true; + } else if (eclipseView) { - // RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); - // cvf::ref calc = new RigEclipseNativeVisibleCellsStatCalc(geoMechView->geoMechCase()->geoMechData(), - // resAddress, - // geoMechView->currentTotalCellVisibility().p()); + size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex(); + calc = new RigEclipseNativeVisibleCellsStatCalc(eclipseView->currentGridCellResults()->cellResults(), + scalarIndex, + eclipseView->currentTotalCellVisibility().p()); } m_visibleCellStatistics = new RigStatisticsDataCache(calc.p()); diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index 68d64de050..3afd3f2d9c 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -35,6 +35,7 @@ ${CEE_CURRENT_LIST_DIR}RigPipeInCellEvaluator.h ${CEE_CURRENT_LIST_DIR}RigResultAccessor2d.h ${CEE_CURRENT_LIST_DIR}RigTernaryResultAccessor2d.h ${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.h +${CEE_CURRENT_LIST_DIR}RigEclipseNativeVisibleCellsStatCalc.h ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.h ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h @@ -68,6 +69,7 @@ ${CEE_CURRENT_LIST_DIR}RigNNCData.cpp ${CEE_CURRENT_LIST_DIR}cvfGeometryTools.cpp ${CEE_CURRENT_LIST_DIR}RigTernaryResultAccessor2d.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.cpp +${CEE_CURRENT_LIST_DIR}RigEclipseNativeVisibleCellsStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp new file mode 100644 index 0000000000..0281f7b94d --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp @@ -0,0 +1,91 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + + +#include "RigEclipseNativeVisibleCellsStatCalc.h" + +#include +#include "RigStatisticsMath.h" +#include "RigCaseCellResultsData.h" +#include "RigActiveCellInfo.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigEclipseNativeVisibleCellsStatCalc::RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData, + size_t scalarResultIndex, + const cvf::UByteArray* cellVisibilities) +: m_caseData(cellResultsData), + m_scalarResultIndex(scalarResultIndex), + m_cellVisibilities(cellVisibilities) +{ + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseNativeVisibleCellsStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) +{ + MinMaxAccumulator acc(min, max); + traverseCells(acc, timeStepIndex); + min = acc.min; + max = acc.max; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseNativeVisibleCellsStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) +{ + PosNegAccumulator acc(pos, neg); + traverseCells(acc, timeStepIndex); + pos = acc.pos; + neg = acc.neg; + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseNativeVisibleCellsStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) +{ + SumCountAccumulator acc(valueSum, sampleCount); + traverseCells(acc, timeStepIndex); + valueSum = acc.valueSum; + sampleCount = acc.sampleCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseNativeVisibleCellsStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) +{ + traverseCells(histogramCalculator, timeStepIndex); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigEclipseNativeVisibleCellsStatCalc::timeStepCount() +{ + return m_caseData->timeStepCount(m_scalarResultIndex); +} + + diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h b/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h new file mode 100644 index 0000000000..1c58e067fc --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h @@ -0,0 +1,72 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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 "RigStatisticsCalculator.h" +#include "cvfArray.h" + +class RigCaseCellResultsData; + + +class RigEclipseNativeVisibleCellsStatCalc : public RigStatisticsCalculator +{ +public: + RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData, + size_t scalarResultIndex, + const cvf::UByteArray* cellVisibilities); + + virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max); + virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg); + virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount); + virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator); + virtual size_t timeStepCount(); + +private: + RigCaseCellResultsData* m_caseData; + size_t m_scalarResultIndex; + cvf::cref m_cellVisibilities; + + template + void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex) + { + std::vector& values = m_caseData->cellScalarResults(m_scalarResultIndex, timeStepIndex); + const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo(); + size_t cellCount = actCellInfo->reservoirCellCount(); + + CVF_TIGHT_ASSERT(cellCount == m_cellVisibilities->size()); + + for (size_t cIdx = 0; cIdx < cellCount; ++cIdx) + { + if (!(*m_cellVisibilities)[cIdx]) continue; + + size_t cellResultIndex = actCellInfo->cellResultIndex(cIdx); + + if (cellResultIndex != cvf::UNDEFINED_SIZE_T) accumulator.addValue(values[cellResultIndex]); + } + } + +}; + + + diff --git a/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp b/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp index 774278f324..acb1947449 100644 --- a/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp +++ b/ApplicationCode/ResultStatisticsCache/RigStatisticsDataCache.cpp @@ -263,7 +263,7 @@ void RigStatisticsDataCache::computeHistogramStatisticsIfNeeded(size_t timeStepI double min; double max; size_t nBins = 100; - this->minMaxCellScalarValues(min, max); + this->minMaxCellScalarValues(timeStepIndex, min, max); RigHistogramCalculator histCalc(min, max, nBins, &m_statsPrTs[timeStepIndex].m_histogram); diff --git a/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.h b/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.h index 741edf2eb2..5aac8c258a 100644 --- a/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.h +++ b/ApplicationCode/ResultStatisticsCache/RigStatisticsMath.h @@ -56,3 +56,78 @@ private: size_t m_observationCount; std::vector* m_histogram; }; + + +class MinMaxAccumulator +{ +public: + MinMaxAccumulator(double initMin, double initMax): max(initMax), min(initMin) {} + void addValue(double value) + { + if (value == HUGE_VAL) // TODO + { + return; + } + + if (value < min) + { + min = value; + } + + if (value > max) + { + max = value; + } + } + + double max; + double min; +}; + + +class PosNegAccumulator +{ +public: + PosNegAccumulator(double initPos, double initNeg): pos(initPos), neg(initNeg) {} + void addValue(double value) + { + if (value == HUGE_VAL) + { + return; + } + + if (value < pos && value > 0) + { + pos = value; + } + + if (value > neg && value < 0) + { + neg = value; + } + } + + double pos; + double neg; +}; + + +class SumCountAccumulator +{ +public: + SumCountAccumulator(double initSum, size_t initCount): valueSum(initSum), sampleCount(initCount) {} + + void addValue(double value) + { + if (value == HUGE_VAL || value != value) + { + return; + } + + valueSum += value; + ++sampleCount; + } + + double valueSum; + size_t sampleCount; +}; diff --git a/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.cpp b/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.cpp index f5384166de..11eb954553 100644 --- a/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.cpp +++ b/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.cpp @@ -105,3 +105,38 @@ void RiuSimpleHistogramWidget::setHistogramData(double min, double max, const st if (m_maxHistogramCount < m_histogramData[colIdx]) m_maxHistogramCount = m_histogramData[colIdx] ; } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSimpleHistogramWidget::setPercentiles(double pmin, double pmax) +{ + m_minPercentile = pmin; + m_maxPercentile = pmax; +} + +#define xBorder 1 +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuSimpleHistogramWidget::xPosFromColIdx(size_t colIdx) +{ + return (int)(m_x + xBorder + (m_width - 2*xBorder) * colIdx/m_histogramData.size()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuSimpleHistogramWidget::xPosFromDomainValue(double value) +{ + double range = m_max - m_min; + return (range == 0.0) ? (int)(m_x + xBorder) : (int)(m_x + xBorder + (m_width - 2*xBorder) * (value - m_min)/(m_max - m_min)); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuSimpleHistogramWidget::yPosFromCount(size_t colHeight) +{ + return (int)(m_y + m_height - 1 - (m_height - 3) * colHeight/m_maxHistogramCount); +} diff --git a/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.h b/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.h index 5ced51fa8e..2dd2a409fa 100644 --- a/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.h +++ b/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.h @@ -10,7 +10,7 @@ public: RiuSimpleHistogramWidget( QWidget * parent = 0, Qt::WindowFlags f = 0); void setHistogramData(double min, double max, const std::vector& histogram); - void setPercentiles(double pmin, double pmax) {m_minPercentile = pmin; m_maxPercentile = pmax;} + void setPercentiles(double pmin, double pmax); void setMean(double mean) {m_mean = mean;} protected: @@ -19,10 +19,10 @@ protected: private: void draw(QPainter *painter,int x, int y, int width, int height ); - int xPosFromColIdx(size_t colIdx) { return (int)(m_x + 1 + (m_width - 2 ) * colIdx/m_histogramData.size());} - int yPosFromCount(size_t colHeight) { return (int)(m_y + m_height - 1 - (m_height - 3 ) * colHeight/m_maxHistogramCount);} + int xPosFromColIdx(size_t colIdx); + int yPosFromCount(size_t colHeight); - int xPosFromDomainValue(double value) { double range = m_max - m_min; return (range == 0.0) ? (int)(m_x + 1) : (int)(m_x + 1 + (m_width - 2 ) * (value - m_min)/(m_max - m_min));} + int xPosFromDomainValue(double value); std::vector m_histogramData; double m_max; From 516c1203139150eb5eede7a29751f142507a8bc1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 9 Nov 2015 17:41:34 +0100 Subject: [PATCH 21/27] (#632) Added selection manager for items in 3D view --- .../UserInterface/RiuSelectionManager.cpp | 73 +++++++++++++ .../UserInterface/RiuSelectionManager.h | 103 ++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 ApplicationCode/UserInterface/RiuSelectionManager.cpp create mode 100644 ApplicationCode/UserInterface/RiuSelectionManager.h diff --git a/ApplicationCode/UserInterface/RiuSelectionManager.cpp b/ApplicationCode/UserInterface/RiuSelectionManager.cpp new file mode 100644 index 0000000000..fc25056989 --- /dev/null +++ b/ApplicationCode/UserInterface/RiuSelectionManager.cpp @@ -0,0 +1,73 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuSelectionManager.h" + +#include "RimEclipseView.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSelectionManager* RiuSelectionManager::instance() +{ + static RiuSelectionManager* singleton = new RiuSelectionManager; + return singleton; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSelectionManager::selectedItems(std::vector& items) const +{ + items = m_selection; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSelectionManager::setSelectedItems(const std::vector& items) +{ + CVF_ASSERT(m_selection.size() == 0); + + m_selection = items; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSelectionManager::deleteAllItems() +{ + for (size_t i = 0; i < m_selection.size(); i++) + { + delete m_selection[i]; + } + + m_selection.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuEclipseSelectionItem::RiuEclipseSelectionItem(RimEclipseView* view, size_t gridIndex, size_t cellIndex, cvf::Color3f color) + : m_view(view), + m_gridIndex(gridIndex), + m_cellIndex(cellIndex), + m_color(color) +{ +} diff --git a/ApplicationCode/UserInterface/RiuSelectionManager.h b/ApplicationCode/UserInterface/RiuSelectionManager.h new file mode 100644 index 0000000000..7e85181b4c --- /dev/null +++ b/ApplicationCode/UserInterface/RiuSelectionManager.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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 "cafPdmPointer.h" + +#include "cvfBase.h" +#include "cvfColor3.h" + +#include + +class RimEclipseView; + +class RiuSelectionItem; + +//================================================================================================== +// +// +// +//================================================================================================== +class RiuSelectionManager +{ +public: + static RiuSelectionManager* instance(); + + // Returns selected items + // Selection manager owns the selection items and is responsible for delete + void selectedItems(std::vector& items) const; + + // Set vector of items as selected items in SelectionManager + // SelectionManager takes ownership of the selection items + void setSelectedItems(const std::vector& items); + + // Deletes all items in the SelectionManager + void deleteAllItems(); + +private: + std::vector < RiuSelectionItem* > m_selection; +}; + + +//================================================================================================== +// +// +// +//================================================================================================== +class RiuSelectionItem +{ +public: + enum RiuSelectionType + { + ECLIPSE_SELECTION_OBJECT, + GEOMECH_SELECTION_OBJECT + }; + +public: + RiuSelectionItem() {} + virtual ~RiuSelectionItem() {}; + + virtual RiuSelectionType type() = 0; +}; + + +//================================================================================================== +// +// +// +//================================================================================================== +class RiuEclipseSelectionItem : public RiuSelectionItem +{ +public: + explicit RiuEclipseSelectionItem(RimEclipseView* view, size_t gridIndex, size_t cellIndex, cvf::Color3f color); + virtual ~RiuEclipseSelectionItem() {}; + + virtual RiuSelectionType type() + { + return ECLIPSE_SELECTION_OBJECT; + } + +public: + caf::PdmPointer m_view; + size_t m_gridIndex; + size_t m_cellIndex; + cvf::Color3f m_color; +}; + + From 963220dd37c57f9ebd8f10d633441bdee56aa0e0 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 9 Nov 2015 17:42:55 +0100 Subject: [PATCH 22/27] (#632) Added support for creation of mesh part from a single cell --- ApplicationCode/CMakeLists.txt | 2 + .../ModelVisualization/CMakeLists_files.cmake | 4 +- .../RivSingleCellPartGenerator.cpp | 74 +++++++++++++++++++ .../RivSingleCellPartGenerator.h | 48 ++++++++++++ .../cvfStructGridGeometryGenerator.cpp | 40 ++++++++++ .../cvfStructGridGeometryGenerator.h | 2 + 6 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.cpp create mode 100644 ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.h diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 57b5c2d616..705cf03c58 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -92,6 +92,8 @@ set( USER_INTERFACE_FILES UserInterface/RiuProjectPropertyView.cpp UserInterface/RiuTimeHistoryQwtPlot.h UserInterface/RiuTimeHistoryQwtPlot.cpp + UserInterface/RiuSelectionManager.h + UserInterface/RiuSelectionManager.cpp ) set( SOCKET_INTERFACE_FILES diff --git a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake index b17a032cf4..7c86908d4f 100644 --- a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake +++ b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake @@ -32,8 +32,7 @@ ${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapperEffectGenerator.h ${CEE_CURRENT_LIST_DIR}RivScalarMapperUtils.h ${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.h ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h - - +${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -62,6 +61,7 @@ ${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapperEffectGenerator.cpp ${CEE_CURRENT_LIST_DIR}RivScalarMapperUtils.cpp ${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.cpp ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.cpp +${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp ) diff --git a/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.cpp b/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.cpp new file mode 100644 index 0000000000..20aac2f185 --- /dev/null +++ b/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.cpp @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA +// Copyright (C) Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RivSingleCellPartGenerator.h" + +#include "RigCaseData.h" + +#include "cafEffectGenerator.h" +#include "cvfPart.h" +#include "cvfRenderStateDepth.h" +#include "cvfStructGridGeometryGenerator.h" + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RivSingleCellPartGenerator::RivSingleCellPartGenerator(RigCaseData* rigCaseData, size_t gridIndex, size_t cellIndex) + : m_rigCaseData(rigCaseData), + m_gridIndex(gridIndex), + m_cellIndex(cellIndex) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::ref RivSingleCellPartGenerator::createPart(const cvf::Color3f color) +{ + cvf::ref part = new cvf::Part; + part->setName("Hightlight part for cell index " + m_cellIndex); + part->setDrawable(createMeshDrawable().p()); + + cvf::ref eff; + caf::MeshEffectGenerator effGen(color); + eff = effGen.generateUnCachedEffect(); + + cvf::ref depth = new cvf::RenderStateDepth; + depth->enableDepthTest(false); + eff->setRenderState(depth.p()); + + part->setEffect(eff.p()); + + return part; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::ref RivSingleCellPartGenerator::createMeshDrawable() +{ + if (m_rigCaseData && + m_cellIndex != cvf::UNDEFINED_SIZE_T) + { + return cvf::StructGridGeometryGenerator::createMeshDrawableFromSingleCell(m_rigCaseData->grid(m_gridIndex), m_cellIndex); + } + + return NULL; +} diff --git a/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.h b/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.h new file mode 100644 index 0000000000..dbf8b2ad56 --- /dev/null +++ b/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA +// Copyright (C) Ceetron Solutions AS +// +// 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 "cvfDrawableGeo.h" + +namespace cvf +{ + class Part; +} + +class RigCaseData; + +//================================================================================================== +/// +/// +//================================================================================================== +class RivSingleCellPartGenerator +{ +public: + RivSingleCellPartGenerator(RigCaseData* rigCaseData, size_t gridIndex, size_t cellIndex); + + cvf::ref createPart(const cvf::Color3f color); + +private: + cvf::ref createMeshDrawable(); + +private: + RigCaseData* m_rigCaseData; + size_t m_gridIndex; + size_t m_cellIndex; +}; diff --git a/Fwk/AppFwk/CommonCode/cvfStructGridGeometryGenerator.cpp b/Fwk/AppFwk/CommonCode/cvfStructGridGeometryGenerator.cpp index e3fe26dcfa..7a724cd464 100644 --- a/Fwk/AppFwk/CommonCode/cvfStructGridGeometryGenerator.cpp +++ b/Fwk/AppFwk/CommonCode/cvfStructGridGeometryGenerator.cpp @@ -252,6 +252,46 @@ ref StructGridGeometryGenerator::createOutlineMeshDrawable(double c } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +ref StructGridGeometryGenerator::createMeshDrawableFromSingleCell(const StructGridInterface* grid, size_t cellIndex) +{ + cvf::Vec3d cornerVerts[8]; + grid->cellCornerVertices(cellIndex, cornerVerts); + + std::vector vertices; + + for (int enumInt = cvf::StructGridInterface::POS_I; enumInt < cvf::StructGridInterface::NO_FACE; enumInt++) + { + cvf::StructGridInterface::FaceType face = static_cast(enumInt); + + ubyte faceConn[4]; + grid->cellFaceVertexIndices(face, faceConn); + + int n; + for (n = 0; n < 4; n++) + { + vertices.push_back(cvf::Vec3f(cornerVerts[faceConn[n]] - grid->displayModelOffset())); + } + } + + cvf::ref cvfVertices = new cvf::Vec3fArray; + cvfVertices->assign(vertices); + + if (!(cvfVertices.notNull() && cvfVertices->size() != 0)) return NULL; + + ref geo = new DrawableGeo; + geo->setVertexArray(cvfVertices.p()); + + ref indices = lineIndicesFromQuadVertexArray(cvfVertices.p()); + ref prim = new PrimitiveSetIndexedUInt(PT_LINES); + prim->setIndices(indices.p()); + + geo->addPrimitiveSet(prim.p()); + return geo; +} + //-------------------------------------------------------------------------------------------------- /// /// diff --git a/Fwk/AppFwk/CommonCode/cvfStructGridGeometryGenerator.h b/Fwk/AppFwk/CommonCode/cvfStructGridGeometryGenerator.h index 953043654d..03ba0642bb 100644 --- a/Fwk/AppFwk/CommonCode/cvfStructGridGeometryGenerator.h +++ b/Fwk/AppFwk/CommonCode/cvfStructGridGeometryGenerator.h @@ -187,6 +187,8 @@ public: ref createMeshDrawable(); ref createOutlineMeshDrawable(double creaseAngle); + static ref createMeshDrawableFromSingleCell(const StructGridInterface* grid, size_t cellIndex); + private: static ref lineIndicesFromQuadVertexArray(const Vec3fArray* vertexArray); From 7cd2cd0f50089add7767706824dc2ca9a8932b25 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 9 Nov 2015 19:05:00 +0100 Subject: [PATCH 23/27] (#632) Add Eclipse cell to selection and show in 3D view and time history plot Consolidated remove of model based on name in RimView Cleanup selection and time history plot when project is closed --- .../Application/RiaApplication.cpp | 3 + .../ProjectDataModel/RimEclipseView.cpp | 99 ++++++++++++------- ApplicationCode/ProjectDataModel/RimView.cpp | 20 ++++ ApplicationCode/ProjectDataModel/RimView.h | 4 +- .../UserInterface/RiuMainWindow.cpp | 2 + .../UserInterface/RiuSelectionManager.cpp | 8 ++ .../UserInterface/RiuSelectionManager.h | 4 + .../UserInterface/RiuTimeHistoryQwtPlot.cpp | 7 +- .../UserInterface/RiuTimeHistoryQwtPlot.h | 9 +- .../UserInterface/RiuViewerCommands.cpp | 41 +++++++- 10 files changed, 150 insertions(+), 47 deletions(-) diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 6c85decc4b..855b10e198 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -66,6 +66,7 @@ #include "RiuMainWindow.h" #include "RiuProcessMonitor.h" +#include "RiuSelectionManager.h" #include "RiuViewer.h" #include "cafAppEnum.h" @@ -608,6 +609,8 @@ bool RiaApplication::closeProject(bool askToSaveIfDirty) } } + RiuSelectionManager::instance()->deleteAllItems(); + mainWnd->cleanupGuiBeforeProjectClose(); caf::EffectGenerator::clearEffectCache(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 268ddd07fc..9d4ae8fda6 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -22,33 +22,42 @@ #include "RiaApplication.h" #include "RiaPreferences.h" + #include "RigCaseCellResultsData.h" #include "RigCaseData.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" + #include "Rim3dOverlayInfoConfig.h" -#include "RimEclipseCase.h" #include "RimCellEdgeColors.h" -#include "RimEclipsePropertyFilterCollection.h" #include "RimCellRangeFilterCollection.h" -#include "RimFaultCollection.h" -#include "RimEclipseFaultColors.h" -#include "RimOilField.h" -#include "RimProject.h" +#include "RimEclipseCase.h" #include "RimEclipseCellColors.h" -#include "RimTernaryLegendConfig.h" +#include "RimEclipseFaultColors.h" +#include "RimEclipsePropertyFilterCollection.h" #include "RimEclipseWell.h" #include "RimEclipseWellCollection.h" +#include "RimFaultCollection.h" +#include "RimOilField.h" +#include "RimProject.h" +#include "RimTernaryLegendConfig.h" +#include "RimViewController.h" +#include "RimViewLinker.h" #include "RimWellPathCollection.h" + #include "RiuMainWindow.h" +#include "RiuSelectionManager.h" #include "RiuViewer.h" + #include "RivReservoirPipesPartMgr.h" +#include "RivSingleCellPartGenerator.h" #include "RivTernarySaturationOverlayItem.h" #include "RivWellPathCollectionPartMgr.h" #include "cafCadNavigation.h" #include "cafCeetronPlusNavigation.h" #include "cafFrameAnimationControl.h" +#include "cafPdmUiTreeOrdering.h" #include "cvfDrawable.h" #include "cvfModelBasicList.h" @@ -61,9 +70,6 @@ #include #include -#include "RimViewLinker.h" -#include "RimViewController.h" -#include "cafPdmUiTreeOrdering.h" @@ -644,20 +650,8 @@ void RimEclipseView::updateCurrentTimeStep() // Well pipes // ---------- cvf::String wellPipeModelName = "WellPipeModel"; - std::vector wellPipeModels; - for (cvf::uint i = 0; i < frameScene->modelCount(); i++) - { - if (frameScene->model(i)->name() == wellPipeModelName) - { - wellPipeModels.push_back(frameScene->model(i)); - } - } - for (size_t i = 0; i < wellPipeModels.size(); i++) - { - //printf("updateCurrentTimeStep: Remove WellPipeModel %i from frameScene, for frame %i\n", i, m_currentTimeStep.v()); - frameScene->removeModel(wellPipeModels[i]); - } + this->removeModelByName(frameScene, wellPipeModelName); cvf::ref wellPipeModelBasicList = new cvf::ModelBasicList; wellPipeModelBasicList->setName(wellPipeModelName); @@ -680,6 +674,51 @@ void RimEclipseView::updateCurrentTimeStep() mainGrid->characteristicIJCellSize(), currentActiveCellInfo()->geometryBoundingBox(), m_reservoirGridPartManager->scaleTransform()); + + + { + // Actions related to highlight items in scene + // + // Removed highlight model by name + // Create new highlight model with name + // Create and add selected parts + // Modify with scaletransform() + // Add parts to model + // Add model to scene + + cvf::String highlightModelName = "HighLightModel"; + + this->removeModelByName(frameScene, highlightModelName); + + cvf::ref highlightModelBasicList = new cvf::ModelBasicList; + highlightModelBasicList->setName(highlightModelName); + + RiuSelectionManager* riuSelManager = RiuSelectionManager::instance(); + std::vector items; + riuSelManager->selectedItems(items); + for (size_t i = 0; i < items.size(); i++) + { + RiuEclipseSelectionItem* eclipseSelItem = dynamic_cast(items[i]); + if (eclipseSelItem && + eclipseSelItem->m_view) + { + CVF_ASSERT(eclipseSelItem->m_view->eclipseCase()); + CVF_ASSERT(eclipseSelItem->m_view->eclipseCase()->reservoirData()); + + RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->reservoirData(), eclipseSelItem->m_gridIndex, eclipseSelItem->m_cellIndex); + + cvf::ref part = partGen.createPart(eclipseSelItem->m_color); + part->setTransform(this->scaleTransform()); + part->setPriority(10000); + + highlightModelBasicList->addPart(part.p()); + } + } + + highlightModelBasicList->updateBoundingBoxesRecursive(); + + frameScene->addModel(highlightModelBasicList.p()); + } } } @@ -1565,19 +1604,7 @@ void RimEclipseView::addWellPathsToScene(cvf::Scene* scene, CVF_ASSERT(scaleTransform); cvf::String wellPathModelName = "WellPathModel"; - std::vector wellPathModels; - for (cvf::uint i = 0; i < scene->modelCount(); i++) - { - if (scene->model(i)->name() == wellPathModelName) - { - wellPathModels.push_back(scene->model(i)); - } - } - - for (size_t i = 0; i < wellPathModels.size(); i++) - { - scene->removeModel(wellPathModels[i]); - } + this->removeModelByName(scene, wellPathModelName); // Append static Well Paths to model cvf::ref wellPathModelBasicList = new cvf::ModelBasicList; diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index 2bf4d50587..d3429e3b1b 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -746,3 +746,23 @@ void RimView::replaceRangeFilterCollectionWithOverride() this->uiCapability()->updateConnectedEditors(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimView::removeModelByName(cvf::Scene* scene, const cvf::String& modelName) +{ + std::vector modelsToBeRemoved; + for (cvf::uint i = 0; i < scene->modelCount(); i++) + { + if (scene->model(i)->name() == modelName) + { + modelsToBeRemoved.push_back(scene->model(i)); + } + } + + for (size_t i = 0; i < modelsToBeRemoved.size(); i++) + { + scene->removeModel(modelsToBeRemoved[i]); + } +} + diff --git a/ApplicationCode/ProjectDataModel/RimView.h b/ApplicationCode/ProjectDataModel/RimView.h index ec84420a08..28912acf6f 100644 --- a/ApplicationCode/ProjectDataModel/RimView.h +++ b/ApplicationCode/ProjectDataModel/RimView.h @@ -33,7 +33,6 @@ #include "cvfBase.h" #include "cvfObject.h" - #include class Rim3dOverlayInfoConfig; @@ -49,6 +48,7 @@ namespace cvf class BoundingBox; class ModelBasicList; class Scene; + class String; class Transform; } @@ -151,6 +151,8 @@ protected: const cvf::BoundingBox& wellPathClipBoundingBox, cvf::Transform* scaleTransform); + static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName); + virtual void createDisplayModel() = 0; virtual void updateDisplayModelVisibility() = 0; virtual void clampCurrentTimestep() = 0; diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 5e5f3c0d8b..c3a4c07cfa 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -181,6 +181,8 @@ void RiuMainWindow::cleanupGuiBeforeProjectClose() setPdmRoot(NULL); setResultInfo(""); + + m_timeHistoryQwtPlot->deleteAllCurves(); if (m_pdmUiPropertyView) { diff --git a/ApplicationCode/UserInterface/RiuSelectionManager.cpp b/ApplicationCode/UserInterface/RiuSelectionManager.cpp index fc25056989..8a8c46d54a 100644 --- a/ApplicationCode/UserInterface/RiuSelectionManager.cpp +++ b/ApplicationCode/UserInterface/RiuSelectionManager.cpp @@ -48,6 +48,14 @@ void RiuSelectionManager::setSelectedItems(const std::vector& m_selection = items; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSelectionManager::appendItemToSelection(RiuSelectionItem* item) +{ + m_selection.push_back(item); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuSelectionManager.h b/ApplicationCode/UserInterface/RiuSelectionManager.h index 7e85181b4c..0089106647 100644 --- a/ApplicationCode/UserInterface/RiuSelectionManager.h +++ b/ApplicationCode/UserInterface/RiuSelectionManager.h @@ -47,6 +47,10 @@ public: // SelectionManager takes ownership of the selection items void setSelectedItems(const std::vector& items); + // Append item to selected items in SelectionManager + // SelectionManager takes ownership of the item + void appendItemToSelection(RiuSelectionItem* item); + // Deletes all items in the SelectionManager void deleteAllItems(); diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp index 09fe3bd589..6fe444881b 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp @@ -63,7 +63,7 @@ RiuTimeHistoryQwtPlot::~RiuTimeHistoryQwtPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector& dateTimes, const std::vector& timeHistoryValues) +void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector& dateTimes, const std::vector& timeHistoryValues) { CVF_ASSERT(dateTimes.size() == timeHistoryValues.size()); @@ -94,7 +94,6 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector plotCurve->setLineSegmentStartStopIndices(filteredIntervals); plotCurve->setTitle(curveName); - cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(); plotCurve->setPen(QPen(QColor(curveColor.rByte(), curveColor.gByte(), curveColor.bByte()))); plotCurve->attach(this); @@ -108,7 +107,7 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector& frameTimes, const std::vector& timeHistoryValues) +void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector& frameTimes, const std::vector& timeHistoryValues) { std::vector dateTimes; @@ -117,7 +116,7 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector dateTimes.push_back(QwtDate::toDateTime(frameTimes[i])); } - addCurve(curveName, dateTimes, timeHistoryValues); + addCurve(curveName, curveColor, dateTimes, timeHistoryValues); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h index 6f39124dc5..6737371553 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h @@ -24,6 +24,11 @@ class QwtPlotCurve; class QwtPlotGrid; +namespace cvf +{ + class Color3f; +} + //================================================================================================== // // @@ -35,8 +40,8 @@ public: RiuTimeHistoryQwtPlot(QWidget* parent = NULL); virtual ~RiuTimeHistoryQwtPlot(); - void addCurve(const QString& curveName, const std::vector& dateTimes, const std::vector& timeHistoryValues); - void addCurve(const QString& curveName, const std::vector& frameTimes, const std::vector& timeHistoryValues); + void addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector& dateTimes, const std::vector& timeHistoryValues); + void addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector& frameTimes, const std::vector& timeHistoryValues); void deleteAllCurves(); diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 465681d3d3..08c05cb0c9 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -78,6 +78,8 @@ #include #include #include "RigFemTimeHistoryResultAccessor.h" +#include "RiuSelectionManager.h" +#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" //================================================================================================== // @@ -531,6 +533,11 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM { // Delete all curves if no cell is hit mainWnd->timeHistoryPlot()->deleteAllCurves(); + + std::vector items; + RiuSelectionManager::instance()->deleteAllItems(); + + m_reservoirView->scheduleCreateDisplayModelAndRedraw(); } } @@ -567,10 +574,34 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t curveName += timeHistResultAccessor.topologyText(); std::vector timeHistoryValues = timeHistResultAccessor.timeHistoryValues(); - CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size()); - - mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, timeHistoryValues); + + cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(); + + std::vector items; + RiuSelectionManager::instance()->selectedItems(items); + + bool isItemPartOfSelection = false; + for (size_t i = 0; i < items.size(); i++) + { + RiuEclipseSelectionItem* eclSelItem = dynamic_cast(items[i]); + if (eclSelItem && + eclSelItem->m_view == eclipseView && + eclSelItem->m_gridIndex == gridIndex && + eclSelItem->m_cellIndex == cellIndex) + { + isItemPartOfSelection = true; + } + } + + if (!isItemPartOfSelection) + { + RiuSelectionManager::instance()->appendItemToSelection(new RiuEclipseSelectionItem(eclipseView, gridIndex, cellIndex, curveColor)); + + mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, timeStepDates, timeHistoryValues); + + eclipseView->scheduleCreateDisplayModelAndRedraw(); + } } } @@ -607,9 +638,11 @@ void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t } CVF_ASSERT(frameTimes.size() == timeHistoryValues.size()); + + cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(); RiuMainWindow* mainWnd = RiuMainWindow::instance(); - mainWnd->timeHistoryPlot()->addCurve(curveName, frameTimes, timeHistoryValues); + mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, frameTimes, timeHistoryValues); } } From f05385129b4b4784af59ab4952b1a4f205b23702 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 10 Nov 2015 08:58:17 +0100 Subject: [PATCH 24/27] (#632) Single click on cell gives single cell selection for curves, CTRL + click appends --- .../UserInterface/RiuViewerCommands.cpp | 27 ++++++++++++------- .../UserInterface/RiuViewerCommands.h | 4 +-- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 08c05cb0c9..80b3eeeae3 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -481,12 +481,6 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM QString pickInfo = "No hits"; QString resultInfo = ""; - bool addCurveToTimeHistoryPlot = false; - if (keyboardModifiers & Qt::ControlModifier) - { - addCurveToTimeHistoryPlot = true; - } - if (cellIndex != cvf::UNDEFINED_SIZE_T || nncIndex != cvf::UNDEFINED_SIZE_T) { RimEclipseView* eclipseView = dynamic_cast(m_reservoirView.p()); @@ -503,7 +497,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM pickInfo = textBuilder.topologyText(", "); - if (addCurveToTimeHistoryPlot) addTimeHistoryCurve(eclipseView, gridIndex, cellIndex); + addTimeHistoryCurve(eclipseView, gridIndex, cellIndex, keyboardModifiers); } else if (geomView) { @@ -516,7 +510,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM pickInfo = textBuilder.topologyText(", "); - if (addCurveToTimeHistoryPlot) addTimeHistoryCurve(geomView, gridIndex, cellIndex, localIntersectionPoint); + addTimeHistoryCurve(geomView, gridIndex, cellIndex, localIntersectionPoint, keyboardModifiers); } } @@ -548,7 +542,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex) +void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex, Qt::KeyboardModifiers keyboardModifiers) { RiuMainWindow* mainWnd = RiuMainWindow::instance(); if (!mainWnd->timeHistoryPlot()->isVisible()) return; @@ -596,6 +590,12 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t if (!isItemPartOfSelection) { + if (!(keyboardModifiers & Qt::ControlModifier)) + { + mainWnd->timeHistoryPlot()->deleteAllCurves(); + RiuSelectionManager::instance()->deleteAllItems(); + } + RiuSelectionManager::instance()->appendItemToSelection(new RiuEclipseSelectionItem(eclipseView, gridIndex, cellIndex, curveColor)); mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, timeStepDates, timeHistoryValues); @@ -608,7 +608,7 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint) +void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint, Qt::KeyboardModifiers keyboardModifiers) { RiuMainWindow* mainWnd = RiuMainWindow::instance(); if (!mainWnd->timeHistoryPlot()->isVisible()) return; @@ -642,6 +642,13 @@ void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(); RiuMainWindow* mainWnd = RiuMainWindow::instance(); + + if (!(keyboardModifiers & Qt::ControlModifier)) + { + mainWnd->timeHistoryPlot()->deleteAllCurves(); + RiuSelectionManager::instance()->deleteAllItems(); + } + mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, frameTimes, timeHistoryValues); } } diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.h b/ApplicationCode/UserInterface/RiuViewerCommands.h index 3a3dcd44be..dcca840e92 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.h +++ b/ApplicationCode/UserInterface/RiuViewerCommands.h @@ -63,8 +63,8 @@ private: void createSliceRangeFilter(int ijOrk); void extractIntersectionData(const cvf::HitItemCollection& hitItems, cvf::Vec3d* localIntersectionPoint, cvf::Part** firstPart, uint* firstPartFaceHit, cvf::Part** nncPart, uint* nncPartFaceHit); void updateSelectionFromPickedPart(cvf::Part* part); - void addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex); - void addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint); + void addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex, Qt::KeyboardModifiers keyboardModifiers); + void addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint, Qt::KeyboardModifiers keyboardModifiers); size_t m_currentGridIdx; size_t m_currentCellIndex; From 21ed13d61ae680244a8cef3ef29bfcaad913f9f0 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 10 Nov 2015 09:02:27 +0100 Subject: [PATCH 25/27] Upped version to 1.5.100-dev --- ResInsightVersion.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index b3b9777ce4..2dcf9847ee 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,9 +1,9 @@ set(CMAKE_MAJOR_VERSION 1) -set(CMAKE_MINOR_VERSION 3) -set(CMAKE_PATCH_VERSION 106) -# set(DEV_VERSION "-dev") -set(DEV_VERSION "-RC") +set(CMAKE_MINOR_VERSION 5) +set(CMAKE_PATCH_VERSION 100) +set(DEV_VERSION "-dev") + # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 2f70abb90d832f70b5ca439b40a50202f4ca2526 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 10 Nov 2015 09:06:44 +0100 Subject: [PATCH 26/27] (#632) Minimum widget size of time history plot is set to zero --- .../UserInterface/RiuTimeHistoryQwtPlot.cpp | 16 ++++++++++++++++ .../UserInterface/RiuTimeHistoryQwtPlot.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp index 6fe444881b..1d867517e5 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp @@ -133,6 +133,22 @@ void RiuTimeHistoryQwtPlot::deleteAllCurves() m_plotCurves.clear(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QSize RiuTimeHistoryQwtPlot::sizeHint() const +{ + return QSize(0, 0); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QSize RiuTimeHistoryQwtPlot::minimumSizeHint() const +{ + return QSize(0, 0); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h index 6737371553..4a7ad625da 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.h @@ -45,6 +45,10 @@ public: void deleteAllCurves(); +protected: + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + private: void setDefaults(); From 17493070ac0d3e37e10b27a6f8cea906f147ee6e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 10 Nov 2015 09:43:56 +0100 Subject: [PATCH 27/27] (#632) Improved colors used for selection and time history curves --- ApplicationCode/CMakeLists.txt | 2 + .../UserInterface/RiuSelectionColors.cpp | 57 +++++++++++++++++++ .../UserInterface/RiuSelectionColors.h | 33 +++++++++++ .../UserInterface/RiuSelectionManager.cpp | 8 +++ .../UserInterface/RiuSelectionManager.h | 2 + .../UserInterface/RiuTimeHistoryQwtPlot.cpp | 3 +- .../UserInterface/RiuViewerCommands.cpp | 19 ++++--- 7 files changed, 115 insertions(+), 9 deletions(-) create mode 100644 ApplicationCode/UserInterface/RiuSelectionColors.cpp create mode 100644 ApplicationCode/UserInterface/RiuSelectionColors.h diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 705cf03c58..f3e6b490c2 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -94,6 +94,8 @@ set( USER_INTERFACE_FILES UserInterface/RiuTimeHistoryQwtPlot.cpp UserInterface/RiuSelectionManager.h UserInterface/RiuSelectionManager.cpp + UserInterface/RiuSelectionColors.h + UserInterface/RiuSelectionColors.cpp ) set( SOCKET_INTERFACE_FILES diff --git a/ApplicationCode/UserInterface/RiuSelectionColors.cpp b/ApplicationCode/UserInterface/RiuSelectionColors.cpp new file mode 100644 index 0000000000..ec2c6d2431 --- /dev/null +++ b/ApplicationCode/UserInterface/RiuSelectionColors.cpp @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuSelectionColors.h" + +#include + +static const int RI_SELECTION_COLOR_COUNT = 7; +static const int RI_SELECTION_COLOR[] = +{ + Qt::magenta, + Qt::cyan, + Qt::blue, + Qt::red, + Qt::green, + Qt::yellow, + Qt::gray +}; + +static int riuSelectionColorIndex = 0; + +//-------------------------------------------------------------------------------------------------- +/// Pick default curve color from an index based palette +//-------------------------------------------------------------------------------------------------- +cvf::Color3f RiuSelectionColors::curveColorFromTable() +{ + QColor color = QColor(Qt::GlobalColor(RI_SELECTION_COLOR[riuSelectionColorIndex % RI_SELECTION_COLOR_COUNT])); + ++riuSelectionColorIndex; + cvf::Color3f cvfColor(color.redF(), color.greenF(), color.blueF()); + return cvfColor; +} + +//-------------------------------------------------------------------------------------------------- +/// Color rarely present in result value colors +//-------------------------------------------------------------------------------------------------- +cvf::Color3f RiuSelectionColors::singleCurveColor() +{ + riuSelectionColorIndex = 0; + + return curveColorFromTable(); +} diff --git a/ApplicationCode/UserInterface/RiuSelectionColors.h b/ApplicationCode/UserInterface/RiuSelectionColors.h new file mode 100644 index 0000000000..b0dbceaf2d --- /dev/null +++ b/ApplicationCode/UserInterface/RiuSelectionColors.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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 "cvfBase.h" +#include "cvfColor3.h" + +//================================================================================================== +/// +//================================================================================================== +class RiuSelectionColors +{ +public: + static cvf::Color3f curveColorFromTable(); + static cvf::Color3f singleCurveColor(); +}; diff --git a/ApplicationCode/UserInterface/RiuSelectionManager.cpp b/ApplicationCode/UserInterface/RiuSelectionManager.cpp index 8a8c46d54a..524ac234b1 100644 --- a/ApplicationCode/UserInterface/RiuSelectionManager.cpp +++ b/ApplicationCode/UserInterface/RiuSelectionManager.cpp @@ -69,6 +69,14 @@ void RiuSelectionManager::deleteAllItems() m_selection.clear(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuSelectionManager::isEmpty() const +{ + return m_selection.size() == 0; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuSelectionManager.h b/ApplicationCode/UserInterface/RiuSelectionManager.h index 0089106647..397b1c5fdc 100644 --- a/ApplicationCode/UserInterface/RiuSelectionManager.h +++ b/ApplicationCode/UserInterface/RiuSelectionManager.h @@ -54,6 +54,8 @@ public: // Deletes all items in the SelectionManager void deleteAllItems(); + bool isEmpty() const; + private: std::vector < RiuSelectionItem* > m_selection; }; diff --git a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp index 1d867517e5..f672f21ce2 100644 --- a/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuTimeHistoryQwtPlot.cpp @@ -21,10 +21,9 @@ #include "RigCurveDataTools.h" -#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" - #include "RiuLineSegmentQwtPlotCurve.h" +#include "cvfBase.h" #include "cvfAssert.h" #include "cvfColor3.h" diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 80b3eeeae3..eff716ad7f 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -25,13 +25,14 @@ #include "Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h" #include "Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h" -#include "RigCaseData.h" #include "RigCaseCellResultsData.h" +#include "RigCaseData.h" #include "RigFemPartCollection.h" #include "RigFemPartGrid.h" #include "RigGeoMechCaseData.h" #include "RigTimeHistoryResultAccessor.h" +#include "RigFemTimeHistoryResultAccessor.h" #include "RimCellRangeFilter.h" #include "RimCellRangeFilterCollection.h" #include "RimEclipseCase.h" @@ -50,13 +51,15 @@ #include "RimProject.h" #include "RimView.h" #include "RimViewController.h" +#include "RimWellLogFile.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" -#include "RimWellLogFile.h" #include "RiuFemResultTextBuilder.h" #include "RiuMainWindow.h" #include "RiuResultTextBuilder.h" +#include "RiuSelectionColors.h" +#include "RiuSelectionManager.h" #include "RiuTimeHistoryQwtPlot.h" #include "RiuViewer.h" @@ -77,9 +80,6 @@ #include #include #include -#include "RigFemTimeHistoryResultAccessor.h" -#include "RiuSelectionManager.h" -#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" //================================================================================================== // @@ -570,7 +570,6 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t std::vector timeHistoryValues = timeHistResultAccessor.timeHistoryValues(); CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size()); - cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(); std::vector items; RiuSelectionManager::instance()->selectedItems(items); @@ -596,6 +595,12 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t RiuSelectionManager::instance()->deleteAllItems(); } + cvf::Color3f curveColor = RiuSelectionColors::curveColorFromTable(); + if (RiuSelectionManager::instance()->isEmpty()) + { + curveColor = RiuSelectionColors::singleCurveColor(); + } + RiuSelectionManager::instance()->appendItemToSelection(new RiuEclipseSelectionItem(eclipseView, gridIndex, cellIndex, curveColor)); mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, timeStepDates, timeHistoryValues); @@ -639,7 +644,7 @@ void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t CVF_ASSERT(frameTimes.size() == timeHistoryValues.size()); - cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(); + cvf::Color3f curveColor = RiuSelectionColors::curveColorFromTable(); RiuMainWindow* mainWnd = RiuMainWindow::instance();