mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve annotations to work in both vertical and horizontal plots (#9154)
* Move enums to RiaPlotDefines.h * Add support for formation names shading in horizontal plots * Refactor line property code * modernize code
This commit is contained in:
@@ -31,6 +31,34 @@ enum class PlotAxis
|
||||
PLOT_AXIS_TOP
|
||||
};
|
||||
|
||||
enum class RegionAnnotationType
|
||||
{
|
||||
NO_ANNOTATIONS = 0,
|
||||
FORMATION_ANNOTATIONS = 1,
|
||||
// Used to have Wbs-parameter coding as 2
|
||||
RESULT_PROPERTY_ANNOTATIONS = 3
|
||||
};
|
||||
enum RegionDisplay
|
||||
{
|
||||
DARK_LINES = 0x01,
|
||||
COLORED_LINES = 0x02,
|
||||
COLOR_SHADING = 0x04,
|
||||
COLOR_SHADING_AND_LINES = 0x05,
|
||||
LIGHT_LINES = 0x08,
|
||||
};
|
||||
enum class TrackSpan
|
||||
{
|
||||
FULL_WIDTH,
|
||||
LEFT_COLUMN,
|
||||
CENTRE_COLUMN,
|
||||
RIGHT_COLUMN
|
||||
};
|
||||
enum class Orientation
|
||||
{
|
||||
HORIZONTAL = 0,
|
||||
VERTICAL
|
||||
};
|
||||
|
||||
double minimumDefaultValuePlot();
|
||||
double minimumDefaultLogValuePlot();
|
||||
double maximumDefaultValuePlot();
|
||||
|
@@ -223,7 +223,7 @@ void RicNewStimPlanModelPlotFeature::createFormationTrack( RimStimPlanModelPlot*
|
||||
RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Formations", plot );
|
||||
formationTrack->setFormationWellPath( stimPlanModel->thicknessDirectionWellPath() );
|
||||
formationTrack->setFormationCase( eclipseCase );
|
||||
formationTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
formationTrack->setAnnotationType( RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
formationTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AxisGridVisibility::AXIS_GRID_NONE );
|
||||
formationTrack->setShowWellPathAttributes( true );
|
||||
formationTrack->setShowBothSidesOfWell( false );
|
||||
@@ -255,9 +255,9 @@ void RicNewStimPlanModelPlotFeature::createFaciesTrack( RimStimPlanModelPlot* pl
|
||||
RimWellLogTrack* faciesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Facies", plot );
|
||||
faciesTrack->setFormationWellPath( stimPlanModel->thicknessDirectionWellPath() );
|
||||
faciesTrack->setFormationCase( eclipseCase );
|
||||
faciesTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS );
|
||||
faciesTrack->setAnnotationType( RiaDefines::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS );
|
||||
faciesTrack->setRegionPropertyResultType( faciesDefinition->resultType(), faciesDefinition->resultVariable() );
|
||||
faciesTrack->setAnnotationDisplay( RiuPlotAnnotationTool::COLOR_SHADING );
|
||||
faciesTrack->setAnnotationDisplay( RiaDefines::COLOR_SHADING );
|
||||
faciesTrack->setOverburdenHeight( stimPlanModel->overburdenHeight() );
|
||||
faciesTrack->setUnderburdenHeight( stimPlanModel->underburdenHeight() );
|
||||
faciesTrack->setPropertyValueAxisTitle( stimPlanModel->unitForProperty( RiaDefines::CurveProperty::FACIES ) );
|
||||
|
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPlotDefines.h"
|
||||
#include "RiaResultNames.h"
|
||||
|
||||
#include "RicNewWellLogCurveExtractionFeature.h"
|
||||
@@ -219,7 +220,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil
|
||||
RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Formations", plot );
|
||||
formationTrack->setFormationWellPath( wellPath );
|
||||
formationTrack->setFormationCase( geoMechCase );
|
||||
formationTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
formationTrack->setAnnotationType( RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
formationTrack->setVisiblePropertyValueRange( 0.0, 0.0 );
|
||||
formationTrack->setColSpan( RimPlot::ONE );
|
||||
}
|
||||
@@ -235,8 +236,8 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
|
||||
casingShoeTrack->setColSpan( RimPlot::ONE );
|
||||
casingShoeTrack->setFormationWellPath( wellPath );
|
||||
casingShoeTrack->setFormationCase( geoMechCase );
|
||||
casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
casingShoeTrack->setAnnotationDisplay( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
|
||||
casingShoeTrack->setAnnotationType( RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
casingShoeTrack->setAnnotationDisplay( RiaDefines::COLOR_SHADING_AND_LINES );
|
||||
casingShoeTrack->setShowRegionLabels( false );
|
||||
casingShoeTrack->setShowWellPathAttributes( true );
|
||||
casingShoeTrack->setShowBothSidesOfWell( false );
|
||||
@@ -312,8 +313,8 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
|
||||
stabilityCurvesTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
|
||||
stabilityCurvesTrack->setFormationWellPath( wellPath );
|
||||
stabilityCurvesTrack->setFormationCase( geoMechCase );
|
||||
stabilityCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
stabilityCurvesTrack->setAnnotationDisplay( RiuPlotAnnotationTool::LIGHT_LINES );
|
||||
stabilityCurvesTrack->setAnnotationType( RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
stabilityCurvesTrack->setAnnotationDisplay( RiaDefines::LIGHT_LINES );
|
||||
stabilityCurvesTrack->setShowRegionLabels( false );
|
||||
|
||||
std::vector<QString> resultNames = RiaResultNames::wbsDerivedResultNames();
|
||||
@@ -431,7 +432,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
|
||||
wellPathAnglesTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
|
||||
wellPathAnglesTrack->setFormationWellPath( wellPath );
|
||||
wellPathAnglesTrack->setFormationCase( geoMechCase );
|
||||
wellPathAnglesTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
wellPathAnglesTrack->setAnnotationDisplay( RiuPlotAnnotationTool::LIGHT_LINES );
|
||||
wellPathAnglesTrack->setAnnotationType( RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
wellPathAnglesTrack->setAnnotationDisplay( RiaDefines::LIGHT_LINES );
|
||||
wellPathAnglesTrack->setShowRegionLabels( false );
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaDateStringParser.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPlotDefines.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
#include "RiaWellNameComparer.h"
|
||||
|
||||
@@ -1096,7 +1097,7 @@ void RimWellPltPlot::onLoadDataAndUpdate()
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
plotTrack->setAnnotationType( RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
}
|
||||
}
|
||||
m_isOnLoad = false;
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaColorTools.h"
|
||||
#include "RiaDateStringParser.h"
|
||||
#include "RiaPlotDefines.h"
|
||||
#include "RiaSimWellBranchTools.h"
|
||||
|
||||
#include "RifReaderEclipseRft.h"
|
||||
@@ -1058,7 +1059,7 @@ void RimWellRftPlot::onLoadDataAndUpdate()
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
plotTrack->setAnnotationType( RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -217,6 +217,8 @@ void RimSummaryPlot::updateAxes()
|
||||
updateAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
||||
updateAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
||||
|
||||
m_summaryPlot->clearAnnotationObjects();
|
||||
|
||||
if ( timeAxisProperties() && plotWidget() )
|
||||
{
|
||||
m_summaryPlot->updateAnnotationObjects( timeAxisProperties() );
|
||||
|
@@ -149,23 +149,23 @@ void AppEnum<RigWellPathFormations::FormationLevel>::setUp()
|
||||
}
|
||||
|
||||
template <>
|
||||
void AppEnum<RiuPlotAnnotationTool::RegionAnnotationType>::setUp()
|
||||
void AppEnum<RiaDefines::RegionAnnotationType>::setUp()
|
||||
{
|
||||
addItem( RiuPlotAnnotationTool::RegionAnnotationType::NO_ANNOTATIONS, "NO_ANNOTATIONS", "No Annotations" );
|
||||
addItem( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS, "FORMATIONS", "Formations" );
|
||||
addItem( RiuPlotAnnotationTool::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS, "RESULT_PROPERTY", "Result Property" );
|
||||
setDefault( RiuPlotAnnotationTool::RegionAnnotationType::NO_ANNOTATIONS );
|
||||
addItem( RiaDefines::RegionAnnotationType::NO_ANNOTATIONS, "NO_ANNOTATIONS", "No Annotations" );
|
||||
addItem( RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS, "FORMATIONS", "Formations" );
|
||||
addItem( RiaDefines::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS, "RESULT_PROPERTY", "Result Property" );
|
||||
setDefault( RiaDefines::RegionAnnotationType::NO_ANNOTATIONS );
|
||||
}
|
||||
|
||||
template <>
|
||||
void AppEnum<RiuPlotAnnotationTool::RegionDisplay>::setUp()
|
||||
void AppEnum<RiaDefines::RegionDisplay>::setUp()
|
||||
{
|
||||
addItem( RiuPlotAnnotationTool::DARK_LINES, "DARK_LINES", "Dark Lines" );
|
||||
addItem( RiuPlotAnnotationTool::LIGHT_LINES, "LIGHT_LINES", "Light Lines" );
|
||||
addItem( RiuPlotAnnotationTool::COLORED_LINES, "COLORED_LINES", "Colored Lines" );
|
||||
addItem( RiuPlotAnnotationTool::COLOR_SHADING, "COLOR_SHADING", "Color Shading" );
|
||||
addItem( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES, "SHADING_AND_LINES", "Color Shading and Lines" );
|
||||
setDefault( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
|
||||
addItem( RiaDefines::DARK_LINES, "DARK_LINES", "Dark Lines" );
|
||||
addItem( RiaDefines::LIGHT_LINES, "LIGHT_LINES", "Light Lines" );
|
||||
addItem( RiaDefines::COLORED_LINES, "COLORED_LINES", "Colored Lines" );
|
||||
addItem( RiaDefines::COLOR_SHADING, "COLOR_SHADING", "Color Shading" );
|
||||
addItem( RiaDefines::COLOR_SHADING_AND_LINES, "SHADING_AND_LINES", "Color Shading and Lines" );
|
||||
setDefault( RiaDefines::COLOR_SHADING_AND_LINES );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
@@ -1305,8 +1305,8 @@ void RimWellLogTrack::onLoadDataAndUpdate()
|
||||
m_curves[cIdx]->loadDataAndUpdate( false );
|
||||
}
|
||||
|
||||
if ( m_regionAnnotationType == RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS ||
|
||||
m_regionAnnotationType == RiuPlotAnnotationTool::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
if ( m_regionAnnotationType == RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS ||
|
||||
m_regionAnnotationType == RiaDefines::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
{
|
||||
m_resultDefinition->loadDataAndUpdate();
|
||||
setFormationFieldsUiReadOnly( false );
|
||||
@@ -1315,7 +1315,7 @@ void RimWellLogTrack::onLoadDataAndUpdate()
|
||||
{
|
||||
setFormationFieldsUiReadOnly( true );
|
||||
}
|
||||
bool noAnnotations = m_regionAnnotationType() == RiuPlotAnnotationTool::RegionAnnotationType::NO_ANNOTATIONS;
|
||||
bool noAnnotations = m_regionAnnotationType() == RiaDefines::RegionAnnotationType::NO_ANNOTATIONS;
|
||||
m_regionAnnotationDisplay.uiCapability()->setUiReadOnly( noAnnotations );
|
||||
m_showRegionLabels.uiCapability()->setUiReadOnly( noAnnotations );
|
||||
|
||||
@@ -1356,7 +1356,7 @@ void RimWellLogTrack::setAndUpdateWellPathFormationNamesData( RimCase* rimCase,
|
||||
|
||||
updateConnectedEditors();
|
||||
|
||||
if ( m_regionAnnotationType != RiuPlotAnnotationTool::RegionAnnotationType::NO_ANNOTATIONS )
|
||||
if ( m_regionAnnotationType != RiaDefines::RegionAnnotationType::NO_ANNOTATIONS )
|
||||
{
|
||||
updateRegionAnnotationsOnPlot();
|
||||
}
|
||||
@@ -1388,7 +1388,7 @@ void RimWellLogTrack::setAndUpdateSimWellFormationNamesData( RimCase* rimCase, c
|
||||
|
||||
updateConnectedEditors();
|
||||
|
||||
if ( m_regionAnnotationType != RiuPlotAnnotationTool::RegionAnnotationType::NO_ANNOTATIONS )
|
||||
if ( m_regionAnnotationType != RiaDefines::RegionAnnotationType::NO_ANNOTATIONS )
|
||||
{
|
||||
updateRegionAnnotationsOnPlot();
|
||||
}
|
||||
@@ -1730,7 +1730,7 @@ void RimWellLogTrack::setColorShadingLegend( RimColorLegend* colorLegend )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType annotationType )
|
||||
void RimWellLogTrack::setAnnotationType( RiaDefines::RegionAnnotationType annotationType )
|
||||
{
|
||||
m_regionAnnotationType = annotationType;
|
||||
}
|
||||
@@ -1738,7 +1738,7 @@ void RimWellLogTrack::setAnnotationType( RiuPlotAnnotationTool::RegionAnnotation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::setAnnotationDisplay( RiuPlotAnnotationTool::RegionDisplay annotationDisplay )
|
||||
void RimWellLogTrack::setAnnotationDisplay( RiaDefines::RegionDisplay annotationDisplay )
|
||||
{
|
||||
m_regionAnnotationDisplay = annotationDisplay;
|
||||
}
|
||||
@@ -1754,7 +1754,7 @@ void RimWellLogTrack::setAnnotationTransparency( int percent )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuPlotAnnotationTool::RegionAnnotationType RimWellLogTrack::annotationType() const
|
||||
RiaDefines::RegionAnnotationType RimWellLogTrack::annotationType() const
|
||||
{
|
||||
return m_regionAnnotationType();
|
||||
}
|
||||
@@ -1762,7 +1762,7 @@ RiuPlotAnnotationTool::RegionAnnotationType RimWellLogTrack::annotationType() co
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuPlotAnnotationTool::RegionDisplay RimWellLogTrack::annotationDisplay() const
|
||||
RiaDefines::RegionDisplay RimWellLogTrack::annotationDisplay() const
|
||||
{
|
||||
return m_regionAnnotationDisplay();
|
||||
}
|
||||
@@ -1772,7 +1772,7 @@ RiuPlotAnnotationTool::RegionDisplay RimWellLogTrack::annotationDisplay() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogTrack::showFormations() const
|
||||
{
|
||||
return m_regionAnnotationType() == RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS;
|
||||
return m_regionAnnotationType() == RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1919,14 +1919,13 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
annotationGroup->add( &m_regionAnnotationType );
|
||||
annotationGroup->add( &m_regionAnnotationDisplay );
|
||||
annotationGroup->add( &m_showRegionLabels );
|
||||
if ( m_regionAnnotationType() == RiuPlotAnnotationTool::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
if ( m_regionAnnotationType() == RiaDefines::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
annotationGroup->add( &m_regionLabelFontSize );
|
||||
|
||||
if ( m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING ||
|
||||
m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLORED_LINES )
|
||||
if ( m_regionAnnotationDisplay() & RiaDefines::COLOR_SHADING || m_regionAnnotationDisplay() & RiaDefines::COLORED_LINES )
|
||||
{
|
||||
annotationGroup->add( &m_colorShadingLegend );
|
||||
if ( m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING )
|
||||
if ( m_regionAnnotationDisplay() & RiaDefines::COLOR_SHADING )
|
||||
{
|
||||
annotationGroup->add( &m_colorShadingTransparency );
|
||||
}
|
||||
@@ -1975,7 +1974,7 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_regionAnnotationType() == RiuPlotAnnotationTool::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
if ( m_regionAnnotationType() == RiaDefines::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
{
|
||||
m_resultDefinition->uiOrdering( uiConfigName, *annotationGroup );
|
||||
}
|
||||
@@ -2002,7 +2001,7 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::initAfterRead()
|
||||
{
|
||||
if ( m_regionAnnotationType() == RiuPlotAnnotationTool::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
if ( m_regionAnnotationType() == RiaDefines::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_formationCase.value() );
|
||||
m_resultDefinition->setEclipseCase( dynamic_cast<RimEclipseCase*>( eclipseCase ) );
|
||||
@@ -2708,18 +2707,18 @@ void RimWellLogTrack::updateRegionAnnotationsOnPlot()
|
||||
{
|
||||
removeRegionAnnotations();
|
||||
|
||||
if ( m_regionAnnotationType == RiuPlotAnnotationTool::RegionAnnotationType::NO_ANNOTATIONS ) return;
|
||||
if ( m_regionAnnotationType == RiaDefines::RegionAnnotationType::NO_ANNOTATIONS ) return;
|
||||
|
||||
if ( m_annotationTool == nullptr )
|
||||
{
|
||||
m_annotationTool = std::unique_ptr<RiuPlotAnnotationTool>( new RiuPlotAnnotationTool() );
|
||||
}
|
||||
|
||||
if ( m_regionAnnotationType == RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS )
|
||||
if ( m_regionAnnotationType == RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS )
|
||||
{
|
||||
updateFormationNamesOnPlot();
|
||||
}
|
||||
else if ( m_regionAnnotationType == RiuPlotAnnotationTool::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
else if ( m_regionAnnotationType == RiaDefines::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS )
|
||||
{
|
||||
updateResultPropertyNamesOnPlot();
|
||||
}
|
||||
@@ -2740,6 +2739,10 @@ 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;
|
||||
|
||||
if ( m_formationSource() == FormationSource::WELL_PICK_FILTER )
|
||||
{
|
||||
if ( m_formationWellPathForSourceWellPath == nullptr ) return;
|
||||
@@ -2833,8 +2836,6 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
|
||||
if ( geoMechWellLogExtractor )
|
||||
{
|
||||
// Attach water and rock base formations
|
||||
const std::pair<double, double> xRange =
|
||||
std::make_pair( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() );
|
||||
|
||||
const caf::ColorTable waterAndRockColors = RiaColorTables::waterAndRockPaletteColors();
|
||||
const std::vector<std::pair<double, double>> waterAndRockIntervals =
|
||||
@@ -2845,13 +2846,13 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
{ "Sea Level", "" },
|
||||
xRange,
|
||||
orientation,
|
||||
convertedYValues,
|
||||
m_regionAnnotationDisplay(),
|
||||
waterAndRockColors,
|
||||
( ( 100 - m_colorShadingTransparency ) * 255 ) / 100,
|
||||
m_showRegionLabels(),
|
||||
RiuPlotAnnotationTool::TrackSpan::LEFT_COLUMN,
|
||||
RiaDefines::TrackSpan::LEFT_COLUMN,
|
||||
{ Qt::SolidPattern, Qt::Dense6Pattern } );
|
||||
}
|
||||
|
||||
@@ -2882,16 +2883,13 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
|
||||
&formationNamesToPlot,
|
||||
&yValues );
|
||||
|
||||
const std::pair<double, double> xRange =
|
||||
std::make_pair( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() );
|
||||
|
||||
std::vector<std::pair<double, double>> convertedYValues =
|
||||
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
|
||||
|
||||
caf::ColorTable colorTable( m_colorShadingLegend->colorArray() );
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
formationNamesToPlot,
|
||||
xRange,
|
||||
orientation,
|
||||
convertedYValues,
|
||||
m_regionAnnotationDisplay(),
|
||||
colorTable,
|
||||
@@ -2912,6 +2910,10 @@ 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;
|
||||
|
||||
RigEclipseWellLogExtractor* eclWellLogExtractor =
|
||||
RiaExtractionTools::findOrCreateWellLogExtractor( m_formationWellPathForSourceCase,
|
||||
dynamic_cast<RimEclipseCase*>( m_formationCase() ) );
|
||||
@@ -2944,8 +2946,6 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
|
||||
CurveSamplingPointData curveData = RimWellLogTrack::curveSamplingPointData( eclWellLogExtractor, resultAccessor.p() );
|
||||
|
||||
// Attach water and rock base formations
|
||||
const std::pair<double, double> xRange =
|
||||
std::make_pair( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() );
|
||||
|
||||
if ( m_formationSource == FormationSource::CASE )
|
||||
{
|
||||
@@ -2987,7 +2987,7 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
|
||||
std::vector<std::pair<double, double>> convertedYValues =
|
||||
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
|
||||
|
||||
// TODO: unecessarily messy!
|
||||
// TODO: unnecessarily messy!
|
||||
// Need to map colors to names (since a category can be used several times)
|
||||
for ( QString nameToPlot : namesToPlot )
|
||||
{
|
||||
@@ -3020,13 +3020,13 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
namesToPlot,
|
||||
xRange,
|
||||
orientation,
|
||||
convertedYValues,
|
||||
m_regionAnnotationDisplay(),
|
||||
colorTable,
|
||||
( ( 100 - m_colorShadingTransparency ) * 255 ) / 100,
|
||||
m_showRegionLabels(),
|
||||
RiuPlotAnnotationTool::TrackSpan::FULL_WIDTH,
|
||||
RiaDefines::TrackSpan::FULL_WIDTH,
|
||||
{},
|
||||
fontSize );
|
||||
}
|
||||
@@ -3044,6 +3044,10 @@ 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;
|
||||
|
||||
wellBoreStabilityPlot->updateCommonDataSource();
|
||||
RimGeoMechCase* geoMechCase =
|
||||
dynamic_cast<RimGeoMechCase*>( wellBoreStabilityPlot->commonDataSource()->caseToApply() );
|
||||
@@ -3056,9 +3060,6 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
|
||||
RiaExtractionTools::findOrCreateWellLogExtractor( wellPath, dynamic_cast<RimGeoMechCase*>( geoMechCase ) );
|
||||
if ( !geoMechWellLogExtractor ) return;
|
||||
|
||||
std::pair<double, double> xRange =
|
||||
std::make_pair( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() );
|
||||
|
||||
CurveSamplingPointData curveData;
|
||||
curveData.md = geoMechWellLogExtractor->cellIntersectionMDs();
|
||||
curveData.tvd = geoMechWellLogExtractor->cellIntersectionTVDs();
|
||||
@@ -3098,13 +3099,13 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
sourceNamesToPlot,
|
||||
xRange,
|
||||
orientation,
|
||||
convertedYValues,
|
||||
m_regionAnnotationDisplay(),
|
||||
colorTable,
|
||||
( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3,
|
||||
m_showRegionLabels(),
|
||||
RiuPlotAnnotationTool::TrackSpan::LEFT_COLUMN );
|
||||
RiaDefines::TrackSpan::LEFT_COLUMN );
|
||||
}
|
||||
{
|
||||
caf::ColorTable colorTable( m_colorShadingLegend->colorArray() );
|
||||
@@ -3129,13 +3130,13 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
sourceNamesToPlot,
|
||||
xRange,
|
||||
orientation,
|
||||
convertedYValues,
|
||||
m_regionAnnotationDisplay(),
|
||||
colorTable,
|
||||
( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3,
|
||||
m_showRegionLabels(),
|
||||
RiuPlotAnnotationTool::TrackSpan::CENTRE_COLUMN );
|
||||
RiaDefines::TrackSpan::CENTRE_COLUMN );
|
||||
}
|
||||
{
|
||||
caf::ColorTable colorTable( m_colorShadingLegend->colorArray() );
|
||||
@@ -3159,13 +3160,13 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
sourceNamesToPlot,
|
||||
xRange,
|
||||
orientation,
|
||||
convertedYValues,
|
||||
m_regionAnnotationDisplay(),
|
||||
colorTable,
|
||||
( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3,
|
||||
m_showRegionLabels(),
|
||||
RiuPlotAnnotationTool::TrackSpan::RIGHT_COLUMN );
|
||||
RiaDefines::TrackSpan::RIGHT_COLUMN );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,8 +21,8 @@
|
||||
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiaPlotDefines.h"
|
||||
#include "RigWellPathFormations.h"
|
||||
#include "RiuPlotAnnotationTool.h"
|
||||
|
||||
#include "RimPlot.h"
|
||||
|
||||
@@ -57,6 +57,7 @@ class RigWellLogExtractor;
|
||||
class RimEclipseResultDefinition;
|
||||
class RimColorLegend;
|
||||
class RimEnsembleWellLogCurveSet;
|
||||
class RiuPlotAnnotationTool;
|
||||
|
||||
struct CurveSamplingPointData
|
||||
{
|
||||
@@ -87,8 +88,8 @@ public:
|
||||
WELL_PICK_FILTER
|
||||
};
|
||||
|
||||
using RegionAnnotationTypeEnum = caf::AppEnum<RiuPlotAnnotationTool::RegionAnnotationType>;
|
||||
using RegionAnnotationDisplayEnum = caf::AppEnum<RiuPlotAnnotationTool::RegionDisplay>;
|
||||
using RegionAnnotationTypeEnum = caf::AppEnum<RiaDefines::RegionAnnotationType>;
|
||||
using RegionAnnotationDisplayEnum = caf::AppEnum<RiaDefines::RegionDisplay>;
|
||||
|
||||
public:
|
||||
RimWellLogTrack();
|
||||
@@ -166,13 +167,13 @@ public:
|
||||
void setMinAndMaxTicksOnly( bool enable );
|
||||
void setPropertyValueAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines );
|
||||
|
||||
void setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType annotationType );
|
||||
void setAnnotationDisplay( RiuPlotAnnotationTool::RegionDisplay annotationDisplay );
|
||||
void setAnnotationType( RiaDefines::RegionAnnotationType annotationType );
|
||||
void setAnnotationDisplay( RiaDefines::RegionDisplay annotationDisplay );
|
||||
void setAnnotationTransparency( int percent );
|
||||
void setColorShadingLegend( RimColorLegend* colorLegend );
|
||||
|
||||
RiuPlotAnnotationTool::RegionAnnotationType annotationType() const;
|
||||
RiuPlotAnnotationTool::RegionDisplay annotationDisplay() const;
|
||||
RiaDefines::RegionAnnotationType annotationType() const;
|
||||
RiaDefines::RegionDisplay annotationDisplay() const;
|
||||
|
||||
bool showFormations() const;
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "RiuGridCrossQwtPlot.h"
|
||||
|
||||
#include "RiaFontCache.h"
|
||||
#include "RiaPlotDefines.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCurve.h"
|
||||
@@ -145,7 +146,7 @@ void RiuGridCrossQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterfac
|
||||
annotation->color(),
|
||||
annotation->name(),
|
||||
annotation->value(),
|
||||
RiuPlotAnnotationTool::Orientation::HORIZONTAL );
|
||||
RiaDefines::Orientation::HORIZONTAL );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -44,17 +44,17 @@ RiuPlotAnnotationTool::~RiuPlotAnnotationTool()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot* plot,
|
||||
const std::vector<QString>& names,
|
||||
const std::pair<double, double> xRange,
|
||||
const std::vector<std::pair<double, double>>& yPositions,
|
||||
RegionDisplay regionDisplay,
|
||||
RiaDefines::Orientation depthOrientation,
|
||||
const std::vector<std::pair<double, double>>& regionRanges,
|
||||
RiaDefines::RegionDisplay regionDisplay,
|
||||
const caf::ColorTable& colorTable,
|
||||
int shadingAlphaByte,
|
||||
bool showNames /*= true */,
|
||||
TrackSpan trackSpan /*= FULL_WIDTH*/,
|
||||
RiaDefines::TrackSpan trackSpan /*= FULL_WIDTH*/,
|
||||
const std::vector<Qt::BrushStyle>& brushStyles /* = {}*/,
|
||||
int fontSize )
|
||||
{
|
||||
if ( names.size() != yPositions.size() ) return;
|
||||
if ( names.size() != regionRanges.size() ) return;
|
||||
m_plot = plot;
|
||||
|
||||
double delta = 0.5;
|
||||
@@ -66,27 +66,36 @@ void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot*
|
||||
catMapper.setCategories( categoryIndices );
|
||||
catMapper.setInterpolateColors( colorTable.color3ubArray() );
|
||||
|
||||
RiaDefines::Orientation annotationOrientation = RiaDefines::Orientation::HORIZONTAL;
|
||||
if ( depthOrientation == RiaDefines::Orientation::HORIZONTAL )
|
||||
annotationOrientation = RiaDefines::Orientation::VERTICAL;
|
||||
|
||||
for ( size_t i = 0; i < names.size(); i++ )
|
||||
{
|
||||
QwtPlotMarker* line( new QwtPlotMarker() );
|
||||
auto* line( new QwtPlotMarker() );
|
||||
|
||||
QString name;
|
||||
if ( showNames && !names[i].isEmpty() )
|
||||
{
|
||||
name = names[i];
|
||||
if ( ( regionDisplay & COLOR_SHADING ) == 0 && names[i].toLower().indexOf( "top" ) == -1 )
|
||||
if ( ( regionDisplay & RiaDefines::COLOR_SHADING ) == 0 && names[i].toLower().indexOf( "top" ) == -1 )
|
||||
{
|
||||
name += " Top";
|
||||
}
|
||||
}
|
||||
if ( regionDisplay & COLOR_SHADING )
|
||||
if ( regionDisplay & RiaDefines::COLOR_SHADING )
|
||||
{
|
||||
cvf::Color3ub cvfColor = catMapper.mapToColor( static_cast<double>( i ) );
|
||||
QColor shadingColor( cvfColor.r(), cvfColor.g(), cvfColor.b(), shadingAlphaByte );
|
||||
|
||||
QwtPlotZoneItem* shading = new QwtPlotZoneItem();
|
||||
shading->setOrientation( Qt::Horizontal );
|
||||
shading->setInterval( yPositions[i].first, yPositions[i].second );
|
||||
auto* shading = new QwtPlotZoneItem();
|
||||
|
||||
if ( depthOrientation == RiaDefines::Orientation::HORIZONTAL )
|
||||
shading->setOrientation( Qt::Vertical );
|
||||
else
|
||||
shading->setOrientation( Qt::Horizontal );
|
||||
|
||||
shading->setInterval( regionRanges[i].first, regionRanges[i].second );
|
||||
shading->setPen( shadingColor, 0.0, Qt::NoPen );
|
||||
QBrush brush( shadingColor );
|
||||
if ( i < brushStyles.size() )
|
||||
@@ -97,21 +106,22 @@ void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot*
|
||||
shading->attach( m_plot );
|
||||
shading->setZ( -100.0 );
|
||||
shading->setXAxis( QwtAxis::XTop );
|
||||
m_horizontalMarkers.push_back( std::move( shading ) );
|
||||
m_plotItems.push_back( shading );
|
||||
}
|
||||
|
||||
QColor lineColor( 0, 0, 0, 0 );
|
||||
QColor textColor( 0, 0, 0, 255 );
|
||||
if ( regionDisplay & DARK_LINES || regionDisplay & COLORED_LINES || regionDisplay & LIGHT_LINES )
|
||||
if ( regionDisplay & RiaDefines::DARK_LINES || regionDisplay & RiaDefines::COLORED_LINES ||
|
||||
regionDisplay & RiaDefines::LIGHT_LINES )
|
||||
{
|
||||
cvf::Color3ub cvfColor = catMapper.mapToColor( static_cast<double>( i ) );
|
||||
QColor cycledColor( cvfColor.r(), cvfColor.g(), cvfColor.b() );
|
||||
|
||||
if ( regionDisplay & DARK_LINES )
|
||||
if ( regionDisplay & RiaDefines::DARK_LINES )
|
||||
{
|
||||
lineColor = QColor( 50, 50, 100 );
|
||||
}
|
||||
else if ( regionDisplay & LIGHT_LINES )
|
||||
else if ( regionDisplay & RiaDefines::LIGHT_LINES )
|
||||
{
|
||||
lineColor = QColor( 200, 200, 200 );
|
||||
}
|
||||
@@ -122,29 +132,34 @@ void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot*
|
||||
textColor = lineColor;
|
||||
}
|
||||
Qt::Alignment horizontalAlignment = trackTextAlignment( trackSpan );
|
||||
RiuPlotAnnotationTool::horizontalDashedLine( line,
|
||||
name,
|
||||
yPositions[i].first,
|
||||
lineColor,
|
||||
textColor,
|
||||
horizontalAlignment,
|
||||
fontSize );
|
||||
|
||||
RiuPlotAnnotationTool::setLineProperties( line,
|
||||
name,
|
||||
annotationOrientation,
|
||||
regionRanges[i].first,
|
||||
Qt::DashLine,
|
||||
lineColor,
|
||||
textColor,
|
||||
horizontalAlignment,
|
||||
fontSize );
|
||||
line->attach( m_plot );
|
||||
m_horizontalMarkers.push_back( std::move( line ) );
|
||||
m_plotItems.push_back( 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( regionRanges[i].second - regionRanges[i + 1].first ) > delta )
|
||||
{
|
||||
QwtPlotMarker* bottomLine( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::horizontalDashedLine( bottomLine,
|
||||
QString(),
|
||||
yPositions[i].second,
|
||||
lineColor,
|
||||
textColor,
|
||||
Qt::AlignRight,
|
||||
fontSize );
|
||||
auto* bottomLine( new QwtPlotMarker() );
|
||||
|
||||
RiuPlotAnnotationTool::setLineProperties( bottomLine,
|
||||
QString(),
|
||||
annotationOrientation,
|
||||
regionRanges[i].second,
|
||||
Qt::DashLine,
|
||||
lineColor,
|
||||
textColor,
|
||||
Qt::AlignRight,
|
||||
fontSize );
|
||||
bottomLine->attach( m_plot );
|
||||
m_horizontalMarkers.push_back( std::move( bottomLine ) );
|
||||
m_plotItems.push_back( bottomLine );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,68 +171,63 @@ void RiuPlotAnnotationTool::attachWellPicks( QwtPlot* plot,
|
||||
const std::vector<QString>& names,
|
||||
const std::vector<double>& yPositions )
|
||||
{
|
||||
detachAllAnnotations( Orientation::HORIZONTAL );
|
||||
detachAllAnnotations();
|
||||
|
||||
if ( names.size() != yPositions.size() ) return;
|
||||
m_plot = plot;
|
||||
|
||||
for ( size_t i = 0; i < names.size(); i++ )
|
||||
{
|
||||
QwtPlotMarker* line( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::horizontalDashedLine( line, names[i], yPositions[i] );
|
||||
auto* line( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::setLineProperties( line, names[i], RiaDefines::Orientation::HORIZONTAL, yPositions[i] );
|
||||
line->attach( m_plot );
|
||||
m_horizontalMarkers.push_back( std::move( line ) );
|
||||
m_plotItems.push_back( line );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotAnnotationTool::attachAnnotationLine( QwtPlot* plot,
|
||||
const QColor& color,
|
||||
const QString& annotationText,
|
||||
const double position,
|
||||
Orientation orientation )
|
||||
void RiuPlotAnnotationTool::attachAnnotationLine( QwtPlot* plot,
|
||||
const QColor& color,
|
||||
const QString& annotationText,
|
||||
const double position,
|
||||
RiaDefines::Orientation orientation )
|
||||
{
|
||||
m_plot = plot;
|
||||
|
||||
QwtPlotMarker* line( new QwtPlotMarker() );
|
||||
if ( orientation == Orientation::HORIZONTAL )
|
||||
auto* line( new QwtPlotMarker() );
|
||||
|
||||
auto textColor = color;
|
||||
if ( orientation == RiaDefines::Orientation::VERTICAL )
|
||||
{
|
||||
RiuPlotAnnotationTool::horizontalDashedLine( line, annotationText, position, color, color );
|
||||
m_horizontalMarkers.push_back( std::move( line ) );
|
||||
}
|
||||
else if ( orientation == Orientation::VERTICAL )
|
||||
{
|
||||
RiuPlotAnnotationTool::verticalLine( line,
|
||||
annotationText,
|
||||
position,
|
||||
color,
|
||||
RiuGuiTheme::getColorByVariableName( "textColor" ) );
|
||||
m_verticalMarkers.push_back( std::move( line ) );
|
||||
textColor = RiuGuiTheme::getColorByVariableName( "textColor" );
|
||||
}
|
||||
|
||||
RiuPlotAnnotationTool::setLineProperties( line, annotationText, orientation, position, Qt::SolidLine, color, textColor );
|
||||
m_plotItems.push_back( line );
|
||||
line->attach( m_plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotAnnotationTool::attachAnnotationRange( QwtPlot* plot,
|
||||
const QColor& color,
|
||||
const QString& annotationText,
|
||||
const double rangeStart,
|
||||
const double rangeEnd,
|
||||
Orientation orientation )
|
||||
void RiuPlotAnnotationTool::attachAnnotationRange( QwtPlot* plot,
|
||||
const QColor& color,
|
||||
const QString& annotationText,
|
||||
const double rangeStart,
|
||||
const double rangeEnd,
|
||||
RiaDefines::Orientation orientation )
|
||||
{
|
||||
m_plot = plot;
|
||||
if ( orientation == Orientation::HORIZONTAL )
|
||||
if ( orientation == RiaDefines::Orientation::HORIZONTAL )
|
||||
{
|
||||
RiuPlotAnnotationTool::horizontalRange( annotationText,
|
||||
std::make_pair( rangeStart, rangeEnd ),
|
||||
color,
|
||||
RiuGuiTheme::getColorByVariableName( "textColor" ) );
|
||||
}
|
||||
else if ( orientation == Orientation::VERTICAL )
|
||||
else if ( orientation == RiaDefines::Orientation::VERTICAL )
|
||||
{
|
||||
RiuPlotAnnotationTool::verticalRange( annotationText,
|
||||
std::make_pair( rangeStart, rangeEnd ),
|
||||
@@ -230,91 +240,38 @@ void RiuPlotAnnotationTool::attachAnnotationRange( QwtPlot* plot,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotAnnotationTool::detachAllAnnotations( Orientation orientation )
|
||||
void RiuPlotAnnotationTool::detachAllAnnotations()
|
||||
{
|
||||
if ( m_plot )
|
||||
{
|
||||
if ( orientation == Orientation::HORIZONTAL )
|
||||
for ( auto& plotItem : m_plotItems )
|
||||
{
|
||||
for ( size_t i = 0; i < m_horizontalMarkers.size(); i++ )
|
||||
{
|
||||
m_horizontalMarkers[i]->detach();
|
||||
delete m_horizontalMarkers[i];
|
||||
}
|
||||
}
|
||||
else if ( orientation == Orientation::VERTICAL )
|
||||
{
|
||||
for ( size_t i = 0; i < m_verticalMarkers.size(); i++ )
|
||||
{
|
||||
m_verticalMarkers[i]->detach();
|
||||
delete m_verticalMarkers[i];
|
||||
}
|
||||
plotItem->detach();
|
||||
delete plotItem;
|
||||
}
|
||||
}
|
||||
if ( orientation == Orientation::HORIZONTAL )
|
||||
{
|
||||
m_horizontalMarkers.clear();
|
||||
}
|
||||
else if ( orientation == Orientation::VERTICAL )
|
||||
{
|
||||
m_verticalMarkers.clear();
|
||||
}
|
||||
m_plotItems.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotAnnotationTool::detachAllAnnotations()
|
||||
{
|
||||
detachAllAnnotations( Orientation::HORIZONTAL );
|
||||
detachAllAnnotations( Orientation::VERTICAL );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Qt::Alignment RiuPlotAnnotationTool::trackTextAlignment( TrackSpan trackSpan )
|
||||
Qt::Alignment RiuPlotAnnotationTool::trackTextAlignment( RiaDefines::TrackSpan trackSpan )
|
||||
{
|
||||
switch ( trackSpan )
|
||||
{
|
||||
case TrackSpan::FULL_WIDTH:
|
||||
case RiaDefines::TrackSpan::FULL_WIDTH:
|
||||
return Qt::AlignRight;
|
||||
case TrackSpan::LEFT_COLUMN:
|
||||
case RiaDefines::TrackSpan::LEFT_COLUMN:
|
||||
return Qt::AlignLeft;
|
||||
case TrackSpan::CENTRE_COLUMN:
|
||||
case RiaDefines::TrackSpan::CENTRE_COLUMN:
|
||||
return Qt::AlignCenter;
|
||||
case TrackSpan::RIGHT_COLUMN:
|
||||
case RiaDefines::TrackSpan::RIGHT_COLUMN:
|
||||
return Qt::AlignRight;
|
||||
}
|
||||
return Qt::AlignRight;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotAnnotationTool::horizontalDashedLine( QwtPlotMarker* line,
|
||||
const QString& name,
|
||||
double yValue,
|
||||
const QColor& color /*= QColor(0, 0, 100) */,
|
||||
const QColor& textColor /*= QColor(0, 0, 100) */,
|
||||
Qt::Alignment horizontalAlignment /*= Qt::AlignRight */,
|
||||
int fontSize )
|
||||
{
|
||||
QPen curvePen;
|
||||
curvePen.setStyle( Qt::DashLine );
|
||||
curvePen.setColor( color );
|
||||
curvePen.setWidth( 1 );
|
||||
|
||||
line->setLineStyle( QwtPlotMarker::HLine );
|
||||
line->setLinePen( curvePen );
|
||||
line->setYValue( yValue );
|
||||
QwtText label( name );
|
||||
label.setColor( textColor );
|
||||
if ( fontSize > 0 ) label.setFont( QFont( label.font().key(), fontSize ) );
|
||||
line->setLabel( label );
|
||||
line->setLabelAlignment( horizontalAlignment | Qt::AlignBottom );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -327,7 +284,7 @@ void RiuPlotAnnotationTool::horizontalRange( const QString& nam
|
||||
QColor shadingColor = color;
|
||||
shadingColor.setAlpha( 10 );
|
||||
|
||||
QwtPlotZoneItem* shading = new QwtPlotZoneItem();
|
||||
auto* shading = new QwtPlotZoneItem();
|
||||
shading->setOrientation( Qt::Horizontal );
|
||||
shading->setInterval( yRange.first, yRange.second );
|
||||
shading->setPen( shadingColor, 0.0, Qt::NoPen );
|
||||
@@ -336,18 +293,31 @@ void RiuPlotAnnotationTool::horizontalRange( const QString& nam
|
||||
shading->attach( m_plot );
|
||||
shading->setZ( -100.0 );
|
||||
shading->setXAxis( QwtAxis::XBottom );
|
||||
m_horizontalMarkers.push_back( std::move( shading ) );
|
||||
m_plotItems.push_back( shading );
|
||||
|
||||
QwtPlotMarker* line( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::horizontalDashedLine( line, name, yRange.first, color, color, horizontalAlignment );
|
||||
auto* line( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::setLineProperties( line,
|
||||
name,
|
||||
RiaDefines::Orientation::HORIZONTAL,
|
||||
yRange.first,
|
||||
Qt::DashLine,
|
||||
color,
|
||||
color,
|
||||
horizontalAlignment );
|
||||
line->attach( m_plot );
|
||||
m_horizontalMarkers.push_back( std::move( line ) );
|
||||
m_plotItems.push_back( line );
|
||||
|
||||
QwtPlotMarker* bottomLine( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::horizontalDashedLine( bottomLine, QString(), yRange.second, color, color );
|
||||
auto* bottomLine( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::setLineProperties( bottomLine,
|
||||
QString(),
|
||||
RiaDefines::Orientation::HORIZONTAL,
|
||||
yRange.second,
|
||||
Qt::DashLine,
|
||||
color,
|
||||
color );
|
||||
|
||||
bottomLine->attach( m_plot );
|
||||
m_horizontalMarkers.push_back( std::move( bottomLine ) );
|
||||
m_plotItems.push_back( bottomLine );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -362,7 +332,7 @@ void RiuPlotAnnotationTool::verticalRange( const QString& name,
|
||||
QColor shadingColor = color;
|
||||
shadingColor.setAlpha( 50 );
|
||||
|
||||
QwtPlotZoneItem* shading = new QwtPlotZoneItem();
|
||||
auto* shading = new QwtPlotZoneItem();
|
||||
shading->setOrientation( Qt::Vertical );
|
||||
shading->setInterval( xRange.first, xRange.second );
|
||||
shading->setPen( shadingColor, 0.0, Qt::NoPen );
|
||||
@@ -371,56 +341,68 @@ void RiuPlotAnnotationTool::verticalRange( const QString& name,
|
||||
shading->attach( m_plot );
|
||||
shading->setZ( -100.0 );
|
||||
shading->setXAxis( QwtAxis::XBottom );
|
||||
m_verticalMarkers.push_back( std::move( shading ) );
|
||||
m_plotItems.push_back( shading );
|
||||
|
||||
QStringList labels = name.split( " - " );
|
||||
|
||||
QwtPlotMarker* line( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::verticalLine( line,
|
||||
labels[0],
|
||||
xRange.first,
|
||||
color,
|
||||
textColor,
|
||||
Qt::SolidLine,
|
||||
Qt::AlignRight | horizontalAlignment );
|
||||
auto* line( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::setLineProperties( line,
|
||||
labels[0],
|
||||
RiaDefines::Orientation::VERTICAL,
|
||||
xRange.first,
|
||||
Qt::SolidLine,
|
||||
color,
|
||||
textColor,
|
||||
Qt::AlignRight | horizontalAlignment );
|
||||
line->attach( m_plot );
|
||||
m_verticalMarkers.push_back( std::move( line ) );
|
||||
m_plotItems.push_back( line );
|
||||
|
||||
QwtPlotMarker* rightLine( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::verticalLine( rightLine,
|
||||
labels.size() == 2 ? labels[1] : QString(),
|
||||
xRange.second,
|
||||
color,
|
||||
textColor,
|
||||
Qt::SolidLine,
|
||||
Qt::AlignLeft | horizontalAlignment );
|
||||
auto* rightLine( new QwtPlotMarker() );
|
||||
RiuPlotAnnotationTool::setLineProperties( rightLine,
|
||||
labels.size() == 2 ? labels[1] : QString(),
|
||||
RiaDefines::Orientation::VERTICAL,
|
||||
xRange.second,
|
||||
Qt::SolidLine,
|
||||
color,
|
||||
textColor,
|
||||
Qt::AlignLeft | horizontalAlignment );
|
||||
rightLine->attach( m_plot );
|
||||
m_verticalMarkers.push_back( std::move( rightLine ) );
|
||||
m_plotItems.push_back( rightLine );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotAnnotationTool::verticalLine( QwtPlotMarker* line,
|
||||
const QString& name,
|
||||
double xValue,
|
||||
const QColor& color /*= QColor(0, 0, 100) */,
|
||||
const QColor& textColor /*= QColor(0, 0, 100) */,
|
||||
Qt::PenStyle lineStyle /*= Qt::DashLine */,
|
||||
Qt::Alignment horizontalAlignment /*= Qt::AlignRight | Qt::AlignBottom */ )
|
||||
void RiuPlotAnnotationTool::setLineProperties( QwtPlotMarker* line,
|
||||
const QString& name,
|
||||
RiaDefines::Orientation orientation,
|
||||
double linePosition,
|
||||
Qt::PenStyle lineStyle,
|
||||
const QColor& color /*= QColor( 0, 0, 100 )*/,
|
||||
const QColor& textColor /*= QColor( 0, 0, 100 )*/,
|
||||
Qt::Alignment horizontalAlignment /*= Qt::AlignRight*/,
|
||||
int fontSize /*= 0 */ )
|
||||
{
|
||||
QPen curvePen;
|
||||
curvePen.setStyle( lineStyle );
|
||||
curvePen.setColor( color );
|
||||
curvePen.setWidth( 1 );
|
||||
|
||||
line->setAxes( QwtAxis::XBottom, QwtAxis::YLeft );
|
||||
line->setLineStyle( QwtPlotMarker::VLine );
|
||||
line->setLinePen( curvePen );
|
||||
line->setXValue( xValue );
|
||||
QwtText label( name );
|
||||
label.setColor( textColor );
|
||||
if ( fontSize > 0 ) label.setFont( QFont( label.font().key(), fontSize ) );
|
||||
line->setLabel( label );
|
||||
line->setLabelAlignment( horizontalAlignment );
|
||||
line->setLabelOrientation( Qt::Orientation::Vertical );
|
||||
line->setLabelAlignment( horizontalAlignment | Qt::AlignBottom );
|
||||
|
||||
if ( orientation == RiaDefines::Orientation::HORIZONTAL )
|
||||
{
|
||||
line->setLineStyle( QwtPlotMarker::HLine );
|
||||
line->setYValue( linePosition );
|
||||
}
|
||||
else
|
||||
{
|
||||
line->setLineStyle( QwtPlotMarker::VLine );
|
||||
line->setXValue( linePosition );
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaPlotDefines.h"
|
||||
|
||||
#include "cafColorTable.h"
|
||||
|
||||
#include "qwt_plot_marker.h"
|
||||
@@ -33,64 +35,35 @@ class QwtPlot;
|
||||
|
||||
class RiuPlotAnnotationTool
|
||||
{
|
||||
public:
|
||||
enum class RegionAnnotationType
|
||||
{
|
||||
NO_ANNOTATIONS = 0,
|
||||
FORMATION_ANNOTATIONS = 1,
|
||||
// Used to have Wbs-parameter coding as 2
|
||||
RESULT_PROPERTY_ANNOTATIONS = 3
|
||||
};
|
||||
enum RegionDisplay
|
||||
{
|
||||
DARK_LINES = 0x01,
|
||||
COLORED_LINES = 0x02,
|
||||
COLOR_SHADING = 0x04,
|
||||
COLOR_SHADING_AND_LINES = 0x05,
|
||||
LIGHT_LINES = 0x08,
|
||||
};
|
||||
enum class TrackSpan
|
||||
{
|
||||
FULL_WIDTH,
|
||||
LEFT_COLUMN,
|
||||
CENTRE_COLUMN,
|
||||
RIGHT_COLUMN
|
||||
};
|
||||
enum class Orientation
|
||||
{
|
||||
HORIZONTAL = 0,
|
||||
VERTICAL
|
||||
};
|
||||
|
||||
public:
|
||||
RiuPlotAnnotationTool(){};
|
||||
~RiuPlotAnnotationTool();
|
||||
|
||||
void attachNamedRegions( QwtPlot* plot,
|
||||
const std::vector<QString>& names,
|
||||
const std::pair<double, double> xRange,
|
||||
const std::vector<std::pair<double, double>>& yPositions,
|
||||
RegionDisplay regionDisplay,
|
||||
RiaDefines::Orientation orientation,
|
||||
const std::vector<std::pair<double, double>>& regionRanges,
|
||||
RiaDefines::RegionDisplay regionDisplay,
|
||||
const caf::ColorTable& colorTable,
|
||||
int shadingAlphaByte,
|
||||
bool showNames = true,
|
||||
TrackSpan trackSpan = TrackSpan::FULL_WIDTH,
|
||||
const std::vector<Qt::BrushStyle>& brushStyles = {},
|
||||
int fontSize = 0 );
|
||||
bool showNames = true,
|
||||
RiaDefines::TrackSpan trackSpan = RiaDefines::TrackSpan::FULL_WIDTH,
|
||||
const std::vector<Qt::BrushStyle>& brushStyles = {},
|
||||
int fontSize = 0 );
|
||||
void attachWellPicks( QwtPlot* plot, const std::vector<QString>& names, const std::vector<double>& yPositions );
|
||||
|
||||
void attachAnnotationLine( QwtPlot* plot,
|
||||
const QColor& color,
|
||||
const QString& annotationText,
|
||||
const double position,
|
||||
Orientation orientation );
|
||||
void attachAnnotationLine( QwtPlot* plot,
|
||||
const QColor& color,
|
||||
const QString& annotationText,
|
||||
const double position,
|
||||
RiaDefines::Orientation orientation );
|
||||
|
||||
void attachAnnotationRange( QwtPlot* plot,
|
||||
const QColor& color,
|
||||
const QString& annotationText,
|
||||
const double rangeStart,
|
||||
const double rangeEnd,
|
||||
Orientation orientation );
|
||||
void attachAnnotationRange( QwtPlot* plot,
|
||||
const QColor& color,
|
||||
const QString& annotationText,
|
||||
const double rangeStart,
|
||||
const double rangeEnd,
|
||||
RiaDefines::Orientation orientation );
|
||||
|
||||
void horizontalRange( const QString& name,
|
||||
const std::pair<double, double> yRange,
|
||||
@@ -105,28 +78,21 @@ public:
|
||||
Qt::Alignment horizontalAlignment = Qt::AlignRight );
|
||||
|
||||
void detachAllAnnotations();
|
||||
void detachAllAnnotations( Orientation orientation );
|
||||
|
||||
private:
|
||||
static Qt::Alignment trackTextAlignment( TrackSpan trackSpan );
|
||||
static void horizontalDashedLine( QwtPlotMarker* line,
|
||||
const QString& name,
|
||||
double yValue,
|
||||
const QColor& color = QColor( 0, 0, 100 ),
|
||||
const QColor& textColor = QColor( 0, 0, 100 ),
|
||||
Qt::Alignment horizontalAlignment = Qt::AlignRight,
|
||||
int fontSize = 0 );
|
||||
static Qt::Alignment trackTextAlignment( RiaDefines::TrackSpan trackSpan );
|
||||
|
||||
void verticalLine( QwtPlotMarker* line,
|
||||
const QString& name,
|
||||
double xValue,
|
||||
const QColor& color = QColor( 0, 0, 100 ),
|
||||
const QColor& textColor = QColor( 0, 0, 100 ),
|
||||
Qt::PenStyle lineStyle = Qt::DashLine,
|
||||
Qt::Alignment horizontalAlignment = Qt::AlignRight | Qt::AlignBottom );
|
||||
static void setLineProperties( QwtPlotMarker* line,
|
||||
const QString& name,
|
||||
RiaDefines::Orientation orientation,
|
||||
double linePosition,
|
||||
Qt::PenStyle lineStyle = Qt::DashLine,
|
||||
const QColor& color = QColor( 0, 0, 100 ),
|
||||
const QColor& textColor = QColor( 0, 0, 100 ),
|
||||
Qt::Alignment horizontalAlignment = Qt::AlignRight,
|
||||
int fontSize = 0 );
|
||||
|
||||
private:
|
||||
QPointer<QwtPlot> m_plot;
|
||||
std::vector<QwtPlotItem*> m_horizontalMarkers;
|
||||
std::vector<QwtPlotItem*> m_verticalMarkers;
|
||||
std::vector<QwtPlotItem*> m_plotItems;
|
||||
};
|
||||
|
@@ -47,6 +47,7 @@ public:
|
||||
|
||||
virtual void useTimeBasedTimeAxis() = 0;
|
||||
|
||||
virtual void clearAnnotationObjects() = 0;
|
||||
virtual void updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ) = 0;
|
||||
|
||||
virtual RiuPlotWidget* plotWidget() const = 0;
|
||||
|
@@ -73,6 +73,13 @@ void RiuSummaryQtChartsPlot::useTimeBasedTimeAxis()
|
||||
m_plotWidget->setAxisScaleType( RiuPlotAxis::defaultBottom(), RiuPlotWidget::AxisScaleType::DATE );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSummaryQtChartsPlot::clearAnnotationObjects()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -50,6 +50,7 @@ public:
|
||||
|
||||
void useTimeBasedTimeAxis() override;
|
||||
|
||||
void clearAnnotationObjects() override;
|
||||
void updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ) override;
|
||||
|
||||
RiuPlotWidget* plotWidget() const override;
|
||||
|
@@ -149,12 +149,11 @@ void RiuSummaryQwtPlot::useTimeBasedTimeAxis()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSummaryQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties )
|
||||
{
|
||||
RiuPlotAnnotationTool::Orientation orientation = RiuPlotAnnotationTool::Orientation::HORIZONTAL;
|
||||
RiaDefines::Orientation orientation = RiaDefines::Orientation::HORIZONTAL;
|
||||
if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||
{
|
||||
orientation = RiuPlotAnnotationTool::Orientation::VERTICAL;
|
||||
orientation = RiaDefines::Orientation::VERTICAL;
|
||||
}
|
||||
m_annotationTool->detachAllAnnotations( orientation );
|
||||
|
||||
for ( auto annotation : axisProperties->annotations() )
|
||||
{
|
||||
@@ -221,3 +220,11 @@ RiuPlotWidget* RiuSummaryQwtPlot::plotWidget() const
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSummaryQwtPlot::clearAnnotationObjects()
|
||||
{
|
||||
m_annotationTool->detachAllAnnotations();
|
||||
}
|
||||
|
@@ -55,6 +55,7 @@ public:
|
||||
|
||||
void useTimeBasedTimeAxis() override;
|
||||
|
||||
void clearAnnotationObjects() override;
|
||||
void updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ) override;
|
||||
|
||||
RiuPlotWidget* plotWidget() const override;
|
||||
|
Reference in New Issue
Block a user