多边形对象。
Inheritance: GeometryBase
 private void dataGridView1_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (_graphicsLayer == null) return;
     _graphicsLayer.Markers.Clear();
     _graphicsLayer.Polygons.Clear();
     _graphicsLayer.Lines.Clear();
     Geometry geometry = this.dataGridView1.Rows[e.RowIndex].Tag as Geometry;
     if (geometry != null)
     {
         switch (geometry.Type)
         {
             case GeometryType.POINT:
                 Marker marker = new Marker(e.RowIndex.ToString(), new Point2D(geometry.Points[0].X, geometry.Points[0].Y),
                      MarkerType.Red_Dot, null);
                 _graphicsLayer.Markers.Add(marker);
                 break;
             case GeometryType.LINE:
                 Line line = new Line(e.RowIndex.ToString(), new List<Point2D>(geometry.Points), 4.5, System.Drawing.Color.FromArgb(125, 0, 0, 255));
                 _graphicsLayer.Lines.Add(line);
                 break;
             case GeometryType.REGION:
                 Polygon polygon = new Polygon(e.RowIndex.ToString(), new List<Point2D>(geometry.Points), System.Drawing.Color.FromArgb(125, 0, 255, 0), System.Drawing.Color.FromArgb(50, 0, 0, 255),
                     4.5);
                 _graphicsLayer.Polygons.Add(polygon);
                 break;
             default:
                 break;
         }
     }
 }
 public PolygonMapGMapPolygon(Polygon polygon, GMapPolygon gMapPolygon)
 {
     this._gMapPolygon = gMapPolygon;
     this._polygon = polygon;
 }
        public override void OnLoad(MapControl mapControl)
        {
            base.OnLoad(mapControl);
            this.ActionDescription = "矩形圈选删除";
            if (_layer == null)
            {
                _layer = new GraphicsLayer(Guid.NewGuid().ToString(), "DelByRectActionLayer");

            }
            this.ServiceUrl = ((MapLayer)mapControl.MapLayer).ServiceUrl;
            this._mapName = ((MapLayer)mapControl.MapLayer).MapName;
            if (!mapControl.GraphicsLayers.Contains(_layer, new LayerComparer()))
            {
                mapControl.GraphicsLayers.Add(_layer);
            }
            if (_rect == null)
            {
                _rect = new Polygon(Guid.NewGuid().ToString(), new List<Point2D>(), Draw.Color.FromArgb(100, 0, 0, 255), Draw.Color.FromArgb(255, 0, 0, 255), 1);
            }
        }
        public static List<Polygon> CreatePolygon(GraphicsLayer graLayer, Feature feature, UGCLayer layer, Recordset recordset, Draw.Color fillColor, Draw.Color strokeColor)
        {
            int index = 0;
            List<Polygon> list = new List<Polygon>();
            int all = feature.Geometry.Parts.Sum();
            for (int i = 0; i < feature.Geometry.Parts.Length; i++)
            {
                Point2D[] points = feature.Geometry.Points.Skip(index).Take(feature.Geometry.Parts[i]).ToArray();
                Polygon polygon = new Polygon(feature.Id.ToString() + "@" + layer.DatasetInfo.Name + "@" + layer.DatasetInfo.DataSourceName + "@" + i.ToString(), points.ToList(), fillColor, strokeColor, 1);
                Dictionary<string, string> property = new Dictionary<string, string>();
                property[PropertyName.LayerName] = recordset.DatasetName;
                property[PropertyName.GraphicsLayerID] = graLayer.ID;
                property[PropertyName.SMID] = feature.Id.ToString();
                polygon.Tag = property;
                graLayer.Polygons.Add(polygon);
                list.Add(polygon);
                index += feature.Geometry.Parts[i];
            }

            return list;
        }
 protected override void MouseDown(System.Windows.Forms.MouseEventArgs e)
 {
     base.MouseDown(e);
     _startFlag = true;
     if (_rect != null)
     {
         if (_layer.Polygons.Contains(_rect))
         {
             _layer.Polygons.Remove(_rect);
         }
     }
     else
     {
         _rect = new Polygon(Guid.NewGuid().ToString(), new List<Point2D>(), Draw.Color.FromArgb(100, 0, 0, 255), Draw.Color.FromArgb(255, 0, 0, 255), 1);
     }
     Point2D startPoint = this.Map.ScreenToMap(e.Location);
     _rect.Point2Ds.Clear();
     _rect.Point2Ds.Add(startPoint);
 }
        public override void OnLoad(MapControl mapControl)
        {
            base.OnLoad(mapControl);
            this.ActionDescription = "画多边形";
            if (_layer == null)
            {
                _layer = new GraphicsLayer(Guid.NewGuid().ToString(), "QueryByPolygonActionLayer");

            }
            this.ServiceUrl = ((MapLayer)mapControl.MapLayer).ServiceUrl;
            this._mapName = ((MapLayer)mapControl.MapLayer).MapName;
            if (!mapControl.GraphicsLayers.Contains(_layer, new LayerComparer()))
            {
                mapControl.GraphicsLayers.Add(_layer);
            }
            if (_polygon == null)
            {
                _polygon = new Polygon(Guid.NewGuid().ToString(), new List<Point2D>(), Draw.Color.FromArgb(100, 0, 0, 255), Draw.Color.FromArgb(255, 0, 0, 255), 1);
            }
            if (_points == null)
            {
                _points = new List<Point2D>();
            }
            _resultForm.MapControl = mapControl;
        }