mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Clean up after review
* Disable grid lines and tick marks if x range is empty. * Rename intervals to intervalCount when it is an integer count. * Fix some compile warnings.
This commit is contained in:
@@ -196,8 +196,8 @@ QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions(const caf::P
|
|||||||
}
|
}
|
||||||
else if (fieldNeedingOptions == &m_trackLegendsHorizontal)
|
else if (fieldNeedingOptions == &m_trackLegendsHorizontal)
|
||||||
{
|
{
|
||||||
options.push_back(caf::PdmOptionItemInfo("Vertical", false));
|
options.push_back(caf::PdmOptionItemInfo("Vertical", QVariant::fromValue(false)));
|
||||||
options.push_back(caf::PdmOptionItemInfo("Horizontal", true));
|
options.push_back(caf::PdmOptionItemInfo("Horizontal", QVariant::fromValue(true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
(*useOptionsOnly) = true;
|
(*useOptionsOnly) = true;
|
||||||
|
|||||||
@@ -285,6 +285,10 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
|||||||
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
|
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
|
||||||
m_wellLogTrackPlotWidget->replot();
|
m_wellLogTrackPlotWidget->replot();
|
||||||
m_isAutoScaleXEnabled = false;
|
m_isAutoScaleXEnabled = false;
|
||||||
|
bool emptyRange = std::abs(m_visibleXRangeMax() - m_visibleXRangeMin) < 1.0e-6 * std::max(1.0, std::max(m_visibleXRangeMax(), m_visibleXRangeMin()));
|
||||||
|
m_explicitTickIntervals.uiCapability()->setUiReadOnly(emptyRange);
|
||||||
|
m_showXGridLines.uiCapability()->setUiReadOnly(emptyRange);
|
||||||
|
|
||||||
updateEditors();
|
updateEditors();
|
||||||
updateParentPlotLayout();
|
updateParentPlotLayout();
|
||||||
updateAxisAndGridTickIntervals();
|
updateAxisAndGridTickIntervals();
|
||||||
@@ -465,7 +469,7 @@ void RimWellLogTrack::updateAxisAndGridTickIntervals()
|
|||||||
xMinorTickIntervals = 10;
|
xMinorTickIntervals = 10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_wellLogTrackPlotWidget->setAutoTickIntervals(xMajorTickIntervals, xMinorTickIntervals);
|
m_wellLogTrackPlotWidget->setAutoTickIntervalCounts(xMajorTickIntervals, xMinorTickIntervals);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_showXGridLines())
|
switch (m_showXGridLines())
|
||||||
@@ -685,11 +689,15 @@ void RimWellLogTrack::loadDataAndUpdate()
|
|||||||
this->updateAxisScaleEngine();
|
this->updateAxisScaleEngine();
|
||||||
this->updateFormationNamesOnPlot();
|
this->updateFormationNamesOnPlot();
|
||||||
this->applyXZoomFromVisibleRange();
|
this->applyXZoomFromVisibleRange();
|
||||||
this->updateAxisAndGridTickIntervals();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->updateAxisAndGridTickIntervals();
|
||||||
m_majorTickInterval.uiCapability()->setUiHidden(!m_explicitTickIntervals());
|
m_majorTickInterval.uiCapability()->setUiHidden(!m_explicitTickIntervals());
|
||||||
m_minorTickInterval.uiCapability()->setUiHidden(!m_explicitTickIntervals());
|
m_minorTickInterval.uiCapability()->setUiHidden(!m_explicitTickIntervals());
|
||||||
|
|
||||||
|
bool emptyRange = std::abs(m_visibleXRangeMax() - m_visibleXRangeMin) < 1.0e-6 * std::max(1.0, std::max(m_visibleXRangeMax(), m_visibleXRangeMin()));
|
||||||
|
m_explicitTickIntervals.uiCapability()->setUiReadOnly(emptyRange);
|
||||||
|
m_showXGridLines.uiCapability()->setUiReadOnly(emptyRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QwtScaleDiv RiuQwtLinearScaleEngine::divideScale(double x1, double x2, double majorStepInterval, double minorStepInterval)
|
QwtScaleDiv RiuQwtLinearScaleEngine::divideScaleWithExplicitIntervals(double x1, double x2, double majorStepInterval, double minorStepInterval)
|
||||||
{
|
{
|
||||||
QwtInterval interval(x1, x2);
|
QwtInterval interval(x1, x2);
|
||||||
QwtInterval roundedInterval = this->align(interval, majorStepInterval);
|
QwtInterval roundedInterval = this->align(interval, majorStepInterval);
|
||||||
|
|||||||
@@ -28,5 +28,5 @@
|
|||||||
class RiuQwtLinearScaleEngine : public QwtLinearScaleEngine
|
class RiuQwtLinearScaleEngine : public QwtLinearScaleEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QwtScaleDiv divideScale(double x1, double x2, double majorStepInterval, double minorStepInterval);
|
QwtScaleDiv divideScaleWithExplicitIntervals(double x1, double x2, double majorStepInterval, double minorStepInterval);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ void RiuWellLogTrack::setMajorAndMinorTickIntervals(double majorTickInterval, do
|
|||||||
if (scaleEngine)
|
if (scaleEngine)
|
||||||
{
|
{
|
||||||
QwtInterval currentRange = this->axisInterval(QwtPlot::xTop);
|
QwtInterval currentRange = this->axisInterval(QwtPlot::xTop);
|
||||||
QwtScaleDiv scaleDiv = scaleEngine->divideScale(currentRange.minValue(), currentRange.maxValue(), majorTickInterval, minorTickInterval);
|
QwtScaleDiv scaleDiv = scaleEngine->divideScaleWithExplicitIntervals(currentRange.minValue(), currentRange.maxValue(), majorTickInterval, minorTickInterval);
|
||||||
|
|
||||||
this->setAxisScaleDiv(QwtPlot::xTop, scaleDiv);
|
this->setAxisScaleDiv(QwtPlot::xTop, scaleDiv);
|
||||||
}
|
}
|
||||||
@@ -324,10 +324,10 @@ void RiuWellLogTrack::setMajorAndMinorTickIntervals(double majorTickInterval, do
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuWellLogTrack::setAutoTickIntervals(int maxMajorTickIntervals, int maxMinorTickIntervals)
|
void RiuWellLogTrack::setAutoTickIntervalCounts(int maxMajorTickIntervalCount, int maxMinorTickIntervalCount)
|
||||||
{
|
{
|
||||||
this->setAxisMaxMajor(QwtPlot::xTop, maxMajorTickIntervals);
|
this->setAxisMaxMajor(QwtPlot::xTop, maxMajorTickIntervalCount);
|
||||||
this->setAxisMaxMinor(QwtPlot::xTop, maxMinorTickIntervals);
|
this->setAxisMaxMinor(QwtPlot::xTop, maxMinorTickIntervalCount);
|
||||||
// Reapply axis limits to force Qwt to use the tick settings.
|
// Reapply axis limits to force Qwt to use the tick settings.
|
||||||
QwtInterval currentRange = this->axisInterval(QwtPlot::xTop);
|
QwtInterval currentRange = this->axisInterval(QwtPlot::xTop);
|
||||||
this->setAxisScale(QwtPlot::xTop, currentRange.minValue(), currentRange.maxValue());
|
this->setAxisScale(QwtPlot::xTop, currentRange.minValue(), currentRange.maxValue());
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
int widthScaleFactor() const;
|
int widthScaleFactor() const;
|
||||||
void enableGridLines(bool majorGridLines, bool minorGridLines);
|
void enableGridLines(bool majorGridLines, bool minorGridLines);
|
||||||
void setMajorAndMinorTickIntervals(double majorTickInterval, double minorTickInterval);
|
void setMajorAndMinorTickIntervals(double majorTickInterval, double minorTickInterval);
|
||||||
void setAutoTickIntervals(int maxMajorTickIntervals, int maxMinorTickIntervals);
|
void setAutoTickIntervalCounts(int maxMajorTickIntervalCount, int maxMinorTickIntervalCount);
|
||||||
double getCurrentMajorTickInterval() const;
|
double getCurrentMajorTickInterval() const;
|
||||||
double getCurrentMinorTickInterval() const;
|
double getCurrentMinorTickInterval() const;
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user