Class TreeVertex
This holds TreeLayout-specific information about Nodes.
Namespace: Northwoods.Go.Layouts
Assembly: Northwoods.GoDiagram.WinForms.TreeLayout.dll
Syntax
public class TreeVertex : Network<TreeVertex, TreeEdge, TreeLayout>.Vertex
Remarks
This class inherits from Network<V, E, Y>.Vertex.
Constructors
TreeVertex(TreeNetwork)
This constructs a vertex that does not know about any Node and sets its network.
Declaration
public TreeVertex(TreeNetwork network)
Parameters
Type | Name | Description |
---|---|---|
TreeNetwork | network |
Properties
Alignment
Gets or sets how this parent node should be aligned relative to its children.
Declaration
public TreeAlignment Alignment { get; set; }
Property Value
Type | Description |
---|---|
TreeAlignment |
Remarks
The default value is CenterChildren.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
Angle
Gets or sets the absolute angle at which this subtree should grow from this vertex.
Declaration
public double Angle { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is zero, meaning that general tree growth should proceed rightwards along the X axis.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass. By default this is the same as the Angle of the parent TreeVertex. However, after the initial propagation of property values, perhaps in an override of AssignTreeVertexValues(TreeVertex), you could just set this property to specify the angle at which this node grows its subtrees.
BreadthLimit
Gets or sets how broad a node and its descendants should be.
Declaration
public double BreadthLimit { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
By default this is zero. A value of zero imposes no limit; a positive value will specify a limit for the total width of this subtree.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
ChildPortSpot
Gets or sets the spot that children nodes' ports get as their ToSpot, if SetsChildPortSpot is true and the node has only a single port.
Declaration
public Spot ChildPortSpot { get; set; }
Property Value
Type | Description |
---|---|
Spot |
Remarks
The default value is Default.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass. A value of Default will cause the TreeLayout to assign a ToSpot based on the parent node's Angle. If the value is other than NoSpot, it is just assigned. When Path is Source, the port's FromSpot is set instead of the ToSpot.
Children
Gets or sets the logical children for this node.
Declaration
public TreeVertex[] Children { get; set; }
Property Value
Type | Description |
---|---|
TreeVertex[] |
Remarks
The default value is an empty array.
This structural property is computed in DoLayout(IEnumerable<Part>) when building the tree structures. You should probably not be setting this property.
ChildrenCount
This read-only property returns the number of immediate children this node has.
Declaration
public int ChildrenCount { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
The default value is zero.
CommentMargin
Gets or sets the space to leave between the node and the comments.
Declaration
public double CommentMargin { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 20.
Negative values may cause comments to overlap with the node. This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
Comments
Gets or sets an array of Nodes that will be positioned near this node.
Declaration
public IList<Node> Comments { get; set; }
Property Value
Type | Description |
---|---|
IList<Node> |
Remarks
The default value is null.
These objects should not have their own TreeVertexes to be laid out. Typically these will be Nodes whose Category is "Comment". This array should be allocated and initialized in AddComments(TreeVertex).
CommentSpacing
Gets or sets the space to leave between consecutive comments.
Declaration
public double CommentSpacing { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 10.
Negative values may cause comments to overlap. This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
Compaction
Gets or sets how the children of this node should be packed together.
Declaration
public TreeCompaction Compaction { get; set; }
Property Value
Type | Description |
---|---|
TreeCompaction |
Remarks
The default value is Block.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
Comparer
Gets or sets how the children should be sorted.
Declaration
public Comparison<TreeVertex> Comparer { get; set; }
Property Value
Type | Description |
---|---|
Comparison<TreeVertex> |
Remarks
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
DescendantCount
Gets or sets the number of descendants this node has.
Declaration
public int DescendantCount { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
For a leaf node, this will be zero.
This informational property is computed as part of the InitializeTreeVertexValues(TreeVertex) pass. You should probably not be setting this property.
Initialized
Gets or sets whether this node has been initialized as part of DoLayout(IEnumerable<Part>) when building the tree structures.
Declaration
public bool Initialized { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
The default value is false.
LayerSpacing
Gets or sets the distance between this node and its children.
Declaration
public double LayerSpacing { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 50.
Negative values may cause children to overlap with the parent. This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
LayerSpacingParentOverlap
Gets or sets the fraction of this node's depth that may overlap with the children's layer.
Declaration
public double LayerSpacingParentOverlap { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 0.0 -- there is overlap only if LayerSpacing is negative. Values must range from 0.0 to 1.0, where 1.0 means the full depth of this node.
When this value is greater than 0.0, there might not be overlap if LayerSpacing is larger than the depth of this node times this fraction. Even when this value is 0.0, there may be overlap when LayerSpacing is negative. This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
Level
Gets or sets the number of single-parent ancestors this node has.
Declaration
public int Level { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
This could also be interpreted as which layer this node is in. A root node will have a value of zero.
This informational property is computed in DoLayout(IEnumerable<Part>) when building the tree structures. You should probably not be setting this property.
MaxChildrenCount
Gets or sets the maximum number of children of any descendant of this node.
Declaration
public int MaxChildrenCount { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
For a leaf node, this will be zero.
This informational property is computed as part of the InitializeTreeVertexValues(TreeVertex) pass. You should probably not be setting this property.
MaxGenerationCount
Gets or sets the maximum depth of the subtrees below this node.
Declaration
public int MaxGenerationCount { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
For a leaf node, this will be zero.
This informational property is computed as part of the InitializeTreeVertexValues(TreeVertex) pass. You should probably not be setting this value.
NodeIndent
Gets or sets the distance the first child should be indented.
Declaration
public double NodeIndent { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is zero. The value should be non-negative.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass. This property is only sensible when the Alignment is Start or End.
NodeIndentPastParent
Gets or sets whether the first child should be indented past the parent node's breadth.
Declaration
public double NodeIndentPastParent { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 0.0 -- the only start or end spacing is provided by NodeIndent. Values must range from 0.0 to 1.0, where 1.0 means the full breadth of this node.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass. This property is only sensible when the Alignment is Start or End.
NodeSpacing
Gets or sets the distance between child nodes.
Declaration
public double NodeSpacing { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 20.
A negative value will cause sibling nodes to overlap. This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
Parent
Gets or sets the logical parent for this node.
Declaration
public TreeVertex Parent { get; set; }
Property Value
Type | Description |
---|---|
TreeVertex |
Remarks
The default value is null.
This structural property is computed in DoLayout(IEnumerable<Part>) when building the tree structures. You should probably not be setting this property.
PortSpot
Gets or sets the spot that this node's port gets as its FromSpot, if SetsPortSpot is true and the node has only a single port.
Declaration
public Spot PortSpot { get; set; }
Property Value
Type | Description |
---|---|
Spot |
Remarks
The default value is Default.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass. A value of Default will cause the TreeLayout to assign a FromSpot based on the parent node's Angle. If the value is other than NoSpot, it is just assigned. When Path is Source, the port's ToSpot is set instead of the FromSpot.
RelativePosition
Gets or sets the position of this node relative to its parent node.
Declaration
public Point RelativePosition { get; set; }
Property Value
Type | Description |
---|---|
Point |
Remarks
This informational property is computed during DoLayout(IEnumerable<Part>). You should probably not be setting this property.
RowIndent
Gets or sets the distance the first child of each row should be indented.
Declaration
public double RowIndent { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 10. The value should be non-negative.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass. This property is only used when the BreadthLimit is positive, and some initial space needs to be reserved in each row of nodes for the links that are routed around those rows.
RowSpacing
Gets or sets the distance between rows within one layer, all sharing the same parent.
Declaration
public double RowSpacing { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 25.
Negative values may cause nodes to overlap. This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
SetsChildPortSpot
Gets or sets whether the TreeLayout should set the ToSpot for each child node port.
Declaration
public bool SetsChildPortSpot { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
The default value is true -- this may modify the spots of the ports of the children nodes, if the node has only a single port.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass. The spot used depends on the value of ChildPortSpot.
SetsPortSpot
Gets or sets whether the TreeLayout should set the FromSpot for this parent node port.
Declaration
public bool SetsPortSpot { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
The default value is true -- this may modify the spot of the port of this node, the parent, if the node has only a single port.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass. The spot used depends on the value of PortSpot.
Sorting
Gets or sets whether and in what order the children should be sorted.
Declaration
public TreeSorting Sorting { get; set; }
Property Value
Type | Description |
---|---|
TreeSorting |
Remarks
The default value is Forwards.
This inherited property is initialized in the InitializeTreeVertexValues(TreeVertex) pass.
SubtreeOffset
Gets or sets the offset of this parent node relative to its whole subtree.
Declaration
public Point SubtreeOffset { get; set; }
Property Value
Type | Description |
---|---|
Point |
Remarks
This informational property is computed during DoLayout(IEnumerable<Part>). Of course if there are no children, this is just (0, 0). You should probably not be setting this property.
SubtreeSize
Gets or sets the size of the subtree (including all descendants) parented by this node.
Declaration
public Size SubtreeSize { get; set; }
Property Value
Type | Description |
---|---|
Size |
Remarks
This informational property is computed during DoLayout(IEnumerable<Part>). Of course if there are no children, this is just the same as Size. You should probably not be setting this property.
Methods
CopyInheritedPropertiesFrom(TreeVertex)
Copy inherited properties from another TreeVertex to this one.
Declaration
public virtual void CopyInheritedPropertiesFrom(TreeVertex copy)
Parameters
Type | Name | Description |
---|---|---|
TreeVertex | copy |