Well measurement improvements

* Update 3D view and plot when measurement data is added
* #8625 Make visibility of measurement follow well path visibility
This commit is contained in:
Magne Sjaastad 2023-02-07 17:44:47 +01:00 committed by GitHub
parent 8028444018
commit 9ae00177bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 57 deletions

View File

@ -24,6 +24,7 @@
#include "RimWellLogTrack.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellMeasurementCurve.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
@ -69,7 +70,9 @@ void RicNewWellMeasurementCurveFeature::onActionTriggered( bool isChecked )
measurementKind = firstMeasurement->kind();
}
RicWellLogTools::addWellMeasurementCurve( wellLogPlotTrack, wellPath, measurementKind );
auto curve = RicWellLogTools::addWellMeasurementCurve( wellLogPlotTrack, wellPath, measurementKind );
bool updateParentPlot = true;
if ( curve ) curve->loadDataAndUpdate( updateParentPlot );
}
}
}

View File

@ -20,6 +20,8 @@
#include "RiaApplication.h"
#include "RimGridView.h"
#include "RimWellMeasurementInViewCollection.h"
#include "RimWellPathCollection.h"
#include "RicWellMeasurementImportTools.h"
@ -63,6 +65,14 @@ void RicImportWellMeasurementsFeature::onActionTriggered( bool isChecked )
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );
RicWellMeasurementImportTools::importWellMeasurementsFromFiles( wellPathFilePaths, wellPathCollection );
RimGridView* activeView = RiaApplication::instance()->activeGridView();
if ( activeView )
{
std::vector<RimWellMeasurementInViewCollection*> measurementsInView;
activeView->descendantsOfType( measurementsInView );
if ( !measurementsInView.empty() ) measurementsInView.front()->setCheckState( true );
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -306,68 +306,65 @@ void RivWellPathPartMgr::appendWellMeasurementsToModel( cvf::ModelBasicList*
if ( !gridView->measurementCollection()->isChecked() ) return;
for ( RimWellMeasurementInView* wellMeasurementInView : gridView->measurementCollection()->measurements() )
for ( RimWellMeasurementInView* wellMeasurementInView :
gridView->measurementCollection()->visibleMeasurementsForWellPath( m_rimWellPath->name() ) )
{
if ( wellMeasurementInView->isChecked() && wellMeasurementInView->isWellChecked( m_rimWellPath->name() ) )
std::vector<QString> measurementKinds;
measurementKinds.push_back( wellMeasurementInView->measurementKind() );
double lowerBound = 0.0;
double upperBound = 0.0;
wellMeasurementInView->rangeValues( &lowerBound, &upperBound );
std::vector<int> qualityFilter = wellMeasurementInView->qualityFilter();
std::vector<RimWellMeasurement*> wellMeasurements =
RimWellMeasurementFilter::filterMeasurements( wellMeasurementCollection->measurements(),
*wellPathCollection,
*m_rimWellPath,
measurementKinds,
lowerBound,
upperBound,
qualityFilter );
RivPipeGeometryGenerator geoGenerator;
for ( RimWellMeasurement* wellMeasurement : wellMeasurements )
{
std::vector<QString> measurementKinds;
measurementKinds.push_back( wellMeasurementInView->measurementKind() );
double wellPathRadius = this->wellPathRadius( characteristicCellSize, this->wellPathCollection() );
double startMD = wellMeasurement->MD() - wellPathRadius * 0.5;
double endMD = wellMeasurement->MD() + wellPathRadius * 0.5;
double lowerBound = 0.0;
double upperBound = 0.0;
wellMeasurementInView->rangeValues( &lowerBound, &upperBound );
std::vector<int> qualityFilter = wellMeasurementInView->qualityFilter();
double wellMeasurementRadius =
this->wellMeasurementRadius( characteristicCellSize, this->wellPathCollection(), wellMeasurementInView );
std::vector<RimWellMeasurement*> wellMeasurements =
RimWellMeasurementFilter::filterMeasurements( wellMeasurementCollection->measurements(),
*wellPathCollection,
*m_rimWellPath,
measurementKinds,
lowerBound,
upperBound,
qualityFilter );
std::vector<cvf::Vec3d> displayCoords;
displayCoords.push_back( displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( startMD ) ) );
displayCoords.push_back( displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( startMD ) ) );
displayCoords.push_back( displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( endMD ) ) );
displayCoords.push_back( displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( endMD ) ) );
RivPipeGeometryGenerator geoGenerator;
for ( RimWellMeasurement* wellMeasurement : wellMeasurements )
std::vector<double> radii;
radii.push_back( std::min( wellPathRadius, wellMeasurementRadius ) );
radii.push_back( wellMeasurementRadius );
radii.push_back( wellMeasurementRadius );
radii.push_back( std::min( wellPathRadius, wellMeasurementRadius ) );
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo( wellMeasurement );
cvf::Collection<cvf::Part> parts;
// Use the view legend config to find color, if only one type of measurement is selected.
cvf::Color3f color = cvf::Color3f(
wellMeasurementInView->legendConfig()->scalarMapper()->mapToColor( wellMeasurement->value() ) );
geoGenerator.tubeWithCenterLinePartsAndVariableWidth( &parts, displayCoords, radii, color );
for ( auto part : parts )
{
double wellPathRadius = this->wellPathRadius( characteristicCellSize, this->wellPathCollection() );
double startMD = wellMeasurement->MD() - wellPathRadius * 0.5;
double endMD = wellMeasurement->MD() + wellPathRadius * 0.5;
double wellMeasurementRadius = this->wellMeasurementRadius( characteristicCellSize,
this->wellPathCollection(),
wellMeasurementInView );
std::vector<cvf::Vec3d> displayCoords;
displayCoords.push_back( displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( startMD ) ) );
displayCoords.push_back( displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( startMD ) ) );
displayCoords.push_back( displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( endMD ) ) );
displayCoords.push_back( displayCoordTransform->transformToDisplayCoord(
m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( endMD ) ) );
std::vector<double> radii;
radii.push_back( std::min( wellPathRadius, wellMeasurementRadius ) );
radii.push_back( wellMeasurementRadius );
radii.push_back( wellMeasurementRadius );
radii.push_back( std::min( wellPathRadius, wellMeasurementRadius ) );
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo( wellMeasurement );
cvf::Collection<cvf::Part> parts;
// Use the view legend config to find color, if only one type of measurement is selected.
cvf::Color3f color = cvf::Color3f(
wellMeasurementInView->legendConfig()->scalarMapper()->mapToColor( wellMeasurement->value() ) );
geoGenerator.tubeWithCenterLinePartsAndVariableWidth( &parts, displayCoords, radii, color );
for ( auto part : parts )
{
part->setSourceInfo( objectSourceInfo.p() );
model->addPart( part.p() );
}
part->setSourceInfo( objectSourceInfo.p() );
model->addPart( part.p() );
}
}
}

View File

@ -15,6 +15,7 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellMeasurementInViewCollection.h"
#include "Rim3dView.h"
@ -27,9 +28,11 @@
#include "RimWellMeasurementCollection.h"
#include "RimWellMeasurementFilter.h"
#include "RimWellMeasurementInView.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiTableViewEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
@ -51,6 +54,9 @@ RimWellMeasurementInViewCollection::RimWellMeasurementInViewCollection()
m_isChecked = false;
this->setName( "Well Measurements" );
CAF_PDM_InitField( &m_linkWellVisibility, "linkWellVisibility", true, "Link Visibility to Well Path Visibility" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_linkWellVisibility );
}
//--------------------------------------------------------------------------------------------------
@ -74,6 +80,31 @@ std::vector<RimWellMeasurementInView*> RimWellMeasurementInViewCollection::measu
return attrs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellMeasurementInView*>
RimWellMeasurementInViewCollection::visibleMeasurementsForWellPath( const QString& wellName ) const
{
if ( !isChecked() ) return {};
if ( m_linkWellVisibility )
{
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
auto wellPath = wellPathCollection->tryFindMatchingWellPath( wellName );
if ( wellPath && !wellPath->showWellPath() ) return {};
}
std::vector<RimWellMeasurementInView*> visible;
for ( auto m : measurements() )
{
if ( m->isChecked() && m->isWellChecked( wellName ) ) visible.push_back( m );
}
return visible;
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------

View File

@ -35,6 +35,7 @@ public:
~RimWellMeasurementInViewCollection() override;
std::vector<RimWellMeasurementInView*> measurements() const;
std::vector<RimWellMeasurementInView*> visibleMeasurementsForWellPath( const QString& wellName ) const;
void syncWithChangesInWellMeasurementCollection();
@ -46,4 +47,5 @@ protected:
private:
caf::PdmChildArrayField<RimWellMeasurementInView*> m_measurementsInView;
caf::PdmField<bool> m_linkWellVisibility;
};