Merge pull request #5105 from OPM/feature-wbs-plot-data-along-well-path

Feature wbs plot data along well path
This commit is contained in:
Magne Sjaastad
2019-11-27 14:08:29 +01:00
committed by GitHub
32 changed files with 2293 additions and 13 deletions

View File

@@ -26,6 +26,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurement.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDef.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.h
@@ -141,6 +143,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.h
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementFilter.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementInViewCollection.h
)
@@ -171,6 +176,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurement.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDef.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.cpp
@@ -286,6 +293,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementFilter.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementInViewCollection.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -310,6 +310,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder.addSeparator();
menuBuilder << "RicWellPathImportPerforationIntervalsFeature";
menuBuilder << "RicWellPathImportCompletionsFileFeature";
menuBuilder << "RicImportWellMeasurementsFeature";
menuBuilder.subMenuEnd();
menuBuilder.addSeparator();
menuBuilder.subMenuStart( "Export Well Paths", QIcon( ":/Save.png" ) );

View File

@@ -76,6 +76,7 @@
#include "RimViewLinker.h"
#include "RimViewNameConfig.h"
#include "RimVirtualPerforationResults.h"
#include "RimWellMeasurementInViewCollection.h"
#include "RimWellPathCollection.h"
#include "Riu3dSelectionManager.h"
@@ -1311,6 +1312,12 @@ void RimEclipseView::onUpdateLegends()
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( virtLegend->titledOverlayFrame(),
isUsingOverrideViewer() );
}
if ( m_wellMeasurementCollection->isChecked() && m_wellMeasurementCollection->legendConfig()->showLegend() )
{
m_wellMeasurementCollection->updateLegendRangesTextAndVisibility( nativeOrOverrideViewer(),
isUsingOverrideViewer() );
}
}
//--------------------------------------------------------------------------------------------------
@@ -1719,6 +1726,7 @@ void RimEclipseView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
uiTreeOrdering.add( faultResultSettings() );
uiTreeOrdering.add( &m_intersectionResultDefCollection );
uiTreeOrdering.add( wellCollection() );
uiTreeOrdering.add( &m_wellMeasurementCollection );
{
bool showFractureColors = false;
@@ -1856,6 +1864,8 @@ void RimEclipseView::onResetLegendsInViewer()
sepInterResDef->ternaryLegendConfig()->recreateLegend();
}
m_wellMeasurementCollection->legendConfig()->recreateLegend();
nativeOrOverrideViewer()->removeAllColorLegends();
}
@@ -2014,6 +2024,8 @@ std::vector<RimLegendConfig*> RimEclipseView::legendConfigs() const
absLegends.push_back( sepInterResDef->ternaryLegendConfig() );
}
absLegends.push_back( m_wellMeasurementCollection->legendConfig() );
return absLegends;
}

View File

@@ -46,6 +46,7 @@
#include "RimTernaryLegendConfig.h"
#include "RimViewLinker.h"
#include "RimViewNameConfig.h"
#include "RimWellMeasurementInViewCollection.h"
#include "Riu3DMainWindowTools.h"
#include "Riu3dSelectionManager.h"
@@ -433,6 +434,8 @@ void RimGeoMechView::onResetLegendsInViewer()
sepInterResDef->ternaryLegendConfig()->recreateLegend();
}
m_wellMeasurementCollection->legendConfig()->recreateLegend();
nativeOrOverrideViewer()->removeAllColorLegends();
}
@@ -483,6 +486,12 @@ void RimGeoMechView::onUpdateLegends()
isUsingOverrideViewer() );
}
}
if ( m_wellMeasurementCollection->isChecked() && m_wellMeasurementCollection->legendConfig()->showLegend() )
{
m_wellMeasurementCollection->updateLegendRangesTextAndVisibility( nativeOrOverrideViewer(),
isUsingOverrideViewer() );
}
}
}
@@ -907,6 +916,7 @@ void RimGeoMechView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
uiTreeOrdering.add( cellResult() );
uiTreeOrdering.add( m_tensorResults() );
uiTreeOrdering.add( &m_intersectionResultDefCollection );
uiTreeOrdering.add( &m_wellMeasurementCollection );
uiTreeOrdering.add( m_intersectionCollection() );

View File

@@ -33,6 +33,7 @@
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "RimViewNameConfig.h"
#include "RimWellMeasurementInViewCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RiuMainWindow.h"
@@ -85,6 +86,10 @@ RimGridView::RimGridView()
m_overlayInfoConfig = new Rim3dOverlayInfoConfig();
m_overlayInfoConfig->setReservoirView( this );
m_overlayInfoConfig.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_wellMeasurementCollection, "WellMeasurements", "Well Measurements", "", "", "" );
m_wellMeasurementCollection = new RimWellMeasurementInViewCollection;
m_wellMeasurementCollection.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
@@ -117,6 +122,7 @@ RimGridView::~RimGridView( void )
delete this->m_overlayInfoConfig();
delete m_wellMeasurementCollection;
delete m_rangeFilterCollection;
delete m_overrideRangeFilterCollection;
delete m_intersectionCollection;
@@ -161,6 +167,14 @@ RimIntersectionCollection* RimGridView::intersectionCollection() const
return m_intersectionCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementInViewCollection* RimGridView::measurementCollection() const
{
return m_wellMeasurementCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -30,6 +30,7 @@ class RimIntersectionResultsDefinitionCollection;
class RimPropertyFilterCollection;
class RimGridCollection;
class RimCellRangeFilterCollection;
class RimWellMeasurementInViewCollection;
class RimGridView : public Rim3dView
{
@@ -48,6 +49,7 @@ public:
RimIntersectionCollection* intersectionCollection() const;
RimIntersectionResultsDefinitionCollection* separateIntersectionResultsCollection() const;
RimAnnotationInViewCollection* annotationCollection() const;
RimWellMeasurementInViewCollection* measurementCollection() const;
virtual const RimPropertyFilterCollection* propertyFilterCollection() const = 0;
void rangeFiltersUpdated();
@@ -87,11 +89,12 @@ protected: // Fields
caf::PdmChildField<RimIntersectionResultsDefinitionCollection*> m_intersectionResultDefCollection;
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
caf::PdmChildField<RimCellRangeFilterCollection*> m_rangeFilterCollection;
caf::PdmChildField<RimCellRangeFilterCollection*> m_overrideRangeFilterCollection;
caf::PdmChildField<RimGridCollection*> m_gridCollection;
caf::PdmChildField<RimAnnotationInViewCollection*> m_annotationCollection;
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
caf::PdmChildField<RimCellRangeFilterCollection*> m_rangeFilterCollection;
caf::PdmChildField<RimCellRangeFilterCollection*> m_overrideRangeFilterCollection;
caf::PdmChildField<RimGridCollection*> m_gridCollection;
caf::PdmChildField<RimAnnotationInViewCollection*> m_annotationCollection;
caf::PdmChildField<RimWellMeasurementInViewCollection*> m_wellMeasurementCollection;
private:
cvf::ref<cvf::UByteArray> m_currentReservoirCellVisibility;

View File

@@ -0,0 +1,179 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellMeasurement.h"
#include "RimProject.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellPath.h"
CAF_PDM_SOURCE_INIT( RimWellMeasurement, "WellMeasurement" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurement::RimWellMeasurement()
{
CAF_PDM_InitObject( "RimWellMeasurement", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name", "", "", "" );
CAF_PDM_InitField( &m_MD, "Depth", -1.0, "MD", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_date, "Date", "Date", "", "", "" );
CAF_PDM_InitField( &m_value, "Value", 0.0, "Value", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_kind, "Kind", "Kind", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_quality, "Quality", "Quality", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_remark, "Remark", "Remark", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurement::~RimWellMeasurement() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellMeasurement::wellName() const
{
return m_wellName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurement::setWellName( const QString& wellName )
{
m_wellName = wellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellMeasurement::MD() const
{
return m_MD();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurement::setMD( double md )
{
m_MD = md;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QDate RimWellMeasurement::date() const
{
return m_date();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurement::setDate( const QDate& date )
{
m_date = date;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellMeasurement::value() const
{
return m_value();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurement::setValue( double value )
{
m_value = value;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellMeasurement::kind() const
{
return m_kind();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurement::setKind( const QString& kind )
{
m_kind = kind;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellMeasurement::quality() const
{
return m_quality();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurement::setQuality( int quality )
{
m_quality = quality;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellMeasurement::remark() const
{
return m_remark();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurement::setRemark( const QString& remark )
{
m_remark = remark;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurement::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
proj->scheduleCreateDisplayModelAndRedrawAllViews();
RimWellMeasurementCollection* wellMeasurementCollection;
this->firstAncestorOrThisOfTypeAsserted( wellMeasurementCollection );
wellMeasurementCollection->updateAllReferringTracks();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurement::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) {}

View File

@@ -0,0 +1,70 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include <QDate>
#include <QString>
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RimWellMeasurement : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellMeasurement();
~RimWellMeasurement() override;
QString wellName() const;
void setWellName( const QString& wellName );
double MD() const;
void setMD( double md );
QDate date() const;
void setDate( const QDate& date );
double value() const;
void setValue( double value );
QString kind() const;
void setKind( const QString& kind );
int quality() const;
void setQuality( int quality );
QString remark() const;
void setRemark( const QString& remark );
private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
caf::PdmField<QString> m_wellName;
caf::PdmField<double> m_MD;
caf::PdmField<QDate> m_date;
caf::PdmField<double> m_value;
caf::PdmField<QString> m_kind;
caf::PdmField<int> m_quality;
caf::PdmField<QString> m_remark;
};

View File

@@ -0,0 +1,173 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellMeasurementCollection.h"
#include "RimProject.h"
#include "RimWellLogTrack.h"
#include "RimWellMeasurement.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmUiTableViewEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
CAF_PDM_SOURCE_INIT( RimWellMeasurementCollection, "WellMeasurements" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementCollection::RimWellMeasurementCollection()
{
CAF_PDM_InitObject( "Well Measurement", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_measurements, "Measurements", "Well Measurements", "", "", "" );
m_measurements.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
m_measurements.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
m_measurements.uiCapability()->setUiTreeHidden( true );
this->setName( "Well Measurements" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementCollection::~RimWellMeasurementCollection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCollection::updateAllReferringTracks()
{
std::vector<RimWellLogTrack*> wellLogTracks;
this->objectsWithReferringPtrFieldsOfType( wellLogTracks );
for ( RimWellLogTrack* track : wellLogTracks )
{
track->loadDataAndUpdate();
}
this->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellMeasurement*> RimWellMeasurementCollection::measurements() const
{
std::vector<RimWellMeasurement*> attrs;
for ( auto attr : m_measurements )
{
attrs.push_back( attr.p() );
}
return attrs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCollection::insertMeasurement( RimWellMeasurement* insertBefore, RimWellMeasurement* measurement )
{
size_t index = m_measurements.index( insertBefore );
if ( index < m_measurements.size() )
m_measurements.insert( index, measurement );
else
m_measurements.push_back( measurement );
this->updateAllReferringTracks();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCollection::appendMeasurement( RimWellMeasurement* measurement )
{
m_measurements.push_back( measurement );
this->updateAllReferringTracks();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCollection::deleteMeasurement( RimWellMeasurement* measurementToDelete )
{
m_measurements.removeChildObject( measurementToDelete );
delete measurementToDelete;
this->updateAllReferringTracks();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCollection::deleteAllMeasurements()
{
m_measurements.deleteAllChildObjects();
this->updateAllReferringTracks();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCollection::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_measurements )
{
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute );
if ( tvAttribute )
{
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FILL_CONTAINER;
tvAttribute->alwaysEnforceResizePolicy = true;
tvAttribute->minimumHeight = 300;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_measurements );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
QString uiConfigName /*= ""*/ )
{
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_isChecked )
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
proj->scheduleCreateDisplayModelAndRedrawAllViews();
this->updateAllReferringTracks();
}
}

View File

@@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimCheckableNamedObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
class RimWellMeasurement;
//==================================================================================================
///
//==================================================================================================
class RimWellMeasurementCollection : public RimCheckableNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellMeasurementCollection();
~RimWellMeasurementCollection() override;
std::vector<RimWellMeasurement*> measurements() const;
void updateAllReferringTracks();
void insertMeasurement( RimWellMeasurement* insertBefore, RimWellMeasurement* measurement );
void appendMeasurement( RimWellMeasurement* measurement );
void deleteMeasurement( RimWellMeasurement* measurementToDelete );
void deleteAllMeasurements();
protected:
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
private:
caf::PdmChildArrayField<RimWellMeasurement*> m_measurements;
};

View File

@@ -0,0 +1,392 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellMeasurementCurve.h"
#include "RigWellLogCurveData.h"
#include "RigWellPath.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellMeasurementFilter.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPlotTools.h"
#include "RimWellRftPlot.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtPlotWidget.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "cafPdmUiTreeOrdering.h"
#include <QFileInfo>
#include <QMessageBox>
CAF_PDM_SOURCE_INIT( RimWellMeasurementCurve, "WellMeasurementCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementCurve::RimWellMeasurementCurve()
{
CAF_PDM_InitObject( "Well Measurement Curve", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path", "", "", "" );
m_wellPath.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_measurementKind, "CurveMeasurementKind", "Measurement Kind", "", "", "" );
m_measurementKind.uiCapability()->setUiTreeChildrenHidden( true );
m_wellPath = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementCurve::~RimWellMeasurementCurve() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isCurveVisible() )
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );
CVF_ASSERT( wellLogPlot );
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
if ( m_wellPath && !m_measurementKind().isEmpty() && wellPathCollection )
{
const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection();
std::vector<QString> measurementKinds;
measurementKinds.push_back( measurementKind() );
std::vector<RimWellMeasurement*> measurements =
RimWellMeasurementFilter::filterMeasurements( measurementCollection->measurements(),
*wellPathCollection,
*m_wellPath,
measurementKinds );
// Extract the values for this measurement kind
std::vector<double> values;
std::vector<double> measuredDepthValues;
for ( auto& measurement : measurements )
{
if ( measurement->kind() == measurementKind() )
{
values.push_back( measurement->value() );
measuredDepthValues.push_back( measurement->MD() );
}
}
if ( values.size() == measuredDepthValues.size() )
{
this->setValuesAndDepths( values,
measuredDepthValues,
RiaDefines::MEASURED_DEPTH,
RiaDefines::UNIT_METER,
false );
RigWellPath* rigWellPath = m_wellPath->wellPathGeometry();
if ( rigWellPath )
{
std::vector<double> trueVerticalDepthValues;
for ( double measuredDepthValue : measuredDepthValues )
{
trueVerticalDepthValues.push_back(
-rigWellPath->interpolatedPointAlongWellPath( measuredDepthValue ).z() );
}
this->setValuesAndDepths( values,
measuredDepthValues,
RiaDefines::TRUE_VERTICAL_DEPTH,
RiaDefines::UNIT_METER,
false );
}
}
if ( m_isUsingAutoName )
{
m_qwtPlotCurve->setTitle( createCurveAutoName() );
}
setSymbol( getSymbolForMeasurementKind( m_measurementKind() ) );
setColor( getColorForMeasurementKind( measurementKind() ) );
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER;
if ( wellLogPlot )
{
displayUnit = wellLogPlot->depthUnit();
}
if ( wellLogPlot && wellLogPlot->depthType() == RiaDefines::TRUE_VERTICAL_DEPTH &&
this->curveData()->availableDepthTypes().count( RiaDefines::TRUE_VERTICAL_DEPTH ) )
{
m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(),
this->curveData()
->depthPlotValues( RiaDefines::TRUE_VERTICAL_DEPTH, displayUnit )
.data(),
static_cast<int>( this->curveData()->xPlotValues().size() ) );
}
else
{
m_qwtPlotCurve
->setSamples( this->curveData()->xPlotValues().data(),
this->curveData()->depthPlotValues( RiaDefines::MEASURED_DEPTH, displayUnit ).data(),
static_cast<int>( this->curveData()->xPlotValues().size() ) );
}
m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
}
if ( updateParentPlot )
{
updateZoomInParentPlot();
}
if ( m_parentQwtPlot )
{
m_parentQwtPlot->replot();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCurve::setWellPath( RimWellPath* wellPath )
{
m_wellPath = wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RimWellMeasurementCurve::wellPath() const
{
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_wellPath || changedField == &m_measurementKind )
{
this->loadDataAndUpdate( true );
}
if ( m_parentQwtPlot ) m_parentQwtPlot->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimPlotCurve::updateOptionSensitivity();
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add( &m_wellPath );
curveDataGroup->add( &m_measurementKind );
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
nameGroup->add( &m_showLegend );
RimPlotCurve::curveNameUiOrdering( *nameGroup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
QString uiConfigName /*= ""*/ )
{
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
RimWellMeasurementCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if ( options.size() > 0 ) return options;
if ( fieldNeedingOptions == &m_wellPath )
{
auto wellPathColl = RimTools::wellPathCollection();
if ( wellPathColl )
{
caf::PdmChildArrayField<RimWellPath*>& wellPaths = wellPathColl->wellPaths;
for ( size_t i = 0; i < wellPaths.size(); i++ )
{
options.push_back( caf::PdmOptionItemInfo( wellPaths[i]->name(), wellPaths[i] ) );
}
if ( options.size() > 0 )
{
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
}
}
if ( fieldNeedingOptions == &m_measurementKind )
{
if ( m_wellPath() )
{
// TODO: take all options from somewhere and filter based on
// what the current well path has set.
options.push_back( caf::PdmOptionItemInfo( "XLOT", "XLOT" ) );
options.push_back( caf::PdmOptionItemInfo( "LOT", "LOT" ) );
options.push_back( caf::PdmOptionItemInfo( "FIT", "FIT" ) );
options.push_back( caf::PdmOptionItemInfo( "DP", "DP" ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCurve::initAfterRead()
{
if ( !m_wellPath ) return;
// TODO: do something here?
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellMeasurementCurve::createCurveAutoName()
{
if ( m_wellPath )
{
QStringList name;
name.push_back( wellName() );
name.push_back( measurementKind() );
return name.join( ", " );
}
return "Empty curve";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellMeasurementCurve::wellLogChannelName() const
{
// Does not really make sense for measurement curve.
return QString( "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellMeasurementCurve::wellName() const
{
if ( m_wellPath )
{
return m_wellPath->name();
}
return QString( "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellMeasurementCurve::measurementKind() const
{
if ( !m_measurementKind().isEmpty() )
{
return m_measurementKind();
}
return QString( "None" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementCurve::setMeasurementKind( const QString& measurementKind )
{
m_measurementKind = measurementKind;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtSymbol::PointSymbolEnum RimWellMeasurementCurve::getSymbolForMeasurementKind( const QString& measurementKind )
{
std::map<QString, RiuQwtSymbol::PointSymbolEnum> symbolTable;
symbolTable["XLOT"] = RiuQwtSymbol::SYMBOL_RECT;
symbolTable["LOT"] = RiuQwtSymbol::SYMBOL_TRIANGLE;
symbolTable["FIT"] = RiuQwtSymbol::SYMBOL_DIAMOND;
symbolTable["MCF"] = RiuQwtSymbol::SYMBOL_ELLIPSE;
symbolTable["MNF"] = RiuQwtSymbol::SYMBOL_ELLIPSE;
symbolTable["TH"] = RiuQwtSymbol::SYMBOL_STAR1;
symbolTable["LE"] = RiuQwtSymbol::SYMBOL_STAR2;
symbolTable["BA"] = RiuQwtSymbol::SYMBOL_STAR1;
symbolTable["CORE"] = RiuQwtSymbol::SYMBOL_RECT;
symbolTable["PPG"] = RiuQwtSymbol::SYMBOL_RECT;
auto it = symbolTable.find( measurementKind );
if ( it != symbolTable.end() )
return it->second;
else
return RiuQwtSymbol::SYMBOL_CROSS;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimWellMeasurementCurve::getColorForMeasurementKind( const QString& measurementKind )
{
if ( measurementKind == "TH" ) return cvf::Color3f::RED;
if ( measurementKind == "LE" ) return cvf::Color3f::BLUE;
if ( measurementKind == "BA" ) return cvf::Color3f::GREEN;
if ( measurementKind == "CORE" ) return cvf::Color3f::BLACK;
return cvf::Color3f::CRIMSON;
}

View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimWellLogCurve.h"
#include "RiuQwtSymbol.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
#include <vector>
class RimWellPath;
class RimWellMeasurement;
//==================================================================================================
///
//==================================================================================================
class RimWellMeasurementCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
RimWellMeasurementCurve();
~RimWellMeasurementCurve() override;
void setWellPath( RimWellPath* wellPath );
RimWellPath* wellPath() const;
void setMeasurementKind( const QString& measurementKind );
QString measurementKind() const;
// Overrides from RimWellLogPlotCurve
QString wellName() const override;
QString wellLogChannelName() const override;
protected:
// Overrides from RimWellLogCurve
QString createCurveAutoName() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override;
// Pdm overrrides
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void initAfterRead() override;
RiuQwtSymbol::PointSymbolEnum getSymbolForMeasurementKind( const QString& measurementKind );
cvf::Color3f getColorForMeasurementKind( const QString& measurementKind );
protected:
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmField<QString> m_measurementKind;
};

View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellMeasurementFilter.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellMeasurement*>
RimWellMeasurementFilter::filterMeasurements( const std::vector<RimWellMeasurement*>& measurements,
const RimWellPathCollection& wellPathCollection,
const RimWellPath& wellPath,
const std::vector<QString>& measurementKinds )
{
std::vector<RimWellMeasurement*> filteredMeasurements;
for ( auto& measurement : measurements )
{
if ( std::find( measurementKinds.begin(), measurementKinds.end(), measurement->kind() ) != measurementKinds.end() )
{
RimWellPath* matchedWellPath = wellPathCollection.tryFindMatchingWellPath( measurement->wellName() );
if ( matchedWellPath && matchedWellPath == &wellPath )
{
filteredMeasurements.push_back( measurement );
}
}
}
return filteredMeasurements;
}
std::vector<RimWellMeasurement*>
RimWellMeasurementFilter::filterMeasurements( const std::vector<RimWellMeasurement*>& measurements,
const std::vector<QString>& measurementKinds )
{
std::vector<RimWellMeasurement*> filteredMeasurements;
for ( auto& measurement : measurements )
{
if ( std::find( measurementKinds.begin(), measurementKinds.end(), measurement->kind() ) != measurementKinds.end() )
{
filteredMeasurements.push_back( measurement );
}
}
return filteredMeasurements;
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>
class RimWellPath;
class RimWellMeasurement;
class RimWellPathCollection;
class QString;
class RimWellMeasurementFilter
{
public:
static std::vector<RimWellMeasurement*> filterMeasurements( const std::vector<RimWellMeasurement*>& measurements,
const RimWellPathCollection& wellPathCollection,
const RimWellPath& rimWellPath,
const std::vector<QString>& measurementKinds );
static std::vector<RimWellMeasurement*> filterMeasurements( const std::vector<RimWellMeasurement*>& measurements,
const std::vector<QString>& measurementKinds );
private:
RimWellMeasurementFilter();
};

View File

@@ -0,0 +1,197 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellMeasurementInViewCollection.h"
#include "Rim3dView.h"
#include "RimProject.h"
#include "RimRegularLegendConfig.h"
#include "RimTools.h"
#include "RimWellLogTrack.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellMeasurementFilter.h"
#include "RimWellPathCollection.h"
#include "RiuViewer.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmUiTableViewEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
#include <cmath>
CAF_PDM_SOURCE_INIT( RimWellMeasurementInViewCollection, "WellMeasurementsInView" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementInViewCollection::RimWellMeasurementInViewCollection()
{
CAF_PDM_InitObject( "Well Measurement", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", "", "", "" );
m_legendConfig = new RimRegularLegendConfig();
m_legendConfig.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_measurementKinds, "MeasurementKinds", "Measurent Kinds", "", "", "" );
m_measurementKinds.uiCapability()->setAutoAddingOptionFromValue( false );
m_measurementKinds.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
m_measurementKinds.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_measurementKinds.xmlCapability()->disableIO();
this->setName( "Well Measurements" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementInViewCollection::~RimWellMeasurementInViewCollection()
{
delete m_legendConfig;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementInViewCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
QString uiConfigName /*= ""*/ )
{
uiTreeOrdering.add( &m_legendConfig );
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_isChecked || changedField == &m_measurementKinds || changedField == &m_legendConfig )
{
updateLegendData();
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
proj->scheduleCreateDisplayModelAndRedrawAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimRegularLegendConfig* RimWellMeasurementInViewCollection::legendConfig()
{
return m_legendConfig;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellMeasurementInViewCollection::updateLegendData()
{
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
if ( !wellPathCollection ) return false;
RimWellMeasurementCollection* wellMeasurementCollection = wellPathCollection->measurementCollection();
if ( !wellMeasurementCollection ) return false;
std::vector<QString> selectedMeasurementKinds = measurementKinds();
// Only show legend when only one measurement is selected
if ( selectedMeasurementKinds.size() == 1 )
{
std::vector<RimWellMeasurement*> wellMeasurements =
RimWellMeasurementFilter::filterMeasurements( wellMeasurementCollection->measurements(),
selectedMeasurementKinds );
double minValue = HUGE_VAL;
double maxValue = -HUGE_VAL;
double posClosestToZero = HUGE_VAL;
double negClosestToZero = -HUGE_VAL;
for ( auto& measurement : wellMeasurements )
{
minValue = std::min( measurement->value(), minValue );
maxValue = std::max( measurement->value(), maxValue );
}
if ( minValue != HUGE_VAL )
{
m_legendConfig->setTitle( QString( "Well Measurement: \n" ) + selectedMeasurementKinds[0] );
m_legendConfig->setAutomaticRanges( minValue, maxValue, minValue, maxValue );
m_legendConfig->setClosestToZeroValues( posClosestToZero, negClosestToZero, posClosestToZero, negClosestToZero );
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementInViewCollection::updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer,
bool isUsingOverrideViewer )
{
bool addToViewer = updateLegendData();
if ( addToViewer )
{
nativeOrOverrideViewer->addColorLegendToBottomLeftCorner( m_legendConfig->titledOverlayFrame(),
isUsingOverrideViewer );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
RimWellMeasurementInViewCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_measurementKinds )
{
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
if ( wellPathCollection )
{
std::vector<RimWellMeasurement*> measurements = wellPathCollection->measurementCollection()->measurements();
std::set<QString> measurementKindsInData;
for ( auto measurement : measurements )
{
measurementKindsInData.insert( measurement->kind() );
}
for ( auto measurementKind : measurementKindsInData )
{
options.push_back( caf::PdmOptionItemInfo( measurementKind, measurementKind ) );
}
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimWellMeasurementInViewCollection::measurementKinds() const
{
return m_measurementKinds;
}

View File

@@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimCheckableNamedObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
#include <vector>
class RimWellMeasurement;
class RimRegularLegendConfig;
class RiuViewer;
class RimWellMeasurementInViewCollection : public RimCheckableNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellMeasurementInViewCollection();
~RimWellMeasurementInViewCollection() override;
RimRegularLegendConfig* legendConfig();
std::vector<QString> measurementKinds() const;
void updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer );
protected:
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly );
bool updateLegendData();
private:
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
caf::PdmField<std::vector<QString>> m_measurementKinds;
};

View File

@@ -38,6 +38,7 @@
#include "RimPerforationCollection.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellPath.h"
#include "Riu3DMainWindowTools.h"
@@ -103,9 +104,12 @@ RimWellPathCollection::RimWellPathCollection()
CAF_PDM_InitField( &wellPathClipZDistance, "WellPathClipZDistance", 100, "Well Path Clipping Depth Distance", "", "", "" );
CAF_PDM_InitFieldNoDefault( &wellPaths, "WellPaths", "Well Paths", "", "", "" );
wellPaths.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_wellMeasurements, "WellMeasurements", "Measurements", "", "", "" );
m_wellMeasurements = new RimWellMeasurementCollection;
m_wellMeasurements->uiCapability()->setUiTreeHidden( true );
m_wellPathImporter = new RifWellPathImporter;
m_wellPathFormationsImporter = new RifWellPathFormationsImporter;
m_mostRecentlyUpdatedWellPath = nullptr;
@@ -221,7 +225,8 @@ std::vector<RimFileWellPath*> RimWellPathCollection::addWellPaths( QStringList f
QString s2 = f2.fileName();
if ( s1 == s2 )
{
// printf("Attempting to open well path JSON file that is already open:\n %s\n", (const char*) filePath.toLocal8Bit());
// printf("Attempting to open well path JSON file that is already open:\n %s\n", (const char*)
// filePath.toLocal8Bit());
alreadyOpen = true;
errorMessages->push_back( QString( "%1 is already loaded" ).arg( filePath ) );
break;
@@ -654,3 +659,21 @@ RiaEclipseUnitTools::UnitSystemType RimWellPathCollection::findUnitSystemForWell
}
return RiaEclipseUnitTools::UNITS_UNKNOWN;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementCollection* RimWellPathCollection::measurementCollection()
{
return m_wellMeasurements;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellMeasurementCollection* RimWellPathCollection::measurementCollection() const
{
return m_wellMeasurements;
}

View File

@@ -42,6 +42,7 @@ class RimProject;
class RimWellLogFile;
class RimWellPath;
class RifWellPathFormationsImporter;
class RimWellMeasurementCollection;
class QString;
namespace cvf
@@ -111,6 +112,9 @@ public:
bool anyWellsContainingPerforationIntervals() const;
size_t modelledWellPathCount() const;
RimWellMeasurementCollection* measurementCollection();
const RimWellMeasurementCollection* measurementCollection() const;
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
@@ -125,7 +129,8 @@ private:
RiaEclipseUnitTools::UnitSystemType findUnitSystemForWellPath( const RimWellPath* wellPath );
RifWellPathImporter* m_wellPathImporter;
RifWellPathFormationsImporter* m_wellPathFormationsImporter;
caf::PdmPointer<RimWellPath> m_mostRecentlyUpdatedWellPath;
RifWellPathImporter* m_wellPathImporter;
RifWellPathFormationsImporter* m_wellPathFormationsImporter;
caf::PdmPointer<RimWellPath> m_mostRecentlyUpdatedWellPath;
caf::PdmChildField<RimWellMeasurementCollection*> m_wellMeasurements;
};