C# Class Smrf.NodeXL.Visualization.Wpf.EdgeDrawer

Draws a graph's edges.
This class is responsible for drawing a graph's edges. The default edge appearance is determined by this class's properties. The appearance of an individual edge can be overridden by adding appropriate metadata to the edge. The following metadata keys are honored: ReservedMetadataKeys.Visibility ReservedMetadataKeys.PerColor ReservedMetadataKeys.PerAlpha ReservedMetadataKeys.PerEdgeWidth ReservedMetadataKeys.PerEdgeStyle ReservedMetadataKeys.PerEdgeLabel ReservedMetadataKeys.PerEdgeLabelTextColor ReservedMetadataKeys.IsSelected

The values of the ReservedMetadataKeys.PerColor and ReservedMetadataKeys.PerEdgeLabelTextColor keys can be of type System.Windows.Media.Color or System.Drawing.Color.

If VertexAndEdgeDrawerBase.UseSelection is true, an edge is drawn using VertexAndEdgeDrawerBase.Color or , depending on whether the edge has been marked as selected. If is false, is used regardless of whether the edge has been marked as selected.

When drawing the graph, call TryDrawEdge for each of the graph's edges.

Inheritance: VertexAndEdgeDrawerBase
Mostrar archivo Open project: 2014-sed-team3/term-project Class Usage Examples

Public Properties

Property Type Description
MaximumRelativeArrowSize Double
MaximumWidth Double
MinimumRelativeArrowSize Double
MinimumWidth Double

Protected Properties

Property Type Description
m_bDrawArrowOnDirectedEdge System.Boolean
m_dBezierDisplacementFactor Double
m_dRelativeArrowSize Double
m_dWidth Double
m_eCurveStyle EdgeCurveStyle
m_oLabelTextColor Color

Public Methods

Method Description
AssertValid ( ) : void
EdgeDrawer ( ) : System

Initializes a new instance of the EdgeDrawer class.

TryDrawEdge ( IEdge edge, GraphDrawingContext graphDrawingContext, EdgeDrawingHistory &edgeDrawingHistory ) : System.Boolean

Protected Methods

Method Description
DrawArrow ( System.Windows.Media.DrawingContext oDrawingContext, Point oArrowTipLocation, Double dArrowAngle, Color oColor, Double dEdgeWidth ) : Point
DrawBezierCurve ( IEdge oEdge, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Boolean bDrawAsSelected, System.Boolean bDrawArrow, System.Windows.Media.Pen oPen, Color oColor, Double dWidth, VisibilityKeyValue eVisibility, String sLabel ) : void
DrawBezierLabel ( System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.FormattedText oFormattedText, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Windows.Media.PathGeometry oBezierCurve, Double dLabelOriginAsFractionOfEdgeLength, Double dEdgeLength, Double dBufferWidth, Color oLabelTextColor, Color oTranslucentRectangleColor, Double dFontSize ) : void
DrawCurveThroughIntermediatePoints ( IEdge oEdge, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, VertexDrawingHistory oVertex1DrawingHistory, VertexDrawingHistory oVertex2DrawingHistory, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Windows.Media.Pen oPen ) : void
DrawLabel ( IEdge oEdge, System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, System.Boolean bDrawAsSelected, Color oEdgeColor, VisibilityKeyValue eVisibility, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Windows.Media.PathGeometry oBezierCurve, Point oBezierControlPoint, String sLabel ) : void
DrawSelfLoopAt ( System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, Color oColor, Double dWidth, Point oSelfLoopEndpoint, RectangleEdge eFarthestGraphRectangleEdge, System.Boolean bDrawArrow ) : void
DrawStraightEdge ( IEdge oEdge, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Boolean bDrawAsSelected, System.Boolean bDrawArrow, System.Windows.Media.Pen oPen, Color oColor, Double dWidth, VisibilityKeyValue eVisibility, String sLabel ) : void
DrawStraightLabel ( System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.FormattedText oFormattedText, Point oEdgeEndpoint1, Point oEdgeEndpoint2, Double dLabelOriginAsFractionOfEdgeLength, Double dEdgeLength, Double dBufferWidth, Color oTranslucentRectangleColor ) : void
DrawTranslucentRectangle ( System.Windows.Media.DrawingContext oDrawingContext, Rect oRectangle, Color oColor ) : void
FilterIntermediatePoints ( IEdge oEdge, VertexDrawingHistory oVertex1DrawingHistory, VertexDrawingHistory oVertex2DrawingHistory ) : List
GetDashStyle ( IEdge oEdge, Double dWidth, System.Boolean bDrawAsSelected ) : System.Windows.Media.DashStyle
GetLabelFontSize ( IEdge oEdge ) : Double
GetLabelTextColor ( IEdge oEdge, System.Boolean bDrawAsSelected, Color oEdgeColor, VisibilityKeyValue eVisibility ) : Color
GetWidth ( IEdge oEdge ) : Double
TryDrawSelfLoop ( IVertex oVertex, System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, Color oColor, Double dWidth, System.Boolean bDrawArrow ) : System.Boolean
TryGetVertexInformation ( IVertex oVertex1, IVertex oVertex2, VertexDrawingHistory &oVertex1DrawingHistory, VertexDrawingHistory &oVertex2DrawingHistory, Point &oEdgeEndpoint1, Point &oEdgeEndpoint2 ) : System.Boolean

Method Details

AssertValid() public method

public AssertValid ( ) : void
return void

DrawArrow() protected method

protected DrawArrow ( System.Windows.Media.DrawingContext oDrawingContext, Point oArrowTipLocation, Double dArrowAngle, Color oColor, Double dEdgeWidth ) : Point
oDrawingContext System.Windows.Media.DrawingContext
oArrowTipLocation Point
dArrowAngle Double
oColor Color
dEdgeWidth Double
return Point

DrawBezierCurve() protected method

protected DrawBezierCurve ( IEdge oEdge, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Boolean bDrawAsSelected, System.Boolean bDrawArrow, System.Windows.Media.Pen oPen, Color oColor, Double dWidth, VisibilityKeyValue eVisibility, String sLabel ) : void
oEdge IEdge
oGraphDrawingContext GraphDrawingContext
oDrawingContext System.Windows.Media.DrawingContext
oEdgeEndpoint1 Point
oEdgeEndpoint2 Point
bDrawAsSelected System.Boolean
bDrawArrow System.Boolean
oPen System.Windows.Media.Pen
oColor Color
dWidth Double
eVisibility VisibilityKeyValue
sLabel String
return void

DrawBezierLabel() protected method

protected DrawBezierLabel ( System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.FormattedText oFormattedText, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Windows.Media.PathGeometry oBezierCurve, Double dLabelOriginAsFractionOfEdgeLength, Double dEdgeLength, Double dBufferWidth, Color oLabelTextColor, Color oTranslucentRectangleColor, Double dFontSize ) : void
oDrawingContext System.Windows.Media.DrawingContext
oGraphDrawingContext GraphDrawingContext
oFormattedText System.Windows.Media.FormattedText
oEdgeEndpoint1 Point
oEdgeEndpoint2 Point
oBezierCurve System.Windows.Media.PathGeometry
dLabelOriginAsFractionOfEdgeLength Double
dEdgeLength Double
dBufferWidth Double
oLabelTextColor Color
oTranslucentRectangleColor Color
dFontSize Double
return void

DrawCurveThroughIntermediatePoints() protected method

protected DrawCurveThroughIntermediatePoints ( IEdge oEdge, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, VertexDrawingHistory oVertex1DrawingHistory, VertexDrawingHistory oVertex2DrawingHistory, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Windows.Media.Pen oPen ) : void
oEdge IEdge
oGraphDrawingContext GraphDrawingContext
oDrawingContext System.Windows.Media.DrawingContext
oVertex1DrawingHistory VertexDrawingHistory
oVertex2DrawingHistory VertexDrawingHistory
oEdgeEndpoint1 Point
oEdgeEndpoint2 Point
oPen System.Windows.Media.Pen
return void

DrawLabel() protected method

protected DrawLabel ( IEdge oEdge, System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, System.Boolean bDrawAsSelected, Color oEdgeColor, VisibilityKeyValue eVisibility, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Windows.Media.PathGeometry oBezierCurve, Point oBezierControlPoint, String sLabel ) : void
oEdge IEdge
oDrawingContext System.Windows.Media.DrawingContext
oGraphDrawingContext GraphDrawingContext
bDrawAsSelected System.Boolean
oEdgeColor Color
eVisibility VisibilityKeyValue
oEdgeEndpoint1 Point
oEdgeEndpoint2 Point
oBezierCurve System.Windows.Media.PathGeometry
oBezierControlPoint Point
sLabel String
return void

DrawSelfLoopAt() protected method

protected DrawSelfLoopAt ( System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, Color oColor, Double dWidth, Point oSelfLoopEndpoint, RectangleEdge eFarthestGraphRectangleEdge, System.Boolean bDrawArrow ) : void
oDrawingContext System.Windows.Media.DrawingContext
oGraphDrawingContext GraphDrawingContext
oColor Color
dWidth Double
oSelfLoopEndpoint Point
eFarthestGraphRectangleEdge RectangleEdge
bDrawArrow System.Boolean
return void

DrawStraightEdge() protected method

protected DrawStraightEdge ( IEdge oEdge, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, Point oEdgeEndpoint1, Point oEdgeEndpoint2, System.Boolean bDrawAsSelected, System.Boolean bDrawArrow, System.Windows.Media.Pen oPen, Color oColor, Double dWidth, VisibilityKeyValue eVisibility, String sLabel ) : void
oEdge IEdge
oGraphDrawingContext GraphDrawingContext
oDrawingContext System.Windows.Media.DrawingContext
oEdgeEndpoint1 Point
oEdgeEndpoint2 Point
bDrawAsSelected System.Boolean
bDrawArrow System.Boolean
oPen System.Windows.Media.Pen
oColor Color
dWidth Double
eVisibility VisibilityKeyValue
sLabel String
return void

DrawStraightLabel() protected method

protected DrawStraightLabel ( System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.FormattedText oFormattedText, Point oEdgeEndpoint1, Point oEdgeEndpoint2, Double dLabelOriginAsFractionOfEdgeLength, Double dEdgeLength, Double dBufferWidth, Color oTranslucentRectangleColor ) : void
oDrawingContext System.Windows.Media.DrawingContext
oGraphDrawingContext GraphDrawingContext
oFormattedText System.Windows.Media.FormattedText
oEdgeEndpoint1 Point
oEdgeEndpoint2 Point
dLabelOriginAsFractionOfEdgeLength Double
dEdgeLength Double
dBufferWidth Double
oTranslucentRectangleColor Color
return void

DrawTranslucentRectangle() protected method

protected DrawTranslucentRectangle ( System.Windows.Media.DrawingContext oDrawingContext, Rect oRectangle, Color oColor ) : void
oDrawingContext System.Windows.Media.DrawingContext
oRectangle System.Windows.Rect
oColor Color
return void

EdgeDrawer() public method

Initializes a new instance of the EdgeDrawer class.
public EdgeDrawer ( ) : System
return System

FilterIntermediatePoints() protected method

protected FilterIntermediatePoints ( IEdge oEdge, VertexDrawingHistory oVertex1DrawingHistory, VertexDrawingHistory oVertex2DrawingHistory ) : List
oEdge IEdge
oVertex1DrawingHistory VertexDrawingHistory
oVertex2DrawingHistory VertexDrawingHistory
return List

GetDashStyle() protected method

protected GetDashStyle ( IEdge oEdge, Double dWidth, System.Boolean bDrawAsSelected ) : System.Windows.Media.DashStyle
oEdge IEdge
dWidth Double
bDrawAsSelected System.Boolean
return System.Windows.Media.DashStyle

GetLabelFontSize() protected method

protected GetLabelFontSize ( IEdge oEdge ) : Double
oEdge IEdge
return Double

GetLabelTextColor() protected method

protected GetLabelTextColor ( IEdge oEdge, System.Boolean bDrawAsSelected, Color oEdgeColor, VisibilityKeyValue eVisibility ) : Color
oEdge IEdge
bDrawAsSelected System.Boolean
oEdgeColor Color
eVisibility VisibilityKeyValue
return Color

GetWidth() protected method

protected GetWidth ( IEdge oEdge ) : Double
oEdge IEdge
return Double

TryDrawEdge() public method

public TryDrawEdge ( IEdge edge, GraphDrawingContext graphDrawingContext, EdgeDrawingHistory &edgeDrawingHistory ) : System.Boolean
edge IEdge
graphDrawingContext GraphDrawingContext
edgeDrawingHistory EdgeDrawingHistory
return System.Boolean

TryDrawSelfLoop() protected method

protected TryDrawSelfLoop ( IVertex oVertex, System.Windows.Media.DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, Color oColor, Double dWidth, System.Boolean bDrawArrow ) : System.Boolean
oVertex IVertex
oDrawingContext System.Windows.Media.DrawingContext
oGraphDrawingContext GraphDrawingContext
oColor Color
dWidth Double
bDrawArrow System.Boolean
return System.Boolean

TryGetVertexInformation() protected method

protected TryGetVertexInformation ( IVertex oVertex1, IVertex oVertex2, VertexDrawingHistory &oVertex1DrawingHistory, VertexDrawingHistory &oVertex2DrawingHistory, Point &oEdgeEndpoint1, Point &oEdgeEndpoint2 ) : System.Boolean
oVertex1 IVertex
oVertex2 IVertex
oVertex1DrawingHistory VertexDrawingHistory
oVertex2DrawingHistory VertexDrawingHistory
oEdgeEndpoint1 Point
oEdgeEndpoint2 Point
return System.Boolean

Property Details

MaximumRelativeArrowSize public_oe static_oe property

Maximum value of the RelativeArrowSize property. The value is 20.
public static Double MaximumRelativeArrowSize
return Double

MaximumWidth public_oe static_oe property

Maximum value of the Width property. The value is 20.
public static Double MaximumWidth
return Double

MinimumRelativeArrowSize public_oe static_oe property

Minimum value of the RelativeArrowSize property. The value is 0.
public static Double MinimumRelativeArrowSize
return Double

MinimumWidth public_oe static_oe property

Minimum value of the Width property. The value is 1.
public static Double MinimumWidth
return Double

m_bDrawArrowOnDirectedEdge protected_oe property

protected Boolean,System m_bDrawArrowOnDirectedEdge
return System.Boolean

m_dBezierDisplacementFactor protected_oe property

protected Double m_dBezierDisplacementFactor
return Double

m_dRelativeArrowSize protected_oe property

protected Double m_dRelativeArrowSize
return Double

m_dWidth protected_oe property

protected Double m_dWidth
return Double

m_eCurveStyle protected_oe property

protected EdgeCurveStyle m_eCurveStyle
return EdgeCurveStyle

m_oLabelTextColor protected_oe property

protected Color m_oLabelTextColor
return Color