Table of Contents

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

viewport Viewport3DX

Fields

CameraMode

Gets or sets CameraMode.

public CameraMode CameraMode

Field Value

CameraMode

CameraRotationMode

Gets or sets CameraRotationMode.

public CameraRotationMode CameraRotationMode

Field Value

CameraRotationMode

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

double

InfiniteSpin

Gets or sets a value indicating whether InfiniteSpin.

public bool InfiniteSpin

Field Value

bool

IsChangeFieldOfViewEnabled

Gets or sets a value indicating whether field of view can be changed.

public bool IsChangeFieldOfViewEnabled

Field Value

bool

IsInertiaEnabled

Gets or sets a value indicating whether inertia is enabled for the camera manipulations.

public bool IsInertiaEnabled

Field Value

bool

true if inertia is enabled; otherwise, false.

IsMoveEnabled

Gets or sets a value indicating whether move is enabled.

public bool IsMoveEnabled

Field Value

bool

true if move is enabled; otherwise, false .

IsPanEnabled

Gets or sets a value indicating whether pan is enabled.

public bool IsPanEnabled

Field Value

bool

IsRotationEnabled

Gets or sets a value indicating whether IsRotationEnabled.

public bool IsRotationEnabled

Field Value

bool

IsZoomEnabled

Gets or sets a value indicating whether IsZoomEnabled.

public bool IsZoomEnabled

Field Value

bool

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

Vector3

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

true if 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

bool

SpinReleaseTime

Gets or sets the max duration of mouse drag to activate spin.

public int SpinReleaseTime

Field Value

int

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

true if 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

double

Properties

ActualCamera

Gets ActualCamera.

public Camera? ActualCamera { get; set; }

Property Value

Camera

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

Vector3

CameraPosition

Gets or sets CameraPosition.

public Vector3 CameraPosition { get; set; }

Property Value

Vector3

CameraTarget

Gets or sets CameraTarget.

public Vector3 CameraTarget { get; set; }

Property Value

Vector3

CameraUpDirection

Gets or sets CameraUpDirection.

public Vector3 CameraUpDirection { get; set; }

Property Value

Vector3

EnablePinchZoom

public bool EnablePinchZoom { get; set; }

Property Value

bool

EnableThreeFingerPan

public bool EnableThreeFingerPan { get; set; }

Property Value

bool

EnableTouchRotate

public bool EnableTouchRotate { get; set; }

Property Value

bool

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

true if [fixed rotation point enabled]; otherwise, false.

IsOrthographicCamera

Gets a value indicating whether IsOrthographicCamera.

protected bool IsOrthographicCamera { get; }

Property Value

bool

IsPerspectiveCamera

Gets a value indicating whether IsPerspectiveCamera.

protected bool IsPerspectiveCamera { get; }

Property Value

bool

OrthographicCamera

Gets OrthographicCamera.

protected OrthographicCamera? OrthographicCamera { get; }

Property Value

OrthographicCamera

PerspectiveCamera

Gets PerspectiveCamera.

protected PerspectiveCamera? PerspectiveCamera { get; }

Property Value

PerspectiveCamera

PinchZoomAtCenter

public bool PinchZoomAtCenter { get; set; }

Property Value

bool

Viewport

Gets or sets Viewport.

public Viewport3DX Viewport { get; }

Property Value

Viewport3DX

Methods

AddMoveForce(Vector3)

Adds the specified move force.

public void AddMoveForce(Vector3 delta)

Parameters

delta Vector3

The delta.

AddMoveForce(float, float, float)

Adds the specified move force.

public void AddMoveForce(float dx, float dy, float dz)

Parameters

dx float

The delta x.

dy float

The delta y.

dz float

The delta z.

AddPanForce(Vector3)

The add pan force.

public void AddPanForce(Vector3 pan)

Parameters

pan Vector3

The pan.

AddPanForce(float, float)

Adds the specified pan force.

public void AddPanForce(float dx, float dy)

Parameters

dx float

The delta x.

dy float

The delta y.

AddRotateForce(float, float)

The add rotate force.

public void AddRotateForce(float dx, float dy)

Parameters

dx float

The delta x.

dy float

The delta y.

AddZoomForce(float)

Adds the zoom force.

public void AddZoomForce(float delta)

Parameters

delta float

The delta.

AddZoomForce(float, Vector3)

Adds the zoom force.

public void AddZoomForce(float delta, Vector3 zoomOrigin)

Parameters

delta float

The delta.

zoomOrigin Vector3

The zoom origin.

ChangeDirection(Vector3, double)

Changes the direction of the camera.

public void ChangeDirection(Vector3 lookDir, double animationTime = 500)

Parameters

lookDir Vector3

The look direction.

animationTime double

The animation time.

ChangeDirection(Vector3, Vector3, double)

Changes the direction of the camera.

public void ChangeDirection(Vector3 lookDir, Vector3 upDir, double animationTime = 500)

Parameters

lookDir Vector3

The look direction.

upDir Vector3

The up direction.

animationTime double

The animation time.

ChangeDirection(Vector3D, Vector3D, double)

Changes the direction.

public void ChangeDirection(Vector3D lookDir, Vector3D upDir, double animationTime = 500)

Parameters

lookDir Vector3D

The look dir.

upDir Vector3D

Up dir.

animationTime double

The animation time.

LookAt(Vector3, double)

Change the "look-at" point.

[Obsolete]
public void LookAt(Vector3 target, double animationTime)

Parameters

target Vector3

The target.

animationTime double

The animation time.

OnCompositionTargetRendering(long)

Called when [composition target rendering].

public void OnCompositionTargetRendering(long ticks)

Parameters

ticks long

The ticks.

OnKeyDown(KeyEventArgs)

Called when a key is pressed.

public void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

The KeyEventArgs instance containing the event data.

OnManipulationCompleted(ManipulationCompletedEventArgs)

Called when the ManipulationCompleted event occurs.

public void OnManipulationCompleted(ManipulationCompletedEventArgs e)

Parameters

e ManipulationCompletedEventArgs

The data for the event.

OnManipulationDelta(ManipulationDeltaEventArgs)

Called when the ManipulationDelta event occurs.

public void OnManipulationDelta(ManipulationDeltaEventArgs e)

Parameters

e ManipulationDeltaEventArgs

The data for the event.

OnManipulationStarted(ManipulationStartedEventArgs)

Called when the ManipulationStarted event occurs.

public void OnManipulationStarted(ManipulationStartedEventArgs e)

Parameters

e ManipulationStartedEventArgs

The 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

e MouseButtonEventArgs

The 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

sender object

The sender.

e MouseWheelEventArgs

The 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

e StylusSystemGestureEventArgs

The 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

speed Vector2

The speed.

position Point

The position.

aroundPoint Vector3

The spin around point.

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

delta double

The delta value.

ZoomExtents(double)

Zooms to the extents of the model.

public void ZoomExtents(double animationTime = 200)

Parameters

animationTime double

The animation time (milliseconds).