FreeCAD C++
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Gui::View3DInventorViewer Class Reference

#include <Gui/View3DInventorViewer.h>

Detailed Description

GUI view into a 3D scene provided by View3DInventor

Public Types

enum  SelectionMode {
  Lasso = 0, Rectangle = 1, Rubberband = 2, BoxZoom = 3,
  Clip = 4
}
 Pick modes for picking points in the scene. More...
 
Modus handling of the viewer

Here you can switch several features on/off and modes of the Viewer

enum  ViewerMod {
  ShowCoord =1, ShowFPS =2, SimpleBackground =4, DisallowRotation =8,
  DisallowPanning =16, DisallowZooming =32
}
 
Anti-Aliasing modes of the rendered 3D scene

Specifies Anti-Aliasing (AA) method

  • Smoothing enables OpenGL line and vertex smoothing (basically depreciated)
  • MSAA is hardware multi sampling (with 2, 4 or 8 passes), a quite common and efficient AA technique
enum  AntiAliasing
 
Render mode
enum  RenderType
 

Public Member Functions

virtual void OnChange (Gui::SelectionSingleton::SubjectType &rCaller, Gui::SelectionSingleton::MessageType Reason)
 Observer message from the Selection.
 
bool dumpToFile (SoNode *node, const char *filename, bool binary) const
 
SbVec2f screenCoordsOfPath (SoPath *path) const
 Returns the screen coordinates of the origin of the path's tail object. More...
 
void addEventCallback (SoType eventtype, SoEventCallbackCB *cb, void *userdata=0)
 
void removeEventCallback (SoType eventtype, SoEventCallbackCB *cb, void *userdata=0)
 
void setCameraOrientation (const SbRotation &rot, SbBool moveTocenter=false)
 
void boxZoom (const SbBox2s &)
 
void viewAll ()
 
void viewVR (void)
 Breaks out a VR window for a Rift.
 
void viewSelection ()
 
Handling of view providers
SbBool hasViewProvider (ViewProvider *) const
 
void addViewProvider (ViewProvider *)
 adds an ViewProvider to the view, e.g. from a feature
 
void removeViewProvider (ViewProvider *)
 remove a ViewProvider
 
ViewProvidergetViewProviderByPath (SoPath *) const
 get view provider by path
 
ViewProvidergetViewProviderByPathFromTail (SoPath *) const
 
std::vector< ViewProvider * > getViewProvidersOfType (const Base::Type &typeId) const
 get all view providers of given type
 
SbBool setEditingViewProvider (Gui::ViewProvider *p, int ModNum=0)
 set the ViewProvider in special edit mode
 
SbBool isEditingViewProvider () const
 return whether a view provider is edited
 
void resetEditingViewProvider ()
 reset from edit mode
 
void setOverrideMode (const std::string &mode)
 display override mode
 
void updateOverrideMode (const std::string &mode)
 
std::string getOverrideMode () const
 
Making pictures
void savePicture (int w, int h, int s, const QColor &, QImage &) const
 
void saveGraphic (int pagesize, const QColor &, SoVectorizeAction *va) const
 
Selection methods
void startSelection (SelectionMode=Lasso)
 
void stopSelection ()
 
bool isSelecting () const
 
std::vector< SbVec2f > getGLPolygon (SelectionRole *role=0) const
 
std::vector< SbVec2f > getGLPolygon (const std::vector< SbVec2s > &) const
 
const std::vector< SbVec2s > & getPolygon (SelectionRole *role=0) const
 
Edit methods
void setEditing (SbBool edit)
 
SbBool isEditing () const
 
void setEditingCursor (const QCursor &cursor)
 
void setComponentCursor (const QCursor &cursor)
 
void setRedirectToSceneGraph (SbBool redirect)
 
SbBool isRedirectedToSceneGraph () const
 
void setRedirectToSceneGraphEnabled (SbBool enable)
 
SbBool isRedirectToSceneGraphEnabled (void) const
 
Pick actions
bool pickPoint (const SbVec2s &pos, SbVec3f &point, SbVec3f &norm) const
 
SoPickedPoint * pickPoint (const SbVec2s &pos) const
 
const SoPickedPoint * getPickedPoint (SoEventCallback *n) const
 
SbBool pubSeekToPoint (const SbVec2s &pos)
 
void pubSeekToPoint (const SbVec3f &pos)
 
Clipping plane, near and far plane
SbVec3f getViewDirection () const
 
void setViewDirection (SbVec3f)
 
SbVec3f getUpDirection () const
 
SbRotation getCameraOrientation () const
 
SbVec3f getPointOnScreen (const SbVec2s &) const
 
void getNearPlane (SbVec3f &rcPt, SbVec3f &rcNormal) const
 
void getFarPlane (SbVec3f &rcPt, SbVec3f &rcNormal) const
 
void toggleClippingPlane ()
 
bool hasClippingPlane () const
 
SbVec3f projectOnNearPlane (const SbVec2f &) const
 
SbVec3f projectOnFarPlane (const SbVec2f &) const
 
Dimension controls

the "turn*" functions are wired up to parameter groups through view3dinventor. don't call them directly. instead set the parameter groups.

See also
TaskDimension
void turnAllDimensionsOn ()
 
void turnAllDimensionsOff ()
 
void turn3dDimensionsOn ()
 
void turn3dDimensionsOff ()
 
void turnDeltaDimensionsOn ()
 
void turnDeltaDimensionsOff ()
 
void eraseAllDimensions ()
 
void addDimension3d (SoNode *node)
 
void addDimensionDelta (SoNode *node)
 

Static Public Member Functions

static int getNumSamples ()
 Get the preferred samples from the user settings.
 

Member Enumeration Documentation

◆ SelectionMode

Pick modes for picking points in the scene.

Enumerator
Lasso 

Select objects using a lasso.

Rectangle 

Select objects using a rectangle.

Rubberband 

Select objects using a rubberband.

BoxZoom 

Perform a box zoom.

Clip 

Clip objects using a lasso.

◆ ViewerMod

Enumerator
ShowCoord 

Enables the Coordinate system in the corner.

ShowFPS 

Enables the Frams per Second counter.

SimpleBackground 

switch to a simple background.

DisallowRotation 

switch off the rotation.

DisallowPanning 

switch off the panning.

DisallowZooming 

switch off the zooming.

Member Function Documentation

◆ addEventCallback()

void Gui::View3DInventorViewer::addEventCallback ( SoType  eventtype,
SoEventCallbackCB *  cb,
void *  userdata = 0 
)

Set up a callback function cb which will be invoked for the given eventtype. userdata will be given as the first argument to the callback function.

◆ boxZoom()

void Gui::View3DInventorViewer::boxZoom ( const SbBox2s &  )

Zooms the viewport to the size of the bounding box.

◆ dumpToFile()

bool Gui::View3DInventorViewer::dumpToFile ( SoNode *  node,
const char *  filename,
bool  binary 
) const

Writes the current scenegraph to an Inventor file, either in ascii or binary.

◆ getCameraOrientation()

SbRotation Gui::View3DInventorViewer::getCameraOrientation ( ) const

Returns the orientation of the camera.

◆ getFarPlane()

void Gui::View3DInventorViewer::getFarPlane ( SbVec3f &  rcPt,
SbVec3f &  rcNormal 
) const

Returns the far plane represented by its normal and base point.

◆ getNearPlane()

void Gui::View3DInventorViewer::getNearPlane ( SbVec3f &  rcPt,
SbVec3f &  rcNormal 
) const

Returns the near plane represented by its normal and base point.

◆ getPointOnScreen()

SbVec3f Gui::View3DInventorViewer::getPointOnScreen ( const SbVec2s &  ) const

Returns the 3d point on the focal plane to the given 2d point.

◆ getUpDirection()

SbVec3f Gui::View3DInventorViewer::getUpDirection ( ) const

Returns the up direction

◆ getViewDirection()

SbVec3f Gui::View3DInventorViewer::getViewDirection ( ) const

Returns the view direction from the user's eye point in direction to the viewport which is actually the negative normal of the near plane. The vector is normalized to length of 1.

◆ hasClippingPlane()

bool Gui::View3DInventorViewer::hasClippingPlane ( ) const

Checks whether a clipping plane is set or not.

◆ projectOnFarPlane()

SbVec3f Gui::View3DInventorViewer::projectOnFarPlane ( const SbVec2f &  ) const

Project the given normalized 2d point onto the far plane

◆ projectOnNearPlane()

SbVec3f Gui::View3DInventorViewer::projectOnNearPlane ( const SbVec2f &  ) const

Project the given normalized 2d point onto the near plane

◆ removeEventCallback()

void Gui::View3DInventorViewer::removeEventCallback ( SoType  eventtype,
SoEventCallbackCB *  cb,
void *  userdata = 0 
)

Unregister the given callback function cb.

◆ savePicture()

void Gui::View3DInventorViewer::savePicture ( int  w,
int  h,
int  s,
const QColor &  ,
QImage &   
) const

Creates an image with width w and height h of the current scene graph using a multi-sampling of s and exports the rendered scenegraph to an image.

◆ screenCoordsOfPath()

SbVec2f Gui::View3DInventorViewer::screenCoordsOfPath ( SoPath *  path) const

Returns the screen coordinates of the origin of the path's tail object.

Return value is in floating-point pixels, origin at bottom-left.

◆ setCameraOrientation()

void Gui::View3DInventorViewer::setCameraOrientation ( const SbRotation &  rot,
SbBool  moveTocenter = false 
)

Set the camera's orientation. If isAnimationEnabled() returns true the reorientation is animated, otherwise its directly set.

◆ toggleClippingPlane()

void Gui::View3DInventorViewer::toggleClippingPlane ( )

Adds or remove a manipulator to/from the scenegraph.

◆ viewAll()

void Gui::View3DInventorViewer::viewAll ( )

Reposition the current camera so we can see the complete scene.

◆ viewSelection()

void Gui::View3DInventorViewer::viewSelection ( )

Reposition the current camera so we can see all selected objects of the scene. Therefore we search for all SOFCSelection nodes, if none of them is selected nothing happens.