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