static public bool IncludeAttributeList(IAttributeListContainer Including, IAttributeListContainer Included, string ListName, bool Initialize) { bool res = false; if (Including == null || Included == null) { return(res); } IAttributeList toAdd = Included.GetList(ListName); IAttributeList addTo = Including.GetList(ListName); if (toAdd == null || addTo == null) { return(res); } for (int i = 0; i < toAdd.Count; i++) { INamedAttribute na = toAdd.Item(i); if (addTo.Find(na.Name) == null) { addTo.Add(na); res = true; } } if (res) { UpdateLists(Including, false); } return(res); }
static public bool CloneAttributeList(IAttributeListContainer From, IAttributeListContainer To, string ListName, bool Initialize) { IAttributeList toAdd = null; if (From != null) { toAdd = From.GetList(ListName); if (toAdd != null) { toAdd = toAdd.Clone(); } } if (toAdd == null) { switch (ListName) { case "ColorList": toAdd = new ColorList(); break; case "LayerList": toAdd = new LayerList(); break; case "HatchStyleList": toAdd = new HatchStyleList(); break; case "DimensionStyleList": toAdd = new DimensionStyleList(); break; case "LineWidthList": toAdd = new LineWidthList(); break; case "LinePatternList": toAdd = new LinePatternList(); break; case "StyleList": toAdd = new StyleList(); break; default: return(false); } if (Initialize) { toAdd.Initialize(); } } To.Add(ListName, toAdd); return(true); }
static public void UpdateLists(IAttributeListContainer container, bool AddMissingToList) { if (container == null) { return; } for (int i = 0; i < container.ListCount; i++) { container.List(i).Update(AddMissingToList); } ; }
static public void UpdateObjectAttrinutes(IAttributeListContainer container, IGeoObject Object2Update) { if (container == null) { return; } for (int i = 0; i < container.ListCount; i++) { container.List(i).Update(Object2Update); if (Object2Update.HasChildren()) { for (int j = 0; j < Object2Update.NumChildren; j++) { container.List(i).Update(Object2Update.Child(j)); } } } }
/// <summary> /// </summary> /// <returns></returns> public static HatchStyleList GetDefault(IAttributeListContainer container) { HatchStyleList res = new HatchStyleList(); HatchStyleSolid sol = new HatchStyleSolid(); sol.Name = StringTable.GetString("HatchStyleList.DefaultSolid"); sol.Color = container.ColorList.Current; res.Add(sol); HatchStyleLines lin = new HatchStyleLines(); lin.Name = StringTable.GetString("HatchStyleList.DefaultLines"); lin.LineDistance = 10.0; lin.LineAngle = new Angle(1.0, 1.0); // 45° lin.ColorDef = container.ColorList.Current; lin.LineWidth = container.LineWidthList.Current; lin.LinePattern = container.LinePatternList.Current; res.Add(lin); return(res); }