mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'dev' into annotation-items
This commit is contained in:
commit
7f0532999a
@ -464,6 +464,14 @@ double RiaDefines::minimumDefaultValuePlot()
|
|||||||
return -10.0;
|
return -10.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
double RiaDefines::minimumDefaultLogValuePlot()
|
||||||
|
{
|
||||||
|
return 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -135,6 +135,7 @@ namespace RiaDefines
|
|||||||
};
|
};
|
||||||
|
|
||||||
double minimumDefaultValuePlot();
|
double minimumDefaultValuePlot();
|
||||||
|
double minimumDefaultLogValuePlot();
|
||||||
double maximumDefaultValuePlot();
|
double maximumDefaultValuePlot();
|
||||||
|
|
||||||
enum PhaseType {
|
enum PhaseType {
|
||||||
|
@ -19,8 +19,10 @@
|
|||||||
#include "RicExitApplicationFeature.h"
|
#include "RicExitApplicationFeature.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicExitApplicationFeature, "RicExitApplicationFeature");
|
CAF_CMD_SOURCE_INIT(RicExitApplicationFeature, "RicExitApplicationFeature");
|
||||||
|
|
||||||
@ -42,7 +44,13 @@ void RicExitApplicationFeature::onActionTriggered(bool isChecked)
|
|||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
if (!app->askUserToSaveModifiedProject()) return;
|
if (!app->askUserToSaveModifiedProject()) return;
|
||||||
|
|
||||||
app->closeAllWindows();
|
// Hide all windows first to make sure they get closed properly
|
||||||
|
for (QWidget* topLevelWidget : app->topLevelWidgets())
|
||||||
|
{
|
||||||
|
topLevelWidget->hide();
|
||||||
|
}
|
||||||
|
// Close just the main window, it'll take care of closing the plot window
|
||||||
|
app->mainWindow()->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -40,7 +40,7 @@ void RicSwapGridCrossPlotCurveSetAxesFeature::onActionTriggered(bool isChecked)
|
|||||||
else if (caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>())
|
else if (caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>())
|
||||||
{
|
{
|
||||||
auto plot = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>();
|
auto plot = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>();
|
||||||
plot->swapAllAxisProperties();
|
plot->swapAxes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ void RimGridCrossPlot::detachAllCurves()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimGridCrossPlot::updateAxisScaling()
|
void RimGridCrossPlot::updateAxisScaling()
|
||||||
{
|
{
|
||||||
updateAxisDisplay();
|
loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -383,13 +383,11 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
|
|||||||
for (auto curveSet : m_crossPlotCurveSets)
|
for (auto curveSet : m_crossPlotCurveSets)
|
||||||
{
|
{
|
||||||
curveSet->loadDataAndUpdate(false);
|
curveSet->loadDataAndUpdate(false);
|
||||||
|
curveSet->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCurveNamesAndPlotTitle();
|
updateCurveNamesAndPlotTitle();
|
||||||
updateAllRequiredEditors();
|
updatePlot();
|
||||||
|
|
||||||
updatePlot();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -525,13 +523,29 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimGridCrossPlot::swapAllAxisProperties()
|
void RimGridCrossPlot::swapAxes()
|
||||||
{
|
{
|
||||||
|
RimPlotAxisProperties* xAxisProperties = m_xAxisProperties();
|
||||||
|
RimPlotAxisProperties* yAxisProperties = m_yAxisProperties();
|
||||||
|
|
||||||
|
QString tmpName = xAxisProperties->name();
|
||||||
|
QwtPlot::Axis tmpAxis = xAxisProperties->qwtPlotAxisType();
|
||||||
|
xAxisProperties->setNameAndAxis(yAxisProperties->name(), yAxisProperties->qwtPlotAxisType());
|
||||||
|
yAxisProperties->setNameAndAxis(tmpName, tmpAxis);
|
||||||
|
|
||||||
|
m_xAxisProperties.removeChildObject(xAxisProperties);
|
||||||
|
m_yAxisProperties.removeChildObject(yAxisProperties);
|
||||||
|
m_yAxisProperties = xAxisProperties;
|
||||||
|
m_xAxisProperties = yAxisProperties;
|
||||||
|
|
||||||
for (auto curveSet : m_crossPlotCurveSets)
|
for (auto curveSet : m_crossPlotCurveSets)
|
||||||
{
|
{
|
||||||
curveSet->swapAxisProperties(false);
|
curveSet->swapAxisProperties(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDataAndUpdate();
|
loadDataAndUpdate();
|
||||||
|
|
||||||
|
updateAxisDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -562,7 +576,6 @@ QString RimGridCrossPlot::asciiDataForPlotExport(int curveSetIndex) const
|
|||||||
formatter.setTableRowLineAppendText("");
|
formatter.setTableRowLineAppendText("");
|
||||||
formatter.setColumnSpacing(3);
|
formatter.setColumnSpacing(3);
|
||||||
|
|
||||||
|
|
||||||
m_crossPlotCurveSets[curveSetIndex]->exportFormattedData(formatter);
|
m_crossPlotCurveSets[curveSetIndex]->exportFormattedData(formatter);
|
||||||
formatter.tableCompleted();
|
formatter.tableCompleted();
|
||||||
return asciiData;
|
return asciiData;
|
||||||
@ -581,6 +594,22 @@ RiuGridCrossQwtPlot* RimGridCrossPlot::qwtPlot() const
|
|||||||
return m_qwtPlot;
|
return m_qwtPlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGridCrossPlot::isXAxisLogarithmic() const
|
||||||
|
{
|
||||||
|
return m_xAxisProperties->isLogarithmicScaleEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGridCrossPlot::isYAxisLogarithmic() const
|
||||||
|
{
|
||||||
|
return m_yAxisProperties->isLogarithmicScaleEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -676,6 +705,25 @@ void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
|
|||||||
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine);
|
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine);
|
||||||
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 5);
|
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (axisProperties->isAutoZoom())
|
||||||
|
{
|
||||||
|
std::vector<const QwtPlotCurve*> plotCurves = visibleQwtCurves();
|
||||||
|
|
||||||
|
double min, max;
|
||||||
|
RimPlotAxisLogRangeCalculator logRangeCalculator(qwtAxisId, plotCurves);
|
||||||
|
logRangeCalculator.computeAxisRange(&min, &max);
|
||||||
|
if (axisProperties->isAxisInverted())
|
||||||
|
{
|
||||||
|
std::swap(min, max);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_qwtPlot->setAxisScale(qwtAxisId, min, max);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -686,19 +734,17 @@ void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
|
|||||||
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine);
|
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine);
|
||||||
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 3);
|
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (axisProperties->isAutoZoom())
|
||||||
|
{
|
||||||
|
m_qwtPlot->setAxisAutoScale(qwtAxisId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType())->setAttribute(QwtScaleEngine::Inverted, axisProperties->isAxisInverted());
|
m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType())->setAttribute(QwtScaleEngine::Inverted, axisProperties->isAxisInverted());
|
||||||
|
|
||||||
if (axisProperties->isAutoZoom())
|
|
||||||
{
|
|
||||||
m_qwtPlot->setAxisAutoScale(qwtAxisId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -731,6 +777,28 @@ void RimGridCrossPlot::updateAxisFromQwt(RiaDefines::PlotAxis axisType)
|
|||||||
axisProperties->updateConnectedEditors();
|
axisProperties->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<const QwtPlotCurve*> RimGridCrossPlot::visibleQwtCurves() const
|
||||||
|
{
|
||||||
|
std::vector<const QwtPlotCurve*> plotCurves;
|
||||||
|
for (auto curveSet : m_crossPlotCurveSets)
|
||||||
|
{
|
||||||
|
if (curveSet->isChecked())
|
||||||
|
{
|
||||||
|
for (auto curve : curveSet->curves())
|
||||||
|
{
|
||||||
|
if (curve->isCurveVisible())
|
||||||
|
{
|
||||||
|
plotCurves.push_back(curve->qwtPlotCurve());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return plotCurves;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Name Configuration
|
/// Name Configuration
|
||||||
///
|
///
|
||||||
|
@ -70,10 +70,12 @@ public:
|
|||||||
void detachAllCurves();
|
void detachAllCurves();
|
||||||
void performAutoNameUpdate() override;
|
void performAutoNameUpdate() override;
|
||||||
void updateCurveNamesAndPlotTitle();
|
void updateCurveNamesAndPlotTitle();
|
||||||
void swapAllAxisProperties();
|
void swapAxes();
|
||||||
QString asciiTitleForPlotExport(int curveSetIndex) const;
|
QString asciiTitleForPlotExport(int curveSetIndex) const;
|
||||||
QString asciiDataForPlotExport(int curveSetIndex) const;
|
QString asciiDataForPlotExport(int curveSetIndex) const;
|
||||||
RiuGridCrossQwtPlot* qwtPlot() const;
|
RiuGridCrossQwtPlot* qwtPlot() const;
|
||||||
|
bool isXAxisLogarithmic() const;
|
||||||
|
bool isYAxisLogarithmic() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Rim2dPlotInterface overrides
|
// Rim2dPlotInterface overrides
|
||||||
@ -96,13 +98,13 @@ protected:
|
|||||||
bool* useOptionsOnly) override;
|
bool* useOptionsOnly) override;
|
||||||
|
|
||||||
void updatePlot();
|
void updatePlot();
|
||||||
void updateCurveNames();
|
|
||||||
|
|
||||||
QString xAxisParameterString() const;
|
QString xAxisParameterString() const;
|
||||||
QString yAxisParameterString() const;
|
QString yAxisParameterString() const;
|
||||||
|
|
||||||
void updateAxisInQwt(RiaDefines::PlotAxis axisType);
|
void updateAxisInQwt(RiaDefines::PlotAxis axisType);
|
||||||
void updateAxisFromQwt(RiaDefines::PlotAxis axisType);
|
void updateAxisFromQwt(RiaDefines::PlotAxis axisType);
|
||||||
|
std::vector<const QwtPlotCurve*> visibleQwtCurves() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_showLegend;
|
caf::PdmField<bool> m_showLegend;
|
||||||
@ -115,7 +117,7 @@ private:
|
|||||||
caf::PdmChildArrayField<RimGridCrossPlotCurveSet*> m_crossPlotCurveSets;
|
caf::PdmChildArrayField<RimGridCrossPlotCurveSet*> m_crossPlotCurveSets;
|
||||||
|
|
||||||
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
|
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -406,6 +406,10 @@ void RimGridCrossPlotCurveSet::onLoadDataAndUpdate(bool updateParentPlot)
|
|||||||
RigEclipseCrossPlotResult result = RigEclipseCrossPlotDataExtractor::extract(
|
RigEclipseCrossPlotResult result = RigEclipseCrossPlotDataExtractor::extract(
|
||||||
eclipseCase->eclipseCaseData(), m_timeStep(), xAddress, yAddress, m_grouping(), groupAddress, timeStepCellVisibilityMap);
|
eclipseCase->eclipseCaseData(), m_timeStep(), xAddress, yAddress, m_grouping(), groupAddress, timeStepCellVisibilityMap);
|
||||||
|
|
||||||
|
if (isXAxisLogarithmic() || isYAxisLogarithmic())
|
||||||
|
{
|
||||||
|
filterInvalidCurveValues(&result);
|
||||||
|
}
|
||||||
createCurves(result);
|
createCurves(result);
|
||||||
|
|
||||||
if (updateParentPlot)
|
if (updateParentPlot)
|
||||||
@ -877,6 +881,26 @@ void RimGridCrossPlotCurveSet::exportFormattedData(RifEclipseDataTableFormatter&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGridCrossPlotCurveSet::isXAxisLogarithmic() const
|
||||||
|
{
|
||||||
|
RimGridCrossPlot* parent = nullptr;
|
||||||
|
firstAncestorOrThisOfTypeAsserted(parent);
|
||||||
|
return parent->isXAxisLogarithmic();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGridCrossPlotCurveSet::isYAxisLogarithmic() const
|
||||||
|
{
|
||||||
|
RimGridCrossPlot* parent = nullptr;
|
||||||
|
firstAncestorOrThisOfTypeAsserted(parent);
|
||||||
|
return parent->isYAxisLogarithmic();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1001,6 +1025,42 @@ bool RimGridCrossPlotCurveSet::hasMultipleTimeSteps() const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridCrossPlotCurveSet::filterInvalidCurveValues(RigEclipseCrossPlotResult* result)
|
||||||
|
{
|
||||||
|
bool xLog = isXAxisLogarithmic();
|
||||||
|
bool yLog = isYAxisLogarithmic();
|
||||||
|
|
||||||
|
if (xLog || yLog)
|
||||||
|
{
|
||||||
|
|
||||||
|
RigEclipseCrossPlotResult validResult;
|
||||||
|
for (size_t i = 0; i < result->xValues.size(); ++i)
|
||||||
|
{
|
||||||
|
double xValue = result->xValues[i];
|
||||||
|
double yValue = result->yValues[i];
|
||||||
|
bool invalid = (xLog && xValue <= 0.0) || (yLog && yValue <= 0.0);
|
||||||
|
if (!invalid)
|
||||||
|
{
|
||||||
|
validResult.xValues.push_back(xValue);
|
||||||
|
validResult.yValues.push_back(yValue);
|
||||||
|
if (i < result->groupValuesContinuous.size())
|
||||||
|
{
|
||||||
|
validResult.groupValuesContinuous.push_back(result->groupValuesContinuous[i]);
|
||||||
|
}
|
||||||
|
if (i < result->groupValuesDiscrete.size())
|
||||||
|
{
|
||||||
|
validResult.groupValuesDiscrete.push_back(result->groupValuesDiscrete[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*result = validResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimGridCrossPlotCurveSetNameConfig, "RimGridCrossPlotCurveSetNameConfig");
|
CAF_PDM_SOURCE_INIT(RimGridCrossPlotCurveSetNameConfig, "RimGridCrossPlotCurveSetNameConfig");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -117,6 +117,9 @@ public:
|
|||||||
void swapAxisProperties(bool updatePlot);
|
void swapAxisProperties(bool updatePlot);
|
||||||
void exportFormattedData(RifEclipseDataTableFormatter& formatter) const;
|
void exportFormattedData(RifEclipseDataTableFormatter& formatter) const;
|
||||||
|
|
||||||
|
bool isXAxisLogarithmic() const;
|
||||||
|
bool isYAxisLogarithmic() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initAfterRead() override;
|
void initAfterRead() override;
|
||||||
void onLoadDataAndUpdate(bool updateParentPlot);
|
void onLoadDataAndUpdate(bool updateParentPlot);
|
||||||
@ -139,6 +142,7 @@ protected:
|
|||||||
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||||
|
|
||||||
bool hasMultipleTimeSteps() const;
|
bool hasMultipleTimeSteps() const;
|
||||||
|
void filterInvalidCurveValues(RigEclipseCrossPlotResult* result);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
caf::PdmPtrField<RimCase*> m_case;
|
caf::PdmPtrField<RimCase*> m_case;
|
||||||
@ -154,4 +158,5 @@ private:
|
|||||||
caf::PdmChildArrayField<RimGridCrossPlotCurve*> m_crossPlotCurves;
|
caf::PdmChildArrayField<RimGridCrossPlotCurve*> m_crossPlotCurves;
|
||||||
|
|
||||||
std::map<int, RigEclipseCrossPlotResult> m_groupedResults;
|
std::map<int, RigEclipseCrossPlotResult> m_groupedResults;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -239,12 +239,11 @@ void RimEclipseCellColors::uiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEclipseCellColors::setReservoirView(RimEclipseView* ownerReservoirView)
|
void RimEclipseCellColors::setReservoirView(RimEclipseView* ownerReservoirView)
|
||||||
{
|
{
|
||||||
|
m_reservoirView = ownerReservoirView;
|
||||||
if (ownerReservoirView)
|
if (ownerReservoirView)
|
||||||
{
|
{
|
||||||
this->setEclipseCase(ownerReservoirView->eclipseCase());
|
this->setEclipseCase(ownerReservoirView->eclipseCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_reservoirView = ownerReservoirView;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -20,14 +20,19 @@
|
|||||||
#include "RimPlotAxisProperties.h"
|
#include "RimPlotAxisProperties.h"
|
||||||
|
|
||||||
#include "RiaDefines.h"
|
#include "RiaDefines.h"
|
||||||
|
#include "RigStatisticsCalculator.h"
|
||||||
|
|
||||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||||
#include "RimPlotAxisAnnotation.h"
|
#include "RimPlotAxisAnnotation.h"
|
||||||
|
|
||||||
#include "cafPdmUiSliderEditor.h"
|
#include "cafPdmUiSliderEditor.h"
|
||||||
|
|
||||||
|
#include "cvfVector2.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <qwt_plot_curve.h>
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@ -229,6 +234,14 @@ QwtPlot::Axis RimPlotAxisProperties::qwtPlotAxisType() const
|
|||||||
return m_axis;
|
return m_axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimPlotAxisProperties::name() const
|
||||||
|
{
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -373,3 +386,92 @@ caf::PdmFieldHandle* RimPlotAxisProperties::objectToggleField()
|
|||||||
{
|
{
|
||||||
return &m_isActive;
|
return &m_isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimPlotAxisLogRangeCalculator::RimPlotAxisLogRangeCalculator(QwtPlot::Axis axis,
|
||||||
|
const std::vector<const QwtPlotCurve*>& qwtCurves)
|
||||||
|
: m_axis(axis)
|
||||||
|
, m_curves(qwtCurves)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotAxisLogRangeCalculator::computeAxisRange(double* minPositive, double* max) const
|
||||||
|
{
|
||||||
|
double minPosValue = HUGE_VAL;
|
||||||
|
double maxValue = -HUGE_VAL;
|
||||||
|
|
||||||
|
for (const QwtPlotCurve* curve : m_curves)
|
||||||
|
{
|
||||||
|
double minPosCurveValue = HUGE_VAL;
|
||||||
|
double maxCurveValue = -HUGE_VAL;
|
||||||
|
|
||||||
|
if (curveValueRange(curve, &minPosCurveValue, &maxCurveValue))
|
||||||
|
{
|
||||||
|
if (minPosCurveValue < minPosValue)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(minPosCurveValue > 0.0);
|
||||||
|
minPosValue = minPosCurveValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxCurveValue > maxValue)
|
||||||
|
{
|
||||||
|
maxValue = maxCurveValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minPosValue == HUGE_VAL)
|
||||||
|
{
|
||||||
|
minPosValue = RiaDefines::minimumDefaultLogValuePlot();
|
||||||
|
maxValue = RiaDefines::maximumDefaultValuePlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
*minPositive = minPosValue;
|
||||||
|
*max = maxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimPlotAxisLogRangeCalculator::curveValueRange(const QwtPlotCurve* qwtCurve, double* minPositive, double* max) const
|
||||||
|
{
|
||||||
|
if (!qwtCurve) return false;
|
||||||
|
|
||||||
|
if (qwtCurve->data()->size() < 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float minPosF = std::numeric_limits<float>::infinity();
|
||||||
|
float maxF = -std::numeric_limits<float>::infinity();
|
||||||
|
|
||||||
|
int axisValueIndex = 0;
|
||||||
|
if (m_axis == QwtPlot::yLeft || m_axis == QwtPlot::yRight)
|
||||||
|
{
|
||||||
|
axisValueIndex = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < qwtCurve->dataSize(); ++i)
|
||||||
|
{
|
||||||
|
QPointF sample = qwtCurve->sample((int) i);
|
||||||
|
cvf::Vec2f vec(sample.x(), sample.y());
|
||||||
|
float value = vec[axisValueIndex];
|
||||||
|
if (value == HUGE_VALF) continue;
|
||||||
|
|
||||||
|
maxF = std::max(maxF, value);
|
||||||
|
if (value > 0.0f && value < minPosF)
|
||||||
|
{
|
||||||
|
minPosF = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*minPositive = minPosF;
|
||||||
|
*max = maxF;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -59,7 +59,9 @@ public:
|
|||||||
|
|
||||||
void setEnableTitleTextSettings(bool enable);
|
void setEnableTitleTextSettings(bool enable);
|
||||||
void setNameAndAxis(const QString& name, QwtPlot::Axis axis);
|
void setNameAndAxis(const QString& name, QwtPlot::Axis axis);
|
||||||
|
|
||||||
QwtPlot::Axis qwtPlotAxisType() const;
|
QwtPlot::Axis qwtPlotAxisType() const;
|
||||||
|
QString name() const;
|
||||||
RiaDefines::PlotAxis plotAxisType() const;
|
RiaDefines::PlotAxis plotAxisType() const;
|
||||||
bool useAutoTitle() const;
|
bool useAutoTitle() const;
|
||||||
bool showDescription() const;
|
bool showDescription() const;
|
||||||
@ -117,3 +119,25 @@ private:
|
|||||||
|
|
||||||
caf::PdmChildArrayField<RimPlotAxisAnnotation*> m_annotations;
|
caf::PdmChildArrayField<RimPlotAxisAnnotation*> m_annotations;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class QwtPlotCurve;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimPlotAxisLogRangeCalculator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RimPlotAxisLogRangeCalculator(QwtPlot::Axis axis,
|
||||||
|
const std::vector<const QwtPlotCurve*>& qwtCurves);
|
||||||
|
|
||||||
|
void computeAxisRange(double* minPositive, double* max) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool curveValueRange(const QwtPlotCurve* qwtCurve, double* minPositive, double* max) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QwtPlot::Axis m_axis;
|
||||||
|
const std::vector<const QwtPlotCurve*> m_curves;
|
||||||
|
};
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
#include "RimSummaryCurvesCalculator.h"
|
#include "RimSummaryCurvesCalculator.h"
|
||||||
|
|
||||||
#include "RigStatisticsCalculator.h"
|
|
||||||
|
|
||||||
#include "RiaDefines.h"
|
#include "RiaDefines.h"
|
||||||
#include "RimSummaryCurve.h"
|
#include "RimSummaryCurve.h"
|
||||||
#include "RimPlotAxisProperties.h"
|
#include "RimPlotAxisProperties.h"
|
||||||
@ -319,86 +317,3 @@ std::string RimSummaryPlotYAxisFormatter::shortCalculationName(const std::string
|
|||||||
return calculationShortName.toStdString();
|
return calculationShortName.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimSummaryPlotYAxisRangeCalculator::RimSummaryPlotYAxisRangeCalculator(
|
|
||||||
const std::vector<QwtPlotCurve*>& qwtCurves,
|
|
||||||
const std::vector<double>& yValuesForAllCurves)
|
|
||||||
:
|
|
||||||
m_singleCurves(qwtCurves),
|
|
||||||
m_yValuesForAllCurves(yValuesForAllCurves)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimSummaryPlotYAxisRangeCalculator::computeYRange(double* min, double* max) const
|
|
||||||
{
|
|
||||||
double minValue = HUGE_VAL;
|
|
||||||
double maxValue = -HUGE_VAL;
|
|
||||||
|
|
||||||
for (QwtPlotCurve* curve : m_singleCurves)
|
|
||||||
{
|
|
||||||
double minCurveValue = HUGE_VAL;
|
|
||||||
double maxCurveValue = -HUGE_VAL;
|
|
||||||
|
|
||||||
if (curveValueRangeY(curve, &minCurveValue, &maxCurveValue))
|
|
||||||
{
|
|
||||||
if (minCurveValue < minValue)
|
|
||||||
{
|
|
||||||
minValue = minCurveValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxCurveValue > maxValue)
|
|
||||||
{
|
|
||||||
maxValue = maxCurveValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minValue == HUGE_VAL)
|
|
||||||
{
|
|
||||||
minValue = RiaDefines::minimumDefaultValuePlot();
|
|
||||||
maxValue = RiaDefines::maximumDefaultValuePlot();
|
|
||||||
}
|
|
||||||
|
|
||||||
// For logarithmic auto scaling, compute positive curve value closest to zero and use
|
|
||||||
// this value as the plot visible minimum
|
|
||||||
|
|
||||||
double pos = HUGE_VAL;
|
|
||||||
double neg = -HUGE_VAL;
|
|
||||||
|
|
||||||
RigStatisticsCalculator::posNegClosestToZero(m_yValuesForAllCurves, pos, neg);
|
|
||||||
|
|
||||||
if (pos != HUGE_VAL)
|
|
||||||
{
|
|
||||||
minValue = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
*min = minValue;
|
|
||||||
*max = maxValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RimSummaryPlotYAxisRangeCalculator::curveValueRangeY(const QwtPlotCurve* qwtCurve, double* min, double* max) const
|
|
||||||
{
|
|
||||||
if (!qwtCurve) return false;
|
|
||||||
|
|
||||||
if (qwtCurve->data()->size() < 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*min = qwtCurve->minYValue();
|
|
||||||
*max = qwtCurve->maxYValue();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
#include <qwt_plot.h>
|
||||||
|
|
||||||
class RimAsciiDataCurve;
|
class RimAsciiDataCurve;
|
||||||
class RimSummaryCurve;
|
class RimSummaryCurve;
|
||||||
class RimPlotAxisProperties;
|
class RimPlotAxisProperties;
|
||||||
@ -46,26 +48,9 @@ private:
|
|||||||
static std::string shortCalculationName(const std::string& calculationName);
|
static std::string shortCalculationName(const std::string& calculationName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RimPlotAxisProperties* m_axisProperties;
|
RimPlotAxisProperties* m_axisProperties;
|
||||||
const std::vector<RimSummaryCurve*> m_summaryCurves;
|
const std::vector<RimSummaryCurve*> m_summaryCurves;
|
||||||
const std::vector<RimAsciiDataCurve*> m_asciiDataCurves;
|
const std::vector<RimAsciiDataCurve*> m_asciiDataCurves;
|
||||||
const std::set<QString> m_timeHistoryCurveQuantities;
|
const std::set<QString> m_timeHistoryCurveQuantities;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class RimSummaryPlotYAxisRangeCalculator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RimSummaryPlotYAxisRangeCalculator( const std::vector<QwtPlotCurve*>& qwtCurves,
|
|
||||||
const std::vector<double>& yValuesForAllCurves);
|
|
||||||
|
|
||||||
void computeYRange(double* min, double* max) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool curveValueRangeY(const QwtPlotCurve* qwtCurve, double* min, double* max) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const std::vector<QwtPlotCurve*> m_singleCurves;
|
|
||||||
const std::vector<double> m_yValuesForAllCurves;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include "qwt_plot_curve.h"
|
#include "qwt_plot_curve.h"
|
||||||
#include "qwt_plot_renderer.h"
|
#include "qwt_plot_renderer.h"
|
||||||
#include "qwt_plot_textlabel.h"
|
#include "qwt_plot_textlabel.h"
|
||||||
|
#include "qwt_scale_engine.h"
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@ -634,33 +635,31 @@ void RimSummaryPlot::updateZoomForAxis(RiaDefines::PlotAxis plotAxis)
|
|||||||
{
|
{
|
||||||
if (yAxisProps->isLogarithmicScaleEnabled)
|
if (yAxisProps->isLogarithmicScaleEnabled)
|
||||||
{
|
{
|
||||||
std::vector<double> yValues;
|
std::vector<const QwtPlotCurve*> plotCurves;
|
||||||
std::vector<QwtPlotCurve*> plotCurves;
|
|
||||||
|
|
||||||
for (RimSummaryCurve* c : visibleSummaryCurvesForAxis(plotAxis))
|
for (RimSummaryCurve* c : visibleSummaryCurvesForAxis(plotAxis))
|
||||||
{
|
{
|
||||||
std::vector<double> curveValues = c->valuesY();
|
|
||||||
yValues.insert(yValues.end(), curveValues.begin(), curveValues.end());
|
|
||||||
plotCurves.push_back(c->qwtPlotCurve());
|
plotCurves.push_back(c->qwtPlotCurve());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RimGridTimeHistoryCurve* c : visibleTimeHistoryCurvesForAxis(plotAxis))
|
for (RimGridTimeHistoryCurve* c : visibleTimeHistoryCurvesForAxis(plotAxis))
|
||||||
{
|
{
|
||||||
std::vector<double> curveValues = c->yValues();
|
|
||||||
yValues.insert(yValues.end(), curveValues.begin(), curveValues.end());
|
|
||||||
plotCurves.push_back(c->qwtPlotCurve());
|
plotCurves.push_back(c->qwtPlotCurve());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RimAsciiDataCurve* c : visibleAsciiDataCurvesForAxis(plotAxis))
|
for (RimAsciiDataCurve* c : visibleAsciiDataCurvesForAxis(plotAxis))
|
||||||
{
|
{
|
||||||
std::vector<double> curveValues = c->yValues();
|
|
||||||
yValues.insert(yValues.end(), curveValues.begin(), curveValues.end());
|
|
||||||
plotCurves.push_back(c->qwtPlotCurve());
|
plotCurves.push_back(c->qwtPlotCurve());
|
||||||
}
|
}
|
||||||
|
|
||||||
double min, max;
|
double min, max;
|
||||||
RimSummaryPlotYAxisRangeCalculator calc(plotCurves, yValues);
|
RimPlotAxisLogRangeCalculator calc(QwtPlot::yLeft, plotCurves);
|
||||||
calc.computeYRange(&min, &max);
|
calc.computeAxisRange(&min, &max);
|
||||||
|
|
||||||
|
if (yAxisProps->isAxisInverted())
|
||||||
|
{
|
||||||
|
std::swap(min, max);
|
||||||
|
}
|
||||||
|
|
||||||
m_qwtPlot->setAxisScale(yAxisProps->qwtPlotAxisType(), min, max);
|
m_qwtPlot->setAxisScale(yAxisProps->qwtPlotAxisType(), min, max);
|
||||||
}
|
}
|
||||||
@ -673,6 +672,8 @@ void RimSummaryPlot::updateZoomForAxis(RiaDefines::PlotAxis plotAxis)
|
|||||||
{
|
{
|
||||||
m_qwtPlot->setAxisScale(yAxisProps->qwtPlotAxisType(), yAxisProps->visibleRangeMin(), yAxisProps->visibleRangeMax());
|
m_qwtPlot->setAxisScale(yAxisProps->qwtPlotAxisType(), yAxisProps->visibleRangeMin(), yAxisProps->visibleRangeMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_qwtPlot->axisScaleEngine(yAxisProps->qwtPlotAxisType())->setAttribute(QwtScaleEngine::Inverted, yAxisProps->isAxisInverted());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,11 @@ bool PdmUiTableViewDelegate::isEditorOpen() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiTableViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void PdmUiTableViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION_MAJOR > 4
|
||||||
|
QStyleOptionViewItem viewItemOption(option);
|
||||||
|
#else
|
||||||
QStyleOptionViewItemV4 viewItemOption(option);
|
QStyleOptionViewItemV4 viewItemOption(option);
|
||||||
|
#endif
|
||||||
|
|
||||||
QVariant fgText = index.data(Qt::ForegroundRole);
|
QVariant fgText = index.data(Qt::ForegroundRole);
|
||||||
|
|
||||||
|
@ -164,7 +164,11 @@ private:
|
|||||||
QRect r = rect();
|
QRect r = rect();
|
||||||
QPalette pal = palette();
|
QPalette pal = palette();
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR > 4
|
||||||
|
QStyleOptionFrame panel;
|
||||||
|
#else
|
||||||
QStyleOptionFrameV2 panel;
|
QStyleOptionFrameV2 panel;
|
||||||
|
#endif
|
||||||
initStyleOption(&panel);
|
initStyleOption(&panel);
|
||||||
style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this);
|
style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this);
|
||||||
r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
|
r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
|
||||||
|
@ -10,7 +10,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev")
|
|||||||
# Must be unique and increasing within one combination of major/minor/patch version
|
# Must be unique and increasing within one combination of major/minor/patch version
|
||||||
# The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT
|
# The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT
|
||||||
# Format of text must be ".xx"
|
# Format of text must be ".xx"
|
||||||
set(RESINSIGHT_DEV_VERSION ".03")
|
set(RESINSIGHT_DEV_VERSION ".04")
|
||||||
|
|
||||||
# https://github.com/CRAVA/crava/tree/master/libs/nrlib
|
# https://github.com/CRAVA/crava/tree/master/libs/nrlib
|
||||||
set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")
|
set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")
|
||||||
|
Loading…
Reference in New Issue
Block a user