/// <summary>
 /// Extracts style information.
 /// </summary>
 /// <param name="polygon"></param>
 /// <param name="layer"></param>
 /// <returns></returns>
 public static Polygon2DStyle From(Polygon2D polygon, int layer)
 {
     Polygon2DStyle newStyle = new Polygon2DStyle();
     newStyle.Color = polygon.Color;
     newStyle.MaxZoom = polygon.MaxZoom;
     newStyle.MinZoom = polygon.MinZoom;
     newStyle.Fill = polygon.Fill;
     newStyle.Width = polygon.Width;
     newStyle.Layer = layer;
     return newStyle;
 }
 /// <summary>
 /// Sets style information.
 /// </summary>
 /// <param name="polygon"></param>
 public void Set(Polygon2D polygon)
 {
     polygon.Color = this.Color;
     polygon.MaxZoom = this.MaxZoom;
     polygon.MinZoom = this.MinZoom;
     polygon.Fill = this.Fill;
     polygon.Width = this.Width;
 }
 /// <summary>
 /// Adds a new style and returns it's index.
 /// </summary>
 /// <param name="polygon"></param>
 /// <param name="layer"></param>
 /// <returns></returns>
 public ushort AddStyle(Polygon2D polygon, int layer)
 {
     Polygon2DStyle newStyle = Polygon2DStyle.From(polygon, layer);
     int indexOf = this.PolygonStyles.IndexOf(newStyle);
     if (indexOf < 0)
     { // the style is not found yet.
         indexOf = this.PolygonStyles.Count;
         this.PolygonStyles.Add(newStyle);
     }
     return (ushort)indexOf;
 }