C# Class Tutorial.CustomStyles.MySimpleEdgeStyle

This class is an example for a custom edge style based on EdgeStyleBase{TVisual}.
The color of the edge style depends in the selection state of the edge.
Inheritance: EdgeStyleBase
显示文件 Open project: yWorks/yfiles-for-wpf-demos Class Usage Examples

Private Properties

Property Type Description
CreateGeometry Geometry
CreateRenderDataCache RenderDataCache
GetLocation PointD
GetPath GeneralPath
Render void
UpdatePath void

Public Methods

Method Description
MySimpleEdgeStyle ( ) : System

Initializes a new instance of the MySimpleEdgeStyle class with a custom arrow.

Protected Methods

Method Description
CreateVisual ( IRenderContext context, IEdge edge ) : VisualGroup

Creates the visual for an edge.

IsHit ( IInputModeContext context, PointD location, IEdge edge ) : bool

Determines whether the visual representation of the edge has been hit at the given location. Overridden method to include the PathThickness and the HitTestRadius specified in the context in the calculation.

Lookup ( IEdge edge, Type type ) : object

This implementation of the look up provides a custom implementation of the ISelectionIndicatorInstaller interface that better suits to this style.

UpdateVisual ( IRenderContext context, oldVisual, IEdge edge ) : VisualGroup

Re-renders the edge using the old visual for performance reasons.

Private Methods

Method Description
CreateGeometry ( GeneralPath gp ) : Geometry

Creates the geometry for the path from the given GeneralPath.

CreateRenderDataCache ( IRenderContext context, IEdge edge ) : RenderDataCache

Creates an object containing all necessary data to create an edge visual

GetLocation ( IPort port ) : PointD

In contrast to the GraphExtensions.GetLocation property of IPort, this method returns the static current location of the port.

It is recommended to use this method at performance critical places that require no live view of the port location, like the GetPath method of this class.

GetPath ( IEdge edge ) : GeneralPath
Render ( IRenderContext context, IEdge edge, container, RenderDataCache cache ) : void

Creates the visual appearance of an edge

UpdatePath ( IRenderContext context, IEdge edge, container, RenderDataCache cache ) : void

Updates the edge path data as well as the arrow positions of the visuals stored in .

Method Details

CreateVisual() protected method

Creates the visual for an edge.
protected CreateVisual ( IRenderContext context, IEdge edge ) : VisualGroup
context IRenderContext
edge IEdge
return VisualGroup

IsHit() protected method

Determines whether the visual representation of the edge has been hit at the given location. Overridden method to include the PathThickness and the HitTestRadius specified in the context in the calculation.
protected IsHit ( IInputModeContext context, PointD location, IEdge edge ) : bool
context IInputModeContext
location PointD
edge IEdge
return bool

Lookup() protected method

This implementation of the look up provides a custom implementation of the ISelectionIndicatorInstaller interface that better suits to this style.
protected Lookup ( IEdge edge, Type type ) : object
edge IEdge
type Type
return object

MySimpleEdgeStyle() public method

Initializes a new instance of the MySimpleEdgeStyle class with a custom arrow.
public MySimpleEdgeStyle ( ) : System
return System

UpdateVisual() protected method

Re-renders the edge using the old visual for performance reasons.
protected UpdateVisual ( IRenderContext context, oldVisual, IEdge edge ) : VisualGroup
context IRenderContext
edge IEdge
return VisualGroup