TreeDrawing Class |
Namespace: KansasStateUniversity.TreeViewer2
The TreeDrawing type exposes the following members.
Name | Description | |
---|---|---|
![]() | TreeDrawing |
Constructs a drawing of an empty tree.
|
![]() | TreeDrawing(ITree, Int32) |
Constructs a drawing of the given tree. T
|
![]() | TreeDrawing(ITree, Int32, IColorizer) |
Constructs a colorized drawing of the given tree.
|
Name | Description | |
---|---|---|
![]() | ChildrenWidth |
Gets the total width of the children in characters.
|
![]() | Height |
Gets the height of this tree in text lines.
|
![]() | Root |
Gets the root of the tree.
|
![]() | RootColor |
Gets the color of the root.
|
![]() | RootWidth |
Gets the width of the root in characters.
|
![]() | Width |
Gets the width of this tree in characters.
|
Name | Description | |
---|---|---|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | GetDrawing |
Returns a TreePanel displaying this drawing using
TreePanel.DefaultFont.
|
![]() | GetDrawing(Font) |
Returns a TreePanel displaying this drawing using the
given Font.
|
![]() | GetEnumerator |
Returns an IEnumerator giving the children, in order.
|
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
![]() ![]() | HorizontalSeparation |
The width in characters of the horizontal separation between two nodes.
|
![]() ![]() | VerticalSeparation |
The height in lines of text of the vertical separation between parents
and children.
|
This tree representation contains a font-independent description of the size of the drawing along with all the information necessary to draw the tree on a given graphics context using a given font.
A TreeDrawing can be constructed from an implementation of ITree and optionally an implementation of IColorizer. No attempt is made to detect cycles or overlapping subtrees; instead, a parameter to the constructor specifies the maximum height of the tree drawn.
A TreePanel containing a graphical representation can be efficiently obtained from either the GetDrawing() or the GetDrawing(Font) method. These methods return a new TreePanel each time they are called, so they can be used in multiple containers. These components will all share the same TreeDrawing.
Empty trees are not drawn, but if a node contains both empty and nonempty children, the horizontal padding that would surround a node is included for empty children. Consequently, in a binary tree, the line drawn from a node to its left child always angles to the left, and the line drawn from a node to its right child always angles to the right, even when the other child is empty. On the other hand, it may be more difficult to tell which children may be empty in trees with other branching factors.
The children, each of which is a TreeDrawing, can be obtained using the GetEnumerator() method. This method returns a System.Collections.IEnumerator of the children. This method allows a C# foreach construct to iterate through the children.