diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 40835f5866..80fe8cbb3f 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -2174,15 +2174,29 @@ void View3DInventorViewer::setSeekMode(SbBool on) NavigationStyle::IDLE : NavigationStyle::INTERACT)); } -void View3DInventorViewer::printDimension() -{ +SbVec3f View3DInventorViewer::getCenterPointOnFocalPlane() const { + SoCamera* cam = getSoRenderManager()->getCamera(); + if (!cam) + return SbVec3f(0. ,0. ,0. ); + + SbVec3f direction; + cam->orientation.getValue().multVec(SbVec3f(0, 0, -1), direction); + return cam->position.getValue() + cam->focalDistance.getValue() * direction; +} + +float View3DInventorViewer::getMaxDimension() const { + float fHeight = -1.0; + float fWidth = -1.0; + getDimensions(fHeight, fWidth); + return std::max(fHeight, fWidth); +} + +void View3DInventorViewer::getDimensions(float& fHeight, float& fWidth) const { SoCamera* camera = getSoRenderManager()->getCamera(); if (!camera) // no camera there return; float aspectRatio = getViewportRegion().getViewportAspectRatio(); - float fHeight = -1.0; - float fWidth = -1.0; SoType type = camera->getTypeId(); if (type.isDerivedFrom(SoOrthographicCamera::getClassTypeId())) { @@ -2201,6 +2215,13 @@ void View3DInventorViewer::printDimension() else { fHeight *= aspectRatio; } +} + +void View3DInventorViewer::printDimension() +{ + float fHeight = -1.0; + float fWidth = -1.0; + getDimensions(fHeight, fWidth); QString dim; diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index 6c57891062..27a30ca380 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -392,6 +392,10 @@ public: bool isEnabledVBO() const; void setRenderCache(int); + void getDimensions(float& fHeight, float& fWidth) const; + float getMaxDimension() const; + SbVec3f getCenterPointOnFocalPlane() const; + NavigationStyle* navigationStyle() const; void setDocument(Gui::Document *pcDocument);