示例#1
0
        /**********************************************************************
         *********************************************************************/
        public void DrawRouters()
        {
            String[,] tableContents = DijkstraAlgorithm.GetTableValues();
            String visitedNodes = tableContents[currentStep, 8];

            DrawRouter(routerZ, "Z", visitedNodes.Contains('z'));
            DrawRouter(routerU, "U", visitedNodes.Contains('u'));
            DrawRouter(routerV, "V", visitedNodes.Contains('v'));
            DrawRouter(routerW, "W", visitedNodes.Contains('w'));
            DrawRouter(routerX, "X", visitedNodes.Contains('x'));
            DrawRouter(routerY, "Y", visitedNodes.Contains('y'));
        }
示例#2
0
        /**********************************************************************
         *********************************************************************/
        public static void DrawTableContents()
        {
            String[,] tableContents = DijkstraAlgorithm.GetTableValues();

            String visitedNodes = tableContents[currentStep, 8];


            for (int i = 0; i <= currentStep; i++)
            {
                // check which is the current table row and write text in this row
                int round = Int32.Parse(tableContents[i, 1]);

                float yValueContent = 0;
                switch (round)
                {
                case 0: yValueContent = yPercent(0.615f); break;

                case 1: yValueContent = yPercent(0.665f); break;

                case 2: yValueContent = yPercent(0.715f); break;

                case 3: yValueContent = yPercent(0.765f); break;

                case 4: yValueContent = yPercent(0.815f); break;

                case 5: yValueContent = yPercent(0.865f); break;
                }

                canvas.DrawText(tableContents[i, 2], new SKPoint(xPercent(0.2f), yValueContent), sk_TableCaption);
                canvas.DrawText(tableContents[i, 3], new SKPoint(xPercent(0.34f), yValueContent), sk_TableCaption);
                canvas.DrawText(tableContents[i, 4], new SKPoint(xPercent(0.48f), yValueContent), sk_TableCaption);
                canvas.DrawText(tableContents[i, 5], new SKPoint(xPercent(0.62f), yValueContent), sk_TableCaption);
                canvas.DrawText(tableContents[i, 6], new SKPoint(xPercent(0.76f), yValueContent), sk_TableCaption);
                canvas.DrawText(tableContents[i, 7], new SKPoint(xPercent(0.9f), yValueContent), sk_TableCaption);


                char visitedNodeToMark = visitedNodes[round];
                yValueContent = yValueContent - yPercent(0.05f); //previous row/round

                // every new round/ every 7th step
                if (i % 6 == 0)
                {
                    //overdraw the previously visited connection in red
                    switch (visitedNodeToMark)
                    {
                    // v = 1st step previous row (i-5) , w = 2nd step..., x = 3rd step..., y = 4th step..., z = 5th step...
                    case 'v':
                        canvas.DrawText(tableContents[i - 5, 3], new SKPoint(xPercent(0.34f), yValueContent), sk_TableCaptionRed);
                        break;

                    case 'w':
                        canvas.DrawText(tableContents[i - 4, 4], new SKPoint(xPercent(0.48f), yValueContent), sk_TableCaptionRed);
                        break;

                    case 'x':
                        canvas.DrawText(tableContents[i - 3, 5], new SKPoint(xPercent(0.62f), yValueContent), sk_TableCaptionRed);
                        break;

                    case 'y':
                        canvas.DrawText(tableContents[i - 2, 6], new SKPoint(xPercent(0.76f), yValueContent), sk_TableCaptionRed);
                        break;

                    case 'z':
                        canvas.DrawText(tableContents[i - 1, 7], new SKPoint(xPercent(0.9f), yValueContent), sk_TableCaptionRed);
                        break;
                    }
                }
            }
        }