示例#1
0
        //public IFeatureClass createPolygons3()
        //{
        //    createFeatureClass();

        //}
        public IFeatureClass createPolygons2()
        {
            createFeatureClass();
            IRasterProps           rsProp   = (IRasterProps)inputRaster;
            int                    bndCnt   = ((IRasterBandCollection)inputRaster).Count;
            IPnt                   rsPnt    = rsProp.MeanCellSize();
            double                 cellArea = rsPnt.X * rsPnt.Y;
            double                 tCells   = minArea / cellArea;
            IFunctionRasterDataset sDset    = rsUtil.createMeanShiftFuction(inputRaster, (int)tCells);

            FunctionRasters.meanShiftFunctionDataset rFunc = (FunctionRasters.meanShiftFunctionDataset)sDset.Function;
            IRaster2               rs2   = (IRaster2)rsUtil.createRaster(sDset);
            IRasterCursor          rsCur = rs2.CreateCursorEx(null);
            IRasterDomainExtractor dExt  = new RasterDomainExtractorClass();

            do
            {
                IPixelBlock            pb     = rsCur.PixelBlock;
                IFunctionRasterDataset pbDset = rsUtil.PixelBlockToRaster(pb, rsCur.TopLeft, sDset);
                IRaster rs          = rsUtil.createRaster(pbDset);
                int     numClusters = rFunc.NumClusters;
                for (int c = 0; c < numClusters; c++)
                {
                    IFunctionRasterDataset fd  = rsUtil.calcEqualFunction(pbDset, c);
                    IFunctionRasterDataset fd2 = rsUtil.setNullValue(fd, 0);
                    IPolygon polys             = dExt.ExtractDomain(rsUtil.createRaster(fd2), true);
                }
            } while (rsCur.Next() == true);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(rsCur);



            return(outftr);
        }
 public IFunctionRasterDataset createMeanShiftFuction(object inRaster, int minCells)
 {
     IFunctionRasterDataset rRst = createIdentityRaster(inRaster);
     string tempAr = funcDir + "\\" + FuncCnt + ".afr";
     IFunctionRasterDataset frDset = new FunctionRasterDatasetClass();
     IFunctionRasterDatasetName frDsetName = new FunctionRasterDatasetNameClass();
     frDsetName.FullName = tempAr;
     frDset.FullName = (IName)frDsetName;
     IRasterFunction rsFunc = new FunctionRasters.meanShiftFunctionDataset();
     FunctionRasters.meanShiftFunctionArguments args = new FunctionRasters.meanShiftFunctionArguments(this);
     args.ValueRaster = rRst;
     args.MinCells = minCells;
     frDset.Init(rsFunc, args);
     return frDset;
 }