mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3155 Slightly tweak X-autozoom so it zooms to the nearest outside minor tick.
* Looks much better and makes the problem of having tick labels overlap with neighbour tracks much rarer.
This commit is contained in:
parent
ca1f9506b1
commit
714aafc05c
@ -643,6 +643,7 @@ void RimWellLogPlot::updateTracks(bool autoScaleXAxis)
|
||||
{
|
||||
m_tracks[tIdx]->setAutoScaleXEnabled(true);
|
||||
m_tracks[tIdx]->calculateXZoomRangeAndUpdateQwt();
|
||||
m_tracks[tIdx]->updateAxisAndGridTickIntervals();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,6 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
updateParentPlotLayout();
|
||||
updateAxisAndGridTickIntervals();
|
||||
m_wellLogTrackPlotWidget->replot();
|
||||
}
|
||||
else if (changedField == &m_explicitTickIntervals)
|
||||
{
|
||||
@ -262,7 +261,6 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
if (!m_explicitTickIntervals())
|
||||
{
|
||||
updateAxisAndGridTickIntervals();
|
||||
m_wellLogTrackPlotWidget->replot();
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_xAxisGridVisibility ||
|
||||
@ -270,7 +268,6 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
changedField == &m_minorTickInterval)
|
||||
{
|
||||
updateAxisAndGridTickIntervals();
|
||||
m_wellLogTrackPlotWidget->replot();
|
||||
}
|
||||
else if (changedField == &m_visibleXRangeMin || changedField == &m_visibleXRangeMax)
|
||||
{
|
||||
@ -284,7 +281,6 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
updateEditors();
|
||||
updateParentPlotLayout();
|
||||
updateAxisAndGridTickIntervals();
|
||||
m_wellLogTrackPlotWidget->replot(); // TODO: See if we can get rid of duplicate replot
|
||||
}
|
||||
else if (changedField == &m_isAutoScaleXEnabled)
|
||||
{
|
||||
@ -495,6 +491,7 @@ void RimWellLogTrack::updateAxisAndGridTickIntervals()
|
||||
m_wellLogTrackPlotWidget->enableDepthGridLines(true, true);
|
||||
break;
|
||||
}
|
||||
m_wellLogTrackPlotWidget->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -977,6 +974,11 @@ void RimWellLogTrack::calculateXZoomRange()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_minorTickInterval() != 0.0)
|
||||
{
|
||||
std::tie(minValue, maxValue) = adjustXRange(minValue, maxValue, m_minorTickInterval());
|
||||
}
|
||||
|
||||
m_visibleXRangeMin = minValue;
|
||||
m_visibleXRangeMax = maxValue;
|
||||
|
||||
@ -1186,6 +1188,18 @@ bool RimWellLogTrack::isFirstVisibleTrackInPlot() const
|
||||
return plot->firstVisibleTrackIndex() == ownIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<double, double> RimWellLogTrack::adjustXRange(double minValue, double maxValue, double tickInterval)
|
||||
{
|
||||
double minRemainder = std::fmod(minValue, tickInterval);
|
||||
double maxRemainder = std::fmod(maxValue, tickInterval);
|
||||
double adjustedMin = minValue - minRemainder;
|
||||
double adjustedMax = maxValue + (tickInterval - maxRemainder);
|
||||
return std::make_pair(adjustedMin, adjustedMax);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -131,11 +131,11 @@ public:
|
||||
void uiOrderingForXAxisSettings(caf::PdmUiOrdering& uiOrdering);
|
||||
|
||||
void setFormationsForCaseWithSimWellOnly(bool caseWithSimWellOnly);
|
||||
void updateAxisAndGridTickIntervals();
|
||||
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
void updateParentPlotLayout();
|
||||
void updateAxisAndGridTickIntervals();
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
@ -168,6 +168,8 @@ private:
|
||||
void updateAxisScaleEngine();
|
||||
bool isFirstVisibleTrackInPlot() const;
|
||||
|
||||
std::pair<double, double> adjustXRange(double minValue, double maxValue, double tickInterval);
|
||||
|
||||
private:
|
||||
QString m_xAxisTitle;
|
||||
|
||||
|
@ -380,7 +380,7 @@ void RiuWellLogPlot::placeChildWidgets(int frameHeight, int frameWidth)
|
||||
|
||||
positionTitle(frameWidth);
|
||||
|
||||
const int trackPadding = 0;
|
||||
const int trackPadding = 2;
|
||||
|
||||
std::map<int, int> trackWidths = calculateTrackWidthsToMatchFrame(frameWidth);
|
||||
size_t visibleTrackCount = trackWidths.size();
|
||||
|
Loading…
Reference in New Issue
Block a user