示例#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;
            double  width   = 0;
            double  height  = 0;
            double  scale   = 1.0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref width))
            {
                return;
            }
            if (!DA.GetData(2, ref height))
            {
                return;
            }
            if (!DA.GetData(3, ref scale))
            {
                return;
            }

            wObject W = new wObject();

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

            G.Width  = width;
            G.Height = height;
            G.Scale  = scale;

            W.Graphics = G;

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

                C.Graphics = G;
                C.SetSize();
                break;

            case "Pollen":
                switch (W.SubType)
                {
                default:
                    pElement El = (pElement)W.Element;
                    pChart   P  = (pChart)El.PollenControl;
                    P.Graphics = G;

                    P.SetSize();
                    break;

                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    W.Element = tDataPt;
                    break;

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

                    tDataSet.SetSeriesScales();

                    tDataSet.SetScales();
                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

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

                    pC.SetSize();
                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;
            }

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