#4695 Add color shading annotation for WBS parameters, similarly to formations (#4757)

* First wbs parameter shading
* Fix wrong Grid->grid rename in GRPC CMakeLists.cmake
* Support color shading of Well Log Tracks based on WBS parameters
* Further improvements to shading for WBS
* #4696 Set RIG_NODEL Por-Bar as default Well log extraction curve parameter for GeoMech
* Fix canvas alignment issue for new WBS plots
This commit is contained in:
Gaute Lindkvist 2019-09-25 11:59:31 +02:00 committed by GitHub
parent 611e1f24d3
commit 3f7fde5227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 593 additions and 154 deletions

View File

@ -166,7 +166,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil
RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Formations", plot );
formationTrack->setFormationWellPath( wellPath );
formationTrack->setFormationCase( geoMechCase );
formationTrack->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
formationTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
formationTrack->setVisibleXRange( 0.0, 0.0 );
formationTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK );
}
@ -182,8 +182,9 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
casingShoeTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK );
casingShoeTrack->setFormationWellPath( wellPath );
casingShoeTrack->setFormationCase( geoMechCase );
casingShoeTrack->setShowFormations( RiuPlotAnnotationTool::DARK_LINES );
casingShoeTrack->setShowFormationLabels( false );
casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
casingShoeTrack->setAnnotationDisplay( RiuPlotAnnotationTool::DARK_LINES );
casingShoeTrack->setShowRegionLabels( false );
casingShoeTrack->setShowWellPathAttributes( true );
casingShoeTrack->setWellPathAttributesSource( wellPath );
casingShoeTrack->setVisibleXRange( 0.0, 0.0 );
@ -207,8 +208,8 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
stabilityCurvesTrack->setFormationWellPath( wellPath );
stabilityCurvesTrack->setFormationCase( geoMechView->geoMechCase() );
stabilityCurvesTrack->setShowFormations( RiuPlotAnnotationTool::NONE );
stabilityCurvesTrack->setShowFormationLabels( false );
stabilityCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::CURVE_ANNOTATIONS );
stabilityCurvesTrack->setShowRegionLabels( true );
std::vector<QString> resultNames = RiaDefines::wellPathStabilityResultNames();
@ -217,6 +218,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
cvf::Color3f::GREEN,
cvf::Color3f::BLUE,
cvf::Color3f::ORANGE};
std::vector<RiuQwtPlotCurve::LineStyleEnum> lineStyles = {RiuQwtPlotCurve::STYLE_SOLID,
RiuQwtPlotCurve::STYLE_DASH,
RiuQwtPlotCurve::STYLE_DASH_DOT,
@ -298,6 +300,6 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
wellPathAnglesTrack->setFormationWellPath( wellPath );
wellPathAnglesTrack->setFormationCase( geoMechView->geoMechCase() );
wellPathAnglesTrack->setShowFormations( RiuPlotAnnotationTool::NONE );
wellPathAnglesTrack->setShowFormationLabels( false );
wellPathAnglesTrack->setAnnotationType( RiuPlotAnnotationTool::NO_ANNOTATIONS );
wellPathAnglesTrack->setShowRegionLabels( false );
}

View File

@ -224,6 +224,7 @@ void RicNewWellLogPlotFeatureImpl::updateAfterCreation( RimWellLogPlot* plot )
plot->loadDataAndUpdate();
plot->updateDepthZoom();
plot->updateConnectedEditors();
plot->updateTracks();
RiaApplication::instance()->project()->updateConnectedEditors();
}

View File

@ -1097,7 +1097,7 @@ void RimWellPltPlot::onLoadDataAndUpdate()
{
if ( trackCount() > 0 )
{
trackByIndex( 0 )->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
trackByIndex( 0 )->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
}
m_isOnLoad = false;
}

View File

@ -936,7 +936,7 @@ void RimWellRftPlot::onLoadDataAndUpdate()
{
if ( trackCount() > 0 )
{
trackByIndex( 0 )->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
trackByIndex( 0 )->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
}
m_isOnLoad = false;

View File

@ -121,6 +121,8 @@ double RimWellBoreStabilityPlot::userDefinedUcs() const
//--------------------------------------------------------------------------------------------------
void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
m_commonDataSource->uiOrdering( uiConfigName, uiOrdering );
caf::PdmUiGroup* parameterSources = uiOrdering.addNewGroup( "Parameter Sources" );
parameterSources->add( &m_porePressureSource );
parameterSources->add( &m_poissonRatioSource );
@ -131,7 +133,11 @@ void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
m_userDefinedPoissionRatio.uiCapability()->setUiReadOnly( m_poissonRatioSource() !=
RigGeoMechWellLogExtractor::USER_DEFINED );
m_userDefinedUcs.uiCapability()->setUiReadOnly( m_ucsSource() != RigGeoMechWellLogExtractor::USER_DEFINED );
RimWellLogPlot::defineUiOrdering( uiConfigName, uiOrdering );
uiOrderingForDepthAxis( uiOrdering );
uiOrderingForPlotSettings( uiOrdering );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------

View File

@ -200,6 +200,7 @@ void RimWellLogCurveCommonDataSource::resetDefaultOptions()
m_uniqueWellNames.clear();
m_uniqueTimeSteps.clear();
m_uniqueBranchIndices.clear();
m_uniqueBranchDetection.clear();
}
//--------------------------------------------------------------------------------------------------

View File

@ -225,7 +225,7 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
}
else if ( geomCase )
{
m_geomResultDefinition->setResultAddress( RigFemResultAddress( RIG_ELEMENT, "POR", "" ) );
m_geomResultDefinition->setResultAddress( RigFemResultAddress( RIG_NODAL, "POR-Bar", "" ) );
}
clearGeneratedSimWellPaths();

View File

@ -211,7 +211,6 @@ void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
changedField == &m_depthAxisGridVisibility )
{
updateTracks();
if ( m_viewer ) m_viewer->updateChildrenLayout();
}
else if ( changedField == &m_showTitleInPlot )
{
@ -687,7 +686,7 @@ QString RimWellLogPlot::createAutoName() const
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::performAutoNameUpdate()
{
this->m_commonDataSource->updateDefaultOptions();
updateCommonDataSource();
this->updatePlotTitle();
}
@ -742,6 +741,14 @@ RimWellLogCurveCommonDataSource* RimWellLogPlot::commonDataSource() const
return m_commonDataSource;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::updateCommonDataSource()
{
m_commonDataSource->updateDefaultOptions();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -817,6 +824,7 @@ void RimWellLogPlot::updateTracks( bool autoScaleXAxis )
calculateAvailableDepthRange();
applyDepthZoomFromVisibleDepth();
if ( m_viewer ) m_viewer->updateChildrenLayout();
}
}
@ -948,7 +956,7 @@ void RimWellLogPlot::deleteViewWidget()
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::initAfterRead()
{
m_commonDataSource->updateDefaultOptions();
updateCommonDataSource();
if ( !m_userName_OBSOLETE().isEmpty() )
{
m_nameConfig->setCustomName( m_userName_OBSOLETE() );

View File

@ -131,6 +131,7 @@ public:
void handleKeyPressEvent( QKeyEvent* keyEvent );
RimWellLogCurveCommonDataSource* commonDataSource() const;
void updateCommonDataSource();
void setAvailableDepthUnits( const std::set<RiaDefines::DepthUnitType>& depthUnits );
void setAvailableDepthTypes( const std::set<RimWellLogPlot::DepthTypeEnum>& depthTypes );

View File

@ -51,8 +51,11 @@
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellBoreStabilityPlot.h"
#include "RimWellFlowRateCurve.h"
#include "RimWellLogCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
#include "RimWellPathAttribute.h"
@ -131,14 +134,22 @@ void AppEnum<RimWellLogTrack::WidthScaleFactor>::setUp()
}
template <>
void AppEnum<RiuPlotAnnotationTool::FormationDisplay>::setUp()
void AppEnum<RiuPlotAnnotationTool::RegionAnnotationType>::setUp()
{
addItem( RiuPlotAnnotationTool::NO_ANNOTATIONS, "NO_ANNOTATIONS", "No Annotations" );
addItem( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS, "FORMATIONS", "Formations" );
addItem( RiuPlotAnnotationTool::CURVE_ANNOTATIONS, "CURVE_DATA", "Curve Data Annotations" );
setDefault( RiuPlotAnnotationTool::NO_ANNOTATIONS );
}
template <>
void AppEnum<RiuPlotAnnotationTool::RegionDisplay>::setUp()
{
addItem( RiuPlotAnnotationTool::NONE, "NONE", "None" );
addItem( RiuPlotAnnotationTool::DARK_LINES, "DARK_LINES", "Dark 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::NONE );
setDefault( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
}
} // namespace caf
@ -175,7 +186,8 @@ RimWellLogTrack::RimWellLogTrack()
m_majorTickInterval.uiCapability()->setUiHidden( true );
m_minorTickInterval.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_formationDisplay, "FormationDisplay", "Show Formations", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_regionAnnotationType, "AnnotationType", "Region Annotations", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_regionAnnotationDisplay, "RegionDisplay", "Region Display", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_colorShadingPalette, "ColorShadingPalette", "Colors", "", "", "" );
m_colorShadingPalette = RimRegularLegendConfig::CATEGORY;
@ -185,7 +197,7 @@ RimWellLogTrack::RimWellLogTrack()
CAF_PDM_InitField( &m_showFormations_OBSOLETE, "ShowFormations", false, "Show Lines", "", "", "" );
m_showFormations_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_showFormationLabels, "ShowFormationLabels", true, "Show Labels", "", "", "" );
CAF_PDM_InitField( &m_showRegionLabels, "ShowFormationLabels", true, "Show Labels", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_formationSource, "FormationSource", "Source", "", "", "" );
@ -372,8 +384,9 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
m_wellLogTrackPlotWidget->replot();
}
else if ( changedField == &m_formationDisplay || changedField == &m_formationSource ||
changedField == &m_colorShadingTransparency || changedField == &m_colorShadingPalette )
else if ( changedField == &m_regionAnnotationType || changedField == &m_regionAnnotationDisplay ||
changedField == &m_formationSource || changedField == &m_colorShadingTransparency ||
changedField == &m_colorShadingPalette )
{
if ( changedField == &m_formationSource && m_formationSource == WELL_PICK_FILTER )
{
@ -410,7 +423,7 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
}
}
else if ( changedField == &m_showFormationLabels )
else if ( changedField == &m_showRegionLabels )
{
loadDataAndUpdate();
}
@ -598,6 +611,23 @@ QList<caf::PdmOptionItemInfo> RimWellLogTrack::calculateValueOptions( const caf:
if ( options.size() > 0 ) return options;
if ( fieldNeedingOptions == &m_regionAnnotationType )
{
options.push_back(
caf::PdmOptionItemInfo( RegionAnnotationTypeEnum::uiText( RiuPlotAnnotationTool::NO_ANNOTATIONS ),
RiuPlotAnnotationTool::NO_ANNOTATIONS ) );
options.push_back(
caf::PdmOptionItemInfo( RegionAnnotationTypeEnum::uiText( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ),
RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ) );
RimWellBoreStabilityPlot* wellBoreStabilityPlot = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellBoreStabilityPlot );
if ( wellBoreStabilityPlot )
{
options.push_back(
caf::PdmOptionItemInfo( RegionAnnotationTypeEnum::uiText( RiuPlotAnnotationTool::CURVE_ANNOTATIONS ),
RiuPlotAnnotationTool::CURVE_ANNOTATIONS ) );
}
}
if ( fieldNeedingOptions == &m_formationWellPathForSourceCase )
{
RimTools::wellPathOptionItems( &options );
@ -821,14 +851,17 @@ void RimWellLogTrack::loadDataAndUpdate( bool updateParentPlotAndToolbars )
curves[cIdx]->loadDataAndUpdate( false );
}
if ( m_formationDisplay == RiuPlotAnnotationTool::NONE )
{
setFormationFieldsUiReadOnly( true );
}
else
if ( m_regionAnnotationType == RiuPlotAnnotationTool::FORMATION_ANNOTATIONS )
{
setFormationFieldsUiReadOnly( false );
}
else
{
setFormationFieldsUiReadOnly( true );
}
bool noAnnotations = m_regionAnnotationType() == RiuPlotAnnotationTool::NO_ANNOTATIONS;
m_regionAnnotationDisplay.uiCapability()->setUiReadOnly( noAnnotations );
m_showRegionLabels.uiCapability()->setUiReadOnly( noAnnotations );
if ( m_wellLogTrackPlotWidget )
{
@ -837,7 +870,7 @@ void RimWellLogTrack::loadDataAndUpdate( bool updateParentPlotAndToolbars )
m_wellLogTrackPlotWidget->updateLegend();
this->updateAxisScaleEngine();
this->updateFormationNamesOnPlot();
this->updateRegionAnnotationsOnPlot();
this->applyXZoomFromVisibleRange();
}
@ -872,9 +905,9 @@ void RimWellLogTrack::setAndUpdateWellPathFormationNamesData( RimCase* rimCase,
updateConnectedEditors();
if ( m_formationDisplay != RiuPlotAnnotationTool::NONE )
if ( m_regionAnnotationType != RiuPlotAnnotationTool::NO_ANNOTATIONS )
{
updateFormationNamesOnPlot();
updateRegionAnnotationsOnPlot();
}
}
@ -904,9 +937,9 @@ void RimWellLogTrack::setAndUpdateSimWellFormationNamesData( RimCase* rimCase, c
updateConnectedEditors();
if ( m_formationDisplay != RiuPlotAnnotationTool::NONE )
if ( m_regionAnnotationType != RiuPlotAnnotationTool::NO_ANNOTATIONS )
{
updateFormationNamesOnPlot();
updateRegionAnnotationsOnPlot();
}
}
@ -1279,9 +1312,33 @@ void RimWellLogTrack::setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setShowFormations( RiuPlotAnnotationTool::FormationDisplay formationDisplay )
void RimWellLogTrack::setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType annotationType )
{
m_formationDisplay = formationDisplay;
m_regionAnnotationType = annotationType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setAnnotationDisplay( RiuPlotAnnotationTool::RegionDisplay annotationDisplay )
{
m_regionAnnotationDisplay = annotationDisplay;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotAnnotationTool::RegionAnnotationType RimWellLogTrack::annotationType() const
{
return m_regionAnnotationType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotAnnotationTool::RegionDisplay RimWellLogTrack::annotationDisplay() const
{
return m_regionAnnotationDisplay();
}
//--------------------------------------------------------------------------------------------------
@ -1289,15 +1346,15 @@ void RimWellLogTrack::setShowFormations( RiuPlotAnnotationTool::FormationDisplay
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::showFormations() const
{
return m_formationDisplay() != RiuPlotAnnotationTool::NONE;
return m_regionAnnotationType() == RiuPlotAnnotationTool::FORMATION_ANNOTATIONS;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setShowFormationLabels( bool on )
void RimWellLogTrack::setShowRegionLabels( bool on )
{
m_showFormationLabels = on;
m_showRegionLabels = on;
}
//--------------------------------------------------------------------------------------------------
@ -1357,17 +1414,19 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
uiOrdering.add( &m_userName );
caf::PdmUiGroup* annotationGroup = uiOrdering.addNewGroup( "Regions/Annotations" );
annotationGroup->add( &m_formationDisplay );
if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING ||
m_formationDisplay() & RiuPlotAnnotationTool::COLORED_LINES )
annotationGroup->add( &m_regionAnnotationType );
annotationGroup->add( &m_regionAnnotationDisplay );
annotationGroup->add( &m_showRegionLabels );
if ( m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING ||
m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLORED_LINES )
{
annotationGroup->add( &m_colorShadingPalette );
if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING )
if ( m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING )
{
annotationGroup->add( &m_colorShadingTransparency );
}
}
annotationGroup->add( &m_showFormationLabels );
if ( !m_formationsForCaseWithSimWellOnly )
{
@ -1435,9 +1494,9 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::initAfterRead()
{
if ( m_showFormations_OBSOLETE() && m_formationDisplay() == RiuPlotAnnotationTool::NONE )
if ( m_showFormations_OBSOLETE() && m_regionAnnotationType() == RiuPlotAnnotationTool::NO_ANNOTATIONS )
{
m_formationDisplay = RiuPlotAnnotationTool::COLORED_LINES;
m_regionAnnotationType = RiuPlotAnnotationTool::FORMATION_ANNOTATIONS;
}
}
@ -1623,7 +1682,8 @@ void RimWellLogTrack::uiOrderingForRftPltFormations( caf::PdmUiOrdering& uiOrder
{
caf::PdmUiGroup* formationGroup = uiOrdering.addNewGroup( "Zonation/Formation Names" );
formationGroup->setCollapsedByDefault( true );
formationGroup->add( &m_formationDisplay );
formationGroup->add( &m_regionAnnotationType );
formationGroup->add( &m_regionAnnotationDisplay );
formationGroup->add( &m_formationSource );
if ( m_formationSource == CASE )
{
@ -1726,29 +1786,29 @@ CurveSamplingPointData RimWellLogTrack::curveSamplingPointData( RigGeoMechWellLo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::findFormationNamesToPlot( const CurveSamplingPointData& curveData,
const std::vector<QString>& formationNamesVector,
void RimWellLogTrack::findRegionNamesToPlot( const CurveSamplingPointData& curveData,
const std::vector<QString>& regionNamesVector,
RimWellLogPlot::DepthTypeEnum depthType,
std::vector<QString>* formationNamesToPlot,
std::vector<QString>* regionNamesToPlot,
std::vector<std::pair<double, double>>* yValues )
{
if ( formationNamesVector.empty() ) return;
if ( regionNamesVector.empty() ) return;
std::vector<size_t> formationNameIndicesFromCurve;
std::vector<size_t> regionNameIndicesFromCurve;
for ( double nameIdx : curveData.data )
{
if ( nameIdx != std::numeric_limits<double>::infinity() )
{
formationNameIndicesFromCurve.push_back( static_cast<size_t>( round( nameIdx ) ) );
regionNameIndicesFromCurve.push_back( static_cast<size_t>( round( nameIdx ) ) );
}
else
{
formationNameIndicesFromCurve.push_back( std::numeric_limits<size_t>::max() );
regionNameIndicesFromCurve.push_back( std::numeric_limits<size_t>::max() );
}
}
if ( formationNameIndicesFromCurve.empty() ) return;
if ( regionNameIndicesFromCurve.empty() ) return;
std::vector<double> depthVector;
@ -1764,17 +1824,17 @@ void RimWellLogTrack::findFormationNamesToPlot( const CurveSamplingPointData&
if ( depthVector.empty() ) return;
double currentYStart = depthVector[0];
size_t prevNameIndex = formationNameIndicesFromCurve[0];
size_t prevNameIndex = regionNameIndicesFromCurve[0];
size_t currentNameIndex;
for ( size_t i = 1; i < formationNameIndicesFromCurve.size(); i++ )
for ( size_t i = 1; i < regionNameIndicesFromCurve.size(); i++ )
{
currentNameIndex = formationNameIndicesFromCurve[i];
currentNameIndex = regionNameIndicesFromCurve[i];
if ( currentNameIndex != std::numeric_limits<size_t>::max() && currentNameIndex != prevNameIndex )
{
if ( prevNameIndex < formationNamesVector.size() )
if ( prevNameIndex < regionNamesVector.size() )
{
formationNamesToPlot->push_back( formationNamesVector[prevNameIndex] );
regionNamesToPlot->push_back( regionNamesVector[prevNameIndex] );
yValues->push_back( std::make_pair( currentYStart, depthVector[i - 1] ) );
}
@ -1783,10 +1843,10 @@ void RimWellLogTrack::findFormationNamesToPlot( const CurveSamplingPointData&
}
}
size_t lastFormationIdx = formationNameIndicesFromCurve.back();
if ( lastFormationIdx < formationNamesVector.size() )
size_t lastFormationIdx = regionNameIndicesFromCurve.back();
if ( lastFormationIdx < regionNamesVector.size() )
{
formationNamesToPlot->push_back( formationNamesVector[lastFormationIdx] );
regionNamesToPlot->push_back( regionNamesVector[lastFormationIdx] );
yValues->push_back( std::make_pair( currentYStart, depthVector.back() ) );
}
}
@ -1822,7 +1882,6 @@ std::vector<QString> RimWellLogTrack::formationNamesVector( RimCase* rimCase )
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setFormationFieldsUiReadOnly( bool readOnly /*= true*/ )
{
m_showFormationLabels.uiCapability()->setUiReadOnly( readOnly );
m_formationSource.uiCapability()->setUiReadOnly( readOnly );
m_formationTrajectoryType.uiCapability()->setUiReadOnly( readOnly );
m_formationSimWellName.uiCapability()->setUiReadOnly( readOnly );
@ -1838,17 +1897,32 @@ void RimWellLogTrack::setFormationFieldsUiReadOnly( bool readOnly /*= true*/ )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateFormationNamesOnPlot()
void RimWellLogTrack::updateRegionAnnotationsOnPlot()
{
removeFormationNames();
removeRegionAnnotations();
if ( m_formationDisplay == RiuPlotAnnotationTool::NONE ) return;
if ( m_regionAnnotationType == RiuPlotAnnotationTool::NO_ANNOTATIONS ) return;
if ( m_annotationTool == nullptr )
{
m_annotationTool = std::unique_ptr<RiuPlotAnnotationTool>( new RiuPlotAnnotationTool() );
}
if ( m_regionAnnotationType == RiuPlotAnnotationTool::FORMATION_ANNOTATIONS )
{
updateFormationNamesOnPlot();
}
else
{
updateCurveDataRegionsOnPlot();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateFormationNamesOnPlot()
{
std::vector<QString> formationNamesToPlot;
RimWellLogPlot* plot = nullptr;
@ -1915,7 +1989,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
std::vector<std::pair<double, double>> yValues;
std::vector<QString> formationNamesVector = RimWellLogTrack::formationNamesVector( m_formationCase );
RimWellLogTrack::findFormationNamesToPlot( curveData,
RimWellLogTrack::findRegionNamesToPlot( curveData,
formationNamesVector,
plot->depthType(),
&formationNamesToPlot,
@ -1925,14 +1999,14 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) );
m_annotationTool->attachFormationNames( this->viewer(),
m_annotationTool->attachNamedRegions( this->viewer(),
formationNamesToPlot,
xRange,
yValues,
m_formationDisplay(),
m_regionAnnotationDisplay(),
colorTable,
( ( 100 - m_colorShadingTransparency ) * 255 ) / 100,
m_showFormationLabels() );
m_showRegionLabels() );
}
else if ( m_formationSource() == WELL_PICK_FILTER )
{
@ -1959,6 +2033,136 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateCurveDataRegionsOnPlot()
{
RimWellBoreStabilityPlot* wellBoreStabilityPlot = nullptr;
this->firstAncestorOrThisOfType( wellBoreStabilityPlot );
if ( wellBoreStabilityPlot )
{
wellBoreStabilityPlot->updateCommonDataSource();
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(
wellBoreStabilityPlot->commonDataSource()->caseToApply() );
RimWellPath* wellPath = wellBoreStabilityPlot->commonDataSource()->wellPathToApply();
int timeStep = wellBoreStabilityPlot->commonDataSource()->timeStepToApply();
if ( geoMechCase && wellPath && timeStep >= 0 )
{
RigGeoMechWellLogExtractor* geoMechWellLogExtractor = nullptr;
geoMechWellLogExtractor = RiaExtractionTools::wellLogExtractorGeoMechCase( wellPath,
dynamic_cast<RimGeoMechCase*>(
geoMechCase ) );
if ( !geoMechWellLogExtractor ) return;
std::pair<double, double> xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() );
CurveSamplingPointData curveData;
curveData.md = geoMechWellLogExtractor->cellIntersectionMDs();
curveData.tvd = geoMechWellLogExtractor->cellIntersectionTVDs();
RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles( wellPath, geoMechWellLogExtractor );
RimWellBoreStabilityPlot* wbsPlot;
this->firstAncestorOrThisOfType( wbsPlot );
if ( wbsPlot )
{
geoMechWellLogExtractor->setWbsParameters( wbsPlot->porePressureSource(),
wbsPlot->poissonRatioSource(),
wbsPlot->ucsSource(),
wbsPlot->userDefinedPoissonRatio(),
wbsPlot->userDefinedUcs() );
}
std::vector<double> ppValues = geoMechWellLogExtractor->porePressureIntervals( timeStep );
std::vector<double> poissonValues = geoMechWellLogExtractor->poissonIntervals( timeStep );
std::vector<double> ucsValues = geoMechWellLogExtractor->ucsIntervals( timeStep );
{
caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) );
std::vector<QString> sourceNames =
{"", "PP=Grid", "PP=Las-File", "PP=Element Property Table", "", "PP=Hydrostatic"};
curveData.data = ppValues;
std::vector<QString> sourceNamesToPlot;
std::vector<std::pair<double, double>> yValues;
RimWellLogTrack::findRegionNamesToPlot( curveData,
sourceNames,
wellBoreStabilityPlot->depthType(),
&sourceNamesToPlot,
&yValues );
m_annotationTool->attachNamedRegions( this->viewer(),
sourceNamesToPlot,
xRange,
yValues,
m_regionAnnotationDisplay(),
colorTable,
( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3,
m_showRegionLabels(),
RiuPlotAnnotationTool::LEFT_COLUMN );
}
{
caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) );
std::vector<QString> sourceNames =
{"",
"",
"Poisson=Las-File",
"Poisson=Element Property Table",
QString( "Poisson=%1" ).arg( wellBoreStabilityPlot->userDefinedPoissonRatio() ),
""};
curveData.data = poissonValues;
std::vector<QString> sourceNamesToPlot;
std::vector<std::pair<double, double>> yValues;
RimWellLogTrack::findRegionNamesToPlot( curveData,
sourceNames,
wellBoreStabilityPlot->depthType(),
&sourceNamesToPlot,
&yValues );
m_annotationTool->attachNamedRegions( this->viewer(),
sourceNamesToPlot,
xRange,
yValues,
m_regionAnnotationDisplay(),
colorTable,
( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3,
m_showRegionLabels(),
RiuPlotAnnotationTool::CENTRE_COLUMN );
}
{
caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) );
std::vector<QString> sourceNames = {"",
"",
"UCS=Las-File",
"UCS=Element Property Table",
QString( "UCS=%1" ).arg( wellBoreStabilityPlot->userDefinedUcs() ),
""};
curveData.data = ucsValues;
std::vector<QString> sourceNamesToPlot;
std::vector<std::pair<double, double>> yValues;
RimWellLogTrack::findRegionNamesToPlot( curveData,
sourceNames,
wellBoreStabilityPlot->depthType(),
&sourceNamesToPlot,
&yValues );
m_annotationTool->attachNamedRegions( this->viewer(),
sourceNamesToPlot,
xRange,
yValues,
m_regionAnnotationDisplay(),
colorTable,
( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3,
m_showRegionLabels(),
RiuPlotAnnotationTool::RIGHT_COLUMN );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -2053,7 +2257,7 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::removeFormationNames()
void RimWellLogTrack::removeRegionAnnotations()
{
if ( m_annotationTool )
{

View File

@ -91,6 +91,9 @@ public:
EXTRA_WIDE_TRACK = 10
};
typedef caf::AppEnum<RiuPlotAnnotationTool::RegionAnnotationType> RegionAnnotationTypeEnum;
typedef caf::AppEnum<RiuPlotAnnotationTool::RegionDisplay> RegionAnnotationDisplayEnum;
void setDescription( const QString& description );
bool isVisible();
void addCurve( RimWellLogCurve* curve );
@ -103,6 +106,7 @@ public:
{
return curves.size();
}
void setXAxisTitle( const QString& text );
QString depthPlotTitle() const;
int widthScaleFactor() const;
@ -145,9 +149,16 @@ public:
void setVisibleXRange( double minValue, double maxValue );
void setTickIntervals( double majorTickInterval, double minorTickInterval );
void setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines );
void setShowFormations( RiuPlotAnnotationTool::FormationDisplay formationDisplay );
void setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType annotationType );
void setAnnotationDisplay( RiuPlotAnnotationTool::RegionDisplay annotationDisplay );
RiuPlotAnnotationTool::RegionAnnotationType annotationType() const;
RiuPlotAnnotationTool::RegionDisplay annotationDisplay() const;
bool showFormations() const;
void setShowFormationLabels( bool on );
void setShowRegionLabels( bool on );
bool showWellPathAttributes() const;
void setShowWellPathAttributes( bool on );
@ -204,7 +215,7 @@ private:
static CurveSamplingPointData curveSamplingPointData( RigGeoMechWellLogExtractor* extractor,
const RigFemResultAddress& resultAddress );
static void findFormationNamesToPlot( const CurveSamplingPointData& curveData,
static void findRegionNamesToPlot( const CurveSamplingPointData& curveData,
const std::vector<QString>& formationNamesVector,
RimWellLogPlot::DepthTypeEnum depthType,
std::vector<QString>* formationNamesToPlot,
@ -214,9 +225,11 @@ private:
void setFormationFieldsUiReadOnly( bool readOnly = true );
void updateRegionAnnotationsOnPlot();
void updateFormationNamesOnPlot();
void updateCurveDataRegionsOnPlot();
void updateWellPathAttributesOnPlot();
void removeFormationNames();
void removeRegionAnnotations();
void updateAxisScaleEngine();
bool isFirstVisibleTrackInPlot() const;
@ -239,10 +252,11 @@ private:
caf::PdmField<double> m_majorTickInterval;
caf::PdmField<double> m_minorTickInterval;
caf::PdmField<caf::AppEnum<RiuPlotAnnotationTool::FormationDisplay>> m_formationDisplay;
caf::PdmField<RegionAnnotationTypeEnum> m_regionAnnotationType;
caf::PdmField<RegionAnnotationDisplayEnum> m_regionAnnotationDisplay;
caf::PdmField<RimRegularLegendConfig::ColorRangeEnum> m_colorShadingPalette;
caf::PdmField<int> m_colorShadingTransparency;
caf::PdmField<bool> m_showFormationLabels;
caf::PdmField<bool> m_showRegionLabels;
caf::PdmField<caf::AppEnum<FormationSource>> m_formationSource;
caf::PdmPtrField<RimCase*> m_formationCase;
caf::PdmField<caf::AppEnum<TrajectoryType>> m_formationTrajectoryType;

View File

@ -575,6 +575,169 @@ void RigGeoMechWellLogExtractor::setWbsParameters( WbsParameterSource porePressu
m_userDefinedUcs = userDefinedUcs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigGeoMechWellLogExtractor::porePressureIntervals( int frameIndex )
{
std::vector<double> ppValues( m_intersections.size(), 0.0 );
RigFemResultAddress porBarResAddr( RIG_ELEMENT_NODAL, "POR-Bar", "" );
RigFemResultAddress porElementResAddr( RIG_ELEMENT, "POR", "" );
const RigFemPart* femPart = m_caseData->femParts()->part( 0 );
RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults();
std::vector<float> porePressures = resultCollection->resultValues( porBarResAddr, 0, frameIndex );
std::vector<float> poreElementPressuresPascal = resultCollection->resultValues( porElementResAddr, 0, frameIndex );
std::vector<float> interpolatedInterfacePorePressureBar;
interpolatedInterfacePorePressureBar.resize( m_intersections.size(), std::numeric_limits<double>::infinity() );
#pragma omp parallel for
for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx )
{
size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx];
RigElementType elmType = femPart->elementType( elmIdx );
if ( !( elmType == HEX8 || elmType == HEX8P ) ) continue;
interpolatedInterfacePorePressureBar[intersectionIdx] = interpolateGridResultValue( porBarResAddr.resultPosType,
porePressures,
intersectionIdx,
false );
}
#pragma omp parallel for
for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx )
{
// Priority 4: Hydrostatic pore pressure
ppValues[intersectionIdx] = static_cast<double>( HYDROSTATIC_PP );
// Priority 3: Try element property tables
if ( m_porePressureSource == AUTO || m_porePressureSource == ELEMENT_PROPERTY_TABLE )
{
size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx];
if ( elmIdx < poreElementPressuresPascal.size() )
{
ppValues[intersectionIdx] = static_cast<double>( ELEMENT_PROPERTY_TABLE );
}
}
// Priority 2: Try LAS-file
if ( m_porePressureSource == AUTO || m_porePressureSource == LAS_FILE )
{
double lasMudWeightKgPerM3 = getWellLogSegmentValue( intersectionIdx, m_wellLogMdAndMudWeightKgPerM3 );
if ( lasMudWeightKgPerM3 != std::numeric_limits<double>::infinity() )
{
ppValues[intersectionIdx] = static_cast<double>( LAS_FILE );
}
}
// Priority 1: Try pore pressure from the grid
if ( m_porePressureSource == AUTO || m_porePressureSource == GRID )
{
float averagePorePressureBar = std::numeric_limits<float>::infinity();
bool validGridPorePressure = averageIntersectionValuesToSegmentValue( intersectionIdx,
interpolatedInterfacePorePressureBar,
std::numeric_limits<float>::infinity(),
&averagePorePressureBar );
if ( validGridPorePressure )
{
ppValues[intersectionIdx] = static_cast<double>( GRID );
}
}
}
return ppValues;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigGeoMechWellLogExtractor::poissonIntervals( int frameIndex )
{
std::vector<double> poissonValues( m_intersections.size(), 0.0 );
RigFemResultAddress poissonResAddr( RIG_ELEMENT, "RATIO", "" );
RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults();
std::vector<float> poissonRatios = resultCollection->resultValues( poissonResAddr, 0, frameIndex );
#pragma omp parallel for
for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx )
{
// Priority 3: User defined Poisson ratio
poissonValues[intersectionIdx] = static_cast<double>( USER_DEFINED );
// Priority 2: Element property table ratio
if ( m_poissonRatioSource == AUTO || m_poissonRatioSource == ELEMENT_PROPERTY_TABLE )
{
size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx];
if ( elmIdx < poissonRatios.size() )
{
poissonValues[intersectionIdx] = static_cast<double>( ELEMENT_PROPERTY_TABLE );
}
}
// Priority 1: Las-file poisson ratio
if ( m_poissonRatioSource == AUTO || m_poissonRatioSource == LAS_FILE )
{
if ( !m_wellLogMdAndPoissonRatios.empty() )
{
double lasPoissionRatio = getWellLogSegmentValue( intersectionIdx, m_wellLogMdAndPoissonRatios );
if ( lasPoissionRatio != std::numeric_limits<double>::infinity() )
{
poissonValues[intersectionIdx] = static_cast<double>( LAS_FILE );
}
}
}
}
return poissonValues;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigGeoMechWellLogExtractor::ucsIntervals( int frameIndex )
{
std::vector<double> ucsValues( m_intersections.size(), 0.0 );
RigFemResultAddress ucsResAddr( RIG_ELEMENT, "UCS", "" );
RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults();
std::vector<float> ucsValuesPascal = resultCollection->resultValues( ucsResAddr, 0, frameIndex );
#pragma omp parallel for
for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx )
{
// Priority 3: User defined Poisson ratio
ucsValues[intersectionIdx] = static_cast<double>( USER_DEFINED );
// Priority 2: From element property table
if ( m_ucsSource == AUTO || m_ucsSource == ELEMENT_PROPERTY_TABLE )
{
size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx];
if ( elmIdx < ucsValuesPascal.size() )
{
ucsValues[intersectionIdx] = static_cast<double>( ELEMENT_PROPERTY_TABLE );
}
}
// Priority 1: Las-file
if ( m_ucsSource == AUTO || m_ucsSource == LAS_FILE )
{
if ( !m_wellLogMdAndUcsBar.empty() )
{
double lasUniaxialStrengthInBar = getWellLogSegmentValue( intersectionIdx, m_wellLogMdAndUcsBar );
if ( lasUniaxialStrengthInBar != std::numeric_limits<double>::infinity() )
{
ucsValues[intersectionIdx] = static_cast<double>( LAS_FILE );
}
}
}
}
return ucsValues;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -749,8 +912,8 @@ void RigGeoMechWellLogExtractor::calculateIntersection()
hexCorners[6] = cvf::Vec3d( nodeCoords[cornerIndices[6]] );
hexCorners[7] = cvf::Vec3d( nodeCoords[cornerIndices[7]] );
// int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[ccIdx],
// &intersections);
// int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners,
// closeCells[ccIdx], &intersections);
RigHexIntersectionTools::lineHexCellIntersection( p1, p2, hexCorners, closeCells[ccIdx], &intersections );
}

View File

@ -81,6 +81,10 @@ public:
double userDefinedPoissonRatio,
double userDefinedUcs );
std::vector<double> porePressureIntervals( int frameIndex );
std::vector<double> poissonIntervals( int frameIndex );
std::vector<double> ucsIntervals( int frameIndex );
private:
enum WellPathTangentCalculation
{

View File

@ -42,17 +42,16 @@ RiuPlotAnnotationTool::~RiuPlotAnnotationTool()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotAnnotationTool::attachFormationNames( QwtPlot* plot,
void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot* plot,
const std::vector<QString>& names,
const std::pair<double, double> xRange,
const std::vector<std::pair<double, double>> yPositions,
FormationDisplay formationDisplay,
RegionDisplay regionDisplay,
const caf::ColorTable& colorTable,
int shadingAlphaByte,
bool showNames /*= true */ )
bool showNames /*= true */,
TrackSpan trackSpan /*= FULL_WIDTH*/ )
{
detachAllAnnotations();
if ( names.size() != yPositions.size() ) return;
m_plot = plot;
@ -67,18 +66,20 @@ void RiuPlotAnnotationTool::attachFormationNames( QwtPlot*
for ( size_t i = 0; i < names.size(); i++ )
{
if ( names[i].isEmpty() ) continue;
QwtPlotMarker* line( new QwtPlotMarker() );
QString name;
if ( showNames )
{
name = names[i];
if ( ( formationDisplay & COLOR_SHADING ) == 0 && names[i].toLower().indexOf( "top" ) == -1 )
if ( ( regionDisplay & COLOR_SHADING ) == 0 && names[i].toLower().indexOf( "top" ) == -1 )
{
name += " Top";
}
}
if ( formationDisplay & COLOR_SHADING )
if ( regionDisplay & COLOR_SHADING )
{
cvf::Color3ub cvfColor = catMapper.mapToColor( static_cast<double>( i ) );
QColor shadingColor( cvfColor.r(), cvfColor.g(), cvfColor.b(), shadingAlphaByte );
@ -103,26 +104,28 @@ void RiuPlotAnnotationTool::attachFormationNames( QwtPlot*
QColor lineColor( 0, 0, 0, 0 );
QColor textColor( 0, 0, 0, 255 );
if ( formationDisplay & DARK_LINES || formationDisplay & COLORED_LINES )
if ( regionDisplay & DARK_LINES || regionDisplay & COLORED_LINES )
{
cvf::Color3ub cvfColor = catMapper.mapToColor( static_cast<double>( i ) );
QColor cycledColor( cvfColor.r(), cvfColor.g(), cvfColor.b() );
lineColor = formationDisplay & DARK_LINES ? QColor( 0, 0, 100 ) : cycledColor;
lineColor = regionDisplay & DARK_LINES ? QColor( 0, 0, 100 ) : cycledColor;
textColor = lineColor;
}
RiuPlotAnnotationTool::horizontalDashedLineWithColor( line, lineColor, textColor, name, yPositions[i].first );
Qt::Alignment horizontalAlignment = trackTextAlignment( trackSpan );
RiuPlotAnnotationTool::horizontalDashedLine( line,
name,
yPositions[i].first,
lineColor,
textColor,
horizontalAlignment );
line->attach( m_plot );
m_markers.push_back( std::move( line ) );
if ( ( i != names.size() - 1 ) && cvf::Math::abs( yPositions[i].second - yPositions[i + 1].first ) > delta )
{
QwtPlotMarker* bottomLine( new QwtPlotMarker() );
RiuPlotAnnotationTool::horizontalDashedLineWithColor( bottomLine,
lineColor,
textColor,
QString(),
yPositions[i].second );
RiuPlotAnnotationTool::horizontalDashedLine( bottomLine, QString(), yPositions[i].second, lineColor, textColor );
bottomLine->attach( m_plot );
m_markers.push_back( std::move( bottomLine ) );
@ -162,7 +165,7 @@ void RiuPlotAnnotationTool::attachAnnotationLine( QwtPlot* plot,
m_plot = plot;
QwtPlotMarker* line( new QwtPlotMarker() );
RiuPlotAnnotationTool::horizontalDashedLineWithColor( line, color, color, annotationText, yPosition );
RiuPlotAnnotationTool::horizontalDashedLine( line, annotationText, yPosition, color, color );
line->attach( m_plot );
m_markers.push_back( std::move( line ) );
}
@ -186,16 +189,31 @@ void RiuPlotAnnotationTool::detachAllAnnotations()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotAnnotationTool::horizontalDashedLine( QwtPlotMarker* line, const QString& name, double yValue )
Qt::Alignment RiuPlotAnnotationTool::trackTextAlignment( TrackSpan trackSpan )
{
horizontalDashedLineWithColor( line, QColor( 0, 0, 100 ), QColor( 0, 0, 100 ), name, yValue );
switch ( trackSpan )
{
case FULL_WIDTH:
return Qt::AlignRight;
case LEFT_COLUMN:
return Qt::AlignLeft;
case CENTRE_COLUMN:
return Qt::AlignCenter;
case RIGHT_COLUMN:
return Qt::AlignRight;
}
return Qt::AlignRight;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotAnnotationTool::horizontalDashedLineWithColor(
QwtPlotMarker* line, const QColor& color, const QColor& textColor, const QString& name, double yValue )
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 */ )
{
QPen curvePen;
curvePen.setStyle( Qt::DashLine );
@ -208,5 +226,5 @@ void RiuPlotAnnotationTool::horizontalDashedLineWithColor(
QwtText label( name );
label.setColor( textColor );
line->setLabel( label );
line->setLabelAlignment( Qt::AlignRight | Qt::AlignBottom );
line->setLabelAlignment( horizontalAlignment | Qt::AlignBottom );
}

View File

@ -33,27 +33,40 @@ class QwtPlot;
class RiuPlotAnnotationTool
{
public:
enum FormationDisplay
enum RegionAnnotationType
{
NO_ANNOTATIONS = 0,
FORMATION_ANNOTATIONS = 1,
CURVE_ANNOTATIONS = 2
};
enum RegionDisplay
{
NONE = 0x00,
DARK_LINES = 0x01,
COLORED_LINES = 0x02,
COLOR_SHADING = 0x04,
COLOR_SHADING_AND_LINES = 0x05
};
enum TrackSpan
{
FULL_WIDTH,
LEFT_COLUMN,
CENTRE_COLUMN,
RIGHT_COLUMN
};
public:
RiuPlotAnnotationTool(){};
~RiuPlotAnnotationTool();
void attachFormationNames( QwtPlot* plot,
void attachNamedRegions( QwtPlot* plot,
const std::vector<QString>& names,
const std::pair<double, double> xRange,
const std::vector<std::pair<double, double>> yPositions,
FormationDisplay formationDisplay,
RegionDisplay regionDisplay,
const caf::ColorTable& colorTable,
int shadingAlphaByte,
bool showNames = true );
bool showNames = true,
TrackSpan trackSpan = FULL_WIDTH );
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 yPosition );
@ -61,9 +74,13 @@ public:
void detachAllAnnotations();
private:
static void horizontalDashedLine( QwtPlotMarker* line, const QString& name, double yValue );
static void horizontalDashedLineWithColor(
QwtPlotMarker* line, const QColor& color, const QColor& textColor, const QString& name, double yValue );
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 );
private:
QPointer<QwtPlot> m_plot;