Example #1
0
        public ReqTraceDotNode(int nYOffset,
                               ReqTraceNode reqTraceNode) : base(nYOffset, reqTraceNode)
        {
            int[]  nTraceToX;
            int[]  nTraceToY;
            string strCurrent;
            int    nTraces;
            bool   bAdditionalTraces;
            string strAttribute = "";

            strDOT = "";

            strCurrent = CoordToString(nXPos, nYPos);

            if (reqTraceNode.IsRootNode)
            {
                strAttribute = "style=filled, fillcolor=\"#C8FFC8\", ";
            }

            strDOT = "  " + strCurrent + " [shape = record, " + strAttribute + "label=\"{" +
                     DotFormat(reqTraceNode.TagName.Replace("\"", "\\\""), 2) +
                     "|" +
                     DotFormat(reqTraceNode.Text.Replace("\"", "\\\""), 8) + "}\"];\r\n";

            if (reqTraceNode.AreTooManyTracesTo(out nTraces, out bAdditionalTraces))
            {
                strDOT += "  " + strCurrent +
                          "_To [shape=none, label=\"" +
                          (bAdditionalTraces ? "+" : "") + nTraces.ToString() + " REQs\"];\r\n";
                strDOT += "  " + strCurrent + " -> " + strCurrent + "_To;\r\n";
            }

            if (reqTraceNode.AreTooManyTracesFrom(out nTraces, out bAdditionalTraces))
            {
                strDOT += "  " + strCurrent +
                          "_From [shape=none, label=\"" +
                          (bAdditionalTraces ? "+" : "") + nTraces.ToString() + " REQs\"];\r\n";
                strDOT += "  " + strCurrent + "_From -> " + strCurrent + ";\r\n";
            }

            reqTraceNode.GetTraceToCoord(out nTraceToX, out nTraceToY);

            for (int i = nTraceToX.GetLength(0) - 1; i >= 0; i--)
            {
                if ((nTraceToX[i] != int.MinValue) && (reqTraceNode.X != int.MinValue))
                {
                    strDOT += "  " + strCurrent + " -> " + CoordToString(nTraceToX[i], nYOffset - nTraceToY[i]) + ";\r\n";
                }
            }
        }
        public ReqTraceUIGraphNode(int nYOffset,
                                   ReqTraceNode reqTraceNode) : base(nYOffset, reqTraceNode)
        {
            TextBox tb;
            ToolTip tt;
            int     nTraces;
            bool    bAdditionalTraces;

            int[] nTraceToX;
            int[] nTraceToY;

            this.reqTraceNode = reqTraceNode;

            tb           = new TextBox();
            tb.Location  = new Point(nXPos * nXSpacing + nXSpacing / 2, nYPos * nYSpacing + nYSpacing / 2);
            tb.Size      = sizeTagName;
            tb.Multiline = true;
            tb.ReadOnly  = true;
            tb.Text      = reqTraceNode.TagName;
            if (reqTraceNode.IsRootNode)
            {
                tb.BackColor = Color.FromArgb(200, 255, 200);
            }
            tt           = new ToolTip();
            tt.BackColor = Color.Yellow;
            tt.SetToolTip(tb, reqTraceNode.TagName);
            tb.ContextMenuStrip = mnuCtxTag;
            tb.MouseEnter      += tb_MouseEnter;
            ctrls.Add(tb);
            tbReqTag = tb;

            tb                  = new TextBox();
            tb.Location         = new Point(nXPos * nXSpacing + nXSpacing / 2, nYPos * nYSpacing + sizeTagName.Height + nYSpacing / 2);
            tb.Size             = sizeText;
            tb.Multiline        = true;
            tb.ReadOnly         = true;
            tb.ScrollBars       = ScrollBars.Vertical;
            tb.Text             = reqTraceNode.Text;
            tb.ContextMenuStrip = mnuCtxName;
            tb.MouseEnter      += tb_MouseEnter;
            ctrls.Add(tb);
            tbReqText = tb;

            arrFGUI = new List <ReqTraceUI>();
            arrBGUI = new List <ReqTraceUI>();

            if (reqTraceNode.AreTooManyTracesFrom(out nTraces, out bAdditionalTraces))
            {
                arrBGUI.Add(new ReqTraceUIArrowDwn(nTraces, bAdditionalTraces,
                                                   nXPos * nXSpacing + nXSpacing / 2 + sizeTagName.Width / 2,
                                                   nYPos * nYSpacing + nYSpacing / 2));
            }

            if (reqTraceNode.AreTooManyTracesTo(out nTraces, out bAdditionalTraces))
            {
                arrBGUI.Add(new ReqTraceUIArrowUp(nTraces, bAdditionalTraces,
                                                  nXPos * nXSpacing + nXSpacing / 2 + sizeTagName.Width / 2,
                                                  nYPos * nYSpacing + sizeTagName.Height + sizeText.Height + nYSpacing / 2));
            }

            reqTraceNode.GetTraceToCoord(out nTraceToX, out nTraceToY);

            for (int i = nTraceToX.GetLength(0) - 1; i >= 0; i--)
            {
                if ((nTraceToX[i] != int.MinValue) && (reqTraceNode.X != int.MinValue))
                {
                    arrFGUI.Add(new ReqTraceUITraceArrow(
                                    nXPos * nXSpacing + sizeText.Width / 2 + nXSpacing / 2,
                                    nYPos * nYSpacing + sizeTagName.Height + sizeText.Height + nYSpacing / 2,
                                    nTraceToX[i] * nXSpacing + sizeText.Width / 2 + nXSpacing / 2,
                                    (nYOffset - nTraceToY[i]) * nYSpacing + nYSpacing / 2));
                }
            }
        }