示例#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;

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

            mFilter Filter = new mFilter();

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

            case 1:
                Filter = new mNormalizeHistogram();
                break;
            }


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


            DA.SetData(0, W);
        }
示例#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)
        {
            string T = "";
            Plane  P = Plane.WorldXY;

            if (!DA.GetData(0, ref T))
            {
                return;
            }
            if (!DA.GetData(1, ref P))
            {
                return;
            }

            wPlane Pln = new wPlane(new wPoint(P.Origin.X, P.Origin.Y, P.Origin.Z), new wVector(P.XAxis.X, P.XAxis.Y, P.XAxis.Z), new wVector(P.YAxis.X, P.YAxis.Y, P.YAxis.Z));

            wText       Txt    = new wText(T);
            wTextObject TxtObj = new wTextObject(Txt, Pln);

            TxtObj.Angle = (Vector3d.VectorAngle(Vector3d.YAxis, P.YAxis, Plane.WorldXY) / Math.PI * 180);

            wShape           Shape  = new wShape(TxtObj);
            wShapeCollection Shapes = new wShapeCollection(Shape);

            Shapes.Type = "Text";

            Shapes.Graphics = new wGraphic().BlackFill();
            Shapes.Effects  = new wEffects();

            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
示例#3
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)
        {
            Point3d P = new Point3d(0, 0, 0);
            double  R = 1.0;

            if (!DA.GetData(0, ref P))
            {
                return;
            }
            if (!DA.GetData(1, ref R))
            {
                return;
            }

            wPoint O   = new wPoint(P.X, P.Y, P.Z);
            wCurve Crv = new wCircle(O, R);

            wShape           Shape  = new wShape(Crv);
            wShapeCollection Shapes = new wShapeCollection(Shape);

            wPlane Pln = new wPlane().XYPlane();

            Pln.Origin = O;

            Shapes.Boundary = new wRectangle(Pln, R, R);
            Shapes.Type     = Crv.GetCurveType;

            Shapes.Graphics = new wGraphic().BlackFill();
            Shapes.Effects  = new wEffects();


            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
示例#4
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)
        {
            string ID   = this.Attributes.InstanceGuid.ToString();
            string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text;
            int    C    = this.RunCount;

            wObject  WindObject = new wObject();
            pElement Element    = new pElement();
            bool     Active     = Elements.ContainsKey(C);

            var pCtrl = new pFrame(name);

            if (Elements.ContainsKey(C))
            {
                Active = true;
            }

            //Check if control already exists
            if (Active)
            {
                if (Elements[C] != null)
                {
                    WindObject = Elements[C];
                    Element    = (pElement)WindObject.Element;
                    pCtrl      = (pFrame)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties
            Bitmap B = null;
            int    I = 3;

            if (!DA.GetData(0, ref B))
            {
                return;
            }
            if (!DA.GetData(1, ref I))
            {
                return;
            }

            pCtrl.SetProperties(B, I);

            //Set Parrot Element and Wind Object properties
            if (!Active)
            {
                Element = new pElement(pCtrl.Element, pCtrl, pCtrl.Type);
            }
            WindObject          = new wObject(Element, "Parrot", Element.Type);
            WindObject.GUID     = this.InstanceGuid;
            WindObject.Instance = C;

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
示例#5
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

            Interval Ga = new Interval(0, 255);
            Interval Gb = new Interval(0, 255);

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

            mFilter Filter = new mFilter();

            Filter = new mAdjustLevelsGray(new wDomain(Ga.T0, Ga.T1), new wDomain(Gb.T0, Gb.T1));


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


            DA.SetData(0, W);
        }
示例#6
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     T = 10;
            int     S = 5;

            // 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 mThresholdOtsu();
                break;

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

            case 2:
                if (!DA.GetData(1, ref T))
                {
                    return;
                }
                Filter = new mThresholdSimple(T);
                break;

            case 3:
                if (!DA.GetData(1, ref T))
                {
                    return;
                }
                if (!DA.GetData(2, ref S))
                {
                    return;
                }
                Filter = new mThresholdIterative(T, S);
                break;
            }

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

            DA.SetData(0, B);
            DA.SetData(1, W);
        }
示例#7
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 X     = null;
            int     Xsize = 0;
            int     Ysize = 0;
            int     F     = 0;
            int     S     = 0;

            // Access the input parameters
            if (!DA.GetData(0, ref X))
            {
                return;
            }
            if (!DA.GetData(1, ref F))
            {
                return;
            }
            if (!DA.GetData(2, ref S))
            {
                return;
            }
            if (!DA.GetData(3, ref Xsize))
            {
                return;
            }
            if (!DA.GetData(4, ref Ysize))
            {
                return;
            }

            if (F != ModeIndex)
            {
                ModeIndex = F;
                UpdateMessage();
            }

            if (S != TypeIndex)
            {
                TypeIndex = S;
                UpdateMessage();
            }

            wObject Z = new wObject();

            if (X != null)
            {
                X.CastTo(out Z);
            }
            mLayer L = new mLayer((mLayer)Z.Element);

            L.SetSizing(F, S, Xsize, Ysize);

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


            DA.SetData(0, W);
        }
示例#8
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 X = null;
            IGH_Goo Y = null;
            IGH_Goo Z = null;

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

            Bitmap   A = null;
            Bitmap   B = null;
            wObject  W = new wObject();
            mTexture T = new mTexture();

            if (X != null)
            {
                X.CastTo(out A);
            }
            if (Y != null)
            {
                Y.CastTo(out B);
            }
            Bitmap C = new Bitmap(A);

            if (Z != null)
            {
                Z.CastTo(out W);
            }
            T = (mTexture)W.Element;


            if ((A.Width != B.Width) || (A.Height != B.Height))
            {
                mMatchBitmaps BitmapPair = new mMatchBitmaps(A, B, MatchType, MatchSizing);

                A = new Bitmap(BitmapPair.BottomImage);
                B = new Bitmap(BitmapPair.TopImage);
            }


            C = new mCompositeTextureMorph(A, B, T).ModifiedBitmap;

            DA.SetData(0, C);
        }
示例#9
0
 public SetComponentWindow(IGH_Component C, wObject W, string T, int R)
 {
     switch (T)
     {
     case "TextBox":
         TextBox A15 = (TextBox)C;
         A15.Elements[R] = W;
         break;
     }
 }
示例#10
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 Element   = null;
            string  LayerName = "Layer 01";

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref LayerName))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.Layer = LayerName;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;
                C.Graphics = G;

                break;

            case "Pollen":
                switch (W.SubType)
                {
                }
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;

                Shapes.Group          = LayerName;
                Shapes.Graphics.Layer = LayerName;

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
示例#11
0
        private List <DataPt> ObjectListToDataPointList(List <object> objects)
        {
            List <DataPt> DataPoints = new List <DataPt>();

            for (int i = 0; i < objects.Count; i++)
            {
                wObject W = (wObject)objects[i];
                DataPoints.Add((DataPt)W.Element);
            }

            return(DataPoints);
        }
示例#12
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;
            double X = 5.0;
            double Y = 10.0;

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

            mTexture Texture = new mTexture();

            switch (M)
            {
            case 0:
                Texture = new mTextureClouds();
                break;

            case 1:
                Texture = new mTextureWood(X);
                break;

            case 2:
                Texture = new mTextureMarble(X, Y);
                break;

            case 3:
                Texture = new mTextureTextile();
                break;

            case 4:
                Texture = new mTextureLabyrinth();
                break;
            }


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


            DA.SetData(0, W);
        }
示例#13
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     Z = null;
            Rectangle3d R = new Rectangle3d(Plane.WorldXY, 150, 150);

            if (!DA.GetData(0, ref Z))
            {
                return;
            }
            if (!DA.GetData(0, ref R))
            {
                return;
            }

            Bitmap A = null;

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

            // Check if is pline
            Curve C = R.ToNurbsCurve();

            BoundingBox B = C.GetBoundingBox(true);
            wPoint      O = new wPoint(B.Center.X, B.Center.Y, B.Center.Z);

            wShape           Shape  = new wShape(new wRectangle());
            wShapeCollection Shapes = new wShapeCollection(Shape);

            wPlane Pln = new wPlane().XYPlane();

            Pln.Origin = O;

            Shapes.Boundary = new wRectangle(Pln, B.Diagonal.X, B.Diagonal.Y);
            //Shapes.Type = Crv.GetCurveType;

            if (C.IsClosed)
            {
                Shapes.Graphics = new wGraphic().BlackFill();
            }
            else
            {
                Shapes.Graphics = new wGraphic().BlackOutline();
            }
            Shapes.Effects = new wEffects();


            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
示例#14
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;
            IGH_Goo Y = null;
            int     L = 1;

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

            wObject   X = new wObject();
            mFilters  F = new mFilters();
            mSequence S = new mSequence();

            Bitmap A = new Bitmap(10, 10);

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

            if (X.SubType == "Filters")
            {
                S.AddFilter((mFilters)X.Element);
            }
            else if (X.SubType == "Filter")
            {
                S.AddFilter((mFilter)X.Element);
            }
            F = S;

            Bitmap B = new mIterate(A, F, L).ModifiedBitmap;

            DA.SetData(0, B);
        }
示例#15
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)
        {
            //Set Unique Control Properties
            IGH_Goo X = null;
            int     D = 96;

            if (!DA.GetData(0, ref X))
            {
                return;
            }
            if (!DA.GetData(1, ref D))
            {
                return;
            }

            wObject W = new wObject();

            X.CastTo(out W);

            pElement E = (pElement)W.Element;

            int XD = 800;
            int YD = 600;

            if (E.Layout.ActualWidth > 0)
            {
                XD = (int)E.Layout.ActualWidth;
            }
            if (E.Layout.ActualHeight > 0)
            {
                YD = (int)E.Layout.ActualHeight;
            }

            RenderTargetBitmap B = new RenderTargetBitmap((int)(XD * (D / 96.0)), (int)(YD * (D / 96.0)), D, D, PixelFormats.Pbgra32);

            B.Render(E.Layout);

            MemoryStream     stream  = new MemoryStream();
            PngBitmapEncoder encoder = new PngBitmapEncoder();

            encoder.Frames.Add(BitmapFrame.Create(B));
            encoder.Save(stream);

            Bitmap F = new Bitmap(stream);

            F.MakeTransparent();

            DA.SetData(0, F);
        }
示例#16
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

            Interval Ra = new Interval(0, 255);
            Interval Ga = new Interval(0, 255);
            Interval Ba = new Interval(0, 255);

            Interval Rb = new Interval(0, 255);
            Interval Gb = new Interval(0, 255);
            Interval Bb = new Interval(0, 255);

            // Access the input parameters
            if (!DA.GetData(0, ref Ra))
            {
                return;
            }
            if (!DA.GetData(1, ref Rb))
            {
                return;
            }
            if (!DA.GetData(2, ref Ga))
            {
                return;
            }
            if (!DA.GetData(3, ref Gb))
            {
                return;
            }
            if (!DA.GetData(4, ref Ba))
            {
                return;
            }
            if (!DA.GetData(5, ref Bb))
            {
                return;
            }

            mFilters Filter = new mFilters();

            //Filter = new mAdjustLevels(new wDomain(Ra.T0, Ra.T1), new wDomain(Ga.T0, Ga.T1), new wDomain(Ba.T0, Ba.T1), new wDomain(Rb.T0, Rb.T1), new wDomain(Gb.T0, Gb.T1), new wDomain(Bb.T0, Bb.T1));


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


            DA.SetData(0, W);
        }
示例#17
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     M = 0;

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

            Bitmap A = new Bitmap(10, 10);

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


            if (M != ModeIndex)
            {
                ModeIndex = M;
                UpdateMessage();
            }

            if (M < 4)
            {
                Filter = new mExtractARGBChannel((short)M);
            }
            else
            {
                Filter = new mExtractYCbCrChannel((short)(M - 4));
            }

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

            DA.SetData(0, B);
            DA.SetData(1, W);
        }
示例#18
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 X = null;
            IGH_Goo Y = null;

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

            mTexture T = new mTexture();
            wObject  Z = new wObject();
            wObject  U = new wObject();
            mFilters F = new mFilters();


            if (X != null)
            {
                X.CastTo(out Z);
            }
            T = (mTexture)Z.Element;
            if (Y != null)
            {
                Y.CastTo(out U);
            }
            F = (mFilters)U.Element;



            mFilters Filter = new mFilters();

            Filter = new mFilterTexture(T, F);


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


            DA.SetData(0, W);
        }
示例#19
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 Element = null;
            double  R       = 10.0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref R))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;

                break;

            case "Pollen":
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;

                Shapes.Effects.Blur = new wBlur(R);
                Shapes.Effects.SetEffect(Shapes.Effects.Blur.ShapeEffect);

                Shapes.Effects.HasEffect = true;

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
        }
示例#20
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)
        {
            string ID   = this.Attributes.InstanceGuid.ToString();
            string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text;
            int    C    = this.RunCount;

            wObject  WindObject = new wObject();
            pElement Element    = new pElement();
            bool     Active     = Elements.ContainsKey(C);

            var pCtrl = new pWebBrowser(name);

            //Check if control already exists
            if (Active)
            {
                WindObject = Elements[C];
                Element    = (pElement)WindObject.Element;
                pCtrl      = (pWebBrowser)Element.ParrotControl;
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties
            string A = "https://www.google.com/";

            if (!DA.GetData(0, ref A))
            {
                return;
            }

            pCtrl.SetProperties(A);


            //Set Parrot Element and Wind Object properties
            Element             = new pElement(pCtrl.Element, pCtrl, pCtrl.Type);
            WindObject          = new wObject(Element, "Parrot", Element.Type);
            WindObject.GUID     = this.InstanceGuid;
            WindObject.Instance = C;

            Elements[C] = WindObject;

            DA.SetData(0, WindObject);
        }
示例#21
0
文件: Blob.cs 项目: shapediver/Aviary
        /// <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 M = 0;
            Interval U = new Interval(50, 1000);
            Interval V = new Interval(50, 1000);

            // Access the input parameters 
            if (!DA.GetData(0, ref Z)) return;
            if (!DA.GetData(1, ref M)) return;
            if (!DA.GetData(2, ref U)) return;
            if (!DA.GetData(3, ref V)) return;

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

            mFilter Filter = new mFilter();

            wDomain X = new wDomain(U.T0,U.T1);
            wDomain Y = new wDomain(V.T0, V.T1);

            switch (M)
            {
                case 0:
                    Filter = new mFigureUnique(X, Y);
                    break;
                case 1:
                    Filter = new mFigureFilter(X, Y);
                    break;
                case 2:
                   Filter = new mFigureCorners(Color.Red);
                    break;
            }

            B = new mApply(A, Filter).ModifiedBitmap;

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


            DA.SetData(0, B);
            DA.SetData(1, W);
        }
示例#22
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;

            System.Drawing.Color S = System.Drawing.Color.Red;
            System.Drawing.Color T = System.Drawing.Color.Blue;
            double R = 100;

            // Access the input parameters
            if (!DA.GetData(0, ref Z))
            {
                return;
            }
            if (!DA.GetData(1, ref S))
            {
                return;
            }
            if (!DA.GetData(2, ref T))
            {
                return;
            }
            if (!DA.GetData(3, ref R))
            {
                return;
            }

            Bitmap A = new Bitmap(10, 10);

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

            mFilter Filter = new mFilter();

            Filter = new mFilterEuclideanColor(new wColor(S.R, S.G, S.B), new wColor(T.R, T.G, T.B), (short)R);

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

            DA.SetData(0, B);
            DA.SetData(1, W);
        }
示例#23
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)
        {
            Brep   B = new Brep();
            double D = 0;
            double K = 0;

            if (!DA.GetData(0, ref B))
            {
                return;
            }
            if (!DA.GetData(1, ref D))
            {
                return;
            }
            if (!DA.GetData(2, ref K))
            {
                return;
            }

            Curve[] C = B.DuplicateNakedEdgeCurves(true, true);
            C = Curve.JoinCurves(C);

            wShapeCollection Shapes = new wShapeCollection();

            foreach (Curve Crv in C)
            {
                Shapes.Shapes.Add(new wShape(new RhCrvToWindCrv().ToPiecewiseBezier(Crv, D, K)));
            }

            BoundingBox X   = B.GetBoundingBox(true);
            wPoint      O   = new wPoint(X.Center.X, X.Center.Y, X.Center.Z);
            wPlane      Pln = new wPlane().XYPlane();

            Pln.Origin      = O;
            Shapes.Boundary = new wRectangle(Pln, X.Diagonal.X, X.Diagonal.Y);
            Shapes.Type     = "PolyCurveGroup";

            Shapes.Graphics = new wGraphic().BlackFill();

            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
示例#24
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 X     = null;
            int     MoveX = 0;
            int     MoveY = 0;
            int     Angle = 0;

            // Access the input parameters
            if (!DA.GetData(0, ref X))
            {
                return;
            }
            if (!DA.GetData(1, ref MoveX))
            {
                return;
            }
            if (!DA.GetData(2, ref MoveY))
            {
                return;
            }
            if (!DA.GetData(3, ref Angle))
            {
                return;
            }

            wObject Z = new wObject();

            if (X != null)
            {
                X.CastTo(out Z);
            }
            mLayer L = new mLayer((mLayer)Z.Element);

            L.SetPosition(MoveX, MoveY);
            L.SetRotation(Angle);

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


            DA.SetData(0, W);
        }
示例#25
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)
        {
            Mesh M = new Mesh();

            if (!DA.GetData(0, ref M))
            {
                return;
            }

            Polyline[]    P     = M.GetNakedEdges();
            List <wShape> Shape = new List <wShape>();

            foreach (Polyline Pline in P)
            {
                List <wPoint> Pts = new List <wPoint>();
                for (int i = 0; i < Pline.Count; i++)
                {
                    Pts.Add(new wPoint(Pline[i].X, Pline[i].Y, Pline[i].Z));
                }

                wCurve Crv = new wPolyline(Pts, true);

                Shape.Add(new wShape(Crv));
            }

            wShapeCollection Shapes = new wShapeCollection(Shape);

            BoundingBox B   = M.GetBoundingBox(true);
            wPoint      O   = new wPoint(B.Center.X, B.Center.Y, B.Center.Z);
            wPlane      Pln = new wPlane().XYPlane();

            Pln.Origin      = O;
            Shapes.Boundary = new wRectangle(Pln, B.Diagonal.X, B.Diagonal.Y);
            Shapes.Type     = "PolylineGroup";

            Shapes.Graphics = new wGraphic().BlackFill();

            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
示例#26
0
        private List <DataPt> ObjectListToDataPointList(List <object> objects)
        {
            List <DataPt> DataPoints = new List <DataPt>();

            double[] TempNumberSet = new double[objects.Count];
            NumericSum = 0;

            for (int i = 0; i < objects.Count; i++)
            {
                wObject W  = (wObject)objects[i];
                DataPt  Pt = (DataPt)W.Element;
                DataPoints.Add((DataPt)W.Element);

                TempNumberSet[i] = Pt.Number;
                NumericSum      += Pt.Number;
            }

            Array.Sort(TempNumberSet);
            NumericBounds = new wDomain(TempNumberSet[0], TempNumberSet[TempNumberSet.Count() - 1]);

            return(DataPoints);
        }
示例#27
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
            List <IGH_Goo> X = new List <IGH_Goo>();

            // Access the input parameters
            if (!DA.GetDataList(0, X))
            {
                return;
            }

            List <mLayer> Layers = new List <mLayer>();

            foreach (IGH_Goo InputObject in X)
            {
                wObject Z = new wObject();
                if (InputObject != null)
                {
                    InputObject.CastTo(out Z);
                }
                mLayer LayerObject = new mLayer((mLayer)Z.Element);

                Layers.Add(LayerObject);
            }

            Bitmap C = null;

            mComposition CompositionObject = new mComposition(Layers);

            CompositionObject.BuildComposition();

            C = CompositionObject.CompositionBitmap;

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


            DA.SetData(0, C);
        }
示例#28
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;
            bool    H = false;
            bool    V = false;

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

            Bitmap A = new Bitmap(10, 10);

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

            mFilter Filter = new mFilter();

            Filter = new mMirror(H, V);

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

            DA.SetData(0, B);
            DA.SetData(1, W);
        }
示例#29
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

            List <IGH_Goo> X = new List <IGH_Goo>();

            // Access the input parameters
            if (!DA.GetDataList(0, X))
            {
                return;
            }

            mFilters  F = new mFilters();
            mSequence S = new mSequence();

            S.ClearSequence();
            List <string> types = new List <string>();

            for (int i = 0; i < X.Count; i++)
            {
                wObject Y = new wObject();
                X[i].CastTo(out Y);
                if (Y.SubType == "Filters")
                {
                    S.AddFilter((mFilters)Y.Element);
                }
                else if (Y.SubType == "Filter")
                {
                    S.AddFilter((mFilter)Y.Element);
                }
            }

            F = S;

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

            DA.SetData(0, W);
        }
示例#30
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        X = null;
            int            M = 0;
            int            T = 100;
            List <IGH_Goo> F = new List <IGH_Goo>();

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

            Bitmap A = new Bitmap(10, 10);

            if (X != null)
            {
                X.CastTo(out A);
            }
            Bitmap B = (Bitmap)A.Clone();

            mLayer LayerObject = new mLayerImage(B, M, (byte)T);

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


            DA.SetData(0, W);
        }