#2944 Stop auto-zooming on load of Well Log Curves.

This commit is contained in:
Gaute Lindkvist 2018-05-23 11:28:57 +02:00
parent 87e91069e0
commit 208313f672
12 changed files with 122 additions and 37 deletions

View File

@ -206,7 +206,7 @@ void RicDeleteItemExec::redo()
parentObj->firstAncestorOrThisOfType(wellLogPlotTrack); parentObj->firstAncestorOrThisOfType(wellLogPlotTrack);
if (wellLogPlotTrack) if (wellLogPlotTrack)
{ {
wellLogPlotTrack->updateXZoom(); wellLogPlotTrack->calculateXZoomRangeAndUpdateQwt();
} }
// Update due to delete plots // Update due to delete plots

View File

@ -70,11 +70,13 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogTrac
for (std::set<RimWellLogTrack*>::iterator tIt = srcTracks.begin(); tIt != srcTracks.end(); ++tIt) for (std::set<RimWellLogTrack*>::iterator tIt = srcTracks.begin(); tIt != srcTracks.end(); ++tIt)
{ {
(*tIt)->updateXZoomAndParentPlotDepthZoom(); (*tIt)->updateParentPlotZoom();
(*tIt)->calculateXZoomRangeAndUpdateQwt();
} }
destTrack->loadDataAndUpdate(); destTrack->loadDataAndUpdate();
destTrack->updateXZoomAndParentPlotDepthZoom(); destTrack->updateParentPlotZoom();
destTrack->calculateXZoomRangeAndUpdateQwt();
destTrack->updateConnectedEditors(); destTrack->updateConnectedEditors();
} }

View File

@ -702,8 +702,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
updateWidgetTitleWindowTitle(); updateWidgetTitleWindowTitle();
m_wellLogPlot->loadDataAndUpdate(); m_wellLogPlot->loadDataAndUpdate();
m_wellLogPlot->updateDepthZoom(); plotTrack->calculateXZoomRange();
plotTrack->updateXZoom();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -945,6 +944,10 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
updateFormationsOnPlot(); updateFormationsOnPlot();
syncSourcesIoFieldFromGuiField(); syncSourcesIoFieldFromGuiField();
syncCurvesFromUiSelection(); syncCurvesFromUiSelection();
m_wellLogPlot->updateDepthZoom();
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
plotTrack->calculateXZoomRangeAndUpdateQwt();
} }
if ( changedField == &m_useStandardConditionCurves if ( changedField == &m_useStandardConditionCurves
@ -952,6 +955,11 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|| changedField == &m_phases) || changedField == &m_phases)
{ {
syncCurvesFromUiSelection(); syncCurvesFromUiSelection();
m_wellLogPlot->updateDepthZoom();
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
plotTrack->calculateXZoomRangeAndUpdateQwt();
} }
} }

View File

@ -113,7 +113,7 @@ void RimWellLogCurve::updateZoomInParentPlot()
firstAncestorOrThisOfType(plotTrack); firstAncestorOrThisOfType(plotTrack);
if (plotTrack) if (plotTrack)
{ {
plotTrack->updateXZoomAndParentPlotDepthZoom(); plotTrack->calculateXZoomRangeAndUpdateQwt();
} }
} }

View File

@ -48,7 +48,6 @@ public:
virtual QString wellDate() const { return ""; }; virtual QString wellDate() const { return ""; };
protected: protected:
virtual void updateZoomInParentPlot(); virtual void updateZoomInParentPlot() override;
cvf::ref<RigWellLogCurveData> m_curveData; cvf::ref<RigWellLogCurveData> m_curveData;
}; };

View File

@ -439,11 +439,17 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate(bool updateParentPlot)
} }
} }
updateZoomInParentPlot(); if (updateParentPlot)
{
updateZoomInParentPlot();
}
setLogScaleFromSelectedResult(); setLogScaleFromSelectedResult();
if (m_parentQwtPlot) m_parentQwtPlot->replot(); if (m_parentQwtPlot)
{
m_parentQwtPlot->replot();
}
} }
} }

View File

@ -168,9 +168,15 @@ void RimWellLogFileCurve::onLoadDataAndUpdate(bool updateParentPlot)
} }
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
updateZoomInParentPlot(); if (updateParentPlot)
{
updateZoomInParentPlot();
}
if (m_parentQwtPlot) m_parentQwtPlot->replot(); if (m_parentQwtPlot)
{
m_parentQwtPlot->replot();
}
} }
} }

View File

@ -127,11 +127,16 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
firstAncestorOrThisOfType(wellAllocPlot); firstAncestorOrThisOfType(wellAllocPlot);
if (wellAllocPlot) wellAllocPlot->loadDataAndUpdate(); if (wellAllocPlot) wellAllocPlot->loadDataAndUpdate();
else if (isRftPlotChild()) rftPlot()->loadDataAndUpdate(); else if (isRftPlotChild()) rftPlot()->loadDataAndUpdate();
else updateTracks(); else
{
updateTracks();
updateDepthZoom();
}
} }
if ( changedField == &m_depthUnit) if ( changedField == &m_depthUnit)
{ {
updateTracks(); updateTracks();
updateDepthZoom();
} }
if ( changedField == &m_showTrackLegends) if ( changedField == &m_showTrackLegends)
@ -395,6 +400,7 @@ void RimWellLogPlot::zoomAll()
{ {
setDepthAutoZoom(true); setDepthAutoZoom(true);
updateDepthZoom(); updateDepthZoom();
updateTracks(true);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -616,7 +622,7 @@ void RimWellLogPlot::onLoadDataAndUpdate()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogPlot::updateTracks() void RimWellLogPlot::updateTracks(bool autoScaleXAxis)
{ {
if (m_showWindow) if (m_showWindow)
{ {
@ -625,10 +631,15 @@ void RimWellLogPlot::updateTracks()
for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx) for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx)
{ {
m_tracks[tIdx]->loadDataAndUpdate(); m_tracks[tIdx]->loadDataAndUpdate();
if (autoScaleXAxis)
{
m_tracks[tIdx]->setAutoScaleXEnabled(true);
m_tracks[tIdx]->calculateXZoomRangeAndUpdateQwt();
}
} }
calculateAvailableDepthRange(); calculateAvailableDepthRange();
updateDepthZoom(); applyDepthZoomFromVisibleDepth();
} }
} }

View File

@ -84,7 +84,7 @@ public:
RimWellLogTrack* trackByIndex(size_t index); RimWellLogTrack* trackByIndex(size_t index);
void updateTracks(); void updateTracks(bool autoScaleXAxis = false);
void updateTrackNames(); void updateTrackNames();
void updateDepthZoom(); void updateDepthZoom();

View File

@ -335,9 +335,13 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot)
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
if ( updateParentPlot && m_parentQwtPlot) if (updateParentPlot)
{ {
updateZoomInParentPlot(); updateZoomInParentPlot();
}
if (m_parentQwtPlot)
{
m_parentQwtPlot->replot(); m_parentQwtPlot->replot();
} }
} }

View File

@ -239,22 +239,23 @@ 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;
updateEditors();
} }
else if (changedField == &m_isAutoScaleXEnabled) else if (changedField == &m_isAutoScaleXEnabled)
{ {
if (m_isAutoScaleXEnabled()) if (m_isAutoScaleXEnabled())
{ {
this->updateXZoom(); this->calculateXZoomRangeAndUpdateQwt();
computeAndSetXRangeMinForLogarithmicScale(); computeAndSetXRangeMinForLogarithmicScale();
if (m_wellLogTrackPlotWidget) m_wellLogTrackPlotWidget->replot(); if (m_wellLogTrackPlotWidget) m_wellLogTrackPlotWidget->replot();
} }
} }
else if (changedField == &m_isLogarithmicScaleEnabled) else if (changedField == &m_isLogarithmicScaleEnabled)
{ {
updateAxisScaleEngine(); updateAxisScaleEngine();
this->updateXZoom(); this->calculateXZoomRangeAndUpdateQwt();
computeAndSetXRangeMinForLogarithmicScale(); computeAndSetXRangeMinForLogarithmicScale();
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax); m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
@ -557,7 +558,7 @@ void RimWellLogTrack::loadDataAndUpdate()
m_wellLogTrackPlotWidget->updateLegend(); m_wellLogTrackPlotWidget->updateLegend();
this->updateAxisScaleEngine(); this->updateAxisScaleEngine();
this->updateFormationNamesOnPlot(); this->updateFormationNamesOnPlot();
this->updateXZoomAndParentPlotDepthZoom(); this->applyXZoomFromVisibleRange();
} }
} }
@ -609,6 +610,14 @@ void RimWellLogTrack::setAndUpdateSimWellFormationNamesData(RimCase* rimCase, co
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setAutoScaleXEnabled(bool enabled)
{
m_isAutoScaleXEnabled = enabled;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -698,7 +707,7 @@ void RimWellLogTrack::detachAllCurves()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateXZoomAndParentPlotDepthZoom() void RimWellLogTrack::updateParentPlotZoom()
{ {
if (m_wellLogTrackPlotWidget) if (m_wellLogTrackPlotWidget)
{ {
@ -708,17 +717,31 @@ void RimWellLogTrack::updateXZoomAndParentPlotDepthZoom()
{ {
wellLogPlot->updateDepthZoom(); wellLogPlot->updateDepthZoom();
} }
updateXZoom();
m_wellLogTrackPlotWidget->replot();
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateXZoom() void RimWellLogTrack::calculateXZoomRangeAndUpdateQwt()
{
this->calculateXZoomRange();
this->applyXZoomFromVisibleRange();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::applyXZoomFromVisibleRange()
{
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
m_wellLogTrackPlotWidget->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::calculateXZoomRange()
{ {
std::map<int, std::vector<RimWellFlowRateCurve*>> stackCurveGroups = visibleStackedCurves(); std::map<int, std::vector<RimWellFlowRateCurve*>> stackCurveGroups = visibleStackedCurves();
for (const std::pair<int, std::vector<RimWellFlowRateCurve*>>& curveGroup : stackCurveGroups) for (const std::pair<int, std::vector<RimWellFlowRateCurve*>>& curveGroup : stackCurveGroups)
@ -728,12 +751,6 @@ void RimWellLogTrack::updateXZoom()
if (!m_isAutoScaleXEnabled()) if (!m_isAutoScaleXEnabled())
{ {
if (m_wellLogTrackPlotWidget)
{
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
m_wellLogTrackPlotWidget->replot();
}
return; return;
} }
@ -769,10 +786,38 @@ void RimWellLogTrack::updateXZoom()
m_visibleXRangeMax = maxValue; m_visibleXRangeMax = maxValue;
computeAndSetXRangeMinForLogarithmicScale(); computeAndSetXRangeMinForLogarithmicScale();
updateEditors();
}
if (m_wellLogTrackPlotWidget) m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax); //--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateEditors()
{
this->updateConnectedEditors();
updateConnectedEditors(); RimWellLogPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted(plot);
plot->updateConnectedEditors();
RimWellRftPlot* rftPlot(nullptr);
firstAncestorOrThisOfType(rftPlot);
if (rftPlot)
{
rftPlot->updateConnectedEditors();
}
else
{
RimWellPltPlot* pltPlot(nullptr);
firstAncestorOrThisOfType(pltPlot);
if (pltPlot)
{
pltPlot->updateConnectedEditors();
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -99,9 +99,13 @@ public:
void setAndUpdateSimWellFormationNamesAndBranchData(RimCase* rimCase, const QString& simWellName, int branchIndex, bool useBranchDetection); void setAndUpdateSimWellFormationNamesAndBranchData(RimCase* rimCase, const QString& simWellName, int branchIndex, bool useBranchDetection);
void setAndUpdateSimWellFormationNamesData(RimCase* rimCase, const QString& simWellName); void setAndUpdateSimWellFormationNamesData(RimCase* rimCase, const QString& simWellName);
void setAutoScaleXEnabled(bool enabled);
void availableDepthRange(double* minimumDepth, double* maximumDepth); void availableDepthRange(double* minimumDepth, double* maximumDepth);
void updateXZoomAndParentPlotDepthZoom(); void updateParentPlotZoom();
void updateXZoom(); void calculateXZoomRangeAndUpdateQwt();
void applyXZoomFromVisibleRange();
void calculateXZoomRange();
void updateEditors();
void setShowFormations(bool on); void setShowFormations(bool on);