예제 #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)
        {
            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);
        }
예제 #2
0
        public void SetElement(pElement ParrotElement)
        {
            Element.Content = null;

            ParrotElement.DetachParent();
            Element.Content = ParrotElement.Container;
        }
예제 #3
0
        public void AddElement(pElement ParrotElement, int Ci, int Ri)
        {
            ParrotElement.DetachParent();

            Grid.SetColumn(ParrotElement.Container, Ci);
            Grid.SetRow(ParrotElement.Container, Ri);
            Element.Children.Add(ParrotElement.Container);
        }
예제 #4
0
        public void AddElement(pElement ParrotElement, int X, int Y)
        {
            ParrotElement.DetachParent();

            Element.Children.Add(ParrotElement.Container);

            Canvas.SetLeft(Element.Children[Element.Children.Count - 1], X);
            Canvas.SetTop(Element.Children[Element.Children.Count - 1], Y);
        }
예제 #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)
        {
            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);
        }
예제 #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)
        {
            //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);
        }
예제 #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)
        {
            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);
        }
예제 #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)
        {
            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);
        }
예제 #9
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 pDrawing(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      = (pDrawing)Element.ParrotControl;
                }
            }
            else
            {
                pCtrl.SetProperties();
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            List <IGH_Goo> Shps = new List <IGH_Goo>();
            Rectangle3d    B    = new Rectangle3d(Plane.WorldXY, 0, 0);
            Interval       Fx   = new Interval(600, 600);
            bool           D    = true;

            if (!DA.GetDataList(0, Shps))
            {
                return;
            }
            if (!DA.GetData(1, ref B))
            {
                return;
            }
            if (!DA.GetData(2, ref Fx))
            {
                return;
            }
            if (!DA.GetData(3, ref D))
            {
                return;
            }

            List <wShapeCollection> Shapes = new List <wShapeCollection>();

            Rectangle3d F = new Rectangle3d(Plane.WorldXY, Fx.T0, Fx.T1);

            wObject          Wx = new wObject();
            wShapeCollection Sx = new wShapeCollection();

            Shps[0].CastTo(out Wx);
            Sx = (wShapeCollection)Wx.Element;

            BoundingBox Box = new BoundingBox(Sx.Boundary.CornerPoints[0].X, Sx.Boundary.CornerPoints[0].Y, 0, Sx.Boundary.CornerPoints[2].X, Sx.Boundary.CornerPoints[2].Y, 0);

            foreach (IGH_Goo Obj in Shps)
            {
                wObject          W = new wObject();
                wShapeCollection S = new wShapeCollection();

                Obj.CastTo(out W);
                S = (wShapeCollection)W.Element;
                Shapes.Add(S);

                wPoint PtA = S.Boundary.CornerPoints[0];
                wPoint PtB = S.Boundary.CornerPoints[2];

                Box.Union(new Point3d(PtA.X, PtA.Y, PtA.Z));
                Box.Union(new Point3d(PtB.X, PtB.Y, PtB.Z));
            }

            if ((B.Width == 0.0) & (B.Height == 0.0))
            {
                Plane pln = Plane.WorldXY;
                pln.Origin = Box.Center;
                B          = new Rectangle3d(pln,
                                             new Interval(-Box.Diagonal.X / 2.0, Box.Diagonal.X / 2.0),
                                             new Interval(-Box.Diagonal.Y / 2.0, Box.Diagonal.Y / 2.0));
            }

            wPlane PlnB = new wPlane(
                new wPoint(B.Center.X, B.Center.Y, B.Center.Z),
                new wVector(B.Plane.XAxis.X, B.Plane.XAxis.Y, B.Plane.XAxis.Z),
                new wVector(B.Plane.YAxis.X, B.Plane.YAxis.Y, B.Plane.YAxis.Z));
            wPlane PlnF = new wPlane(
                new wPoint(F.Center.X, F.Center.Y, F.Center.Z),
                new wVector(F.Plane.XAxis.X, F.Plane.XAxis.Y, F.Plane.XAxis.Z),
                new wVector(F.Plane.YAxis.X, F.Plane.YAxis.Y, F.Plane.YAxis.Z));

            pCtrl.SetCanvasSize(new wRectangle(PlnF, F.Width, F.Height), new wRectangle(PlnB, B.Width, B.Height));

            pCtrl.Graphics.Width  = F.Width;
            pCtrl.Graphics.Height = F.Height;

            pCtrl.group.X = B.Center.X * pCtrl.Scale - B.Width / 2.0 * pCtrl.Scale;
            pCtrl.group.Y = B.Center.Y * pCtrl.Scale - B.Height / 2.0 * pCtrl.Scale;

            pCtrl.group.Width  = F.Width;
            pCtrl.group.Height = F.Height;

            pCtrl.SetSize();

            pCtrl.SetScale();
            if (D)
            {
                pCtrl.ClearDrawing();
            }

            foreach (wShapeCollection S in Shapes)
            {
                switch (S.Type)
                {
                case "PolyCurveGroup":
                    pCtrl.AddPolySpline(S);
                    break;

                case "PolylineGroup":
                    pCtrl.AddPolyFigure(S);
                    break;

                default:
                    pCtrl.AddShape(S);
                    break;
                }
            }

            pCtrl.SetCanvas();

            //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);
            DA.SetData(1, pCtrl.group);
            DA.SetData(2, pCtrl.GetBitmap());
        }
예제 #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)
        {
            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 pGradient(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      = (pGradient)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            List <System.Drawing.Color> G = new List <System.Drawing.Color>();;
            List <double> T = new List <double>();
            List <string> V = new List <string>();
            int           W = 20;

            if (!DA.GetDataList(0, G))
            {
                return;
            }
            if (!DA.GetDataList(1, T))
            {
                return;
            }
            if (!DA.GetDataList(2, V))
            {
                return;
            }
            if (!DA.GetData(3, ref W))
            {
                return;
            }

            List <wColor> H = new List <wColor>();

            for (int i = 0; i < G.Count; i++)
            {
                H.Add(new wColor(G[i]));
            }

            int k = T.Count;

            for (int i = k; i < G.Count; i++)
            {
                T.Add(1.0);
            }

            k = V.Count;
            for (int i = k; i < G.Count; i++)
            {
                V.Add(" ");
            }

            pCtrl.SetProperties(H, T, V, W, IsHorizontal, OrientMode, IsExtents, HasTicks, IsLight, IsFlipped);

            //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);
        }
예제 #11
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 pControl = new pDataTableA(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;
                    pControl   = (pDataTableA)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;

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

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            List <pPointSeries> PointSeriesList = new List <pPointSeries>();

            for (int i = 0; i < DC.Sets.Count; i++)
            {
                pPointSeries pSeriesSet = new pPointSeries(Convert.ToString(name + i));
                pSeriesSet.SetProperties(DC.Sets[i]);
                pSeriesSet.SetChartLabels(DC.Label);
                pSeriesSet.SetNumericData(1);
                PointSeriesList.Add(pSeriesSet);
            }

            pControl.SetProperties(DC);
            //pControl.SetFormatting();

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

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
예제 #12
0
 public void AddElement(pElement ParrotElement)
 {
     ParrotElement.DetachParent();
     Element.Children.Add(ParrotElement.Container);
 }
예제 #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 Element = null;

            List <System.Drawing.Color> Colors = new List <System.Drawing.Color>();
            List <double> Parameters           = new List <double>();
            double        GradientAngle        = 0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetDataList(1, Colors))
            {
                return;
            }
            if (!DA.GetDataList(2, Parameters))
            {
                return;
            }
            if (!DA.GetData(3, ref GradientAngle))
            {
                return;
            }

            wObject W = new wObject();

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

            G.FillType     = wGraphic.FillTypes.LinearGradient;
            G.CustomFills += 1;

            if (Parameters.Count < 1)
            {
                G.Gradient = new wGradient(Colors);
            }
            else
            {
                if (Parameters.Count < Colors.Count)
                {
                    for (int i = Parameters.Count; i < Colors.Count; i++)
                    {
                        Parameters.Add(Parameters[Parameters.Count - 1]);
                    }
                }

                G.Gradient = new wGradient(Colors, Parameters, GradientAngle, (wGradient.GradientSpace)GradientSpace);
            }

            G.WpfFill = new wFillGradient(G.Gradient, GradientType).GrdBrush;

            W.Graphics = G;

            if (Element != null)
            {
                switch (W.Type)
                {
                case "Parrot":
                    pElement E = (pElement)W.Element;
                    pControl C = (pControl)E.ParrotControl;
                    C.SetFill();

                    C.Graphics = G;
                    break;

                case "Pollen":
                    switch (W.SubType)
                    {
                    case "DataPoint":
                        DataPt tDataPt = (DataPt)W.Element;
                        tDataPt.Graphics = G;

                        tDataPt.Graphics.WpfFill    = G.WpfFill;
                        tDataPt.Graphics.WpfPattern = G.WpfPattern;

                        W.Element = tDataPt;
                        break;

                    case "DataSet":
                        DataSetCollection tDataSet = (DataSetCollection)W.Element;
                        tDataSet.Graphics = G;

                        tDataSet.Graphics.WpfFill    = G.WpfFill;
                        tDataSet.Graphics.WpfPattern = G.WpfPattern;

                        W.Element = tDataSet;
                        break;

                    case "Chart":
                    case "Table":

                        pElement pE = (pElement)W.Element;
                        pChart   pC = pE.PollenControl;
                        pC.Graphics = G;

                        pC.Graphics.WpfFill    = G.WpfFill;
                        pC.Graphics.WpfPattern = G.WpfPattern;

                        pC.SetGradientFill();

                        pE.PollenControl = pC;
                        W.Element        = pE;
                        break;
                    }
                    break;

                case "Hoopoe":
                    wShapeCollection Shapes = (wShapeCollection)W.Element;
                    Shapes.Graphics.FillType = wGraphic.FillTypes.LinearGradient;

                    wGradient GRD = new wGradient();

                    if (Parameters.Count < 1)
                    {
                        GRD = new wGradient(Colors, GradientAngle, (wGradient.GradientSpace)GradientSpace);
                    }
                    else
                    {
                        GRD = new wGradient(Colors, Parameters, GradientAngle, (wGradient.GradientSpace)GradientSpace);
                    }

                    Shapes.Graphics.Gradient = GRD;
                    Shapes.Graphics.WpfFill  = new wFillGradient(G.Gradient, GradientType).GrdBrush;



                    W.Element = Shapes;
                    break;
                }
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
예제 #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)
        {
            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 pPanelWrap(name);

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

            List <IGH_Goo> X = new List <IGH_Goo>();
            int            A = 0;
            bool           H = true;

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

            pCtrl.SetProperties(H, A);

            wObject  W;
            pElement E;

            foreach (IGH_Goo Y in X)
            {
                Y.CastTo(out W);
                E = (pElement)W.Element;
                pCtrl.AddElement(E);
            }


            //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);
        }
예제 #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)
        {
            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 pControl = new pPointChart(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;
                    pControl   = (pPointChart)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;
            int     M = 0;

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

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(wGradients.Metro, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomStroke == 0)
            {
                if (M == 1)
                {
                    DC.SetDefaultStrokes(wStrokes.StrokeTypes.Transparent);
                }
                else
                {
                    DC.SetDefaultStrokes(wStrokes.StrokeTypes.LineChart, wGradients.Metro, false, true);
                }
            }
            if (DC.TotalCustomMarker == 0)
            {
                if (M == 0)
                {
                    DC.SetDefaultMarkers(wGradients.Metro, wMarker.MarkerType.Circle, false, DC.Sets.Count > 1);
                }
                else
                {
                    DC.SetDefaultMarkers(wGradients.SolidTransparent, wMarker.MarkerType.None, false, DC.Sets.Count > 1);
                }
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(wFonts.ChartPointDark);
            }
            if (DC.TotalCustomLabel == 0)
            {
                DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.None, new wGraphic(wColors.Transparent)));
            }

            if (DC.TotalCustomTitles == 0)
            {
                DC.Graphics.FontObject = wFonts.AxisLabel;
            }

            List <pPointSeries> PointSeriesList = new List <pPointSeries>();

            int T = 0;

            double X = DC.Sets.Count;
            double Y = 99.0 / X;

            if (!DC.Axes.Enabled)
            {
                DC.Axes.AxisX.Enabled  = true;
                DC.Axes.AxisX.HasLabel = false;
                DC.Axes.AxisY.Enabled  = true;
                DC.Axes.AxisY.HasLabel = false;
            }

            pControl.SetProperties(DC);

            for (int i = 0; i < DC.Sets.Count; i++)
            {
                pPointSeries pSeriesSet = new pPointSeries(DC.Sets[i].Title);
                pSeriesSet.SetProperties(DC.Sets[i]);
                pSeriesSet.SetRadialChartType(M);
                pSeriesSet.SetChartLabels(DC.Label);
                pSeriesSet.SetNumericData(4);
                PointSeriesList.Add(pSeriesSet);
            }

            pControl.SetSeries(PointSeriesList);
            pControl.SetAxisScale();
            pControl.SetAxisAppearance();
            if (M == 0)
            {
                pControl.SetXaxis(new wDomain(0, PointSeriesList[0].DataList.Count - 1));
            }

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

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
예제 #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)
        {
            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 pControl = new pGaugeChartSeries(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;
                    pControl   = (pGaugeChartSeries)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;
            int     M = 0;
            bool    B = true;
            int     S = 100;

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

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(wGradients.Metro, false, false);
            }
            if (DC.TotalCustomStroke == 0)
            {
                DC.SetDefaultStrokes(wStrokes.StrokeTypes.Transparent);
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(wFonts.ChartGauge);
            }
            if (DC.TotalCustomMarker == 0)
            {
                DC.SetDefaultMarkers(wGradients.SolidTransparent, wMarker.MarkerType.None, false, false);
            }
            if (DC.TotalCustomLabel == 0)
            {
                DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent)));
            }

            pControl.SetProperties(DC, B, 0);
            pControl.SetCharts(S, M, modeStatus);

            if (DC.TotalCustomFont > 0)
            {
                pControl.SetFont();
            }

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

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
예제 #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)
        {
            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 pDataGrid(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      = (pDataGrid)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;

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

            wObject W = new wObject();

            D.CastTo(out W);
            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(wGradients.SolidLightGray, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(wFonts.DataGrid);
            }
            if (DC.TotalCustomStroke == 0)
            {
                DC.SetDefaultStrokes(wStrokes.StrokeTypes.OffWhiteSolid);
            }

            if (DC.TotalCustomTitles == 0)
            {
                DC.Graphics.FontObject = wFonts.DataGridTitle;
            }

            pCtrl.SetProperties(DC, HasTitle);

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

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
예제 #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)
        {
            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 pLegend(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      = (pLegend)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            List <string> V = new List <string>();
            List <System.Drawing.Color> E = new List <System.Drawing.Color>();
            int X = 0;

            if (!DA.GetDataList(0, V))
            {
                return;
            }
            if (!DA.GetDataList(1, E))
            {
                return;
            }
            if (!DA.GetData(2, ref X))
            {
                return;
            }

            if (V.Count > 0)
            {
                if (E.Count < 1)
                {
                    E.Add(System.Drawing.Color.Black);
                }
            }

            int A = E.Count;
            int B = V.Count;

            for (int i = A; i < V.Count; i++)
            {
                E.Add(E[A - 1]);
            }

            pCtrl.SetDirection(X, IsHorizontal);
            pCtrl.SetItems(V, E, (pLegend.IconMode)IconMode, IsLight);

            //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);
        }
예제 #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)
        {
            string ID   = this.Attributes.InstanceGuid.ToString();
            string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), true).Text;
            int    C    = this.RunCount;

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

            var pCtrl = new pPanelStack(name);

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

            //Set Unique Control Properties
            List <IGH_Goo> E = new List <IGH_Goo>();
            bool           H = true;

            if (!DA.GetDataList(0, E))
            {
                return;
            }
            if (!DA.GetData(1, ref H))
            {
                return;
            }

            pCtrl.SetProperties(H);

            for (int i = 0; i < E.Count; i++)
            {
                wObject  W;
                pElement Elem;
                E[i].CastTo(out W);
                Elem = (pElement)W.Element;

                pCtrl.AddElement(Elem);
            }

            //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);
        }
예제 #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)
        {
            IGH_Goo Element = null;
            double  T0      = 1;

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

            wObject W = new wObject();

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

            G.Margin[0] = T0;
            G.Margin[1] = T0;
            G.Margin[2] = T0;
            G.Margin[3] = T0;

            W.Graphics = G;

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

                C.SetMargin();

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetMargin();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
예제 #21
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)), true).Text;
            int    C    = this.RunCount;

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

            var pCtrl = new pSlider(name);

            pCtrl.SetProperties();
            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      = (pSlider)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            double   V = 0.5;
            double   I = 0;
            Interval D = new Interval(0, 1);

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

            pCtrl.SetValues(D.T0, D.T1, I, V, boolDirection, boolLabel, boolTick);

            //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);
        }
예제 #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)
        {
            string ID   = this.Attributes.InstanceGuid.ToString();
            string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), true).Text;
            int    C    = this.RunCount;

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

            var pCtrl = new pTextBox(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      = (pTextBox)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties
            string Text    = "";
            bool   HasText = false;
            bool   Wraps   = false;
            double Width   = 0;

            if (!DA.GetData(0, ref Text))
            {
                return;
            }
            if (!DA.GetData(1, ref Wraps))
            {
                return;
            }
            if (!DA.GetData(2, ref Width))
            {
                return;
            }

            if (Text != "")
            {
                HasText = true;
            }

            pCtrl.SetProperties(Text, HasText, Wraps, Width);

            //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);
        }
예제 #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)
        {
            IGH_Goo Element = null;
            bool    P       = false;
            double  R0      = 5;

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

            wObject W = new wObject();

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

            G.PadRadius = P;
            G.Radius[0] = R0;
            G.Radius[1] = R0;
            G.Radius[2] = R0;
            G.Radius[3] = R0;

            W.Graphics = G;

            if (P)
            {
                W.Graphics.SetPaddingFromCorners();
            }
            else
            {
                W.Graphics.SetUniformPadding(0);
            }

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

                C.SetCorners();

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;

                    tDataPt.Graphics.Radius = G.Radius;
                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;

                    tDataSet.Graphics.Radius = G.Radius;
                    W.Element = tDataSet;
                    break;
                }
                break;

            case "Hoopoe":
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
예제 #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)
        {
            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 pControl = new pCartesianChart(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;
                    pControl   = (pCartesianChart)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;
            int     M = 0;

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

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(wGradients.Metro, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomStroke == 0)
            {
                DC.SetDefaultStrokes(wStrokes.StrokeTypes.Transparent);
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(wFonts.ChartPoint);
            }
            if (DC.TotalCustomMarker == 0)
            {
                DC.SetDefaultMarkers(wGradients.SolidTransparent, wMarker.MarkerType.None, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomLabel == 0)
            {
                if ((M == 0) || (M == 3))
                {
                    DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent)));
                }
                else
                {
                    DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Top, wLabel.LabelAlignment.Perp, new wGraphic(wColors.Transparent)));
                }
            }

            List <pCartesianSeries> PointSeriesList = new List <pCartesianSeries>();

            pControl.SetProperties(DC);
            switch (M)
            {
            case 0:
                pControl.SetAdjacentBarChart();
                break;

            case 1:
                pControl.SetStackBarChart(false);
                break;

            case 2:
                pControl.SetStackBarChart(true);
                break;

            case 3:
                pControl.SetAdjacentColumnChart();
                break;

            case 4:
                pControl.SetStackColumnChart(false);
                break;

            case 5:
                pControl.SetStackColumnChart(true);
                break;
            }
            pControl.ForceRefresh();
            pControl.SetAxisAppearance();

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

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
예제 #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)
        {
            IGH_Goo Element = null;
            int     X       = 0;
            int     Y       = 0;
            int     Z       = 0;
            bool    D       = false;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref X))
            {
                return;
            }
            if (!DA.GetData(2, ref Y))
            {
                return;
            }
            if (!DA.GetData(3, ref Z))
            {
                return;
            }

            wObject W;

            Element.CastTo(out W);


            D = !((X == 0) & (Y == 0) & (Z == 0));

            p3D V = new p3D(X, Y, Z, D, (p3D.LightingMode)ModeLighting);

            switch (W.Type)
            {
            case "Pollen":

                switch (W.SubType)
                {
                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;

                    tDataSet.SetThreeDView(D, V);

                    W.Element = tDataSet;
                    break;

                case "PointChart":
                    pElement E = (pElement)W.Element;
                    pChart   C = (pChart)E.PollenControl;

                    C.View = V;
                    C.SetThreeDView();

                    E.PollenControl = C;
                    W.Element       = E;
                    break;
                }
                break;
            }

            DA.SetData(0, W);
        }
예제 #26
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 pControl = new pRadialChart(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;
                    pControl   = (pRadialChart)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;
            double  R = 0;

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

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(Wind.Presets.wGradients.Metro, false, false);
            }
            if (DC.TotalCustomStroke == 0)
            {
                DC.SetDefaultStrokes(wStrokes.StrokeTypes.OffWhiteSolid);
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(wFonts.ChartPoint);
            }
            if (DC.TotalCustomMarker == 0)
            {
                DC.SetDefaultMarkers(wGradients.Metro, wMarker.MarkerType.Circle, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomLabel == 0)
            {
                DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent)));
            }

            if (DC.TotalCustomTitles == 0)
            {
                DC.Graphics.FontObject = wFonts.AxisLabel;
            }

            List <pRadialSeries> RadialSeriesList = new List <pRadialSeries>();

            pControl.SetProperties(DC, R);
            pControl.SetPollenSeries(name);
            pControl.ForceRefresh();

            /*
             * for (int i = 0; i < DC.Sets.Count; i++)
             * {
             *  pRadialSeries pSeriesSet = new pRadialSeries(Convert.ToString(name + i));
             *  pSeriesSet.SetRadialSeries(DC.Sets[i]);
             *  RadialSeriesList.Add(pSeriesSet);
             * }
             */

            //pControl.SetSeries(RadialSeriesList);
            //pControl.SetAxisAppearance();

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

            Elements[this.RunCount] = WindObject;

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

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

            var pCtrl = new pPanelPlace(name);


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

            //Set Unique Control Properties
            List <IGH_Goo> E  = new List <IGH_Goo>();
            Interval       S  = new Interval(600, 600);
            List <int>     Xv = new List <int>();
            List <int>     Yv = new List <int>();

            if (!DA.GetDataList(0, E))
            {
                return;
            }
            if (!DA.GetData(1, ref S))
            {
                return;
            }
            if (!DA.GetDataList(2, Xv))
            {
                return;
            }
            if (!DA.GetDataList(3, Yv))
            {
                return;
            }

            pCtrl.SetProperties((int)S.T0, (int)S.T1);
            pCtrl.ClearChildren();

            int k = Xv.Count;

            for (int i = k; i < E.Count; i++)
            {
                Xv.Add(Xv[Xv.Count - 1]);
            }

            k = Yv.Count;
            for (int i = k; i < E.Count; i++)
            {
                Yv.Add(Yv[Yv.Count - 1]);
            }

            for (int i = 0; i < E.Count; i++)
            {
                wObject  W;
                pElement Elem;
                E[i].CastTo(out W);
                Elem = (pElement)W.Element;

                pCtrl.AddElement(Elem, Xv[i], Yv[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);
        }
예제 #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)
        {
            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 pPanelTabs(name);

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

            List <string>  T = new List <string>();
            List <IGH_Goo> X = new List <IGH_Goo>();
            List <int>     I = new List <int>();

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

            pCtrl.SetProperties();

            int k = I.Count;

            for (int i = k; i < X.Count; i++)
            {
                I.Add(I[k - 1]);
            }

            int[] Indices = I.ToArray();
            Array.Sort(Indices);

            k = T.Count;
            for (int i = k; i < Indices[I.Count - 1] + 1; i++)
            {
                T.Add(T[k - 1]);
            }

            for (int i = 0; i < T.Count; i++)
            {
                pCtrl.AddTab(T[i]);
            }

            wObject  W;
            pElement E;

            for (int i = 0; i < X.Count; i++)
            {
                X[i].CastTo(out W);
                E = (pElement)W.Element;

                pCtrl.AddElement(I[i], E);
            }


            //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);
        }
예제 #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)
        {
            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 pSpacer(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      = (pSpacer)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties
            System.Drawing.Color color = System.Drawing.Color.Transparent;
            double Width = 0;

            if (!DA.GetData(0, ref color))
            {
                return;
            }
            if (!DA.GetData(1, ref Width))
            {
                return;
            }

            pCtrl.SetProperties(new wColor(color).ToMediaColor(), Width, IsHorizontal, IsFill);


            //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);
        }
예제 #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)
        {
            IGH_Goo Element = null;
            IGH_Goo Shps    = null;
            double  Scale   = 1.0;

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

            wObject W = new wObject();

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

            wShapeCollection S = new wShapeCollection();

            if (Shps != null)
            {
                Shps.CastTo(out S);
            }

            wFillSwatch Swatch = new wFillSwatch(S, Scale, TilingMode, S.X, S.Y, S.Width, S.Height);

            G.FillType     = wGraphic.FillTypes.Pattern;
            G.WpfPattern   = Swatch.DwgBrush;
            G.WpfFill      = Swatch.DwgBrush;
            G.CustomFills += 1;

            W.Graphics = G;

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

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    tDataPt.Graphics.WpfFill    = G.WpfFill;
                    tDataPt.Graphics.WpfPattern = G.WpfPattern;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    tDataSet.Graphics.WpfFill    = G.WpfFill;
                    tDataSet.Graphics.WpfPattern = G.WpfPattern;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.Graphics.WpfFill    = G.WpfFill;
                    pC.Graphics.WpfPattern = G.WpfPattern;

                    pC.SetPatternFill();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;
                Shapes.Graphics.FillType = wGraphic.FillTypes.Pattern;

                Shapes.Graphics.WpfFill    = G.WpfFill;
                Shapes.Graphics.WpfPattern = G.WpfPattern;

                W.Element = Shapes;
                break;
            }

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