Ejemplo n.º 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            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);
        }
Ejemplo n.º 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 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);
        }
Ejemplo n.º 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)
        {
            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);
        }
Ejemplo n.º 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 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);
        }
Ejemplo n.º 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)
        {
            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());
        }
Ejemplo n.º 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)
        {
            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);
        }
Ejemplo n.º 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)), 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);
        }
Ejemplo n.º 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)
        {
            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);
        }
Ejemplo n.º 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 pColorPicker(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      = (pColorPicker)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            Color        D = Color.Transparent;
            List <Color> S = new List <Color>();
            List <Color> K = new List <Color>();
            int          M = 1;

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

            pColorSets ClrSets = new pColorSets();

            if (S.Count < 1)
            {
                S = ClrSets.Standard;
            }
            if (K.Count < 1)
            {
                K = ClrSets.Standard;
            }

            pCtrl.SetProperties(D, S, K, M);

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

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
Ejemplo n.º 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 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;
            int     P = 0;
            int     T = 0;
            int     L = 0;

            if (!DA.GetData(0, ref D))
            {
                return;
            }
            if (!DA.GetData(1, ref M))
            {
                return;
            }
            if (!DA.GetData(2, ref P))
            {
                return;
            }
            if (!DA.GetData(3, ref T))
            {
                return;
            }
            if (!DA.GetData(4, ref L))
            {
                return;
            }

            wObject W = new wObject();

            D.CastTo(out W);

            bool LineMode  = ((M > 2) & (M < 6));
            bool TagMode   = ((M == 1) || (M == 2));
            bool LabelMode = ((M == 0) || (LineMode));

            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(Wind.Presets.wGradients.Metro, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomStroke == 0)
            {
                if (LineMode)
                {
                    DC.SetDefaultStrokes(wStrokes.StrokeTypes.LineChart, wGradients.Metro, false, DC.Sets.Count > 1);
                }
                else
                {
                    DC.SetDefaultStrokes(wStrokes.StrokeTypes.OffWhiteSolid);
                }
            }
            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)
            {
                if (LabelMode)
                {
                    DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.None, new wGraphic(wColors.Transparent)));
                }
                else
                {
                    DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent)));
                }
            }

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

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

            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.SetNumberChartType(M, ModeStack, LineMode);
                pSeriesSet.SetChartLabels(DC.Label);
                pSeriesSet.SetNumericData(0);
                PointSeriesList.Add(pSeriesSet);
            }

            pControl.View = new Pollen.Utilities.p3D(P, T, L, (Pollen.Utilities.p3D.LightingMode)ModeLighting);

            pControl.SetSeries(PointSeriesList);
            pControl.SetThreeDView();
            pControl.SetAxisScale();
            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);
        }
Ejemplo n.º 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 pCtrl = new pViewGrid(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      = (pViewGrid)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            GH_Structure <GH_String> D = new GH_Structure <GH_String>();
            List <string>            T = new List <string>();

            if (!DA.GetDataTree(0, out D))
            {
                return;
            }
            if (!DA.GetDataList(1, T))
            {
                return;
            }

            int k = T.Count;

            for (int i = k; i < D.PathCount; i++)
            {
                T.Add(T[k - 1] + i);
            }

            pCtrl.SetProperties(GridType, false, ResizeHorizontal, Sortable, AlternateGraphics, AddlRows);
            pCtrl.SetTitles(T);

            List <List <string> > Rows = new List <List <string> >();

            k = 0;
            for (int i = 0; i < D.PathCount; i++)
            {
                if (D.Branches[i].Count > k)
                {
                    k = D.Branches[i].Count;
                }

                List <string> RowValues = new List <string>();
                for (int j = 0; j < D.Branches[i].Count; j++)
                {
                    RowValues.Add(D.Branches[i][j].ToString());
                }
                Rows.Add(RowValues);
            }

            pCtrl.SetRows(k);

            for (int i = 0; i < D.PathCount; i++)
            {
                pCtrl.AddRow(T[i], Rows[i]);
            }

            pCtrl.BuildTable();

            //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);
        }
Ejemplo n.º 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)
        {
            string        ID      = this.Attributes.InstanceGuid.ToString();
            string        name    = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text;
            List <string> newKeys = new List <string>();

            string type, format;
            GH_Structure <IGH_Goo> El;
            GH_Structure <IGH_Goo> OutPut = new GH_Structure <IGH_Goo>();

            if (!DA.GetDataTree(0, out El))
            {
                return;
            }

            for (int i = 0; i < El.Paths.Count; i++)
            {
                GH_Path Q = El.get_Path(i);
                GH_Path P = El.get_Path(i);
                P.AppendElement(0);
                for (int k = 0; k < El.get_Branch(Q).Count; k++)
                {
                    IGH_Goo X = El.get_DataItem(Q, k);


                    wObject W;
                    X.CastTo(out W);

                    format = W.Type;

                    if (format == "Parrot")
                    {
                        pElement E;
                        E = (pElement)W.Element;

                        type = E.Type;
                        newKeys.Add(E.Element.Name);

                        switch (type)
                        {
                        case ("Button"):
                            Button C0 = (Button)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C0.PreviewMouseDown -= (o, e) => { ExpireSolution(true); };
                                C0.PreviewMouseDown += (o, e) => { ExpireSolution(true); };

                                C0.PreviewMouseUp -= (o, e) => { ExpireSolution(true); };
                                C0.PreviewMouseUp += (o, e) => { ExpireSolution(true); };
                            }

                            OutPut.Append(new GH_ObjectWrapper((Mouse.LeftButton == MouseButtonState.Pressed) & C0.IsMouseOver), P);
                            break;

                        case ("Calculator"):
                            Calculator C1 = (Calculator)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C1.ValueChanged -= (o, e) => { ExpireSolution(true); };
                                C1.ValueChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C1.Value), P);
                            break;

                        case ("Calendar"):
                            Calendar C2 = (Calendar)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C2.SelectedDatesChanged -= (o, e) => { ExpireSolution(true); };
                                C2.SelectedDatesChanged += (o, e) => { ExpireSolution(true); };
                            }
                            List <IGH_Goo> Dates = new List <IGH_Goo>();

                            for (int j = 0; j < C2.SelectedDates.Count; j++)
                            {
                                OutPut.Append(new GH_ObjectWrapper(C2.SelectedDates[j]), P);
                            }
                            break;

                        case ("Clock"):
                            Clock C23 = (Clock)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C23.LayoutUpdated -= (o, e) => { ExpireSolution(true); };
                                C23.LayoutUpdated += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C23.Time), P);
                            break;

                        case ("CheckBox"):
                            CheckBox C19 = (CheckBox)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C19.Click -= (o, e) => { ExpireSolution(true); };
                                C19.Click += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C19.IsChecked), P);
                            break;

                        case ("CheckListBox"):
                            CheckListBox C3 = (CheckListBox)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C3.ItemSelectionChanged -= (o, e) => { ExpireSolution(true); };
                                C3.ItemSelectionChanged += (o, e) => { ExpireSolution(true); };
                            }
                            for (int j = 0; j < C3.SelectedItems.Count; j++)
                            {
                                OutPut.Append(new GH_ObjectWrapper(C3.SelectedItems[j]), P);
                            }
                            break;

                        case ("ColorCanvas"):
                            ColorCanvas C4 = (ColorCanvas)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C4.SelectedColorChanged -= (o, e) => { ExpireSolution(true); };
                                C4.SelectedColorChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(new wColor((System.Windows.Media.Color)C4.SelectedColor).ToDrawingColor()), P);
                            OutPut.Append(new GH_ObjectWrapper(C4.SelectedColor), P);
                            break;

                        case ("ColorPicker"):
                            ColorPicker C5 = (ColorPicker)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C5.SelectedColorChanged -= (o, e) => { ExpireSolution(true); };
                                C5.SelectedColorChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(new wColor((System.Windows.Media.Color)C5.SelectedColor).ToDrawingColor()), P);
                            break;

                        case ("CheckComboBox"):
                            CheckComboBox C6 = (CheckComboBox)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C6.ItemSelectionChanged -= (o, e) => { ExpireSolution(true); };
                                C6.ItemSelectionChanged += (o, e) => { ExpireSolution(true); };
                            }
                            for (int j = 0; j < C6.SelectedItems.Count; j++)
                            {
                                OutPut.Append(new GH_ObjectWrapper(C6.SelectedItems[j]), P);
                            }
                            break;

                        case ("RangeSlider"):
                            MahApps.Metro.Controls.RangeSlider C7 = (MahApps.Metro.Controls.RangeSlider)E.Layout.Children[0];
                            if (!keys.Contains(E.Element.Name))
                            {
                                C7.UpperValueChanged -= (o, e) => { ExpireSolution(true); };
                                C7.UpperValueChanged += (o, e) => { ExpireSolution(true); };
                                C7.LowerValueChanged -= (o, e) => { ExpireSolution(true); };
                                C7.LowerValueChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(new Interval(C7.LowerValue, C7.UpperValue)), P);
                            break;

                        case ("Slider"):
                            Slider C8 = (Slider)E.Layout.Children[0];
                            if (!keys.Contains(E.Element.Name))
                            {
                                C8.ValueChanged -= (o, e) => { ExpireSolution(true); };
                                C8.ValueChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C8.Value), P);
                            break;

                        case ("RadioButton"):
                            RadioButton C9 = (RadioButton)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C9.Checked -= (o, e) => { ExpireSolution(true); };
                                C9.Checked += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C9.IsChecked), P);
                            break;

                        case ("TimePicker"):
                            MaterialDesignThemes.Wpf.TimePicker C10 = (MaterialDesignThemes.Wpf.TimePicker)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C10.MouseUp       -= (o, e) => { ExpireSolution(true); };
                                C10.MouseUp       += (o, e) => { ExpireSolution(true); };
                                C10.LayoutUpdated -= (o, e) => { ExpireSolution(true); };
                                C10.LayoutUpdated += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C10.SelectedTime), P);
                            break;

                        case ("PickDate"):
                            DatePicker C11 = (DatePicker)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C11.SelectedDateChanged -= (o, e) => { ExpireSolution(true); };
                                C11.SelectedDateChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C11.SelectedDate), P);
                            break;

                        case ("PickDateTime"):
                            DateTimePicker C12 = (DateTimePicker)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C12.ValueChanged -= (o, e) => { ExpireSolution(true); };
                                C12.ValueChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C12.Value), P);
                            break;

                        case ("ListView"):
                            ListView C13 = (ListView)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C13.SelectionChanged -= (o, e) => { ExpireSolution(true); };
                                C13.SelectionChanged += (o, e) => { ExpireSolution(true); };
                            }
                            for (int j = 0; j < C13.Items.Count; j++)
                            {
                                Label tbox = (Label)C13.Items[j];

                                OutPut.Append(new GH_ObjectWrapper(tbox.ToolTip.ToString()), P);
                            }
                            break;

                        case ("ListBox"):
                            ListBox C14 = (ListBox)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C14.SelectionChanged -= (o, e) => { ExpireSolution(true); };
                                C14.SelectionChanged += (o, e) => { ExpireSolution(true); };
                            }
                            for (int j = 0; j < C14.SelectedItems.Count; j++)
                            {
                                OutPut.Append(new GH_ObjectWrapper(C14.SelectedItems[j]), P);
                            }
                            break;

                        case ("ComboBox"):
                            ComboBox C15 = (ComboBox)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C15.SelectionChanged -= (o, e) => { ExpireSolution(true); };
                                C15.SelectionChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C15.SelectedValue), P);
                            break;

                        case ("ScrollValue"):
                            ButtonSpinner C16 = (ButtonSpinner)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C16.Spin -= (o, e) => { ExpireSolution(true); };
                                C16.Spin += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C16.Content), P);
                            break;

                        case ("ScrollNumber"):
                            NumericUpDown C17 = (NumericUpDown)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C17.ValueChanged -= (o, e) => { ExpireSolution(true); };
                                C17.ValueChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C17.Value), P);
                            break;

                        case ("TextBox"):
                            TextBox C18 = (TextBox)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C18.TextChanged -= (o, e) => { ExpireSolution(true); };
                                C18.TextChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C18.Text), P);
                            break;

                        case ("TreeView"):
                            TreeView C20 = (TreeView)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C20.SelectedItemChanged -= (o, e) => { ExpireSolution(true); };
                                C20.SelectedItemChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C20.SelectedValue), P);
                            break;

                        case ("GridView"):
                            ListView C21 = (ListView)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C21.SelectionChanged -= (o, e) => { ExpireSolution(true); };
                                C21.SelectionChanged += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C21.Items), P);
                            break;

                        case ("Toggle"):
                            ToggleButton C22 = (ToggleButton)E.Element;
                            if (!keys.Contains(E.Element.Name))
                            {
                                C22.Click -= (o, e) => { ExpireSolution(true); };
                                C22.Click += (o, e) => { ExpireSolution(true); };
                            }
                            OutPut.Append(new GH_ObjectWrapper(C22.IsChecked), P);
                            break;
                        }
                    }
                }
            }

            keys = newKeys;

            DA.SetDataTree(0, OutPut);
            DA.SetDataList(1, keys);
        }
Ejemplo n.º 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)
        {
            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;
            int     J = 0;

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

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(wGradients.GradientTypes.Metro, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(new wFonts(wFonts.FontTypes.ChartPoint).Font);
            }
            if (DC.TotalCustomMarker == 0)
            {
                DC.SetDefaultMarkers(wGradients.GradientTypes.SolidDarkGray, false, DC.Sets.Count > 1);
            }

            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.SetStackChartType(M, J);
                pSeriesSet.SetChartLabels(DC.Labels.Position, DC.Labels.HasLeader);
                pSeriesSet.SetNumericData(2);
                PointSeriesList.Add(pSeriesSet);
            }

            pControl.SetProperties(DC);
            pControl.SetSeries(PointSeriesList);
            pControl.SetAxisAppearance();
            pControl.SetPyramidThreeDView(M);

            //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);
        }
Ejemplo n.º 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 pViewport(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      = (pViewport)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties
            string  Text            = "GH_HACK";
            int     DisplayIndex    = 0;
            int     ProjectionIndex = 0;
            wCamera Cam             = new wCameraStandard();

            if (!DA.GetData(0, ref Text))
            {
                return;
            }
            if (!DA.GetData(1, ref DisplayIndex))
            {
                return;
            }
            if (!DA.GetData(2, ref ProjectionIndex))
            {
                return;
            }
            if (!DA.GetData(3, ref Cam))
            {
                return;
            }

            pCtrl.SetProperties(Text);

            if (ZoomExtent)
            {
                pCtrl.ZoomExtents();
                ZoomExtent = false;
            }

            if (ZoomSelect)
            {
                pCtrl.ZoomSelected();
                ZoomSelect = false;
            }

            pCtrl.SetGridAxis(HasGrid, HasAxis, HasGizmo);
            pCtrl.SetCameraProjection((pViewport.CameraProjection)ProjectionIndex, Cam.LensLength);
            pCtrl.SetCameraPosition(Cam.Location, Cam.Target, Cam.Up);
            //pCtrl.SetViewPort(Rhino.RhinoDoc.ActiveDoc.Views.ToList()[0].ActiveViewport);
            pCtrl.SetViewShading(Rhino.Display.DisplayModeDescription.GetDisplayModes()[0]);

            pCtrl.BuildView();


            //Set Parrot Element and Wind Object properties
            if (!Active)
            {
                Element = new pElement(pCtrl.Element, pCtrl, pCtrl.Type);
            }

            Element.Control     = pCtrl;
            WindObject          = new wObject(Element, "Parrot", Element.Type);
            WindObject.GUID     = this.InstanceGuid;
            WindObject.Instance = C;

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
Ejemplo n.º 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)), 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);
        }
Ejemplo n.º 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)), true).Text;
            int    C    = this.RunCount;

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

            var pCtrl = new pExpand(name);

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

            IGH_Goo element = null;
            string  N       = "";
            bool    B       = false;

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

            wObject  W;
            pElement E;

            element.CastTo(out W);
            E = (pElement)W.Element;

            pCtrl.SetProperties(N, B, (int)ModeDirection);
            pCtrl.SetElement(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);
        }
Ejemplo n.º 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 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);
        }
Ejemplo n.º 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 pPointCloudViewer(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      = (pPointCloudViewer)Element.ParrotControl;
                }
            }
            else
            {
                pCtrl.SetProperties();
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            List <Point3d> P = new List <Point3d>();
            List <Color>   X = new List <Color>();
            List <double>  R = new List <double>();
            IGH_Goo        U = null;


            if (Params.Input[3].VolatileDataCount < 1)
            {
                Params.Input[3].ClearData();
                Params.Input[3].AddVolatileData(new Grasshopper.Kernel.Data.GH_Path(0), 0, InitialCamera);
            }

            if (!DA.GetDataList(0, P))
            {
                return;
            }
            if (!DA.GetDataList(1, X))
            {
                return;
            }
            if (!DA.GetDataList(2, R))
            {
                return;
            }
            if (!DA.GetData(3, ref U))
            {
                return;
            }

            wCameraStandard V = new wCameraStandard();

            U.CastTo(out V);


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

            for (int i = (R.Count - 1); i < P.Count; i++)
            {
                R.Add(R[R.Count - 1]);
            }

            pCtrl.ClearScene();

            for (int i = 0; i < P.Count; i++)
            {
                pCtrl.AddPoint(new wPoint(P[i].X, P[i].Y, P[i].Z), new wColor(X[i]), R[i]);
            }

            BoundingBox Bbox = new BoundingBox(P);

            pCtrl.SetCamera(V, Bbox.Diagonal.Length);

            pCtrl.SetNavigation(HasNavigation);
            pCtrl.SetGizmo(HasGizmo);
            pCtrl.SetCoordinateSystem(HasCoordinates);

            if (ZoomExtents)
            {
                pCtrl.ZoomExtents(1.0);
                ZoomExtents = false;
            }

            //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);
        }
Ejemplo n.º 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)), 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);
        }
Ejemplo n.º 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 pPanelGrid(name);

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

            List <IGH_Goo> X = new List <IGH_Goo>();
            List <int>     I = new List <int>();
            List <int>     J = new List <int>();
            int            D = 0;
            int            R = 0;

            // Access the input parameters
            if (!DA.GetDataList(0, X))
            {
                return;
            }
            if (!DA.GetDataList(1, I))
            {
                return;
            }
            if (!DA.GetDataList(2, J))
            {
                return;
            }
            if (!DA.GetData(3, ref D))
            {
                return;
            }
            if (!DA.GetData(4, ref R))
            {
                return;
            }

            pCtrl.SetProperties();
            pCtrl.SetColumns(D);
            pCtrl.SetRows(R);

            int k = I.Count;

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

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

            for (int i = 0; i < X.Count; i++)
            {
                wObject  W;
                pElement Elem;
                X[i].CastTo(out W);
                Elem = (pElement)W.Element;
                pCtrl.AddElement(Elem, I[i], J[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);
        }
Ejemplo n.º 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)), 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);
        }
Ejemplo n.º 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)), false).Text;
            int    C    = this.RunCount;

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

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

            //Set Unique Control Properties

            List <IGH_Goo> X = new List <IGH_Goo>();
            List <IGH_Goo> Y = new List <IGH_Goo>();
            IGH_Goo        U = null;

            if (Params.Input[1].VolatileDataCount < 1)
            {
                UpdateLightInput(1);
            }
            //if (Params.Input[2].VolatileDataCount < 1) { UpdateCameraInput(2); }

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

            wCamera V = new wCamera();

            U.CastTo(out V);

            List <wMesh> Meshes = new List <wMesh>();

            foreach (IGH_Goo Obj in X)
            {
                wMesh M = new wMesh();
                Obj.CastTo(out M);
                Meshes.Add(M);
            }

            pCtrl.SetMeshes(Meshes);

            List <wLight> Lights = new List <wLight>();

            foreach (IGH_Goo Obj in Y)
            {
                wLight L = new wLight();
                Obj.CastTo(out L);
                Lights.Add(L);
            }

            pCtrl.SetLights(Lights);

            pCtrl.BuildScene();

            pCtrl.SetCamera(V);

            pCtrl.SetNavigation(HasNavigation);
            pCtrl.SetGizmo(HasGizmo);
            pCtrl.SetCoordinateSystem(HasCoordinates);

            //if (V.IsPreset) { pCtrl.ZoomExtents(1.0); }

            if (ZoomExtents)
            {
                pCtrl.ZoomExtents(1.0);
                ZoomExtents = false;
            }

            //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);
        }
Ejemplo n.º 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)
        {
            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);
        }
Ejemplo n.º 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 pCtrl = new pViewList(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      = (pViewList)Element.ParrotControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            List <string> T = new List <string>();
            List <Color>  X = new List <Color>();

            if (!DA.GetDataList(0, T))
            {
                return;
            }
            if (!DA.GetDataList(1, X))
            {
                return;
            }

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

            if (T.Count > 0)
            {
                if (X.Count < 1)
                {
                    X.Add(Color.LightGray);
                }
            }

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

            int A = Y.Count;
            int B = T.Count;

            for (int i = A; i < B; i++)
            {
                Y.Add(Y[A - 1]);
            }

            pCtrl.SetProperties(T, Y);

            //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);
        }
Ejemplo n.º 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)
        {
            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);
        }
Ejemplo n.º 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 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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)
        {
            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 pHeatChart(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   = (pHeatChart)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;
            IGH_Goo G = null;

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

            wObject  W  = new wObject();
            wGraphic GR = new wGraphic();

            GR.Gradient = wGradients.Metro;
            D.CastTo(out W);
            G.CastTo(out GR);


            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(wGradients.Metro, false, DC.Sets.Count > 1);
            }
            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.TotalCustomStroke == 0)
            {
                DC.SetDefaultStrokes(wStrokes.StrokeTypes.Transparent);
            }
            if (DC.TotalCustomLabel == 0)
            {
                DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent)));
            }


            pControl.SetProperties(DC);
            pControl.SetPollenSeries();
            pControl.SetFormatting();
            pControl.SetToolTip();
            pControl.ForceRefresh();
            //pControl.SetAxisAppearance();

            if (G != null)
            {
                pControl.SetGradient(GR);
            }

            //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);
        }