mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2226 Well Formations: Avoid adding "Top" to the formation names
This commit is contained in:
parent
77f4b4bb4b
commit
899a226a38
@ -1234,29 +1234,23 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
|
||||
plot->depthType(),
|
||||
&formationNamesToPlot,
|
||||
&yValues);
|
||||
|
||||
m_annotationTool->attachFormationNames(this->viewer(), formationNamesToPlot, yValues);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_formationWellPath == nullptr) return;
|
||||
if (plot->depthType() != RimWellLogPlot::MEASURED_DEPTH) return;
|
||||
|
||||
std::vector<double> topYValues;
|
||||
std::vector<double> yValues;
|
||||
|
||||
const RigWellPathFormations* formations = m_formationWellPath->formationsGeometry();
|
||||
if (!formations) return;
|
||||
|
||||
formations->measuredDepthAndFormationNamesWithoutDuplicates(formationNamesToPlot, topYValues);
|
||||
formations->measuredDepthAndFormationNamesWithoutDuplicates(formationNamesToPlot, yValues);
|
||||
|
||||
if (topYValues.empty()) return;
|
||||
|
||||
for (size_t i = 0; i < topYValues.size() - 1; i++)
|
||||
{
|
||||
yValues.push_back(std::pair<double, double>(topYValues[i], topYValues[i + 1]));
|
||||
}
|
||||
yValues.push_back(std::pair<double, double>(topYValues.back(), topYValues.back()));
|
||||
m_annotationTool->attachWellPicks(this->viewer(), formationNamesToPlot, yValues);
|
||||
}
|
||||
|
||||
m_annotationTool->attachFormationNames(this->viewer(), formationNamesToPlot, yValues);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -40,49 +40,56 @@ void RiuPlotAnnotationTool::attachFormationNames(QwtPlot* plot, const std::vecto
|
||||
|
||||
if (names.size() != yPositions.size()) return;
|
||||
m_plot = plot;
|
||||
QPen curvePen;
|
||||
curvePen.setStyle(Qt::DashLine);
|
||||
curvePen.setColor(QColor(0, 0, 100));
|
||||
curvePen.setWidth(1);
|
||||
|
||||
double delta = 0.5;
|
||||
|
||||
for (size_t i = 0; i < names.size(); i++)
|
||||
{
|
||||
QwtPlotMarker* line(new QwtPlotMarker());
|
||||
|
||||
line->setLineStyle(QwtPlotMarker::HLine);
|
||||
line->setLinePen(curvePen);
|
||||
line->setYValue(yPositions[i].first);
|
||||
|
||||
QString name = names[i];
|
||||
if (names[i].toLower().indexOf("top") == -1)
|
||||
{
|
||||
name += " Top";
|
||||
}
|
||||
|
||||
line->setLabel(name);
|
||||
line->setLabelAlignment(Qt::AlignRight | Qt::AlignBottom);
|
||||
|
||||
RiuPlotAnnotationTool::horizontalDashedLine(line, name, yPositions[i].first);
|
||||
|
||||
line->attach(m_plot);
|
||||
|
||||
m_markers.push_back(std::move(line));
|
||||
|
||||
if ((i != names.size() - 1) && cvf::Math::abs(yPositions[i].second - yPositions[i+1].first) > delta)
|
||||
{
|
||||
QwtPlotMarker* line(new QwtPlotMarker());
|
||||
QwtPlotMarker* bottomLine(new QwtPlotMarker());
|
||||
RiuPlotAnnotationTool::horizontalDashedLine(bottomLine, QString(), yPositions[i].second);
|
||||
|
||||
line->setLineStyle(QwtPlotMarker::HLine);
|
||||
line->setLinePen(curvePen);
|
||||
line->setYValue(yPositions[i].second);
|
||||
|
||||
line->attach(m_plot);
|
||||
|
||||
m_markers.push_back(std::move(line));
|
||||
bottomLine->attach(m_plot);
|
||||
m_markers.push_back(std::move(bottomLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotAnnotationTool::attachWellPicks(QwtPlot* plot, const std::vector<QString>& names, const std::vector<double> yPositions)
|
||||
{
|
||||
detachAllAnnotations();
|
||||
|
||||
if (names.size() != yPositions.size()) return;
|
||||
m_plot = plot;
|
||||
|
||||
double delta = 0.5;
|
||||
|
||||
for (size_t i = 0; i < names.size(); i++)
|
||||
{
|
||||
QwtPlotMarker* line(new QwtPlotMarker());
|
||||
RiuPlotAnnotationTool::horizontalDashedLine(line, names[i], yPositions[i]);
|
||||
line->attach(m_plot);
|
||||
m_markers.push_back(std::move(line));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -98,3 +105,21 @@ void RiuPlotAnnotationTool::detachAllAnnotations()
|
||||
}
|
||||
m_markers.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotAnnotationTool::horizontalDashedLine(QwtPlotMarker* line, const QString& name, double yValue)
|
||||
{
|
||||
QPen curvePen;
|
||||
curvePen.setStyle(Qt::DashLine);
|
||||
curvePen.setColor(QColor(0, 0, 100));
|
||||
curvePen.setWidth(1);
|
||||
|
||||
line->setLineStyle(QwtPlotMarker::HLine);
|
||||
line->setLinePen(curvePen);
|
||||
line->setYValue(yValue);
|
||||
line->setLabel(name);
|
||||
line->setLabelAlignment(Qt::AlignRight | Qt::AlignBottom);
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,12 @@ public:
|
||||
~RiuPlotAnnotationTool();
|
||||
|
||||
void attachFormationNames(QwtPlot* plot, const std::vector<QString>& names, const std::vector<std::pair<double, double>> yPositions);
|
||||
void attachWellPicks(QwtPlot* plot, const std::vector<QString>& names, const std::vector<double> yPositions);
|
||||
void detachAllAnnotations();
|
||||
|
||||
private:
|
||||
static void horizontalDashedLine(QwtPlotMarker* line, const QString& name, double yValue);
|
||||
|
||||
private:
|
||||
QPointer<QwtPlot> m_plot;
|
||||
std::vector<QwtPlotMarker*> m_markers;
|
||||
|
Loading…
Reference in New Issue
Block a user