Esempio n. 1
0
        /// <summary>
        /// displays the database
        /// </summary>
        /// <param name="db"></param>
        /// <param name="curves"></param>
        static public void ShowDataBase(Database db, params Splines.ICurve[] curves)
        {
            Microsoft.Msagl.Drawing.Graph g = new Microsoft.Msagl.Drawing.Graph("");
            AllocateDebugCurves(g);

            Microsoft.Msagl.Splines.Rectangle graphBox = new Microsoft.Msagl.Splines.Rectangle(db.Anchors[0].LeftTop);

            List <ICurve> cl = new List <ICurve>(curves);

            foreach (Anchor a in db.Anchors)
            {
                graphBox.Add(a.LeftTop);
                graphBox.Add(a.RightBottom);
                cl.Add(a.PolygonalBoundary);
            }

            AddCurvesToGraph(cl, g);

            Microsoft.Msagl.Point del = (graphBox.LeftBottom - graphBox.RightTop) / 10;
            graphBox.Add(graphBox.LeftBottom + del);
            graphBox.Add(graphBox.RightTop - del);
            GeometryGraph gg = new GeometryGraph();

            gg.BoundingBox  = graphBox;
            g.DataBase      = db;
            g.GeometryGraph = gg;
            DisplayGraph(g);
            db.nodesToShow = null;
        }
Esempio n. 2
0
        private static void ShowCurvesWithColorsSet(IEnumerable <Microsoft.Msagl.Splines.ICurve> curves,
                                                    Microsoft.Msagl.Drawing.Graph g)
        {
            AllocateDebugCurves(g);
            //   g.ShowControlPoints = true;

            Microsoft.Msagl.Splines.Rectangle graphBox = new Microsoft.Msagl.Splines.Rectangle();

            AddCurvesToGraph(curves, g);
            bool firstTime = true;

            foreach (Microsoft.Msagl.Splines.ICurve c0 in curves)
            {
                if (c0 != null)
                {
                    Microsoft.Msagl.Splines.Parallelogram b = c0.ParallelogramNodeOverICurve.Parallelogram;

                    for (int i = 0; i < 4; i++)
                    {
                        if (firstTime)
                        {
                            firstTime = false;
                            graphBox  = new Rectangle(b.Vertex((VertexId)i));
                        }
                        graphBox.Add(b.Vertex((VertexId)i));
                    }
                }
            }

            Microsoft.Msagl.Point del = (graphBox.LeftBottom - graphBox.RightTop) / 10;
            graphBox.Add(graphBox.LeftBottom + del);
            graphBox.Add(graphBox.RightTop - del);
            GeometryGraph gg = new GeometryGraph();

            gg.BoundingBox  = graphBox;
            g.GeometryGraph = gg;
            try {
                DisplayGraph(g);
            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }