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

            System.Drawing.Color Background = wColors.VeryLightGray.ToDrawingColor();

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

            wObject W = new wObject();

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

            G.FillType = wGraphic.FillTypes.Solid;

            G.Background = new wColor(Background);
            G.Foreground = new wColor(Background);

            G.WpfFill      = new wFillSolid(G.Background).FillBrush;
            G.CustomFills += 1;

            W.Graphics = G;

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

                C.SetFill();

                break;

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

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

                    W.Element = tDataPt;
                    break;

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

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

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

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

                    pC.SetSolidFill();

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

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

                Shapes.Graphics.Background = new wColor(Background);
                Shapes.Graphics.Foreground = new wColor(Background);

                W.Element = Shapes;
                break;
            }

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