示例#1
0
        public IFeatureClass createPolygons()
        {
            IRasterProps rsProp = (IRasterProps)inputRaster;

            IPnt   rsPnt    = rsProp.MeanCellSize();
            double cellArea = rsPnt.X * rsPnt.Y;
            double tCells   = minArea / cellArea;
            int    rws      = (int)Math.Sqrt(tCells);

            if (rws < 3)
            {
                rws = 3;
            }
            int clms = rws;

            esriUtil.Statistics.dataPrepClusterBinary dpClus = new Statistics.dataPrepClusterBinary(inputRaster, specificity, 100000, 0.001);
            IRaster clusRs = rsUtil.createRaster(rsUtil.calcClustFunctionBinary(inputRaster, dpClus));

            Console.WriteLine("Exracting Domains");
            extractDomains(clusRs, dpClus);
            //IFeatureCursor ftrCur = outftr.Search(null, false);
            //IFeature ftr = ftrCur.NextFeature();
            //Console.WriteLine("removing small polygons");
            //while (ftr != null)
            //{
            //    IArea pArea = (IArea)ftr.Shape;
            //    double area = pArea.Area;
            //    if (area < MinArea)
            //    {
            //        addToNeighboringFeature(ftr, outftr, dpClus);
            //    }
            //    ftr = ftrCur.NextFeature();
            //}
            //Console.WriteLine("splitting large polygons");
            //ftrCur = outftr.Search(null, false);
            //ftr = ftrCur.NextFeature();
            //while (ftr != null)
            //{
            //    IArea pArea = (IArea)ftr.Shape;
            //    double area = pArea.Area;
            //    if (area > MaxArea)
            //    {
            //        splitFeature(ftr, outftr, true);
            //    }
            //    ftr = ftrCur.NextFeature();
            //}
            //System.Runtime.InteropServices.Marshal.ReleaseComObject(ftrCur);
            return(outftr);
        }