#5116 Well Measurement: select RimWellMeasurementInView when picking in 3d view.

This commit is contained in:
Kristian Bendiksen 2020-01-10 11:52:57 +01:00
parent 33693932b6
commit 49dd2ad307
3 changed files with 40 additions and 1 deletions

View File

@ -26,6 +26,8 @@
#include "RimPerforationInterval.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellMeasurementInView.h"
#include "RimWellMeasurementInViewCollection.h"
#include "RimWellPath.h"
#include "RimWellPathAttribute.h"
#include "RimWellPathAttributeCollection.h"
@ -159,7 +161,23 @@ bool RicWellPathPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& event
}
RiuMainWindow::instance()->setResultInfo( measurementText );
RiuMainWindow::instance()->selectAsCurrentItem( collection );
Rim3dView* rimView = RiaApplication::instance()->activeReservoirView();
if ( rimView )
{
// Find the RimWellMeasurementInView which matches the selection
std::vector<RimWellMeasurementInViewCollection*> wellMeasurementInViewCollections;
rimView->descendantsIncludingThisOfType( wellMeasurementInViewCollections );
if ( !wellMeasurementInViewCollections.empty() )
{
RimWellMeasurementInView* wellMeasurementInView =
wellMeasurementInViewCollections[0]->getWellMeasurementInView( measurement );
if ( wellMeasurementInView )
{
RiuMainWindow::instance()->selectAsCurrentItem( wellMeasurementInView );
}
}
}
}
}

View File

@ -142,3 +142,21 @@ void RimWellMeasurementInViewCollection::syncWithChangesInWellMeasurementCollect
updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------
/// Get the "in-view" measurement corresponding to a give measurement.
//--------------------------------------------------------------------------------------------------
RimWellMeasurementInView*
RimWellMeasurementInViewCollection::getWellMeasurementInView( const RimWellMeasurement* measurement ) const
{
for ( RimWellMeasurementInView* wellMeasurementInView : measurements() )
{
if ( wellMeasurementInView->measurementKind() == measurement->kind() )
{
return wellMeasurementInView;
}
}
// No match
return nullptr;
}

View File

@ -24,6 +24,7 @@
#include <vector>
class RimWellMeasurementInView;
class RimWellMeasurement;
class RimWellMeasurementInViewCollection : public RimCheckableNamedObject
{
@ -37,6 +38,8 @@ public:
void syncWithChangesInWellMeasurementCollection();
RimWellMeasurementInView* getWellMeasurementInView( const RimWellMeasurement* measurement ) const;
protected:
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,