Exemplo n.º 1
0
        public VisualizedWord CalculateWordAppearence(IWeightedWord word, int itemIndex)
        {
            var fontSize = CalculateRelativeValue(Arguments.FontSizeRange, word.Weight);
            var opacity  = CalculateRelativeValue(Arguments.OpacityRange, word.Weight);
            var size     = Arguments.WordSizeCalculator(word.Text, fontSize);
            var visWord  = new VisualizedWord(word)
            {
                FontSize = fontSize,
                Opacity  = opacity,
                Size     = size
            };

            //Startpunkt in der Mitte ermitteln
            var basePoint = new Point
            {
                X = Arguments.PanelSize.Width / 2 - size.Width / 2,
                Y = Arguments.PanelSize.Height / 2 - size.Height / 2
            };
            Rect  rect;
            Point desiredPoint;

            do
            {
                desiredPoint = CalculateSpiralPoint(Radius, Phi, basePoint);
                rect         = new Rect(desiredPoint, size);
                Phi         += Rad(PhiIncreaseDegree * DegreeIncreaseCorrection);
            } while (!IsRadiusOutOfBounds && (IsRectOutOfBounds(rect) || Taken.Any(rect1 => rect.IntersectsWith(rect1))));
            // Radius Out Of Bounds is kill criterial

            Taken.Add(rect);

            visWord.Position = desiredPoint;

            if (!IsRadiusOutOfBounds)
            {
                return(visWord);
            }
            CanAddWords = false;
            return(null);
        }
Exemplo n.º 2
0
        public VisualizedWord CalculateWordAppearence(IWeightedWord word, int itemIndex)
        {
            var fontSize = CalculateRelativeValue(Arguments.FontSizeRange, word.Weight);

            var size = Arguments.WordSizeCalculator(word.Text, fontSize);

            var visualizedTag = new VisualizedWord(word)
            {
                Position = new Point(Top, itemIndex * 10),
                Opacity  = CalculateRelativeValue(Arguments.OpacityRange, word.Weight),
                FontSize = fontSize,
                Size     = size
            };

            Top += size.Height;

            if (itemIndex == 4)
            {
                CanAddWords = false;
            }

            return(visualizedTag);
        }