Exemplo n.º 1
0
        /// <summary>
        /// Create all objects for sculpture generation on a project
        /// </summary>
        /// <param name="proj">project to edit</param>
        /// <param name="gs">generated sculpture</param>
        public void CreateProjectObject(Project proj, GeneratedSculpture gs)
        {
            Granne.Init();
            SortedSet <Granne> set = this.SortGranne(this.GenerateGrannes());
            uint trueWidth = 0, trueHeight = 0;
            uint countX = 0, countY = 0;

            if (Granne.TrueRectangle.Width > 0)
            {
                trueWidth = (uint)Granne.TrueRectangle.Width;
            }
            if (Granne.TrueRectangle.Height > 0)
            {
                trueHeight = (uint)Granne.TrueRectangle.Height;
            }
            if (Granne.Size.Width > 0)
            {
                countX = (uint)Granne.Size.Width;
            }
            if (Granne.Size.Height > 0)
            {
                countY = (uint)Granne.Size.Height;
            }
            Granne[,] tab2D = new Granne[countX, countY];
            foreach (Granne g in set)
            {
                g.InsertIntoArray(tab2D);
            }
            gs.CreateDestination(proj, trueWidth, trueHeight, countX, countY);
            this.FillObjects(proj, gs, tab2D);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generate grannes
        /// </summary>
        /// <returns>hash set of granne</returns>
        private HashSet <Granne> GenerateGrannes()
        {
            Granne.Init();
            Granne.ComputeGranne(this.Cadres);
            HashSet <Granne> grannes = new HashSet <Granne>();

            foreach (CadreModel c in this.Cadres)
            {
                Granne.SetTrueRect(c.WidthPosition, c.HeightPosition, c.WidthPosition + c.Width, c.HeightPosition + c.Height);
            }
            foreach (CadreModel c in this.Cadres)
            {
                grannes.Add(new Granne(c, c.WidthPosition, c.HeightPosition, c.Width, c.Height));
            }
            return(grannes);
        }