Tried to improve readability by renaming in the plot classes.

This commit is contained in:
Jacob Støren 2015-10-27 14:44:53 +01:00
parent 4a12eecd0c
commit 0a45354bd9
19 changed files with 222 additions and 225 deletions

View File

@ -114,14 +114,14 @@ void RicDeleteItemExec::redo()
parentObj->firstAnchestorOrThisOfType(wellLogPlot);
if (wellLogPlot)
{
wellLogPlot->updateAvailableDepthRange();
wellLogPlot->calculateAvailableDepthRange();
}
RimWellLogPlotTrack* wellLogPlotTrack;
parentObj->firstAnchestorOrThisOfType(wellLogPlotTrack);
if (wellLogPlotTrack)
{
wellLogPlotTrack->updateAxisRangesAndReplot();
wellLogPlotTrack->allignDepthZoomToPlotAndZoomAllX();
}
RimWellLogPlotCollection* wellLogPlotCollection = NULL;

View File

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

View File

@ -67,7 +67,7 @@ void RicDeleteWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
if (wellLogPlot && wellLogPlot->trackCount() > 1)
{
wellLogPlot->removeTrack(track);
wellLogPlot->updateAvailableDepthRange();
wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->uiCapability()->updateConnectedEditors();
caf::SelectionManager::instance()->removeObjectFromAllSelections(track);

View File

@ -47,7 +47,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlot
wellLogPlotTrack->insertCurve(curves[cIdx], cIdx);
}
wellLogPlotTrack->updateAxisRangesAndReplot();
wellLogPlotTrack->allignDepthZoomToPlotAndZoomAllX();
wellLogPlotTrack->updateConnectedEditors();
}
@ -59,7 +59,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlot
CVF_ASSERT(wellLogPlotTrack && insertAfterCurve);
wellLogPlotTrack->moveCurves(insertAfterCurve, curves);
wellLogPlotTrack->updateAxisRangesAndReplot();
wellLogPlotTrack->allignDepthZoomToPlotAndZoomAllX();
wellLogPlotTrack->updateConnectedEditors();
}

View File

@ -179,7 +179,7 @@ void RimWellLogExtractionCurve::updatePlotData()
{
RimWellLogPlotCurve::updatePlotConfiguration();
if (isCurveVisibile())
if (isCurveVisible())
{
// Make sure we have set correct case data into the result definitions.
@ -255,10 +255,10 @@ void RimWellLogExtractionCurve::updatePlotData()
}
}
m_plotCurve->setCurveData(m_curveData.p());
m_qwtPlotCurve->setCurveData(m_curveData.p());
updateTrackAndPlotFromCurveData();
if (m_plot) m_plot->replot();
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
}
}

View File

@ -69,7 +69,7 @@ void RimWellLogFileCurve::updatePlotData()
{
RimWellLogPlotCurve::updatePlotConfiguration();
if (isCurveVisibile())
if (isCurveVisible())
{
m_curveData = new RigWellLogCurveData;
@ -92,16 +92,16 @@ void RimWellLogFileCurve::updatePlotData()
if (m_autoName)
{
m_plotCurve->setTitle(createCurveName());
m_qwtPlotCurve->setTitle(createCurveName());
}
}
}
m_plotCurve->setCurveData(m_curveData.p());
m_qwtPlotCurve->setCurveData(m_curveData.p());
updateTrackAndPlotFromCurveData();
if (m_plot) m_plot->replot();
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
}
}
@ -137,7 +137,7 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
this->updatePlotData();
}
if (m_plot) m_plot->replot();
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
}
//--------------------------------------------------------------------------------------------------

View File

@ -66,17 +66,17 @@ RimWellLogPlot::RimWellLogPlot()
caf::AppEnum< RimWellLogPlot::DepthTypeEnum > depthType = MEASURED_DEPTH;
CAF_PDM_InitField(&m_depthType, "DepthType", depthType, "Depth type", "", "", "");
CAF_PDM_InitField(&m_minimumVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "");
CAF_PDM_InitField(&m_maximumVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "");
CAF_PDM_InitField(&m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "");
CAF_PDM_InitField(&m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "");
CAF_PDM_InitFieldNoDefault(&tracks, "Tracks", "", "", "", "");
tracks.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", "");
m_tracks.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&windowGeometry, "WindowGeometry", "", "", "", "");
windowGeometry.uiCapability()->setUiHidden(true);
m_depthRangeMinimum = HUGE_VAL;
m_depthRangeMaximum = -HUGE_VAL;
m_minAvailableDepth = HUGE_VAL;
m_maxAvailableDepth = -HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------
@ -142,9 +142,9 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
uiCapability()->updateUiIconFromToggleField();
}
else if (changedField == &m_minimumVisibleDepth || changedField == &m_maximumVisibleDepth)
else if (changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth)
{
updateAxisRanges();
updateDepthZoomInQwt();
}
else if (changedField == &m_userName)
{
@ -169,7 +169,7 @@ caf::PdmFieldHandle* RimWellLogPlot::objectToggleField()
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::addTrack(RimWellLogPlotTrack* track)
{
tracks.push_back(track);
m_tracks.push_back(track);
if (m_viewer)
{
track->recreateViewer();
@ -184,7 +184,7 @@ void RimWellLogPlot::addTrack(RimWellLogPlotTrack* track)
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::insertTrack(RimWellLogPlotTrack* track, size_t index)
{
tracks.insert(index, track);
m_tracks.insert(index, track);
if (m_viewer)
{
@ -203,7 +203,7 @@ void RimWellLogPlot::removeTrack(RimWellLogPlotTrack* track)
if (track)
{
if (m_viewer) m_viewer->removeTrackPlot(track->viewer());
tracks.removeChildObject(track);
m_tracks.removeChildObject(track);
}
}
@ -226,7 +226,7 @@ void RimWellLogPlot::moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std
}
}
size_t index = tracks.index(insertAfterTrack) + 1;
size_t index = m_tracks.index(insertAfterTrack) + 1;
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
{
@ -247,12 +247,12 @@ RiuWellLogPlot* RimWellLogPlot::viewer()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::zoomDepth(double zoomFactor, double zoomCenter)
void RimWellLogPlot::setDepthZoomByFactorAndCenter(double zoomFactor, double zoomCenter)
{
double newMinimum = zoomCenter - (zoomCenter - m_minimumVisibleDepth)*zoomFactor;
double newMaximum = zoomCenter + (m_maximumVisibleDepth - zoomCenter)*zoomFactor;
double newMinimum = zoomCenter - (zoomCenter - m_minVisibleDepth)*zoomFactor;
double newMaximum = zoomCenter + (m_maxVisibleDepth - zoomCenter)*zoomFactor;
setVisibleDepthRange(newMinimum, newMaximum);
setDepthZoomMinMax(newMinimum, newMaximum);
}
//--------------------------------------------------------------------------------------------------
@ -260,38 +260,38 @@ void RimWellLogPlot::zoomDepth(double zoomFactor, double zoomCenter)
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::panDepth(double panFactor)
{
double delta = panFactor*(m_maximumVisibleDepth - m_minimumVisibleDepth);
setVisibleDepthRange(m_minimumVisibleDepth + delta, m_maximumVisibleDepth + delta);
double delta = panFactor*(m_maxVisibleDepth - m_minVisibleDepth);
setDepthZoomMinMax(m_minVisibleDepth + delta, m_maxVisibleDepth + delta);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::setVisibleDepthRange(double minimumDepth, double maximumDepth)
void RimWellLogPlot::setDepthZoomMinMax(double minimumDepth, double maximumDepth)
{
m_minimumVisibleDepth = minimumDepth;
m_maximumVisibleDepth = maximumDepth;
m_minVisibleDepth = minimumDepth;
m_maxVisibleDepth = maximumDepth;
m_minimumVisibleDepth.uiCapability()->updateConnectedEditors();
m_maximumVisibleDepth.uiCapability()->updateConnectedEditors();
m_minVisibleDepth.uiCapability()->updateConnectedEditors();
m_maxVisibleDepth.uiCapability()->updateConnectedEditors();
updateAxisRanges();
updateDepthZoomInQwt();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::updateAvailableDepthRange()
void RimWellLogPlot::calculateAvailableDepthRange()
{
double minDepth = HUGE_VAL;
double maxDepth = -HUGE_VAL;
for (size_t tIdx = 0; tIdx < tracks.size(); tIdx++)
for (size_t tIdx = 0; tIdx < m_tracks.size(); tIdx++)
{
double minTrackDepth = HUGE_VAL;
double maxTrackDepth = -HUGE_VAL;
if (tracks[tIdx]->availableDepthRange(&minTrackDepth, &maxTrackDepth))
if (m_tracks[tIdx]->availableDepthRange(&minTrackDepth, &maxTrackDepth))
{
if (minTrackDepth < minDepth)
{
@ -305,8 +305,8 @@ void RimWellLogPlot::updateAvailableDepthRange()
}
}
m_depthRangeMinimum = minDepth;
m_depthRangeMaximum = maxDepth;
m_minAvailableDepth = minDepth;
m_maxAvailableDepth = maxDepth;
}
//--------------------------------------------------------------------------------------------------
@ -316,8 +316,8 @@ void RimWellLogPlot::availableDepthRange(double* minimumDepth, double* maximumDe
{
if (hasAvailableDepthRange())
{
*minimumDepth = m_depthRangeMinimum;
*maximumDepth = m_depthRangeMaximum;
*minimumDepth = m_minAvailableDepth;
*maximumDepth = m_maxAvailableDepth;
}
else
{
@ -332,16 +332,16 @@ void RimWellLogPlot::availableDepthRange(double* minimumDepth, double* maximumDe
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlot::hasAvailableDepthRange() const
{
return m_depthRangeMinimum < HUGE_VAL && m_depthRangeMaximum > -HUGE_VAL;
return m_minAvailableDepth < HUGE_VAL && m_maxAvailableDepth > -HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::visibleDepthRange(double* minimumDepth, double* maximumDepth) const
void RimWellLogPlot::depthZoomMinMax(double* minimumDepth, double* maximumDepth) const
{
*minimumDepth = m_minimumVisibleDepth;
*maximumDepth = m_maximumVisibleDepth;
*minimumDepth = m_minVisibleDepth;
*maximumDepth = m_maxVisibleDepth;
}
@ -366,8 +366,8 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add(&m_depthType);
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup("Visible Depth Range");
gridGroup->add(&m_minimumVisibleDepth);
gridGroup->add(&m_maximumVisibleDepth);
gridGroup->add(&m_minVisibleDepth);
gridGroup->add(&m_maxVisibleDepth);
}
@ -387,13 +387,13 @@ void RimWellLogPlot::updateTracks()
{
if (m_showWindow)
{
for (size_t tIdx = 0; tIdx < tracks.size(); ++tIdx)
for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx)
{
tracks[tIdx]->loadDataAndUpdate();
m_tracks[tIdx]->loadDataAndUpdate();
}
updateAvailableDepthRange();
updateAxisRanges();
calculateAvailableDepthRange();
updateDepthZoomInQwt();
}
}
@ -402,23 +402,23 @@ void RimWellLogPlot::updateTracks()
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::updateTrackNames()
{
for (size_t tIdx = 0; tIdx < tracks.size(); tIdx++)
for (size_t tIdx = 0; tIdx < m_tracks.size(); tIdx++)
{
tracks[tIdx]->setDescription(QString("Track %1").arg(tIdx + 1));
m_tracks[tIdx]->setDescription(QString("Track %1").arg(tIdx + 1));
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::updateAxisRanges()
void RimWellLogPlot::updateDepthZoomInQwt()
{
if (m_viewer)
{
double minDepth = m_minimumVisibleDepth < HUGE_VAL ? m_minimumVisibleDepth : RI_LOGPLOT_MINDEPTH_DEFAULT;
double maxDepth = m_maximumVisibleDepth > -HUGE_VAL ? m_maximumVisibleDepth : RI_LOGPLOT_MAXDEPTH_DEFAULT;
double minDepth = m_minVisibleDepth < HUGE_VAL ? m_minVisibleDepth : RI_LOGPLOT_MINDEPTH_DEFAULT;
double maxDepth = m_maxVisibleDepth > -HUGE_VAL ? m_maxVisibleDepth : RI_LOGPLOT_MAXDEPTH_DEFAULT;
m_viewer->setDepthRangeAndReplot(minDepth, maxDepth);
m_viewer->setDepthZoomAndReplot(minDepth, maxDepth);
}
}
@ -426,15 +426,15 @@ void RimWellLogPlot::updateAxisRanges()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::setVisibleDepthRangeFromContents()
void RimWellLogPlot::zoomAllDepth()
{
if (hasAvailableDepthRange())
{
setVisibleDepthRange(m_depthRangeMinimum, m_depthRangeMaximum);
setDepthZoomMinMax(m_minAvailableDepth, m_maxAvailableDepth);
}
else
{
setVisibleDepthRange(RI_LOGPLOT_MINDEPTH_DEFAULT, RI_LOGPLOT_MAXDEPTH_DEFAULT);
setDepthZoomMinMax(RI_LOGPLOT_MINDEPTH_DEFAULT, RI_LOGPLOT_MAXDEPTH_DEFAULT);
}
}
@ -445,10 +445,10 @@ void RimWellLogPlot::recreateTrackPlots()
{
CVF_ASSERT(m_viewer);
for (size_t tIdx = 0; tIdx < tracks.size(); ++tIdx)
for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx)
{
tracks[tIdx]->recreateViewer();
m_viewer->addTrackPlot(tracks[tIdx]->viewer());
m_tracks[tIdx]->recreateViewer();
m_viewer->addTrackPlot(m_tracks[tIdx]->viewer());
}
}
@ -457,9 +457,9 @@ void RimWellLogPlot::recreateTrackPlots()
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::detachAllCurves()
{
for (size_t tIdx = 0; tIdx < tracks.size(); ++tIdx)
for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx)
{
tracks[tIdx]->detachAllCurves();
m_tracks[tIdx]->detachAllCurves();
}
}

View File

@ -49,72 +49,66 @@ public:
RimWellLogPlot();
virtual ~RimWellLogPlot();
void setDescription(const QString& description);
void updateViewerWidgetWindowTitle();
void setDescription(const QString& description);
void addTrack(RimWellLogPlotTrack* track);
void insertTrack(RimWellLogPlotTrack* track, size_t index);
size_t trackCount() { return tracks.size();}
void removeTrack(RimWellLogPlotTrack* track);
void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracksToMove);
DepthTypeEnum depthType() const;
QString depthPlotTitle() const;
void loadDataAndUpdate();
void updateTracks();
void updateTrackNames();
caf::PdmField< std::vector<int> > windowGeometry;
RiuWellLogPlot* viewer();
void addTrack(RimWellLogPlotTrack* track);
void insertTrack(RimWellLogPlotTrack* track, size_t index);
size_t trackCount() { return m_tracks.size();}
void removeTrack(RimWellLogPlotTrack* track);
void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracksToMove);
void zoomDepth(double zoomFactor, double zoomCenter);
void panDepth(double panFactor);
void setVisibleDepthRange(double minimumDepth, double maximumDepth);
void loadDataAndUpdate();
void updateTracks();
void updateTrackNames();
void updateAvailableDepthRange();
void availableDepthRange(double* minimumDepth, double* maximumDepth) const;
bool hasAvailableDepthRange() const;
RiuWellLogPlot* viewer();
void visibleDepthRange(double* minimumDepth, double* maximumDepth) const;
void updateAxisRanges();
void setVisibleDepthRangeFromContents();
DepthTypeEnum depthType() const;
QString depthPlotTitle() const;
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
caf::PdmField< std::vector<int> > windowGeometry;
void zoomAllDepth();
void setDepthZoomByFactorAndCenter(double zoomFactor, double zoomCenter);
void panDepth(double panFactor);
void setDepthZoomMinMax(double minimumDepth, double maximumDepth);
void depthZoomMinMax(double* minimumDepth, double* maximumDepth) const;
void calculateAvailableDepthRange();
void availableDepthRange(double* minimumDepth, double* maximumDepth) const;
bool hasAvailableDepthRange() const;
protected:
// Overridden PDM methods
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void setupBeforeSave();
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void setupBeforeSave();
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual caf::PdmFieldHandle* objectToggleField();
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
private:
void updateViewerWidget();
void recreateTrackPlots();
void detachAllCurves();
void handleViewerDeletion();
virtual caf::PdmFieldHandle* objectToggleField();
void updateViewerWidget();
void updateViewerWidgetWindowTitle();
void updateDepthZoomInQwt();
void recreateTrackPlots();
void detachAllCurves();
void handleViewerDeletion();
private:
QPointer<RiuWellLogPlot> m_viewer;
caf::PdmField<bool> m_showWindow;
caf::PdmChildArrayField<RimWellLogPlotTrack*> tracks;
caf::PdmField<bool> m_showWindow;
caf::PdmField<QString> m_userName;
caf::PdmField< caf::AppEnum< DepthTypeEnum > > m_depthType;
caf::PdmField<double> m_minimumVisibleDepth;
caf::PdmField<double> m_maximumVisibleDepth;
caf::PdmChildArrayField<RimWellLogPlotTrack*> m_tracks;
double m_depthRangeMinimum;
double m_depthRangeMaximum;
caf::PdmField<double> m_minVisibleDepth;
caf::PdmField<double> m_maxVisibleDepth;
double m_minAvailableDepth;
double m_maxAvailableDepth;
friend class RiuWellLogPlot;
QPointer<RiuWellLogPlot> m_viewer;
};

View File

@ -49,11 +49,11 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
m_plotCurve = new RiuWellLogPlotCurve;
m_plotCurve->setXAxis(QwtPlot::xTop);
m_plotCurve->setYAxis(QwtPlot::yLeft);
m_qwtPlotCurve = new RiuWellLogPlotCurve;
m_qwtPlotCurve->setXAxis(QwtPlot::xTop);
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
m_plot = NULL;
m_ownerQwtTrack = NULL;
}
//--------------------------------------------------------------------------------------------------
@ -61,10 +61,10 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCurve::~RimWellLogPlotCurve()
{
m_plotCurve->detach();
if (m_plot) m_plot->replot();
m_qwtPlotCurve->detach();
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
delete m_plotCurve;
delete m_qwtPlotCurve;
}
//--------------------------------------------------------------------------------------------------
@ -83,7 +83,7 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
}
else if (&m_curveColor == changedField)
{
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
m_qwtPlotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
}
else if (changedField == &m_autoName)
{
@ -97,7 +97,7 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
updatePlotTitle();
}
if (m_plot) m_plot->replot();
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
}
//--------------------------------------------------------------------------------------------------
@ -113,13 +113,13 @@ caf::PdmFieldHandle* RimWellLogPlotCurve::objectToggleField()
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updateCurveVisibility()
{
if (m_showCurve() && m_plot)
if (m_showCurve() && m_ownerQwtTrack)
{
m_plotCurve->attach(m_plot);
m_qwtPlotCurve->attach(m_ownerQwtTrack);
}
else
{
m_plotCurve->detach();
m_qwtPlotCurve->detach();
}
}
@ -132,20 +132,20 @@ void RimWellLogPlotCurve::updatePlotConfiguration()
this->updateCurveName();
this->updatePlotTitle();
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
m_qwtPlotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
// Todo: Rest of the curve setup controlled from this class
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::setPlot(RiuWellLogTrackPlot* plot)
void RimWellLogPlotCurve::setQwtTrack(RiuWellLogTrackPlot* plot)
{
m_plot = plot;
m_ownerQwtTrack = plot;
if (m_showCurve)
{
m_plotCurve->attach(m_plot);
m_plot->replot();
m_qwtPlotCurve->attach(m_ownerQwtTrack);
m_ownerQwtTrack->replot();
}
}
@ -163,15 +163,15 @@ caf::PdmFieldHandle* RimWellLogPlotCurve::userDescriptionField()
bool RimWellLogPlotCurve::depthRange(double* minimumDepth, double* maximumDepth) const
{
CVF_ASSERT(minimumDepth && maximumDepth);
CVF_ASSERT(m_plotCurve);
CVF_ASSERT(m_qwtPlotCurve);
if (m_plotCurve->data()->size() < 1)
if (m_qwtPlotCurve->data()->size() < 1)
{
return false;
}
*minimumDepth = m_plotCurve->minYValue();
*maximumDepth = m_plotCurve->maxYValue();
*minimumDepth = m_qwtPlotCurve->minYValue();
*maximumDepth = m_qwtPlotCurve->maxYValue();
return true;
}
@ -182,15 +182,15 @@ bool RimWellLogPlotCurve::depthRange(double* minimumDepth, double* maximumDepth)
bool RimWellLogPlotCurve::valueRange(double* minimumValue, double* maximumValue) const
{
CVF_ASSERT(minimumValue && maximumValue);
CVF_ASSERT(m_plotCurve);
CVF_ASSERT(m_qwtPlotCurve);
if (m_plotCurve->data()->size() < 1)
if (m_qwtPlotCurve->data()->size() < 1)
{
return false;
}
*minimumValue = m_plotCurve->minXValue();
*maximumValue = m_plotCurve->maxXValue();
*minimumValue = m_qwtPlotCurve->minXValue();
*maximumValue = m_qwtPlotCurve->maxXValue();
return true;
}
@ -206,9 +206,9 @@ void RimWellLogPlotCurve::setColor(const cvf::Color3f& color)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::detachCurve()
void RimWellLogPlotCurve::detachQwtCurve()
{
m_plotCurve->detach();
m_qwtPlotCurve->detach();
}
//--------------------------------------------------------------------------------------------------
@ -216,7 +216,7 @@ void RimWellLogPlotCurve::detachCurve()
//--------------------------------------------------------------------------------------------------
QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
{
return m_plotCurve;
return m_qwtPlotCurve;
}
//--------------------------------------------------------------------------------------------------
@ -224,13 +224,13 @@ QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updatePlotTitle()
{
m_plotCurve->setTitle(m_curveName);
m_qwtPlotCurve->setTitle(m_curveName);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotCurve::isCurveVisibile()
bool RimWellLogPlotCurve::isCurveVisible()
{
return m_showCurve;
}
@ -253,11 +253,11 @@ void RimWellLogPlotCurve::updateTrackAndPlotFromCurveData()
if (wellLogPlot)
{
bool setDepthRange = !wellLogPlot->hasAvailableDepthRange();
wellLogPlot->updateAvailableDepthRange();
wellLogPlot->calculateAvailableDepthRange();
if (setDepthRange)
{
wellLogPlot->setVisibleDepthRangeFromContents();
wellLogPlot->zoomAllDepth();
}
}
@ -265,7 +265,7 @@ void RimWellLogPlotCurve::updateTrackAndPlotFromCurveData()
firstAnchestorOrThisOfType(plotTrack);
if (plotTrack)
{
plotTrack->updateAxisRangesAndReplot();
plotTrack->allignDepthZoomToPlotAndZoomAllX();
}
}

View File

@ -44,35 +44,35 @@ public:
RimWellLogPlotCurve();
virtual ~RimWellLogPlotCurve();
void setColor(const cvf::Color3f& color);
void setColor(const cvf::Color3f& color);
bool depthRange(double* minimumDepth, double* maximumDepth) const;
bool valueRange(double* minimumValue, double* maximumValue) const;
bool depthRange(double* minimumDepth, double* maximumDepth) const;
bool valueRange(double* minimumValue, double* maximumValue) const;
void setPlot(RiuWellLogTrackPlot* plot);
void detachCurve();
void setQwtTrack(RiuWellLogTrackPlot* plot);
void detachQwtCurve();
bool isCurveVisibile();
bool isCurveVisible();
QwtPlotCurve* plotCurve() const;
const RigWellLogCurveData* curveData() const;
QwtPlotCurve* plotCurve() const;
const RigWellLogCurveData* curveData() const;
QString name() const { return m_curveName; }
void updateCurveName();
void updatePlotTitle();
QString name() const { return m_curveName; }
void updateCurveName();
void updatePlotTitle();
virtual QString wellName() const = 0;
virtual QString wellLogChannelName() const = 0;
virtual QString wellDate() const { return ""; };
virtual void updatePlotData() = 0;
virtual QString wellName() const = 0;
virtual QString wellLogChannelName() const = 0;
virtual QString wellDate() const { return ""; };
virtual void updatePlotData() = 0;
protected:
virtual QString createCurveName() = 0;
virtual QString createCurveName() = 0;
void updatePlotConfiguration();
void updateCurveVisibility();
void updateTrackAndPlotFromCurveData();
void updateOptionSensitivity();
void updatePlotConfiguration();
void updateCurveVisibility();
void updateTrackAndPlotFromCurveData();
void updateOptionSensitivity();
// Overridden PDM methods
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
@ -81,14 +81,14 @@ protected:
virtual void initAfterRead();
RiuWellLogTrackPlot* m_plot;
RiuWellLogPlotCurve* m_plotCurve;
RiuWellLogTrackPlot* m_ownerQwtTrack;
RiuWellLogPlotCurve* m_qwtPlotCurve;
cvf::ref<RigWellLogCurveData> m_curveData;
caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_curveName;
caf::PdmField<QString> m_customCurveName;
caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_curveName;
caf::PdmField<QString> m_customCurveName;
caf::PdmField<bool> m_autoName;
caf::PdmField<cvf::Color3f> m_curveColor;
caf::PdmField<bool> m_autoName;
caf::PdmField<cvf::Color3f> m_curveColor;
};

View File

@ -114,7 +114,7 @@ void RimWellLogPlotTrack::addCurve(RimWellLogPlotCurve* curve)
if (m_wellLogTrackPlotWidget)
{
curve->setPlot(m_wellLogTrackPlotWidget);
curve->setQwtTrack(m_wellLogTrackPlotWidget);
}
}
@ -127,7 +127,7 @@ void RimWellLogPlotTrack::insertCurve(RimWellLogPlotCurve* curve, size_t index)
if (m_wellLogTrackPlotWidget)
{
curve->setPlot(m_wellLogTrackPlotWidget);
curve->setQwtTrack(m_wellLogTrackPlotWidget);
}
}
@ -139,7 +139,7 @@ void RimWellLogPlotTrack::removeCurve(RimWellLogPlotCurve* curve)
size_t index = curves.index(curve);
if ( index < curves.size())
{
curves[index]->detachCurve();
curves[index]->detachQwtCurve();
curves.removeChildObject(curve);
}
}
@ -255,7 +255,7 @@ void RimWellLogPlotTrack::recreateViewer()
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
{
curves[cIdx]->setPlot(this->m_wellLogTrackPlotWidget);
curves[cIdx]->setQwtTrack(this->m_wellLogTrackPlotWidget);
}
}
}
@ -267,14 +267,14 @@ void RimWellLogPlotTrack::detachAllCurves()
{
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
{
curves[cIdx]->detachCurve();
curves[cIdx]->detachQwtCurve();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::updateAxisRangesAndReplot()
void RimWellLogPlotTrack::allignDepthZoomToPlotAndZoomAllX()
{
if (m_wellLogTrackPlotWidget)
{
@ -283,13 +283,12 @@ void RimWellLogPlotTrack::updateAxisRangesAndReplot()
if (wellLogPlot)
{
double minimumDepth, maximumDepth;
wellLogPlot->visibleDepthRange(&minimumDepth, &maximumDepth);
wellLogPlot->depthZoomMinMax(&minimumDepth, &maximumDepth);
m_wellLogTrackPlotWidget->setDepthRange(minimumDepth, maximumDepth);
m_wellLogTrackPlotWidget->setDepthZoom(minimumDepth, maximumDepth);
}
updateXAxisRangeFromCurves();
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
zoomAllXAxis();
m_wellLogTrackPlotWidget->replot();
}
@ -298,7 +297,7 @@ void RimWellLogPlotTrack::updateAxisRangesAndReplot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::updateXAxisRangeFromCurves()
void RimWellLogPlotTrack::zoomAllXAxis()
{
double minValue = HUGE_VAL;
double maxValue = -HUGE_VAL;
@ -331,6 +330,8 @@ void RimWellLogPlotTrack::updateXAxisRangeFromCurves()
m_visibleXRangeMin = minValue;
m_visibleXRangeMax = maxValue;
if (m_wellLogTrackPlotWidget) m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
updateConnectedEditors();
}

View File

@ -57,7 +57,7 @@ public:
void loadDataAndUpdate();
bool availableDepthRange(double* minimumDepth, double* maximumDepth);
void updateAxisRangesAndReplot();
void allignDepthZoomToPlotAndZoomAllX();
RiuWellLogTrackPlot* viewer();
@ -72,7 +72,7 @@ protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
private:
void updateXAxisRangeFromCurves();
void zoomAllXAxis();
private:
caf::PdmField<bool> m_show;

View File

@ -269,7 +269,7 @@ void RigWellLogCurveData::computePolyLineStartStopIndices(const std::vector< std
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigWellLogCurveData::depthRange(double* minimumDepth, double* maximumDepth) const
bool RigWellLogCurveData::calculateMDRange(double* minimumDepth, double* maximumDepth) const
{
CVF_ASSERT(minimumDepth && maximumDepth);

View File

@ -35,39 +35,41 @@ public:
RigWellLogCurveData();
virtual ~RigWellLogCurveData();
void setValuesAndMD(const std::vector<double>& xValues, const std::vector<double>& measuredDepths);
void setValuesWithTVD(const std::vector<double>& xValues, const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths );
bool depthRange(double* minimumDepth, double* maximumDepth) const;
void setValuesAndMD(const std::vector<double>& xValues,
const std::vector<double>& measuredDepths);
void setValuesWithTVD(const std::vector<double>& xValues,
const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths );
const std::vector<double>& xValues() const;
const std::vector<double>& measuredDepths() const;
const std::vector<double>& xValues() const;
const std::vector<double>& measuredDepths() const;
bool calculateMDRange(double* minMD, double* maxMD) const;
std::vector<double> xPlotValues() const;
std::vector<double> depthPlotValues() const;
std::vector< std::pair<size_t, size_t> > polylineStartStopIndices() const;
std::vector<double> xPlotValues() const;
std::vector<double> depthPlotValues() const;
std::vector< std::pair<size_t, size_t> > polylineStartStopIndices() const;
private:
void calculateIntervalsOfContinousValidValues();
void calculateIntervalsOfContinousValidValues();
static void calculateIntervalsOfValidValues(const std::vector<double>& values,
std::vector< std::pair<size_t, size_t> >* intervals);
static void splitIntervalAtEmptySpace(const std::vector<double>& depthValues,
size_t startIdx, size_t stopIdx,
std::vector< std::pair<size_t, size_t> >* intervals);
static void calculateIntervalsOfValidValues(const std::vector<double>& values,
std::vector< std::pair<size_t, size_t> >* intervals);
static void splitIntervalAtEmptySpace(const std::vector<double>& depthValues,
size_t startIdx, size_t stopIdx,
std::vector< std::pair<size_t, size_t> >* intervals);
static void getValuesByIntervals(const std::vector<double>& values,
const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector<double>* filteredValues);
static void computePolyLineStartStopIndices(const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector< std::pair<size_t, size_t> >* filteredIntervals);
static void getValuesByIntervals(const std::vector<double>& values,
const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector<double>* filteredValues);
static void computePolyLineStartStopIndices(const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector< std::pair<size_t, size_t> >* filteredIntervals);
private:
std::vector<double> m_xValues;
std::vector<double> m_measuredDepths;
std::vector<double> m_tvDepths;
std::vector<double> m_xValues;
std::vector<double> m_measuredDepths;
std::vector<double> m_tvDepths;
std::vector< std::pair<size_t, size_t> > m_intervalsOfContinousValidValues;
std::vector< std::pair<size_t, size_t> > m_intervalsOfContinousValidValues;
friend class RigWellLogCurveDataTestInterface;
};

View File

@ -285,7 +285,7 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogPlotCurve* curve, const QSt
double minDepth = 0.0;
double maxDepth = 0.0;
curveData->depthRange(&minDepth, &maxDepth);
curveData->calculateMDRange(&minDepth, &maxDepth);
lasFile.setStartDepth(minDepth);
lasFile.setStopDepth(maxDepth);

View File

@ -132,11 +132,11 @@ void RiuWellLogPlot::modifyWidthOfContainingMdiWindow(int widthChange)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setDepthRangeAndReplot(double minDepth, double maxDepth)
void RiuWellLogPlot::setDepthZoomAndReplot(double minDepth, double maxDepth)
{
for (int tpIdx = 0; tpIdx < m_trackPlots.count(); tpIdx++)
{
m_trackPlots[tpIdx]->setDepthRange(minDepth, maxDepth);
m_trackPlots[tpIdx]->setDepthZoom(minDepth, maxDepth);
m_trackPlots[tpIdx]->replot();
}
@ -168,10 +168,10 @@ void RiuWellLogPlot::slotSetMinDepth(int value)
{
double minimumDepth;
double maximumDepth;
m_plotDefinition->visibleDepthRange(&minimumDepth, &maximumDepth);
m_plotDefinition->depthZoomMinMax(&minimumDepth, &maximumDepth);
double delta = value - minimumDepth;
m_plotDefinition->setVisibleDepthRange(minimumDepth + delta, maximumDepth + delta);
m_plotDefinition->setDepthZoomMinMax(minimumDepth + delta, maximumDepth + delta);
}
//--------------------------------------------------------------------------------------------------

View File

@ -49,7 +49,7 @@ public:
void insertTrackPlot(RiuWellLogTrackPlot* trackPlot, size_t index);
void removeTrackPlot(RiuWellLogTrackPlot* trackPlot);
void setDepthRangeAndReplot(double minDepth, double maxDepth);
void setDepthZoomAndReplot(double minDepth, double maxDepth);
private:
void updateScrollBar(double minDepth, double maxDepth);

View File

@ -132,7 +132,7 @@ void RiuWellLogTrackPlot::setDefaults()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrackPlot::setDepthRange(double minDepth, double maxDepth)
void RiuWellLogTrackPlot::setDepthZoom(double minDepth, double maxDepth)
{
// Note: Y-axis is inverted
setAxisScale(QwtPlot::yLeft, maxDepth, minDepth);
@ -185,11 +185,11 @@ bool RiuWellLogTrackPlot::eventFilter(QObject* watched, QEvent* event)
if (wheelEvent->delta() > 0)
{
plotDefinition->zoomDepth(RIU_SCROLLWHEEL_ZOOMFACTOR, zoomCenter);
plotDefinition->setDepthZoomByFactorAndCenter(RIU_SCROLLWHEEL_ZOOMFACTOR, zoomCenter);
}
else
{
plotDefinition->zoomDepth(1.0/RIU_SCROLLWHEEL_ZOOMFACTOR, zoomCenter);
plotDefinition->setDepthZoomByFactorAndCenter(1.0/RIU_SCROLLWHEEL_ZOOMFACTOR, zoomCenter);
}
}
else

View File

@ -40,7 +40,7 @@ public:
RiuWellLogTrackPlot(RimWellLogPlotTrack* plotTrackDefinition, QWidget* parent = NULL);
virtual ~RiuWellLogTrackPlot();
void setDepthRange(double minDepth, double maxDepth);
void setDepthZoom(double minDepth, double maxDepth);
void setDepthTitle(const QString& title);
void setXRange(double min, double max);