Ejemplo n.º 1
0
        //插入实体对象集
        private void insertGeometriesCollectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IGeometryCollection geometryCollection1 = new MultipointClass();
            IGeometryCollection geometryCollection2 = new MultipointClass();
            IGeometryCollection geometryCollection3 = new MultipointClass();
            IGeometryCollection geometryCollection4 = new MultipointClass();
            IMultipoint         multipoint;
            object missing = Type.Missing;
            IPoint point;

            //创建3个实体对象集
            for (int i = 0; i < 10; i++)
            {
                point = new PointClass();
                point.PutCoords(i * 2, i);
                geometryCollection1.AddGeometry(point as IGeometry, ref missing, ref missing);
            }
            for (int i = 0; i < 10; i++)
            {
                point = new PointClass();
                point.PutCoords(i, i);
                geometryCollection2.AddGeometry(point as IGeometry, ref missing, ref missing);
            }
            for (int i = 0; i < 10; i++)
            {
                point = new PointClass();
                point.PutCoords(i, i * 2);
                geometryCollection3.AddGeometry(point as IGeometry, ref missing, ref missing);
            }
            geometryCollection1.InsertGeometryCollection(1, geometryCollection2);
            geometryCollection1.InsertGeometryCollection(1, geometryCollection3);

            multipoint = geometryCollection1 as IMultipoint;
            addFeature("multipoint", multipoint as IGeometry);
            this.axMapControl1.Extent = multipoint.Envelope;
            this.axMapControl1.Refresh();
        }