Example #1
0
 public void Bind(object pArgument)
 {
     if (pArgument is LandscapeFunctionArguments)
     {
         LandscapeFunctionArguments args = (LandscapeFunctionArguments)pArgument;
         inrs     = args.InRaster;
         orig     = args.OriginalRaster;
         inop     = args.Operation;
         landType = args.LandscapeType;
         inWindow = args.WindowType;
         clms     = args.Columns;
         rws      = args.Rows;
         radius   = args.Radius;
         myFunctionHelper.Bind(inrs);
         myFunctionHelperCoef.Bind(orig);
         myRasterInfo = myFunctionHelper.RasterInfo;
         myPixeltype  = myRasterInfo.PixelType;
         myValidFlag  = true;
     }
     else
     {
         throw new System.Exception("Incorrect arguments object. Expected: FocalFunctonArguments");
     }
 }
 /// <summary>
 /// Will perform a focal raster operation on an input raster all bands
 /// </summary>
 /// <param name="inRaster">either IRaster, IRasterDataset, or a valid path pointing to a raster</param>
 /// <param name="radius">number of cells that make up the radius of the moving window</param>
 /// <param name="statType">the type of operation</param>
 /// <param name="landType">the type of metric</param>
 /// <returns>a IRaster that can be used for further analysis</returns>
 public IFunctionRasterDataset calcLandscapeFunction(object inRaster, int radius, focalType statType, landscapeType landType)
 {
     IFunctionRasterDataset iR1 = 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.landscapeFunctionDataset();
     FunctionRasters.LandscapeFunctionArguments args = new FunctionRasters.LandscapeFunctionArguments(this);
     args.WindowType = windowType.CIRCLE;
     args.Radius = radius;
     args.InRaster = iR1;
     args.Operation = statType;
     args.LandscapeType = landType;
     frDset.Init(rsFunc, args);
     return frDset;
 }