/// <summary> /// Returns a deep copy. /// </summary> /// <param name="model">The model the copy belongs to.</param> public ItemList Clone(GraphModel model) { ItemList l = new ItemList(model); for (int i = 0; i < Count; i++) { l.Add(this[i].Clone()); } return l; }
/// <summary> /// Copies from another model with a deep copy. /// </summary> /// <param name="m">The model to copy from.</param> public void CopyFrom(GraphModel m) { X0 = m.X0; X1 = m.X1; Y0 = m.Y0; Y1 = m.Y1; Z0 = m.Z0; Z1 = m.Z1; rx = m.rx; ry = m.ry; rz = m.rz; xAxis = m.xAxis; yAxis = m.yAxis; xRaster = m.xRaster; yRaster = m.yRaster; xGrid = m.xGrid; yGrid = m.yGrid; xScale = m.xScale; yScale = m.yScale; zScale = m.zScale; Border = m.Border; FixYtoX = m.FixYtoX; Legend = m.Legend; LegendBorder = m.LegendBorder; xDigits = m.xDigits; yDigits = m.yDigits; zDigits = m.zDigits; xNumberStyle = m.xNumberStyle; yNumberStyle = m.yNumberStyle; zNumberStyle = m.zNumberStyle; ScaleFont = m.ScaleFont; ScaleColor = m.ScaleColor; Filename = (string)m.Filename.Clone(); Items = m.Items.Clone(this); Library = (SourceLibrary)m.Library.Clone(); CompilerImports = (string[])m.CompilerImports.Clone(); //Deep Copy of CompilerOptions CompilerOptions.Clear(); IEnumerator keys, values; keys = m.CompilerOptions.Keys.GetEnumerator(); values = m.CompilerOptions.Values.GetEnumerator(); keys.Reset(); values.Reset(); for (int i = 0; i < m.CompilerOptions.Count; i++) { keys.MoveNext(); values.MoveNext(); CompilerOptions.Add(keys.Current, values.Current); } Modified = true; }
/// <summary> /// The default constructor. /// </summary> public GraphModel() { X0 = Y0 = Z0 = -1; X1 = Y1 = Z1 = rx = ry = rz = 1; xScale = yScale = zScale = xRaster = yRaster = Border = LegendBorder = true; xGrid = yGrid = xAxis = yAxis = Legend = FixYtoX = false; xDigits = yDigits = zDigits = 3; xNumberStyle = yNumberStyle = zNumberStyle = NumberStyle.Normal; ScaleFont = new System.Drawing.Font("Arial", 8); ScaleColor = Color.Black; Items = new ItemList(this); Library = new SourceLibrary(this); CompilerImports = new string[0]; CompilerOptions = new ListDictionary(); CompilerOptions.Add("target", "library"); CompilerOptions.Add("o", true); ResetRaster(); this.Filename = "Noname.fplot"; }