Exemple #1
0
        public void ApplyLayout(object layout)
        {
            TreeLayout tl = layout as TreeLayout;

            if (tl != null)
            {
                tl.Arrange(flowchart);
                return;
            }

#if !FCNET_STD
            SpringLayout sl = layout as SpringLayout;
            if (sl != null)
            {
                sl.Arrange(flowchart);
                return;
            }

            LayeredLayout ll = layout as LayeredLayout;
            if (ll != null)
            {
                ll.Arrange(flowchart);
                return;
            }

            GridLayout gl = layout as GridLayout;
            if (gl != null)
            {
                gl.Arrange(flowchart);
                return;
            }
#endif
        }
Exemple #2
0
        void PrintGraph(SemanticWebUsersLevel web)
        {
            DD.ClearAll();
            Dictionary <int, DiagramNode> nodeMap = new Dictionary <int, DiagramNode>();

            foreach (var node in web.Nodes)
            {
                var diagramNode = DD.Factory.CreateShapeNode(bounds);
                //diagramNode.Brush = new LinearGradientBrush(new GradientStopCollection
                nodeMap[node.ID] = diagramNode;
                diagramNode.Text = node.Name;
                diagramNode.Tag  = node;
            }


            foreach (var arc in web.Arcs)
            {
                if (!arc.Name.Contains("_#"))
                {
                    var diagramArc =
                        DD.Factory.CreateDiagramLink(nodeMap[arc.From.ID], nodeMap[arc.To.ID]);
                    diagramArc.Text = arc.Name;
                }
            }
            load = false;
            // arrange the graph(расстановка)
            var layout = new LayeredLayout();

            layout.Arrange(DD);
            //sbState.Style = (Style)FindResource("ReadySBStyle");
        }
Exemple #3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            //this.diagram1.DefaultShape = Shapes.Rectangle;
            Dictionary <string, DiagramNode> nodeMap = new Dictionary <string, DiagramNode>();
            var bounds = new RectangleF(0, 0, 30, 20);

            XmlNodeList nodes = xmlDiagram.SelectNodes("/ArrayOfDiagramElements/DiagramElements/elementName");

            foreach (XmlElement node in nodes)
            {
                ShapeNode diagramNode = diagram2.Factory.CreateShapeNode(bounds);
                nodeMap[node.GetAttribute("id")] = diagramNode;
                diagramNode.Text = node.InnerText;
            }

            // Arrange the graph
            LayeredLayout layout = new LayeredLayout();

            layout.LayerDistance = 12;
            layout.Arrange(diagram2);
        }