Table of Contents

Class AnimatedView

Namespace
CADability
Assembly
CADability.dll

A view in which mechanical dependencies of objects can be defined and animated.

public class AnimatedView : IShowPropertyImpl, IShowProperty, IPropertyEntry, IView, ICommandHandler, ISerializable
Inheritance
AnimatedView
Implements
Inherited Members

Constructors

AnimatedView()

Common initialization for the public constructor and the deserialization constructor: creates the empty lists of selected and highlighted objects, reads the selection color and widths from the frame and sets an isometric projection. Project and model are not set here.

protected AnimatedView()

AnimatedView(Project, Model, IFrame)

Creates a new AnimatedView object. In oder to display this view on the screen you need to add this view to a IFrame and set it as the ActiveView.

public AnimatedView(Project project, Model model, IFrame frame)

Parameters

project Project

The project that contains the lists of all schedules (if needed)

model Model

The model that is displayed and contains the list of all drives

frame IFrame

The frame which is the context of this view

AnimatedView(SerializationInfo, StreamingContext)

Constructor for the legacy binary deserialization (ISerializable): restores project, model, projection, visible layers and name.

protected AnimatedView(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

The serialized data

context StreamingContext

The source of the deserialization

Properties

BackgroundColor

Backgroundcolor to override the default background color as defined in the global settings

public Color BackgroundColor { get; set; }

Property Value

Color

ContextMenu

Implementation of ContextMenu: the default returns null. An entry whose LabelType contains ContextMenu must override it.

public override MenuWithHandler[] ContextMenu { get; }

Property Value

MenuWithHandler[]

DraggingObjects

The objects that were under the cursor at the last mouse down (null before the first click, empty when SelectionEnabled is false). They are intended as the data of a drag and drop operation that starts when the mouse is moved with the left button pressed.

public GeoObjectList DraggingObjects { get; }

Property Value

GeoObjectList

DriveList

List of all drives defined in this context.

public DriveList DriveList { get; }

Property Value

DriveList

EntryType

Overrides EntryType, returns GroupTitle.

public override ShowPropertyEntryType EntryType { get; }

Property Value

ShowPropertyEntryType

FixPoint

Sets or gets the fixpoint for interactive view direction changes

public GeoPoint FixPoint { get; set; }

Property Value

GeoPoint

HighlightColor

Color of the highlighted objects

public Color HighlightColor { get; set; }

Property Value

Color

HighlightWidth

The width in pixels by which the highlighted objects are drawn thicker than normal (their display list is painted several times with small offsets); 0 (the default) draws them with their normal width. See HighlightColor.

public int HighlightWidth { get; set; }

Property Value

int

IsPaused

True while the anumation is paused

public bool IsPaused { get; }

Property Value

bool

IsRunning

True while the animation/simulation is running.

public bool IsRunning { get; }

Property Value

bool

LabelText

Implementation of LabelText, returns either labelTextInternal (if not null) or GetString(string)(resourceId+".Label") Whe set, labelTextInternal is set.

public override string LabelText { get; set; }

Property Value

string

LabelType

How the label of this entry behaves (see ShowPropertyLabelFlags): whether it can be selected or edited, is bold or has a context menu. The default implementation returns Selectable.

public override ShowPropertyLabelFlags LabelType { get; }

Property Value

ShowPropertyLabelFlags

Name

Name of this AnimatedView as shown in the controlcenter

public string Name { get; set; }

Property Value

string

SelectionEnabled

If true, the user can select objects in this view with the mouse: a left click selects the object under the cursor (with Ctrl it is added to the selection), and the cursor turns into a hand over selectable objects. The selected objects are drawn in the selection color while the animation is not running and are available via GetSelectedObjects(). The default is false.

public bool SelectionEnabled { get; set; }

Property Value

bool

Speed

Set or get the current speed factor (1.0 is normal)

public double Speed { get; set; }

Property Value

double

SubEntries

The sub entries shown below this entry when it is opened in the property page. The default implementation has none and returns an empty array.

public override IShowProperty[] SubEntries { get; }

Property Value

IShowProperty[]

SubEntriesCount

The number of SubEntries, 0 for an entry that cannot be opened. The default implementation returns 0.

public override int SubEntriesCount { get; }

Property Value

int

VisibleLayers

List of visible layers. Modify visible layers using Set(Layer, bool)

public CheckedLayerList VisibleLayers { get; }

Property Value

CheckedLayerList

Methods

AddHighlightedObject(IGeoObject)

Adds the provided object to the highlighted objects of this view. This is typically called during simulation/animation to draw the user attention to this object

public void AddHighlightedObject(IGeoObject toHighlight)

Parameters

toHighlight IGeoObject

highlighted object to add

Added(IPropertyPage)

Implementation of Added(IPropertyPage): memorizes the property page in propertyPage. Unlike Added(IPropertyTreeView) it does not raise the state changed event. Override it to subscribe to events while the entry is displayed, and call the base implementation.

public override void Added(IPropertyPage propertyTreeView)

Parameters

propertyTreeView IPropertyPage

ClearHighlightedObjects()

Removes all objects that were added with AddHighlightedObject(IGeoObject). The view is not repainted by itself.

public void ClearHighlightedObjects()

Collision(Solid, Solid, double, out GeoPoint)

Tests the collision of two solids. The current position of the drives is applied to both objects (typically one of the objects is static). If there is a collision, true is returned and the collisionPoint is filled with an arbitrary point where collision takes place.

public bool Collision(Solid firstObject, Solid secondObject, double precision, out GeoPoint collisionPoint)

Parameters

firstObject Solid

First Solid of the test

secondObject Solid

Second Solid of the test

precision double

Precision of the collision test (used to partition the faces of the solids)

collisionPoint GeoPoint

Collision point

Returns

bool

True if there is a collision, false otherwise

DoDragDrop(GeoObjectList, DragDropEffects)

Returns None without starting a drag and drop operation; dragging objects out of this view is currently not supported. The IView implementation of this view forwards to the canvas instead.

public DragDropEffects DoDragDrop(GeoObjectList dragList, DragDropEffects all)

Parameters

dragList GeoObjectList

Not evaluated

all DragDropEffects

Not evaluated

Returns

DragDropEffects

None

GetSelectedObjects()

Returns the currently selected objects (the list itself, not a copy).

public GeoObjectList GetSelectedObjects()

Returns

GeoObjectList

The selected objects, empty if nothing is selected

PauseAnimation()

Pauses the animation. All drive positions remain unchanged, the time stops.

public void PauseAnimation()

ReassembleDisplayList()

Discards the display lists of the drives, so that they are rebuilt from the model on the next paint. Call it when objects have been added to or removed from the model, or when the drive of an object (Actuator) has changed, while the view is displayed.

public void ReassembleDisplayList()

RemoveHighlightedObject(IGeoObject)

Remove the highlighted object that was previously added

public void RemoveHighlightedObject(IGeoObject toRemove)

Parameters

toRemove IGeoObject

highlighted object to remove

ResumeAnimation()

Resume a previously paused animation

public void ResumeAnimation()

SetSelectedObject(IGeoObject)

Makes the provided object the only selected object and repaints the view. The selection is shown while the animation is not running.

public void SetSelectedObject(IGeoObject go)

Parameters

go IGeoObject

The object to select

SetSelectedObjects(GeoObjectList)

Replaces the selection with the provided objects and repaints the view. The selection is shown while the animation is not running.

public void SetSelectedObjects(GeoObjectList l)

Parameters

l GeoObjectList

The objects to select

StartAnimation(ISchedule, double, double, double)

Starts the realtime animation. speed provides a time factor, 1.0 is real time. The method returns immediately. There may bee zooming and scrolling during the animation. The animation may be stopped at any time and stops automatically when endTime is reached. Each discrete frame that is displayed fires the NextStepEvent to enable the user of this class to provide some additional display changes or other tasks.

public void StartAnimation(ISchedule schedule, double startTime, double endTime, double speed)

Parameters

schedule ISchedule

The ISchedule which sets the positions of the drives for each point in time of the animation

startTime double

Start time for the animation

endTime double

Stop time for the animation

speed double

Speed factor

StopAnimation()

Stop the animation. All objects return to the starting position

public void StopAnimation()

ZoomToModelExtent(double)

Zooms to the extend of the model. The projection direction is not changed.

public void ZoomToModelExtent(double factor)

Parameters

factor double

ZoomToRect(BoundingRect)

public void ZoomToRect(BoundingRect visibleRect)

Parameters

visibleRect BoundingRect

Events

GetTimeEvent

Event beeing raised on each frame update of the animation

public event AnimatedView.GetTimeDelegate GetTimeEvent

Event Type

AnimatedView.GetTimeDelegate

MouseDoubleClick

Provide an event handler for the mouse double click message here if you want to manipulate the mouse input to this ModelView

public event MouseFilterDelegate MouseDoubleClick

Event Type

MouseFilterDelegate

MouseDown

Provide an event handler for the mouse down message here if you want to manipulate the mouse input to this ModelView

public event MouseFilterDelegate MouseDown

Event Type

MouseFilterDelegate

MouseMove

Provide an event handler for the mouse move message here if you want to manipulate the mouse input to this ModelView

public event MouseFilterDelegate MouseMove

Event Type

MouseFilterDelegate

MouseUp

Provide an event handler for the mouse up message here if you want to manipulate the mouse input to this ModelView

public event MouseFilterDelegate MouseUp

Event Type

MouseFilterDelegate

MouseWheel

Provide an event handler for the mouse wheel message here if you want to manipulate the mouse input to this ModelView

public event MouseFilterDelegate MouseWheel

Event Type

MouseFilterDelegate

NextStepEvent

Event beeing raised on each frame update of the animation

public event AnimatedView.NextStepDelegate NextStepEvent

Event Type

AnimatedView.NextStepDelegate

PaintActiveEvent

Raised during each paint cycle after the model (with all drives at their current position), the selected and the highlighted objects have been painted, before the PaintSelectEvent handlers. Handlers are registered with SetPaintHandler(DrawingAspect, PaintView) for Active.

public event PaintView PaintActiveEvent

Event Type

PaintView

PaintSelectEvent

Raised at the end of each paint cycle, after the PaintActiveEvent handlers. Handlers are registered with SetPaintHandler(DrawingAspect, PaintView) for Select.

public event PaintView PaintSelectEvent

Event Type

PaintView

ScrollPositionChangedEvent

Not raised by this view: the animated view does not report its scroll position (see ScrollPositionChangedEvent).

public event ScrollPositionChanged ScrollPositionChangedEvent

Event Type

ScrollPositionChanged