Build() public méthode

public Build ( SqlGeography geography ) : GraphicsPath
geography SqlGeography
Résultat System.Drawing.Drawing2D.GraphicsPath
Exemple #1
0
 public ActionResult Index(int x, int y, int z)
 {
     var ymax = 1 << z;
     y = ymax - y - 1;
     var memoryStream = new MemoryStream();
     using (var bitmap = new Bitmap(256, 256))
     using (var g = Graphics.FromImage(bitmap))
     using (var pen = new Pen(Color.Blue, 2.0f))
     {
         g.CompositingMode = CompositingMode.SourceOver;
         g.CompositingQuality = CompositingQuality.HighQuality;
         var boundsGeographyLL = GetBoundingBoxInLatLng(x, y, z);
         if (boundsGeographyLL.Bottom > 0)
         {
             var states = new GeometryDataSource().Query(boundsGeographyLL.ToSqlGeography(), "states");
             var builder = new GraphicsPathBuilder(SphericalMercator.FromLonLat(boundsGeographyLL), new Size(256 ,256));
             foreach (var state in states)
             {
                 var geography = (SqlGeography) state["geom"];
                 {
                     using (var gp = builder.Build(geography))
                     {
                         g.DrawPath(pen, gp);
                     }
                 }
             }
         }
         bitmap.Save(memoryStream, ImageFormat.Png);
     }
     return File(memoryStream.ToArray(), "image/png");
 }
Exemple #2
0
 public void FillPolygon(SqlGeography geography, int i, object data = null)
 {
     using (var gp = _graphicsPathBuilder.Build(geography))
         using (var brush = Utf8Grid.CreateBrush(i))
         {
             _graphics.FillPath(brush, gp);
         }
     if (data != null)
     {
         this.Data.Add(i.ToString(), data);
     }
 }
Exemple #3
0
 private static GraphicsPath CreateGraphicsPath(RectangleF bounds, Bitmap bitmap, SqlGeography geography)
 {
     var builder = new GraphicsPathBuilder(bounds, bitmap.Size);
     var gp = builder.Build(geography);
     return gp;
 }