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

            modelPoint = gfactory.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ) as IModelPoint;
            modelPoint.SetCoords(100, 200, 300, 0, 0);
            modelPoint.ModelName = "testModel";
            //IMatrix matrix = new Matrix();
            //matrix.MakeIdentity();
            //modelPoint.Matrix33 = matrix as Array;
            IEnvelope boundingBox = new Envelope();
            boundingBox.Set(50, 60, 70, 150, 160, 170);
            modelPoint.ModelEnvelope = boundingBox;

            if (modelPoint == null)
                return;

            ModelPoint geo = new ModelPoint();
            // Geometry属性
            geo.Dimension = modelPoint.Dimension;
            if (modelPoint.Envelope != null)
            {
                geo.MaxX = modelPoint.Envelope.MaxX;
                geo.MaxY = modelPoint.Envelope.MaxY;
                geo.MaxZ = modelPoint.Envelope.MaxZ;
                geo.MinX = modelPoint.Envelope.MinX;
                geo.MinY = modelPoint.Envelope.MinY;
                geo.MinZ = modelPoint.Envelope.MinZ;
            }
            geo.GeometryType = modelPoint.GeometryType;
            geo.IsEmpty = modelPoint.IsEmpty;
            geo.IsValid = modelPoint.IsValid;
            geo.VertexAttribute = modelPoint.VertexAttribute;
            geo.HasId = modelPoint.HasId();
            geo.HasM = modelPoint.HasM();
            geo.HasZ = modelPoint.HasZ();
            // Point属性
            geo.Id = modelPoint.Id;
            geo.M = modelPoint.M;
            geo.X = modelPoint.X;
            geo.Y = modelPoint.Y;
            geo.Z = modelPoint.Z;
            // modelPoint属性
            geo.Matrix33 = modelPoint.Matrix33;
            if (modelPoint.ModelEnvelope != null)
            {
                geo.ModelEnvelopeMaxX = modelPoint.ModelEnvelope.MaxX;
                geo.ModelEnvelopeMaxY = modelPoint.ModelEnvelope.MaxY;
                geo.ModelEnvelopeMaxZ = modelPoint.ModelEnvelope.MaxZ;
                geo.ModelEnvelopeMinX = modelPoint.ModelEnvelope.MinX;
                geo.ModelEnvelopeMinY = modelPoint.ModelEnvelope.MinY;
                geo.ModelEnvelopeMinZ = modelPoint.ModelEnvelope.MinZ;
            }
            geo.ModelName = modelPoint.ModelName;

            this.propertyGrid1.SelectedObject = geo;
        }