Example #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)
        {
            // Declare variables

            int M = 0;
            int D = 32;

            // Access the input parameters
            if (!DA.GetData(0, ref M))
            {
                return;
            }
            if (!DA.GetData(1, ref D))
            {
                return;
            }

            mFilter Filter = new mFilter();

            switch (M)
            {
            case 0:
                Filter = new mStreakHorizontal(D);
                break;

            case 1:
                Filter = new mStreakVertical(D);
                break;
            }


            wObject W = new wObject(Filter, "Macaw", Filter.Type);


            DA.SetData(0, W);
        }
Example #2
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)
        {
            // Declare variables
            IGH_Goo  Z = null;
            int      I = 0;
            int      J = 0;
            bool     C = true;
            bool     D = true;
            Interval X = new Interval(0, 20);
            Interval Y = new Interval(0, 20);


            // Access the input parameters
            if (!DA.GetData(0, ref Z))
            {
                return;
            }

            Bitmap A = new Bitmap(10, 10);

            if (Z != null)
            {
                Z.CastTo(out A);
            }

            mFilter Filter = new mFilter();

            switch (ModeIndex)
            {
            case 0:
                Filter = new mErosionSimple();
                break;

            case 1:
                Filter = new mErosionDilation();
                break;

            case 2:
                Filter = new mErosionOpening();
                break;

            case 3:
                Filter = new mErosionClosing();
                break;

            case 4:
                Filter = new mErosionHatTop();
                break;

            case 5:
                Filter = new mErosionHatBottom();
                break;

            case 6:
                if (!DA.GetData(1, ref I))
                {
                    return;
                }
                if (!DA.GetData(2, ref J))
                {
                    return;
                }
                Filter = new mErosionSkeleton(I, J);
                break;

            case 7:
                if (!DA.GetData(1, ref I))
                {
                    return;
                }
                if (!DA.GetData(2, ref C))
                {
                    return;
                }
                Filter = new mStreakHorizontal(I, C);
                break;

            case 8:
                if (!DA.GetData(1, ref I))
                {
                    return;
                }
                if (!DA.GetData(2, ref C))
                {
                    return;
                }
                Filter = new mStreakVertical(I, C);
                break;

            case 9:
                if (!DA.GetData(1, ref I))
                {
                    return;
                }
                if (!DA.GetData(2, ref J))
                {
                    return;
                }
                if (!DA.GetData(3, ref C))
                {
                    return;
                }
                Filter = new mErosionFill(I, J, C);
                break;

            case 10:
                if (!DA.GetData(1, ref X))
                {
                    return;
                }
                if (!DA.GetData(2, ref Y))
                {
                    return;
                }
                if (!DA.GetData(3, ref C))
                {
                    return;
                }
                Filter = new mFigureFilter(new wDomain(X.T0, X.T1), new wDomain(Y.T0, Y.T1), C);
                break;

            case 11:
                if (!DA.GetData(1, ref X))
                {
                    return;
                }
                if (!DA.GetData(2, ref Y))
                {
                    return;
                }
                if (!DA.GetData(3, ref C))
                {
                    return;
                }
                if (!DA.GetData(3, ref D))
                {
                    return;
                }
                Filter = new mFigureUnique(new wDomain(X.T0, X.T1), new wDomain(Y.T0, Y.T1), C, D);
                break;
            }

            Bitmap  B = new mApply(A, Filter).ModifiedBitmap;
            wObject W = new wObject(Filter, "Macaw", Filter.Type);


            DA.SetData(0, B);
            DA.SetData(1, W);
        }