Clone() public méthode

public Clone ( ) : DnaPolygon
Résultat DnaPolygon
Exemple #1
0
        internal DnaDrawing Clone()
        {
            var drawing = new DnaDrawing
            {
                Polygons = new List <DnaPolygon>(),
                //SourceImage = SourceImage,
            };

            unchecked
            {
                for (int i = 0; i < Polygons.Count; i++)
                {
                    DnaPolygon polygon = Polygons[i];
                    drawing.Polygons.Add(polygon.Clone());
                }
            }
            return(drawing);
        }
Exemple #2
0
        internal void AddPolygonClone(JobInfo info)
        {
            if (Polygons.Count < info.Settings.PolygonsMax)
            {
                if (Polygons.Count < 1)
                {
                    AddPolygon(info);
                }
                else
                {
                    DnaPolygon parent     = Polygons[info.GetRandomNumber(0, Polygons.Count)];
                    DnaPolygon newPolygon = parent.Clone();
                    Polygons.Insert(Polygons.IndexOf(parent), newPolygon);

                    newPolygon.Offset(info.GetRandomNumber(-6, 6), info.GetRandomNumber(-6, 6));

                    SetDirty();
                }
            }
        }