Depth Track Plots: Optionally show a line in all tracks

* #9378 Depth Track Plots: Optionally show a line in all tracks
* Use RiaDefines::Orientation
This commit is contained in:
Magne Sjaastad 2022-10-24 16:24:51 +02:00 committed by GitHub
parent 286855cce0
commit a33f651bcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 341 additions and 111 deletions

View File

@ -54,6 +54,28 @@ void caf::AppEnum<RiaDefines::ObjectNamingMethod>::setUp()
setDefault( RiaDefines::ObjectNamingMethod::AUTO );
}
template <>
void caf::AppEnum<Qt::PenStyle>::setUp()
{
addItem( Qt::PenStyle::NoPen, "NO_PEN", "No Pen" );
addItem( Qt::PenStyle::SolidLine, "SOLID_LINE", "Solid Line" );
addItem( Qt::PenStyle::DashLine, "DASH_LINE", "Dash Line" );
addItem( Qt::PenStyle::DotLine, "DOT_LINE", "Dot Line" );
addItem( Qt::PenStyle::DashDotLine, "DASH_DOT_LINE", "Dash Dot Line" );
addItem( Qt::PenStyle::DashDotDotLine, "DASH_DOT_DOT_LINE", "Dash Dot Dot Line" );
setDefault( Qt::PenStyle::SolidLine );
}
template <>
void caf::AppEnum<RiaDefines::Orientation>::setUp()
{
addItem( RiaDefines::Orientation::HORIZONTAL, "HORIZONTAL", "Horizontal" );
addItem( RiaDefines::Orientation::VERTICAL, "VERTICAL", "Vertical" );
setDefault( RiaDefines::Orientation::VERTICAL );
}
}; // namespace caf
//--------------------------------------------------------------------------------------------------

View File

@ -69,6 +69,7 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
plot->setNameTemplateText( templateText );
plot->setPlotTitleVisible( true );
plot->setLegendItemsClickable( false );
plot->enableDepthMarkerLine( true );
QString wellName = "Unknown";

View File

@ -68,6 +68,7 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
plot->setNameTemplateText( templateText );
plot->setPlotTitleVisible( true );
plot->setLegendItemsClickable( false );
plot->enableDepthMarkerLine( true );
QString wellName = "Unknown";

View File

@ -89,7 +89,7 @@ RimWellBoreStabilityPlot*
RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot()
{
auto plot = createWellLogPlot();
plot->setDepthOrientation( RimDepthTrackPlot::DepthOrientation::HORIZONTAL );
plot->setDepthOrientation( RiaDefines::Orientation::HORIZONTAL );
plot->setLegendsHorizontal( true );
return plot;

View File

@ -38,6 +38,7 @@
#include "RimMainPlotCollection.h"
#include "RimOilField.h"
#include "RimPlot.h"
#include "RimPlotAxisAnnotation.h"
#include "RimPlotWindow.h"
#include "RimProject.h"
#include "RimWellAllocationPlot.h"
@ -79,11 +80,11 @@ void RimDepthTrackPlot::AxisGridEnum::setUp()
}
template <>
void caf::AppEnum<RimDepthTrackPlot::DepthOrientation>::setUp()
void caf::AppEnum<RimDepthTrackPlot::DepthOrientation_OBSOLETE>::setUp()
{
addItem( RimDepthTrackPlot::DepthOrientation::HORIZONTAL, "HORIZONTAL", "Horizontal" );
addItem( RimDepthTrackPlot::DepthOrientation::VERTICAL, "VERTICAL", "Vertical" );
setDefault( RimDepthTrackPlot::DepthOrientation::VERTICAL );
addItem( RimDepthTrackPlot::DepthOrientation_OBSOLETE::HORIZONTAL, "HORIZONTAL", "Horizontal" );
addItem( RimDepthTrackPlot::DepthOrientation_OBSOLETE::VERTICAL, "VERTICAL", "Vertical" );
setDefault( RimDepthTrackPlot::DepthOrientation_OBSOLETE::VERTICAL );
}
} // End namespace caf
@ -133,6 +134,11 @@ RimDepthTrackPlot::RimDepthTrackPlot()
caf::AppEnum<RiaDefines::MultiPlotAxisVisibility> depthAxisVisibility = RiaDefines::MultiPlotAxisVisibility::ONE_VISIBLE;
CAF_PDM_InitField( &m_depthAxisVisibility, "DepthAxisVisibility", depthAxisVisibility, "Axis Visibility" );
CAF_PDM_InitScriptableField( &m_showDepthMarkerLine, "ShowDepthMarkerLine", false, "Show Depth Marker Line" );
CAF_PDM_InitFieldNoDefault( &m_depthAnnotations, "DepthAnnotations", "Depth Annotations" );
m_depthAnnotations.uiCapability()->setUiTreeHidden( true );
m_depthAnnotations.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitScriptableFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Track Title Font Size" );
CAF_PDM_InitScriptableFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size" );
CAF_PDM_InitScriptableFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size" );
@ -310,7 +316,7 @@ std::vector<RimWellLogTrack*> RimDepthTrackPlot::visiblePlots() const
//--------------------------------------------------------------------------------------------------
int RimDepthTrackPlot::columnCount() const
{
if ( depthOrientation() == DepthOrientation::VERTICAL )
if ( depthOrientation() == RiaDefines::Orientation::VERTICAL )
return RimPlotWindow::columnCount();
else
return 1;
@ -434,6 +440,62 @@ void RimDepthTrackPlot::visibleDepthRange( double* minimumDepth, double* maximum
*maximumDepth = m_maxVisibleDepth;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::enableDepthMarkerLine( bool enable )
{
m_showDepthMarkerLine = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimDepthTrackPlot::isDepthMarkerLineEnabled() const
{
return m_showDepthMarkerLine();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::setDepthMarkerPosition( double depth )
{
RimPlotAxisAnnotation* firstAnnotation = nullptr;
if ( !m_depthAnnotations.empty() )
{
firstAnnotation = m_depthAnnotations[0];
}
if ( firstAnnotation == nullptr )
{
firstAnnotation = RimPlotAxisAnnotation::createLineAnnotation();
firstAnnotation->setPenStyle( Qt::DashLine );
m_depthAnnotations.push_back( firstAnnotation );
}
firstAnnotation->setValue( depth );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::clearDepthAnnotations()
{
m_depthAnnotations.deleteChildren();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotAxisAnnotation*> RimDepthTrackPlot::depthAxisAnnotations() const
{
return m_depthAnnotations.children();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::DepthUnitType RimDepthTrackPlot::caseDepthUnit() const
{
RimEclipseResultCase* thecase = dynamic_cast<RimEclipseResultCase*>( commonDataSource()->caseToApply() );
@ -485,6 +547,7 @@ void RimDepthTrackPlot::uiOrderingForDepthAxis( QString uiConfigName, caf::PdmUi
uiOrdering.add( &m_maxVisibleDepth );
uiOrdering.add( &m_depthAxisGridVisibility );
uiOrdering.add( &m_depthAxisVisibility );
uiOrdering.add( &m_showDepthMarkerLine );
}
//--------------------------------------------------------------------------------------------------
@ -999,6 +1062,17 @@ void RimDepthTrackPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
ensembleWellLogCurveSet->loadDataAndUpdate( true );
}
}
else if ( changedField == &m_showDepthMarkerLine )
{
if ( !m_showDepthMarkerLine )
{
clearDepthAnnotations();
for ( auto p : plots() )
{
p->updateAxes();
}
}
}
updateConnectedEditors();
}
@ -1318,7 +1392,7 @@ RimDepthTrackPlot::AxisGridVisibility RimDepthTrackPlot::depthAxisGridLinesEnabl
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDepthTrackPlot::DepthOrientation RimDepthTrackPlot::depthOrientation() const
RiaDefines::Orientation RimDepthTrackPlot::depthOrientation() const
{
return m_depthOrientation();
}
@ -1326,7 +1400,7 @@ RimDepthTrackPlot::DepthOrientation RimDepthTrackPlot::depthOrientation() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::setDepthOrientation( DepthOrientation depthOrientation )
void RimDepthTrackPlot::setDepthOrientation( RiaDefines::Orientation depthOrientation )
{
m_depthOrientation = depthOrientation;
}
@ -1358,9 +1432,9 @@ RiuPlotAxis RimDepthTrackPlot::depthAxis() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotAxis RimDepthTrackPlot::depthAxis( DepthOrientation depthOrientation )
RiuPlotAxis RimDepthTrackPlot::depthAxis( RiaDefines::Orientation depthOrientation )
{
if ( depthOrientation == RimDepthTrackPlot::DepthOrientation::VERTICAL ) return RiuPlotAxis::defaultLeft();
if ( depthOrientation == RiaDefines::Orientation::VERTICAL ) return RiuPlotAxis::defaultLeft();
return RiuPlotAxis::defaultBottom();
}
@ -1376,9 +1450,9 @@ RiuPlotAxis RimDepthTrackPlot::valueAxis() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotAxis RimDepthTrackPlot::valueAxis( DepthOrientation depthOrientation )
RiuPlotAxis RimDepthTrackPlot::valueAxis( RiaDefines::Orientation depthOrientation )
{
if ( depthOrientation == RimDepthTrackPlot::DepthOrientation::VERTICAL ) return RiuPlotAxis::defaultTop();
if ( depthOrientation == RiaDefines::Orientation::VERTICAL ) return RiuPlotAxis::defaultTop();
return RiuPlotAxis::defaultLeft();
}
@ -1394,7 +1468,7 @@ RiuPlotAxis RimDepthTrackPlot::annotationAxis() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotAxis RimDepthTrackPlot::annotationAxis( DepthOrientation depthOrientation )
RiuPlotAxis RimDepthTrackPlot::annotationAxis( RiaDefines::Orientation depthOrientation )
{
auto riuAxis = valueAxis( depthOrientation );

View File

@ -46,6 +46,7 @@ class RimEnsembleCurveSet;
class RiuPlotAxis;
class RimWellLogTrack;
class RimWellLogPlotNameConfig;
class RimPlotAxisAnnotation;
class QKeyEvent;
@ -69,7 +70,7 @@ public:
typedef caf::AppEnum<AxisGridVisibility> AxisGridEnum;
using DepthTypeEnum = RiaDefines::DepthTypeEnum;
enum class DepthOrientation
enum class DepthOrientation_OBSOLETE
{
HORIZONTAL,
VERTICAL
@ -106,8 +107,8 @@ public:
void enableDepthAxisGridLines( AxisGridVisibility gridVisibility );
AxisGridVisibility depthAxisGridLinesEnabled() const;
RimDepthTrackPlot::DepthOrientation depthOrientation() const;
void setDepthOrientation( RimDepthTrackPlot::DepthOrientation depthOrientation );
RiaDefines::Orientation depthOrientation() const;
void setDepthOrientation( RiaDefines::Orientation depthOrientation );
RiaDefines::MultiPlotAxisVisibility depthAxisVisibility() const;
void setDepthAxisVisibility( RiaDefines::MultiPlotAxisVisibility axisVisibility );
@ -129,6 +130,12 @@ public:
void availableDepthRange( double* minimumDepth, double* maximumDepth ) const;
void visibleDepthRange( double* minimumDepth, double* maximumDepth ) const;
void enableDepthMarkerLine( bool enable );
bool isDepthMarkerLineEnabled() const;
void setDepthMarkerPosition( double depth );
void clearDepthAnnotations();
std::vector<RimPlotAxisAnnotation*> depthAxisAnnotations() const;
void uiOrderingForDepthAxis( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
void uiOrderingForAutoName( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
@ -158,9 +165,9 @@ public:
void updateDepthAxisVisibility();
static RiuPlotAxis depthAxis( DepthOrientation depthOrientation );
static RiuPlotAxis valueAxis( DepthOrientation depthOrientation );
static RiuPlotAxis annotationAxis( DepthOrientation depthOrientation );
static RiuPlotAxis depthAxis( RiaDefines::Orientation depthOrientation );
static RiuPlotAxis valueAxis( RiaDefines::Orientation depthOrientation );
static RiuPlotAxis annotationAxis( RiaDefines::Orientation depthOrientation );
protected:
QImage snapshotWindowContent() override;
@ -213,6 +220,8 @@ protected:
caf::PdmField<AxisGridEnum> m_depthAxisGridVisibility;
caf::PdmField<bool> m_isAutoScaleDepthEnabled;
caf::PdmField<caf::AppEnum<RiaDefines::MultiPlotAxisVisibility>> m_depthAxisVisibility;
caf::PdmField<bool> m_showDepthMarkerLine;
caf::PdmChildArrayField<RimPlotAxisAnnotation*> m_depthAnnotations;
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_subTitleFontSize;
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisTitleFontSize;
@ -224,7 +233,7 @@ protected:
caf::PdmField<caf::AppEnum<RimEnsembleWellLogStatistics::DepthEqualization>> m_depthEqualization;
caf::PdmPtrField<RimEnsembleCurveSet*> m_ensembleCurveSet;
caf::PdmField<caf::AppEnum<DepthOrientation>> m_depthOrientation;
caf::PdmField<caf::AppEnum<RiaDefines::Orientation>> m_depthOrientation;
QPointer<RiuWellLogPlot> m_viewer;
std::set<RiaDefines::DepthUnitType> m_availableDepthUnits;

View File

@ -46,6 +46,19 @@ RimPlotAxisAnnotation::RimPlotAxisAnnotation()
CAF_PDM_InitFieldNoDefault( &m_rangeStart, "RangeStart", "Range Start" );
CAF_PDM_InitFieldNoDefault( &m_rangeEnd, "RangeEnd", "Range End" );
caf::AppEnum<Qt::PenStyle> defaultStyle = Qt::PenStyle::SolidLine;
CAF_PDM_InitField( &m_penStyle, "PenStyle", defaultStyle, "Pen Style" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotAxisAnnotation* RimPlotAxisAnnotation::createLineAnnotation()
{
auto annotation = new RimPlotAxisAnnotation();
annotation->setAnnotationType( RimPlotAxisAnnotation::AnnotationType::LINE );
return annotation;
}
//--------------------------------------------------------------------------------------------------
@ -112,6 +125,22 @@ QColor RimPlotAxisAnnotation::color() const
return QColor( 0, 0, 100 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisAnnotation::setPenStyle( Qt::PenStyle penStyle )
{
m_penStyle = penStyle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Qt::PenStyle RimPlotAxisAnnotation::penStyle() const
{
return m_penStyle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -40,6 +40,8 @@ public:
};
RimPlotAxisAnnotation();
static RimPlotAxisAnnotation* createLineAnnotation();
void setName( const QString& name );
void setValue( double value );
@ -50,6 +52,9 @@ public:
virtual double rangeEnd() const;
virtual QColor color() const;
void setPenStyle( Qt::PenStyle penStyle );
Qt::PenStyle penStyle() const;
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* objectToggleField() override;
@ -59,11 +64,12 @@ protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
protected:
caf::PdmField<bool> m_isActive;
caf::PdmField<QString> m_name;
caf::PdmField<double> m_value;
caf::PdmField<double> m_rangeStart;
caf::PdmField<double> m_rangeEnd;
caf::PdmField<bool> m_isActive;
caf::PdmField<QString> m_name;
caf::PdmField<double> m_value;
caf::PdmField<double> m_rangeStart;
caf::PdmField<double> m_rangeEnd;
caf::PdmField<caf::AppEnum<Qt::PenStyle>> m_penStyle;
protected:
void setAnnotationType( AnnotationType annotationType );

View File

@ -227,7 +227,7 @@ void RimWellLogCurve::updateCurveAppearance()
{
RimPlotCurve::updateCurveAppearance();
RimDepthTrackPlot::DepthOrientation orientation = RimDepthTrackPlot::DepthOrientation::VERTICAL;
auto orientation = RiaDefines::Orientation::VERTICAL;
RimDepthTrackPlot* wellLogPlot = nullptr;
firstAncestorOrThisOfType( wellLogPlot );
@ -247,7 +247,7 @@ void RimWellLogCurve::updateCurveAppearance()
RiuQwtPlotCurve* qwtPlotCurve = dynamic_cast<RiuQwtPlotCurve*>( m_plotCurve );
if ( qwtPlotCurve )
{
if ( orientation == RimDepthTrackPlot::DepthOrientation::VERTICAL )
if ( orientation == RiaDefines::Orientation::VERTICAL )
{
qwtPlotCurve->setOrientation( Qt::Horizontal );
qwtPlotCurve->setBaseline( 0.0 );
@ -435,13 +435,13 @@ void RimWellLogCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
bool RimWellLogCurve::isVerticalCurve() const
{
RimDepthTrackPlot::DepthOrientation orientation = RimDepthTrackPlot::DepthOrientation::VERTICAL;
auto orientation = RiaDefines::Orientation::VERTICAL;
RimDepthTrackPlot* depthTrackPlot = nullptr;
firstAncestorOrThisOfType( depthTrackPlot );
if ( depthTrackPlot ) orientation = depthTrackPlot->depthOrientation();
return orientation == RimDepthTrackPlot::DepthOrientation::VERTICAL;
return orientation == RiaDefines::Orientation::VERTICAL;
}
//--------------------------------------------------------------------------------------------------

View File

@ -373,7 +373,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
std::vector<double> depthPlotValues = curveData()->depthValuesByIntervals( depthType, displayUnit );
CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() );
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL )
if ( wellLogPlot->depthOrientation() == RiaDefines::Orientation::HORIZONTAL )
m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, xPlotValues, useLogarithmicScale );
else

View File

@ -519,7 +519,7 @@ void RimWellLogTrack::updatePropertyValueZoom()
this->firstAncestorOrThisOfTypeAsserted( wellLogPlot );
// Attribute components use the opposite axis to the property values
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
if ( wellLogPlot->depthOrientation() == RiaDefines::Orientation::VERTICAL )
{
m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), componentRangeMin, componentRangeMax );
}
@ -539,7 +539,7 @@ void RimWellLogTrack::updateDepthZoom()
RimDepthTrackPlot* wellLogPlot;
this->firstAncestorOrThisOfTypeAsserted( wellLogPlot );
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
if ( wellLogPlot->depthOrientation() == RiaDefines::Orientation::VERTICAL )
{
m_plotWidget->setAxisRange( depthAxis(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() );
}
@ -864,7 +864,7 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals()
RimDepthTrackPlot* wellLogPlot;
this->firstAncestorOrThisOfTypeAsserted( wellLogPlot );
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
if ( wellLogPlot->depthOrientation() == RiaDefines::Orientation::VERTICAL )
{
m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtAxis::XTop, div );
}
@ -1097,6 +1097,20 @@ void RimWellLogTrack::onAxisSelected( RiuPlotAxis axis, bool toggle )
void RimWellLogTrack::updateAxes()
{
updatePropertyValueZoom();
if ( m_plotWidget )
{
RimDepthTrackPlot* wellLogPlot;
this->firstAncestorOrThisOfTypeAsserted( wellLogPlot );
if ( wellLogPlot->isDepthMarkerLineEnabled() )
{
m_plotWidget->createAnnotationsInPlot( wellLogPlot->depthAxisAnnotations() );
}
else
{
m_plotWidget->createAnnotationsInPlot( {} );
}
}
}
//--------------------------------------------------------------------------------------------------
@ -1279,7 +1293,7 @@ bool RimWellLogTrack::isEmptyVisiblePropertyRange() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateAxesVisibility( RimDepthTrackPlot::DepthOrientation orientation, bool isFirstTrack, bool isLastTrack )
void RimWellLogTrack::updateAxesVisibility( RiaDefines::Orientation orientation, bool isFirstTrack, bool isLastTrack )
{
if ( !m_plotWidget ) return;
@ -1307,7 +1321,7 @@ void RimWellLogTrack::updateAxesVisibility( RimDepthTrackPlot::DepthOrientation
wellLogPlot->depthAxisVisibility() == RiaDefines::MultiPlotAxisVisibility::ALL_VISIBLE ||
( isLastTrack && wellLogPlot->depthAxisVisibility() == RiaDefines::MultiPlotAxisVisibility::ONE_VISIBLE );
if ( orientation == RimDepthTrackPlot::DepthOrientation::VERTICAL )
if ( orientation == RiaDefines::Orientation::VERTICAL )
{
// Show depth axis only for the first track (on the left side)
needUpdate |= setAxisVisible( QwtAxis::XBottom, false );
@ -1968,7 +1982,7 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
RimDepthTrackPlot* plot = nullptr;
firstAncestorOrThisOfType( plot );
bool isHorizontal = plot && plot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL;
bool isHorizontal = plot && plot->depthOrientation() == RiaDefines::Orientation::HORIZONTAL;
if ( isHorizontal )
uiOrdering.add( &m_rowSpan );
else
@ -2124,7 +2138,7 @@ void RimWellLogTrack::updateAxisScaleEngine()
this->firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot )
{
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
if ( wellLogPlot->depthOrientation() == RiaDefines::Orientation::VERTICAL )
{
m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), true );
@ -2257,7 +2271,7 @@ void RimWellLogTrack::handleWheelEvent( QWheelEvent* wheelEvent )
double zoomCenter = 0.0;
auto position = caf::position( wheelEvent );
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
if ( wellLogPlot->depthOrientation() == RiaDefines::Orientation::VERTICAL )
{
QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtAxis::YLeft );
zoomCenter = scaleMap.invTransform( position.y() );
@ -2834,9 +2848,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
RiaDefines::DepthUnitType fromDepthUnit = plot->caseDepthUnit();
RiaDefines::DepthUnitType toDepthUnit = plot->depthUnit();
RiaDefines::Orientation orientation = RiaDefines::Orientation::HORIZONTAL;
if ( plot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
orientation = RiaDefines::Orientation::VERTICAL;
auto orientation = plot->depthOrientation();
if ( m_formationSource() == FormationSource::WELL_PICK_FILTER )
{
@ -3005,9 +3017,7 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
RiaDefines::DepthUnitType fromDepthUnit = plot->caseDepthUnit();
RiaDefines::DepthUnitType toDepthUnit = plot->depthUnit();
RiaDefines::Orientation orientation = RiaDefines::Orientation::HORIZONTAL;
if ( plot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
orientation = RiaDefines::Orientation::VERTICAL;
auto orientation = plot->depthOrientation();
RigEclipseWellLogExtractor* eclWellLogExtractor =
RiaExtractionTools::findOrCreateWellLogExtractor( m_formationWellPathForSourceCase,
@ -3139,9 +3149,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
RiaDefines::DepthUnitType fromDepthUnit = wellBoreStabilityPlot->caseDepthUnit();
RiaDefines::DepthUnitType toDepthUnit = wellBoreStabilityPlot->depthUnit();
RiaDefines::Orientation orientation = RiaDefines::Orientation::HORIZONTAL;
if ( wellBoreStabilityPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
orientation = RiaDefines::Orientation::VERTICAL;
auto orientation = wellBoreStabilityPlot->depthOrientation();
wellBoreStabilityPlot->updateCommonDataSource();
RimGeoMechCase* geoMechCase =

View File

@ -239,7 +239,7 @@ public:
void setCurvesTreeVisibility( bool isVisible );
void setEnsembleWellLogCurveSet( RimEnsembleWellLogCurveSet* curveSet );
void updateAxesVisibility( RimDepthTrackPlot::DepthOrientation orientation, bool isFirstTrack, bool isLastTrack );
void updateAxesVisibility( RiaDefines::Orientation orientation, bool isFirstTrack, bool isLastTrack );
protected:
// RimViewWindow overrides

View File

@ -145,6 +145,7 @@ void RiuGridCrossQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterfac
m_annotationTool->attachAnnotationLine( qwtPlot(),
annotation->color(),
annotation->name(),
annotation->penStyle(),
annotation->value(),
RiaDefines::Orientation::HORIZONTAL );
}

View File

@ -906,37 +906,6 @@ void RiuGuiTheme::storeQwtStyleSheetProperty( const QString& plotName,
s_qwtPlotItemPropertiesMap[plotName][itemType][itemName].insert( propertyName, value );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Qt::PenStyle RiuGuiTheme::getPenStyleFromString( const QString& style )
{
if ( style == "solid" )
{
return Qt::PenStyle::SolidLine;
}
else if ( style == "dash" )
{
return Qt::PenStyle::DashLine;
}
else if ( style == "dot" )
{
return Qt::PenStyle::DotLine;
}
else if ( style == "dash-dot" )
{
return Qt::PenStyle::DashDotLine;
}
else if ( style == "dash-dot-dot" )
{
return Qt::PenStyle::DashDotDotLine;
}
else
{
return Qt::PenStyle::NoPen;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -61,17 +61,16 @@ public:
static void styleQwtItem( QwtPicker* item );
private:
static void preparseStyleSheet( RiaDefines::ThemeEnum theme, QString& styleSheet );
static QString getStyleSheetPath( RiaDefines::ThemeEnum theme );
static void storeQwtStyleSheetProperty( const QString& plotName,
const QString& itemType,
const QString& itemName,
const QString& propertyName,
const QString& value );
static Qt::PenStyle getPenStyleFromString( const QString& style );
static QwtSymbol* cloneMarkerSymbol( QwtPlotMarker* marker );
static QwtSymbol* cloneCurveSymbol( QwtPlotCurve* curve );
static void formatStyleSheetForWriting( QString& styleSheet );
static void preparseStyleSheet( RiaDefines::ThemeEnum theme, QString& styleSheet );
static QString getStyleSheetPath( RiaDefines::ThemeEnum theme );
static void storeQwtStyleSheetProperty( const QString& plotName,
const QString& itemType,
const QString& itemName,
const QString& propertyName,
const QString& value );
static QwtSymbol* cloneMarkerSymbol( QwtPlotMarker* marker );
static QwtSymbol* cloneCurveSymbol( QwtPlotCurve* curve );
static void formatStyleSheetForWriting( QString& styleSheet );
private:
static RiaDefines::ThemeEnum s_currentTheme;

View File

@ -18,6 +18,7 @@
#include "RiuPlotAnnotationTool.h"
#include "RimPlotAxisAnnotation.h"
#include "RiuGuiTheme.h"
#include "cafCategoryMapper.h"
@ -191,6 +192,7 @@ void RiuPlotAnnotationTool::attachWellPicks( QwtPlot* plot,
void RiuPlotAnnotationTool::attachAnnotationLine( QwtPlot* plot,
const QColor& color,
const QString& annotationText,
Qt::PenStyle penStyle,
const double position,
RiaDefines::Orientation orientation )
{
@ -204,11 +206,29 @@ void RiuPlotAnnotationTool::attachAnnotationLine( QwtPlot* plot,
textColor = RiuGuiTheme::getColorByVariableName( "textColor" );
}
RiuPlotAnnotationTool::setLineProperties( line, annotationText, orientation, position, Qt::SolidLine, color, textColor );
RiuPlotAnnotationTool::setLineProperties( line, annotationText, orientation, position, penStyle, color, textColor );
m_plotItems.push_back( line );
line->attach( m_plot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotAnnotationTool::attachAnnotation( QwtPlot* plot,
RimPlotAxisAnnotation* annotation,
RiaDefines::Orientation orientation )
{
if ( annotation->annotationType() == RimPlotAxisAnnotation::AnnotationType::LINE )
{
attachAnnotationLine( plot,
annotation->color(),
annotation->name(),
annotation->penStyle(),
annotation->value(),
orientation );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -32,6 +32,7 @@
class QString;
class QwtPlot;
class RimPlotAxisAnnotation;
class RiuPlotAnnotationTool
{
@ -55,9 +56,12 @@ public:
void attachAnnotationLine( QwtPlot* plot,
const QColor& color,
const QString& annotationText,
Qt::PenStyle penStyle,
const double position,
RiaDefines::Orientation orientation );
void attachAnnotation( QwtPlot* plot, RimPlotAxisAnnotation* annotation, RiaDefines::Orientation orientation );
void attachAnnotationRange( QwtPlot* plot,
const QColor& color,
const QString& annotationText,

View File

@ -606,6 +606,8 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
return true;
}
}
onMouseMoveEvent( mouseEvent );
}
return false;
}
@ -1386,6 +1388,13 @@ RiuPlotAxis RiuQwtPlotWidget::findPlotAxisForQwtAxis( const QwtAxisId& qwtAxisId
return RiuPlotAxis::defaultLeft();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::onMouseMoveEvent( QMouseEvent* event )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -207,6 +207,8 @@ protected:
RiuPlotAxis findPlotAxisForQwtAxis( const QwtAxisId& qwtAxisId ) const;
virtual void onMouseMoveEvent( QMouseEvent* event );
private:
void selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection = false );
static int defaultMinimumWidth();

View File

@ -162,6 +162,7 @@ void RiuSummaryQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface*
m_annotationTool->attachAnnotationLine( m_plotWidget->qwtPlot(),
annotation->color(),
annotation->name(),
annotation->penStyle(),
annotation->value(),
orientation );
}

View File

@ -91,7 +91,7 @@ void RiuWellLogPlot::renderTo( QPaintDevice* paintDevice )
RiuMultiPlotPage::renderTo( paintDevice );
if ( depthTrackPlot() && depthTrackPlot()->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL )
if ( depthTrackPlot() && depthTrackPlot()->depthOrientation() == RiaDefines::Orientation::HORIZONTAL )
m_horizontalTrackScrollBar->setVisible( true );
else
m_verticalTrackScrollBar->setVisible( true );
@ -104,7 +104,7 @@ bool RiuWellLogPlot::showYAxis( int row, int column ) const
{
if ( depthTrackPlot() )
{
if ( depthTrackPlot()->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
if ( depthTrackPlot()->depthOrientation() == RiaDefines::Orientation::VERTICAL )
{
return column == 0;
}
@ -132,7 +132,7 @@ void RiuWellLogPlot::reinsertScrollbar()
int colCount = this->m_gridLayout->columnCount();
int rowCount = this->m_gridLayout->rowCount();
if ( depthTrackPlot() && depthTrackPlot()->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL )
if ( depthTrackPlot() && depthTrackPlot()->depthOrientation() == RiaDefines::Orientation::HORIZONTAL )
{
m_gridLayout->addLayout( m_horizontalTrackScrollBarLayout, rowCount, 0, 1, colCount );
m_horizontalTrackScrollBar->setVisible( !plotWidgets.empty() );

View File

@ -21,6 +21,8 @@
#include "RiaDefines.h"
#include "RiaPlotDefines.h"
#include "RimPlotAxisAnnotation.h"
#include "RimWellLogCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogTrack.h"
@ -28,6 +30,7 @@
#include "RigWellLogCurveData.h"
#include "RiuGuiTheme.h"
#include "RiuPlotAnnotationTool.h"
#include "RiuPlotCurve.h"
#include "RiuPlotCurveInfoTextProvider.h"
#include "RiuQwtCurvePointTracker.h"
@ -37,6 +40,7 @@
#include "qwt_plot_curve.h"
#include "qwt_scale_draw.h"
#include "qwt_scale_engine.h"
#include "qwt_scale_map.h"
#include "qwt_scale_widget.h"
#include <QWheelEvent>
@ -75,7 +79,7 @@ protected:
RimWellLogPlot* wlp = nullptr;
m_wellLogTrack->firstAncestorOfType( wlp );
if ( wlp && wlp->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL )
if ( wlp && wlp->depthOrientation() == RiaDefines::Orientation::HORIZONTAL )
{
str = QString( "%1\nDepth: %2" ).arg( depthAxisValueString ).arg( xAxisValueString );
}
@ -149,8 +153,7 @@ public:
{
auto [xValue, yValue] = curve->sample( sampleIndex );
auto depth = depthTrackPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ? yValue
: xValue;
auto depth = depthTrackPlot->depthOrientation() == RiaDefines::Orientation::VERTICAL ? yValue : xValue;
auto propertyValue = annotationCurve->closestYValueForX( depth );
@ -184,12 +187,14 @@ RiuWellLogTrack::RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent /*= nu
RimWellLogPlot* wlp = nullptr;
track->firstAncestorOfType( wlp );
bool isVertical = ( wlp && wlp->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL );
bool isVertical = ( wlp && wlp->depthOrientation() == RiaDefines::Orientation::VERTICAL );
setAxisEnabled( QwtAxis::YLeft, true );
setAxisEnabled( QwtAxis::YRight, false );
setAxisEnabled( QwtAxis::XTop, !isVertical );
setAxisEnabled( QwtAxis::XBottom, isVertical );
m_annotationTool = std::make_unique<RiuPlotAnnotationTool>();
new RiuWellLogCurvePointTracker( this->qwtPlot(), &wellLogCurveInfoTextProvider, track );
}
@ -220,3 +225,62 @@ void RiuWellLogTrack::setAxisEnabled( QwtAxis::Position axis, bool enabled )
setAxisTitleEnabled( plotAxis, enabled );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrack::createAnnotationsInPlot( const std::vector<RimPlotAxisAnnotation*>& annotations )
{
m_annotationTool->detachAllAnnotations();
RimDepthTrackPlot* depthTrackPlot = nullptr;
m_plotDefinition->firstAncestorOfType( depthTrackPlot );
if ( !depthTrackPlot ) return;
auto orientation = depthTrackPlot->depthOrientation() == RiaDefines::Orientation::HORIZONTAL
? RiaDefines::Orientation::VERTICAL
: RiaDefines::Orientation::HORIZONTAL;
for ( auto annotation : annotations )
{
m_annotationTool->attachAnnotation( qwtPlot(), annotation, orientation );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrack::onMouseMoveEvent( QMouseEvent* mouseEvent )
{
if ( !m_plotDefinition ) return;
RimDepthTrackPlot* depthTrackPlot = nullptr;
m_plotDefinition->firstAncestorOfType( depthTrackPlot );
if ( !depthTrackPlot || !depthTrackPlot->isDepthMarkerLineEnabled() ) return;
auto plotwidget = dynamic_cast<RiuQwtPlotWidget*>( m_plotDefinition->plotWidget() );
if ( !plotwidget ) return;
auto plot = plotwidget->qwtPlot();
double depth = 0.0;
auto riuPlotAxis = depthTrackPlot->depthAxis();
auto qwtAxis = plotwidget->toQwtPlotAxis( riuPlotAxis );
const QwtScaleMap axisMap = plot->canvasMap( qwtAxis );
if ( depthTrackPlot->depthOrientation() == RiaDefines::Orientation::HORIZONTAL )
{
depth = axisMap.invTransform( mouseEvent->pos().x() );
}
else
{
depth = axisMap.invTransform( mouseEvent->pos().y() );
}
depthTrackPlot->setDepthMarkerPosition( depth );
for ( auto p : depthTrackPlot->plots() )
{
p->updateAxes();
}
}

View File

@ -23,7 +23,10 @@
#include "qwt_plot.h"
class RimWellLogTrack;
class RiuPlotAnnotationTool;
class RimPlotAxisAnnotation;
class QWheelEvent;
class QMouseEvent;
//==================================================================================================
//
@ -39,4 +42,12 @@ public:
~RiuWellLogTrack() override;
void setAxisEnabled( QwtAxis::Position axis, bool enabled );
void createAnnotationsInPlot( const std::vector<RimPlotAxisAnnotation*>& annotations );
private:
void onMouseMoveEvent( QMouseEvent* event ) override;
private:
std::unique_ptr<RiuPlotAnnotationTool> m_annotationTool;
};

View File

@ -54,7 +54,7 @@ RiuWellPathComponentPlotItem::RiuWellPathComponentPlotItem( const RimWellPath* w
, m_componentType( RiaDefines::WellPathComponentType::WELL_PATH )
, m_columnOffset( 0.0 )
, m_depthType( RiaDefines::DepthTypeEnum::MEASURED_DEPTH )
, m_depthOrientation( RimWellLogPlot::DepthOrientation::VERTICAL )
, m_depthOrientation( RiaDefines::Orientation::VERTICAL )
, m_maxColumnOffset( 0.0 )
, m_showLabel( false )
{
@ -186,7 +186,7 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot )
addColumnFeature( -posMax, -posMin, startDepth, endDepth, componentColor() );
addColumnFeature( posMin, posMax, startDepth, endDepth, componentColor() );
if ( m_depthOrientation == RimWellLogPlot::DepthOrientation::VERTICAL )
if ( m_depthOrientation == RiaDefines::Orientation::VERTICAL )
{
addMarker( -posMax, endDepth, 12, RiuPlotCurveSymbol::SYMBOL_LEFT_ANGLED_TRIANGLE, componentColor() );
addMarker( posMax, endDepth, 12, RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor() );
@ -227,7 +227,7 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot )
auto plotSymbol1 = RiuPlotCurveSymbol::SYMBOL_LEFT_ALIGNED_TRIANGLE;
auto plotSymbol2 = RiuPlotCurveSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE;
if ( m_depthOrientation == RimWellLogPlot::DepthOrientation::HORIZONTAL )
if ( m_depthOrientation == RiaDefines::Orientation::HORIZONTAL )
{
plotSymbol1 = RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE;
plotSymbol2 = RiuPlotCurveSymbol::SYMBOL_UP_TRIANGLE;
@ -456,7 +456,7 @@ QwtPlotItem*
marker->setSymbol( symbol );
marker->setSpacing( 6 );
if ( m_depthOrientation == RimWellLogPlot::DepthOrientation::HORIZONTAL )
if ( m_depthOrientation == RiaDefines::Orientation::HORIZONTAL )
{
marker->setXValue( depth );
marker->setYValue( position );
@ -483,7 +483,7 @@ QwtPlotItem*
if ( drawLine )
{
if ( m_depthOrientation == RimWellLogPlot::DepthOrientation::HORIZONTAL )
if ( m_depthOrientation == RiaDefines::Orientation::HORIZONTAL )
{
marker->setLineStyle( QwtPlotMarker::HLine );
}
@ -512,7 +512,7 @@ void RiuWellPathComponentPlotItem::addColumnFeature( double startPositio
double startY = startDepth;
double endY = endDepth;
if ( m_depthOrientation == RimWellLogPlot::DepthOrientation::HORIZONTAL )
if ( m_depthOrientation == RiaDefines::Orientation::HORIZONTAL )
{
startX = startDepth;
endX = endDepth;
@ -612,7 +612,7 @@ void RiuWellPathComponentPlotItem::setDepthType( RimWellLogPlot::DepthTypeEnum d
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathComponentPlotItem::setDepthOrientation( RimWellLogPlot::DepthOrientation depthOrientation )
void RiuWellPathComponentPlotItem::setDepthOrientation( RiaDefines::Orientation depthOrientation )
{
m_depthOrientation = depthOrientation;
}
@ -658,7 +658,7 @@ void RiuWellPathComponentPlotItem::attachToQwt()
auto riuAxis = RimDepthTrackPlot::annotationAxis( m_depthOrientation );
auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxisEnum( riuAxis.axis() );
if ( m_depthOrientation == RimWellLogPlot::DepthOrientation::VERTICAL )
if ( m_depthOrientation == RiaDefines::Orientation::VERTICAL )
{
m_combinedComponentGroup.setXAxis( qwtAxis );
}

View File

@ -65,7 +65,7 @@ public:
void setShowLabel( bool showLabel );
void setDepthType( RimWellLogPlot::DepthTypeEnum depthType );
void setDepthOrientation( RimWellLogPlot::DepthOrientation depthOrientation );
void setDepthOrientation( RiaDefines::Orientation depthOrientation );
void setContributeToLegend( bool contributeToLegend );
void setParentPlotNoReplot( QwtPlot* plot );
@ -124,10 +124,10 @@ private:
double m_columnOffset;
double m_maxColumnOffset;
RimWellLogPlot::DepthTypeEnum m_depthType;
RimWellLogPlot::DepthOrientation m_depthOrientation;
QPointer<QwtPlot> m_parentQwtPlot;
RiuQwtPlotItemGroup m_combinedComponentGroup;
RimWellLogPlot::DepthTypeEnum m_depthType;
RiaDefines::Orientation m_depthOrientation;
QPointer<QwtPlot> m_parentQwtPlot;
RiuQwtPlotItemGroup m_combinedComponentGroup;
bool m_showLabel;
};