Beispiel #1
0
        // pcb

        public Module()
        {
            UserText  = new List <fp_text>();
            Borders   = new List <fp_shape>();
            Pads      = new List <pad>();
            CadModels = new List <model>();

            Reference = new fp_text("reference", "Ref", new PointF(0, 0), "F.SilkS", new SizeF(1.5f, 1.5f), 0.15f, false);
            Value     = new fp_text("value", "Val", new PointF(0, 0), "F.Fab", new SizeF(1.5f, 1.5f), 0.15f, false);
        }
Beispiel #2
0
        public static fp_text Parse(SNodeBase node)
        {
            fp_text result = new fp_text();

            if ((node is SExpression) && ((node as SExpression).Name == "fp_text"))
            {
                SExpression expr = node as SExpression;

                result.Type  = (expr.Items[0] as SNodeAtom).Value;
                result.Value = (expr.Items[1] as SNodeAtom).Value;

                int index = 2;

                while (index < expr.Items.Count)
                {
                    if (expr.Items[index] is SExpression)
                    {
                        SExpression sub = expr.Items[index] as SExpression;
                        if (sub.Name == "at")
                        {
                            result.position = Position.Parse(sub);
                        }
                        else if (sub.Name == "effects")
                        {
                            result.effects = TextEffects.Parse(sub);
                        }
                        else if (sub.Name == "layer")
                        {
                            result.layer = Layer.ParseLayer(sub);
                        }
                    }
                    else
                    {
                        SNodeAtom atom = expr.Items[index] as SNodeAtom;

                        if (atom.Value == "hide")
                        {
                            result.visible = false;
                        }
                    }

                    index++;
                }
                return(result);
            }
            else
            {
                return(null);  // error
            }
        }