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)
        {
            IGH_Goo Element = null;
            int     M       = 0;
            int     R       = 10;

            System.Drawing.Color F = System.Drawing.Color.DarkGray;
            System.Drawing.Color S = System.Drawing.Color.Transparent;
            double T = 0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref M))
            {
                return;
            }
            if (!DA.GetData(2, ref R))
            {
                return;
            }
            if (!DA.GetData(3, ref F))
            {
                return;
            }
            if (!DA.GetData(4, ref S))
            {
                return;
            }
            if (!DA.GetData(5, ref T))
            {
                return;
            }

            wObject W;

            Element.CastTo(out W);

            wGraphic G = new wGraphic();

            G.Background  = new wColor(F);
            G.StrokeColor = new wColor(S);
            G.SetUniformStrokeWeight(T);

            wMarker CustomMarker = new wMarker((wMarker.MarkerType)M, (int)R, G);

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

                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt Pt = (DataPt)W.Element;
                    Pt.SetMarker(CustomMarker);

                    W.Element = Pt;
                    break;

                case "DataSet":
                    DataSetCollection St = (DataSetCollection)W.Element;
                    St.SetUniformMarkers(CustomMarker);

                    W.Element = St;
                    break;
                }
                break;
            }

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