Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public HatchStyleList Clone()
        {
            HatchStyleList res = new HatchStyleList();

            foreach (DictionaryEntry de in entries)
            {
                HatchStyle cloned = (de.Value as HatchStyle).Clone();
                res.Add(cloned);
                if ((de.Value as HatchStyle) == current)
                {
                    res.current = cloned;
                }
            }
            return(res);
        }
Esempio n. 3
0
        /// <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);
        }
Esempio n. 4
0
        bool ICommandHandler.OnCommand(string MenuId)
        {
            switch (MenuId)
            {
            case "MenuId.HatchStyleListEntry.Delete":
            {
                HatchStyleList hsl = parent;
                if (hsl != null)
                {
                    hsl.Remove(this);
                    if (propertyPage != null)
                    {
                        propertyPage.Refresh(hsl);
                    }
                }
                return(true);
            }

            case "MenuId.HatchStyleListEntry.Edit":
                propertyPage.StartEditLabel(this);
                return(true);

            case "MenuId.HatchStyleListEntry.Current":
            {
                var            dbg = propertyPage.GetParent(this);
                HatchStyleList hsl = parent;         //  propertyPage.GetParent(this) as HatchStyleList;
                if (hsl != null)
                {
                    hsl.Current = this;
                    propertyPage.Refresh(hsl);
                }
                return(true);
            }
            }
            return(false);
        }