(#691) Added option to keep the depth range fixed

This commit is contained in:
Magne Sjaastad
2015-12-07 12:03:33 +01:00
parent dc6a50ec3c
commit 5eb38fe203
8 changed files with 39 additions and 15 deletions

View File

@@ -125,7 +125,7 @@ void RicDeleteItemExec::redo()
if (wellLogPlot) if (wellLogPlot)
{ {
wellLogPlot->calculateAvailableDepthRange(); wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->zoomAllDepth(); wellLogPlot->updateDepthZoom();
} }
RimWellLogTrack* wellLogPlotTrack; RimWellLogTrack* wellLogPlotTrack;

View File

@@ -109,7 +109,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
} }
plot->calculateAvailableDepthRange(); plot->calculateAvailableDepthRange();
plot->zoomAllDepth(); plot->updateDepthZoom();
plotTrack->viewer()->replot(); plotTrack->viewer()->replot();
RiaApplication::instance()->project()->updateConnectedEditors(); RiaApplication::instance()->project()->updateConnectedEditors();

View File

@@ -71,7 +71,7 @@ void RicDeleteWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
delete track; delete track;
wellLogPlot->calculateAvailableDepthRange(); wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->zoomAllDepth(); wellLogPlot->updateDepthZoom();
wellLogPlot->uiCapability()->updateConnectedEditors(); wellLogPlot->uiCapability()->updateConnectedEditors();
} }
} }

View File

@@ -108,7 +108,7 @@ void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dst
{ {
(*pIt)->calculateAvailableDepthRange(); (*pIt)->calculateAvailableDepthRange();
(*pIt)->updateTrackNames(); (*pIt)->updateTrackNames();
(*pIt)->zoomAllDepth(); (*pIt)->updateDepthZoom();
(*pIt)->updateConnectedEditors(); (*pIt)->updateConnectedEditors();
} }

View File

@@ -277,7 +277,7 @@ void RimWellLogCurve::zoomAllOwnerTrackAndPlot()
if (wellLogPlot) if (wellLogPlot)
{ {
wellLogPlot->calculateAvailableDepthRange(); wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->zoomAllDepth(); wellLogPlot->updateDepthZoom();
} }
RimWellLogTrack* plotTrack; RimWellLogTrack* plotTrack;

View File

@@ -71,6 +71,7 @@ RimWellLogPlot::RimWellLogPlot()
CAF_PDM_InitField(&m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", ""); CAF_PDM_InitField(&m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "");
CAF_PDM_InitField(&m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", ""); CAF_PDM_InitField(&m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "");
CAF_PDM_InitField(&m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", "");
m_tracks.uiCapability()->setUiHidden(true); m_tracks.uiCapability()->setUiHidden(true);
@@ -147,7 +148,13 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
} }
else if (changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth) else if (changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth)
{ {
updateDepthZoomInQwt(); applyDepthZoomFromVisibleDepth();
m_isAutoScaleDepthEnabled = false;
}
else if (changedField == &m_isAutoScaleDepthEnabled)
{
updateDepthZoom();
} }
else if (changedField == &m_userName) else if (changedField == &m_userName)
{ {
@@ -279,7 +286,7 @@ void RimWellLogPlot::setDepthZoomMinMax(double minimumDepth, double maximumDepth
m_minVisibleDepth.uiCapability()->updateConnectedEditors(); m_minVisibleDepth.uiCapability()->updateConnectedEditors();
m_maxVisibleDepth.uiCapability()->updateConnectedEditors(); m_maxVisibleDepth.uiCapability()->updateConnectedEditors();
updateDepthZoomInQwt(); applyDepthZoomFromVisibleDepth();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -373,6 +380,7 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add(&m_depthUnit); uiOrdering.add(&m_depthUnit);
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup("Visible Depth Range"); caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup("Visible Depth Range");
gridGroup->add(&m_isAutoScaleDepthEnabled);
gridGroup->add(&m_minVisibleDepth); gridGroup->add(&m_minVisibleDepth);
gridGroup->add(&m_maxVisibleDepth); gridGroup->add(&m_maxVisibleDepth);
} }
@@ -400,7 +408,7 @@ void RimWellLogPlot::updateTracks()
} }
calculateAvailableDepthRange(); calculateAvailableDepthRange();
updateDepthZoomInQwt(); updateDepthZoom();
} }
} }
@@ -418,7 +426,22 @@ void RimWellLogPlot::updateTrackNames()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogPlot::updateDepthZoomInQwt() void RimWellLogPlot::updateDepthZoom()
{
if (m_isAutoScaleDepthEnabled)
{
applyZoomAllDepths();
}
else
{
applyDepthZoomFromVisibleDepth();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::applyDepthZoomFromVisibleDepth()
{ {
if (m_viewer) if (m_viewer)
{ {
@@ -433,7 +456,7 @@ void RimWellLogPlot::updateDepthZoomInQwt()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogPlot::zoomAllDepth() void RimWellLogPlot::applyZoomAllDepths()
{ {
if (hasAvailableDepthRange()) if (hasAvailableDepthRange())
{ {

View File

@@ -74,7 +74,7 @@ public:
RiuWellLogPlot* viewer(); RiuWellLogPlot* viewer();
void zoomAllDepth(); void updateDepthZoom();
void setDepthZoomByFactorAndCenter(double zoomFactor, double zoomCenter); void setDepthZoomByFactorAndCenter(double zoomFactor, double zoomCenter);
void panDepth(double panFactor); void panDepth(double panFactor);
void setDepthZoomMinMax(double minimumDepth, double maximumDepth); void setDepthZoomMinMax(double minimumDepth, double maximumDepth);
@@ -96,13 +96,13 @@ protected:
private: private:
void updateViewerWidget(); void updateViewerWidget();
void updateViewerWidgetWindowTitle(); void updateViewerWidgetWindowTitle();
void updateDepthZoomInQwt(); void applyZoomAllDepths();
void applyDepthZoomFromVisibleDepth();
void recreateTrackPlots(); void recreateTrackPlots();
void detachAllCurves(); void detachAllCurves();
void handleViewerDeletion(); void handleViewerDeletion();
private: private:
caf::PdmField<bool> m_showWindow; caf::PdmField<bool> m_showWindow;
caf::PdmField<QString> m_userName; caf::PdmField<QString> m_userName;
@@ -113,6 +113,7 @@ private:
caf::PdmField<double> m_minVisibleDepth; caf::PdmField<double> m_minVisibleDepth;
caf::PdmField<double> m_maxVisibleDepth; caf::PdmField<double> m_maxVisibleDepth;
caf::PdmField<bool> m_isAutoScaleDepthEnabled;
double m_minAvailableDepth; double m_minAvailableDepth;
double m_maxAvailableDepth; double m_maxAvailableDepth;

View File

@@ -92,7 +92,7 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
if (wellLogPlot) if (wellLogPlot)
{ {
wellLogPlot->calculateAvailableDepthRange(); wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->zoomAllDepth(); wellLogPlot->updateDepthZoom();
if (wellLogPlot->viewer()) wellLogPlot->viewer()->updateChildrenLayout(); if (wellLogPlot->viewer()) wellLogPlot->viewer()->updateChildrenLayout();
} }
} }
@@ -268,7 +268,7 @@ void RimWellLogTrack::zoomAllXAndZoomAllDepthOnOwnerPlot()
firstAnchestorOrThisOfType(wellLogPlot); firstAnchestorOrThisOfType(wellLogPlot);
if (wellLogPlot) if (wellLogPlot)
{ {
wellLogPlot->zoomAllDepth(); wellLogPlot->updateDepthZoom();
} }
zoomAllXAxisIfAutoScale(); zoomAllXAxisIfAutoScale();