예제 #1
0
        private void ResizeBmp(Bitmap bmp, MemoryStream result, int width, int height)
        {
            Bitmap resizedBmp = OrgChartHelper.ResizeImage(bmp, width, height, false);

            //after resize - change the coordinates of the list, in order return the proper coordinates
            resizedBmp.Save(result, this.option.ImageFormat);
            resizedBmp.Dispose();
        }
예제 #2
0
        /// <summary>
        /// 组织机构图表生成器
        /// </summary>
        /// <param name="nodes"></param>
        /// <param name="option"></param>
        public OrgChartGenerator(List <OrgChartNode> nodes, OrgChartOption option)
        {
            this.nodes = nodes;

            if (option != null)
            {
                this.option = option;
            }

            this.rootNode = OrgChartHelper.BuildTree(this.nodes);

            int maxLevelNodesCount = (from node in nodes
                                      group node by node.Level into gp
                                      select new { Level = gp.Key, Count = gp.Count() }
                                      ).Max(item => item.Count);

            this.isSampleTree = maxLevelNodesCount < this.option.SampeTreeLevelCount;

            if (this.option.UseDefaultIfSampleTree && this.isSampleTree)
            {
                this.option = this.DefaultOption;
            }
        }