mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5576 Simulation wells: Add Fly to Object
This commit is contained in:
@@ -79,6 +79,12 @@ void RicFlyToObjectFeature::onActionTriggered( bool isChecked )
|
||||
directionNormalToLargesExtent = cvf::Vec3d::Y_AXIS;
|
||||
}
|
||||
|
||||
double zExtent = fabs( bb.extent().z() ) * activeView->scaleZ();
|
||||
largesExtent = std::max( largesExtent, zExtent );
|
||||
|
||||
// Scale to make the object fit in view
|
||||
largesExtent *= 2.0;
|
||||
|
||||
cvf::Vec3d cameraEye = centerInDisplayCoords + directionNormalToLargesExtent * std::max( largesExtent, 30.0 );
|
||||
cvf::Vec3d cameraViewRefPoint = centerInDisplayCoords;
|
||||
cvf::Vec3d cameraUp = cvf::Vec3d::Z_AXIS;
|
||||
@@ -113,7 +119,11 @@ cvf::BoundingBox RicFlyToObjectFeature::boundingBoxForSelectedObjects()
|
||||
{
|
||||
if ( obj )
|
||||
{
|
||||
bb.add( obj->boundingBoxInDomainCoords() );
|
||||
auto candidate = obj->boundingBoxInDomainCoords();
|
||||
if ( candidate.isValid() )
|
||||
{
|
||||
bb.add( candidate );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -745,6 +745,37 @@ void RimSimWellInView::scaleDisk( double minValue, double maxValue )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimSimWellInView::boundingBoxInDomainCoords() const
|
||||
{
|
||||
std::vector<std::vector<cvf::Vec3d>> pipeBranchesCLCoords;
|
||||
std::vector<std::vector<RigWellResultPoint>> pipeBranchesCellIds;
|
||||
|
||||
auto noConst = const_cast<RimSimWellInView*>( this );
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( noConst,
|
||||
pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds );
|
||||
|
||||
cvf::BoundingBox bb;
|
||||
for ( auto branch : pipeBranchesCLCoords )
|
||||
{
|
||||
if ( !branch.empty() )
|
||||
{
|
||||
// Estimate the bounding box based on first, middle and last coordinate of branches
|
||||
bb.add( branch.front() );
|
||||
|
||||
size_t mid = branch.size() / 2;
|
||||
bb.add( branch[mid] );
|
||||
|
||||
bb.add( branch.back() );
|
||||
}
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Rim3dPropertiesInterface.h"
|
||||
|
||||
#include "RigWellDiskData.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
@@ -46,7 +48,7 @@ class RimWellDiskConfig;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSimWellInView : public caf::PdmObject
|
||||
class RimSimWellInView : public caf::PdmObject, public Rim3dPropertiesInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -105,6 +107,8 @@ public:
|
||||
double calculateInjectionProductionFractions( const RimWellDiskConfig& wellDiskConfig, bool* isOk );
|
||||
void scaleDisk( double minValue, double maxValue );
|
||||
|
||||
cvf::BoundingBox boundingBoxInDomainCoords() const override;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
Reference in New Issue
Block a user