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(),
|
plot->depthType(),
|
||||||
&formationNamesToPlot,
|
&formationNamesToPlot,
|
||||||
&yValues);
|
&yValues);
|
||||||
|
|
||||||
|
m_annotationTool->attachFormationNames(this->viewer(), formationNamesToPlot, yValues);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_formationWellPath == nullptr) return;
|
if (m_formationWellPath == nullptr) return;
|
||||||
if (plot->depthType() != RimWellLogPlot::MEASURED_DEPTH) return;
|
if (plot->depthType() != RimWellLogPlot::MEASURED_DEPTH) return;
|
||||||
|
|
||||||
std::vector<double> topYValues;
|
std::vector<double> yValues;
|
||||||
|
|
||||||
const RigWellPathFormations* formations = m_formationWellPath->formationsGeometry();
|
const RigWellPathFormations* formations = m_formationWellPath->formationsGeometry();
|
||||||
if (!formations) return;
|
if (!formations) return;
|
||||||
|
|
||||||
formations->measuredDepthAndFormationNamesWithoutDuplicates(formationNamesToPlot, topYValues);
|
formations->measuredDepthAndFormationNamesWithoutDuplicates(formationNamesToPlot, yValues);
|
||||||
|
|
||||||
if (topYValues.empty()) return;
|
m_annotationTool->attachWellPicks(this->viewer(), formationNamesToPlot, yValues);
|
||||||
|
|
||||||
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->attachFormationNames(this->viewer(), formationNamesToPlot, yValues);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -40,49 +40,56 @@ void RiuPlotAnnotationTool::attachFormationNames(QwtPlot* plot, const std::vecto
|
|||||||
|
|
||||||
if (names.size() != yPositions.size()) return;
|
if (names.size() != yPositions.size()) return;
|
||||||
m_plot = plot;
|
m_plot = plot;
|
||||||
QPen curvePen;
|
|
||||||
curvePen.setStyle(Qt::DashLine);
|
|
||||||
curvePen.setColor(QColor(0, 0, 100));
|
|
||||||
curvePen.setWidth(1);
|
|
||||||
|
|
||||||
double delta = 0.5;
|
double delta = 0.5;
|
||||||
|
|
||||||
for (size_t i = 0; i < names.size(); i++)
|
for (size_t i = 0; i < names.size(); i++)
|
||||||
{
|
{
|
||||||
QwtPlotMarker* line(new QwtPlotMarker());
|
QwtPlotMarker* line(new QwtPlotMarker());
|
||||||
|
|
||||||
line->setLineStyle(QwtPlotMarker::HLine);
|
|
||||||
line->setLinePen(curvePen);
|
|
||||||
line->setYValue(yPositions[i].first);
|
|
||||||
|
|
||||||
QString name = names[i];
|
QString name = names[i];
|
||||||
if (names[i].toLower().indexOf("top") == -1)
|
if (names[i].toLower().indexOf("top") == -1)
|
||||||
{
|
{
|
||||||
name += " Top";
|
name += " Top";
|
||||||
}
|
}
|
||||||
|
|
||||||
line->setLabel(name);
|
RiuPlotAnnotationTool::horizontalDashedLine(line, name, yPositions[i].first);
|
||||||
line->setLabelAlignment(Qt::AlignRight | Qt::AlignBottom);
|
|
||||||
|
|
||||||
line->attach(m_plot);
|
line->attach(m_plot);
|
||||||
|
|
||||||
m_markers.push_back(std::move(line));
|
m_markers.push_back(std::move(line));
|
||||||
|
|
||||||
if ((i != names.size() - 1) && cvf::Math::abs(yPositions[i].second - yPositions[i+1].first) > delta)
|
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);
|
bottomLine->attach(m_plot);
|
||||||
line->setLinePen(curvePen);
|
m_markers.push_back(std::move(bottomLine));
|
||||||
line->setYValue(yPositions[i].second);
|
|
||||||
|
|
||||||
line->attach(m_plot);
|
|
||||||
|
|
||||||
m_markers.push_back(std::move(line));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
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();
|
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();
|
~RiuPlotAnnotationTool();
|
||||||
|
|
||||||
void attachFormationNames(QwtPlot* plot, const std::vector<QString>& names, const std::vector<std::pair<double, double>> yPositions);
|
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();
|
void detachAllAnnotations();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void horizontalDashedLine(QwtPlotMarker* line, const QString& name, double yValue);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<QwtPlot> m_plot;
|
QPointer<QwtPlot> m_plot;
|
||||||
std::vector<QwtPlotMarker*> m_markers;
|
std::vector<QwtPlotMarker*> m_markers;
|
||||||
|
Loading…
Reference in New Issue
Block a user