#3155 Remove track spacing

This commit is contained in:
Gaute Lindkvist
2018-07-06 09:17:16 +02:00
parent f8a7ba541f
commit 162d82f8b7
6 changed files with 46 additions and 16 deletions

View File

@@ -285,6 +285,21 @@ RimWellLogTrack* RimWellLogPlot::trackByIndex(size_t index)
return m_tracks[index];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimWellLogPlot::firstVisibleTrackIndex() const
{
for (size_t i = 0; i < m_tracks.size(); ++i)
{
if (m_tracks[i]->isVisible())
{
return i;
}
}
return std::numeric_limits<size_t>::max();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -866,7 +881,7 @@ void RimWellLogPlot::setTrackLegendsHorizontal(bool horizontal)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimWellLogPlot::trackIndex(RimWellLogTrack* track)
size_t RimWellLogPlot::trackIndex(const RimWellLogTrack* track) const
{
return m_tracks.index(track);
}

View File

@@ -85,9 +85,9 @@ public:
size_t trackCount() { return m_tracks.size();}
void removeTrack(RimWellLogTrack* track);
size_t trackIndex(RimWellLogTrack* track);
size_t trackIndex(const RimWellLogTrack* track) const;
RimWellLogTrack* trackByIndex(size_t index);
size_t firstVisibleTrackIndex() const;
void updateTracks(bool autoScaleXAxis = false);
void updateTrackNames();

View File

@@ -670,7 +670,10 @@ void RimWellLogTrack::loadDataAndUpdate()
if (wellLogPlot && m_wellLogTrackPlotWidget)
{
m_wellLogTrackPlotWidget->setDepthTitle(wellLogPlot->depthPlotTitle());
if (isFirstVisibleTrackInPlot())
{
m_wellLogTrackPlotWidget->setDepthTitle(wellLogPlot->depthPlotTitle());
}
m_wellLogTrackPlotWidget->setXTitle(m_xAxisTitle);
}
@@ -1166,6 +1169,17 @@ void RimWellLogTrack::updateAxisScaleEngine()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::isFirstVisibleTrackInPlot() const
{
RimWellLogPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted(plot);
size_t ownIndex = plot->trackIndex(this);
return plot->firstVisibleTrackIndex() == ownIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -167,6 +167,7 @@ private:
void updateFormationNamesOnPlot();
void removeFormationNames();
void updateAxisScaleEngine();
bool isFirstVisibleTrackInPlot() const;
private:
QString m_xAxisTitle;

View File

@@ -380,7 +380,7 @@ void RiuWellLogPlot::placeChildWidgets(int frameHeight, int frameWidth)
positionTitle(frameWidth);
const int trackPadding = 4;
const int trackPadding = 0;
std::map<int, int> trackWidths = calculateTrackWidthsToMatchFrame(frameWidth);
size_t visibleTrackCount = trackWidths.size();

View File

@@ -118,8 +118,11 @@ void RiuWellLogTrack::setXRange(double min, double max)
void RiuWellLogTrack::setDepthTitle(const QString& title)
{
QwtText axisTitleY = axisTitle(QwtPlot::yLeft);
axisTitleY.setText(title);
setAxisTitle(QwtPlot::yLeft, axisTitleY);
if (title != axisTitleY.text())
{
axisTitleY.setText(title);
setAxisTitle(QwtPlot::yLeft, axisTitleY);
}
}
//--------------------------------------------------------------------------------------------------
@@ -129,7 +132,10 @@ void RiuWellLogTrack::setXTitle(const QString& title)
{
QwtText axisTitleX = axisTitle(QwtPlot::xTop);
axisTitleX.setText(title);
setAxisTitle(QwtPlot::xTop, axisTitleX);
if (title != axisTitleX.text())
{
setAxisTitle(QwtPlot::xTop, axisTitleX);
}
}
//--------------------------------------------------------------------------------------------------
@@ -267,14 +273,8 @@ bool RiuWellLogTrack::isRimTrackVisible()
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrack::enableVerticalAxisLabelsAndTitle(bool enable)
{
QString depthAxisTitle("");
if (enable && m_plotTrackDefinition)
{
depthAxisTitle = m_plotTrackDefinition->depthPlotTitle();
}
this->setAxisTitle(QwtPlot::yLeft, depthAxisTitle);
this->axisScaleDraw(QwtPlot::yLeft)->enableComponent(
QwtAbstractScaleDraw::Labels, enable);
this->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtAbstractScaleDraw::Ticks, enable);
this->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtAbstractScaleDraw::Labels, enable);
}
//--------------------------------------------------------------------------------------------------