예제 #1
0
 public void Arrange()
 {
     if (_layout != null)
     {
         _layout.Arrange(this);
         OnLayoutDone();
     }
 }
예제 #2
0
        private void BuildLayout()
        {
            if (m_Words == null) { return; }

            using (Graphics graphics = this.CreateGraphics())
            {
                IGraphicEngine graphicEngine =
                    new GdiGraphicEngine(graphics, this.Font.FontFamily, FontStyle.Regular, m_Palette, MinFontSize, MaxFontSize, m_MinWordWeight, m_MaxWordWeight);
                m_Layout = LayoutFactory.CrateLayout(m_LayoutType, this.Size);
                m_Layout.Arrange(m_Words, graphicEngine);
            }
        }
예제 #3
0
        private T Process <T>(
            Func <IGraphicEngine <TBitmap>, IEnumerable <LayoutItem>, T> handler)
        {
            // Arrange word cloud.
            var size = new SizeD(wordCloud.Width, wordCloud.Height);

            layout.Arrange(wordCloud.Entries, engine);

            // Process results.
            var area = new RectangleD(new PointD(0, 0), size);

            return(handler(engine, layout.GetWordsInArea(area)));
        }
예제 #4
0
        private void BuildLayout()
        {
            if (m_Terms == null)
            {
                return;
            }

            using (Graphics graphics = this.CreateGraphics())
            {
                IGraphicEngine graphicEngine =
                    new GdiGraphicEngine(graphics, this.Font.FontFamily, FontStyle.Regular, m_Palette, MinFontSize, MaxFontSize, m_MinTermWeight, m_MaxTermWeight);
                m_Layout = LayoutFactory.CrateLayout(m_LayoutType, this.Size);
                m_Layout.Arrange(m_Terms, graphicEngine);
            }
        }
예제 #5
0
        private void BuildLayout()
        {
            if (m_Words == null)
            {
                return;
            }

            using (CanvasDrawingSession ds = _DrawingCanvas.CreateDrawingSession())
            {
                IGraphicEngine graphicEngine = new GdiGraphicEngine(ds, FontStyle, FontFamily, m_Palette, MinFontSize, MaxFontSize, m_MinWordWeight, m_MaxWordWeight);

                m_Layout = LayoutFactory.CrateLayout(m_LayoutType, new Size(this.ActualWidth, this.ActualHeight));
                m_Layout.Arrange(m_Words, graphicEngine);
            }
        }
예제 #6
0
        public void BuildLayout()
        {
            m_Layout   = LayoutFactory.CrateLayout(m_LayoutType, this.Size);
            ItemsCount = 0;
            if (m_Words == null || m_Words.Count == 0)
            {
                return;
            }

            CaclulateMinMaxWordWeights();

            using (Graphics graphics = this.CreateGraphics())
            {
                IGraphicEngine graphicEngine =
                    new GdiGraphicEngine(graphics, this.Font.FontFamily, FontStyle.Regular, m_Palette, MinFontSize, MaxFontSize, m_MinWordWeight, m_MaxWordWeight);
                ItemsCount = m_Layout.Arrange(this.m_Words, graphicEngine);
            }
        }
예제 #7
0
        private void BuildLayout()
        {
            if (m_Words == null)
            {
                return;
            }

            using (Graphics graphics = CreateGraphics())
                using (GdiGraphicEngine graphicEngine =
                           new GdiGraphicEngine(graphics, m_Palette, m_MinWordWeight, m_MaxWordWeight))
                {
                    graphicEngine.FontFamily  = Font.FontFamily;
                    graphicEngine.FontStyle   = FontStyle.Regular;
                    graphicEngine.MinFontSize = MinFontSize;
                    graphicEngine.MaxFontSize = MaxFontSize;
                    m_Layout = LayoutFactory.CreateLayout(m_LayoutType, Size);
                    m_Layout.Arrange(m_Words, graphicEngine);
                }
        }
        protected void BuildLayout()
        {
            if (m_Words == null || !m_Words.Any())
            {
                return;
            }

            using (Graphics graphics = this.CreateGraphics())
            {
                var engine = NewGraphicEngine(graphics,
                                              Font.FontFamily,
                                              FontStyle.Regular,
                                              m_Palette,
                                              m_MinFontSize,
                                              m_MaxFontSize,
                                              m_MinWordWeight,
                                              m_MaxWordWeight);

                m_Layout = CreateLayout(m_LayoutType, this.Size);
                m_Layout.Arrange(m_Words, engine);
            }
        }
        public Size CalculateMinimumRequiredTotalSize(out ILayout layout, out IEnumerable <LayoutItem> wordsToDraw)
        {
            Size requiredSize = Size.Empty;

            using (Graphics graphics = this.CreateGraphics())
            {
                var engine = NewGraphicEngine(graphics,
                                              this.Font.FontFamily,
                                              FontStyle.Regular,
                                              m_Palette,
                                              m_MinFontSize,
                                              m_MaxFontSize,
                                              m_MinWordWeight,
                                              m_MaxWordWeight);

                int numAllWords = m_Words.Count();
                wordsToDraw = null;

                var   trySize = new SizeF(640, 480);
                float xInc = (trySize.Width / 4), yInc = (trySize.Height / 4);

                do
                {
                    layout = CreateLayout(m_LayoutType, trySize);

                    if (layout.Arrange(m_Words, engine) == numAllWords)
                    {
                        wordsToDraw  = layout.GetWordsInArea(new RectangleF(new PointF(0, 0), trySize));
                        requiredSize = Size.Ceiling(trySize);
                    }
                    else
                    {
                        trySize = new SizeF(trySize.Width + xInc, trySize.Height + yInc);
                    }
                }while (requiredSize.IsEmpty);
            }

            return(requiredSize);
        }