private void btnConstructPolyline_Click(object sender, EventArgs e) { if (gfactory == null) gfactory = new GeometryFactory(); point = gfactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); polyline = gfactory.CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline; int length = 100; for (int i = 0; i < length; i++) { point.SetCoords(i, 2 * i, 0, 0, i + 1); polyline.AppendPoint(point); } if (polyline == null) return; CompoundLine geo = new CompoundLine(); // Geometry属性 geo.Dimension = polyline.Dimension; if (polyline.Envelope != null) { geo.MaxX = polyline.Envelope.MaxX; geo.MaxY = polyline.Envelope.MaxY; geo.MaxZ = polyline.Envelope.MaxZ; geo.MinX = polyline.Envelope.MinX; geo.MinY = polyline.Envelope.MinY; geo.MinZ = polyline.Envelope.MinZ; } geo.GeometryType = polyline.GeometryType; geo.IsEmpty = polyline.IsEmpty; geo.IsValid = polyline.IsValid; geo.VertexAttribute = polyline.VertexAttribute; geo.HasId = polyline.HasId(); geo.HasM = polyline.HasM(); geo.HasZ = polyline.HasZ(); // Curve属性 geo.IsClosed = polyline.IsClosed; geo.Length = polyline.Length; if (polyline.StartPoint != null) { geo.StartPointX = polyline.StartPoint.X; geo.StartPointY = polyline.StartPoint.Y; geo.StartPointZ = polyline.StartPoint.Z; } if (polyline.EndPoint != null) { geo.EndPointX = polyline.EndPoint.X; geo.EndPointY = polyline.EndPoint.Y; geo.EndPointZ = polyline.EndPoint.Z; } // CompoundLine属性 geo.PointCount = polyline.PointCount; geo.SegmentCount = polyline.SegmentCount; this.propertyGrid1.SelectedObject = geo; }