Example #1
0
 /// <summary>
 /// Function to search for a layer in this collection by its name
 /// </summary>
 /// <param name="layerName">The name of the layer to search for</param>
 /// <returns>The layer if found, otherwise <value>null</value></returns>
 public ILayer GetLayerByName(string layerName)
 {
     lock (this)
     {
         LayerCollection lays = this;
         return(GetLayerByNameInternal(layerName, lays));
     }
 }
Example #2
0
 /// <summary>
 /// Method to add all layers of <paramref name="other"/> to this collection
 /// </summary>
 /// <param name="other">A collection of layers</param>
 public void AddCollection(LayerCollection other)
 {
     lock (this)
     {
         foreach (var lay in other)
         {
             Add(lay);
         }
     }
 }
Example #3
0
 /// <summary>
 /// Creates an instance of this class
 /// </summary>
 /// <param name="variableLayers">Layer collection that holds layers with data sources updating frequently</param>
 public VariableLayerCollection(LayerCollection variableLayers)
 {
     _variableLayers = variableLayers;
     if (_timer == null)
     {
         _timer          = new Timer();
         _timer.Interval = 500;
         _timer.Elapsed += new ElapsedEventHandler(TimerElapsed);
     }
 }
Example #4
0
 /// <summary>
 /// Returns a cloned copy of the LayerCollection
 /// </summary>
 /// <remarks>
 /// The layer instances are the same as in the original collection, however if a layer implements ICloneable this could not be true.
 /// </remarks>
 /// <returns></returns>
 public LayerCollection Clone()
 {
     lock (this)
     {
         var newColl = new LayerCollection();
         foreach (ILayer lay in this)
         {
             var cloneable = lay as ICloneable;
             if (cloneable != null)
             {
                 newColl.Add((ILayer)cloneable.Clone());
             }
             else
             {
                 newColl.Add(lay);
             }
         }
         return(newColl);
     }
 }