Exemplo n.º 1
0
        /*
         *      /// <summary>
         *      /// Gets the LayerList in sync with the ColorList.
         *      /// The layer in the layer list may refer to a color. There is a color list in the same
         *      /// context. (The context is given by an object that implements <see cref="IAttributeListContainer"/>,
         *      /// currently there are <see cref="Project"/> and <see cref="Settings"/> that implement IAttributeListContainer)
         *      /// This Update method redirects all references of layers in this list to colors in the related
         *      /// color list. If a color is not in the colorlist, it will be added.
         *      /// </summary>
         *      public void Update()
         *      {
         *              ColorList cl = ColorList;
         *              for (int i=0; i<entries.Count; ++i)
         *              {
         *                      Layer l = entries.GetByIndex(i) as Layer;
         *                      ColorDef cd = l.ColorDef;
         *                      if (cd!=null)
         *                      {
         *                              if (cd.Source==ColorDef.ColorSource.fromName)
         *                              {
         *                                      ColorDef found = cl.GetColorDef(cd.Name);
         *                                      if (found!=null)
         *                                      {	// im Layer die Farbe ersetzen
         *                                              if (cd!=found) l.ColorDef = found;
         *                                      }
         *                                      else
         *                                      {	// die Farbe gibt es in der ColorList nicht, also erzeugen
         *                                              cl.AddColorDef(cd);
         *                                      }
         *                              }
         *                      }
         *              }
         *      }
         */
        /// <summary>
        /// Liefert eine LayerList aus der StringResource. Wird benötigt, wenn keine
        /// globale LayerListe gegeben ist.
        /// </summary>
        /// <returns>Die Default LayerList</returns>
        public static LayerList GetDefault()
        {
            LayerList res = new LayerList();
            string    defaultLayerList = StringTable.GetString("LayerList.Default");

            string[] split = defaultLayerList.Split(new char[] { defaultLayerList[0] });
            foreach (string Name in split)
            {
                if (Name.Length > 0)
                {
                    Layer NewLayer = new Layer(Name);
                    res.Add(NewLayer);
                }
            }
            return(res);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Alle Layer sollen sich mit ihrer ColorDef Property auf ColorDef Objekte
        /// aus der im Parameter gegebenen Liste beziehen. Die Liste wird ggf. erweitert.
        /// </summary>
        /// <param name="ct">Die Liste der benannten Farben</param>
        internal LayerList clone()
        {
            LayerList res = new LayerList();

            foreach (DictionaryEntry de in entries)
            {
                res.Add((de.Value as Layer).Clone());
            }
            if (current != null)
            {
                res.current = res.Find(current.Name);
            }
            else
            {
                res.current = null;
            }
            return(res);
        }