#3466 Add attribute items to legend by creating a new RiuQwtPlotItemGroup that combines sub-graphics

This commit is contained in:
Gaute Lindkvist committed 2018-10-09 14:05:57 +02:00
1 parent 1f9dfd67aa
commit f3a2521eda
11 files changed
+415 -144

No files matched your search

@@ -268,6 +268,7 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
{ {
updateParentPlotLayout(); updateParentPlotLayout();
updateAxisAndGridTickIntervals(); updateAxisAndGridTickIntervals();
applyXZoomFromVisibleRange();
} }
else if (changedField == &m_explicitTickIntervals) else if (changedField == &m_explicitTickIntervals)
{ {
@@ -713,11 +714,11 @@ void RimWellLogTrack::availableDepthRange(double* minimumDepth, double* maximumD
if (m_showWellPathAttributes) if (m_showWellPathAttributes)
{ {
for (RiuWellPathAttributePlotObject& plotObject : m_wellPathAttributePlotObjects) for (cvf::ref<RiuWellPathAttributePlotObject> plotObject : m_wellPathAttributePlotObjects)
{ {
double minObjectDepth = HUGE_VAL; double minObjectDepth = HUGE_VAL;
double maxObjectDepth = -HUGE_VAL; double maxObjectDepth = -HUGE_VAL;
if (plotObject.yValueRange(&minObjectDepth, &maxObjectDepth)) if (plotObject->yValueRange(&minObjectDepth, &maxObjectDepth))
{ {
if (minObjectDepth < minDepth) if (minObjectDepth < minDepth)
{ {
@@ -970,9 +971,9 @@ void RimWellLogTrack::detachAllCurves()
{ {
curve->detachQwtCurve(); curve->detachQwtCurve();
} }
for (RiuWellPathAttributePlotObject& plotObjects : m_wellPathAttributePlotObjects) for (cvf::ref<RiuWellPathAttributePlotObject> plotObjects : m_wellPathAttributePlotObjects)
{ {
plotObjects.detachFromQwt(); plotObjects->detachFromQwt();
} }
} }
@@ -985,9 +986,9 @@ void RimWellLogTrack::reattachAllCurves()
{ {
curve->reattachQwtCurve(); curve->reattachQwtCurve();
} }
for (RiuWellPathAttributePlotObject& plotObjects : m_wellPathAttributePlotObjects) for (cvf::ref<RiuWellPathAttributePlotObject> plotObjects : m_wellPathAttributePlotObjects)
{ {
plotObjects.reattachToQwt(); plotObjects->reattachToQwt();
} }
} }
@@ -1025,12 +1026,13 @@ void RimWellLogTrack::applyXZoomFromVisibleRange()
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax); m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
// Attribute range. Double the width of the radius (thus same as diameter) to allow for labels and casing shoe. // Attribute range. Fixed range where well attributes are positioned [-1, 1].
double attributeRangeMax = 1.0; // Set an extended range here to allow for some label space.
double attributeRangeMax = 1.5 * (10.0 / (m_widthScaleFactor()));
double attributeRangeMin = -0.25; double attributeRangeMin = -0.25;
if (m_showWellPathAttributeBothSides) if (m_showWellPathAttributeBothSides)
{ {
attributeRangeMin = -attributeRangeMax; attributeRangeMin = -1.0;
} }
m_wellLogTrackPlotWidget->setXRange(attributeRangeMin, attributeRangeMax, QwtPlot::xBottom); m_wellLogTrackPlotWidget->setXRange(attributeRangeMin, attributeRangeMax, QwtPlot::xBottom);
@@ -1813,7 +1815,7 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
if (m_showWellPathAttributes && wellPathAttributeSource()) if (m_showWellPathAttributes && wellPathAttributeSource())
{ {
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource())); m_wellPathAttributePlotObjects.push_back(new RiuWellPathAttributePlotObject(wellPathAttributeSource()));
if (m_wellPathAttributeCollection) if (m_wellPathAttributeCollection)
{ {
@@ -1826,7 +1828,7 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
for (RimWellPathAttribute* attribute : attributes) for (RimWellPathAttribute* attribute : attributes)
{ {
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource(), attribute)); m_wellPathAttributePlotObjects.push_back(new RiuWellPathAttributePlotObject(wellPathAttributeSource(), attribute));
} }
} }
if (m_showWellPathAttributesFromCompletions()) if (m_showWellPathAttributesFromCompletions())
@@ -1836,21 +1838,21 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
RimPerforationCollection* perforationsCollection = completions->perforationCollection(); RimPerforationCollection* perforationsCollection = completions->perforationCollection();
for (const RimPerforationInterval* perforationInterval : perforationsCollection->perforations()) for (const RimPerforationInterval* perforationInterval : perforationsCollection->perforations())
{ {
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource(), perforationInterval)); m_wellPathAttributePlotObjects.push_back(new RiuWellPathAttributePlotObject(wellPathAttributeSource(), perforationInterval));
} }
} }
{ {
RimFishbonesCollection* fishbonesCollection = completions->fishbonesCollection(); RimFishbonesCollection* fishbonesCollection = completions->fishbonesCollection();
for (const RimFishbonesMultipleSubs* fishbones : fishbonesCollection->activeFishbonesSubs()) for (const RimFishbonesMultipleSubs* fishbones : fishbonesCollection->activeFishbonesSubs())
{ {
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource(), fishbones)); m_wellPathAttributePlotObjects.push_back(new RiuWellPathAttributePlotObject(wellPathAttributeSource(), fishbones));
} }
} }
{ {
RimWellPathFractureCollection* fractureCollection = completions->fractureCollection(); RimWellPathFractureCollection* fractureCollection = completions->fractureCollection();
for (const RimFracture* fracture : fractureCollection->activeFractures()) for (const RimFracture* fracture : fractureCollection->activeFractures())
{ {
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource(), fracture)); m_wellPathAttributePlotObjects.push_back(new RiuWellPathAttributePlotObject(wellPathAttributeSource(), fracture));
} }
} }
} }
@@ -1860,18 +1862,24 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType(); RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType();
int index = 0; int index = 0;
for (RiuWellPathAttributePlotObject& attributePlotObject : m_wellPathAttributePlotObjects) std::set<QString> attributesAssignedToLegend;
for (cvf::ref<RiuWellPathAttributePlotObject> attributePlotObject : m_wellPathAttributePlotObjects)
{ {
cvf::Color3f attributeColor = cvf::Color3::LIGHT_GRAY; cvf::Color3f attributeColor = cvf::Color3::LIGHT_GRAY;
if (attributePlotObject.attributeType() != RimWellPathAttribute::AttributeWellTube) if (attributePlotObject->attributeType() != RimWellPathAttribute::AttributeWellTube)
{ {
attributeColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(++index); attributeColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(++index);
} }
attributePlotObject.setBaseColor(attributeColor); attributePlotObject->setBaseColor(attributeColor);
attributePlotObject.setDepthType(depthType); attributePlotObject->setDepthType(depthType);
attributePlotObject.setShowLabel(m_showWellPathAttributeLabels()); attributePlotObject->setShowLabel(m_showWellPathAttributeLabels());
attributePlotObject.loadDataAndUpdate(false); QString legendTitle = attributePlotObject->legendTitle();
attributePlotObject.setParentQwtPlotNoReplot(m_wellLogTrackPlotWidget); bool contributeToLegend = m_wellPathAttributesInLegend() &&
!attributesAssignedToLegend.count(legendTitle);
attributePlotObject->setContributeToLegend(contributeToLegend);
attributesAssignedToLegend.insert(legendTitle);
attributePlotObject->loadDataAndUpdate(false);
attributePlotObject->setParentQwtPlotNoReplot(m_wellLogTrackPlotWidget);
} }
} }
applyXZoomFromVisibleRange(); applyXZoomFromVisibleRange();
@@ -220,7 +220,7 @@ private:
caf::PdmPtrField<RimWellPath*> m_wellPathAttributeSource; caf::PdmPtrField<RimWellPath*> m_wellPathAttributeSource;
caf::PdmPtrField<RimWellPathAttributeCollection*> m_wellPathAttributeCollection; caf::PdmPtrField<RimWellPathAttributeCollection*> m_wellPathAttributeCollection;
std::vector<RiuWellPathAttributePlotObject> m_wellPathAttributePlotObjects; std::vector<cvf::ref<RiuWellPathAttributePlotObject>> m_wellPathAttributePlotObjects;
bool m_formationsForCaseWithSimWellOnly; bool m_formationsForCaseWithSimWellOnly;
@@ -100,17 +100,55 @@ double RimWellPathAttribute::diameterInInches() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellPathAttribute::label() const QString RimWellPathAttribute::label() const
{ {
if (m_type == AttributeCasing) QString fullLabel = typeLabel(m_type());
if (m_type() == AttributeCasing || m_type() == AttributeLiner)
{ {
return QString("Casing %1").arg(diameterLabel()); fullLabel += QString(" %1").arg(diameterLabel());
} }
else if (m_type == AttributeLiner) return fullLabel;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathAttribute::typeLabel(AttributeType type)
{
switch (type)
{ {
return QString("Liner %1").arg(diameterLabel()); case AttributeCasing:
} return QString("Casing");
else break;
{ case AttributeLiner:
return m_type().uiText(); return QString("Liner");
break;
case AttributePacker:
return QString("Packer");
break;
case AttributeWellTube:
return QString("Production Tube");
break;
case AttributeFracture:
return QString("Fracture");
break;
case AttributePerforationInterval:
return QString("Perforations");
break;
case AttributeFishbonesInterval:
return QString("Fishbones");
break;
case AttributeAICD:
return QString("AICD");
break;
case AttributeICD:
return QString("ICD");
break;
case AttributeICV:
return QString("ICV");
break;
default:
CVF_ASSERT(false);
return QString("UNKNOWN TYPE");
break;
} }
} }
@@ -54,14 +54,15 @@ public:
RimWellPathAttribute(); RimWellPathAttribute();
~RimWellPathAttribute(); ~RimWellPathAttribute();
AttributeType type() const; AttributeType type() const;
double depthStart() const; double depthStart() const;
double depthEnd() const; double depthEnd() const;
double diameterInInches() const; double diameterInInches() const;
QString label() const; QString label() const;
QString diameterLabel() const; static QString typeLabel(AttributeType type);
bool operator<(const RimWellPathAttribute& rhs) const; QString diameterLabel() const;
void setDepthsFromWellPath(const RimWellPath* wellPath); bool operator<(const RimWellPathAttribute& rhs) const;
void setDepthsFromWellPath(const RimWellPath* wellPath);
private: private:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
@@ -74,6 +74,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuMohrsCirclePlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindowTools.h ${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindowTools.h
${CMAKE_CURRENT_LIST_DIR}/Riu3DMainWindowTools.h ${CMAKE_CURRENT_LIST_DIR}/Riu3DMainWindowTools.h
${CMAKE_CURRENT_LIST_DIR}/RiuDockWidgetTools.h ${CMAKE_CURRENT_LIST_DIR}/RiuDockWidgetTools.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotItemGroup.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellPathAttributePlotObject.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellPathAttributePlotObject.h
) )
@@ -149,6 +150,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuMohrsCirclePlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindowTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindowTools.cpp
${CMAKE_CURRENT_LIST_DIR}/Riu3DMainWindowTools.cpp ${CMAKE_CURRENT_LIST_DIR}/Riu3DMainWindowTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuDockWidgetTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuDockWidgetTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotItemGroup.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuWellPathAttributePlotObject.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuWellPathAttributePlotObject.cpp
) )
@@ -0,0 +1,110 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuQwtPlotItemGroup.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotItemGroup::RiuQwtPlotItemGroup()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotItemGroup::~RiuQwtPlotItemGroup()
{
this->detach();
for (QwtPlotItem* item : m_plotItems)
{
delete item;
}
for (QwtPlotItem* legendItem : m_legendItems)
{
delete legendItem;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotItemGroup::addPlotItem(QwtPlotItem* plotItem)
{
m_plotItems.push_back(plotItem);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotItemGroup::addLegendItem(QwtPlotItem* legendItem)
{
m_legendItems.push_back(legendItem);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotItemGroup::draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const
{
for (const QwtPlotItem* item : m_plotItems)
{
item->draw(painter, xMap, yMap, canvasRect);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QRectF RiuQwtPlotItemGroup::boundingRect() const
{
QRectF totalBoundingRect;
for (const QwtPlotItem* item : m_plotItems)
{
totalBoundingRect = totalBoundingRect.united(item->boundingRect());
}
return totalBoundingRect;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtGraphic RiuQwtPlotItemGroup::legendIcon(int index, const QSizeF& size) const
{
QwtGraphic graphic;
graphic.setDefaultSize(size);
QPainter painter(&graphic);
painter.setRenderHint(QPainter::Antialiasing,
testRenderHint(QwtPlotItem::RenderAntialiased));
for (QwtPlotItem* legendItem : m_legendItems)
{
QwtGraphic subGraphic = legendItem->legendIcon(index, legendItem->legendIconSize());
QRectF boundingRect = legendItem->boundingRect();
QImage subImage = subGraphic.toImage();
QRectF subRect(0.0, 0.0, legendItem->legendIconSize().width(), legendItem->legendIconSize().height());
// Symbols may not have a bounding width/height. Force the width height to be the same as the icon
boundingRect.setWidth(subRect.width());
boundingRect.setHeight(subRect.height());
// Paint onto the existing icon
painter.drawImage(boundingRect, subImage, subRect);
}
return graphic;
}
@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "qwt_plot_item.h"
class QwtGraphic;
class QRectF;
class QPainter;
//==================================================================================================
/// Class that can combine multiple Qwt plot items into one Qwt graphic with a combined legend.
///
//==================================================================================================
class RiuQwtPlotItemGroup : public QwtPlotItem
{
public:
RiuQwtPlotItemGroup();
~RiuQwtPlotItemGroup();
void addPlotItem(QwtPlotItem* plotItem);
void addLegendItem(QwtPlotItem* legendItem);
virtual int rtti() const override { return 5000; }
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override;
virtual QRectF boundingRect() const override;
virtual QwtGraphic legendIcon(int index, const QSizeF &size) const override;
private:
std::vector<QwtPlotItem*> m_plotItems;
std::vector<QwtPlotItem*> m_legendItems;
};
+14 -15
View File
@@ -56,10 +56,10 @@ RiuQwtSymbol::RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, Label
style = QwtSymbol::Path; style = QwtSymbol::Path;
{ {
QPainterPath path; QPainterPath path;
path.moveTo(0, -10); path.moveTo(0, 0);
path.lineTo(-10, 0); path.lineTo(-10, 10);
path.lineTo(0, 10); path.lineTo(0, 20);
path.lineTo(0, -10); path.lineTo(0, 0);
setPath(path); setPath(path);
setPinPoint(QPointF(0, 0)); setPinPoint(QPointF(0, 0));
} }
@@ -68,10 +68,10 @@ RiuQwtSymbol::RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, Label
style = QwtSymbol::Path; style = QwtSymbol::Path;
{ {
QPainterPath path; QPainterPath path;
path.moveTo(0, -10); path.moveTo(0, 0);
path.lineTo(10, 0); path.lineTo(10, 10);
path.lineTo(0, 10); path.lineTo(0, 20);
path.lineTo(0, -10); path.lineTo(0, 0);
setPath(path); setPath(path);
setPinPoint(QPointF(0, 0)); setPinPoint(QPointF(0, 0));
} }
@@ -81,11 +81,11 @@ RiuQwtSymbol::RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, Label
{ {
QPainterPath path; QPainterPath path;
path.moveTo(0, 0); path.moveTo(0, 0);
path.lineTo(-10, 0); path.lineTo(0, 10);
path.lineTo(0, -10); path.lineTo(-10, 10);
path.lineTo(0, 0); path.lineTo(0, 0);
setPath(path); setPath(path);
setPinPoint(QPointF(0, 0)); setPinPoint(QPointF(0, 10));
} }
break; break;
case SYMBOL_RIGHT_ANGLED_TRIANGLE: case SYMBOL_RIGHT_ANGLED_TRIANGLE:
@@ -93,11 +93,11 @@ RiuQwtSymbol::RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, Label
{ {
QPainterPath path; QPainterPath path;
path.moveTo(0, 0); path.moveTo(0, 0);
path.lineTo(10, 0); path.lineTo(0, 10);
path.lineTo(0, -10); path.lineTo(10, 10);
path.lineTo(0, 0); path.lineTo(0, 0);
setPath(path); setPath(path);
setPinPoint(QPointF(0, 0)); setPinPoint(QPointF(0, 10));
} }
break; break;
default: default:
@@ -151,4 +151,3 @@ void RiuQwtSymbol::setLabelPosition(LabelPosition labelPosition)
{ {
m_labelPosition = labelPosition; m_labelPosition = labelPosition;
} }
+1 -1
View File
@@ -60,7 +60,7 @@ public:
QString label() const { return m_label; } QString label() const { return m_label; }
void setLabelPosition(LabelPosition labelPosition); void setLabelPosition(LabelPosition labelPosition);
private: private:
QString m_label; QString m_label;
LabelPosition m_labelPosition; LabelPosition m_labelPosition;
@@ -30,7 +30,6 @@
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RigWellPath.h" #include "RigWellPath.h"
#include "RiuQwtPlotCurve.h"
#include "qwt_plot.h" #include "qwt_plot.h"
#include "qwt_plot_marker.h" #include "qwt_plot_marker.h"
@@ -39,6 +38,7 @@
#include <QBrush> #include <QBrush>
#include <Qt> #include <Qt>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -77,6 +77,7 @@ RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(const RimWellPath
m_startMD = wellPathAttribute->depthStart(); m_startMD = wellPathAttribute->depthStart();
m_endMD = wellPathAttribute->depthEnd(); m_endMD = wellPathAttribute->depthEnd();
m_label = wellPathAttribute->label(); m_label = wellPathAttribute->label();
m_legendTitle = wellPathAttribute->label();
} }
} }
@@ -94,9 +95,10 @@ RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(
{ {
CVF_ASSERT(wellPath && perforationInterval); CVF_ASSERT(wellPath && perforationInterval);
m_startMD = perforationInterval->startMD(); m_startMD = perforationInterval->startMD();
m_endMD = perforationInterval->endMD(); m_endMD = perforationInterval->endMD();
m_label = QString("Perforations: %1").arg(perforationInterval->name()); m_label = QString("Perforation Interval\n%1").arg(perforationInterval->name());
m_legendTitle = "Perforations";
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -116,6 +118,7 @@ RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(
m_startMD = fishbones->startOfSubMD(); m_startMD = fishbones->startOfSubMD();
m_endMD = fishbones->endOfSubMD(); m_endMD = fishbones->endOfSubMD();
m_label = fishbones->generatedName(); m_label = fishbones->generatedName();
m_legendTitle = "Fishbones";
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -134,7 +137,7 @@ RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(
if (fracture->fractureTemplate()->orientationType() == RimFractureTemplate::ALONG_WELL_PATH) if (fracture->fractureTemplate()->orientationType() == RimFractureTemplate::ALONG_WELL_PATH)
{ {
m_startMD = fracture->fractureMD() + 0.5*fracture->perforationLength(); m_startMD = fracture->fractureMD() - 0.5*fracture->perforationLength();
m_endMD = m_startMD + fracture->perforationLength(); m_endMD = m_startMD + fracture->perforationLength();
} }
else else
@@ -143,6 +146,7 @@ RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(
m_endMD = m_startMD + fracture->fractureTemplate()->computeFractureWidth(fracture); m_endMD = m_startMD + fracture->fractureTemplate()->computeFractureWidth(fracture);
} }
m_label = fracture->name(); m_label = fracture->name();
m_legendTitle = "Fracture";
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -151,10 +155,6 @@ RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(
RiuWellPathAttributePlotObject::~RiuWellPathAttributePlotObject() RiuWellPathAttributePlotObject::~RiuWellPathAttributePlotObject()
{ {
detachFromQwt(); detachFromQwt();
for (QwtPlotItem* plotFeature : m_plotFeatures)
{
delete plotFeature;
}
if (m_parentQwtPlot) if (m_parentQwtPlot)
{ {
@@ -165,7 +165,7 @@ RiuWellPathAttributePlotObject::~RiuWellPathAttributePlotObject()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiuWellPathAttributePlotObject::label() QString RiuWellPathAttributePlotObject::label() const
{ {
return m_label; return m_label;
} }
@@ -193,6 +193,7 @@ void RiuWellPathAttributePlotObject::onLoadDataAndUpdate(bool updateParentPlot)
{ {
double startDepth, endDepth; double startDepth, endDepth;
std::tie(startDepth, endDepth) = depthsOfDepthType(); std::tie(startDepth, endDepth) = depthsOfDepthType();
double midDepth = 0.5 * (startDepth + endDepth);
float columnAlpha = 0.9f; float columnAlpha = 0.9f;
@@ -207,24 +208,22 @@ void RiuWellPathAttributePlotObject::onLoadDataAndUpdate(bool updateParentPlot)
addColumnFeature(-0.75, -0.5, startDepth, endDepth, m_baseColor); addColumnFeature(-0.75, -0.5, startDepth, endDepth, m_baseColor);
addColumnFeature(0.5, 0.75, startDepth, endDepth, m_baseColor); addColumnFeature(0.5, 0.75, startDepth, endDepth, m_baseColor);
addMarker(-0.75, endDepth,10, RiuQwtSymbol::SYMBOL_LEFT_ANGLED_TRIANGLE, m_baseColor); addMarker(-0.75, endDepth,10, RiuQwtSymbol::SYMBOL_LEFT_ANGLED_TRIANGLE, m_baseColor);
addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, m_baseColor); addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, m_baseColor, label());
addMarker(0.625, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, m_baseColor, label());
} }
else if (m_attributeType == RimWellPathAttribute::AttributeLiner) else if (m_attributeType == RimWellPathAttribute::AttributeLiner)
{ {
addColumnFeature(-0.5, -0.25, startDepth, endDepth, m_baseColor); addColumnFeature(-0.5, -0.25, startDepth, endDepth, m_baseColor);
addColumnFeature(0.25, 0.5, startDepth, endDepth, m_baseColor); addColumnFeature(0.25, 0.5, startDepth, endDepth, m_baseColor);
addMarker(0.375, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, transparentBaseColor, label(), Qt::AlignTop); addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, transparentBaseColor, label());
} }
else if (m_attributeType == RimWellPathAttribute::AttributePerforationInterval) else if (m_attributeType == RimWellPathAttribute::AttributePerforationInterval)
{ {
addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::Dense6Pattern); addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::Dense6Pattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::Dense6Pattern); addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::Dense6Pattern);
addMarker(0.626, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::WHITE, 0.0), label(), Qt::AlignTop);
// Empirically a spacing of around 30 in depth between symbols looks good in the most relevant zoom levels. // Empirically a spacing of around 30 in depth between symbols looks good in the most relevant zoom levels.
const double markerSpacing = 30; const double markerSpacing = 30;
const int markerSize = 6; const int markerSize = 6;
double markerDepth = startDepth + 0.5 * markerSpacing; double markerDepth = startDepth;
while (markerDepth <= endDepth) while (markerDepth <= endDepth)
{ {
addMarker(-0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 1.0f)); addMarker(-0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 1.0f));
@@ -232,26 +231,28 @@ void RiuWellPathAttributePlotObject::onLoadDataAndUpdate(bool updateParentPlot)
markerDepth += markerSpacing; markerDepth += markerSpacing;
} }
addMarker(0.75, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 0.0), label());
QwtPlotItem* legendItem1 = createMarker(16.0, 0.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 1.0f));
legendItem1->setLegendIconSize(QSize(4, 8));
QwtPlotItem* legendItem2 = createMarker(16.0, 8.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 1.0f));
legendItem2->setLegendIconSize(QSize(4, 8));
m_combinedAttributeGroup.addLegendItem(legendItem1);
m_combinedAttributeGroup.addLegendItem(legendItem2);
} }
else if (m_attributeType == RimWellPathAttribute::AttributeFishbonesInterval) else if (m_attributeType == RimWellPathAttribute::AttributeFishbonesInterval)
{ {
addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::BDiagPattern); addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::BDiagPattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::FDiagPattern); addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::FDiagPattern);
addMarker(0.625, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::WHITE, 0.0f), label(), Qt::AlignTop); addMarker(0.75, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 0.0f), label());
} }
else if (m_attributeType == RimWellPathAttribute::AttributeFracture) else if (m_attributeType == RimWellPathAttribute::AttributeFracture)
{ {
if (std::abs(m_endMD - m_startMD) < 20) addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::ORANGE_RED, columnAlpha), Qt::SolidPattern);
{ addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::ORANGE_RED, columnAlpha), Qt::SolidPattern);
addMarker(0.625, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::ORANGE_RED, 1.0f), label(), Qt::AlignTop, Qt::Horizontal, true, false); addMarker(0.75, startDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::ORANGE_RED, 1.0f), "", Qt::AlignTop | Qt::AlignRight, Qt::Horizontal, true);
} addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::ORANGE_RED, 1.0f), "", Qt::AlignTop | Qt::AlignRight, Qt::Horizontal, true);
else addMarker(0.75, startDepth, 1, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, cvf::Color4f(cvf::Color3::ORANGE_RED, 0.0f), label(), Qt::AlignTop | Qt::AlignRight);
{
addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::ORANGE_RED, columnAlpha), Qt::HorPattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::ORANGE_RED, columnAlpha), Qt::HorPattern);
addMarker(0.625, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::ORANGE_RED, 0.0f), label(), Qt::AlignTop);
}
} }
else if (m_attributeType == RimWellPathAttribute::AttributeICD) else if (m_attributeType == RimWellPathAttribute::AttributeICD)
{ {
@@ -259,9 +260,11 @@ void RiuWellPathAttributePlotObject::onLoadDataAndUpdate(bool updateParentPlot)
} }
else if (m_attributeType == RimWellPathAttribute::AttributePacker) else if (m_attributeType == RimWellPathAttribute::AttributePacker)
{ {
addColumnFeature(-1.0, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::GRAY, 1.0f), Qt::SolidPattern); addColumnFeature(-1.0, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::GRAY, 1.0f), Qt::DiagCrossPattern);
addColumnFeature(0.25, 1.0, startDepth, endDepth, cvf::Color4f(cvf::Color3::GRAY, 1.0f), Qt::SolidPattern); addColumnFeature(0.25, 1.0, startDepth, endDepth, cvf::Color4f(cvf::Color3::GRAY, 1.0f), Qt::DiagCrossPattern);
} }
m_combinedAttributeGroup.setTitle(legendTitle());
m_combinedAttributeGroup.setLegendIconSize(QSize(20, 16));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -285,29 +288,38 @@ std::pair<double, double> RiuWellPathAttributePlotObject::depthsOfDepthType() co
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::addMarker(double posX, void RiuWellPathAttributePlotObject::addMarker(double posX,
double depth, double depth,
int size, int size,
RiuQwtSymbol::PointSymbolEnum symbolType, RiuQwtSymbol::PointSymbolEnum symbolType,
cvf::Color4f baseColor, cvf::Color4f baseColor,
QString label /*= QString("")*/, QString label /*= QString("")*/,
Qt::Alignment labelAlignment /*= Qt::AlignTop*/, Qt::Alignment labelAlignment /*= Qt::AlignTop*/,
Qt::Orientation labelOrientation /*= Qt::Vertical*/, Qt::Orientation labelOrientation /*= Qt::Vertical*/,
bool drawLine /*= false*/, bool drawLine /*= false*/,
bool contrastTextColor /*= true*/) bool contrastTextColor /*= true*/)
{ {
QColor bgColor = RiaColorTools::toQColor(baseColor); QwtPlotItem* marker = createMarker(posX, depth, size, symbolType, baseColor, label, labelAlignment, labelOrientation, drawLine, contrastTextColor);
QColor textColor = bgColor; m_combinedAttributeGroup.addPlotItem(marker);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtPlotItem* RiuWellPathAttributePlotObject::createMarker(double posX, double depth, int size, RiuQwtSymbol::PointSymbolEnum symbolType, cvf::Color4f baseColor, QString label /*= QString("")*/, Qt::Alignment labelAlignment /*= Qt::AlignTop*/, Qt::Orientation labelOrientation /*= Qt::Vertical*/, bool drawLine /*= false*/, bool contrastTextColor /*= true*/)
{
QColor bgColor = RiaColorTools::toQColor(baseColor);
QColor textColor = RiaColorTools::toQColor(baseColor.toColor3f(), 1.0);
if (contrastTextColor) if (contrastTextColor)
{ {
textColor = RiaColorTools::toQColor(RiaColorTools::constrastColor(baseColor.toColor3f())); textColor = RiaColorTools::toQColor(RiaColorTools::constrastColor(baseColor.toColor3f()));
} }
QwtPlotMarker* marker = new QwtPlotMarker(label); QwtPlotMarker* marker = new QwtPlotMarker(label);
RiuQwtSymbol* symbol = new RiuQwtSymbol(symbolType, "", RiuQwtSymbol::LabelRightOfSymbol); RiuQwtSymbol* symbol = new RiuQwtSymbol(symbolType, "", RiuQwtSymbol::LabelRightOfSymbol);
symbol->setSize(size); symbol->setSize(size);
symbol->setColor(bgColor); symbol->setColor(bgColor);
marker->setSymbol(symbol); marker->setSymbol(symbol);
marker->setSpacing(2); marker->setSpacing(6);
marker->setXValue(posX); marker->setXValue(posX);
marker->setYValue(depth); marker->setYValue(depth);
@@ -326,36 +338,52 @@ void RiuWellPathAttributePlotObject::addMarker(double pos
if (drawLine) if (drawLine)
{ {
marker->setLineStyle(QwtPlotMarker::HLine); marker->setLineStyle(QwtPlotMarker::HLine);
marker->setLinePen(bgColor, 5.0, Qt::DashLine); marker->setLinePen(bgColor, 2.0, Qt::SolidLine);
} }
m_plotFeatures.push_back(marker); return marker;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::addColumnFeature(double startX, double endX, double startDepth, double endDepth, cvf::Color4f baseColor, Qt::BrushStyle brushStyle) void RiuWellPathAttributePlotObject::addColumnFeature(double startX,
{ double endX,
drawColumnFeature(startX, endX, startDepth, endDepth, baseColor, Qt::SolidPattern); double startDepth,
double endDepth,
cvf::Color4f baseColor,
Qt::BrushStyle brushStyle /*= Qt::SolidPattern*/)
{
QwtPlotItem* backgroundShape = createColumnShape(startX, endX, startDepth, endDepth, baseColor, Qt::SolidPattern);
m_combinedAttributeGroup.addPlotItem(backgroundShape);
if (startX >= 0.0)
{
QwtPlotItem* legendShape = createColumnShape(0.0, 16.0, 0.0, 16.0, baseColor, Qt::SolidPattern);
m_combinedAttributeGroup.addLegendItem(legendShape);
}
if (brushStyle != Qt::SolidPattern) if (brushStyle != Qt::SolidPattern)
{ {
// If we're doing a special pattern, draw the pattern in black over the existing pattern // If we're doing a special pattern, draw the pattern in black over the existing pattern
drawColumnFeature(startX, endX, startDepth, endDepth, cvf::Color4f(cvf::Color3::BLACK), brushStyle); QwtPlotItem* patternShape = createColumnShape(startX, endX, startDepth, endDepth, cvf::Color4f(cvf::Color3::BLACK), brushStyle);
m_combinedAttributeGroup.addPlotItem(patternShape);
if (startX >= 0.0)
{
QwtPlotItem* legendShape = createColumnShape(0.0, 16.0, 0.0, 16.0, cvf::Color4f(cvf::Color3::BLACK), brushStyle);
m_combinedAttributeGroup.addLegendItem(legendShape);
}
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::drawColumnFeature(double startX, QwtPlotItem* RiuWellPathAttributePlotObject::createColumnShape(double startX,
double endX, double endX,
double startDepth, double startDepth,
double endDepth, double endDepth,
cvf::Color4f baseColor, cvf::Color4f baseColor,
Qt::BrushStyle brushStyle) Qt::BrushStyle brushStyle)
{ {
QwtPlotShapeItem* rightSide = new QwtPlotShapeItem(label()); QwtPlotShapeItem* columnShape = new QwtPlotShapeItem(label());
QPolygonF polygon; QPolygonF polygon;
QColor color = RiaColorTools::toQColor(baseColor); QColor color = RiaColorTools::toQColor(baseColor);
@@ -364,10 +392,12 @@ void RiuWellPathAttributePlotObject::drawColumnFeature(double startX,
polygon.push_back(QPointF(endX, endDepth)); polygon.push_back(QPointF(endX, endDepth));
polygon.push_back(QPointF(startX, endDepth)); polygon.push_back(QPointF(startX, endDepth));
polygon.push_back(QPointF(startX, startDepth)); polygon.push_back(QPointF(startX, startDepth));
rightSide->setPolygon(polygon); columnShape->setPolygon(polygon);
rightSide->setXAxis(QwtPlot::xBottom); columnShape->setXAxis(QwtPlot::xBottom);
rightSide->setBrush(QBrush(color, brushStyle)); columnShape->setBrush(QBrush(color, brushStyle));
m_plotFeatures.push_back(rightSide); columnShape->setLegendMode(QwtPlotShapeItem::LegendShape);
columnShape->setLegendIconSize(QSize(16, 16));
return columnShape;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -428,6 +458,18 @@ void RiuWellPathAttributePlotObject::setBaseColor(const cvf::Color4f& baseColor)
m_baseColor = baseColor; m_baseColor = baseColor;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::setContributeToLegend(bool contributeToLegend)
{
bool actuallyContributeToLegend = contributeToLegend && (m_attributeType == RimWellPathAttribute::AttributeFishbonesInterval ||
m_attributeType == RimWellPathAttribute::AttributeFracture ||
m_attributeType == RimWellPathAttribute::AttributePerforationInterval ||
m_attributeType == RimWellPathAttribute::AttributePacker);
m_combinedAttributeGroup.setItemAttribute(QwtPlotItem::Legend, actuallyContributeToLegend);
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -456,10 +498,7 @@ void RiuWellPathAttributePlotObject::attachToQwt()
{ {
if (m_parentQwtPlot) if (m_parentQwtPlot)
{ {
for (QwtPlotItem* plotFeature : m_plotFeatures) m_combinedAttributeGroup.attach(m_parentQwtPlot);
{
plotFeature->attach(m_parentQwtPlot);
}
} }
} }
@@ -468,10 +507,7 @@ void RiuWellPathAttributePlotObject::attachToQwt()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::detachFromQwt() void RiuWellPathAttributePlotObject::detachFromQwt()
{ {
for (QwtPlotItem* plotFeature : m_plotFeatures) m_combinedAttributeGroup.detach();
{
plotFeature->detach();
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -482,3 +518,11 @@ void RiuWellPathAttributePlotObject::reattachToQwt()
detachFromQwt(); detachFromQwt();
attachToQwt(); attachToQwt();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuWellPathAttributePlotObject::legendTitle() const
{
return m_legendTitle;
}
@@ -18,6 +18,8 @@
#pragma once #pragma once
#include "RiuQwtPlotItemGroup.h"
#include "RimPlotCurve.h" #include "RimPlotCurve.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellPathAttribute.h" #include "RimWellPathAttribute.h"
@@ -27,6 +29,7 @@
#include "cafPdmPtrField.h" #include "cafPdmPtrField.h"
#include "cvfColor4.h" #include "cvfColor4.h"
#include "cvfObject.h"
#include <QBrush> #include <QBrush>
#include <QString> #include <QString>
@@ -38,11 +41,13 @@ class RimPerforationInterval;
class RimWellPath; class RimWellPath;
class QwtPlotItem; class QwtPlotItem;
//================================================================================================== //==================================================================================================
/// ///
/// ///
//================================================================================================== //==================================================================================================
class RiuWellPathAttributePlotObject class RiuWellPathAttributePlotObject : public cvf::Object
{ {
public: public:
@@ -62,7 +67,9 @@ public:
~RiuWellPathAttributePlotObject(); ~RiuWellPathAttributePlotObject();
QString label(); QString label() const;
QString legendTitle() const;
void loadDataAndUpdate(bool updateParentPlot); void loadDataAndUpdate(bool updateParentPlot);
RimWellPathAttribute::AttributeType attributeType() const; RimWellPathAttribute::AttributeType attributeType() const;
@@ -74,28 +81,39 @@ public:
void setDepthType(RimWellLogPlot::DepthTypeEnum depthType); void setDepthType(RimWellLogPlot::DepthTypeEnum depthType);
void setBaseColor(const cvf::Color3f& baseColor); void setBaseColor(const cvf::Color3f& baseColor);
void setBaseColor(const cvf::Color4f& baseColor); void setBaseColor(const cvf::Color4f& baseColor);
void setContributeToLegend(bool contributeToLegend);
void setParentQwtPlotAndReplot(QwtPlot* plot); void setParentQwtPlotAndReplot(QwtPlot* plot);
void setParentQwtPlotNoReplot(QwtPlot* plot); void setParentQwtPlotNoReplot(QwtPlot* plot);
void attachToQwt(); void attachToQwt();
void detachFromQwt(); void detachFromQwt();
void reattachToQwt(); void reattachToQwt();
private: private:
void onLoadDataAndUpdate(bool updateParentPlot); void onLoadDataAndUpdate(bool updateParentPlot);
std::pair<double, double> depthsOfDepthType() const; std::pair<double, double> depthsOfDepthType() const;
void addMarker(double posX, void addMarker(double posX,
double depth, double depth,
int size, int size,
RiuQwtSymbol::PointSymbolEnum symbolType, RiuQwtSymbol::PointSymbolEnum symbolType,
cvf::Color4f baseColor, cvf::Color4f baseColor,
QString label = QString(""), QString label = QString(""),
Qt::Alignment labelAlignment = Qt::AlignTop, Qt::Alignment labelAlignment = Qt::AlignVCenter | Qt::AlignRight,
Qt::Orientation labelOrientation = Qt::Vertical, Qt::Orientation labelOrientation = Qt::Horizontal,
bool drawLine = false, bool drawLine = false,
bool contrastTextColor = true); bool contrastTextColor = false);
QwtPlotItem* createMarker(double posX,
double depth,
int size,
RiuQwtSymbol::PointSymbolEnum symbolType,
cvf::Color4f baseColor,
QString label = QString(""),
Qt::Alignment labelAlignment = Qt::AlignVCenter | Qt::AlignRight,
Qt::Orientation labelOrientation = Qt::Horizontal,
bool drawLine = false,
bool contrastTextColor = false);
void addColumnFeature(double startX, void addColumnFeature(double startX,
double endX, double endX,
double startDepth, double startDepth,
@@ -103,12 +121,12 @@ private:
cvf::Color4f baseColor, cvf::Color4f baseColor,
Qt::BrushStyle brushStyle = Qt::SolidPattern); Qt::BrushStyle brushStyle = Qt::SolidPattern);
void drawColumnFeature(double startX, QwtPlotItem* createColumnShape(double startX,
double endX, double endX,
double startDepth, double startDepth,
double endDepth, double endDepth,
cvf::Color4f baseColor, cvf::Color4f baseColor,
Qt::BrushStyle brushStyle = Qt::SolidPattern); Qt::BrushStyle brushStyle = Qt::SolidPattern);
private: private:
const RimWellPath* m_wellPath; const RimWellPath* m_wellPath;
@@ -117,11 +135,12 @@ private:
double m_startMD; double m_startMD;
double m_endMD; double m_endMD;
QString m_label; QString m_label;
QString m_legendTitle;
RimWellLogPlot::DepthTypeEnum m_depthType; RimWellLogPlot::DepthTypeEnum m_depthType;
QPointer<QwtPlot> m_parentQwtPlot; QPointer<QwtPlot> m_parentQwtPlot;
std::vector<QwtPlotItem*> m_plotFeatures; RiuQwtPlotItemGroup m_combinedAttributeGroup;
cvf::Color4f m_baseColor; cvf::Color4f m_baseColor;
bool m_showLabel; bool m_showLabel;
}; };