protected override void OnPaint(PaintEventArgs e) { var node = TestData.TestNode; var node2 = TestData.TestNode; var tree = new ColumnTree { Roots = new List <PHLibrary.Arithmetic.TreeToRectangle.ColumnTreeNode> { node, node2 } }; Draw(tree, panel.CreateGraphics()); var simpleTree = new ColumnTree { Roots = new List <ColumnTreeNode> { //root1 new ColumnTreeNode { CanSpanRows = true }, //root2 new ColumnTreeNode { Children = new List <ColumnTreeNode> { new ColumnTreeNode() } } } }; Draw(simpleTree, panel2.CreateGraphics()); }
/// <summary> /// Clears the tree data /// </summary> private void ClearTreeData() { _zoneTree = null; _columnTree = null; _rootZoneNode = null; _rootDomNode = null; _rootColumnNode = null; }
public System.IO.Stream Create(DataTable dataTable, ColumnTree columnTree, CellStyleSettings cellStyleSettings = null) { return(Create(new List <DataTable> { dataTable }, new List <ColumnTree> { columnTree }, cellStyleSettings)); }
/// <summary> /// Sets the zone tree /// </summary> /// <param name="zoneTree">The zone tree</param> private void SetZoneTree(ZoneTree zoneTree) { this.ClearTreeData(); if (zoneTree != null) { _zoneTree = zoneTree; _columnTree = _appServices.CreateColumnTree(zoneTree); _rootDomNode = new ElementTreeNode(_zoneTree.Document.Body); _rootZoneNode = new ZoneTreeNode(_zoneTree.Root); _rootColumnNode = new ColumnTreeNode(_columnTree.Root); } }
public void TreeNodeTest() { var tree = new ColumnTree { Roots = new List <ColumnTreeNode> { TestNode } }; var retangles = tree.CalculateRetangles(); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(retangles)); Assert.AreEqual(11, retangles.Count); }
/// <summary> /// Builds a column tree /// </summary> /// <param name="zoneTree">The zone tree</param> /// <param name="collapseBranches">Whether to collapse branches and merge children</param> /// <returns> /// The created column tree /// </returns> public ColumnTree Build(ZoneTree zoneTree, bool collapseBranches) { _count = 0; var rootNode = this.CreateColumn(null, zoneTree.Root); this.Build(rootNode); var tree = new ColumnTree(rootNode, zoneTree); if (collapseBranches) { tree.Accept(new CollapseBranches(_tolerance), new BreadthFirstWalkerFactory().CreateReversed()); } return(tree); }
private ColumnTree CreateColumnTree(DataTable table) { ColumnTree columnTree = new ColumnTree(); var roots = new List <ColumnTreeNode>(); for (int i = 0; i < table.Columns.Count; i++) { var column = table.Columns[i]; roots.Add(new ColumnTreeNode { Title = column.ColumnName }); } columnTree.Roots = roots; return(columnTree); }
public void Draw(ColumnTree tree, System.Drawing.Graphics formGraphics) { // var retangles = node.CalculateRetangles(0, node.MaxDepth); var retangles = tree.CalculateRetangles(); foreach (var c in retangles) { label1.Text += c.ToString() + Environment.NewLine; System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush (Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256))); formGraphics.FillRectangle(myBrush, new Rectangle( c.RetanglePosition.X * 20, c.RetanglePosition.Y * 20, c.RetangleSize.Width * 20, c.RetangleSize.Height * 20)); myBrush.Dispose(); } }
/// <summary> /// 递归模块列表,返回按级别排序 /// </summary> public List <ColumnTree> RecursiveModule(List <ColumnTree> list, ColumnTree model) { var nodeList = new List <ColumnTree>(); var children = list.Where(t => t.ColumnId == model.Id).OrderBy(m => m.Sort); if (children.Any()) { foreach (var item in children) { nodeList.Add(new ColumnTree() { Id = item.Id, ColumnId = item.ColumnId, Name = item.Name, Href = item.Href + item.Id, TempId = item.TempId, Sort = item.Sort, children = RecursiveModule(list, item) }); } } return(nodeList); }
/// <summary> /// 递归模块列表,返回按级别排序 /// </summary> public List <ColumnTree> RecursiveModule(List <ColumnTree> list, ColumnTree model, bool isAdmin = false) { var nodeList = new List <ColumnTree>(); var children = list.Where(t => t.ColumnId == model.Id).OrderBy(m => m.Sort); if (children.Any()) { foreach (var item in children) { nodeList.Add(new ColumnTree() { Id = item.Id, ColumnId = item.ColumnId, Name = item.Name, Href = isAdmin ? "/fytadmin/cms/article/?column=" + item.Id : item.Href + item.Id, TempId = item.TempId, Sort = item.Sort, children = RecursiveModule(list, item, isAdmin) }); } } return(nodeList); }
public ExceHeaderCreatorEPPlus(ColumnTree tree, ExcelWorksheet sheet) { this.sheet = sheet; this.Tree = tree; }
public System.IO.Stream Create(DataSet dataset, ColumnTree columnTree, CellStyleSettings cellStyleSettings = null) { return(Create(FetchFrom(dataset), new List <ColumnTree> { columnTree }, cellStyleSettings)); }
public MatchTreeNode(DcTable set, ColumnTree parent = null) : base(set, parent) { }
public MatchTreeNode(DcColumn dim, ColumnTree parent = null) : base(dim, parent) { }
/// <summary> /// Labels the article content using the layout analysis algorithm /// </summary> /// <param name="columnTree">The column tree</param> internal void LayoutAnalysisArticleContentLabeling(ColumnTree columnTree) { _layoutAnalysisArticleContentLabeler.Execute(columnTree); }