Exemplo n.º 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo goo    = null;
            Bitmap  bitmap = new Bitmap(100, 100);

            if (!DA.GetData(0, ref goo))
            {
                return;
            }
            if (!goo.TryGetBitmap(ref bitmap))
            {
                return;
            }

            Shapes shapes = new Shapes(bitmap);

            Interval width = new Interval();

            if (DA.GetData(1, ref width))
            {
                shapes.MinWidth = (int)width.T0;
                shapes.MaxWidth = (int)width.T1;
            }

            Interval height = new Interval();

            if (DA.GetData(2, ref height))
            {
                shapes.MinHeight = (int)height.T0;
                shapes.MaxHeight = (int)height.T1;
            }

            Color color = new Color();

            if (DA.GetData(3, ref color))
            {
                shapes.BackgroundColor = color;
            }

            bool limit = false;

            if (DA.GetData(4, ref limit))
            {
                shapes.Coupled = limit;
            }

            double angle = -1;

            if (DA.GetData(5, ref angle))
            {
                shapes.Angle = angle;
            }
            double distance = -1;

            if (DA.GetData(6, ref distance))
            {
                shapes.Length = distance;
            }
            double deviation = -1;

            if (DA.GetData(7, ref deviation))
            {
                shapes.Distortion = deviation;
            }

            shapes.CalculateShapes();

            DA.SetDataList(0, shapes.GetCircles);
            DA.SetDataList(1, shapes.GetTriangles);
            DA.SetDataList(2, shapes.GetQuadrilaterals);
        }