Esempio n. 1
0
 public void Bind(object pArgument)
 {
     if (pArgument is aggregationFunctionArguments)
     {
         aggregationFunctionArguments args = (aggregationFunctionArguments)pArgument;
         inrs  = args.InRaster;
         orig  = args.OriginalRaster;
         cells = args.Cells;
         myFunctionHelper.Bind(inrs);
         myFunctionHelperOrig.Bind(orig);
         //System.Windows.Forms.MessageBox.Show(orig.RasterInfo.CellSize.X.ToString()+"\n" + inrs.RasterInfo.CellSize.X.ToString());
         myRasterInfo = myFunctionHelper.RasterInfo;
         myPixeltype  = myRasterInfo.PixelType;
         myValidFlag  = true;
     }
     else
     {
         throw new System.Exception("Incorrect arguments object. Expected: aggregationFunctonArguments");
     }
 }
 /// <summary>
 /// performs block summarization
 /// </summary>
 /// <param name="inRaster"></param>
 /// <param name="outWks"></param>
 /// <param name="outRsName"></param>
 /// <param name="numCells"></param>
 /// <returns></returns>
 public IFunctionRasterDataset calcAggregationFunction(object inRaster, int cells, focalType statType)
 {
     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 = null;
     switch (statType)
     {
         case focalType.MIN:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperMin();
             break;
         case focalType.SUM:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperSum();
             break;
         case focalType.MEAN:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperMean();
             break;
         case focalType.MODE:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperMode();
             break;
         case focalType.MEDIAN:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperMedian();
             break;
         case focalType.VARIANCE:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperVar();
             break;
         case focalType.STD:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperStd();
             break;
         case focalType.UNIQUE:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperUnique();
             break;
         case focalType.ENTROPY:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperEntropy();
             break;
         case focalType.ASM:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperASM();
             break;
         default:
             rsFunc = new FunctionRasters.NeighborhoodHelper.aggregationHelperMax();
             break;
     }
     FunctionRasters.aggregationFunctionArguments args = new FunctionRasters.aggregationFunctionArguments(this);
     args.Cells = cells;
     args.InRaster = iR1;
     frDset.Init(rsFunc, args);
     return frDset;
 }