示例#1
0
文件: Layer.cs 项目: hakbra/SGIS
        public Layer(string n)
        {
            name = n;
            shapetype = ShapeType.EMPTY;
            Visible = true;
            Features = new Dictionary<int, Feature>();
            Selected = new List<Feature>();
            shapetype = ShapeType.EMPTY;

            Style = new Style();
        }
示例#2
0
文件: Render.cs 项目: hakbra/SGIS
 // draws arbitrary geometry
 public void Draw(IGeometry ge, Graphics gr, Style c)
 {
     if (ge.GeometryType == "Polygon")
         drawPolygon((Polygon)ge, gr, c);
     if (ge.GeometryType == "MultiPolygon" || ge.GeometryType == "MultiLineString")
         foreach(IGeometry g in ((IGeometryCollection)ge).Geometries)
             Draw(g, gr, c);
     if (ge.GeometryType == "LineString")
         drawLine((LineString)ge, gr, c);
     if (ge.GeometryType == "Point")
         drawPoint((NTSPoint)ge, gr, c);
 }
示例#3
0
文件: Render.cs 项目: hakbra/SGIS
        private void drawPoint(NTSPoint ge, Graphics gr, Style c)
        {
            float rad = Math.Max(1, c.pen.Width * 5 * (float)scale.X);
            var mid = ScaleAndOffSet(ge);

            gr.FillEllipse(c.brush, (int)(mid.X - rad), (int)(mid.Y - rad), (int)(rad*2), (int)(rad*2));
        }
示例#4
0
文件: Render.cs 项目: hakbra/SGIS
        // draws polygon and then path around polygon
        private void drawPolygon(Polygon ge, Graphics gr, Style c)
        {
            System.Drawing.Drawing2D.GraphicsPath gp = CreatePath(ge.ExteriorRing);

            var hulls = ge.InteriorRings;
            for (int h = 0; h < hulls.Count(); h++)
                gp.AddPath(CreatePath(hulls[h]), false);

            gp.FillMode = System.Drawing.Drawing2D.FillMode.Alternate;
            gr.FillPath(c.brush, gp);

            if (c.pen.Width > 0)
                gr.DrawPath(c.pen, gp);
        }
示例#5
0
文件: Render.cs 项目: hakbra/SGIS
 private void drawLine(LineString ge, Graphics gr, Style c)
 {
     var points = ge.Coordinates;
     for (int i = 1; i < points.Count(); i++)
     {
         var a = ScaleAndOffSet(new NTSPoint(points[i - 1]));
         var b = ScaleAndOffSet(new NTSPoint(points[i]));
         gr.DrawLine(c.pen, (int)a.X, (int)a.Y, (int)b.X, (int)b.Y);
     }
 }