Gui::NavigationStyle Class Reference

The navigation style base class. More...

#include <NavigationStyle.h>

Public Types

enum  OrbitStyle { Turntable , Trackball }
 
enum class  RotationCenterMode { WindowCenter = 0 , ScenePointAtCursor = 1 , FocalPointAtCursor = 2 , BoundingBoxCenter = 4 }
 
enum  SelectionMode {
  Lasso = 0 , Rectangle = 1 , Rubberband = 2 , BoxZoom = 3 ,
  Clip = 4
}
 
enum  ViewerMode {
  IDLE , INTERACT , ZOOMING , BOXZOOM ,
  PANNING , DRAGGING , SPINNING , SEEK_WAIT_MODE ,
  SEEK_MODE , SELECTION
}
 

Public Member Functions

void abortSelection ()
 
void boxZoom (const SbBox2s &box)
 
SbVec3f getFocalPoint () const
 
OrbitStyle getOrbitStyle () const
 
const std::vector< SbVec2s > & getPolygon (SelectionRole *role=nullptr) const
 
RotationCenterModes getRotationCenterMode () const
 
float getSensitivity () const
 
int getViewingMode () const
 
SbBool isAnimating () const
 
SbBool isAnimationEnabled () const
 
SbBool isPopupMenuEnabled () const
 
SbBool isResetCursorPosition () const
 
SbBool isSelecting () const
 
SbBool isZoomAtCursor () const
 
SbBool isZoomInverted () const
 
void lookAtPoint (const SbVec3f &)
 
 NavigationStyle ()
 
NavigationStyleoperator= (const NavigationStyle &ns)
 
virtual SbBool processClickEvent (const SoMouseButtonEvent *const event)
 
virtual SbBool processEvent (const SoEvent *const ev)
 
virtual SbBool processKeyboardEvent (const SoKeyboardEvent *const event)
 
virtual SbBool processMotionEvent (const SoMotion3Event *const ev)
 
virtual SbBool processWheelEvent (const SoMouseWheelEvent *const event)
 
void redraw ()
 
void setAnimationEnabled (const SbBool enable)
 
void setCameraOrientation (const SbRotation &rot, SbBool moveTocenter=false)
 
void setOrbitStyle (OrbitStyle style)
 
void setPopupMenuEnabled (const SbBool on)
 
void setResetCursorPosition (SbBool)
 
void setRotationCenter (const SbVec3f &cnt)
 
void setRotationCenterMode (RotationCenterModes)
 
void setSensitivity (float)
 
void setViewer (View3DInventorViewer *)
 
void setViewingMode (const ViewerMode newmode)
 
void setZoomAtCursor (SbBool)
 
void setZoomInverted (SbBool)
 
void setZoomStep (float)
 
void startAnimating (const SbVec3f &axis, float velocity)
 
void startSelection (AbstractMouseSelection *)
 
void startSelection (SelectionMode=Lasso)
 
void stopAnimating ()
 
void stopSelection ()
 
void updateAnimation ()
 
virtual void viewAll ()
 
void zoomIn ()
 
void zoomOut ()
 
virtual ~NavigationStyle ()
 
- Public Member Functions inherited from Base::BaseClass
 BaseClass ()
 Construction. More...
 
 BaseClass (const BaseClass &)=default
 
virtual PyObjectgetPyObject ()
 This method returns the Python wrapper for a C++ object. More...
 
virtual Type getTypeId () const
 
bool isDerivedFrom (const Type type) const
 
BaseClassoperator= (const BaseClass &)=default
 
virtual void setPyObject (PyObject *)
 
virtual ~BaseClass ()
 Destruction. More...
 

Protected Member Functions

void addToLog (const SbVec2s pos, const SbTime time)
 
void clearLog ()
 
void doRotate (SoCamera *camera, float angle, const SbVec2f &pos)
 
SbBool doSpin ()
 
void doZoom (SoCamera *camera, float logzoomfactor, const SbVec2f &pos)
 NavigationStyle::doZoom Zooms in or out by specified factor, keeping the point on screen specified by parameter pos fixed or not according to user preference (NavigationStyle::zoomAtCursor). Ignores invertZoom user preference. More...
 
void doZoom (SoCamera *camera, int wheeldelta, const SbVec2f &pos)
 
void finalize ()
 
int getDelta () const
 
int getInteractiveCount () const
 
SbVec3f getRotationCenter (SbBool *) const
 
SbBool handleEventInForeground (const SoEvent *const e)
 
void initialize ()
 
void interactiveCountDec ()
 
void interactiveCountInc ()
 
SbBool isSeekMode () const
 
SbBool isViewing () const
 
SbBool lookAtPoint (const SbVec2s screenpos)
 
void moveCursorPosition ()
 
SbVec2f normalizePixelPos (SbVec2f pixpos)
 
SbVec2f normalizePixelPos (SbVec2s pixpos)
 
virtual void openPopupMenu (const SbVec2s &position)
 
void pan (SoCamera *camera)
 
void panCamera (SoCamera *camera, float vpaspect, const SbPlane &panplane, const SbVec2f &previous, const SbVec2f &current)
 
void panToCenter (const SbPlane &pplane, const SbVec2f &currpos)
 
virtual SbBool processSoEvent (const SoEvent *const ev)
 
void reorientCamera (SoCamera *camera, const SbRotation &rot)
 Rotate the camera by the given amount, then reposition it so we're still pointing at the same focal point. More...
 
void saveCursorPosition (const SoEvent *const ev)
 
SbBool seekToPoint (const SbVec2s screenpos)
 
void seekToPoint (const SbVec3f &scenepos)
 
void setSeekMode (SbBool enable)
 
void setViewing (SbBool)
 
void spin (const SbVec2f &pointerpos)
 Uses the sphere sheet projector to map the mouseposition onto a 3D point and find a rotation from this and the last calculated point. More...
 
void spin_simplified (SoCamera *cam, SbVec2f curpos, SbVec2f prevpos)
 NavigationStyle::spin_simplified is a simplified version of NavigationStyle::spin(..), which uses less global variables. Doesn't support starting an animated spinning. More...
 
void syncModifierKeys (const SoEvent *const ev)
 
void syncWithEvent (const SoEvent *const ev)
 
void zoom (SoCamera *camera, float diffvalue)
 Dependent on the camera type this will either shrink or expand the height of the viewport (orthogonal camera) or move the camera closer or further away from the focal point in the scene. More...
 
void zoomByCursor (const SbVec2f &thispos, const SbVec2f &prevpos)
 

Protected Attributes

SbBool altdown
 
SbBool button1down
 
SbBool button2down
 
SbBool button3down
 
SbTime centerTime
 
SbBool ctrldown
 
ViewerMode currentmode
 
SbVec2s globalPos
 
SbBool invertZoom
 
SbVec2f lastmouseposition
 
SbVec2s localPos
 
SbBool lockrecenter
 
struct {
   short   historysize
 
   SbVec2s *   position
 
   short   size
 
   SbTime *   time
 
log
 
SbBool menuenabled
 
SoMouseButtonEvent mouseDownConsumedEvent
 
SbPlane panningplane
 
SbTime prevRedrawTime
 
SbBool shiftdown
 
View3DInventorViewerviewer
 
SbBool zoomAtCursor
 
float zoomStep
 
Mouse model
AbstractMouseSelectionmouseSelection
 
std::vector< SbVec2s > pcPolygon
 
SelectionRole selectedRole
 

Spinning data

SbBool spinanimatingallowed
 
int spinsamplecounter
 
SbRotation spinincrement
 
SbRotation spinRotation
 
SbSphereSheetProjectorspinprojector
 
struct NavigationStyleP
 

Additional Inherited Members

- Static Public Member Functions inherited from Base::BaseClass
static void * create ()
 
static Type getClassTypeId ()
 
static void init ()
 
- Static Protected Member Functions inherited from Base::BaseClass
static void initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr)
 

Detailed Description

The navigation style base class.

Author
Werner Mayer

Member Enumeration Documentation

◆ OrbitStyle

Enumerator
Turntable 
Trackball 

◆ RotationCenterMode

Enumerator
WindowCenter 

The center of the window.

ScenePointAtCursor 

Find the point in the scene at the cursor position.

If there is no point then the focal plane is used

FocalPointAtCursor 

Find the point on the focal plane at the cursor position.

BoundingBoxCenter 

Find the center point of the bounding box of the scene.

◆ SelectionMode

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.

◆ ViewerMode

Enumerator
IDLE 
INTERACT 
ZOOMING 
BOXZOOM 
PANNING 
DRAGGING 
SPINNING 
SEEK_WAIT_MODE 
SEEK_MODE 
SELECTION 

Constructor & Destructor Documentation

◆ NavigationStyle()

NavigationStyle::NavigationStyle ( )

◆ ~NavigationStyle()

NavigationStyle::~NavigationStyle ( )
virtual

References finalize().

Member Function Documentation

◆ abortSelection()

void NavigationStyle::abortSelection ( )

◆ addToLog()

◆ boxZoom()

void NavigationStyle::boxZoom ( const SbBox2s &  box)

◆ clearLog()

void NavigationStyle::clearLog ( )
protected

References log.

Referenced by setViewingMode().

◆ doRotate()

void NavigationStyle::doRotate ( SoCamera *  camera,
float  angle,
const SbVec2f &  pos 
)
protected

◆ doSpin()

◆ doZoom() [1/2]

void NavigationStyle::doZoom ( SoCamera *  camera,
float  logzoomfactor,
const SbVec2f &  pos 
)
protected

NavigationStyle::doZoom Zooms in or out by specified factor, keeping the point on screen specified by parameter pos fixed or not according to user preference (NavigationStyle::zoomAtCursor). Ignores invertZoom user preference.

References panCamera(), viewer, zoom(), and zoomAtCursor.

◆ doZoom() [2/2]

void NavigationStyle::doZoom ( SoCamera *  camera,
int  wheeldelta,
const SbVec2f &  pos 
)
protected

◆ finalize()

void NavigationStyle::finalize ( )
protected

◆ getDelta()

int NavigationStyle::getDelta ( ) const
protected

Returns the steps if the mouse wheel is rotated

Referenced by doZoom(), processKeyboardEvent(), and Gui::MayaGestureNavigationStyle::processSoEvent().

◆ getFocalPoint()

SbVec3f NavigationStyle::getFocalPoint ( ) const

References viewer.

◆ getInteractiveCount()

int NavigationStyle::getInteractiveCount ( ) const
protected

References viewer.

◆ getOrbitStyle()

NavigationStyle::OrbitStyle NavigationStyle::getOrbitStyle ( ) const

◆ getPolygon()

const std::vector< SbVec2s > & NavigationStyle::getPolygon ( SelectionRole role = nullptr) const

◆ getRotationCenter()

SbVec3f NavigationStyle::getRotationCenter ( SbBool *  ok) const
protected

◆ getRotationCenterMode()

NavigationStyle::RotationCenterModes NavigationStyle::getRotationCenterMode ( ) const

◆ getSensitivity()

float NavigationStyle::getSensitivity ( ) const

Referenced by spin(), and spin_simplified().

◆ getViewingMode()

int NavigationStyle::getViewingMode ( ) const

◆ handleEventInForeground()

◆ initialize()

◆ interactiveCountDec()

◆ interactiveCountInc()

void NavigationStyle::interactiveCountInc ( )
protected

References viewer.

Referenced by lookAtPoint(), setCameraOrientation(), and setViewingMode().

◆ isAnimating()

◆ isAnimationEnabled()

SbBool NavigationStyle::isAnimationEnabled ( ) const

Query whether or not it is possible to start a spinning animation by releasing the left mouse button while dragging the mouse.

References spinanimatingallowed.

Referenced by Gui::View3DInventorViewer::isAnimationEnabled(), lookAtPoint(), setCameraOrientation(), and startAnimating().

◆ isPopupMenuEnabled()

◆ isResetCursorPosition()

SbBool NavigationStyle::isResetCursorPosition ( ) const

Referenced by moveCursorPosition().

◆ isSeekMode()

◆ isSelecting()

SbBool NavigationStyle::isSelecting ( ) const

◆ isViewing()

◆ isZoomAtCursor()

SbBool NavigationStyle::isZoomAtCursor ( ) const

References zoomAtCursor.

◆ isZoomInverted()

SbBool NavigationStyle::isZoomInverted ( ) const

References invertZoom.

◆ lookAtPoint() [1/2]

SbBool NavigationStyle::lookAtPoint ( const SbVec2s  screenpos)
protected

◆ lookAtPoint() [2/2]

◆ moveCursorPosition()

◆ normalizePixelPos() [1/2]

SbVec2f NavigationStyle::normalizePixelPos ( SbVec2f  pixpos)
protected

References size, and viewer.

◆ normalizePixelPos() [2/2]

◆ openPopupMenu()

◆ operator=()

◆ pan()

void NavigationStyle::pan ( SoCamera *  camera)
protected

◆ panCamera()

◆ panToCenter()

void NavigationStyle::panToCenter ( const SbPlane &  pplane,
const SbVec2f &  currpos 
)
protected

◆ processClickEvent()

◆ processEvent()

◆ processKeyboardEvent()

◆ processMotionEvent()

◆ processSoEvent()

◆ processWheelEvent()

SbBool NavigationStyle::processWheelEvent ( const SoMouseWheelEvent *const  event)
virtual

References doZoom(), normalizePixelPos(), and viewer.

Referenced by processSoEvent().

◆ redraw()

◆ reorientCamera()

void NavigationStyle::reorientCamera ( SoCamera *  camera,
const SbRotation &  rot 
)
protected

Rotate the camera by the given amount, then reposition it so we're still pointing at the same focal point.

Referenced by spin(), spin_simplified(), and updateAnimation().

◆ saveCursorPosition()

◆ seekToPoint() [1/2]

◆ seekToPoint() [2/2]

void NavigationStyle::seekToPoint ( const SbVec3f &  scenepos)
protected

References viewer.

◆ setAnimationEnabled()

void NavigationStyle::setAnimationEnabled ( const SbBool  enable)

Decide if it should be possible to start a spin animation of the model in the viewer by releasing the mouse button while dragging.

If the enable flag is false and we're currently animating, the spin will be stopped.

References isAnimating(), spinanimatingallowed, and stopAnimating().

Referenced by Gui::View3DInventorViewer::setAnimationEnabled().

◆ setCameraOrientation()

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

◆ setOrbitStyle()

void NavigationStyle::setOrbitStyle ( NavigationStyle::OrbitStyle  style)

◆ setPopupMenuEnabled()

void NavigationStyle::setPopupMenuEnabled ( const SbBool  on)

◆ setResetCursorPosition()

void NavigationStyle::setResetCursorPosition ( SbBool  on)

◆ setRotationCenter()

void NavigationStyle::setRotationCenter ( const SbVec3f &  cnt)

Referenced by saveCursorPosition().

◆ setRotationCenterMode()

void NavigationStyle::setRotationCenterMode ( RotationCenterModes  )

Referenced by initialize().

◆ setSeekMode()

void NavigationStyle::setSeekMode ( SbBool  enable)
protected

◆ setSensitivity()

void NavigationStyle::setSensitivity ( float  val)

◆ setViewer()

void NavigationStyle::setViewer ( View3DInventorViewer view)

◆ setViewing()

◆ setViewingMode()

◆ setZoomAtCursor()

void NavigationStyle::setZoomAtCursor ( SbBool  on)

References zoomAtCursor.

◆ setZoomInverted()

void NavigationStyle::setZoomInverted ( SbBool  on)

References invertZoom.

◆ setZoomStep()

void NavigationStyle::setZoomStep ( float  val)

References zoomStep.

◆ spin()

◆ spin_simplified()

void NavigationStyle::spin_simplified ( SoCamera *  cam,
SbVec2f  curpos,
SbVec2f  prevpos 
)
protected

NavigationStyle::spin_simplified is a simplified version of NavigationStyle::spin(..), which uses less global variables. Doesn't support starting an animated spinning.

Parameters
camthe camera to affect. The rotation amount is determined by delta (curpos-prevpos), and rotation axis is also affected by average pos.
curposcurrent normalized position or mouse pointer
prevposprevious normalized position of mouse pointer

References getSensitivity(), reorientCamera(), spinprojector, and viewer.

Referenced by Gui::MayaGestureNavigationStyle::processSoEvent().

◆ startAnimating()

void NavigationStyle::startAnimating ( const SbVec3f &  axis,
float  velocity 
)

Starts programmatically the viewer in animation mode. The given axis direction is always in screen coordinates, not in world coordinates.

References isAnimationEnabled(), prevRedrawTime, setViewing(), setViewingMode(), spinincrement, SPINNING, and spinRotation.

Referenced by Gui::View3DInventorViewer::startAnimating().

◆ startSelection() [1/2]

void NavigationStyle::startSelection ( AbstractMouseSelection mouse)

◆ startSelection() [2/2]

◆ stopAnimating()

◆ stopSelection()

◆ syncModifierKeys()

◆ syncWithEvent()

void NavigationStyle::syncWithEvent ( const SoEvent *const  ev)
protected

◆ updateAnimation()

void NavigationStyle::updateAnimation ( )

◆ viewAll()

void NavigationStyle::viewAll ( )
virtual

◆ zoom()

void NavigationStyle::zoom ( SoCamera *  camera,
float  diffvalue 
)
protected

Dependent on the camera type this will either shrink or expand the height of the viewport (orthogonal camera) or move the camera closer or further away from the focal point in the scene.

Referenced by doZoom(), Gui::OpenCascadeNavigationStyle::processSoEvent(), Gui::OpenSCADNavigationStyle::processSoEvent(), zoomByCursor(), zoomIn(), and zoomOut().

◆ zoomByCursor()

◆ zoomIn()

void NavigationStyle::zoomIn ( )

References viewer, and zoom().

Referenced by Gui::View3DInventorPy::zoomIn().

◆ zoomOut()

void NavigationStyle::zoomOut ( )

References viewer, and zoom().

Referenced by Gui::View3DInventorPy::zoomOut().

Friends And Related Function Documentation

◆ NavigationStyleP

friend struct NavigationStyleP
friend

Member Data Documentation

◆ altdown

◆ button1down

◆ button2down

◆ button3down

◆ centerTime

◆ ctrldown

◆ currentmode

◆ globalPos

SbVec2s Gui::NavigationStyle::globalPos
protected

◆ historysize

short Gui::NavigationStyle::historysize

◆ invertZoom

◆ lastmouseposition

◆ localPos

SbVec2s Gui::NavigationStyle::localPos
protected

◆ lockrecenter

◆ 

struct { ... } Gui::NavigationStyle::log

◆ menuenabled

SbBool Gui::NavigationStyle::menuenabled
protected

◆ mouseDownConsumedEvent

SoMouseButtonEvent Gui::NavigationStyle::mouseDownConsumedEvent
protected

◆ mouseSelection

AbstractMouseSelection* Gui::NavigationStyle::mouseSelection
protected

◆ panningplane

◆ pcPolygon

std::vector<SbVec2s> Gui::NavigationStyle::pcPolygon
protected

◆ position

◆ prevRedrawTime

SbTime Gui::NavigationStyle::prevRedrawTime
protected

◆ selectedRole

SelectionRole Gui::NavigationStyle::selectedRole
protected

Referenced by getPolygon(), and processEvent().

◆ shiftdown

◆ size

◆ spinanimatingallowed

SbBool Gui::NavigationStyle::spinanimatingallowed
protected

◆ spinincrement

SbRotation Gui::NavigationStyle::spinincrement
protected

Referenced by initialize(), spin(), and startAnimating().

◆ spinprojector

◆ spinRotation

SbRotation Gui::NavigationStyle::spinRotation
protected

◆ spinsamplecounter

int Gui::NavigationStyle::spinsamplecounter
protected

Referenced by initialize(), and spin().

◆ time

SbTime* Gui::NavigationStyle::time

Referenced by addToLog().

◆ viewer

◆ zoomAtCursor

SbBool Gui::NavigationStyle::zoomAtCursor
protected

◆ zoomStep

float Gui::NavigationStyle::zoomStep
protected

Referenced by doZoom(), initialize(), and setZoomStep().


The documentation for this class was generated from the following files: