Class CameraController
- Namespace
- HelixToolkit.Wpf.SharpDX
- Assembly
- HelixToolkit.Wpf.SharpDX.dll
Provides a control that manipulates the camera by mouse and keyboard gestures.
public class CameraController
- Inheritance
-
CameraController
- Inherited Members
Constructors
CameraController(Viewport3DX)
Initializes a new instance of the CameraController class.
public CameraController(Viewport3DX viewport)
Parameters
viewportViewport3DX
Fields
CameraMode
Gets or sets CameraMode.
public CameraMode CameraMode
Field Value
CameraRotationMode
Gets or sets CameraRotationMode.
public CameraRotationMode CameraRotationMode
Field Value
ChangeFieldOfViewCursor
Gets or sets the change field of view cursor.
public Cursor ChangeFieldOfViewCursor
Field Value
- Cursor
The change field of view cursor.
DefaultCamera
Gets or sets the default camera (used when resetting the view).
public ProjectionCamera? DefaultCamera
Field Value
- ProjectionCamera
The default camera.
InertiaFactor
Gets or sets InertiaFactor.
public double InertiaFactor
Field Value
InfiniteSpin
Gets or sets a value indicating whether InfiniteSpin.
public bool InfiniteSpin
Field Value
IsChangeFieldOfViewEnabled
Gets or sets a value indicating whether field of view can be changed.
public bool IsChangeFieldOfViewEnabled
Field Value
IsInertiaEnabled
Gets or sets a value indicating whether inertia is enabled for the camera manipulations.
public bool IsInertiaEnabled
Field Value
- bool
trueif inertia is enabled; otherwise,false.
IsMoveEnabled
Gets or sets a value indicating whether move is enabled.
public bool IsMoveEnabled
Field Value
- bool
trueif move is enabled; otherwise,false.
IsPanEnabled
Gets or sets a value indicating whether pan is enabled.
public bool IsPanEnabled
Field Value
IsRotationEnabled
Gets or sets a value indicating whether IsRotationEnabled.
public bool IsRotationEnabled
Field Value
IsZoomEnabled
Gets or sets a value indicating whether IsZoomEnabled.
public bool IsZoomEnabled
Field Value
LeftRightPanSensitivity
Gets or sets the sensitivity for pan by the left and right keys.
public double LeftRightPanSensitivity
Field 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
Field Value
- double
The rotation sensitivity.
Remarks
Use -1 to invert the rotation direction.
MaximumFieldOfView
Gets or sets the maximum field of view.
public double MaximumFieldOfView
Field Value
- double
The maximum field of view.
MinimumFieldOfView
Gets or sets the minimum field of view.
public double MinimumFieldOfView
Field Value
- double
The minimum field of view.
ModelUpDirection
Gets or sets the model up direction.
public Vector3 ModelUpDirection
Field Value
MoveSensitivity
Gets or sets the move sensitivity.
public double MoveSensitivity
Field Value
- double
The move sensitivity.
PageUpDownZoomSensitivity
Gets or sets the sensitivity for zoom by the page up and page down keys.
public double PageUpDownZoomSensitivity
Field Value
- double
The zoom sensitivity.
Remarks
Use -1 to invert the zoom direction.
PanCursor
Gets or sets the pan cursor.
public Cursor PanCursor
Field Value
- Cursor
The pan cursor.
RotateAroundMouseDownPoint
Gets or sets a value indicating whether to rotate around the mouse down point.
public bool RotateAroundMouseDownPoint
Field Value
- bool
trueif rotation around the mouse down point is enabled; otherwise,false.
RotateCursor
Gets or sets the rotate cursor.
public Cursor RotateCursor
Field Value
- Cursor
The rotate cursor.
RotationSensitivity
Gets or sets the rotation sensitivity (degrees/pixel).
public double RotationSensitivity
Field 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
Field Value
SpinReleaseTime
Gets or sets the max duration of mouse drag to activate spin.
public int SpinReleaseTime
Field Value
Remarks
If the time between mouse down and mouse up is less than this value, spin is activated.
UpDownPanSensitivity
Gets or sets the sensitivity for pan by the up and down keys.
public double UpDownPanSensitivity
Field 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
Field Value
- double
The rotation sensitivity.
Remarks
Use -1 to invert the rotation direction.
ZoomAroundMouseDownPoint
Gets or sets a value indicating whether to zoom around mouse down point.
public bool ZoomAroundMouseDownPoint
Field Value
- bool
trueif zooming around the mouse down point is enabled; otherwise,false.
ZoomCursor
Gets or sets the zoom cursor.
public Cursor ZoomCursor
Field Value
- Cursor
The zoom cursor.
ZoomDistanceLimitFar
Gets or sets the zoom distance limit far.
public double ZoomDistanceLimitFar
Field Value
- double
The zoom distance limit far.
ZoomDistanceLimitNear
Gets or sets the zoom distance limit near.
public double ZoomDistanceLimitNear
Field Value
- double
The zoom distance limit near.
ZoomRectangleCursor
Gets or sets the zoom rectangle cursor.
public Cursor ZoomRectangleCursor
Field Value
- Cursor
The zoom rectangle cursor.
ZoomSensitivity
Gets or sets ZoomSensitivity.
public double ZoomSensitivity
Field Value
Properties
ActualCamera
Gets ActualCamera.
public Camera? ActualCamera { get; set; }
Property Value
AllowRotateXY
Gets or sets to allow rotate x direction and y direction globally. X, Y is screen space.
X = 1: Allow left/right rotation. Y = 1: Allow up/down rotation
Default is (1, 1)
public Vector2 AllowRotateXY { get; set; }
Property Value
- Vector2
The allow rotate xy.
CameraLookDirection
Gets or sets CameraLookDirection.
public Vector3 CameraLookDirection { get; set; }
Property Value
CameraPosition
Gets or sets CameraPosition.
public Vector3 CameraPosition { get; set; }
Property Value
CameraTarget
Gets or sets CameraTarget.
public Vector3 CameraTarget { get; set; }
Property Value
CameraUpDirection
Gets or sets CameraUpDirection.
public Vector3 CameraUpDirection { get; set; }
Property Value
EnablePinchZoom
public bool EnablePinchZoom { get; set; }
Property Value
EnableThreeFingerPan
public bool EnableThreeFingerPan { get; set; }
Property Value
EnableTouchRotate
public bool EnableTouchRotate { get; set; }
Property Value
FixedRotationPoint
Gets or sets the fixed rotation point.
public Vector3 FixedRotationPoint { get; set; }
Property Value
- Vector3
The fixed rotation point.
FixedRotationPointEnabled
Gets or sets a value indicating whether [fixed rotation point enabled].
public bool FixedRotationPointEnabled { get; set; }
Property Value
- bool
trueif [fixed rotation point enabled]; otherwise,false.
IsOrthographicCamera
Gets a value indicating whether IsOrthographicCamera.
protected bool IsOrthographicCamera { get; }
Property Value
IsPerspectiveCamera
Gets a value indicating whether IsPerspectiveCamera.
protected bool IsPerspectiveCamera { get; }
Property Value
OrthographicCamera
Gets OrthographicCamera.
protected OrthographicCamera? OrthographicCamera { get; }
Property Value
PerspectiveCamera
Gets PerspectiveCamera.
protected PerspectiveCamera? PerspectiveCamera { get; }
Property Value
PinchZoomAtCenter
public bool PinchZoomAtCenter { get; set; }
Property Value
Viewport
Gets or sets Viewport.
public Viewport3DX Viewport { get; }
Property Value
Methods
AddMoveForce(Vector3)
Adds the specified move force.
public void AddMoveForce(Vector3 delta)
Parameters
deltaVector3The delta.
AddMoveForce(float, float, float)
Adds the specified move force.
public void AddMoveForce(float dx, float dy, float dz)
Parameters
AddPanForce(Vector3)
The add pan force.
public void AddPanForce(Vector3 pan)
Parameters
panVector3The pan.
AddPanForce(float, float)
Adds the specified pan force.
public void AddPanForce(float dx, float dy)
Parameters
AddRotateForce(float, float)
The add rotate force.
public void AddRotateForce(float dx, float dy)
Parameters
AddZoomForce(float)
Adds the zoom force.
public void AddZoomForce(float delta)
Parameters
deltafloatThe delta.
AddZoomForce(float, Vector3)
Adds the zoom force.
public void AddZoomForce(float delta, Vector3 zoomOrigin)
Parameters
ChangeDirection(Vector3, double)
Changes the direction of the camera.
public void ChangeDirection(Vector3 lookDir, double animationTime = 500)
Parameters
ChangeDirection(Vector3, Vector3, double)
Changes the direction of the camera.
public void ChangeDirection(Vector3 lookDir, Vector3 upDir, double animationTime = 500)
Parameters
lookDirVector3The look direction.
upDirVector3The up direction.
animationTimedoubleThe animation time.
ChangeDirection(Vector3D, Vector3D, double)
Changes the direction.
public void ChangeDirection(Vector3D lookDir, Vector3D upDir, double animationTime = 500)
Parameters
LookAt(Vector3, double)
Change the "look-at" point.
[Obsolete]
public void LookAt(Vector3 target, double animationTime)
Parameters
OnCompositionTargetRendering(long)
Called when [composition target rendering].
public void OnCompositionTargetRendering(long ticks)
Parameters
tickslongThe ticks.
OnKeyDown(KeyEventArgs)
Called when a key is pressed.
public void OnKeyDown(KeyEventArgs e)
Parameters
eKeyEventArgsThe KeyEventArgs instance containing the event data.
OnManipulationCompleted(ManipulationCompletedEventArgs)
Called when the ManipulationCompleted event occurs.
public void OnManipulationCompleted(ManipulationCompletedEventArgs e)
Parameters
eManipulationCompletedEventArgsThe data for the event.
OnManipulationDelta(ManipulationDeltaEventArgs)
Called when the ManipulationDelta event occurs.
public void OnManipulationDelta(ManipulationDeltaEventArgs e)
Parameters
eManipulationDeltaEventArgsThe data for the event.
OnManipulationStarted(ManipulationStartedEventArgs)
Called when the ManipulationStarted event occurs.
public 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.
public 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.
OnMouseWheel(object?, MouseWheelEventArgs)
Called when the mouse wheel is moved.
public void OnMouseWheel(object? sender, MouseWheelEventArgs e)
Parameters
senderobjectThe sender.
eMouseWheelEventArgsThe MouseWheelEventArgs instance containing the event data.
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.
public void OnStylusSystemGesture(StylusSystemGestureEventArgs e)
Parameters
eStylusSystemGestureEventArgsThe StylusSystemGestureEventArgs that contains the event data.
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.
StartSpin(Vector2, Point, Vector3)
Starts the spin.
public void StartSpin(Vector2 speed, Point position, Vector3 aroundPoint)
Parameters
StopAnimations()
The stop animations.
public void StopAnimations()
StopPanning()
Stops the panning.
public void StopPanning()
StopSpin()
Stops the spin.
public void StopSpin()
StopZooming()
Stops the zooming inertia.
public void StopZooming()
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).