Class CameraController
- Namespace
- HelixToolkit.Wpf
- Assembly
- HelixToolkit.Wpf.dll
Provides a control that manipulates the camera by mouse and keyboard gestures.
public class CameraController : Grid, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IAddChild
- Inheritance
-
CameraController
- Implements
- Inherited Members
- Extension Methods
Constructors
CameraController()
Initializes a new instance of the CameraController class.
public CameraController()
Fields
CameraModeProperty
Identifies the CameraMode dependency property.
public static readonly DependencyProperty CameraModeProperty
Field Value
CameraProperty
Identifies the Camera dependency property.
public static readonly DependencyProperty CameraProperty
Field Value
CameraRotationModeProperty
Identifies the CameraRotationMode dependency property.
public static readonly DependencyProperty CameraRotationModeProperty
Field Value
ChangeFieldOfViewCursorProperty
Identifies the ChangeFieldOfViewCursor dependency property.
public static readonly DependencyProperty ChangeFieldOfViewCursorProperty
Field Value
DefaultCameraProperty
Identifies the DefaultCamera dependency property.
public static readonly DependencyProperty DefaultCameraProperty
Field Value
EnabledProperty
Identifies the Enabled dependency property.
public static readonly DependencyProperty EnabledProperty
Field Value
FixedRotationPointEnabledProperty
Identifies the FixedRotationPointEnabled dependency property.
public static readonly DependencyProperty FixedRotationPointEnabledProperty
Field Value
FixedRotationPointProperty
Identifies the FixedRotationPoint dependency property.
public static readonly DependencyProperty FixedRotationPointProperty
Field Value
InertiaFactorProperty
Identifies the InertiaFactor dependency property.
public static readonly DependencyProperty InertiaFactorProperty
Field Value
InfiniteSpinProperty
Identifies the InfiniteSpin dependency property.
public static readonly DependencyProperty InfiniteSpinProperty
Field Value
IsChangeFieldOfViewEnabledProperty
Identifies the IsChangeFieldOfViewEnabled dependency property.
public static readonly DependencyProperty IsChangeFieldOfViewEnabledProperty
Field Value
IsInertiaEnabledProperty
Identifies the IsInertiaEnabled dependency property.
public static readonly DependencyProperty IsInertiaEnabledProperty
Field Value
IsMoveEnabledProperty
Identifies the IsMoveEnabled dependency property.
public static readonly DependencyProperty IsMoveEnabledProperty
Field Value
IsPanEnabledProperty
Identifies the IsPanEnabled dependency property.
public static readonly DependencyProperty IsPanEnabledProperty
Field Value
IsRotationEnabledProperty
Identifies the IsRotationEnabled dependency property.
public static readonly DependencyProperty IsRotationEnabledProperty
Field Value
IsTouchZoomEnabledProperty
Identifies the IsTouchZoomEnabled dependency property.
public static readonly DependencyProperty IsTouchZoomEnabledProperty
Field Value
IsZoomEnabledProperty
Identifies the IsZoomEnabled dependency property.
public static readonly DependencyProperty IsZoomEnabledProperty
Field Value
LeftRightPanSensitivityProperty
Identifies the LeftRightPanSensitivity dependency property.
public static readonly DependencyProperty LeftRightPanSensitivityProperty
Field Value
LeftRightRotationSensitivityProperty
Identifies the LeftRightRotationSensitivity dependency property.
public static readonly DependencyProperty LeftRightRotationSensitivityProperty
Field Value
LookAtChangedEvent
The look at (target) point changed event
public static readonly RoutedEvent LookAtChangedEvent
Field Value
MaximumFieldOfViewProperty
Identifies the MaximumFieldOfView dependency property.
public static readonly DependencyProperty MaximumFieldOfViewProperty
Field Value
MinimumFieldOfViewProperty
Identifies the MinimumFieldOfView dependency property.
public static readonly DependencyProperty MinimumFieldOfViewProperty
Field Value
ModelUpDirectionProperty
Identifies the ModelUpDirection dependency property.
public static readonly DependencyProperty ModelUpDirectionProperty
Field Value
MoveSensitivityProperty
Identifies the MoveSensitivity dependency property.
public static readonly DependencyProperty MoveSensitivityProperty
Field Value
PageUpDownZoomSensitivityProperty
Identifies the PageUpDownZoomSensitivity dependency property.
public static readonly DependencyProperty PageUpDownZoomSensitivityProperty
Field Value
PanCursorProperty
Identifies the PanCursor dependency property.
public static readonly DependencyProperty PanCursorProperty
Field Value
RotateAroundMouseDownPointProperty
Identifies the RotateAroundMouseDownPoint dependency property.
public static readonly DependencyProperty RotateAroundMouseDownPointProperty
Field Value
RotateCursorProperty
Identifies the RotateCursor dependency property.
public static readonly DependencyProperty RotateCursorProperty
Field Value
RotationSensitivityProperty
Identifies the RotationSensitivity dependency property.
public static readonly DependencyProperty RotationSensitivityProperty
Field Value
ShowCameraTargetProperty
Identifies the ShowCameraTarget dependency property.
public static readonly DependencyProperty ShowCameraTargetProperty
Field Value
SnapMouseDownPointProperty
Identifies the SnapMouseDownPoint dependency property.
public static readonly DependencyProperty SnapMouseDownPointProperty
Field Value
SpinReleaseTimeProperty
Identifies the SpinReleaseTime dependency property.
public static readonly DependencyProperty SpinReleaseTimeProperty
Field Value
UpDownPanSensitivityProperty
Identifies the UpDownPanSensitivity dependency property.
public static readonly DependencyProperty UpDownPanSensitivityProperty
Field Value
UpDownRotationSensitivityProperty
Identifies the UpDownRotationSensitivity dependency property.
public static readonly DependencyProperty UpDownRotationSensitivityProperty
Field Value
ViewportProperty
Identifies the Viewport dependency property.
public static readonly DependencyProperty ViewportProperty
Field Value
ZoomAroundMouseDownPointProperty
Identifies the ZoomAroundMouseDownPoint dependency property.
public static readonly DependencyProperty ZoomAroundMouseDownPointProperty
Field Value
ZoomCursorProperty
Identifies the ZoomCursor dependency property.
public static readonly DependencyProperty ZoomCursorProperty
Field Value
ZoomRectangleCursorProperty
Identifies the ZoomRectangleCursor dependency property.
public static readonly DependencyProperty ZoomRectangleCursorProperty
Field Value
ZoomSensitivityProperty
Identifies the ZoomSensitivity dependency property.
public static readonly DependencyProperty ZoomSensitivityProperty
Field Value
ZoomedByRectangleEvent
The zoomed by rectangle event
public static readonly RoutedEvent ZoomedByRectangleEvent
Field Value
Properties
ActualCamera
Gets ActualCamera.
public ProjectionCamera? ActualCamera { get; }
Property Value
BackViewCommand
Gets the back view command.
public static RoutedCommand BackViewCommand { get; }
Property Value
BottomViewCommand
Gets the bottom view command.
public static RoutedCommand BottomViewCommand { get; }
Property Value
Camera
Gets or sets Camera.
public ProjectionCamera Camera { get; set; }
Property Value
CameraLookDirection
Gets or sets CameraLookDirection.
public Vector3D CameraLookDirection { get; set; }
Property Value
CameraMode
Gets or sets CameraMode.
public CameraMode CameraMode { get; set; }
Property Value
CameraPosition
Gets or sets CameraPosition.
public Point3D CameraPosition { get; set; }
Property Value
CameraRotationMode
Gets or sets CameraRotationMode.
public CameraRotationMode CameraRotationMode { get; set; }
Property Value
CameraTarget
Gets or sets CameraTarget.
public Point3D CameraTarget { get; set; }
Property Value
CameraUpDirection
Gets or sets CameraUpDirection.
public Vector3D CameraUpDirection { get; set; }
Property Value
ChangeFieldOfViewCommand
Gets the change field of view command.
public static RoutedCommand ChangeFieldOfViewCommand { get; }
Property Value
ChangeFieldOfViewCursor
Gets or sets the change field of view cursor.
public Cursor ChangeFieldOfViewCursor { get; set; }
Property Value
- Cursor
The change field of view cursor.
ChangeLookAtCommand
Gets the change look at command.
public static RoutedCommand ChangeLookAtCommand { get; }
Property Value
DefaultCamera
Gets or sets the default camera (used when resetting the view).
public ProjectionCamera DefaultCamera { get; set; }
Property Value
- ProjectionCamera
The default camera.
Enabled
Gets or sets a value indicating whether Enabled.
public bool Enabled { get; set; }
Property Value
FixedRotationPoint
Gets or sets a value indicating the center of rotation.
public Point3D FixedRotationPoint { get; set; }
Property Value
- Point3D
trueif rotation around a fixed point is enabled; otherwise,false.
FixedRotationPointEnabled
Gets or sets a value indicating whether to rotate around a fixed point.
public bool FixedRotationPointEnabled { get; set; }
Property Value
- bool
trueif rotation around a fixed point is enabled; otherwise,false.
FrontViewCommand
Gets the front view command.
public static RoutedCommand FrontViewCommand { get; }
Property Value
InertiaFactor
Gets or sets InertiaFactor.
public double InertiaFactor { get; set; }
Property Value
InfiniteSpin
Gets or sets a value indicating whether InfiniteSpin.
public bool InfiniteSpin { get; set; }
Property Value
IsActive
Gets a value indicating whether IsActive.
public bool IsActive { get; }
Property Value
IsChangeFieldOfViewEnabled
Gets or sets a value indicating whether field of view can be changed.
public bool IsChangeFieldOfViewEnabled { get; set; }
Property Value
IsInertiaEnabled
Gets or sets a value indicating whether inertia is enabled for the camera manipulations.
public bool IsInertiaEnabled { get; set; }
Property Value
- bool
trueif inertia is enabled; otherwise,false.
IsMoveEnabled
Gets or sets a value indicating whether move is enabled.
public bool IsMoveEnabled { get; set; }
Property Value
- bool
trueif move is enabled; otherwise,false.
IsOrthographicCamera
Gets a value indicating whether IsOrthographicCamera.
protected bool IsOrthographicCamera { get; }
Property Value
IsPanEnabled
Gets or sets a value indicating whether pan is enabled.
public bool IsPanEnabled { get; set; }
Property Value
IsPerspectiveCamera
Gets a value indicating whether IsPerspectiveCamera.
protected bool IsPerspectiveCamera { get; }
Property Value
IsRotationEnabled
Gets or sets a value indicating whether IsRotationEnabled.
public bool IsRotationEnabled { get; set; }
Property Value
IsTouchZoomEnabled
Gets or sets a value indicating whether touch zoom (pinch gesture) is enabled.
public bool IsTouchZoomEnabled { get; set; }
Property Value
- bool
trueif touch zoom is enabled; otherwise,false.
IsZoomEnabled
Gets or sets a value indicating whether IsZoomEnabled.
public bool IsZoomEnabled { get; set; }
Property Value
LeftRightPanSensitivity
Gets or sets the sensitivity for pan by the left and right keys.
public double LeftRightPanSensitivity { get; set; }
Property Value
- double
The pan sensitivity.
Remarks
Use -1 to invert the pan direction.
LeftRightRotationSensitivity
Gets or sets the sensitivity for rotation by the left and right keys.
public double LeftRightRotationSensitivity { get; set; }
Property Value
- double
The rotation sensitivity.
Remarks
Use -1 to invert the rotation direction.
LeftViewCommand
Gets the left view command.
public static RoutedCommand LeftViewCommand { get; }
Property Value
LimitFPS
Gets or sets a value indicating whether [limit FPS].
public bool LimitFPS { get; set; }
Property Value
- bool
trueif [limit FPS]; otherwise,false.
MaximumFieldOfView
Gets or sets the maximum field of view.
public double MaximumFieldOfView { get; set; }
Property Value
- double
The maximum field of view.
MinimumFieldOfView
Gets or sets the minimum field of view.
public double MinimumFieldOfView { get; set; }
Property Value
- double
The minimum field of view.
ModelUpDirection
Gets or sets the model up direction.
public Vector3D ModelUpDirection { get; set; }
Property Value
MoveSensitivity
Gets or sets the move sensitivity.
public double MoveSensitivity { get; set; }
Property Value
- double
The move sensitivity.
OrthographicCamera
Gets OrthographicCamera.
protected OrthographicCamera? OrthographicCamera { get; }
Property Value
PageUpDownZoomSensitivity
Gets or sets the sensitivity for zoom by the page up and page down keys.
public double PageUpDownZoomSensitivity { get; set; }
Property Value
- double
The zoom sensitivity.
Remarks
Use -1 to invert the zoom direction.
PanCommand
Gets the pan command.
public static RoutedCommand PanCommand { get; }
Property Value
PanCursor
Gets or sets the pan cursor.
public Cursor PanCursor { get; set; }
Property Value
- Cursor
The pan cursor.
PerspectiveCamera
Gets PerspectiveCamera.
protected PerspectiveCamera? PerspectiveCamera { get; }
Property Value
ResetCameraCommand
Gets the reset camera command.
public static RoutedCommand ResetCameraCommand { get; }
Property Value
RightViewCommand
Gets the right view command.
public static RoutedCommand RightViewCommand { get; }
Property Value
RotataAroundClosestVertexComplexity
Efficiency option, lower values decrease computation time for camera interaction when RotateAroundMouseDownPoint or ZoomAroundMouseDownPoint is set to true in inspect mode. Note: Will mostly save on computation time once the bounds are already calculated and cashed within the MeshGeometry3D.
public int RotataAroundClosestVertexComplexity { get; set; }
Property Value
RotateAroundMouseDownPoint
Gets or sets a value indicating whether to rotate around the mouse down point.
public bool RotateAroundMouseDownPoint { get; set; }
Property Value
- bool
trueif rotation around the mouse down point is enabled; otherwise,false.
RotateCommand
Gets the rotate command.
public static RoutedCommand RotateCommand { get; }
Property Value
RotateCursor
Gets or sets the rotate cursor.
public Cursor RotateCursor { get; set; }
Property Value
- Cursor
The rotate cursor.
RotationSensitivity
Gets or sets the rotation sensitivity (degrees/pixel).
public double RotationSensitivity { get; set; }
Property Value
- double
The rotation sensitivity.
ShowCameraTarget
Gets or sets a value indicating whether to show a target adorner when manipulating the camera.
public bool ShowCameraTarget { get; set; }
Property Value
SnapMouseDownPoint
Gets or sets a value indicating whether to snap the mouse down point to a model.
public bool SnapMouseDownPoint { get; set; }
Property Value
- bool
trueif snapping the mouse down point is enabled; otherwise,false.
SpinReleaseTime
Gets or sets the max duration of mouse drag to activate spin.
public int SpinReleaseTime { get; set; }
Property Value
Remarks
If the time between mouse down and mouse up is less than this value, spin is activated.
TopViewCommand
Gets the top view command.
public static RoutedCommand TopViewCommand { get; }
Property Value
UpDownPanSensitivity
Gets or sets the sensitivity for pan by the up and down keys.
public double UpDownPanSensitivity { get; set; }
Property Value
- double
The pan sensitivity.
Remarks
Use -1 to invert the pan direction.
UpDownRotationSensitivity
Gets or sets the sensitivity for rotation by the up and down keys.
public double UpDownRotationSensitivity { get; set; }
Property Value
- double
The rotation sensitivity.
Remarks
Use -1 to invert the rotation direction.
Viewport
Gets or sets Viewport.
public Viewport3D Viewport { get; set; }
Property Value
ZoomAroundMouseDownPoint
Gets or sets a value indicating whether to zoom around mouse down point.
public bool ZoomAroundMouseDownPoint { get; set; }
Property Value
- bool
trueif zooming around the mouse down point is enabled; otherwise,false.
ZoomCommand
Gets the zoom command.
public static RoutedCommand ZoomCommand { get; }
Property Value
ZoomCursor
Gets or sets the zoom cursor.
public Cursor ZoomCursor { get; set; }
Property Value
- Cursor
The zoom cursor.
ZoomExtentsCommand
Gets the zoom extents command.
public static RoutedCommand ZoomExtentsCommand { get; }
Property Value
ZoomRectangleCommand
Gets the zoom rectangle command.
public static RoutedCommand ZoomRectangleCommand { get; }
Property Value
ZoomRectangleCursor
Gets or sets the zoom rectangle cursor.
public Cursor ZoomRectangleCursor { get; set; }
Property Value
- Cursor
The zoom rectangle cursor.
ZoomSensitivity
Gets or sets ZoomSensitivity.
public double ZoomSensitivity { get; set; }
Property Value
Methods
AddMoveForce(double, double, double)
Adds the specified move force.
public void AddMoveForce(double dx, double dy, double dz)
Parameters
AddMoveForce(Vector3D)
Adds the specified move force.
public void AddMoveForce(Vector3D delta)
Parameters
deltaVector3DThe delta.
AddPanForce(double, double)
Adds the specified pan force.
public void AddPanForce(double dx, double dy)
Parameters
AddPanForce(Vector3D)
The add pan force.
public void AddPanForce(Vector3D pan)
Parameters
panVector3DThe pan.
AddRotateForce(double, double)
The add rotate force.
public void AddRotateForce(double dx, double dy)
Parameters
AddZoomForce(double)
Adds the zoom force.
public void AddZoomForce(double delta)
Parameters
deltadoubleThe delta.
AddZoomForce(double, Point3D)
Adds the zoom force.
public void AddZoomForce(double delta, Point3D zoomOrigin)
Parameters
ChangeDirection(Vector3D, double)
Changes the direction of the camera.
public void ChangeDirection(Vector3D lookDir, double animationTime = 500)
Parameters
ChangeDirection(Vector3D, Vector3D, double)
Changes the direction of the camera.
public void ChangeDirection(Vector3D lookDir, Vector3D upDir, double animationTime = 500)
Parameters
lookDirVector3DThe look direction.
upDirVector3DThe up direction.
animationTimedoubleThe animation time.
HideRectangle()
Hides the rectangle.
public void HideRectangle()
HideTargetAdorner()
Hides the target adorner.
public void HideTargetAdorner()
LookAt(Point3D, double)
Change the "look-at" point.
[Obsolete]
public void LookAt(Point3D target, double animationTime)
Parameters
OnLookAtChanged()
Raises the LookAtChanged event.
protected virtual void OnLookAtChanged()
OnManipulationCompleted(ManipulationCompletedEventArgs)
Called when the ManipulationCompleted event occurs.
protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
Parameters
eManipulationCompletedEventArgsThe data for the event.
OnManipulationDelta(ManipulationDeltaEventArgs)
Called when the ManipulationDelta event occurs.
protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
Parameters
eManipulationDeltaEventArgsThe data for the event.
OnManipulationStarted(ManipulationStartedEventArgs)
Called when the ManipulationStarted event occurs.
protected override void OnManipulationStarted(ManipulationStartedEventArgs e)
Parameters
eManipulationStartedEventArgsThe data for the event.
OnMouseDown(MouseButtonEventArgs)
Invoked when an unhandled MouseDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnMouseDown(MouseButtonEventArgs e)
Parameters
eMouseButtonEventArgsThe MouseButtonEventArgs that contains the event data. This event data reports details about the mouse button that was pressed and the handled state.
OnStylusSystemGesture(StylusSystemGestureEventArgs)
Invoked when an unhandled StylusSystemGesture attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnStylusSystemGesture(StylusSystemGestureEventArgs e)
Parameters
eStylusSystemGestureEventArgsThe StylusSystemGestureEventArgs that contains the event data.
OnZoomedByRectangle()
Raises the ZoomedByRectangle event.
protected virtual void OnZoomedByRectangle()
PushCameraSetting()
Push the current camera settings on an internal stack.
public void PushCameraSetting()
ResetCamera()
Resets the camera.
public void ResetCamera()
ResetCameraUpDirection()
Resets the camera up direction.
public void ResetCameraUpDirection()
RestoreCameraSetting()
Restores the most recent camera setting from the internal stack.
public bool RestoreCameraSetting()
Returns
- bool
The restore camera setting.
RestoreCursor()
Restores the cursor from the cursor stack.
public void RestoreCursor()
SetCursor(Cursor)
Sets the cursor and pushes the current cursor to the cursor stack.
public void SetCursor(Cursor cursor)
Parameters
cursorCursorThe cursor.
Remarks
Use RestoreCursor() to restore the cursor again.
ShowRectangle(Rect, Color, Color)
Shows the rectangle.
public void ShowRectangle(Rect rect, Color color1, Color color2)
Parameters
ShowTargetAdorner(Point)
Shows the target adorner.
public void ShowTargetAdorner(Point position)
Parameters
positionPointThe position.
StartSpin(Vector, Point, Point3D)
Starts the spin.
public void StartSpin(Vector speed, Point position, Point3D aroundPoint)
Parameters
StopSpin()
Stops the spin.
public void StopSpin()
UpdateRectangle(Rect)
Updates the rectangle.
public void UpdateRectangle(Rect rect)
Parameters
rectRectThe rectangle.
Zoom(double)
Zooms by the specified delta value.
public void Zoom(double delta)
Parameters
deltadoubleThe delta value.
ZoomExtents(double)
Zooms to the extents of the model.
public void ZoomExtents(double animationTime = 200)
Parameters
animationTimedoubleThe animation time (milliseconds).
Events
LookAtChanged
Occurs when the look at/target point changed.
public event RoutedEventHandler LookAtChanged
Event Type
ZoomedByRectangle
Occurs when the view is zoomed by rectangle.
public event RoutedEventHandler ZoomedByRectangle