Exemple #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     J       = vJustify * 3 + hJustify;

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

            wObject W = new wObject();

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

            GetFont.Font  = new wFont(fName, fSize, new wColor(DrawColor), (wFontBase.Justification)J, IsBold, IsItalic, IsUnder, false).ToDrawingFont().FontObject;
            GetFont.Color = DrawColor;

            if (toggle)
            {
                GetFont.ShowDialog();

                fName = GetFont.Font.Name;
                fSize = GetFont.Font.Size;

                IsBold   = GetFont.Font.Bold;
                IsItalic = GetFont.Font.Italic;
                IsUnder  = GetFont.Font.Underline;

                DrawColor = GetFont.Color;

                toggle = false;
            }

            wFont F = new wFont(fName, fSize, new wColor(DrawColor), (wFontBase.Justification)J, IsBold, IsItalic, IsUnder, false);

            G.FontObject   = F;
            G.CustomFonts += 1;

            W.Graphics = G;

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

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

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

                    W.Element = tDataPt;
                    break;

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

                    tDataSet.TotalCustomTitles += 1;

                    W.Element = tDataSet;

                    break;

                case "Chart":
                case "Table":
                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetFont();

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

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;

                Shapes.Fonts = F;

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G.FontObject);
            DA.SetData(2, G);
        }
Exemple #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)
        {
            IGH_Goo Element = null;
            string  N       = "Arial";
            double  S       = 8;

            System.Drawing.Color X = System.Drawing.Color.Black;
            int  J = 0;
            bool B = false;
            bool I = false;
            bool U = false;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref N))
            {
                return;
            }
            if (!DA.GetData(2, ref S))
            {
                return;
            }
            if (!DA.GetData(3, ref X))
            {
                return;
            }
            if (!DA.GetData(4, ref J))
            {
                return;
            }
            if (!DA.GetData(5, ref B))
            {
                return;
            }
            if (!DA.GetData(6, ref I))
            {
                return;
            }
            if (!DA.GetData(7, ref U))
            {
                return;
            }

            wObject W = new wObject();

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

            wFont F = new wFont(N, S, new wColor(X), (wFontBase.Justification)J, B, I, U, false);

            G.FontObject = F;

            W.Graphics = G;

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

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

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

                    W.Element = tDataPt;
                    break;

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

                    tDataSet.TotalCustomTitles += 1;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":
                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetFont();

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

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;

                Shapes.Fonts = F;

                W.Element = Shapes;
                break;
            }

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