public void createVoronoiDiagram(string layername)
 {
     try
     {
         Geoprocessor gp = new Geoprocessor();
         gp.OverwriteOutput = false;
         IFeatureClass pInputFeatureClass = ChkMarkPoint.getFeatureLayer(layername).FeatureClass;
         MessageBox.Show("Choose the Save File of Voronoi Diagram");
         AutoChooseFile acf          = new AutoChooseFile();
         string         saveFilePath = acf.saveFullPathName();
         //CreateThiessenPolygons pCTP = new CreateThiessenPolygons(pInputFeatureClass, @"F:\Voronoi Land Cover\LC Voronoi.shp");
         CreateThiessenPolygons pCTP = new CreateThiessenPolygons(pInputFeatureClass, @saveFilePath);
         pCTP.fields_to_copy = "ALL";
         IGeoProcessorResult pGPR = gp.Execute(pCTP, null) as IGeoProcessorResult;
         for (int i = 0; i < gp.MessageCount; i++)
         {
             ChkMarkPoint.changeText(gp.GetMessage(i));
         }
         //IFeatureClass pOutFeatureClass = gp.Open(pGPR.ReturnValue) as IFeatureClass;
         //IFeatureLayer pFeatureLayer = new FeatureLayerClass();
         //pFeatureLayer.Name = "Voronoi";
         //pFeatureLayer.FeatureClass = pOutFeatureClass;
         //ChkMarkPoint.Mapcontr.Map.AddLayer(pFeatureLayer as ILayer);
         //ChkMarkPoint.Mapcontr.Refresh();
     }
     catch (System.Exception e)
     {
         ChkMarkPoint.changeText(e.Message);
     }
 }
        //标注提取的未扩展的湿地对象的代表性点
        public static void labelObjPoint(IGeoDataset pGeodataset, int objVal, string errstring)
        {
            IRaster           pRaster      = pGeodataset as IRaster;
            IRaster2          pRaster2     = pRaster as IRaster2;
            IRasterProps      pRasterProps = pRaster as IRasterProps;
            ISpatialReference pSR          = pGeodataset.SpatialReference;
            //获取图层的行列值
            int height = pRasterProps.Height;
            int width  = pRasterProps.Width;

            //定义并初始化数组,用于存储栅格内的所有像元值
            double[,] PixelVal = new double[height, width];
            //这是像素块大小
            IPnt blocksize = new PntClass();

            blocksize.SetCoords(256, 256);
            IRasterCursor pRasterCursor = pRaster2.CreateCursorEx(blocksize);

            //存储像素块的行列值、像素值
            System.Array pixels;
            IPixelBlock3 pPixelBlock3;

            do
            {
                int xunit = (int)pRasterCursor.TopLeft.X;
                int yunit = (int)pRasterCursor.TopLeft.Y;
                pPixelBlock3 = pRasterCursor.PixelBlock as IPixelBlock3;
                pixels       = (Array)pPixelBlock3.get_PixelData(0);
                for (int i = 0; i < pPixelBlock3.Height; i++)
                {
                    for (int j = 0; j < pPixelBlock3.Width; j++)
                    {
                        PixelVal[yunit + i, xunit + j] = Convert.ToDouble(pixels.GetValue(j, i));
                        if (PixelVal[yunit + i, xunit + j] == objVal)
                        {
                            IPoint pPoint = new PointClass();
                            pPoint.SpatialReference = pSR;
                            pPoint.X = pRaster2.ToMapX(xunit + j);
                            pPoint.Y = pRaster2.ToMapY(yunit + i);
                            ChkMarkPoint.insertChkPoint("cglc_chkmark", pPoint as IGeometry, errstring);
                            //MessageBox.Show("Neighborhood Relation Checking Complete...");
                            return;
                        }
                    }
                }
            } while (pRasterCursor.Next());
        }