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

Draws a NodeXL graph onto a collection of Visual objects.
This is used to draw a NodeXL graph in a WPF application. It contains a collection of Visual objects that represent the graph's vertices and edges. Call DrawGraph to draw a laid-out NodeXL graph onto the contained GraphDrawer.VisualCollection.

GraphDrawer does not lay out the graph. You should lay out the graph using one of the provided layout classes before calling .

A GraphDrawer cannot be directly rendered and is typically not used directly by an application. Applications typically use one of two other NodeXL graph-drawing classes:

NodeXLControl, which is a FrameworkElement that wraps a and hosts its . NodeXLControl is meant for use in WPF desktop applications. It automatically lays out the graph before drawing it. NodeXLVisual, which is a Visual that wraps a and hosts its . This is a lower-level alternative to NodeXLControl and can be used anywhere a Visual is more appropriate than a FrameworkElement. Like GraphDrawer, does not lay out the graph before drawing it.

If you do use GraphDrawer directly, rendering the graph requires a custom wrapper that hosts the GraphDrawer. object.

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

Protected Properties

Property Type Description
m_oAllVertexDrawingVisuals System.Windows.Media.DrawingVisual
m_oBackColor Color
m_oBackgroundImage ImageSource
m_oEdgeDrawer EdgeDrawer
m_oGroupDrawer GroupDrawer
m_oSelectedEdgeDrawingVisuals DrawingVisual
m_oUnselectedEdgeDrawingVisuals DrawingVisual
m_oVertexDrawer VertexDrawer
m_oVisualCollection VisualCollection

Public Methods

Method Description
AddVisualOnTopOfGraph ( Visual visual ) : void
AssertValid ( ) : void
DrawGraph ( IGraph graph, GraphDrawingContext graphDrawingContext ) : void
DrawNewEdge ( IEdge newEdge, GraphDrawingContext graphDrawingContext ) : void
DrawNewVertex ( IVertex newVertex, GraphDrawingContext graphDrawingContext ) : void
GetVerticesFromRectangle ( Rect rectangle ) : ICollection
GraphDrawer ( Visual parentVisual ) : System

Initializes a new instance of the GraphDrawer class.

RedrawEdge ( IEdge edge, GraphDrawingContext graphDrawingContext ) : void
RedrawVertex ( IVertex vertex, GraphDrawingContext graphDrawingContext ) : void
RemoveVisualFromTopOfGraph ( Visual visual ) : void
TryGetVertexFromPoint ( Point point, IVertex &vertex ) : System.Boolean
UndrawEdge ( IEdge edge, GraphDrawingContext graphDrawingContext ) : void
UndrawVertex ( IVertex vertex, GraphDrawingContext graphDrawingContext ) : void

Protected Methods

Method Description
DrawBackground ( IGraph oGraph, GraphDrawingContext oGraphDrawingContext ) : void
DrawEdge ( IEdge oEdge, GraphDrawingContext oGraphDrawingContext ) : void
DrawVertex ( IVertex oVertex, GraphDrawingContext oGraphDrawingContext ) : void
GetEdgeDrawingVisuals ( EdgeDrawingHistory oEdgeDrawingHistory ) : System.Windows.Media.DrawingVisual
GetVerticesToDraw ( IGraph oGraph ) : ICollection
RetrieveVertexFromDrawingVisual ( System.Windows.Media.DrawingVisual oDrawingVisual ) : IVertex
SaveVertexOnDrawingVisual ( IVertex oVertex, System.Windows.Media.DrawingVisual oDrawingVisual ) : void

Method Details

AddVisualOnTopOfGraph() public method

public AddVisualOnTopOfGraph ( Visual visual ) : void
visual Visual
return void

AssertValid() public method

public AssertValid ( ) : void
return void

DrawBackground() protected method

protected DrawBackground ( IGraph oGraph, GraphDrawingContext oGraphDrawingContext ) : void
oGraph IGraph
oGraphDrawingContext GraphDrawingContext
return void

DrawEdge() protected method

protected DrawEdge ( IEdge oEdge, GraphDrawingContext oGraphDrawingContext ) : void
oEdge IEdge
oGraphDrawingContext GraphDrawingContext
return void

DrawGraph() public method

public DrawGraph ( IGraph graph, GraphDrawingContext graphDrawingContext ) : void
graph IGraph
graphDrawingContext GraphDrawingContext
return void

DrawNewEdge() public method

public DrawNewEdge ( IEdge newEdge, GraphDrawingContext graphDrawingContext ) : void
newEdge IEdge
graphDrawingContext GraphDrawingContext
return void

DrawNewVertex() public method

public DrawNewVertex ( IVertex newVertex, GraphDrawingContext graphDrawingContext ) : void
newVertex IVertex
graphDrawingContext GraphDrawingContext
return void

DrawVertex() protected method

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

GetEdgeDrawingVisuals() protected method

protected GetEdgeDrawingVisuals ( EdgeDrawingHistory oEdgeDrawingHistory ) : System.Windows.Media.DrawingVisual
oEdgeDrawingHistory EdgeDrawingHistory
return System.Windows.Media.DrawingVisual

GetVerticesFromRectangle() public method

public GetVerticesFromRectangle ( Rect rectangle ) : ICollection
rectangle System.Windows.Rect
return ICollection

GetVerticesToDraw() protected method

protected GetVerticesToDraw ( IGraph oGraph ) : ICollection
oGraph IGraph
return ICollection

GraphDrawer() public method

Initializes a new instance of the GraphDrawer class.
public GraphDrawer ( Visual parentVisual ) : System
parentVisual Visual /// The parent of the contained . This is usually a /// FrameworkElement that is hosting the collection. ///
return System

RedrawEdge() public method

public RedrawEdge ( IEdge edge, GraphDrawingContext graphDrawingContext ) : void
edge IEdge
graphDrawingContext GraphDrawingContext
return void

RedrawVertex() public method

public RedrawVertex ( IVertex vertex, GraphDrawingContext graphDrawingContext ) : void
vertex IVertex
graphDrawingContext GraphDrawingContext
return void

RemoveVisualFromTopOfGraph() public method

public RemoveVisualFromTopOfGraph ( Visual visual ) : void
visual Visual
return void

RetrieveVertexFromDrawingVisual() protected method

protected RetrieveVertexFromDrawingVisual ( System.Windows.Media.DrawingVisual oDrawingVisual ) : IVertex
oDrawingVisual System.Windows.Media.DrawingVisual
return IVertex

SaveVertexOnDrawingVisual() protected method

protected SaveVertexOnDrawingVisual ( IVertex oVertex, System.Windows.Media.DrawingVisual oDrawingVisual ) : void
oVertex IVertex
oDrawingVisual System.Windows.Media.DrawingVisual
return void

TryGetVertexFromPoint() public method

public TryGetVertexFromPoint ( Point point, IVertex &vertex ) : System.Boolean
point Point
vertex IVertex
return System.Boolean

UndrawEdge() public method

public UndrawEdge ( IEdge edge, GraphDrawingContext graphDrawingContext ) : void
edge IEdge
graphDrawingContext GraphDrawingContext
return void

UndrawVertex() public method

public UndrawVertex ( IVertex vertex, GraphDrawingContext graphDrawingContext ) : void
vertex IVertex
graphDrawingContext GraphDrawingContext
return void

Property Details

m_oAllVertexDrawingVisuals protected_oe property

protected DrawingVisual,System.Windows.Media m_oAllVertexDrawingVisuals
return System.Windows.Media.DrawingVisual

m_oBackColor protected_oe property

protected Color m_oBackColor
return Color

m_oBackgroundImage protected_oe property

protected ImageSource m_oBackgroundImage
return ImageSource

m_oEdgeDrawer protected_oe property

protected EdgeDrawer m_oEdgeDrawer
return EdgeDrawer

m_oGroupDrawer protected_oe property

protected GroupDrawer m_oGroupDrawer
return GroupDrawer

m_oSelectedEdgeDrawingVisuals protected_oe property

protected DrawingVisual m_oSelectedEdgeDrawingVisuals
return DrawingVisual

m_oUnselectedEdgeDrawingVisuals protected_oe property

protected DrawingVisual m_oUnselectedEdgeDrawingVisuals
return DrawingVisual

m_oVertexDrawer protected_oe property

protected VertexDrawer m_oVertexDrawer
return VertexDrawer

m_oVisualCollection protected_oe property

protected VisualCollection m_oVisualCollection
return VisualCollection