public interface IRenderContext extends ICanvasContext
IVisualCreator
DEFAULT
Modifier and Type | Method and Description |
---|---|
default void |
childVisualRemoved(Node visual)
Notifies the context that the
visual has been removed from the visual tree. |
RectD |
getClip()
The clipping rectangle in world coordinates.
|
Transform |
getViewTransform()
A transform that can be added to the transform list of a visual to be displayed in the original coordinate system (the
view coordinate system).
|
default void |
registerForChildrenIfNecessary(Node visual,
IDisposeVisualCallback callback)
Registers a visual if children have registered themselves for disposal.
|
default void |
setDisposeCallback(Node visual,
IDisposeVisualCallback callback)
Registers a
callback which will be called when the visual will be removed from the visual tree. |
PointD |
toViewCoordinates(PointD worldPoint)
Converts the given set of world coordinates to a coordinate pair that can be used to render within the
ViewTransform . |
create, create, create, getCanvasControl, getHitTestRadius, getZoom
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, lookup, safeLookup
default void childVisualRemoved(Node visual)
visual
has been removed from the visual tree.
This has to be done in a IVisualCreator
's IVisualCreator.updateVisual(IRenderContext, Node)
method if a IVisualCreator
's IVisualCreator.createVisual(IRenderContext)
is called or a previously added visual will be removed or replaced. Calling this method will call a previously registered
IDisposeVisualCallback
that the visual
has been removed and needs to free its resources.
If the visual
has not been registered previously this method will do nothing.
visual
- The visual which has been removed.setDisposeCallback(Node, IDisposeVisualCallback)
,
IVisualCreator
,
IVisualCreator.updateVisual(IRenderContext, Node)
,
IDisposeVisualCallback
RectD getClip()
Rendering outside of this clip may be skipped altogether.
Transform getViewTransform()
In contrast to the world coordinate system where the logical coordinates of the elements that are managed by a CanvasControl
(for example, graph elements like node and edges), the view coordinate system is used to display visualizations that are
independent to scale (zoom) or translation transformations (like handles or selection indicators).
default void registerForChildrenIfNecessary(Node visual, IDisposeVisualCallback callback)
This is necessary for visual creators which delegate to another visual creator to create one or more child visuals, like style decorators.
Implementors have to add a call to this method at the end of their IVisualCreator.createVisual(IRenderContext)
and IVisualCreator.updateVisual(IRenderContext, Node)
methods.
The registered callback
has to call childVisualRemoved(Node)
on all child visuals of the
visual
.
visual
- The visual to be registered. This is the visual which is returned by the IVisualCreator.createVisual(IRenderContext)
or IVisualCreator.updateVisual(IRenderContext, Node)
method which calls this method.callback
- A IDisposeVisualCallback
which calls childVisualRemoved(Node)
on all child visuals of the registered
visual
.default void setDisposeCallback(Node visual, IDisposeVisualCallback callback)
callback
which will be called when the visual
will be removed from the visual tree.
This applies to a IVisualCreator
's IVisualCreator.createVisual(IRenderContext)
method if the created visual
allocates resources which should be freed after the visual is no longer used. In
this case the visual has to be registered together with a IDisposeVisualCallback
which can free the allocated
resources. The callback will be called by the framework when the visual is removed from the visual tree.
The callback can also be used to support caching for temporarily removed visuals. See IDisposeVisualCallback
.
visual
- The visual which needs to be disposed after removal.callback
- A callback which will dispose the visual
.IVisualCreator
,
IVisualCreator.createVisual(IRenderContext)
,
IDisposeVisualCallback
PointD toViewCoordinates(PointD worldPoint)
ViewTransform
.worldPoint
- The coordinates in the world coordinate system.getViewTransform()