Exemple #1
0
        private void RotateBlocks()
        {
            rotateTransform.Rotation = rotateTransformLambda(CalculateRotationAngle());

            foreach (var textBlock in tagBlocks)
            {
                Point3D newPoint;
                if (rotateTransform.TryTransform(textBlock.CenterPoint, out newPoint))
                {
                    textBlock.CenterPoint = newPoint;

                    if (TopItem == null || TopItem.CenterPoint.Z < newPoint.Z)
                    {
                        if (TopItem != null)
                        {
                            TopItem.SetAsTop(false);
                        }

                        TopItem = textBlock;
                        TopItem.SetAsTop(true);
                    }

                    textBlock.Redraw(ActualWidth / 2, ActualHeight / 2);
                }
            }
        }
        public void SetTags(string[] list)
        {
            tags = list;
            TopItem = null;

            if (!isLoaded)
            {
                return;
            }

            Children.Clear();
            FillTags();
        }
Exemple #3
0
        public void SetTags(string[] list)
        {
            tags    = list;
            TopItem = null;

            if (!isLoaded)
            {
                return;
            }

            Children.Clear();
            FillTags();
        }
Exemple #4
0
        private void FillTags()
        {
            tagBlocks = new List <TagItem>();

            var radius = ActualWidth / 3;
            var max    = tags.Length;

            for (var i = 1; i < max + 1; i++)
            {
                var phi   = Math.Acos(-1.0 + (2.0 * i - 1.0) / max);
                var theta = Math.Sqrt(max * Math.PI) * phi;
                var x     = radius * Math.Cos(theta) * Math.Sin(phi);
                var y     = radius * Math.Sin(theta) * Math.Sin(phi);
                var z     = radius * Math.Cos(phi);

                var tag = new TagItem(x, y, z, tags[i - 1]);
                tag.Redraw(Width / 2, Height / 2);

                Children.Add(tag);
                tagBlocks.Add(tag);
            }
        }
        private void RotateBlocks()
        {
            rotateTransform.Rotation = rotateTransformLambda(CalculateRotationAngle());

            foreach (var textBlock in tagBlocks)
            {
                Point3D newPoint;
                if (rotateTransform.TryTransform(textBlock.CenterPoint, out newPoint))
                {
                    textBlock.CenterPoint = newPoint;

                    if (TopItem == null || TopItem.CenterPoint.Z < newPoint.Z)
                    {
                        if (TopItem != null)
                        {
                            TopItem.SetAsTop(false);
                        }

                        TopItem = textBlock;
                        TopItem.SetAsTop(true);
                    }

                    textBlock.Redraw(ActualWidth / 2, ActualHeight / 2);
                }
            }
        }
        private void FillTags()
        {
            tagBlocks = new List<TagItem>();

            var radius = ActualWidth / 3;
            var max = tags.Length;

            for (var i = 1; i < max + 1; i++)
            {
                var phi = Math.Acos(-1.0 + (2.0 * i - 1.0) / max);
                var theta = Math.Sqrt(max * Math.PI) * phi;
                var x = radius * Math.Cos(theta) * Math.Sin(phi);
                var y = radius * Math.Sin(theta) * Math.Sin(phi);
                var z = radius * Math.Cos(phi);

                var tag = new TagItem(x, y, z, tags[i - 1]);
                tag.Redraw(Width / 2, Height / 2);

                Children.Add(tag);
                tagBlocks.Add(tag);
            }
        }