/// <summary> /// Determine the Y-axis coordinate for this node /// </summary> /// <param name="iVerticalOffset">vertical offset up to this node</param> /// <param name="Tree">the tree itself</param> /// <param name="grfx">grpahics info</param> public void CalculateYCoordinate(int iVerticalOffset, LingTreeTree Tree, Graphics grfx) { LingTreeNode Node; // Determine Y-axis coordinates for this node YCoord = iVerticalOffset; YLowerMid = YCoord + Height + m_iYCoordAdjustment; YUpperMid = YCoord - m_iYCoordAdjustment; if (YLowerMid > Tree.YSize) { Tree.YSize = YLowerMid; // Keep track of total height for scrolling } if (Type == NodeType.Lex) { // keep track of lowest for "flat" view if (YCoord > Tree.LexBottomYCoord) { Tree.LexBottomYCoord = YCoord; } if (YUpperMid > Tree.LexBottomYUpperMid) { Tree.LexBottomYUpperMid = YUpperMid; } } if (Type == NodeType.Gloss) { // keep track of lowest for "flat" view if (YCoord > Tree.GlossBottomYCoord) { Tree.GlossBottomYCoord = YCoord; } } // Determine Y-axis coordinate for any daughters Node = Daughter; while (Node != null) { int iDaughterYCoordinate = YCoord + Tree.GetMaxLevelHeight(Level); if (Node.Type != NodeType.Gloss) { iDaughterYCoordinate += Tree.VerticalGap; } else { iDaughterYCoordinate += Tree.LexGlossGapAdjustment; } Node.CalculateYCoordinate(iDaughterYCoordinate, Tree, grfx); Node = Node.Sister; } }
/////////////////////////////////////////////////////////////////////////////// // NAME // CalculateMaxHeight // ARGUMENTS // pTree - pointer to tree this node is in // pDC - pointer to the device context // DESCRIPTION // Determine the maximum height at each level in the tree // It assumes that the height of this and all other nodes hav already been established // RETURN VALUE // none // public void CalculateMaxHeight(LingTreeTree Tree, Graphics grfx) { LingTreeNode Node; // Determine the height for this node CalculateHeight(Tree, grfx); // calculate max height of all daughters Node = Daughter; while (Node != null) { Node.CalculateMaxHeight(Tree, grfx); Node = Node.Sister; } // set tree's maximum height at this node's level if (Tree.GetMaxLevelHeight(Level) < Height) { Tree.SetMaxLevelHeight(Level, Height); } }
/// <summary> /// Determine the Y-axis coordinate for this node /// </summary> /// <param name="iVerticalOffset">vertical offset up to this node</param> /// <param name="Tree">the tree itself</param> /// <param name="grfx">grpahics info</param> public void CalculateYCoordinate(int iVerticalOffset, LingTreeTree Tree, Graphics grfx) { LingTreeNode Node; // Determine Y-axis coordinates for this node YCoord = iVerticalOffset; YLowerMid = YCoord + Height + m_iYCoordAdjustment; YUpperMid = YCoord - m_iYCoordAdjustment; if (YLowerMid > Tree.YSize) Tree.YSize = YLowerMid; // Keep track of total height for scrolling if (Type == NodeType.Lex) { // keep track of lowest for "flat" view if (YCoord > Tree.LexBottomYCoord) Tree.LexBottomYCoord = YCoord; if (YUpperMid > Tree.LexBottomYUpperMid) Tree.LexBottomYUpperMid = YUpperMid; } if (Type == NodeType.Gloss) { // keep track of lowest for "flat" view if (YCoord > Tree.GlossBottomYCoord) Tree.GlossBottomYCoord = YCoord; } // Determine Y-axis coordinate for any daughters Node = Daughter; while (Node != null) { int iDaughterYCoordinate = YCoord + Tree.GetMaxLevelHeight(Level); if (Node.Type != NodeType.Gloss) iDaughterYCoordinate += Tree.VerticalGap; else iDaughterYCoordinate += Tree.LexGlossGapAdjustment; Node.CalculateYCoordinate(iDaughterYCoordinate, Tree, grfx); Node = Node.Sister; } }
/////////////////////////////////////////////////////////////////////////////// // NAME // CalculateMaxHeight // ARGUMENTS // pTree - pointer to tree this node is in // pDC - pointer to the device context // DESCRIPTION // Determine the maximum height at each level in the tree // It assumes that the height of this and all other nodes hav already been established // RETURN VALUE // none // public void CalculateMaxHeight(LingTreeTree Tree, Graphics grfx) { LingTreeNode Node; // Determine the height for this node CalculateHeight(Tree, grfx); // calculate max height of all daughters Node = Daughter; while (Node != null) { Node.CalculateMaxHeight(Tree, grfx); Node = Node.Sister; } // set tree's maximum height at this node's level if (Tree.GetMaxLevelHeight(Level) < Height) Tree.SetMaxLevelHeight(Level , Height); }