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

Draws a graph's vertices.
This class is responsible for drawing a graph's vertices. The default vertex appearance is determined by this class's properties. The appearance of an individual vertex can be overridden by adding appropriate metadata to the vertex. The following metadata keys are honored: ReservedMetadataKeys.Visibility ReservedMetadataKeys.IsSelected ReservedMetadataKeys.PerColor ReservedMetadataKeys.PerAlpha ReservedMetadataKeys.PerVertexShape ReservedMetadataKeys.PerVertexRadius ReservedMetadataKeys.PerVertexLabel ReservedMetadataKeys.PerVertexLabelFillColor ReservedMetadataKeys.PerVertexLabelPosition ReservedMetadataKeys.PerVertexImage

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

If a vertex has the shape VertexShape.Label and has the ReservedMetadataKeys.PerVertexLabel key, the vertex is drawn as a rectangle containing the text specified by the key's value. The default color of the text and the rectangle's outline is , but can be overridden with the ReservedMetadataKeys.PerColor key. The default fill color of the rectangle is LabelFillColor, but can be overridden with the ReservedMetadataKeys.PerVertexLabelFillColor key.

If a vertex has a shape other than VertexShape.Label and has the ReservedMetadataKeys.PerVertexLabel key, the vertex is drawn as the specified shape, and the text specified by the key's value is drawn next to the vertex as an annotation at the position determined by .

If a vertex has the shape VertexShape.Image and has the key, the vertex is drawn as the image specified by the key's value.

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

When drawing the graph, call TryDrawVertex for each of the graph's vertices.

Inheritance: VertexAndEdgeDrawerBase
Mostra file Open project: 2014-sed-team3/term-project Class Usage Examples

Public Properties

Property Type Description
MaximumRadius Double
MaximumRelativeOuterGlowSize Double
MinimumRadius Double
MinimumRelativeOuterGlowSize Double

Protected Properties

Property Type Description
m_bLabelWrapText System.Boolean
m_bLimitVerticesToBounds System.Boolean
m_btBackgroundAlpha Byte
m_dLabelWrapMaxTextWidth Double
m_dRadius Double
m_dRelativeOuterGlowSize Double
m_eEffect VertexEffect
m_eLabelPosition VertexLabelPosition
m_eShape VertexShape
m_oLabelFillColor Color

Public Methods

Method Description
AssertValid ( ) : void
TryDrawVertex ( IVertex vertex, GraphDrawingContext graphDrawingContext, VertexDrawingHistory &vertexDrawingHistory ) : System.Boolean
VertexDrawer ( ) : System

Initializes a new instance of the VertexDrawer class.

Protected Methods

Method Description
CheckDrawVertexArguments ( IVertex oVertex, GraphDrawingContext oGraphDrawingContext ) : void
CreateFormattedTextWithWrap ( String sText, Color oColor, Double dFontSize ) : System.Windows.Media.FormattedText
DrawImageShape ( IVertex oVertex, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, DrawingVisualPlus oDrawingVisual, VisibilityKeyValue eVisibility, System.Boolean bDrawAsSelected, String sAnnotation, System.Windows.Media.ImageSource oImageSource, VertexLabelDrawer oVertexLabelDrawer, CollapsedGroupDrawingManager oCollapsedGroupDrawingManager ) : VertexDrawingHistory
DrawLabelShape ( IVertex oVertex, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, DrawingVisualPlus oDrawingVisual, VisibilityKeyValue eVisibility, System.Boolean bDrawAsSelected, String sLabel, CollapsedGroupDrawingManager oCollapsedGroupDrawingManager ) : VertexDrawingHistory
DrawSimpleShape ( IVertex oVertex, VertexShape eShape, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, DrawingVisualPlus oDrawingVisual, VisibilityKeyValue eVisibility, System.Boolean bDrawAsSelected, String sAnnotation, VertexLabelDrawer oVertexLabelDrawer, CollapsedGroupDrawingManager oCollapsedGroupDrawingManager ) : VertexDrawingHistory
GetDropShadowEffect ( Color oColor, Double dShadowDepth, Double dBlurRadius, Double dOpacity ) : System.Windows.Media.Effects.DropShadowEffect
GetEffectForDropShadow ( GraphDrawingContext oGraphDrawingContext, Double dShadowDepth, Double dOpacity ) : System.Windows.Media.Effects.Effect
GetEffectForOuterGlow ( Color oColor, Double dGlowSize, Double dOpacity ) : System.Windows.Media.Effects.Effect
GetLabelFontSize ( IVertex oVertex ) : Double
GetLabelPadding ( Double dLabelFontSize ) : Double
GetRadius ( IVertex oVertex ) : Double
GetRectangleEffect ( GraphDrawingContext oGraphDrawingContext, Color oColor ) : System.Windows.Media.Effects.Effect
GetShape ( IVertex oVertex ) : VertexShape
GetSimpleShapeEffect ( GraphDrawingContext oGraphDrawingContext, Double dRadius, Color oColor ) : System.Windows.Media.Effects.Effect
GetVertexLocation ( IVertex oVertex ) : Point
GetVertexRectangle ( Point oLocation, Double dWidth, Double dHeight ) : Rect
MoveVertexIfNecessary ( IVertex oVertex, GraphDrawingContext oGraphDrawingContext, CollapsedGroupDrawingManager oCollapsedGroupDrawingManager, Rect &oVertexBounds ) : void

Method Details

AssertValid() public method

public AssertValid ( ) : void
return void

CheckDrawVertexArguments() protected method

protected CheckDrawVertexArguments ( IVertex oVertex, GraphDrawingContext oGraphDrawingContext ) : void
oVertex IVertex
oGraphDrawingContext GraphDrawingContext
return void

CreateFormattedTextWithWrap() protected method

protected CreateFormattedTextWithWrap ( String sText, Color oColor, Double dFontSize ) : System.Windows.Media.FormattedText
sText String
oColor Color
dFontSize Double
return System.Windows.Media.FormattedText

DrawImageShape() protected method

protected DrawImageShape ( IVertex oVertex, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, DrawingVisualPlus oDrawingVisual, VisibilityKeyValue eVisibility, System.Boolean bDrawAsSelected, String sAnnotation, System.Windows.Media.ImageSource oImageSource, VertexLabelDrawer oVertexLabelDrawer, CollapsedGroupDrawingManager oCollapsedGroupDrawingManager ) : VertexDrawingHistory
oVertex IVertex
oGraphDrawingContext GraphDrawingContext
oDrawingContext System.Windows.Media.DrawingContext
oDrawingVisual Smrf.WpfGraphicsLib.DrawingVisualPlus
eVisibility VisibilityKeyValue
bDrawAsSelected System.Boolean
sAnnotation String
oImageSource System.Windows.Media.ImageSource
oVertexLabelDrawer VertexLabelDrawer
oCollapsedGroupDrawingManager CollapsedGroupDrawingManager
return VertexDrawingHistory

DrawLabelShape() protected method

protected DrawLabelShape ( IVertex oVertex, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, DrawingVisualPlus oDrawingVisual, VisibilityKeyValue eVisibility, System.Boolean bDrawAsSelected, String sLabel, CollapsedGroupDrawingManager oCollapsedGroupDrawingManager ) : VertexDrawingHistory
oVertex IVertex
oGraphDrawingContext GraphDrawingContext
oDrawingContext System.Windows.Media.DrawingContext
oDrawingVisual Smrf.WpfGraphicsLib.DrawingVisualPlus
eVisibility VisibilityKeyValue
bDrawAsSelected System.Boolean
sLabel String
oCollapsedGroupDrawingManager CollapsedGroupDrawingManager
return VertexDrawingHistory

DrawSimpleShape() protected method

protected DrawSimpleShape ( IVertex oVertex, VertexShape eShape, GraphDrawingContext oGraphDrawingContext, System.Windows.Media.DrawingContext oDrawingContext, DrawingVisualPlus oDrawingVisual, VisibilityKeyValue eVisibility, System.Boolean bDrawAsSelected, String sAnnotation, VertexLabelDrawer oVertexLabelDrawer, CollapsedGroupDrawingManager oCollapsedGroupDrawingManager ) : VertexDrawingHistory
oVertex IVertex
eShape VertexShape
oGraphDrawingContext GraphDrawingContext
oDrawingContext System.Windows.Media.DrawingContext
oDrawingVisual Smrf.WpfGraphicsLib.DrawingVisualPlus
eVisibility VisibilityKeyValue
bDrawAsSelected System.Boolean
sAnnotation String
oVertexLabelDrawer VertexLabelDrawer
oCollapsedGroupDrawingManager CollapsedGroupDrawingManager
return VertexDrawingHistory

GetDropShadowEffect() protected method

protected GetDropShadowEffect ( Color oColor, Double dShadowDepth, Double dBlurRadius, Double dOpacity ) : System.Windows.Media.Effects.DropShadowEffect
oColor Color
dShadowDepth Double
dBlurRadius Double
dOpacity Double
return System.Windows.Media.Effects.DropShadowEffect

GetEffectForDropShadow() protected method

protected GetEffectForDropShadow ( GraphDrawingContext oGraphDrawingContext, Double dShadowDepth, Double dOpacity ) : System.Windows.Media.Effects.Effect
oGraphDrawingContext GraphDrawingContext
dShadowDepth Double
dOpacity Double
return System.Windows.Media.Effects.Effect

GetEffectForOuterGlow() protected method

protected GetEffectForOuterGlow ( Color oColor, Double dGlowSize, Double dOpacity ) : System.Windows.Media.Effects.Effect
oColor Color
dGlowSize Double
dOpacity Double
return System.Windows.Media.Effects.Effect

GetLabelFontSize() protected method

protected GetLabelFontSize ( IVertex oVertex ) : Double
oVertex IVertex
return Double

GetLabelPadding() protected method

protected GetLabelPadding ( Double dLabelFontSize ) : Double
dLabelFontSize Double
return Double

GetRadius() protected method

protected GetRadius ( IVertex oVertex ) : Double
oVertex IVertex
return Double

GetRectangleEffect() protected method

protected GetRectangleEffect ( GraphDrawingContext oGraphDrawingContext, Color oColor ) : System.Windows.Media.Effects.Effect
oGraphDrawingContext GraphDrawingContext
oColor Color
return System.Windows.Media.Effects.Effect

GetShape() protected method

protected GetShape ( IVertex oVertex ) : VertexShape
oVertex IVertex
return VertexShape

GetSimpleShapeEffect() protected method

protected GetSimpleShapeEffect ( GraphDrawingContext oGraphDrawingContext, Double dRadius, Color oColor ) : System.Windows.Media.Effects.Effect
oGraphDrawingContext GraphDrawingContext
dRadius Double
oColor Color
return System.Windows.Media.Effects.Effect

GetVertexLocation() protected method

protected GetVertexLocation ( IVertex oVertex ) : Point
oVertex IVertex
return Point

GetVertexRectangle() protected method

protected GetVertexRectangle ( Point oLocation, Double dWidth, Double dHeight ) : Rect
oLocation Point
dWidth Double
dHeight Double
return System.Windows.Rect

MoveVertexIfNecessary() protected method

protected MoveVertexIfNecessary ( IVertex oVertex, GraphDrawingContext oGraphDrawingContext, CollapsedGroupDrawingManager oCollapsedGroupDrawingManager, Rect &oVertexBounds ) : void
oVertex IVertex
oGraphDrawingContext GraphDrawingContext
oCollapsedGroupDrawingManager CollapsedGroupDrawingManager
oVertexBounds System.Windows.Rect
return void

TryDrawVertex() public method

public TryDrawVertex ( IVertex vertex, GraphDrawingContext graphDrawingContext, VertexDrawingHistory &vertexDrawingHistory ) : System.Boolean
vertex IVertex
graphDrawingContext GraphDrawingContext
vertexDrawingHistory VertexDrawingHistory
return System.Boolean

VertexDrawer() public method

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

Property Details

MaximumRadius public_oe static_oe property

Maximum value of the Radius property. The value is 549.0.
public static Double MaximumRadius
return Double

MaximumRelativeOuterGlowSize public_oe static_oe property

Maximum value of the RelativeOuterGlowSize property. The value is 10.0.
public static Double MaximumRelativeOuterGlowSize
return Double

MinimumRadius public_oe static_oe property

Minimum value of the Radius property. The value is 0.1.
public static Double MinimumRadius
return Double

MinimumRelativeOuterGlowSize public_oe static_oe property

Minimum value of the RelativeOuterGlowSize property. The value is 1.0.
public static Double MinimumRelativeOuterGlowSize
return Double

m_bLabelWrapText protected_oe property

protected Boolean,System m_bLabelWrapText
return System.Boolean

m_bLimitVerticesToBounds protected_oe property

protected Boolean,System m_bLimitVerticesToBounds
return System.Boolean

m_btBackgroundAlpha protected_oe property

protected Byte m_btBackgroundAlpha
return Byte

m_dLabelWrapMaxTextWidth protected_oe property

protected Double m_dLabelWrapMaxTextWidth
return Double

m_dRadius protected_oe property

protected Double m_dRadius
return Double

m_dRelativeOuterGlowSize protected_oe property

protected Double m_dRelativeOuterGlowSize
return Double

m_eEffect protected_oe property

protected VertexEffect m_eEffect
return VertexEffect

m_eLabelPosition protected_oe property

protected VertexLabelPosition m_eLabelPosition
return VertexLabelPosition

m_eShape protected_oe property

protected VertexShape m_eShape
return VertexShape

m_oLabelFillColor protected_oe property

protected Color m_oLabelFillColor
return Color