C

ObjectRendererBase<TRenderTag, TVisual>
abstract

An abstract base class for convenient implementation of IObjectRenderer<T>.
ImplementsInheritance Hierarchy

Remarks

The only method that needs to be implemented is createVisual, however to improve rendering performance it is highly recommended to implement at least updateVisual, too.

Type Parameters

TRenderTag

The type of the subclasses will render. This class will cast the render tag to this type before passing it to subclasses.

TVisual

The type of the visual this instance will create. Subclasses may declare a fixed type to make implementing and more convenient.

Members

Show:

Constructors

Initializes a new instance of the ObjectRendererBase<TRenderTag, TVisual> class.

Methods

Creates the visual representation for the renderTag.
This method is called in response to a createVisual call to the instance that has been queried from the IObjectRenderer<T>.
protectedabstract

Parameters

context: IRenderContext
The render context.
renderTag: TRenderTag
The render tag this instance renders.

Return Value

TVisual
The visual as required by the createVisual interface.

See Also

API
updateVisual
Gets the bounds of the visual for the render tag in the given context.

This method is called in response to a getBounds call to the instance that has been queried from the IObjectRenderer<T>.

This implementation returns INFINITE.

protected

Parameters

context: ICanvasContext
The canvas context.
renderTag: TRenderTag
The render tag this instance renders.

Return Value

Rect
The bounds of the visual representation.

See Also

API
UNBOUNDED
Returns an implementation of IBoundsProvider that can determine the visible bounds of the rendering of the render tag.
This method may always return the same instance. By contract, clients will not cache instances returned, but will always call this method before the methods on the instance will be called. This contract enables the use of the flyweight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.
final

Parameters

renderTag: TRenderTag
the render tag to query the bounds for

Return Value

IBoundsProvider
An implementation of IBoundsProvider to determine the bounds of the visualization.
Returns an implementation of IHitTestable that can determine whether the rendering of the render tag has been hit at a given coordinate.
This method may always return the same instance. By contract, clients will not cache instances returned, but will always call this method before the methods on the instance will be called. This contract enables the use of the flyweight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.
final

Parameters

renderTag: TRenderTag
the render tag to do the hit testing for

Return Value

IHitTestable
An implementation of IHitTestable to determine visibility.
Returns an implementation of IVisibilityTestable that can determine if the rendering of the render tag would be visible in a given context.
This method may always return the same instance. By contract clients will not cache instances returned but will always call this method before the methods on the instance will be called. This contract enables the use of the flyweight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.
final

Parameters

renderTag: TRenderTag
the render tag to query visibility for

Return Value

IVisibilityTestable
An implementation of IVisibilityTestable to determine visibility.
Returns an implementation of IVisualCreator that will create the Visual tree for the render tag.
This method may always return the same instance. By contract, clients will not cache instances returned, but will always call this method before the methods on the instance will be called. This contract enables the use of the flyweight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.
final

Parameters

renderTag: TRenderTag
the render tag to create a Visual for

Return Value

IVisualCreator
An implementation of IVisualCreator to create or update the visualization.
Determines whether the visual representation of the node has been hit at the given location.

This method is called in response to a isHit call to the instance that has been queried from the IObjectRenderer<T>.

This implementation always returns false.

protected

Parameters

context: IInputModeContext
The canvas context.
location: Point
The point to test.
renderTag: TRenderTag
The render tag this instance renders.

Return Value

boolean
false.
Determines whether the visualization for the specified node is visible in the given area for the given context.

This method is called in response to a isVisible call to the instance that has been queried from the IObjectRenderer<T>.

This implementation always returns true.

protected

Parameters

context: ICanvasContext
The canvas context.
rectangle: Rect
The visible area.
renderTag: TRenderTag
The render tag this instance renders.

Return Value

boolean
true.
Updates a visual representation for the renderTag previously created by createVisual.

This method is called in response to a updateVisual call to the instance that has been queried from the IObjectRenderer<T>.

This implementation simply delegates to createVisual so subclasses should override to improve rendering performance.

protected

Parameters

context: IRenderContext
The render context.
oldVisual: TVisual
The visual that has been created in the call to createVisual.
renderTag: TRenderTag
The render tag this instance renders.

Return Value

TVisual
The visual as required by the createVisual interface.

See Also

API
createVisual