public void ShowMap(IEnumerable<Feature> features, bool isGeographic, bool showmap, string backgroundImageFile)
 {
     this.map = new Map();
     Envelope envelope = null;
     foreach (Feature feature in features)
     {
         Geometry g = feature.Geometry;
         g.STAsGML();
         MapRegion item = new MapRegion(this.map);
         item.Geometry = g;
         item.Attributes = feature.Attributes;
         double result = 1.0;
         if (feature.Attributes.Keys.Contains<string>("FillColor"))
         {
             item.FillColor = this.ConvertToColor(feature.Attributes["FillColor"], "White");
         }
         else
         {
             item.FillColor = "White";
         }
         if (feature.Attributes.Keys.Contains<string>("LineColor"))
         {
             item.LineColor = this.ConvertToColor(feature.Attributes["LineColor"], "Black");
         }
         else
         {
             item.LineColor = "Black";
         }
         if (feature.Attributes.Keys.Contains<string>("LineThickness"))
         {
             double num2 = 1.0;
             double.TryParse(feature.Attributes["LineThickness"].ToString(), out num2);
             item.LineThickness = num2;
         }
         if (feature.Attributes.Keys.Contains<string>("PointSize") && double.TryParse(feature.Attributes["PointSize"].ToString(), out result))
         {
             result *= 0.5;
         }
         if (g is Point)
         {
             Point point = g as Point;
             MapPath path = new MapPath();
             path.PathData = string.Format("M {2},{1} L {3},{1} M {0},{4} L {0} {5}", new object[] { point.X, point.Y, point.X - result, point.X + result, point.Y - result, point.Y + result });
             item.Geometries.Add(path);
         }
         if (g is LineString)
         {
             LineString line = g as LineString;
             if (isGeographic)
             {
                 MultiLineString str2 = line.SphericDensify(1.0);
                 foreach (LineString str3 in str2.Geometries)
                 {
                     MapPath path2 = new MapPath();
                     path2.PathData = str3.ToWpfPathString();
                     item.Geometries.Add(path2);
                 }
                 g = str2;
             }
             else
             {
                 MapPath path3 = new MapPath();
                 path3.PathData = line.ToWpfPathString();
                 item.Geometries.Add(path3);
             }
         }
         else if (g is MultiLineString)
         {
             MultiLineString str4 = (g as MultiLineString).SphericDensify(1.0);
             foreach (LineString str5 in str4.Geometries)
             {
                 MapPath path4 = new MapPath();
                 path4.PathData = str5.ToWpfPathString();
                 item.Geometries.Add(path4);
             }
             g = str4;
         }
         else if (g is Polygon)
         {
             Polygon poly = g as Polygon;
             MapPath path5 = new MapPath();
             path5.PathData = poly.ToWpfPathString();
             item.Geometries.Add(path5);
         }
         else if (g is MultiPolygon)
         {
             MultiPolygon polygon2 = g as MultiPolygon;
             foreach (Polygon polygon3 in polygon2.Geometries)
             {
                 MapPath path6 = new MapPath();
                 path6.PathData = polygon3.ToWpfPathString();
                 item.Geometries.Add(path6);
             }
         }
         else if (g is GeometryCollection)
         {
             GeometryCollection geometrys = g as GeometryCollection;
             foreach (Geometry geometry2 in geometrys.Geometries)
             {
                 MapPath path7 = new MapPath();
                 if (geometry2 is Polygon)
                 {
                     path7.PathData = (geometry2 as Polygon).ToWpfPathString();
                 }
                 else if (geometry2 is LineString)
                 {
                     path7.PathData = (geometry2 as LineString).ToWpfPathString();
                 }
                 if (!string.IsNullOrEmpty(path7.PathData))
                 {
                     item.Geometries.Add(path7);
                 }
             }
         }
         Envelope envelope2 = g.GetEnvelope();
         envelope = envelope2.Join(envelope);
         item.BoundingBox = envelope2.ToRect();
         this.map.Regions.Add(item);
     }
     if ((envelope != null) && (this.map.Regions.Count != 0))
     {
         this.map.BoundingBox = new Rect(envelope.MinX, envelope.MinY, envelope.Width, envelope.Height);
         this.map.ScaleTo(new Size(this.MasterCanvas.ActualWidth, this.MasterCanvas.ActualHeight));
         if (((isGeographic && showmap) && ((envelope.MinX > -200.0) && (envelope.MinY > -100.0))) && ((envelope.MaxX < 200.0) && (envelope.MaxY < 100.0)))
         {
             if (this.BackgroundWorldMap.Visibility == Visibility.Hidden)
             {
                 this.LoadBackgroundMap(backgroundImageFile);
             }
         }
         else
         {
             this.BackgroundWorldMap.Visibility = Visibility.Hidden;
         }
         object obj1 = base.Resources["PolygonTemplate"];
         this.MasterCanvas.DataContext = this.map;
     }
 }
 public void ShowBlankMap(string backgroundImageFile)
 {
     this.map = new Map();
     this.map.BoundingBox = new Rect(-180.0, -90.0, 360.0, 180.0);
     this.map.ScaleTo(new Size(this.MasterCanvas.ActualWidth, this.MasterCanvas.ActualHeight));
     this.LoadBackgroundMap(backgroundImageFile);
     this.MasterCanvas.DataContext = this.map;
 }