#5576 Simulation wells: Add Fly to Object

This commit is contained in:
Magne Sjaastad
2020-03-07 16:15:03 +01:00
parent 49d74ce0e7
commit 587478cbd1
3 changed files with 47 additions and 2 deletions

View File

@@ -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 );
}
}
}

View File

@@ -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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -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;