public Tikz_Option GetOption(string optionname, Tikz_OptionType type) { foreach (TikzParseItem tpi in Children) { if (tpi is Tikz_Option) { Tikz_Option s = tpi as Tikz_Option; if (s.type == type && s.key.Trim() == optionname) return s; } } // foreach (Tikz_Option s in options) // if (s.type == type && s.key.Trim() == optionname) // return s; return null; }
/* public static void SetShiftRel(TikzContainerParseItem tcpi, double xshift, double yshift) { if (xshift != 0) { Tikz_Option o = GetOption(tcpi, "xshift", Tikz_OptionType.keyval); if (o == null) { o = new Tikz_Option(); o.type = Tikz_OptionType.keyval; o.key = "xshift"; o.numval = new Tikz_NumberUnit(); o.numval.unit = "cm"; o.numval.SetInCM(xshift); AddOption(tcpi, o); } else { o.numval.SetInCM(o.numval.GetInCM() + xshift); o.UpdateText(); } } if (yshift != 0) { Tikz_Option o = GetOption(tcpi, "yshift", Tikz_OptionType.keyval); if (o == null) { o = new Tikz_Option(); o.type = Tikz_OptionType.keyval; o.key = "yshift"; o.numval = new Tikz_NumberUnit(); o.numval.unit = "cm"; o.numval.SetInCM(yshift); AddOption(tcpi, o); } else { o.numval.SetInCM(o.numval.GetInCM() + yshift); o.UpdateText(); } } } */ public static Tikz_Option GetOption(TikzContainerParseItem tcpi, string optionname, Tikz_OptionType type) { Tikz_Option to = null; foreach (TikzParseItem tpi in tcpi.Children) { if (tpi is Tikz_Options) { Tikz_Option o = (tpi as Tikz_Options).GetOption(optionname, type); if (o != null) to = o; } } return to; }