Exemple #1
0
        private void btnConstructCompoundLine_Click(object sender, EventArgs e)
        {
            if (gfactory == null)
                gfactory = new GeometryFactory();

            IPoint point1 = gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
            point1.SetCoords(3.56, 4, 5, 0, 1);
            IPoint point2 = gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
            point2.SetCoords(1, -1, 0, 0, 2);
            IPoint point3 = gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
            point3.SetCoords(2, 0, 0, 0, 3);

            circularArc = gfactory.CreateGeometry(gviGeometryType.gviGeometryCircularArc, gviVertexAttribute.gviVertexAttributeZ) as ICirculeArc;
            circularArc.ConstructThreePoints(point1, point2, point3);
            if (circularArc == null)
                return;

            compoundLine = gfactory.CreateGeometry(gviGeometryType.gviGeometryCompoundLine, gviVertexAttribute.gviVertexAttributeZ) as ICompoundLine;
            compoundLine.AppendSegment(circularArc);
            if (compoundLine == null)
                return;

            CompoundLine geo = new CompoundLine();
            // Geometry属性
            geo.Dimension = compoundLine.Dimension;
            if (compoundLine.Envelope != null)
            {
                geo.MaxX = compoundLine.Envelope.MaxX;
                geo.MaxY = compoundLine.Envelope.MaxY;
                geo.MaxZ = compoundLine.Envelope.MaxZ;
                geo.MinX = compoundLine.Envelope.MinX;
                geo.MinY = compoundLine.Envelope.MinY;
                geo.MinZ = compoundLine.Envelope.MinZ;
            }
            geo.GeometryType = compoundLine.GeometryType;
            geo.IsEmpty = compoundLine.IsEmpty;
            geo.IsValid = compoundLine.IsValid;
            geo.VertexAttribute = compoundLine.VertexAttribute;
            geo.HasId = compoundLine.HasId();
            geo.HasM = compoundLine.HasM();
            geo.HasZ = compoundLine.HasZ();
            // Curve属性
            geo.IsClosed = compoundLine.IsClosed;
            geo.Length = compoundLine.Length;
            if (compoundLine.StartPoint != null)
            {
                geo.StartPointX = compoundLine.StartPoint.X;
                geo.StartPointY = compoundLine.StartPoint.Y;
                geo.StartPointZ = compoundLine.StartPoint.Z;
            }
            if (compoundLine.EndPoint != null)
            {
                geo.EndPointX = compoundLine.EndPoint.X;
                geo.EndPointY = compoundLine.EndPoint.Y;
                geo.EndPointZ = compoundLine.EndPoint.Z;
            }
            // CompoundLine属性
            geo.PointCount = compoundLine.PointCount;
            geo.SegmentCount = compoundLine.SegmentCount;

            this.propertyGrid1.SelectedObject = geo;
        }
Exemple #2
0
        private void btnConstructCirculeArc_Click(object sender, EventArgs e)
        {
            if (gfactory == null)
                gfactory = new GeometryFactory();

            IPoint point1 = gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
            point1.SetCoords(3.56, 4, 5, 0, 1);
            IPoint point2 = gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
            point2.SetCoords(1, -1, 0, 0, 2);
            IPoint point3 = gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
            point3.SetCoords(2, 0, 0, 0, 3);

            circularArc = gfactory.CreateGeometry(gviGeometryType.gviGeometryCircularArc, gviVertexAttribute.gviVertexAttributeZ) as ICirculeArc;
            circularArc.ConstructThreePoints(point1, point2, point3);
            if (circularArc == null)
                return;

            CirculeArc geo = new CirculeArc();
            // Geometry属性
            geo.Dimension = circularArc.Dimension;
            if (circularArc.Envelope != null)
            {
                geo.MaxX = circularArc.Envelope.MaxX;
                geo.MaxY = circularArc.Envelope.MaxY;
                geo.MaxZ = circularArc.Envelope.MaxZ;
                geo.MinX = circularArc.Envelope.MinX;
                geo.MinY = circularArc.Envelope.MinY;
                geo.MinZ = circularArc.Envelope.MinZ;
            }
            geo.GeometryType = circularArc.GeometryType;
            geo.IsEmpty = circularArc.IsEmpty;
            geo.IsValid = circularArc.IsValid;
            geo.VertexAttribute = circularArc.VertexAttribute;
            geo.HasId = circularArc.HasId();
            geo.HasM = circularArc.HasM();
            geo.HasZ = circularArc.HasZ();
            // Curve属性
            geo.IsClosed = circularArc.IsClosed;
            geo.Length = circularArc.Length;
            if (circularArc.StartPoint != null)
            {
                geo.StartPointX = circularArc.StartPoint.X;
                geo.StartPointY = circularArc.StartPoint.Y;
                geo.StartPointZ = circularArc.StartPoint.Z;
            }
            if (circularArc.EndPoint != null)
            {
                geo.EndPointX = circularArc.EndPoint.X;
                geo.EndPointY = circularArc.EndPoint.Y;
                geo.EndPointZ = circularArc.EndPoint.Z;
            }
            // CirculeArc属性
            //if (circularArc.CenterPoint != null)
            //{
            //    geo.CenterPointX = circularArc.CenterPoint.X;
            //    geo.CenterPointY = circularArc.CenterPoint.Y;
            //    geo.CenterPointZ = circularArc.CenterPoint.Z;
            //}
            geo.CentralAngle = circularArc.CentralAngle;
            geo.ChordHeight = circularArc.ChordHeight;
            geo.ChordLength = circularArc.ChordLength;
            geo.IsLine = circularArc.IsLine;
            geo.IsMinor = circularArc.IsMinor;
            geo.IsPoint = circularArc.IsPoint;
            if (circularArc.PointOnArc != null)
            {
                geo.PointOnArcX = circularArc.PointOnArc.X;
                geo.PointOnArcY = circularArc.PointOnArc.Y;
                geo.PointOnArcZ = circularArc.PointOnArc.Z;
            }
            geo.Radius = circularArc.Radius;

            this.propertyGrid1.SelectedObject = geo;
        }