예제 #1
0
        public void Load(List <ThumbElement> thumbElements, int model)
        {
            if (thumbElements == null || !thumbElements.Any())
            {
                return;
            }
            Circles.Clear();

            var imageCount = thumbElements.Count;

            if (model == 0)
            {
                CircleCount = (int)Math.Ceiling(imageCount / (CircleParameter.MaxCapacityInCircle * 1d));
                if (CircleCount > CircleParameter.MaxCircleCapacity)
                {
                    CircleCount = CircleParameter.MaxCircleCapacity;
                }
                CapacityInCircle = (int)Math.Ceiling(imageCount / (CircleCount * 1d));
                if (CapacityInCircle > CircleParameter.MaxCapacityInCircle)
                {
                    CapacityInCircle = CircleParameter.MaxCapacityInCircle;
                }
            }
            else
            {
                CircleCount      = CircleParameter.MaxCircleCapacity;
                CapacityInCircle = (int)Math.Ceiling(imageCount / (CircleCount * 1d));
                if (CapacityInCircle > CircleParameter.MaxCapacityInCircle)
                {
                    CapacityInCircle = CircleParameter.MaxCapacityInCircle;
                }
            }


            var startPoint = new Point(CircleParameter.OrginalCenter.X, CircleParameter.OrginalCenter.Y - (int)(CircleCount - 1) * CircleParameter.CircleVerInterval / 2);

            for (var i = 0; i < CircleCount; i++)
            {
                var center = new Point(startPoint.X, startPoint.Y + i * CircleParameter.CircleVerInterval);
                var circle = new ImageCircle()
                {
                    Index           = i,
                    HoverColor      = Color.White,
                    SelectedColor   = Color.GreenYellow,
                    Perspective     = 4,
                    CircleCenter    = center,
                    MaxCapacity     = CapacityInCircle,
                    RevolveType     = RevolveTypes.Fixed,
                    Radius          = CircleParameter.Radius,
                    FixedAlphaAccel = CircleParameter.Alpha,
                    BackgroundColor = CircleParameter.BackgroundColor,
                    MaxImageLength  = CircleParameter.MaxImageLength,
                    ScalingOption   = CircleParameter.ScalingOption,
                    DestinationSize = CircleParameter.DestinationSize,
                };
                Circles.Add(circle);

                circle.Load(thumbElements.Skip(i * CapacityInCircle).Take(CapacityInCircle).ToList());
            }
        }
예제 #2
0
        public void Load(List <string> filePaths)
        {
            var imageCount = filePaths.Count;

            CircleCount = (int)Math.Ceiling(imageCount / (MaxCapacityInCircle * 1d));
            if (CircleCount > CircleCapacity)
            {
                CircleCount = CircleCapacity;
            }
            var startPoint = new Point(OrginalCenter.X, OrginalCenter.Y - (int)(CircleCount - 1) * CircleVerInterval / 2);

            for (var i = 0; i < CircleCount; i++)
            {
                var center = new Point(startPoint.X, startPoint.Y + i * CircleVerInterval);
                var circle = new ImageCircle()
                {
                    Index           = i,
                    BackgroundColor = BackgroundColor,
                    HoverColor      = Color.White,
                    Perspective     = 4,
                    CircleCenter    = center,
                    Radius          = Radius,
                    FixedAlphaAccel = 0.1f,
                    MaxCapacity     = MaxCapacityInCircle,
                    RevolveType     = RevolveTypes.Fixed,
                };
                Circles.Add(circle);

                var paths = new List <string>();
                for (int j = i * circle.MaxCapacity; j < (i + 1) * circle.MaxCapacity; j++)
                {
                    if (j >= filePaths.Count)
                    {
                        break;
                    }
                    paths.Add(filePaths[j]);
                }
                circle.Load(paths);
            }
        }